Make PERL_PATCHLEVEL a single value quoted string
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist 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 Thu Dec 25 12:54:36 CET 2008 [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 echo " "
6370 val="$undef"
6371 case "$d_suidsafe" in
6372 "$define")
6373         val="$undef"
6374         echo "No need to emulate SUID scripts since they are secure here." >&4
6375         ;;
6376 *)
6377         $cat <<EOM
6378 Some systems have disabled setuid scripts, especially systems where
6379 setuid scripts cannot be secure.  On systems where setuid scripts have
6380 been disabled, the setuid/setgid bits on scripts are currently
6381 useless.  It is possible for $package to detect those bits and emulate
6382 setuid/setgid in a secure fashion.  This emulation will only work if
6383 setuid scripts have been disabled in your kernel.
6384
6385 EOM
6386         case "$d_dosuid" in
6387         "$define") dflt=y ;;
6388         *) dflt=n ;;
6389         esac
6390         rp="Do you want to do setuid/setgid emulation?"
6391         . ./myread
6392         case "$ans" in
6393         [yY]*)  val="$define";;
6394         *)      val="$undef";;
6395         esac
6396         ;;
6397 esac
6398 set d_dosuid
6399 eval $setvar
6400
6401 : Find perl5.005 or later.
6402 echo "Looking for a previously installed perl5.005 or later... "
6403 case "$perl5" in
6404 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6405                 : Check if this perl is recent and can load a simple module
6406                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6407                         perl5=$tdir/perl
6408                         break;
6409                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6410                         perl5=$tdir/perl5
6411                         break;
6412                 fi
6413         done
6414         ;;
6415 *)      perl5="$perl5"
6416         ;;
6417 esac
6418 case "$perl5" in
6419 '')     echo "None found.  That's ok.";;
6420 *)      echo "Using $perl5." ;;
6421 esac
6422
6423 : Set the siteprefix variables
6424 $cat <<EOM
6425
6426 After $package is installed, you may wish to install various
6427 add-on modules and utilities.  Typically, these add-ons will
6428 be installed under $prefix with the rest
6429 of this package.  However, you may wish to install such add-ons
6430 elsewhere under a different prefix.
6431
6432 If you do not wish to put everything under a single prefix, that's
6433 ok.  You will be prompted for the individual locations; this siteprefix
6434 is only used to suggest the defaults.
6435
6436 The default should be fine for most people.
6437
6438 EOM
6439 fn=d~+
6440 rp='Installation prefix to use for add-on modules and utilities?'
6441 : XXX Here might be another good place for an installstyle setting.
6442 case "$siteprefix" in
6443 '') dflt=$prefix ;;
6444 *)  dflt=$siteprefix ;;
6445 esac
6446 . ./getfile
6447 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6448 oldsiteprefix=''
6449 case "$siteprefix" in
6450 '') ;;
6451 *)      case "$ans" in
6452         "$prefix") ;;
6453         *) oldsiteprefix="$prefix";;
6454         esac
6455         ;;
6456 esac
6457 siteprefix="$ans"
6458 siteprefixexp="$ansexp"
6459
6460 : determine where site specific libraries go.
6461 : Usual default is /usr/local/lib/perl5/site_perl/$version
6462 : The default "style" setting is made in installstyle.U
6463 : XXX No longer works with Prefixit stuff.
6464 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6465 case "$sitelib" in
6466 '') case "$installstyle" in
6467         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6468         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6469         esac
6470         ;;
6471 *)      dflt="$sitelib"
6472         ;;
6473 esac
6474 $cat <<EOM
6475
6476 The installation process will create a directory for
6477 site-specific extensions and modules.  Most users find it convenient
6478 to place all site-specific files in this directory rather than in the
6479 main distribution directory.
6480
6481 EOM
6482 fn=d~+
6483 rp='Pathname for the site-specific library files?'
6484 . ./getfile
6485 prefixvar=sitelib
6486 . ./setprefixvar
6487 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6488
6489 : Determine list of previous versions to include in @INC
6490 $cat > getverlist <<EOPL
6491 #!$perl5 -w
6492 use File::Basename;
6493 \$api_versionstring = "$api_versionstring";
6494 \$version = "$version";
6495 \$stem = "$sitelib_stem";
6496 \$archname = "$archname";
6497 EOPL
6498         $cat >> getverlist <<'EOPL'
6499 # The list found is store twice for each entry: the original name, and
6500 # the binary broken down version as pack "sss", so sorting is easy and
6501 # unambiguous. This will work for all versions that have a maximum of
6502 # three digit groups, separate by '.'s or '_'s. Names are extended with
6503 # ".0.0" to ensure at least three elements for the pack.
6504 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6505
6506 # Can't have leading @ because metaconfig interprets it as a command!
6507 ;@inc_version_list=();
6508 # XXX Redo to do opendir/readdir?
6509 if (-d $stem) {
6510     chdir($stem);
6511     ;@candidates = map {
6512         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6513 }
6514 else {
6515     ;@candidates = ();
6516 }
6517
6518 ($pversion, $aversion, $vsn5005) = map {
6519     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6520 foreach $d (@candidates) {
6521     if ($d->[1] lt $pversion) {
6522         if ($d->[1] ge $aversion) {
6523             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6524         }
6525         elsif ($d->[1] ge $vsn5005) {
6526             unshift(@inc_version_list, grep { -d } $d->[0]);
6527         }
6528     }
6529     else {
6530         # Skip newer version.  I.e. don't look in
6531         # 5.7.0 if we're installing 5.6.1.
6532     }
6533 }
6534
6535 if (@inc_version_list) {
6536     print join(' ', @inc_version_list);
6537 }
6538 else {
6539     # Blank space to preserve value for next Configure run.
6540     print " ";
6541 }
6542 EOPL
6543 chmod +x getverlist
6544 case "$inc_version_list" in
6545 '')     if test -x "$perl5$exe_ext"; then
6546                 dflt=`$perl5 getverlist`
6547         else
6548                 dflt='none'
6549         fi
6550         ;;
6551 $undef) dflt='none' ;;
6552 *)  eval dflt=\"$inc_version_list\" ;;
6553 esac
6554 case "$dflt" in
6555 ''|' ') dflt=none ;;
6556 esac
6557 case "$dflt" in
6558 5.005) dflt=none ;;
6559 esac
6560 $cat <<EOM
6561
6562 In order to ease the process of upgrading, this version of perl
6563 can be configured to use modules built and installed with earlier
6564 versions of perl that were installed under $prefix.  Specify here
6565 the list of earlier versions that this version of perl should check.
6566 If Configure detected no earlier versions of perl installed under
6567 $prefix, then the list will be empty.  Answer 'none' to tell perl
6568 to not search earlier versions.
6569
6570 The default should almost always be sensible, so if you're not sure,
6571 just accept the default.
6572 EOM
6573
6574 rp='List of earlier versions to include in @INC?'
6575 . ./myread
6576 case "$ans" in
6577 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6578 *) inc_version_list="$ans" ;;
6579 esac
6580 case "$inc_version_list" in
6581 ''|' ')
6582         inc_version_list_init='0'
6583         d_inc_version_list="$undef"
6584         ;;
6585 *)      inc_version_list_init=`echo $inc_version_list |
6586                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6587         d_inc_version_list="$define"
6588         ;;
6589 esac
6590 $rm -f getverlist
6591
6592 : see if malloc/malloc.h has to be included
6593 set malloc/malloc.h i_mallocmalloc
6594 eval $inhdr
6595
6596 : see if this is a malloc.h system
6597 : we want a real compile instead of Inhdr because some systems have a
6598 : malloc.h that just gives a compile error saying to use stdlib.h instead
6599 echo " "
6600 $cat >try.c <<EOCP
6601 #include <stdlib.h>
6602 #include <malloc.h>
6603 #$i_mallocmalloc I_MALLOCMALLOC
6604 #ifdef I_MALLOCMALLOC
6605 # include <malloc/malloc.h>
6606 #endif
6607
6608 int main () { return 0; }
6609 EOCP
6610 set try
6611 if eval $compile; then
6612     echo "<malloc.h> found." >&4
6613     val="$define"
6614 else
6615     echo "<malloc.h> NOT found." >&4
6616     val="$undef"
6617 fi
6618 $rm_try
6619 set i_malloc
6620 eval $setvar
6621
6622 : check for void type
6623 echo " "
6624 echo "Checking to see how well your C compiler groks the void type..." >&4
6625 case "$voidflags" in
6626 '')
6627         $cat >try.c <<EOCP
6628 #$i_stdlib I_STDLIB
6629 #ifdef I_STDLIB
6630 #include <stdlib.h>
6631 #endif
6632 #if TRY & 1
6633 void sub() {
6634 #else
6635 sub() {
6636 #endif
6637         extern void moo();      /* function returning void */
6638         void (*goo)();          /* ptr to func returning void */
6639 #if TRY & 8
6640         void *hue;              /* generic ptr */
6641 #endif
6642 #if TRY & 2
6643         void (*foo[10])();
6644 #endif
6645
6646 #if TRY & 4
6647         if(goo == moo) {
6648                 exit(0);
6649         }
6650 #endif
6651         exit(0);
6652 }
6653 int main() { sub(); }
6654 EOCP
6655         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6656                 voidflags=$defvoidused
6657         echo "Good.  It appears to support void to the level $package wants.">&4
6658                 if $contains warning .out >/dev/null 2>&1; then
6659                         echo "However, you might get some warnings that look like this:"
6660                         $cat .out
6661                 fi
6662         else
6663 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6664                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6665                         echo "It supports 1..."
6666                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6667                                 echo "It also supports 2..."
6668                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6669                                         voidflags=7
6670                                         echo "And it supports 4 but not 8 definitely."
6671                                 else
6672                                         echo "It doesn't support 4..."
6673                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6674                                                 voidflags=11
6675                                                 echo "But it supports 8."
6676                                         else
6677                                                 voidflags=3
6678                                                 echo "Neither does it support 8."
6679                                         fi
6680                                 fi
6681                         else
6682                                 echo "It does not support 2..."
6683                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6684                                         voidflags=13
6685                                         echo "But it supports 4 and 8."
6686                                 else
6687                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6688                                                 voidflags=5
6689                                                 echo "And it supports 4 but has not heard about 8."
6690                                         else
6691                                                 echo "However it supports 8 but not 4."
6692                                         fi
6693                                 fi
6694                         fi
6695                 else
6696                         echo "There is no support at all for void."
6697                         voidflags=0
6698                 fi
6699         fi
6700 esac
6701 case "$voidflags" in
6702 "$defvoidused") ;;
6703 *)      $cat >&4 <<'EOM'
6704   Support flag bits are:
6705     1: basic void declarations.
6706     2: arrays of pointers to functions returning void.
6707     4: operations between pointers to and addresses of void functions.
6708     8: generic void pointers.
6709 EOM
6710         dflt="$voidflags";
6711         rp="Your void support flags add up to what?"
6712         . ./myread
6713         voidflags="$ans"
6714         ;;
6715 esac
6716 $rm_try
6717
6718 : check for length of pointer
6719 echo " "
6720 case "$ptrsize" in
6721 '')
6722         echo "Checking to see how big your pointers are..." >&4
6723         if test "$voidflags" -gt 7; then
6724                 echo '#define VOID_PTR char *' > try.c
6725         else
6726                 echo '#define VOID_PTR void *' > try.c
6727         fi
6728         $cat >>try.c <<EOCP
6729 #include <stdio.h>
6730 #$i_stdlib I_STDLIB
6731 #ifdef I_STDLIB
6732 #include <stdlib.h>
6733 #endif
6734 int main()
6735 {
6736     printf("%d\n", (int)sizeof(VOID_PTR));
6737     exit(0);
6738 }
6739 EOCP
6740         set try
6741         if eval $compile_ok; then
6742                 ptrsize=`$run ./try`
6743                 echo "Your pointers are $ptrsize bytes long."
6744         else
6745                 dflt='4'
6746                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6747                 rp="What is the size of a pointer (in bytes)?"
6748                 . ./myread
6749                 ptrsize="$ans"
6750         fi
6751         ;;
6752 esac
6753 $rm_try
6754 case "$use64bitall" in
6755 "$define"|true|[yY]*)
6756         case "$ptrsize" in
6757         4)      cat <<EOM >&4
6758
6759 *** You have chosen a maximally 64-bit build,
6760 *** but your pointers are only 4 bytes wide.
6761 *** Please rerun Configure without -Duse64bitall.
6762 EOM
6763                 case "$d_quad" in
6764                 define)
6765                         cat <<EOM >&4
6766 *** Since you have quads, you could possibly try with -Duse64bitint.
6767 EOM
6768                         ;;
6769                 esac
6770                 cat <<EOM >&4
6771 *** Cannot continue, aborting.
6772
6773 EOM
6774
6775                 exit 1
6776                 ;;
6777         esac
6778         ;;
6779 esac
6780
6781
6782 : determine whether to use malloc wrapping
6783 echo " "
6784 case "$usemallocwrap" in
6785 [yY]*|true|$define)     dflt='y' ;;
6786 [nN]*|false|$undef)     dflt='n' ;;
6787 *)      case "$usedevel" in
6788         [yY]*|true|$define)     dflt='y' ;;
6789         *) dflt='n' ;;
6790         esac
6791         ;;
6792 esac
6793 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6794 . ./myread
6795 usemallocwrap="$ans"
6796 case "$ans" in
6797 y*|true)
6798         usemallocwrap="$define" ;;
6799 *)
6800         usemallocwrap="$undef" ;;
6801 esac
6802
6803 : determine which malloc to compile in
6804 echo " "
6805 case "$usemymalloc" in
6806 [yY]*|true|$define)     dflt='y' ;;
6807 [nN]*|false|$undef)     dflt='n' ;;
6808 *)      case "$ptrsize" in
6809         4) dflt='y' ;;
6810         *) dflt='n' ;;
6811         esac
6812         ;;
6813 esac
6814 rp="Do you wish to attempt to use the malloc that comes with $package?"
6815 . ./myread
6816 usemymalloc="$ans"
6817 case "$ans" in
6818 y*|true)
6819         usemymalloc='y'
6820         mallocsrc='malloc.c'
6821         mallocobj="malloc$_o"
6822         d_mymalloc="$define"
6823         case "$libs" in
6824         *-lmalloc*)
6825                 : Remove malloc from list of libraries to use
6826                 echo "Removing unneeded -lmalloc from library list" >&4
6827                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6828                 shift
6829                 libs="$*"
6830                 echo "libs = $libs" >&4
6831                 ;;
6832         esac
6833         ;;
6834 *)
6835         usemymalloc='n'
6836         mallocsrc=''
6837         mallocobj=''
6838         d_mymalloc="$undef"
6839         ;;
6840 esac
6841
6842 : compute the return types of malloc and free
6843 echo " "
6844 $cat >malloc.c <<END
6845 #$i_malloc I_MALLOC
6846 #$i_stdlib I_STDLIB
6847 #include <stdio.h>
6848 #include <sys/types.h>
6849 #ifdef I_MALLOC
6850 #include <malloc.h>
6851 #endif
6852 #ifdef I_STDLIB
6853 #include <stdlib.h>
6854 #endif
6855 #ifdef TRY_MALLOC
6856 void *malloc();
6857 #endif
6858 #ifdef TRY_FREE
6859 void free();
6860 #endif
6861 END
6862 case "$malloctype" in
6863 '')
6864         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6865                 malloctype='void *'
6866         else
6867                 malloctype='char *'
6868         fi
6869         ;;
6870 esac
6871 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6872
6873 case "$freetype" in
6874 '')
6875         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6876                 freetype='void'
6877         else
6878                 freetype='int'
6879         fi
6880         ;;
6881 esac
6882 echo "Your system uses $freetype free(), it would seem." >&4
6883 $rm -f malloc.[co]
6884 : determine where site specific architecture-dependent libraries go.
6885 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6886 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6887 : sitelib may have an optional trailing /share.
6888 case "$sitearch" in
6889 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6890         dflt="$dflt/$archname"
6891         ;;
6892 *)      dflt="$sitearch"
6893         ;;
6894 esac
6895 set sitearch sitearch none
6896 eval $prefixit
6897 $cat <<EOM
6898
6899 The installation process will also create a directory for
6900 architecture-dependent site-specific extensions and modules.
6901
6902 EOM
6903 fn=d~+
6904 rp='Pathname for the site-specific architecture-dependent library files?'
6905 . ./getfile
6906 prefixvar=sitearch
6907 . ./setprefixvar
6908 if $test X"$sitearch" = X"$sitelib"; then
6909         d_sitearch="$undef"
6910 else
6911         d_sitearch="$define"
6912 fi
6913
6914 : Set the vendorprefix variables
6915 $cat <<EOM
6916
6917 The installation process will also create a directory for
6918 vendor-supplied add-ons.  Vendors who supply perl with their system
6919 may find it convenient to place all vendor-supplied files in this
6920 directory rather than in the main distribution directory.  This will
6921 ease upgrades between binary-compatible maintenance versions of perl.
6922
6923 Of course you may also use these directories in whatever way you see
6924 fit.  For example, you might use them to access modules shared over a
6925 company-wide network.
6926
6927 The default answer should be fine for most people.
6928 This causes further questions about vendor add-ons to be skipped
6929 and no vendor-specific directories will be configured for perl.
6930
6931 EOM
6932 rp='Do you want to configure vendor-specific add-on directories?'
6933 case "$usevendorprefix" in
6934 define|true|[yY]*) dflt=y ;;
6935 *)      : User may have set vendorprefix directly on Configure command line.
6936         case "$vendorprefix" in
6937         ''|' ') dflt=n ;;
6938         *)      dflt=y ;;
6939         esac
6940         ;;
6941 esac
6942 . ./myread
6943 case "$ans" in
6944 [yY]*)  fn=d~+
6945         rp='Installation prefix to use for vendor-supplied add-ons?'
6946         case "$vendorprefix" in
6947         '') dflt='' ;;
6948         *)  dflt=$vendorprefix ;;
6949         esac
6950         . ./getfile
6951         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6952         oldvendorprefix=''
6953         case "$vendorprefix" in
6954         '') ;;
6955         *)      case "$ans" in
6956                 "$prefix") ;;
6957                 *) oldvendorprefix="$prefix";;
6958                 esac
6959                 ;;
6960         esac
6961         usevendorprefix="$define"
6962         vendorprefix="$ans"
6963         vendorprefixexp="$ansexp"
6964         ;;
6965 *)      usevendorprefix="$undef"
6966         vendorprefix=''
6967         vendorprefixexp=''
6968         ;;
6969 esac
6970
6971 : Set the vendorlib variables
6972 case "$vendorprefix" in
6973 '')     d_vendorlib="$undef"
6974         vendorlib=''
6975         vendorlibexp=''
6976         ;;
6977 *)      d_vendorlib="$define"
6978         : determine where vendor-supplied modules go.
6979         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6980         case "$vendorlib" in
6981         '')
6982                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6983                 case "$installstyle" in
6984                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6985                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6986                 esac
6987                 ;;
6988         *)      dflt="$vendorlib"
6989                 ;;
6990         esac
6991         fn=d~+
6992         rp='Pathname for the vendor-supplied library files?'
6993         . ./getfile
6994         vendorlib="$ans"
6995         vendorlibexp="$ansexp"
6996         ;;
6997 esac
6998 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6999 prefixvar=vendorlib
7000 . ./installprefix
7001
7002 : Set the vendorarch variables
7003 case "$vendorprefix" in
7004 '')     d_vendorarch="$undef"
7005         vendorarch=''
7006         vendorarchexp=''
7007         ;;
7008 *)      d_vendorarch="$define"
7009         : determine where vendor-supplied architecture-dependent libraries go.
7010         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7011         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7012         : vendorlib may have an optional trailing /share.
7013         case "$vendorarch" in
7014         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7015                 dflt="$dflt/$archname"
7016                 ;;
7017         *)      dflt="$vendorarch" ;;
7018         esac
7019         fn=d~+
7020         rp='Pathname for vendor-supplied architecture-dependent files?'
7021         . ./getfile
7022         vendorarch="$ans"
7023         vendorarchexp="$ansexp"
7024         ;;
7025 esac
7026 prefixvar=vendorarch
7027 . ./installprefix
7028 if $test X"$vendorarch" = X"$vendorlib"; then
7029         d_vendorarch="$undef"
7030 else
7031         d_vendorarch="$define"
7032 fi
7033
7034 : Final catch-all directories to search
7035 $cat <<EOM
7036
7037 Lastly, you can have perl look in other directories for extensions and
7038 modules in addition to those already specified.
7039 These directories will be searched after 
7040         $sitearch 
7041         $sitelib 
7042 EOM
7043 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7044 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7045 echo ' '
7046 case "$otherlibdirs" in
7047 ''|' ') dflt='none' ;;
7048 *)      dflt="$otherlibdirs" ;;
7049 esac
7050 $cat <<EOM
7051 Enter a colon-separated set of extra paths to include in perl's @INC
7052 search path, or enter 'none' for no extra paths.
7053
7054 EOM
7055
7056 rp='Colon-separated list of additional directories for perl to search?'
7057 . ./myread
7058 case "$ans" in
7059 ' '|''|none)    otherlibdirs=' ' ;;     
7060 *)      otherlibdirs="$ans" ;;
7061 esac
7062 case "$otherlibdirs" in
7063 ' ') val=$undef ;;
7064 *)      val=$define ;;
7065 esac
7066 set d_perl_otherlibdirs
7067 eval $setvar
7068
7069 : Cruising for prototypes
7070 echo " "
7071 echo "Checking out function prototypes..." >&4
7072 $cat >prototype.c <<EOCP
7073 #$i_stdlib I_STDLIB
7074 #ifdef I_STDLIB
7075 #include <stdlib.h>
7076 #endif
7077 int main(int argc, char *argv[]) {
7078         exit(0);}
7079 EOCP
7080 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7081         echo "Your C compiler appears to support function prototypes."
7082         val="$define"
7083 else
7084         echo "Your C compiler doesn't seem to understand function prototypes."
7085         val="$undef"
7086 fi
7087 set prototype
7088 eval $setvar
7089 $rm -f prototype*
7090
7091 : Check if ansi2knr is required
7092 case "$prototype" in
7093 "$define") ;;
7094 *)      ansi2knr='ansi2knr'
7095         echo " "
7096         cat <<EOM >&4
7097
7098 $me:  FATAL ERROR:
7099 This version of $package can only be compiled by a compiler that 
7100 understands function prototypes.  Unfortunately, your C compiler 
7101         $cc $ccflags
7102 doesn't seem to understand them.  Sorry about that.
7103
7104 If GNU cc is available for your system, perhaps you could try that instead.  
7105
7106 Eventually, we hope to support building Perl with pre-ANSI compilers.
7107 If you would like to help in that effort, please contact <perlbug@perl.org>.
7108
7109 Aborting Configure now.
7110 EOM
7111         exit 2
7112         ;;
7113 esac
7114
7115 : DTrace support
7116 dflt_dtrace='/usr/sbin/dtrace'
7117 cat <<EOM
7118
7119 Perl can be built to support DTrace on platforms that support it.
7120 DTrace is a diagnosis and performance analysis tool from Sun.
7121
7122 If this doesn't make any sense to you, just accept the default '$dflt'.
7123 EOM
7124
7125 while $test 1 ; do
7126         case "$usedtrace" in
7127         $define|true|[yY]*)
7128                 dflt='y'
7129                 ;;
7130         ?*)
7131                 dflt='y'
7132                 dflt_dtrace=$usedtrace
7133                 ;;
7134         *)
7135                 dflt='n'
7136                 ;;
7137         esac
7138
7139         rp='Support DTrace if available?'
7140         . ./myread
7141         case "$ans" in
7142         y|Y)    val="$define" ;;
7143         *)      val="$undef" ;;
7144         esac
7145         set usedtrace
7146         eval $setvar
7147
7148         test "X$usedtrace" != "X$define" && break
7149
7150         echo " "
7151         rp='Where is the dtrace executable?'
7152         dflt=$dflt_dtrace
7153         . ./getfile
7154         val="$ans"
7155         set dtrace
7156         eval $setvar
7157
7158         if $test -f $dtrace
7159         then
7160                 if $dtrace -h -s ../perldtrace.d \
7161                         -o perldtrace.tmp >/dev/null 2>&1 \
7162                         && rm -f perldtrace.tmp
7163                 then
7164                         echo " "
7165                         echo "Good: your $dtrace knows about the -h flag."
7166                 else
7167                         cat >&2 <<EOM
7168
7169 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7170 ***
7171 *** Your installed dtrace doesn't support the -h switch to compile a D
7172 *** program into a C header. Can't continue.
7173
7174 EOM
7175                         exit 1
7176                 fi
7177                 break;
7178         fi
7179
7180         case "$fastread" in
7181         yes)
7182                 cat >&2 <<EOM
7183
7184 *** $me:  Fatal Error:  $dtrace not found.
7185 *** Can't continue.
7186
7187 EOM
7188                 exit 1
7189                 ;;
7190         *)
7191                 echo "*** $dtrace was not found."
7192                 echo " "
7193                 ;;
7194         esac
7195 done
7196
7197 : See if we want extra modules installed
7198 echo " "
7199 case "$extras" in
7200 '') dflt='n';;
7201 *) dflt='y';;
7202 esac
7203 cat <<EOM
7204 Perl can be built with extra modules or bundles of modules which
7205 will be fetched from the CPAN and installed alongside Perl.
7206
7207 Notice that you will need access to the CPAN; either via the Internet,
7208 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7209 be asked later to configure the CPAN.pm module which will in turn do
7210 the installation of the rest of the extra modules or bundles.)
7211
7212 Notice also that if the modules require any external software such as
7213 libraries and headers (the libz library and the zlib.h header for the
7214 Compress::Zlib module, for example) you MUST have any such software
7215 already installed, this configuration process will NOT install such
7216 things for you.
7217
7218 If this doesn't make any sense to you, just accept the default '$dflt'.
7219 EOM
7220 rp='Install any extra modules (y or n)?'
7221 . ./myread
7222 case "$ans" in
7223 y|Y)
7224         cat <<EOM
7225
7226 Please list any extra modules or bundles to be installed from CPAN,
7227 with spaces between the names.  The names can be in any format the
7228 'install' command of CPAN.pm will understand.  (Answer 'none',
7229 without the quotes, to install no extra modules or bundles.)
7230 EOM
7231         rp='Extras?'
7232         dflt="$extras"
7233         . ./myread
7234         extras="$ans"
7235 esac
7236 case "$extras" in
7237 ''|'none')
7238         val=''
7239         $rm -f ../extras.lst
7240         ;;
7241 *)      echo "(Saving the list of extras for later...)"
7242         echo "$extras" > ../extras.lst
7243         val="'$extras'"
7244         ;;
7245 esac
7246 set extras
7247 eval $setvar
7248 echo " "
7249
7250 : determine where html pages for programs go
7251 set html1dir html1dir none
7252 eval $prefixit
7253 $cat <<EOM
7254
7255 If you wish to install html files for programs in $spackage, indicate
7256 the appropriate directory here.  To skip installing html files,
7257 answer "none".
7258 EOM
7259 case "$html1dir" in
7260 ''|none|$undef|' ') dflt=none ;;
7261 *) dflt=$html1dir ;;
7262 esac
7263 fn=dn+~
7264 rp="Directory for the main $spackage html pages?"
7265 . ./getfile
7266 prefixvar=html1dir
7267 . ./setprefixvar
7268 : Use ' ' for none so value is preserved next time through Configure
7269 $test X"$html1dir" = "X" && html1dir=' '
7270
7271 : determine where html pages for libraries and modules go
7272 set html3dir html3dir none
7273 eval $prefixit
7274 $cat <<EOM
7275
7276 If you wish to install html files for modules associated with $spackage,
7277 indicate the appropriate directory here.  To skip installing html files,
7278 answer "none".
7279 EOM
7280 : There is no obvious default.  If they have specified html1dir, then
7281 : try to key off that, possibly changing .../html1 into .../html3.
7282 case "$html3dir" in
7283 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7284 *) dflt=$html3dir ;;
7285 esac
7286 fn=dn+~
7287 rp="Directory for the $spackage module html pages?"
7288 . ./getfile
7289 prefixvar=html3dir
7290 . ./setprefixvar
7291 : Use ' ' for none so value is preserved next time through Configure
7292 $test X"$html3dir" = "X" && html3dir=' '
7293
7294 : determine whether to install perl also as /usr/bin/perl
7295
7296 echo " "
7297 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7298         $cat <<EOM
7299 Many scripts expect perl to be installed as /usr/bin/perl.
7300
7301 If you want to, I can install the perl you are about to compile
7302 as /usr/bin/perl (in addition to $bin/perl).
7303 EOM
7304         if test -f /usr/bin/perl; then
7305             $cat <<EOM
7306
7307 However, please note that because you already have a /usr/bin/perl,
7308 overwriting that with a new Perl would very probably cause problems.
7309 Therefore I'm assuming you don't want to do that (unless you insist).
7310
7311 EOM
7312             case "$installusrbinperl" in
7313             "$define"|[yY]*)    dflt='y';;
7314             *)                  dflt='n';;
7315             esac
7316         else
7317             $cat <<EOM
7318
7319 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7320
7321 EOM
7322             case "$installusrbinperl" in
7323             "$undef"|[nN]*)     dflt='n';;
7324             *)                  dflt='y';;
7325             esac
7326         fi
7327         rp="Do you want to install perl as /usr/bin/perl?"
7328         . ./myread
7329         case "$ans" in
7330         [yY]*)  val="$define";;
7331         *)      val="$undef" ;;
7332         esac
7333 else
7334         val="$undef"
7335 fi
7336 set installusrbinperl
7337 eval $setvar
7338
7339 : Check if we are using the GNU C library
7340 echo " "
7341 echo "Checking for GNU C Library..." >&4
7342 cat >try.c <<'EOCP'
7343 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7344    alone are insufficient to distinguish different versions, such as
7345    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7346    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7347 */
7348 #include <stdio.h>
7349 int main(void)
7350 {
7351 #ifdef __GLIBC__
7352 #   ifdef __GLIBC_MINOR__
7353 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7354 #           include <gnu/libc-version.h>
7355             printf("%s\n",  gnu_get_libc_version());
7356 #       else
7357             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7358 #       endif
7359 #   else
7360         printf("%d\n",  __GLIBC__);
7361 #   endif
7362     return 0;
7363 #else
7364     return 1;
7365 #endif
7366 }
7367 EOCP
7368 set try
7369 if eval $compile_ok && $run ./try > glibc.ver; then
7370         val="$define"
7371         gnulibc_version=`$cat glibc.ver`
7372         echo "You are using the GNU C Library version $gnulibc_version"
7373 else
7374         val="$undef"
7375         gnulibc_version=''
7376         echo "You are not using the GNU C Library"
7377 fi
7378 $rm_try glibc.ver
7379 set d_gnulibc
7380 eval $setvar
7381
7382 : see if nm is to be used to determine whether a symbol is defined or not
7383 case "$usenm" in
7384 '')
7385         dflt=''
7386         case "$d_gnulibc" in
7387         "$define")
7388                 echo " "
7389                 echo "nm probably won't work on the GNU C Library." >&4
7390                 dflt=n
7391                 ;;
7392         esac
7393         case "$dflt" in
7394         '') 
7395                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7396                         echo " "
7397                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7398                         echo "'nm' won't be sufficient on this sytem." >&4
7399                         dflt=n
7400                 fi
7401                 ;;
7402         esac
7403         case "$dflt" in
7404         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7405                 if $test $dflt -gt 20; then
7406                         dflt=y
7407                 else
7408                         dflt=n
7409                 fi
7410                 ;;
7411         esac
7412         ;;
7413 *)
7414         case "$usenm" in
7415         true|$define) dflt=y;;
7416         *) dflt=n;;
7417         esac
7418         ;;
7419 esac
7420 $cat <<EOM
7421
7422 I can use $nm to extract the symbols from your C libraries. This
7423 is a time consuming task which may generate huge output on the disk (up
7424 to 3 megabytes) but that should make the symbols extraction faster. The
7425 alternative is to skip the 'nm' extraction part and to compile a small
7426 test program instead to determine whether each symbol is present. If
7427 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7428 this may be the best solution.
7429
7430 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7431
7432 EOM
7433 rp="Shall I use $nm to extract C symbols from the libraries?"
7434 . ./myread
7435 case "$ans" in
7436 [Nn]*) usenm=false;;
7437 *) usenm=true;;
7438 esac
7439
7440 runnm=$usenm
7441 case "$reuseval" in
7442 true) runnm=false;;
7443 esac
7444
7445 : nm options which may be necessary
7446 case "$nm_opt" in
7447 '') if $test -f /mach_boot; then
7448                 nm_opt=''       # Mach
7449         elif $test -d /usr/ccs/lib; then
7450                 nm_opt='-p'     # Solaris (and SunOS?)
7451         elif $test -f /dgux; then
7452                 nm_opt='-p'     # DG-UX
7453         elif $test -f /lib64/rld; then
7454                 nm_opt='-p'     # 64-bit Irix
7455         else
7456                 nm_opt=''
7457         fi;;
7458 esac
7459
7460 : nm options which may be necessary for shared libraries but illegal
7461 : for archive libraries.  Thank you, Linux.
7462 case "$nm_so_opt" in
7463 '')     case "$myuname" in
7464         *linux*|gnu*)
7465                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7466                         nm_so_opt='--dynamic'
7467                 fi
7468                 ;;
7469         esac
7470         ;;
7471 esac
7472
7473 : Figure out where the libc is located
7474 case "$runnm" in
7475 true)
7476 : get list of predefined functions in a handy place
7477 echo " "
7478 case "$libc" in
7479 '') libc=unknown
7480         case "$libs" in
7481         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7482         esac
7483         ;;
7484 esac
7485 case "$libs" in
7486 '') ;;
7487 *)  for thislib in $libs; do
7488         case "$thislib" in
7489         -lc|-lc_s)
7490                 : Handle C library specially below.
7491                 ;;
7492         -l*)
7493                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7494                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7495                         :
7496                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7497                         :
7498                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7499                         :
7500                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7501                         :
7502                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7503                         :
7504                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7505                         :
7506                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7507                         :
7508                 else
7509                         try=''
7510                 fi
7511                 libnames="$libnames $try"
7512                 ;;
7513         *) libnames="$libnames $thislib" ;;
7514         esac
7515         done
7516         ;;
7517 esac
7518 xxx=normal
7519 case "$libc" in
7520 unknown)
7521         set /lib/libc.$so
7522         for xxx in $libpth; do
7523                 $test -r $1 || set $xxx/libc.$so
7524                 : The messy sed command sorts on library version numbers.
7525                 $test -r $1 || \
7526                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7527                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7528                                 h
7529                                 s/[0-9][0-9]*/0000&/g
7530                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7531                                 G
7532                                 s/\n/ /' | \
7533                          $sort | $sed -e 's/^.* //'`
7534                 eval set \$$#
7535         done
7536         $test -r $1 || set /usr/ccs/lib/libc.$so
7537         $test -r $1 || set /lib/libsys_s$_a
7538         ;;
7539 *)
7540         set blurfl
7541         ;;
7542 esac
7543 if $test -r "$1"; then
7544         echo "Your (shared) C library seems to be in $1."
7545         libc="$1"
7546 elif $test -r /lib/libc && $test -r /lib/clib; then
7547         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7548         xxx=apollo
7549         libc='/lib/clib /lib/libc'
7550         if $test -r /lib/syslib; then
7551                 echo "(Your math library is in /lib/syslib.)"
7552                 libc="$libc /lib/syslib"
7553         fi
7554 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7555         echo "Your C library seems to be in $libc, as you said before."
7556 elif $test -r $incpath/usr/lib/libc$_a; then
7557         libc=$incpath/usr/lib/libc$_a;
7558         echo "Your C library seems to be in $libc.  That's fine."
7559 elif $test -r /lib/libc$_a; then
7560         libc=/lib/libc$_a;
7561         echo "Your C library seems to be in $libc.  You're normal."
7562 else
7563         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7564                 :
7565         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7566                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7567         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7568                 :
7569         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7570                 :
7571         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7572                 :
7573         else
7574                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7575         fi
7576         if $test -r "$tans"; then
7577                 echo "Your C library seems to be in $tans, of all places."
7578                 libc=$tans
7579         else
7580                 libc='blurfl'
7581         fi
7582 fi
7583 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7584         dflt="$libc"
7585         cat <<EOM
7586
7587 If the guess above is wrong (which it might be if you're using a strange
7588 compiler, or your machine supports multiple models), you can override it here.
7589
7590 EOM
7591 else
7592         dflt=''
7593         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7594         cat >&4 <<EOM
7595 I can't seem to find your C library.  I've looked in the following places:
7596
7597 EOM
7598         $sed 's/^/      /' libpath
7599         cat <<EOM
7600
7601 None of these seems to contain your C library. I need to get its name...
7602
7603 EOM
7604 fi
7605 fn=f
7606 rp='Where is your C library?'
7607 . ./getfile
7608 libc="$ans"
7609
7610 echo " "
7611 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7612 set X `cat libnames`
7613 shift
7614 xxx=files
7615 case $# in 1) xxx=file; esac
7616 echo "Extracting names from the following $xxx for later perusal:" >&4
7617 echo " "
7618 $sed 's/^/      /' libnames >&4
7619 echo " "
7620 $echo $n "This may take a while...$c" >&4
7621
7622 for file in $*; do
7623         case $file in
7624         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7625         *) $nm $nm_opt $file 2>/dev/null;;
7626         esac
7627 done >libc.tmp
7628
7629 $echo $n ".$c"
7630 $grep fprintf libc.tmp > libc.ptf
7631 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7632 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7633 xxx='[ADTSIW]'
7634 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7635         eval $xscan;\
7636         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7637                 eval $xrun
7638 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7639         eval $xscan;\
7640         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7641                 eval $xrun
7642 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7643         eval $xscan;\
7644         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7645                 eval $xrun
7646 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7647         eval $xscan;\
7648         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7649                 eval $xrun
7650 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7651         eval $xscan;\
7652         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7653                 eval $xrun
7654 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7655         eval $xscan;\
7656         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7657                 eval $xrun
7658 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7659                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7660         eval $xscan;\
7661         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7662                 eval $xrun
7663 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7664         eval $xscan;\
7665         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7666                 eval $xrun
7667 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7668         eval $xscan;\
7669         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7670                 eval $xrun
7671 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7672         eval $xscan;\
7673         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7674                 eval $xrun
7675 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7676         eval $xscan;\
7677         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7678                 eval $xrun
7679 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7680         eval $xscan;\
7681         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7682                 eval $xrun
7683 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7684         eval $xscan;\
7685         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7686                 eval $xrun
7687 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7688         eval $xscan;\
7689         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7690                 eval $xrun
7691 else
7692         $nm -p $* 2>/dev/null >libc.tmp
7693         $grep fprintf libc.tmp > libc.ptf
7694         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7695                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7696         then
7697                 nm_opt='-p'
7698                 eval $xrun
7699         else
7700                 echo " "
7701                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7702                 com=''
7703                 if $ar t $libc > libc.tmp && \
7704                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7705                 then
7706                         for thisname in $libnames $libc; do
7707                                 $ar t $thisname >>libc.tmp
7708                         done
7709                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7710                         echo "Ok." >&4
7711                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7712                         for thisname in $libnames $libc; do
7713                                 $ar tv $thisname >>libc.tmp
7714                                 emximp -o tmp.imp $thisname \
7715                                     2>/dev/null && \
7716                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7717                                     < tmp.imp >>libc.tmp
7718                                 $rm -f tmp.imp
7719                         done
7720                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7721                         echo "Ok." >&4
7722                 else
7723                         echo "$ar didn't seem to work right." >&4
7724                         echo "Maybe this is a Cray...trying bld instead..." >&4
7725                         if  bld t $libc | \
7726                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7727                                 $test -s libc.list
7728                         then
7729                                 for thisname in $libnames; do
7730                                         bld t $libnames | \
7731                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7732                                         $ar t $thisname >>libc.tmp
7733                                 done
7734                                 echo "Ok." >&4
7735                         else
7736                                 echo "That didn't work either.  Giving up." >&4
7737                                 exit 1
7738                         fi
7739                 fi
7740         fi
7741 fi
7742 nm_extract="$com"
7743 case "$PASE" in
7744 define)
7745     echo " "
7746     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7747     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7748     ;;
7749 *)  if $test -f /lib/syscalls.exp; then
7750         echo " "
7751         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7752         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7753                 /lib/syscalls.exp >>libc.list
7754     fi
7755     ;;
7756 esac
7757 ;;
7758 esac
7759 $rm -f libnames libpath
7760
7761 : see if dld is available
7762 set dld.h i_dld
7763 eval $inhdr
7764
7765 : Check if we are using C++
7766 echo " "
7767 echo "Checking for C++..." >&4
7768 $cat >try.c <<'EOCP'
7769 #include <stdio.h>
7770 int main(void)
7771 {
7772 #ifdef __cplusplus
7773     return 0;
7774 #else
7775     return 1;
7776 #endif
7777 }
7778 EOCP
7779 set try
7780 if eval $compile_ok && $run ./try; then
7781         val="$define"
7782         echo "You are using a C++ compiler."
7783 else
7784         val="$undef"
7785         echo "You are not using a C++ compiler."
7786 fi
7787 $rm_try cplusplus$$
7788 set d_cplusplus
7789 eval $setvar
7790
7791 : is a C symbol defined?
7792 csym='tlook=$1;
7793 case "$3" in
7794 -v) tf=libc.tmp; tdc="";;
7795 -a) tf=libc.tmp; tdc="[]";;
7796 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7797 esac;
7798 case "$d_cplusplus" in
7799     $define)    extern_C="extern \"C\"" ;;
7800     *)          extern_C="extern"       ;;
7801 esac;
7802 tx=yes;
7803 case "$reuseval-$4" in
7804 true-) ;;
7805 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7806 esac;
7807 case "$tx" in
7808 yes)
7809         tval=false;
7810         if $test "$runnm" = true; then
7811                 if $contains $tlook $tf >/dev/null 2>&1; then
7812                         tval=true;
7813                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7814                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7815                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7816                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7817                         $rm_try;
7818                 fi;
7819         else
7820                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7821                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7822                 $rm_try;
7823         fi;
7824         ;;
7825 *)
7826         case "$tval" in
7827         $define) tval=true;;
7828         *) tval=false;;
7829         esac;
7830         ;;
7831 esac;
7832 eval "$2=$tval"'
7833
7834 : define an is-in-libc? function
7835 inlibc='echo " "; td=$define; tu=$undef;
7836 sym=$1; var=$2; eval "was=\$$2";
7837 tx=yes;
7838 case "$reuseval$was" in
7839 true) ;;
7840 true*) tx=no;;
7841 esac;
7842 case "$tx" in
7843 yes)
7844         set $sym tres -f;
7845         eval $csym;
7846         case "$tres" in
7847         true)
7848                 echo "$sym() found." >&4;
7849                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7850         *)
7851                 echo "$sym() NOT found." >&4;
7852                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7853         esac;;
7854 *)
7855         case "$was" in
7856         $define) echo "$sym() found." >&4;;
7857         *) echo "$sym() NOT found." >&4;;
7858         esac;;
7859 esac'
7860
7861 : see if dlopen exists
7862 xxx_runnm="$runnm"
7863 xxx_ccflags="$ccflags"
7864 runnm=false
7865 : with g++ one needs -shared to get is-in-libc to work for dlopen
7866 case "$gccversion" in
7867 '')     ;;
7868 *)      case "$d_cplusplus" in
7869         "$define") ccflags="$ccflags -shared" ;;
7870         esac
7871         ;;
7872 esac
7873 set dlopen d_dlopen
7874 eval $inlibc
7875 runnm="$xxx_runnm"
7876 ccflags="$xxx_ccflags"
7877
7878 : see if this is a unistd.h system
7879 set unistd.h i_unistd
7880 eval $inhdr
7881
7882 : determine which dynamic loading, if any, to compile in
7883 echo " "
7884 dldir="ext/DynaLoader"
7885 case "$usedl" in
7886 $define|y|true)
7887         dflt='y'
7888         usedl="$define"
7889         ;;
7890 $undef|n|false)
7891         dflt='n'
7892         usedl="$undef"
7893         ;;
7894 *)
7895         dflt='n'
7896         case "$d_dlopen" in
7897             $define) dflt='y' ;;
7898         esac
7899         case "$i_dld" in
7900             $define) dflt='y' ;;
7901         esac
7902         : Does a dl_xxx.xs file exist for this operating system
7903         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7904         ;;
7905 esac
7906 rp="Do you wish to use dynamic loading?"
7907 . ./myread
7908 usedl="$ans"
7909 case "$ans" in
7910 y*) usedl="$define"
7911         case "$dlsrc" in
7912         '')
7913                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7914                         dflt="$dldir/dl_${osname}.xs"
7915                 elif $test "$d_dlopen" = "$define" ; then
7916                         dflt="$dldir/dl_dlopen.xs"
7917                 elif $test "$i_dld" = "$define" ; then
7918                         dflt="$dldir/dl_dld.xs"
7919                 else
7920                         dflt=''
7921                 fi
7922                 ;;
7923         *)      dflt="$dldir/$dlsrc"
7924                 ;;
7925         esac
7926     echo "The following dynamic loading files are available:"
7927         : Can not go over to $dldir because getfile has path hard-coded in.
7928         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7929         rp="Source file to use for dynamic loading"
7930         fn="fne"
7931         gfpth="$src"
7932         . ./getfile
7933         usedl="$define"
7934         : emulate basename
7935         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7936
7937         $cat << EOM
7938
7939 Some systems may require passing special flags to $cc -c to
7940 compile modules that will be used to create a shared library.
7941 To use no flags, say "none".
7942
7943 EOM
7944     case "$cccdlflags" in
7945     '') case "$gccversion" in
7946                 '') case "$osname" in
7947                         hpux)   dflt='+z' ;;
7948                         next)   dflt='none' ;;
7949                         irix*)  dflt='-KPIC' ;;
7950                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7951                         sunos)  dflt='-pic' ;;
7952                         *)      dflt='none' ;;
7953                     esac
7954                         ;;
7955                 *)  case "$osname" in
7956                         darwin) dflt='none' ;;
7957                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7958                         *)      dflt='-fpic' ;;
7959                     esac ;;
7960             esac ;;
7961         ' ') dflt='none' ;;
7962     *)  dflt="$cccdlflags" ;;
7963     esac
7964     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7965     . ./myread
7966     case "$ans" in
7967     none) cccdlflags=' ' ;;
7968     *) cccdlflags="$ans" ;;
7969     esac
7970
7971     cat << EOM
7972
7973 Some systems use ld to create libraries that can be dynamically loaded,
7974 while other systems (such as those using ELF) use $cc.
7975
7976 EOM
7977         case "$ld" in
7978         '')     $cat >try.c <<EOM
7979 /* Test for whether ELF binaries are produced */
7980 #include <fcntl.h>
7981 #$i_stdlib I_STDLIB
7982 #ifdef I_STDLIB
7983 #include <stdlib.h>
7984 #endif
7985 #$i_unistd I_UNISTD
7986 #ifdef I_UNISTD
7987 #include <unistd.h>
7988 #endif
7989 int main() {
7990         char b[4];
7991         int i = open("a.out",O_RDONLY);
7992         if(i == -1)
7993                 exit(1); /* fail */
7994         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7995                 exit(0); /* succeed (yes, it's ELF) */
7996         else
7997                 exit(1); /* fail */
7998 }
7999 EOM
8000                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8001                         cat <<EOM
8002 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8003 EOM
8004                         dflt="$cc"
8005                 else
8006                         echo "I'll use ld to build dynamic libraries."
8007                         dflt='ld'
8008                 fi
8009                 $rm_try
8010                 ;;
8011         *)      dflt="$ld"
8012                 ;;
8013         esac
8014
8015     rp="What command should be used to create dynamic libraries?"
8016     . ./myread
8017         ld="$ans"
8018
8019     cat << EOM
8020
8021 Some systems may require passing special flags to $ld to create a
8022 library that can be dynamically loaded.  If your ld flags include
8023 -L/other/path options to locate libraries outside your loader's normal
8024 search path, you may need to specify those -L options here as well.  To
8025 use no flags, say "none".
8026
8027 EOM
8028     case "$lddlflags" in
8029     '') case "$osname" in
8030                         beos) dflt='-nostart' ;;
8031                         haiku) dflt='-shared' ;;
8032                         hpux) dflt='-b';
8033                               case "$gccversion" in
8034                               '') dflt="$dflt +vnocompatwarnings" ;;
8035                               esac
8036                               ;;
8037                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8038                         next)  dflt='none' ;;
8039                         solaris) dflt='-G' ;;
8040                         sunos) dflt='-assert nodefinitions' ;;
8041                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8042                 *)     dflt='none' ;;
8043                         esac
8044                         ;;
8045     *) dflt="$lddlflags" ;;
8046     esac
8047
8048         : Try to guess additional flags to pick up local libraries.
8049         : Be careful not to append to a plain 'none'
8050         case "$dflt" in
8051         none) dflt='' ;;
8052         esac
8053         for thisflag in $ldflags; do
8054                 case "$thisflag" in
8055                 -L*|-R*|-Wl,-R*)
8056                         case " $dflt " in
8057                         *" $thisflag "*) ;;
8058                         *) dflt="$dflt $thisflag" ;;
8059                         esac
8060                         ;;
8061                 esac
8062         done
8063
8064         case "$dflt" in
8065         ''|' ') dflt='none' ;;
8066         esac
8067
8068         case "$ldflags" in
8069         *-fstack-protector*)
8070             case "$dflt" in
8071                         *-fstack-protector*) ;; # Don't add it again
8072                         *) dflt="$dflt -fstack-protector" ;; 
8073                 esac
8074                 ;;
8075         esac
8076
8077
8078     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8079     . ./myread
8080     case "$ans" in
8081     none) lddlflags=' ' ;;
8082     *) lddlflags="$ans" ;;
8083     esac
8084
8085         cat <<EOM
8086
8087 Some systems may require passing special flags to $cc to indicate that
8088 the resulting executable will use dynamic linking.  To use no flags,
8089 say "none".
8090
8091 EOM
8092     case "$ccdlflags" in
8093     '') case "$osname" in
8094             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8095             next|sunos) dflt='none' ;;
8096             *)          dflt='none' ;;
8097             esac ;;
8098     ' ')  dflt='none' ;;
8099     *)  dflt="$ccdlflags" ;;
8100     esac
8101     rp="Any special flags to pass to $cc to use dynamic linking?"
8102     . ./myread
8103     case "$ans" in
8104     none) ccdlflags=' ' ;;
8105     *) ccdlflags="$ans" ;;
8106     esac
8107     ;;
8108 *)  usedl="$undef"
8109         ld='ld'
8110     dlsrc='dl_none.xs'
8111     lddlflags=''
8112     ccdlflags=''
8113     ;;
8114 esac
8115
8116 : Do we want a shared libperl?
8117 also=''
8118 case "$usedl" in
8119 $undef)
8120         # No dynamic loading being used, so don't bother even to prompt.
8121         useshrplib='false'
8122         ;;
8123 *)      case "$useshrplib" in
8124         '')     case "$osname" in
8125                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8126                         dflt=y
8127                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8128                         ;;
8129                 next*)
8130                         case "$osvers" in
8131                         4*)     dflt=y
8132                                 also='Building a shared libperl is needed for MAB support.'
8133                                 ;;
8134                         *)      dflt=n
8135                                 ;;
8136                         esac
8137                         ;;
8138                 *)      dflt=n
8139                         ;;
8140                 esac
8141                 ;;
8142         $define|true|[Yy]*)
8143                 dflt=y
8144                 ;;
8145         *)      dflt=n
8146                 ;;
8147         esac
8148         $cat << EOM
8149
8150 The perl executable is normally obtained by linking perlmain.c with
8151 libperl${_a}, any static extensions (usually just DynaLoader), and
8152 any other libraries needed on this system (such as -lm, etc.).  Since
8153 your system supports dynamic loading, it is probably possible to build
8154 a shared libperl.$so.  If you will have more than one executable linked
8155 to libperl.$so, this will significantly reduce the size of each
8156 executable, but it may have a noticeable effect on performance.  The
8157 default is probably sensible for your system.
8158 $also
8159
8160 EOM
8161         rp="Build a shared libperl.$so (y/n)"
8162         . ./myread
8163         case "$ans" in
8164         true|$define|[Yy]*)
8165                 useshrplib='true'  ;;
8166         *)      useshrplib='false' ;;
8167         esac
8168         ;;
8169 esac
8170
8171 case "$useshrplib" in
8172 true)
8173         case "$libperl" in
8174         '')
8175                 # Figure out a good name for libperl.so.  Since it gets stored in
8176                 # a version-specific architecture-dependent library, the version
8177                 # number isn't really that important, except for making cc/ld happy.
8178                 #
8179                 # A name such as libperl.so.10.1
8180                 majmin="libperl.$so.$patchlevel.$subversion"
8181                 # A name such as libperl.so.100
8182                 majonly=`echo $patchlevel $subversion |
8183                         $awk '{printf "%d%02d", $1, $2}'`
8184                 majonly=libperl.$so.$majonly
8185                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8186                 # rely on figuring it out from the naming of libc.
8187                 case "${osname}${osvers}" in
8188                 next4*)
8189                         dflt=libperl.5.$so
8190                         # XXX How handle the --version stuff for MAB?
8191                         ;;
8192                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8193                         dflt=libperl.$so
8194                         ;;
8195                 cygwin*) # ld links now against the dll directly
8196                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8197                         majonly=`echo $patchlevel $subversion |
8198                                 $awk '{printf "%03d%03d", $1, $2}'`
8199                         majonly=cygperl5.$majonly.$so
8200                         dflt=$majmin
8201                         ;;
8202                 *)      # Try to guess based on whether libc has major.minor.
8203                         case "$libc" in
8204                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8205                         *libc.$so.[0-9]*) dflt=$majonly ;;
8206                         *)      dflt=libperl.$so ;;
8207                         esac
8208                         ;;
8209                 esac
8210                 ;;
8211         *)      dflt=$libperl
8212                 ;;
8213         esac
8214         cat << EOM
8215
8216 I need to select a good name for the shared libperl.  If your system uses
8217 library names with major and minor numbers, then you might want something
8218 like $majmin.  Alternatively, if your system uses a single version
8219 number for shared libraries, then you might want to use $majonly.
8220 Or, your system might be quite happy with a simple libperl.$so.
8221
8222 Since the shared libperl will get installed into a version-specific
8223 architecture-dependent directory, the version number of the shared perl
8224 library probably isn't important, so the default should be o.k.
8225
8226 EOM
8227         rp='What name do you want to give to the shared libperl?'
8228         . ./myread
8229         libperl=$ans
8230         echo "Ok, I'll use $libperl"
8231         ;;
8232 *)
8233         libperl="libperl${_a}"
8234         ;;
8235 esac
8236
8237 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8238 case "$shrpdir" in
8239 '') ;;
8240 *)      $cat >&4 <<EOM
8241 WARNING:  Use of the shrpdir variable for the installation location of
8242 the shared $libperl is not supported.  It was never documented and
8243 will not work in this version.  Let me (perlbug@perl.org)
8244 know of any problems this may cause.
8245
8246 EOM
8247         case "$shrpdir" in
8248         "$archlibexp/CORE")
8249                 $cat >&4 <<EOM
8250 But your current setting of $shrpdir is
8251 the default anyway, so it's harmless.
8252 EOM
8253                 ;;
8254         *)
8255                 $cat >&4 <<EOM
8256 Further, your current attempted setting of $shrpdir
8257 conflicts with the value of $archlibexp/CORE
8258 that installperl will use.
8259 EOM
8260                 ;;
8261         esac
8262         ;;
8263 esac
8264
8265 # How will the perl executable find the installed shared $libperl?
8266 # Add $xxx to ccdlflags.
8267 # If we can't figure out a command-line option, use $shrpenv to
8268 # set env LD_RUN_PATH.  The main perl makefile uses this.
8269 shrpdir=$archlibexp/CORE
8270 xxx=''
8271 tmp_shrpenv=''
8272 if "$useshrplib"; then
8273     case "$osname" in
8274         aix)
8275                 # We'll set it in Makefile.SH...
8276                 ;;
8277         solaris)
8278                 xxx="-R $shrpdir"
8279                 ;;
8280         freebsd|netbsd|openbsd|interix|dragonfly)
8281                 xxx="-Wl,-R$shrpdir"
8282                 ;;
8283         bsdos|linux|irix*|dec_osf|gnu*)
8284                 xxx="-Wl,-rpath,$shrpdir"
8285                 ;;
8286         next)
8287                 # next doesn't like the default...
8288                 ;;
8289         beos)
8290                 # beos doesn't like the default, either.
8291                 ;;
8292         haiku)
8293                 # Haiku doesn't like the default, either.
8294                 ;;
8295         hpux*)
8296                 # hpux doesn't like the default, either.
8297                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8298                 ;;
8299         cygwin)
8300                 # cygwin needs only ldlibpth
8301                 ;;
8302         *)
8303                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8304                 ;;
8305         esac
8306         case "$xxx" in
8307         '') ;;
8308         *)
8309                 # Only add $xxx if it isn't already in ccdlflags.
8310                 case " $ccdlflags " in
8311                 *" $xxx "*)     ;;
8312                 *)      ccdlflags="$ccdlflags $xxx"
8313                         cat <<EOM >&4
8314
8315 Adding $xxx to the flags
8316 passed to $ld so that the perl executable will find the
8317 installed shared $libperl.
8318
8319 EOM
8320                         ;;
8321                 esac
8322                 ;;
8323         esac
8324 fi
8325 # Fix ccdlflags in AIX for building external extensions.
8326 # (For building Perl itself bare -bE:perl.exp is needed,
8327 #  Makefile.SH takes care of this.)
8328 case "$osname" in
8329 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8330 esac
8331 # Respect a hint or command-line value.
8332 case "$shrpenv" in
8333 '') shrpenv="$tmp_shrpenv" ;;
8334 esac
8335 case "$ldlibpthname" in
8336 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8337 none)   ldlibpthname='' ;;
8338 esac
8339
8340 : determine where manual pages are on this system
8341 echo " "
8342 case "$sysman" in
8343 '') 
8344         syspath='/usr/share/man/man1 /usr/man/man1'
8345         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8346         syspath="$syspath /usr/man/u_man/man1"
8347         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8348         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8349         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8350         sysman=`./loc . /usr/man/man1 $syspath`
8351         ;;
8352 esac
8353 if $test -d "$sysman"; then
8354         echo "System manual is in $sysman." >&4
8355 else
8356         echo "Could not find manual pages in source form." >&4
8357 fi
8358
8359 : determine where manual pages go
8360 set man1dir man1dir none
8361 eval $prefixit
8362 $cat <<EOM
8363
8364 $spackage has manual pages available in source form.
8365 EOM
8366 case "$nroff" in
8367 nroff)
8368         echo "However, you don't have nroff, so they're probably useless to you."
8369         case "$man1dir" in
8370         '') man1dir="none";;
8371         esac;;
8372 esac
8373 echo "If you don't want the manual sources installed, answer 'none'."
8374 case "$man1dir" in
8375 ' ') dflt=none
8376         ;;
8377 '')
8378         lookpath="$prefixexp/share/man/man1"
8379         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8380         lookpath="$lookpath $prefixexp/man/p_man/man1"
8381         lookpath="$lookpath $prefixexp/man/u_man/man1"
8382         lookpath="$lookpath $prefixexp/man/man.1"
8383         case "$sysman" in
8384         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8385         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8386         esac
8387         set dflt
8388         eval $prefixup
8389         ;;
8390 *)  dflt="$man1dir"
8391         ;;
8392 esac
8393 echo " "
8394 fn=dn+~
8395 rp="Where do the main $spackage manual pages (source) go?"
8396 . ./getfile
8397 if $test "X$man1direxp" != "X$ansexp"; then
8398         installman1dir=''
8399 fi
8400 prefixvar=man1dir
8401 . ./setprefixvar
8402
8403 case "$man1dir" in
8404 '')     man1dir=' '
8405         installman1dir='';;
8406 esac
8407
8408 : What suffix to use on installed man pages
8409
8410 case "$man1dir" in
8411 ' ')
8412         man1ext='0'
8413         ;;
8414 *)
8415         rp="What suffix should be used for the main $spackage man pages?"
8416         case "$man1ext" in
8417         '')     case "$man1dir" in
8418                 *1)  dflt=1 ;;
8419                 *1p) dflt=1p ;;
8420                 *1pm) dflt=1pm ;;
8421                 *l) dflt=l;;
8422                 *n) dflt=n;;
8423                 *o) dflt=o;;
8424                 *p) dflt=p;;
8425                 *C) dflt=C;;
8426                 *L) dflt=L;;
8427                 *L1) dflt=L1;;
8428                 *) dflt=1;;
8429                 esac
8430                 ;;
8431         *)      dflt="$man1ext";;
8432         esac
8433         . ./myread
8434         man1ext="$ans"
8435         ;;
8436 esac
8437
8438 : see if we can have long filenames
8439 echo " "
8440 first=123456789abcdef
8441 $rm -f $first
8442 if (echo hi >$first) 2>/dev/null; then
8443         if $test -f 123456789abcde; then
8444                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8445                 val="$undef"
8446         else
8447                 echo 'You can have filenames longer than 14 characters.'>&4
8448                 val="$define"
8449         fi
8450 else
8451         $cat <<'EOM'
8452 You can't have filenames longer than 14 chars.
8453 You can't even think about them!
8454 EOM
8455         val="$undef"
8456 fi
8457 set d_flexfnam
8458 eval $setvar
8459 $rm -rf 123456789abcde*
8460
8461 : determine where library module manual pages go
8462 set man3dir man3dir none
8463 eval $prefixit
8464 $cat <<EOM
8465
8466 $spackage has manual pages for many of the library modules.
8467 EOM
8468
8469 case "$nroff" in
8470 nroff)
8471         $cat <<'EOM'
8472 However, you don't have nroff, so they're probably useless to you.
8473 EOM
8474         case "$man3dir" in
8475         '') man3dir="none";;
8476         esac;;
8477 esac
8478
8479 case "$d_flexfnam" in
8480 undef)
8481         $cat <<'EOM'
8482 However, your system can't handle the long file names like File::Basename.3.
8483 EOM
8484         case "$man3dir" in
8485         '') man3dir="none";;
8486         esac;;
8487 esac
8488
8489 echo "If you don't want the manual sources installed, answer 'none'."
8490 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8491 case "$man3dir" in
8492 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8493         if $test -d "$privlib/man/man3"; then
8494                 cat <<EOM >&4
8495
8496 WARNING:  Previous versions of perl installed man3 pages into
8497 $privlib/man/man3.  This version will suggest a
8498 new default of $dflt.
8499 EOM
8500                 tdflt=$dflt
8501                 dflt='n'
8502                 rp='Do you wish to preserve the old behavior?(y/n)'
8503                 . ./myread
8504                 case "$ans" in
8505                 y*) dflt="$privlib/man/man3" ;;
8506                 *)  dflt=$tdflt ;;
8507                 esac
8508     fi
8509         ;;
8510 *)      dflt="$man3dir" ;;
8511 esac
8512 case "$dflt" in
8513 ' ') dflt=none ;;
8514 esac
8515 echo " "
8516 fn=dn+~
8517 rp="Where do the $package library man pages (source) go?"
8518 . ./getfile
8519 prefixvar=man3dir
8520 . ./setprefixvar
8521
8522 case "$man3dir" in
8523 '')     man3dir=' '
8524         installman3dir='';;
8525 esac
8526
8527 : What suffix to use on installed man pages
8528 case "$man3dir" in
8529 ' ')
8530         man3ext='0'
8531         ;;
8532 *)
8533         rp="What suffix should be used for the $package library man pages?"
8534         case "$man3ext" in
8535         '')     case "$man3dir" in
8536                 *3)  dflt=3 ;;
8537                 *3p) dflt=3p ;;
8538                 *3pm) dflt=3pm ;;
8539                 *l) dflt=l;;
8540                 *n) dflt=n;;
8541                 *o) dflt=o;;
8542                 *p) dflt=p;;
8543                 *C) dflt=C;;
8544                 *L) dflt=L;;
8545                 *L3) dflt=L3;;
8546                 *) dflt=3;;
8547                 esac
8548                 ;;
8549         *)      dflt="$man3ext";;
8550         esac
8551         . ./myread
8552         man3ext="$ans"
8553         ;;
8554 esac
8555
8556 : see if we have to deal with yellow pages, now NIS.
8557 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8558         if $test -f /usr/etc/nibindd; then
8559                 echo " "
8560                 echo "I'm fairly confident you're on a NeXT."
8561                 echo " "
8562                 rp='Do you get the hosts file via NetInfo?'
8563                 dflt=y
8564                 case "$hostcat" in
8565                 nidump*) ;;
8566                 '') ;;
8567                 *) dflt=n;;
8568                 esac
8569                 . ./myread
8570                 case "$ans" in
8571                 y*) hostcat='nidump hosts .';;
8572                 *)      case "$hostcat" in
8573                         nidump*) hostcat='';;
8574                         esac
8575                         ;;
8576                 esac
8577         fi
8578         case "$hostcat" in
8579         nidump*) ;;
8580         *)
8581                 case "$hostcat" in
8582                 *ypcat*) dflt=y;;
8583                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8584                                 dflt=y
8585                         else
8586                                 dflt=n
8587                         fi;;
8588                 *) dflt=n;;
8589                 esac
8590                 echo " "
8591                 rp='Are you getting the hosts file via yellow pages?'
8592                 . ./myread
8593                 case "$ans" in
8594                 y*) hostcat='ypcat hosts';;
8595                 *) hostcat='cat /etc/hosts';;
8596                 esac
8597                 ;;
8598         esac
8599 fi
8600 case "$hostcat" in
8601 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8602 esac
8603 case "$groupcat" in
8604 '') test -f /etc/group && groupcat='cat /etc/group';;
8605 esac
8606 case "$passcat" in
8607 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8608 esac
8609
8610 : now get the host name
8611 echo " "
8612 echo "Figuring out host name..." >&4
8613 case "$myhostname" in
8614 '') cont=true
8615         echo 'Maybe "hostname" will work...'
8616         if tans=`sh -c hostname 2>&1` ; then
8617                 myhostname=$tans
8618                 phostname=hostname
8619                 cont=''
8620         fi
8621         ;;
8622 *) cont='';;
8623 esac
8624 if $test "$cont"; then
8625         if ./xenix; then
8626                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8627                 if tans=`cat /etc/systemid 2>&1` ; then
8628                         myhostname=$tans
8629                         phostname='cat /etc/systemid'
8630                         echo "Whadyaknow.  Xenix always was a bit strange..."
8631                         cont=''
8632                 fi
8633         elif $test -r /etc/systemid; then
8634                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8635         fi
8636 fi
8637 if $test "$cont"; then
8638         echo 'No, maybe "uuname -l" will work...'
8639         if tans=`sh -c 'uuname -l' 2>&1` ; then
8640                 myhostname=$tans
8641                 phostname='uuname -l'
8642         else
8643                 echo 'Strange.  Maybe "uname -n" will work...'
8644                 if tans=`sh -c 'uname -n' 2>&1` ; then
8645                         myhostname=$tans
8646                         phostname='uname -n'
8647                 else
8648                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8649                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8650                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8651                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8652                         else
8653                                 case "$myhostname" in
8654                                 '') echo "Does this machine have an identity crisis or something?"
8655                                         phostname='';;
8656                                 *)
8657                                         echo "Well, you said $myhostname before..."
8658                                         phostname='echo $myhostname';;
8659                                 esac
8660                         fi
8661                 fi
8662         fi
8663 fi
8664 case "$myhostname" in
8665 '') myhostname=noname ;;
8666 esac
8667 : you do not want to know about this
8668 set $myhostname
8669 myhostname=$1
8670
8671 : verify guess
8672 if $test "$myhostname" ; then
8673         dflt=y
8674         rp='Your host name appears to be "'$myhostname'".'" Right?"
8675         . ./myread
8676         case "$ans" in
8677         y*) ;;
8678         *) myhostname='';;
8679         esac
8680 fi
8681
8682 : bad guess or no guess
8683 while $test "X$myhostname" = X ; do
8684         dflt=''
8685         rp="Please type the (one word) name of your host:"
8686         . ./myread
8687         myhostname="$ans"
8688 done
8689
8690 : translate upper to lower if necessary
8691 case "$myhostname" in
8692 *[A-Z]*)
8693         echo "(Normalizing case in your host name)"
8694         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8695         ;;
8696 esac
8697
8698 case "$myhostname" in
8699 *.*)
8700         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8701         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8702         echo "(Trimming domain name from host name--host name is now $myhostname)"
8703         ;;
8704 *) case "$mydomain" in
8705         '')
8706                 {
8707                         test "X$hostcat" = "Xypcat hosts" &&
8708                         ypmatch "$myhostname" hosts 2>/dev/null |\
8709                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8710                         $test -s hosts
8711                 } || {
8712                         test "X$hostcat" != "X" &&
8713                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8714                                         /[       ]$myhostname[  . ]/p" > hosts
8715                 }
8716                 tmp_re="[       . ]"
8717                 if $test -f hosts; then
8718                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8719                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8720                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8721                                 hosts | $sort | $uniq | \
8722                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8723                         case `$echo X$dflt` in
8724                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8725                                 dflt=.
8726                                 ;;
8727                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8728                                 ;;
8729                         esac
8730                 else
8731                         echo "(I cannot locate a hosts database anywhere)"
8732                         dflt=.
8733                 fi
8734                 case "$dflt" in
8735                 .)
8736                         tans=`./loc resolv.conf X /etc /usr/etc`
8737                         if $test -f "$tans"; then
8738                                 echo "(Attempting domain name extraction from $tans)"
8739                                 dflt=.`$sed -n -e 's/   / /g' \
8740                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8741                                   -e 1q 2>/dev/null`
8742                                 case "$dflt" in
8743                                 .) dflt=.`$sed -n -e 's/        / /g' \
8744                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8745                                      -e 1q 2>/dev/null`
8746                                         ;;
8747                                 esac
8748                         fi
8749                         ;;
8750                 esac
8751                 case "$dflt" in
8752                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8753                         dflt=.`sh -c domainname 2>/dev/null`
8754                         case "$dflt" in
8755                         '') dflt='.';;
8756                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8757                         esac
8758                         ;;
8759                 esac
8760                 case "$dflt$osname" in
8761                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8762                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8763                         ;;
8764                 esac
8765                 case "$dflt" in
8766                 .) echo "(Lost all hope -- silly guess then)"
8767                         dflt='.nonet'
8768                         ;;
8769                 esac
8770                 $rm -f hosts
8771                 ;;
8772         *) dflt="$mydomain";;
8773         esac;;
8774 esac
8775 echo " "
8776 rp="What is your domain name?"
8777 . ./myread
8778 tans="$ans"
8779 case "$ans" in
8780 '') ;;
8781 .*) ;;
8782 *) tans=".$tans";;
8783 esac
8784 mydomain="$tans"
8785
8786 : translate upper to lower if necessary
8787 case "$mydomain" in
8788 *[A-Z]*)
8789         echo "(Normalizing case in your domain name)"
8790         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8791         ;;
8792 esac
8793
8794 : a little sanity check here
8795 case "$phostname" in
8796 '') ;;
8797 *)
8798         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8799         $myhostname$mydomain|$myhostname) ;;
8800         *)
8801                 case "$phostname" in
8802                 sed*)
8803                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8804                         ;;
8805                 *)
8806                         echo "(That doesn't agree with your $phostname command, by the way.)"
8807                         ;;
8808                 esac
8809         ;;
8810         esac
8811         ;;
8812 esac
8813
8814 : determine the e-mail address of the user who is running us
8815 $cat <<EOM
8816
8817 I need to get your e-mail address in Internet format if possible, i.e.
8818 something like user@host.domain. Please answer accurately since I have
8819 no easy means to double check it. The default value provided below
8820 is most probably close to reality but may not be valid from outside
8821 your organization...
8822
8823 EOM
8824 cont=x
8825 while test "$cont"; do
8826         case "$cf_email" in
8827         '') dflt="$cf_by@$myhostname$mydomain";;
8828         *) dflt="$cf_email";;
8829         esac
8830         rp='What is your e-mail address?'
8831         . ./myread
8832         cf_email="$ans"
8833         case "$cf_email" in
8834         *@*.*) cont='' ;;
8835         *)
8836                 rp='Address does not look like an Internet one.  Use it anyway?'
8837                 case "$fastread" in
8838                 yes) dflt=y ;;
8839                 *) dflt=n ;;
8840                 esac
8841                 . ./myread
8842                 case "$ans" in
8843                 y*) cont='' ;;
8844                 *) echo " " ;;
8845                 esac
8846                 ;;
8847         esac
8848 done
8849
8850 : Ask e-mail of administrator
8851 $cat <<EOM
8852
8853 If you or somebody else will be maintaining perl at your site, please
8854 fill in the correct e-mail address here so that they may be contacted
8855 if necessary. Currently, the "perlbug" program included with perl
8856 will send mail to this address in addition to perlbug@perl.org. You may
8857 enter "none" for no administrator.
8858
8859 EOM
8860 case "$perladmin" in
8861 '') dflt="$cf_email";;
8862 *) dflt="$perladmin";;
8863 esac
8864 rp='Perl administrator e-mail address'
8865 . ./myread
8866 perladmin="$ans"
8867
8868 : determine whether to only install version-specific parts.
8869 echo " "
8870 $cat <<EOM
8871 Do you want to install only the version-specific parts of the perl
8872 distribution?  Usually you do *not* want to do this.
8873 EOM
8874 case "$versiononly" in
8875 "$define"|[Yy]*|true) dflt='y' ;;
8876 *) dflt='n';
8877 esac
8878 rp="Do you want to install only the version-specific parts of perl?"
8879 . ./myread
8880 case "$ans" in
8881 [yY]*)  val="$define";;
8882 *)      val="$undef" ;;
8883 esac
8884 set versiononly
8885 eval $setvar
8886
8887 case "$versiononly" in
8888 "$define") inc_version_list=''
8889            inc_version_list_init=0
8890            ;;
8891 esac
8892
8893 : figure out how to guarantee perl startup
8894 : XXX Note that this currently takes advantage of the bug that binexp ignores
8895 :     the Configure -Dinstallprefix setting, which in turn means that under
8896 :     relocatable @INC, initialinstalllocation is what binexp started as.
8897 case "$startperl" in
8898 '')
8899         case "$sharpbang" in
8900         *!)
8901                 $cat <<EOH
8902
8903 I can use the #! construct to start perl on your system. This will
8904 make startup of perl scripts faster, but may cause problems if you
8905 want to share those scripts and perl is not in a standard place
8906 ($initialinstalllocation/perl) on all your platforms. The alternative
8907 is to force a shell by starting the script with a single ':' character.
8908
8909 EOH
8910                 case "$versiononly" in
8911                 "$define")      dflt="$initialinstalllocation/perl$version";;
8912                 *)              dflt="$initialinstalllocation/perl";;
8913                 esac
8914                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8915                 . ./myread
8916                 case "$ans" in
8917                 none)   startperl=": # use perl";;
8918                 *)      startperl="#!$ans"
8919                         if $test 30 -lt `echo "$ans" | wc -c`; then
8920                                 $cat >&4 <<EOM
8921
8922 WARNING:  Some systems limit the #! command to 32 characters.
8923 If you experience difficulty running Perl scripts with #!, try
8924 installing Perl in a directory with a shorter pathname.
8925
8926 EOM
8927                         fi ;;
8928                 esac
8929                 ;;
8930         *) startperl=": # use perl"
8931                 ;;
8932         esac
8933         ;;
8934 esac
8935 echo "I'll use $startperl to start perl scripts."
8936
8937 : figure best path for perl in scripts
8938 case "$perlpath" in
8939 '')
8940         case "$versiononly" in
8941         "$define")      perlpath="$initialinstalllocation/perl$version";;
8942         *)              perlpath="$initialinstalllocation/perl";;
8943         esac
8944         case "$startperl" in
8945         *!*) ;;
8946         *)
8947                 $cat <<EOH
8948
8949 I will use the "eval 'exec'" idiom to start Perl on your system.
8950 I can use the full path of your Perl binary for this purpose, but
8951 doing so may cause problems if you want to share those scripts and
8952 Perl is not always in a standard place ($initialinstalllocation/perl).
8953
8954 EOH
8955                 dflt="$initialinstalllocation/perl"
8956                 rp="What path shall I use in \"eval 'exec'\"?"
8957                 . ./myread
8958                 perlpath="$ans"
8959                 ;;
8960         esac
8961         ;;
8962 esac
8963 case "$startperl" in
8964 *!*)    ;;
8965 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8966 esac
8967
8968 : determine where public executable scripts go
8969 set scriptdir scriptdir
8970 eval $prefixit
8971 case "$scriptdir" in
8972 '')
8973         dflt="$bin"
8974         : guess some guesses
8975         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8976         $test -d /usr/share/bin     && dflt=/usr/share/bin
8977         $test -d /usr/local/script  && dflt=/usr/local/script
8978         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8979         $test -d $prefixexp/script  && dflt=$prefixexp/script
8980         set dflt
8981         eval $prefixup
8982         ;;
8983 *)  dflt="$scriptdir"
8984         ;;
8985 esac
8986 $cat <<EOM
8987
8988 Some installations have a separate directory just for executable scripts so
8989 that they can mount it across multiple architectures but keep the scripts in
8990 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8991 Or you might just lump your scripts in with all your other executables.
8992
8993 EOM
8994 fn=d~
8995 rp='Where do you keep publicly executable scripts?'
8996 . ./getfile
8997 if $test "X$ansexp" != "X$scriptdirexp"; then
8998         installscript=''
8999 fi
9000 installscriptdir=''
9001 prefixvar=scriptdir
9002 . ./setprefixvar
9003 : A little fix up for an irregularly named variable.
9004 installscript="$installscriptdir"
9005
9006 : determine where add-on public executables go
9007 case "$sitebin" in
9008 '')     dflt=$siteprefix/bin ;;
9009 *)      dflt=$sitebin ;;
9010 esac
9011 fn=d~
9012 rp='Pathname where the add-on public executables should be installed?'
9013 . ./getfile
9014 prefixvar=sitebin
9015 . ./setprefixvar
9016
9017 : determine where add-on html pages go
9018 : There is no standard location, so try to copy the previously-selected
9019 : directory structure for the core html pages.
9020 case "$sitehtml1dir" in
9021 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9022 *)     dflt=$sitehtml1dir ;;
9023 esac
9024 case "$dflt" in
9025 ''|' ') dflt=none ;;
9026 esac
9027 fn=dn+~
9028 rp='Pathname where the site-specific html pages should be installed?'
9029 . ./getfile
9030 prefixvar=sitehtml1dir
9031 . ./setprefixvar
9032
9033 : determine where add-on library html pages go
9034 : There is no standard location, so try to copy the previously-selected
9035 : directory structure for the core html pages.
9036 case "$sitehtml3dir" in
9037 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9038 *)     dflt=$sitehtml3dir ;;
9039 esac
9040 case "$dflt" in
9041 ''|' ') dflt=none ;;
9042 esac
9043 fn=dn+~
9044 rp='Pathname where the site-specific library html pages should be installed?'
9045 . ./getfile
9046 prefixvar=sitehtml3dir
9047 . ./setprefixvar
9048
9049 : determine where add-on manual pages go
9050 case "$siteman1dir" in
9051 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9052 *)      dflt=$siteman1dir ;;
9053 esac
9054 case "$dflt" in
9055 ''|' ') dflt=none ;;
9056 esac
9057 fn=dn+~
9058 rp='Pathname where the site-specific manual pages should be installed?'
9059 . ./getfile
9060 prefixvar=siteman1dir
9061 . ./setprefixvar
9062
9063 : determine where add-on library man pages go
9064 case "$siteman3dir" in
9065 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9066 *)      dflt=$siteman3dir ;;
9067 esac
9068 case "$dflt" in
9069 ''|' ') dflt=none ;;
9070 esac
9071 fn=dn+~
9072 rp='Pathname where the site-specific library manual pages should be installed?'
9073 . ./getfile
9074 prefixvar=siteman3dir
9075 . ./setprefixvar
9076
9077 : determine where add-on public executable scripts go
9078 case "$sitescript" in
9079 '')     dflt=$siteprefix/script
9080         $test -d $dflt || dflt=$sitebin ;;
9081 *)  dflt="$sitescript" ;;
9082 esac
9083 fn=d~+
9084 rp='Pathname where add-on public executable scripts should be installed?'
9085 . ./getfile
9086 prefixvar=sitescript
9087 . ./setprefixvar
9088
9089 : Check if faststdio is requested and available
9090 case "$usefaststdio" in
9091 $define|true|[yY]*|'')
9092         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9093         case "$xversion" in
9094         [68])   dflt='y' ;;
9095         *)      dflt='n' ;;
9096         esac
9097         ;;
9098 *) dflt='n';;
9099 esac
9100 cat <<EOM
9101
9102 Perl can be built to use 'fast stdio', which means using the stdio
9103 library but also directly manipulating the stdio buffers to enable
9104 faster I/O.  Using stdio is better for backward compatibility (especially
9105 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9106 interface has been preferred instead of stdio.
9107
9108 If this doesn't make any sense to you, just accept the default '$dflt'.
9109 EOM
9110 rp='Use the "fast stdio" if available?'
9111 . ./myread
9112 case "$ans" in
9113 y|Y)    val="$define" ;;
9114 *)      val="$undef" ;;
9115 esac
9116 set usefaststdio
9117 eval $setvar
9118
9119
9120 : define an is-a-typedef? function
9121 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9122 case "$inclist" in
9123 "") inclist="sys/types.h";;
9124 esac;
9125 eval "varval=\$$var";
9126 case "$varval" in
9127 "")
9128         $rm -f temp.c;
9129         for inc in $inclist; do
9130                 echo "#include <$inc>" >>temp.c;
9131         done;
9132         echo "#ifdef $type" >> temp.c;
9133         echo "printf(\"We have $type\");" >> temp.c;
9134         echo "#endif" >> temp.c;
9135         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9136         if $contains $type temp.E >/dev/null 2>&1; then
9137                 eval "$var=\$type";
9138         else
9139                 eval "$var=\$def";
9140         fi;
9141         $rm -f temp.?;;
9142 *) eval "$var=\$varval";;
9143 esac'
9144
9145 : define an is-a-typedef? function that prompts if the type is not available.
9146 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9147 case "$inclist" in
9148 "") inclist="sys/types.h";;
9149 esac;
9150 eval "varval=\$$var";
9151 case "$varval" in
9152 "")
9153         $rm -f temp.c;
9154         for inc in $inclist; do
9155                 echo "#include <$inc>" >>temp.c;
9156         done;
9157         echo "#ifdef $type" >> temp.c;
9158         echo "printf(\"We have $type\");" >> temp.c;
9159         echo "#endif" >> temp.c;
9160         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9161         echo " " ;
9162         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9163         if $contains $type temp.E >/dev/null 2>&1; then
9164                 echo "$type found." >&4;
9165                 eval "$var=\$type";
9166         else
9167                 echo "$type NOT found." >&4;
9168                 dflt="$def";
9169                 . ./myread ;
9170                 eval "$var=\$ans";
9171         fi;
9172         $rm -f temp.?;;
9173 *) eval "$var=\$varval";;
9174 esac'
9175
9176 : see what type lseek is declared as in the kernel
9177 rp="What is the type used for lseek's offset on this system?"
9178 set off_t lseektype long stdio.h sys/types.h
9179 eval $typedef_ask
9180
9181 echo " "
9182 echo "Checking to see how big your file offsets are..." >&4
9183 $cat >try.c <<EOCP
9184 #include <sys/types.h>
9185 #include <stdio.h>
9186 int main()
9187 {
9188     printf("%d\n", (int)sizeof($lseektype));
9189     return(0);
9190 }
9191 EOCP
9192 set try
9193 if eval $compile_ok; then
9194         lseeksize=`$run ./try`
9195         echo "Your file offsets are $lseeksize bytes long."
9196 else
9197         dflt=$longsize
9198         echo " "
9199         echo "(I can't seem to compile the test program.  Guessing...)"
9200         rp="What is the size of your file offsets (in bytes)?"
9201         . ./myread
9202         lseeksize="$ans"
9203 fi
9204 $rm_try
9205
9206 : see what type file positions are declared as in the library
9207 rp="What is the type for file position used by fsetpos()?"
9208 set fpos_t fpostype long stdio.h sys/types.h
9209 eval $typedef_ask
9210
9211 : Check size for Fpos_t
9212 echo " "
9213 case "$fpostype" in
9214 *_t) zzz="$fpostype"    ;;
9215 *)   zzz="fpos_t"       ;;
9216 esac
9217 echo "Checking the size of $zzz..." >&4
9218 cat > try.c <<EOCP
9219 #include <sys/types.h>
9220 #include <stdio.h>
9221 #$i_stdlib I_STDLIB
9222 #ifdef I_STDLIB
9223 #include <stdlib.h>
9224 #endif
9225 int main() {
9226     printf("%d\n", (int)sizeof($fpostype));
9227     exit(0);
9228 }
9229 EOCP
9230 set try
9231 if eval $compile_ok; then
9232         yyy=`$run ./try`
9233         case "$yyy" in
9234         '')     fpossize=4
9235                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9236                 ;;
9237         *)      fpossize=$yyy
9238                 echo "Your $zzz is $fpossize bytes long."
9239                 ;;
9240         esac
9241 else
9242         dflt="$longsize"
9243         echo " " >&4
9244         echo "(I can't compile the test program.  Guessing...)" >&4
9245         rp="What is the size of your file positions (in bytes)?"
9246         . ./myread
9247         fpossize="$ans"
9248 fi
9249
9250 : Check for large file support
9251 # Backward compatibility (uselfs is deprecated).
9252 case "$uselfs" in
9253 "$define"|true|[yY]*)
9254         cat <<EOM >&4
9255
9256 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9257 EOM
9258         uselargefiles="$define"
9259         ;;
9260 esac
9261
9262 case "$lseeksize:$fpossize" in
9263 8:8) cat <<EOM
9264
9265 You can have files larger than 2 gigabytes.
9266 EOM
9267    val="$define" ;;
9268 *)    case "$uselargefiles" in
9269    "$undef"|false|[nN]*) dflt='n' ;;
9270    *)   dflt='y' ;;
9271    esac
9272    cat <<EOM
9273
9274 Perl can be built to understand large files (files larger than 2 gigabytes)
9275 on some systems.  To do so, Configure can be run with -Duselargefiles.
9276
9277 If this doesn't make any sense to you, just accept the default '$dflt'.
9278 EOM
9279    rp='Try to understand large files, if available?'
9280    . ./myread
9281    case "$ans" in
9282    y|Y)         val="$define" ;;
9283    *)           val="$undef"  ;;
9284    esac
9285    ;;
9286 esac
9287 set uselargefiles
9288 eval $setvar
9289 : Look for a hint-file generated 'call-back-unit'.  If the
9290 : user has specified that a large files perl is to be built,
9291 : we may need to set or change some other defaults.
9292 if $test -f uselargefiles.cbu; then
9293         echo "Your platform has some specific hints regarding large file builds, using them..."
9294         . ./uselargefiles.cbu
9295 fi
9296 case "$uselargefiles" in
9297 "$define")
9298         if $test -f uselargefiles.cbu; then
9299                 echo " "
9300                 echo "Rechecking to see how big your file offsets are..." >&4
9301                 $cat >try.c <<EOCP
9302 #include <sys/types.h>
9303 #include <stdio.h>
9304 int main()
9305 {
9306     printf("%d\n", (int)sizeof($lseektype));
9307     return(0);
9308 }
9309 EOCP
9310                 set try
9311                 if eval $compile_ok; then
9312                         lseeksize=`$run ./try`
9313                         $echo "Your file offsets are now $lseeksize bytes long."
9314                 else
9315                         dflt="$lseeksize"
9316                         echo " "
9317                         echo "(I can't seem to compile the test program.  Guessing...)"
9318                         rp="What is the size of your file offsets (in bytes)?"
9319                         . ./myread
9320                         lseeksize="$ans"
9321                 fi
9322                 case "$fpostype" in
9323                 *_t) zzz="$fpostype"    ;;
9324                 *)   zzz="fpos_t"       ;;
9325                 esac
9326                 $echo $n "Rechecking the size of $zzz...$c" >&4
9327                 $cat > try.c <<EOCP
9328 #include <sys/types.h>
9329 #include <stdio.h>
9330 #$i_stdlib I_STDLIB
9331 #ifdef I_STDLIB
9332 #include <stdlib.h>
9333 #endif
9334 int main() {
9335     printf("%d\n", (int)sizeof($fpostype));
9336     return(0);
9337 }
9338 EOCP
9339                 set try
9340                 if eval $compile_ok; then
9341                         yyy=`$run ./try`
9342                         dflt="$lseeksize"
9343                         case "$yyy" in
9344                         '')     echo " "
9345                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9346                                 ;;
9347                         *)      fpossize=$yyy
9348                                 echo " $fpossize bytes." >&4
9349                                 ;;
9350                         esac
9351                 else
9352                         dflt="$fpossize"
9353                         echo " "
9354                         echo "(I can't compile the test program.  Guessing...)" >&4
9355                         rp="What is the size of your file positions (in bytes)?"
9356                         . ./myread
9357                         fpossize="$ans"
9358                 fi
9359                 $rm_try
9360         fi
9361         ;;
9362 esac
9363
9364 : Set the vendorbin variables
9365 case "$vendorprefix" in
9366 '')     d_vendorbin="$undef"
9367         vendorbin=''
9368         vendorbinexp=''
9369         ;;
9370 *)      d_vendorbin="$define"
9371         : determine where vendor-supplied executables go.
9372         case "$vendorbin" in
9373         '') dflt=$vendorprefix/bin ;;
9374         *)      dflt="$vendorbin" ;;
9375         esac
9376         fn=d~+
9377         rp='Pathname for the vendor-supplied executables directory?'
9378         . ./getfile
9379         vendorbin="$ans"
9380         vendorbinexp="$ansexp"
9381         ;;
9382 esac
9383 prefixvar=vendorbin
9384 . ./installprefix
9385
9386 : Set the vendorhtml1dir variables
9387 case "$vendorprefix" in
9388 '')     vendorhtml1dir=''
9389         vendorhtml1direxp=''
9390         ;;
9391 *)      : determine where vendor-supplied html pages go.
9392         : There is no standard location, so try to copy the previously-selected
9393         : directory structure for the core html pages.
9394         : XXX Better default suggestions would be welcome.
9395         case "$vendorhtml1dir" in
9396         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9397         *)      dflt=$vendorhtml1dir ;;
9398         esac
9399         case "$dflt" in
9400         ''|' ') dflt=none ;;
9401         esac
9402         fn=dn+~
9403         rp='Pathname for the vendor-supplied html pages?'
9404         . ./getfile
9405         vendorhtml1dir="$ans"
9406         vendorhtml1direxp="$ansexp"
9407         ;;
9408 esac
9409 : Use ' ' for none so value is preserved next time through Configure
9410 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9411 prefixvar=vendorhtml1dir
9412 . ./installprefix
9413
9414 : Set the vendorhtml3dir variables
9415 case "$vendorprefix" in
9416 '')     vendorhtml3dir=''
9417         vendorhtml3direxp=''
9418         ;;
9419 *)      : determine where vendor-supplied module html pages go.
9420         : There is no standard location, so try to copy the previously-selected
9421         : directory structure for the core html pages.
9422         : XXX Better default suggestions would be welcome.
9423         case "$vendorhtml3dir" in
9424         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9425         *)      dflt=$vendorhtml3dir ;;
9426         esac
9427         case "$dflt" in
9428         ''|' ') dflt=none ;;
9429         esac
9430         fn=dn+~
9431         rp='Pathname for the vendor-supplied html pages?'
9432         . ./getfile
9433         vendorhtml3dir="$ans"
9434         vendorhtml3direxp="$ansexp"
9435         ;;
9436 esac
9437 : Use ' ' for none so value is preserved next time through Configure
9438 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9439 prefixvar=vendorhtml3dir
9440 . ./installprefix
9441
9442 : Set the vendorman1dir variables
9443 case "$vendorprefix" in
9444 '')     vendorman1dir=''
9445         vendorman1direxp=''
9446         ;;
9447 *)      : determine where vendor-supplied manual pages go.
9448         case "$vendorman1dir" in
9449         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9450         *)      dflt=$vendorman1dir ;;
9451         esac
9452         case "$dflt" in
9453         ''|' ') dflt=none ;;
9454         esac
9455         fn=nd~+
9456         rp='Pathname for the vendor-supplied manual section 1 pages?'
9457         . ./getfile
9458         vendorman1dir="$ans"
9459         vendorman1direxp="$ansexp"
9460         ;;
9461 esac
9462 : Use ' ' for none so value is preserved next time through Configure
9463 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9464 prefixvar=vendorman1dir
9465 . ./installprefix
9466
9467 : Set the vendorman3dir variables
9468 case "$vendorprefix" in
9469 '')     vendorman3dir=''
9470         vendorman3direxp=''
9471         ;;
9472 *)      : determine where vendor-supplied module manual pages go.
9473         case "$vendorman3dir" in
9474         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9475         *)      dflt=$vendorman3dir ;;
9476         esac
9477         case "$dflt" in
9478         ''|' ') dflt=none ;;
9479         esac
9480         fn=nd~+
9481         rp='Pathname for the vendor-supplied manual section 3 pages?'
9482         . ./getfile
9483         vendorman3dir="$ans"
9484         vendorman3direxp="$ansexp"
9485         ;;
9486 esac
9487 : Use ' ' for none so value is preserved next time through Configure
9488 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9489 prefixvar=vendorman3dir
9490 . ./installprefix
9491
9492 : Set the vendorscript variables
9493 case "$vendorprefix" in
9494 '')     d_vendorscript="$undef"
9495         vendorscript=''
9496         vendorscriptexp=''
9497         ;;
9498 *)      d_vendorscript="$define"
9499         : determine where vendor-supplied scripts go.
9500         case "$vendorscript" in
9501         '')     dflt=$vendorprefix/script
9502                 $test -d $dflt || dflt=$vendorbin ;;
9503         *)  dflt="$vendorscript" ;;
9504         esac
9505         $cat <<EOM
9506
9507 The installation process will create a directory for
9508 vendor-supplied scripts.
9509
9510 EOM
9511         fn=d~+
9512         rp='Pathname for the vendor-supplied scripts directory?'
9513         . ./getfile
9514         vendorscript="$ans"
9515         vendorscriptexp="$ansexp"
9516         ;;
9517 esac
9518 prefixvar=vendorscript
9519 . ./installprefix
9520
9521 : script used to emit important warnings
9522 cat >warn <<EOS
9523 $startsh
9524 if test \$# -gt 0; then
9525         echo "\$@" >msg
9526 else
9527         cat >msg
9528 fi
9529 echo "*** WARNING:" >&4
9530 sed -e 's/^/*** /' <msg >&4
9531 echo "*** " >&4
9532 cat msg >>config.msg
9533 echo " " >>config.msg
9534 rm -f msg
9535 EOS
9536 chmod +x warn
9537 $eunicefix warn
9538
9539 : see which of string.h or strings.h is needed
9540 echo " "
9541 strings=`./findhdr string.h`
9542 if $test "$strings" && $test -r "$strings"; then
9543         echo "Using <string.h> instead of <strings.h>." >&4
9544         val="$define"
9545 else
9546         val="$undef"
9547         strings=`./findhdr strings.h`
9548         if $test "$strings" && $test -r "$strings"; then
9549                 echo "Using <strings.h> instead of <string.h>." >&4
9550         else
9551                 ./warn "No string header found -- You'll surely have problems."
9552         fi
9553 fi
9554 set i_string
9555 eval $setvar
9556 case "$i_string" in
9557 "$undef") strings=`./findhdr strings.h`;;
9558 *)        strings=`./findhdr string.h`;;
9559 esac
9560
9561 : see if qgcvt exists
9562 set qgcvt d_qgcvt
9563 eval $inlibc
9564
9565 : Check print/scan long double stuff
9566 echo " "
9567
9568 if $test X"$d_longdbl" = X"$define"; then
9569
9570 echo "Checking how to print long doubles..." >&4
9571
9572 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9573         $cat >try.c <<'EOCP'
9574 #include <sys/types.h>
9575 #include <stdio.h>
9576 int main() {
9577   double d = 123.456;
9578   printf("%.3f\n", d);
9579 }
9580 EOCP
9581         set try
9582         if eval $compile; then
9583                 yyy=`$run ./try`
9584                 case "$yyy" in
9585                 123.456)
9586                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9587                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9588                         echo "We will use %f."
9589                         ;;
9590                 esac
9591         fi
9592 fi
9593
9594 if $test X"$sPRIfldbl" = X; then
9595         $cat >try.c <<'EOCP'
9596 #include <sys/types.h>
9597 #include <stdio.h>
9598 int main() {
9599   long double d = 123.456;
9600   printf("%.3Lf\n", d);
9601 }
9602 EOCP
9603         set try
9604         if eval $compile; then
9605                 yyy=`$run ./try`
9606                 case "$yyy" in
9607                 123.456)
9608                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9609                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9610                         echo "We will use %Lf."
9611                         ;;
9612                 esac
9613         fi
9614 fi
9615
9616 if $test X"$sPRIfldbl" = X; then
9617         $cat >try.c <<'EOCP'
9618 #include <sys/types.h>
9619 #include <stdio.h>
9620 int main() {
9621   long double d = 123.456;
9622   printf("%.3llf\n", d);
9623 }
9624 EOCP
9625         set try
9626         if eval $compile; then
9627                 yyy=`$run ./try`
9628                 case "$yyy" in
9629                 123.456)
9630                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9631                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9632                         echo "We will use %llf."
9633                         ;;
9634                 esac
9635         fi
9636 fi
9637
9638 if $test X"$sPRIfldbl" = X; then
9639         $cat >try.c <<'EOCP'
9640 #include <sys/types.h>
9641 #include <stdio.h>
9642 int main() {
9643   long double d = 123.456;
9644   printf("%.3lf\n", d);
9645 }
9646 EOCP
9647         set try
9648         if eval $compile; then
9649                 yyy=`$run ./try`
9650                 case "$yyy" in
9651                 123.456)
9652                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9653                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9654                         echo "We will use %lf."
9655                         ;;
9656                 esac
9657         fi
9658 fi
9659
9660 if $test X"$sPRIfldbl" = X; then
9661         echo "Cannot figure out how to print long doubles." >&4
9662 else
9663         sSCNfldbl=$sPRIfldbl    # expect consistency
9664 fi
9665
9666 $rm_try
9667
9668 fi # d_longdbl
9669
9670 case "$sPRIfldbl" in
9671 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9672         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9673         d_SCNfldbl="$undef";
9674         ;;
9675 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9676         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9677         d_SCNfldbl="$define";
9678         ;;
9679 esac
9680
9681 : Check how to convert floats to strings.
9682
9683 if test "X$d_Gconvert" = X; then
9684
9685 echo " "
9686 echo "Checking for an efficient way to convert floats to strings."
9687 echo " " > try.c
9688 case "$uselongdouble" in
9689 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9690 esac
9691 case "$d_longdbl" in
9692 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9693 esac
9694 case "$d_PRIgldbl" in
9695 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9696 esac
9697 $cat >>try.c <<EOP
9698 #ifdef TRY_gconvert
9699 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9700 char *myname = "gconvert";
9701 #endif
9702 #ifdef TRY_gcvt
9703 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9704 char *myname = "gcvt";
9705 #endif
9706 #ifdef TRY_qgcvt
9707 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9708 char *myname = "qgcvt";
9709 #define DOUBLETYPE long double
9710 #endif
9711 #ifdef TRY_sprintf
9712 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9713 #ifdef HAS_PRIgldbl
9714 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9715 #else
9716 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9717 #endif
9718 #else
9719 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9720 #endif
9721 char *myname = "sprintf";
9722 #endif
9723
9724 #ifndef DOUBLETYPE
9725 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9726 #define DOUBLETYPE long double
9727 #else
9728 #define DOUBLETYPE double
9729 #endif
9730 #endif
9731
9732 #include <stdio.h>
9733
9734 #$i_stdlib I_STDLIB
9735 #ifdef I_STDLIB
9736 #include <stdlib.h>
9737 #endif
9738 #$i_string I_STRING
9739 #ifdef I_STRING
9740 #  include <string.h>
9741 #else
9742 #  include <strings.h>
9743 #endif
9744
9745 int checkit(char *expect, char *got)
9746 {
9747     if (strcmp(expect, got)) {
9748                 printf("%s oddity:  Expected %s, got %s\n",
9749                         myname, expect, got);
9750                 exit(1);
9751         }
9752 }
9753
9754 int main()
9755 {
9756         char buf[64];
9757         buf[63] = '\0';
9758
9759         /* This must be 1st test on (which?) platform */
9760         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9761         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9762         checkit("0.1", buf);
9763
9764         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9765         checkit("0.01", buf);
9766
9767         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9768         checkit("0.001", buf);
9769
9770         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9771         checkit("0.0001", buf);
9772
9773         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9774         if (strlen(buf) > 5)
9775             checkit("9e-005", buf); /* for Microsoft ?? */
9776         else
9777             checkit("9e-05", buf);
9778
9779         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9780         checkit("1", buf);
9781
9782         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9783         checkit("1.1", buf);
9784
9785         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9786         checkit("1.01", buf);
9787
9788         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9789         checkit("1.001", buf);
9790
9791         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9792         checkit("1.0001", buf);
9793
9794         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9795         checkit("1.00001", buf);
9796
9797         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9798         checkit("1.000001", buf);
9799
9800         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9801         checkit("0", buf);
9802
9803         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9804         checkit("-1", buf);
9805
9806         /* Some Linux gcvt's give 1.e+5 here. */
9807         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9808         checkit("100000", buf);
9809
9810         /* Some Linux gcvt's give -1.e+5 here. */
9811         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9812         checkit("-100000", buf);
9813
9814         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9815         checkit("123.456", buf);
9816
9817         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9818         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9819         /* 34 should be enough to scare even long double
9820          * places into using the e notation. */
9821         if (strlen(buf) > 5)
9822             checkit("1e+034", buf); /* for Microsoft */
9823         else
9824             checkit("1e+34", buf);
9825
9826         /* For Perl, if you add additional tests here, also add them to
9827          * t/base/num.t for benefit of platforms not using Configure or
9828          * overriding d_Gconvert */
9829
9830         exit(0);
9831 }
9832 EOP
9833 : first add preferred functions to our list
9834 xxx_list=""
9835 for xxx_convert in $gconvert_preference; do
9836     case $xxx_convert in
9837     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9838     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9839     esac
9840 done
9841 : then add any others
9842 for xxx_convert in gconvert gcvt sprintf; do
9843     case "$xxx_list" in
9844     *$xxx_convert*) ;;
9845     *) xxx_list="$xxx_list $xxx_convert" ;;
9846     esac
9847 done
9848
9849 case "$d_longdbl$uselongdouble" in
9850 "$define$define")
9851     : again, add prefered functions to our list first
9852     xxx_ld_list=""
9853     for xxx_convert in $gconvert_ld_preference; do
9854         case $xxx_convert in
9855         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9856         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9857         esac
9858     done
9859     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9860     for xxx_convert in qgcvt sprintf $xxx_list; do
9861         case "$xxx_ld_list" in
9862         $xxx_convert*|*" $xxx_convert"*) ;;
9863         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9864         esac
9865     done
9866     : if sprintf cannot do long doubles, move it to the end
9867     if test "$d_PRIgldbl" != "$define"; then
9868         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9869     fi
9870     : if no qgcvt, remove it
9871     if test "$d_qgcvt" != "$define"; then
9872         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9873     fi
9874     : use the ld_list
9875     xxx_list="$xxx_ld_list"
9876     ;;
9877 esac
9878
9879 for xxx_convert in $xxx_list; do
9880         echo "Trying $xxx_convert..."
9881         $rm -f try try$_o core
9882         set try -DTRY_$xxx_convert
9883         if eval $compile; then
9884                 echo "$xxx_convert() found." >&4
9885                 if $run ./try; then
9886                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9887                         break;
9888                 else
9889                         echo "...But $xxx_convert didn't work as I expected."
9890                         xxx_convert=''
9891                 fi
9892         else
9893                 echo "$xxx_convert NOT found." >&4
9894         fi
9895 done
9896
9897 if test X$xxx_convert = X; then
9898     echo "*** WHOA THERE!!! ***" >&4
9899     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9900     xxx_convert=sprintf
9901 fi
9902
9903 case "$xxx_convert" in
9904 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9905 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9906 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9907 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9908    "$define$define$define")
9909       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9910    "$define$define$undef")
9911       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9912    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9913    esac
9914    ;;
9915 esac
9916
9917 fi
9918 $rm_try
9919
9920 : see if _fwalk exists
9921 set fwalk d__fwalk
9922 eval $inlibc
9923
9924 : Initialize h_fcntl
9925 h_fcntl=false
9926
9927 : Initialize h_sysfile
9928 h_sysfile=false
9929
9930 : access call always available on UNIX
9931 set access d_access
9932 eval $inlibc
9933
9934 : locate the flags for 'access()'
9935 case "$d_access" in
9936 "$define")
9937         echo " "
9938         $cat >access.c <<EOCP
9939 #include <sys/types.h>
9940 #ifdef I_FCNTL
9941 #include <fcntl.h>
9942 #endif
9943 #ifdef I_SYS_FILE
9944 #include <sys/file.h>
9945 #endif
9946 #ifdef I_UNISTD
9947 #include <unistd.h>
9948 #endif
9949 #$i_stdlib I_STDLIB
9950 #ifdef I_STDLIB
9951 #include <stdlib.h>
9952 #endif
9953 int main() {
9954         exit(R_OK);
9955 }
9956 EOCP
9957         : check sys/file.h first, no particular reason here
9958         if $test `./findhdr sys/file.h` && \
9959                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9960                 h_sysfile=true;
9961                 echo "<sys/file.h> defines the *_OK access constants." >&4
9962         elif $test `./findhdr fcntl.h` && \
9963                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9964                 h_fcntl=true;
9965                 echo "<fcntl.h> defines the *_OK access constants." >&4
9966         elif $test `./findhdr unistd.h` && \
9967                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9968                 echo "<unistd.h> defines the *_OK access constants." >&4
9969         else
9970                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9971         fi
9972         ;;
9973 esac
9974 $rm -f access*
9975
9976 : see if accessx exists
9977 set accessx d_accessx
9978 eval $inlibc
9979
9980 : see if aintl exists
9981 set aintl d_aintl
9982 eval $inlibc
9983
9984 : see if alarm exists
9985 set alarm d_alarm
9986 eval $inlibc
9987
9988 : see if 64bit time functions exists
9989
9990 set ctime64 d_ctime64
9991 eval $inlibc
9992
9993 set localtime64 d_localtime64
9994 eval $inlibc
9995
9996 set gmtime64 d_gmtime64
9997 eval $inlibc
9998
9999 set mktime64 d_mktime64
10000 eval $inlibc
10001
10002 set difftime64 d_difftime64
10003 eval $inlibc
10004
10005 set asctime64 d_asctime64
10006 eval $inlibc
10007
10008 : see if POSIX threads are available
10009 set pthread.h i_pthread
10010 eval $inhdr
10011
10012 : define a fucntion to check prototypes
10013 $cat > protochk <<EOSH
10014 $startsh
10015 cc="$cc"
10016 optimize="$optimize"
10017 ccflags="$ccflags"
10018 prototype="$prototype"
10019 define="$define"
10020 rm_try="$rm_try"
10021 usethreads=$usethreads
10022 i_pthread=$i_pthread
10023 pthread_h_first=$pthread_h_first
10024 EOSH
10025
10026 $cat >> protochk <<'EOSH'
10027
10028 $rm_try
10029 foo="$1"
10030 shift
10031 while test $# -ge 2; do
10032         case "$1" in
10033                 $define) echo "#include <$2>" >> try.c ;;
10034                 literal) echo "$2" >> try.c ;;
10035         esac
10036     # Extra magic for the benefit of systems that need pthread.h
10037     # to be included early to correctly detect threadsafe functions.
10038     # Such functions must guarantee themselves, though, that the usethreads
10039     # and i_pthread have been defined, before calling protochk.
10040     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10041         echo "#include <pthread.h>" >> try.c
10042         pthread_h_done=yes
10043     fi
10044     shift 2
10045 done
10046 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10047 cat >> try.c <<'EOCP'
10048 #ifdef CAN_PROTOTYPE
10049 #define _(args) args
10050 #else
10051 #define _(args) ()
10052 #endif
10053 EOCP
10054 echo "$foo" >> try.c
10055 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10056 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10057 status=$?
10058 $rm_try
10059 exit $status
10060 EOSH
10061 chmod +x protochk
10062 $eunicefix protochk
10063
10064 : Define hasproto macro for Configure internal use
10065 hasproto='varname=$1; func=$2; shift; shift;
10066 while $test $# -ge 2; do
10067         case "$1" in
10068         $define) echo "#include <$2>";;
10069         esac ;
10070     shift 2;
10071 done > try.c;
10072 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10073 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10074         echo "$func() prototype found.";
10075         val="$define";
10076 else
10077         echo "$func() prototype NOT found.";
10078         val="$undef";
10079 fi;
10080 set $varname;
10081 eval $setvar;
10082 $rm_try tryout.c'
10083
10084 : see if sys/types.h has to be included
10085 set sys/types.h i_systypes
10086 eval $inhdr
10087
10088 : see if sys/select.h has to be included
10089 set sys/select.h i_sysselct
10090 eval $inhdr
10091
10092 : Define hasfield macro for Configure internal use
10093 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10094 while $test $# -ge 2; do
10095         case "$1" in
10096         $define) echo "#include <$2>";;
10097         esac ;
10098     shift 2;
10099 done > try.c;
10100 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10101 set try;
10102 if eval $compile; then
10103         val="$define";
10104 else
10105         val="$undef";
10106 fi;
10107 set $varname;
10108 eval $setvar;
10109 $rm_try'
10110
10111 : see if we should include time.h, sys/time.h, or both
10112 echo " "
10113 if test "X$timeincl" = X; then
10114         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10115         $echo $n "I'm now running the test program...$c"
10116         $cat >try.c <<EOCP
10117 #include <sys/types.h>
10118 #ifdef I_TIME
10119 #include <time.h>
10120 #endif
10121 #ifdef I_SYSTIME
10122 #ifdef SYSTIMEKERNEL
10123 #define KERNEL
10124 #endif
10125 #include <sys/time.h>
10126 #endif
10127 #ifdef I_SYSSELECT
10128 #include <sys/select.h>
10129 #endif
10130 #$i_stdlib I_STDLIB
10131 #ifdef I_STDLIB
10132 #include <stdlib.h>
10133 #endif
10134 int main()
10135 {
10136         struct tm foo;
10137 #ifdef S_TIMEVAL
10138         struct timeval bar;
10139 #endif
10140 #ifdef S_TIMEZONE
10141         struct timezone tzp;
10142 #endif
10143         if (foo.tm_sec == foo.tm_sec)
10144                 exit(0);
10145 #ifdef S_TIMEVAL
10146         if (bar.tv_sec == bar.tv_sec)
10147                 exit(0);
10148 #endif
10149         exit(1);
10150 }
10151 EOCP
10152         flags=''
10153         for s_timezone in '-DS_TIMEZONE' ''; do
10154         sysselect=''
10155         for s_timeval in '-DS_TIMEVAL' ''; do
10156         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10157         for i_time in '' '-DI_TIME'; do
10158         for i_systime in '-DI_SYSTIME' ''; do
10159                 case "$flags" in
10160                 '') $echo $n ".$c"
10161                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10162                         if eval $compile; then
10163                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10164                                 shift
10165                                 flags="$*"
10166                                 echo " "
10167                                 $echo $n "Succeeded with $flags$c"
10168                         fi
10169                         ;;
10170                 esac
10171         done
10172         done
10173         done
10174         done
10175         done
10176         timeincl=''
10177         echo " "
10178         case "$flags" in
10179         *SYSTIMEKERNEL*) i_systimek="$define"
10180                 timeincl=`./findhdr sys/time.h`
10181                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10182         *) i_systimek="$undef";;
10183         esac
10184         case "$flags" in
10185         *I_TIME*) i_time="$define"
10186                 timeincl=`./findhdr time.h`" $timeincl"
10187                 echo "We'll include <time.h>." >&4;;
10188         *) i_time="$undef";;
10189         esac
10190         case "$flags" in
10191         *I_SYSTIME*) i_systime="$define"
10192                 timeincl=`./findhdr sys/time.h`" $timeincl"
10193                 echo "We'll include <sys/time.h>." >&4;;
10194         *) i_systime="$undef";;
10195         esac
10196         $rm_try
10197 fi
10198 : see if struct tm knows about tm_zone
10199 case "$i_systime$i_time" in
10200 *$define*)
10201         echo " "
10202         echo "Checking to see if your struct tm has tm_zone field..." >&4
10203         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10204         eval $hasfield
10205         ;;
10206 *)      val="$undef"
10207         set d_tm_tm_zone
10208         eval $setvar
10209         ;;
10210 esac
10211 case "$d_tm_tm_zone" in
10212 "$define")      echo "Yes, it does."   ;;
10213 *)              echo "No, it doesn't." ;;
10214 esac
10215 : see if struct tm knows about tm_gmtoff
10216 case "$i_systime$i_time" in
10217 *$define*)
10218         echo " "
10219         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10220         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10221         eval $hasfield
10222         ;;
10223 *)      val="$undef"
10224         set d_tm_tm_gmtoff
10225         eval $setvar
10226         ;;
10227 esac
10228 case "$d_tm_tm_gmtoff" in
10229 "$define")      echo "Yes, it does."   ;;
10230 *)              echo "No, it doesn't." ;;
10231 esac
10232
10233 : see if asctime_r exists
10234 set asctime_r d_asctime_r
10235 eval $inlibc
10236 case "$d_asctime_r" in
10237 "$define")
10238         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10239         case "$d_asctime_r_proto:$usethreads" in
10240         ":define")      d_asctime_r_proto=define
10241                 set d_asctime_r_proto asctime_r $hdrs
10242                 eval $hasproto ;;
10243         *)      ;;
10244         esac
10245         case "$d_asctime_r_proto" in
10246         define)
10247         case "$asctime_r_proto" in
10248         ''|0) try='char* asctime_r(const struct tm*, char*);'
10249         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10250         esac
10251         case "$asctime_r_proto" in
10252         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10253         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10254         esac
10255         case "$asctime_r_proto" in
10256         ''|0) try='int asctime_r(const struct tm*, char*);'
10257         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10258         esac
10259         case "$asctime_r_proto" in
10260         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10261         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10262         esac
10263         case "$asctime_r_proto" in
10264         ''|0)   d_asctime_r=undef
10265                 asctime_r_proto=0
10266                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10267         * )     case "$asctime_r_proto" in
10268                 REENTRANT_PROTO*) ;;
10269                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10270                 esac
10271                 echo "Prototype: $try" ;;
10272         esac
10273         ;;
10274         *)      case "$usethreads" in
10275                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10276                 esac
10277                 d_asctime_r=undef
10278                 asctime_r_proto=0
10279                 ;;
10280         esac
10281         ;;
10282 *)      asctime_r_proto=0
10283         ;;
10284 esac
10285
10286 : see if atolf exists
10287 set atolf d_atolf
10288 eval $inlibc
10289
10290 : see if atoll exists
10291 set atoll d_atoll
10292 eval $inlibc
10293
10294 : Look for GCC-style attribute format
10295 case "$d_attribute_format" in
10296 '')
10297 echo " "
10298 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10299 $cat >attrib.c <<'EOCP'
10300 #include <stdio.h>
10301 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10302 EOCP
10303 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10304         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10305                 echo "Your C compiler doesn't support __attribute__((format))."
10306                 val="$undef"
10307         else
10308                 echo "Your C compiler supports __attribute__((format))."
10309                 val="$define"
10310         fi
10311 else
10312         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10313         val="$undef"
10314 fi
10315 ;;
10316 *) val="$d_attribute_format" ;;
10317 esac
10318 set d_attribute_format
10319 eval $setvar
10320 $rm -f attrib*
10321
10322 : Look for GCC-style attribute format with null format allowed
10323 case "$d_printf_format_null" in
10324 '') case "$d_attribute_format" in
10325     $define)
10326         echo " "
10327         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10328 $cat >attrib.c <<EOCP
10329 #include <stdio.h>
10330 #$i_stdlib I_STDLIB
10331 #ifdef I_STDLIB
10332 #include <stdlib.h>
10333 #endif
10334 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10335 int null_printf (char* pat,...) { return (int)pat; }
10336 int main () { exit(null_printf(NULL)); }
10337 EOCP
10338         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10339             : run the executable in case it produces a run-time warning
10340             if $run ./attrib >>attrib.out 2>&1; then
10341                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10342                     echo "Your C compiler doesn't allow __printf__ format to be null."
10343                     val="$undef"
10344                 else
10345                     echo "Your C compiler allows __printf__ format to be null."
10346                     val="$define"
10347                 fi
10348             else
10349             echo "Your C compiler executable failed with __printf__ format null."
10350             val="$undef"
10351         fi
10352     else
10353         echo "Your C compiler fails with __printf__ format null."
10354         val="$undef"
10355     fi
10356     ;;
10357     *)  val="$undef" ;;
10358     esac
10359 ;;
10360 *)  val="$d_printf_format_null" ;;
10361 esac
10362 set d_printf_format_null
10363 eval $setvar
10364 $rm -f attrib*
10365
10366 : Look for GCC-style attribute malloc
10367 case "$d_attribute_malloc" in
10368 '')
10369 echo " "
10370 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10371 $cat >attrib.c <<'EOCP'
10372 #include <stdio.h>
10373 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10374 EOCP
10375 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10376         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10377                 echo "Your C compiler doesn't support __attribute__((malloc))."
10378                 val="$undef"
10379         else
10380                 echo "Your C compiler supports __attribute__((malloc))."
10381                 val="$define"
10382         fi
10383 else
10384         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10385         val="$undef"
10386 fi
10387 ;;
10388 *) val="$d_attribute_malloc" ;;
10389 esac
10390 set d_attribute_malloc
10391 eval $setvar
10392 $rm -f attrib*
10393
10394 : Look for GCC-style attribute nonnull
10395 case "$d_attribute_nonnull" in
10396 '')
10397 echo " "
10398 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10399 $cat >attrib.c <<'EOCP'
10400 #include <stdio.h>
10401 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10402 EOCP
10403 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10404         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10405                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10406                 val="$undef"
10407         else
10408                 echo "Your C compiler supports __attribute__((nonnull))."
10409                 val="$define"
10410         fi
10411 else
10412         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10413         val="$undef"
10414 fi
10415 ;;
10416 *) val="$d_attribute_nonnull" ;;
10417 esac
10418 set d_attribute_nonnull
10419 eval $setvar
10420 $rm -f attrib*
10421
10422 : Look for GCC-style attribute noreturn
10423 case "$d_attribute_noreturn" in
10424 '')
10425 echo " "
10426 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10427 $cat >attrib.c <<'EOCP'
10428 #include <stdio.h>
10429 void fall_over_dead( void ) __attribute__((noreturn));
10430 EOCP
10431 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10432         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10433                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10434                 val="$undef"
10435         else
10436                 echo "Your C compiler supports __attribute__((noreturn))."
10437                 val="$define"
10438         fi
10439 else
10440         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10441         val="$undef"
10442 fi
10443 ;;
10444 *) val="$d_attribute_noreturn" ;;
10445 esac
10446 set d_attribute_noreturn
10447 eval $setvar
10448 $rm -f attrib*
10449
10450 : Look for GCC-style attribute pure
10451 case "$d_attribute_pure" in
10452 '')
10453 echo " "
10454 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10455 $cat >attrib.c <<'EOCP'
10456 #include <stdio.h>
10457 int square( int n ) __attribute__((pure));
10458 EOCP
10459 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10460         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10461                 echo "Your C compiler doesn't support __attribute__((pure))."
10462                 val="$undef"
10463         else
10464                 echo "Your C compiler supports __attribute__((pure))."
10465                 val="$define"
10466         fi
10467 else
10468         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10469         val="$undef"
10470 fi
10471 ;;
10472 *) val="$d_attribute_pure" ;;
10473 esac
10474 set d_attribute_pure
10475 eval $setvar
10476 $rm -f attrib*
10477
10478 : Look for GCC-style attribute unused
10479 case "$d_attribute_unused" in
10480 '')
10481 echo " "
10482 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10483 $cat >attrib.c <<'EOCP'
10484 #include <stdio.h>
10485 int do_something( int dummy __attribute__((unused)), int n );
10486 EOCP
10487 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10488         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10489                 echo "Your C compiler doesn't support __attribute__((unused))."
10490                 val="$undef"
10491         else
10492                 echo "Your C compiler supports __attribute__((unused))."
10493                 val="$define"
10494         fi
10495 else
10496         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10497         val="$undef"
10498 fi
10499 ;;
10500 *) val="$d_attribute_unused" ;;
10501 esac
10502 set d_attribute_unused
10503 eval $setvar
10504 $rm -f attrib*
10505
10506 : Look for GCC-style attribute deprecated
10507 case "$d_attribute_deprecated" in
10508 '')
10509 echo " "
10510 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10511 $cat >attrib.c <<'EOCP'
10512 #include <stdio.h>
10513 int I_am_deprecated(void) __attribute__((deprecated));
10514 EOCP
10515 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10516         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10517                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10518                 val="$undef"
10519         else
10520                 echo "Your C compiler supports __attribute__((deprecated))."
10521                 val="$define"
10522         fi
10523 else
10524         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10525         val="$undef"
10526 fi
10527 ;;
10528 *) val="$d_attribute_deprecated" ;;
10529 esac
10530 set d_attribute_deprecated
10531 eval $setvar
10532 $rm -f attrib*
10533
10534 : Look for GCC-style attribute warn_unused_result
10535 case "$d_attribute_warn_unused_result" in
10536 '')
10537 echo " "
10538 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10539 $cat >attrib.c <<'EOCP'
10540 #include <stdio.h>
10541 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10542 EOCP
10543 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10544         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10545                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10546                 val="$undef"
10547         else
10548                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10549                 val="$define"
10550         fi
10551 else
10552         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10553         val="$undef"
10554 fi
10555 ;;
10556 *) val="$d_attribute_warn_unused_result" ;;
10557 esac
10558 set d_attribute_warn_unused_result
10559 eval $setvar
10560 $rm -f attrib*
10561
10562 : see if bcmp exists
10563 set bcmp d_bcmp
10564 eval $inlibc
10565
10566 : see if bcopy exists
10567 set bcopy d_bcopy
10568 eval $inlibc
10569
10570 : see if getpgrp exists
10571 set getpgrp d_getpgrp
10572 eval $inlibc
10573
10574 case "$d_getpgrp" in
10575 "$define")
10576         echo " "
10577         echo "Checking to see which flavor of getpgrp is in use..."
10578         $cat >try.c <<EOP
10579 #$i_unistd I_UNISTD
10580 #include <sys/types.h>
10581 #ifdef I_UNISTD
10582 #  include <unistd.h>
10583 #endif
10584 #$i_stdlib I_STDLIB
10585 #ifdef I_STDLIB
10586 #include <stdlib.h>
10587 #endif
10588 int main()
10589 {
10590         if (getuid() == 0) {
10591                 printf("(I see you are running Configure as super-user...)\n");
10592                 setuid(1);
10593         }
10594 #ifdef TRY_BSD_PGRP
10595         if (getpgrp(1) == 0)
10596                 exit(0);
10597 #else
10598         if (getpgrp() > 0)
10599                 exit(0);
10600 #endif
10601         exit(1);
10602 }
10603 EOP
10604         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10605                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10606                 val="$define"
10607         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10608                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10609                 val="$undef"
10610         else
10611                 echo "I can't seem to compile and run the test program."
10612                 if ./usg; then
10613                         xxx="a USG one, i.e. you use getpgrp()."
10614                 else
10615                         # SVR4 systems can appear rather BSD-ish.
10616                         case "$i_unistd" in
10617                         $undef)
10618                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10619                                 val="$define"
10620                                 ;;
10621                         $define)
10622                                 xxx="probably a USG one, i.e. you use getpgrp()."
10623                                 val="$undef"
10624                                 ;;
10625                         esac
10626                 fi
10627                 echo "Assuming your getpgrp is $xxx" >&4
10628         fi
10629         ;;
10630 *) val="$undef";;
10631 esac
10632 set d_bsdgetpgrp
10633 eval $setvar
10634 $rm_try
10635
10636 : see if setpgrp exists
10637 set setpgrp d_setpgrp
10638 eval $inlibc
10639
10640 case "$d_setpgrp" in
10641 "$define")
10642         echo " "
10643         echo "Checking to see which flavor of setpgrp is in use..."
10644         $cat >try.c <<EOP
10645 #$i_unistd I_UNISTD
10646 #include <sys/types.h>
10647 #ifdef I_UNISTD
10648 #  include <unistd.h>
10649 #endif
10650 #$i_stdlib I_STDLIB
10651 #ifdef I_STDLIB
10652 #include <stdlib.h>
10653 #endif
10654 int main()
10655 {
10656         if (getuid() == 0) {
10657                 printf("(I see you are running Configure as super-user...)\n");
10658                 setuid(1);
10659         }
10660 #ifdef TRY_BSD_PGRP
10661         if (-1 == setpgrp(1, 1))
10662                 exit(0);
10663 #else
10664         if (setpgrp() != -1)
10665                 exit(0);
10666 #endif
10667         exit(1);
10668 }
10669 EOP
10670         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10671                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10672                 val="$define"
10673         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10674                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10675                 val="$undef"
10676         else
10677                 echo "(I can't seem to compile and run the test program.)"
10678                 if ./usg; then
10679                         xxx="a USG one, i.e. you use setpgrp()."
10680                 else
10681                         # SVR4 systems can appear rather BSD-ish.
10682                         case "$i_unistd" in
10683                         $undef)
10684                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10685                                 val="$define"
10686                                 ;;
10687                         $define)
10688                                 xxx="probably a USG one, i.e. you use setpgrp()."
10689                                 val="$undef"
10690                                 ;;
10691                         esac
10692                 fi
10693                 echo "Assuming your setpgrp is $xxx" >&4
10694         fi
10695         ;;
10696 *) val="$undef";;
10697 esac
10698 set d_bsdsetpgrp
10699 eval $setvar
10700 $rm_try
10701
10702 : Look for GCC-style __builtin_choose_expr
10703 case "$d_builtin_choose_expr" in
10704 '')
10705     echo " "
10706     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10707     $cat >try.c <<'EOCP'
10708 #include <assert.h>
10709 #include <stdlib.h>
10710 #include <stdio.h>
10711
10712 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10713
10714 int main(void) {
10715     assert( SYRINX(1) == 2112 );
10716     assert( SYRINX(1) != 5150 );
10717     assert( SYRINX(0) == 5150 );
10718     assert( SYRINX(0) != 2112 );
10719     puts( "All good!" );
10720     exit(0);
10721 }
10722
10723 EOCP
10724     set try
10725     if eval $compile && $run ./try; then
10726         echo "Your C compiler supports __builtin_choose_expr."
10727         val="$define"
10728     else
10729         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10730         val="$undef"
10731     fi
10732 ;;
10733 *) val="$d_builtin_choose_expr" ;;
10734 esac
10735
10736 set d_builtin_choose_expr
10737 eval $setvar
10738 $rm_try
10739
10740 : Look for GCC-style __builtin_expect
10741 case "$d_builtin_expect" in
10742 '')
10743     echo " "
10744     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10745     $cat >try.c <<'EOCP'
10746 int main(void) {
10747     int n = 50;
10748     if ( __builtin_expect(n, 0) ) n = 1;
10749     /* Remember shell exit code truth is 0, C truth is non-zero */
10750     return !(n == 1);
10751 }
10752 EOCP
10753     set try
10754     if eval $compile && $run ./try; then
10755         echo "Your C compiler supports __builtin_expect."
10756         val="$define"
10757     else
10758         echo "Your C compiler doesn't seem to understand __builtin_expect."
10759         val="$undef"
10760     fi
10761     ;;
10762 *) val="$d_builtin_expect" ;;
10763 esac
10764
10765 set d_builtin_expect
10766 eval $setvar
10767 $rm_try
10768
10769 : see if bzero exists
10770 set bzero d_bzero
10771 eval $inlibc
10772
10773 : see if stdarg is available
10774 echo " "
10775 if $test `./findhdr stdarg.h`; then
10776         echo "<stdarg.h> found." >&4
10777         valstd="$define"
10778 else
10779         echo "<stdarg.h> NOT found." >&4
10780         valstd="$undef"
10781 fi
10782
10783 : see if varags is available
10784 echo " "
10785 if $test `./findhdr varargs.h`; then
10786         echo "<varargs.h> found." >&4
10787 else
10788         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10789 fi
10790
10791 : set up the varargs testing programs
10792 $cat > varargs.c <<EOP
10793 #ifdef I_STDARG
10794 #include <stdarg.h>
10795 #endif
10796 #ifdef I_VARARGS
10797 #include <varargs.h>
10798 #endif
10799
10800 #ifdef I_STDARG
10801 int f(char *p, ...)
10802 #else
10803 int f(va_alist)
10804 va_dcl
10805 #endif
10806 {
10807         va_list ap;
10808 #ifndef I_STDARG
10809         char *p;
10810 #endif
10811 #ifdef I_STDARG
10812         va_start(ap,p);
10813 #else
10814         va_start(ap);
10815         p = va_arg(ap, char *);
10816 #endif
10817         va_end(ap);
10818         return 0;
10819 }
10820 EOP
10821 $cat > varargs <<EOP
10822 $startsh
10823 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10824         echo "true"
10825 else
10826         echo "false"
10827 fi
10828 $rm -f varargs$_o
10829 EOP
10830 chmod +x varargs
10831
10832 : now check which varargs header should be included
10833 echo " "
10834 i_varhdr=''
10835 case "$valstd" in
10836 "$define")
10837         if `./varargs I_STDARG`; then
10838                 val='stdarg.h'
10839         elif `./varargs I_VARARGS`; then
10840                 val='varargs.h'
10841         fi
10842         ;;
10843 *)
10844         if `./varargs I_VARARGS`; then
10845                 val='varargs.h'
10846         fi
10847         ;;
10848 esac
10849 case "$val" in
10850 '')
10851 echo "I could not find the definition for va_dcl... You have problems..." >&4
10852         val="$undef"; set i_stdarg; eval $setvar
10853         val="$undef"; set i_varargs; eval $setvar
10854         ;;
10855 *)
10856         set i_varhdr
10857         eval $setvar
10858         case "$i_varhdr" in
10859         stdarg.h)
10860                 val="$define"; set i_stdarg; eval $setvar
10861                 val="$undef"; set i_varargs; eval $setvar
10862                 ;;
10863         varargs.h)
10864                 val="$undef"; set i_stdarg; eval $setvar
10865                 val="$define"; set i_varargs; eval $setvar
10866                 ;;
10867         esac
10868         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10869 esac
10870 $rm -f varargs*
10871
10872 : see if the Compiler supports C99 variadic macros
10873 case "$i_stdarg$i_stdlib" in
10874     "$define$define")
10875     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10876     $cat >try.c <<EOCP
10877 #include <stdio.h>
10878 #include <stdarg.h>
10879
10880 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10881
10882 int main() {
10883   char buf[20];
10884   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10885   puts(buf);
10886   return 0;
10887 }
10888 EOCP
10889     set try
10890     if eval $compile && $run ./try 2>&1 >/dev/null; then
10891         case "`$run ./try`" in
10892             "123 456 789")
10893             echo "You have C99 variadic macros." >&4
10894             d_c99_variadic_macros="$define"
10895             ;;
10896             *)
10897             echo "You don't have functional C99 variadic macros." >&4
10898             d_c99_variadic_macros="$undef"
10899             ;;
10900         esac
10901     else
10902         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10903         d_c99_variadic_macros="$undef"
10904     fi
10905     $rm_try
10906     ;;
10907     *)
10908     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10909     d_c99_variadic_macros="$undef"
10910     ;;
10911 esac
10912
10913 : see if signal is declared as pointer to function returning int or void
10914 echo " "
10915 xxx=`./findhdr signal.h`
10916 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10917 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10918         echo "You have int (*signal())() instead of void." >&4
10919         val="$undef"
10920 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10921         echo "You have void (*signal())()." >&4
10922         val="$define"
10923 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10924         echo "You have int (*signal())() instead of void." >&4
10925         val="$undef"
10926 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10927         echo "You have void (*signal())()." >&4
10928         val="$define"
10929 else
10930         case "$d_voidsig" in
10931         '')
10932         echo "I can't determine whether signal handler returns void or int..." >&4
10933                 dflt=void
10934                 rp="What type does your signal handler return?"
10935                 . ./myread
10936                 case "$ans" in
10937                 v*) val="$define";;
10938                 *) val="$undef";;
10939                 esac;;
10940         "$define")
10941                 echo "As you already told me, signal handler returns void." >&4
10942                 val="$define"
10943                 ;;
10944         *)      echo "As you already told me, signal handler returns int." >&4
10945                 val="$undef"
10946                 ;;
10947         esac
10948 fi
10949 set d_voidsig
10950 eval $setvar
10951 case "$d_voidsig" in
10952 "$define") signal_t="void";;
10953 *) signal_t="int";;
10954 esac
10955 $rm -f $$.tmp
10956
10957 : check for ability to cast large floats to 32-bit ints.
10958 echo " "
10959 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10960 if $test "$intsize" -ge 4; then
10961         xxx=int
10962 else
10963         xxx=long
10964 fi
10965 $cat >try.c <<EOCP
10966 #include <stdio.h>
10967 #$i_stdlib I_STDLIB
10968 #ifdef I_STDLIB
10969 #include <stdlib.h>
10970 #endif
10971 #include <sys/types.h>
10972 #include <signal.h>
10973 $signal_t blech(int s) { exit(3); }
10974 int main()
10975 {
10976         $xxx i32;
10977         double f, g;
10978         int result = 0;
10979         char str[16];
10980         signal(SIGFPE, blech);
10981
10982         /* Don't let compiler optimize the test away.  Store the number
10983            in a writable string for gcc to pass to sscanf under HP/UX.
10984         */
10985         sprintf(str, "2147483647");
10986         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10987         g = 10 * f;
10988         i32  = ($xxx) g;
10989
10990         /* x86 processors will probably give 0x8000 0000, which is a
10991            sign change.  We don't want that.  We want to mimic SPARC
10992            behavior here, which is to preserve the sign and give
10993            back 0x7fff ffff.
10994         */
10995         if (i32 != ($xxx) f)
10996                 result |= 1;
10997         exit(result);
10998 }
10999 EOCP
11000 set try
11001 if eval $compile_ok; then
11002         $run ./try
11003         yyy=$?
11004 else
11005         echo "(I can't seem to compile the test program--assuming it can't)"
11006         yyy=1
11007 fi
11008 case "$yyy" in
11009 0)      val="$define"
11010         echo "Yup, it can."
11011         ;;
11012 *)      val="$undef"
11013         echo "Nope, it can't."
11014         ;;
11015 esac
11016 set d_casti32
11017 eval $setvar
11018 $rm_try
11019
11020 : check for ability to cast negative floats to unsigned
11021 echo " "
11022 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11023 $cat >try.c <<EOCP
11024 #include <stdio.h>
11025 #$i_stdlib I_STDLIB
11026 #ifdef I_STDLIB
11027 #include <stdlib.h>
11028 #endif
11029 #include <sys/types.h>
11030 #include <signal.h>
11031 $signal_t blech(int s) { exit(7); }
11032 $signal_t blech_in_list(int s) { exit(4); }
11033 unsigned long dummy_long(unsigned long p) { return p; }
11034 unsigned int dummy_int(unsigned int p) { return p; }
11035 unsigned short dummy_short(unsigned short p) { return p; }
11036 int main()
11037 {
11038         double f;
11039         unsigned long along;
11040         unsigned int aint;
11041         unsigned short ashort;
11042         int result = 0;
11043         char str[16];
11044
11045         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11046            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11047            optimized the whole file away
11048         */
11049         /* Store the number in a writable string for gcc to pass to
11050            sscanf under HP/UX.
11051         */
11052         sprintf(str, "-123");
11053         sscanf(str, "%lf", &f);  /* f = -123.; */
11054
11055         signal(SIGFPE, blech);
11056         along = (unsigned long)f;
11057         aint = (unsigned int)f;
11058         ashort = (unsigned short)f;
11059         if (along != (unsigned long)-123)
11060                 result |= 1;
11061         if (aint != (unsigned int)-123)
11062                 result |= 1;
11063         if (ashort != (unsigned short)-123)
11064                 result |= 1;
11065         sprintf(str, "1073741824.");
11066         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11067         f = f + f;
11068         along = 0;
11069         along = (unsigned long)f;
11070         if (along != 0x80000000)
11071                 result |= 2;
11072         f -= 1.;
11073         along = 0;
11074         along = (unsigned long)f;
11075         if (along != 0x7fffffff)
11076                 result |= 1;
11077         f += 2.;
11078         along = 0;
11079         along = (unsigned long)f;
11080         if (along != 0x80000001)
11081                 result |= 2;
11082         if (result)
11083                 exit(result);
11084         signal(SIGFPE, blech_in_list);
11085         sprintf(str, "123.");
11086         sscanf(str, "%lf", &f);  /* f = 123.; */
11087         along = dummy_long((unsigned long)f);
11088         aint = dummy_int((unsigned int)f);
11089         ashort = dummy_short((unsigned short)f);
11090         if (along != (unsigned long)123)
11091                 result |= 4;
11092         if (aint != (unsigned int)123)
11093                 result |= 4;
11094         if (ashort != (unsigned short)123)
11095                 result |= 4;
11096         exit(result);
11097
11098 }
11099 EOCP
11100 set try
11101 if eval $compile_ok; then
11102         $run ./try
11103         castflags=$?
11104 else
11105         echo "(I can't seem to compile the test program--assuming it can't)"
11106         castflags=7
11107 fi
11108 case "$castflags" in
11109 0)      val="$define"
11110         echo "Yup, it can."
11111         ;;
11112 *)      val="$undef"
11113         echo "Nope, it can't."
11114         ;;
11115 esac
11116 set d_castneg
11117 eval $setvar
11118 $rm_try
11119
11120 : see if vprintf exists
11121 echo " "
11122 if set vprintf val -f d_vprintf; eval $csym; $val; then
11123         echo 'vprintf() found.' >&4
11124         val="$define"
11125         $cat >try.c <<EOF
11126 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11127 #$i_varargs I_VARARGS
11128
11129 #$i_stdlib I_STDLIB
11130 #$i_unistd I_UNISTD
11131
11132 #ifdef I_STDARG
11133 #  include <stdarg.h>
11134 #else /* I_VARARGS */
11135 #  include <varargs.h>
11136 #endif
11137
11138 #ifdef I_UNISTD
11139 #  include <unistd.h>
11140 #endif
11141
11142 #ifdef I_STDLIB
11143 #  include <stdlib.h>
11144 #endif
11145
11146 #include <stdio.h> /* vsprintf prototype */
11147
11148 #ifdef I_STDARG
11149 void xxx(int n, ...)
11150 {
11151     va_list args;
11152     char buf[10];
11153     va_start(args, n);
11154     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11155 }
11156 int main() { xxx(1, "foo"); }
11157
11158 #else /* I_VARARGS */
11159
11160 xxx(va_alist)
11161 va_dcl
11162 {
11163     va_list args;
11164     char buf[10];
11165     va_start(args);
11166     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11167 }
11168 int main() { xxx("foo"); }
11169
11170 #endif
11171
11172 EOF
11173         set try
11174         if eval $compile_ok; then
11175                 if $run ./try; then
11176                         echo "Your vsprintf() returns (int)." >&4
11177                         val2="$undef"
11178                 else
11179                         echo "Your vsprintf() returns (char*)." >&4
11180                         val2="$define"
11181                 fi
11182         else
11183                 echo 'I am unable to compile the vsprintf() test program.' >&4
11184                 # We shouldn't get here.  If we do, assume the standard signature,
11185                 # not the old BSD one.
11186                 echo 'Guessing that vsprintf() returns (int).' >&4
11187                 val2="$undef"
11188         fi
11189 else
11190         echo 'vprintf() NOT found.' >&4
11191         val="$undef"
11192         val2="$undef"
11193 fi
11194 $rm_try
11195 set d_vprintf
11196 eval $setvar
11197 val=$val2
11198 set d_charvspr
11199 eval $setvar
11200
11201 : see if chown exists
11202 set chown d_chown
11203 eval $inlibc
11204
11205 : see if chroot exists
11206 set chroot d_chroot
11207 eval $inlibc
11208
11209 : see if chsize exists
11210 set chsize d_chsize
11211 eval $inlibc
11212
11213 : see if class exists
11214 set class d_class
11215 eval $inlibc
11216
11217 : see if clearenv exists
11218 set clearenv d_clearenv
11219 eval $inlibc
11220
11221 : Define hasstruct macro for Configure internal use
11222 hasstruct='varname=$1; struct=$2; shift; shift;
11223 while $test $# -ge 2; do
11224         case "$1" in
11225         $define) echo "#include <$2>";;
11226         esac ;
11227     shift 2;
11228 done > try.c;
11229 echo "int main () { struct $struct foo; }" >> try.c;
11230 set try;
11231 if eval $compile; then
11232         val="$define";
11233 else
11234         val="$undef";
11235 fi;
11236 set $varname;
11237 eval $setvar;
11238 $rm_try'
11239
11240 : see whether socket exists
11241 socketlib=''
11242 sockethdr=''
11243 echo " "
11244 $echo $n "Hmm... $c" >&4
11245 if set socket val -f d_socket; eval $csym; $val; then
11246         echo "Looks like you have Berkeley networking support." >&4
11247         d_socket="$define"
11248         if set setsockopt val -f; eval $csym; $val; then
11249                 d_oldsock="$undef"
11250         else
11251                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11252                 d_oldsock="$define"
11253         fi
11254 else
11255         if $contains socklib libc.list >/dev/null 2>&1; then
11256                 echo "Looks like you have Berkeley networking support." >&4
11257                 d_socket="$define"
11258                 : we will have to assume that it supports the 4.2 BSD interface
11259                 d_oldsock="$undef"
11260         else
11261                 echo "You don't have Berkeley networking in libc$_a..." >&4
11262                 if test "X$d_socket" = "X$define"; then
11263                    echo "...but you seem to believe that you have sockets." >&4
11264                 else
11265                         for net in net socket
11266                         do
11267                                 if test -f /usr/lib/lib$net$_a; then
11268                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11269                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11270                                         if $contains socket libc.list >/dev/null 2>&1; then
11271                                                 d_socket="$define"
11272                                                 socketlib="-l$net"
11273                                                 case "$net" in
11274                                                 net)
11275                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11276                                                         sockethdr="-I/usr/netinclude"
11277                                                         ;;
11278                                                 esac
11279                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11280                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11281                                                         d_oldsock="$undef"
11282                                                 else
11283                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11284                                                         d_oldsock="$define"
11285                                                 fi
11286                                                 break
11287                                         fi
11288                                 fi
11289                         done
11290                         if test "X$d_socket" != "X$define"; then
11291                            echo "or anywhere else I see." >&4
11292                            d_socket="$undef"
11293                            d_oldsock="$undef"
11294                         fi
11295                 fi
11296         fi
11297 fi
11298
11299 : see if socketpair exists
11300 set socketpair d_sockpair
11301 eval $inlibc
11302
11303
11304 echo " "
11305 echo "Checking the availability of certain socket constants..." >&4
11306 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11307         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11308         $cat >try.c <<EOF
11309 #include <sys/types.h>
11310 #include <sys/socket.h>
11311 int main() {
11312     int i = $ENUM;
11313 }
11314 EOF
11315         val="$undef"
11316         set try; if eval $compile; then
11317                 val="$define"
11318         fi
11319         set d_${enum}; eval $setvar
11320         $rm_try
11321 done
11322
11323 : see if this is a sys/uio.h system
11324 set sys/uio.h i_sysuio
11325 eval $inhdr
11326
11327 : Check for cmsghdr support
11328 echo " "
11329 echo "Checking to see if your system supports struct cmsghdr..." >&4
11330 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11331 eval $hasstruct
11332 case "$d_cmsghdr_s" in
11333 "$define")      echo "Yes, it does."   ;;
11334 *)              echo "No, it doesn't." ;;
11335 esac
11336
11337
11338 : check for const keyword
11339 echo " "
11340 echo 'Checking to see if your C compiler knows about "const"...' >&4
11341 $cat >const.c <<'EOCP'
11342 typedef struct spug { int drokk; } spug;
11343 int main()
11344 {
11345         const char *foo;
11346         const spug y = { 0 };
11347 }
11348 EOCP
11349 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11350         val="$define"
11351         echo "Yup, it does."
11352 else
11353         val="$undef"
11354         echo "Nope, it doesn't."
11355 fi
11356 set d_const
11357 eval $setvar
11358
11359 : see if copysignl exists
11360 set copysignl d_copysignl
11361 eval $inlibc
11362
11363 : see if crypt exists
11364 echo " "
11365 set crypt d_crypt
11366 eval $inlibc
11367 case "$d_crypt" in
11368 $define) cryptlib='' ;;
11369 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11370                 echo 'crypt() found.' >&4
11371                 val="$define"
11372                 cryptlib=''
11373         else
11374                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11375                 if $test -z "$cryptlib"; then
11376                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11377                 else
11378                         cryptlib=-lcrypt
11379                 fi
11380                 if $test -z "$cryptlib"; then
11381                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11382                 else
11383                         cryptlib=-lcrypt
11384                 fi
11385                 if $test -z "$cryptlib"; then
11386                         cryptlib=`./loc libcrypt$_a "" $libpth`
11387                 else
11388                         cryptlib=-lcrypt
11389                 fi
11390                 if $test -z "$cryptlib"; then
11391                         echo 'crypt() NOT found.' >&4
11392                         val="$undef"
11393                 else
11394                         val="$define"
11395                 fi
11396         fi
11397         set d_crypt
11398         eval $setvar
11399         ;;
11400 esac
11401
11402 : see if this is a crypt.h system
11403 set crypt.h i_crypt
11404 eval $inhdr
11405
11406 : see if crypt_r exists
11407 set crypt_r d_crypt_r
11408 eval $inlibc
11409 case "$d_crypt_r" in
11410 "$define")
11411         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11412         case "$d_crypt_r_proto:$usethreads" in
11413         ":define")      d_crypt_r_proto=define
11414                 set d_crypt_r_proto crypt_r $hdrs
11415                 eval $hasproto ;;
11416         *)      ;;
11417         esac
11418         case "$d_crypt_r_proto" in
11419         define)
11420         case "$crypt_r_proto" in
11421         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11422         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11423         esac
11424         case "$crypt_r_proto" in
11425         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11426         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11427         esac
11428         case "$crypt_r_proto" in
11429         ''|0)   d_crypt_r=undef
11430                 crypt_r_proto=0
11431                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11432         * )     case "$crypt_r_proto" in
11433                 REENTRANT_PROTO*) ;;
11434                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11435                 esac
11436                 echo "Prototype: $try" ;;
11437         esac
11438         ;;
11439         *)      case "$usethreads" in
11440                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11441                 esac
11442                 d_crypt_r=undef
11443                 crypt_r_proto=0
11444                 ;;
11445         esac
11446         ;;
11447 *)      crypt_r_proto=0
11448         ;;
11449 esac
11450
11451 : get csh whereabouts
11452 case "$csh" in
11453 'csh') val="$undef" ;;
11454 *) val="$define" ;;
11455 esac
11456 set d_csh
11457 eval $setvar
11458 : Respect a hint or command line value for full_csh.
11459 case "$full_csh" in
11460 '') full_csh=$csh ;;
11461 esac
11462
11463 : see if ctermid exists
11464 set ctermid d_ctermid
11465 eval $inlibc
11466
11467 : see if ctermid_r exists
11468 set ctermid_r d_ctermid_r
11469 eval $inlibc
11470 case "$d_ctermid_r" in
11471 "$define")
11472         hdrs="$i_systypes sys/types.h define stdio.h "
11473         case "$d_ctermid_r_proto:$usethreads" in
11474         ":define")      d_ctermid_r_proto=define
11475                 set d_ctermid_r_proto ctermid_r $hdrs
11476                 eval $hasproto ;;
11477         *)      ;;
11478         esac
11479         case "$d_ctermid_r_proto" in
11480         define)
11481         case "$ctermid_r_proto" in
11482         ''|0) try='char* ctermid_r(char*);'
11483         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11484         esac
11485         case "$ctermid_r_proto" in
11486         ''|0)   d_ctermid_r=undef
11487                 ctermid_r_proto=0
11488                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11489         * )     case "$ctermid_r_proto" in
11490                 REENTRANT_PROTO*) ;;
11491                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11492                 esac
11493                 echo "Prototype: $try" ;;
11494         esac
11495         ;;
11496         *)      case "$usethreads" in
11497                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11498                 esac
11499                 d_ctermid_r=undef
11500                 ctermid_r_proto=0
11501                 ;;
11502         esac
11503         ;;
11504 *)      ctermid_r_proto=0
11505         ;;
11506 esac
11507
11508 : see if ctime_r exists
11509 set ctime_r d_ctime_r
11510 eval $inlibc
11511 case "$d_ctime_r" in
11512 "$define")
11513         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11514         case "$d_ctime_r_proto:$usethreads" in
11515         ":define")      d_ctime_r_proto=define
11516                 set d_ctime_r_proto ctime_r $hdrs
11517                 eval $hasproto ;;
11518         *)      ;;
11519         esac
11520         case "$d_ctime_r_proto" in
11521         define)
11522         case "$ctime_r_proto" in
11523         ''|0) try='char* ctime_r(const time_t*, char*);'
11524         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11525         esac
11526         case "$ctime_r_proto" in
11527         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11528         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11529         esac
11530         case "$ctime_r_proto" in
11531         ''|0) try='int ctime_r(const time_t*, char*);'
11532         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11533         esac
11534         case "$ctime_r_proto" in
11535         ''|0) try='int ctime_r(const time_t*, char*, int);'
11536         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11537         esac
11538         case "$ctime_r_proto" in
11539         ''|0)   d_ctime_r=undef
11540                 ctime_r_proto=0
11541                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11542         * )     case "$ctime_r_proto" in
11543                 REENTRANT_PROTO*) ;;
11544                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11545                 esac
11546                 echo "Prototype: $try" ;;
11547         esac
11548         ;;
11549         *)      case "$usethreads" in
11550                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11551                 esac
11552                 d_ctime_r=undef
11553                 ctime_r_proto=0
11554                 ;;
11555         esac
11556         ;;
11557 *)      ctime_r_proto=0
11558         ;;
11559 esac
11560
11561 : see if cuserid exists
11562 set cuserid d_cuserid
11563 eval $inlibc
11564
11565 : see if this is a limits.h system
11566 set limits.h i_limits
11567 eval $inhdr
11568
11569 : see if this is a float.h system
11570 set float.h i_float
11571 eval $inhdr
11572
11573 : See if number of significant digits in a double precision number is known
11574 echo " "
11575 $cat >dbl_dig.c <<EOM
11576 #$i_limits I_LIMITS
11577 #$i_float I_FLOAT
11578 #ifdef I_LIMITS
11579 #include <limits.h>
11580 #endif
11581 #ifdef I_FLOAT
11582 #include <float.h>
11583 #endif
11584 #ifdef DBL_DIG
11585 printf("Contains DBL_DIG");
11586 #endif
11587 EOM
11588 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11589 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11590         echo "DBL_DIG found." >&4
11591         val="$define"
11592 else
11593         echo "DBL_DIG NOT found." >&4
11594         val="$undef"
11595 fi
11596 $rm -f dbl_dig.?
11597 set d_dbl_dig
11598 eval $setvar
11599
11600 : see if dbm.h is available
11601 : see if dbmclose exists
11602 set dbmclose d_dbmclose
11603 eval $inlibc
11604
11605 case "$d_dbmclose" in
11606 $define)
11607         set dbm.h i_dbm
11608         eval $inhdr
11609         case "$i_dbm" in
11610         $define)
11611                 val="$undef"
11612                 set i_rpcsvcdbm
11613                 eval $setvar
11614                 ;;
11615         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11616                 eval $inhdr
11617                 ;;
11618         esac
11619         ;;
11620 *)      echo "We won't be including <dbm.h>"
11621         val="$undef"
11622         set i_dbm
11623         eval $setvar
11624         val="$undef"
11625         set i_rpcsvcdbm
11626         eval $setvar
11627         ;;
11628 esac
11629
11630 : see if prototype for dbminit is available
11631 echo " "
11632 set d_dbminitproto dbminit $i_dbm dbm.h
11633 eval $hasproto
11634
11635 : see if difftime exists
11636 set difftime d_difftime
11637 eval $inlibc
11638
11639 : see if this is a dirent system
11640 echo " "
11641 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11642         val="$define"
11643         echo "<dirent.h> found." >&4
11644 else
11645         val="$undef"
11646         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11647                 echo "<sys/dir.h> found." >&4
11648                 echo " "
11649         else
11650                 xinc=`./findhdr sys/ndir.h`
11651         fi
11652         echo "<dirent.h> NOT found." >&4
11653 fi
11654 set i_dirent
11655 eval $setvar
11656
11657 : Look for type of directory structure.
11658 echo " "
11659 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11660
11661 case "$direntrytype" in
11662 ''|' ')
11663         case "$i_dirent" in
11664         $define) guess1='struct dirent' ;;
11665         *) guess1='struct direct'  ;;
11666         esac
11667         ;;
11668 *)      guess1="$direntrytype"
11669         ;;
11670 esac
11671
11672 case "$guess1" in
11673 'struct dirent') guess2='struct direct' ;;
11674 *) guess2='struct dirent' ;;
11675 esac
11676
11677 if $contains "$guess1" try.c >/dev/null 2>&1; then
11678         direntrytype="$guess1"
11679         echo "Your directory entries are $direntrytype." >&4
11680 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11681         direntrytype="$guess2"
11682         echo "Your directory entries seem to be $direntrytype." >&4
11683 else
11684         echo "I don't recognize your system's directory entries." >&4
11685         rp="What type is used for directory entries on this system?"
11686         dflt="$guess1"
11687         . ./myread
11688         direntrytype="$ans"
11689 fi
11690 $rm_try
11691
11692 : see if the directory entry stores field length
11693 echo " "
11694 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11695 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11696         echo "Good, your directory entry keeps length information in d_namlen." >&4
11697         val="$define"
11698 else
11699         echo "Your directory entry does not know about the d_namlen field." >&4
11700         val="$undef"
11701 fi
11702 set d_dirnamlen
11703 eval $setvar
11704 $rm_try
11705
11706 : Look for DIR.dd_fd
11707 case "$i_dirent" in
11708 "$define")
11709     echo "Checking to see if DIR has a dd_fd member variable" >&4
11710     $cat >try.c <<EOCP
11711 #$i_stdlib I_STDLIB
11712 #ifdef I_STDLIB
11713 #include <stdlib.h>
11714 #endif
11715 #include <dirent.h>
11716
11717 int main() {
11718     DIR dir;
11719     dir.dd_fd = 1;
11720     return 0;
11721 }
11722 EOCP
11723     val=$undef
11724     set try
11725     if eval $compile; then
11726         echo "Yes, it does."
11727         val="$define"
11728     else
11729         echo "No, it does not."
11730         val="$undef"
11731     fi
11732     ;;
11733 *)
11734     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11735     val="$undef"
11736     ;;
11737 esac
11738 set d_dir_dd_fd
11739 eval $setvar
11740 $rm_try
11741
11742 : see if this is an sysdir system
11743 set sys/dir.h i_sysdir
11744 eval $inhdr
11745
11746 : see if this is an sysndir system
11747 set sys/ndir.h i_sysndir
11748 eval $inhdr
11749
11750 : Look for dirfd
11751 echo " "
11752 $cat >dirfd.c <<EOM
11753 #include <stdio.h>
11754 #$i_stdlib I_STDLIB
11755 #ifdef I_STDLIB
11756 #include <stdlib.h>
11757 #endif
11758 #$i_dirent I_DIRENT             /**/
11759 #$i_sysdir I_SYS_DIR            /**/
11760 #$i_sysndir I_SYS_NDIR          /**/
11761 #$i_systypes I_SYS_TYPES        /**/
11762 #if defined(I_SYS_TYPES)
11763 #include <sys/types.h>
11764 #endif
11765 #if defined(I_DIRENT)
11766 #include <dirent.h>
11767 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11768 #include <sys/dir.h>
11769 #endif
11770 #else
11771 #ifdef I_SYS_NDIR
11772 #include <sys/ndir.h>
11773 #else
11774 #ifdef I_SYS_DIR
11775 #ifdef hp9000s500
11776 #include <ndir.h>       /* may be wrong in the future */
11777 #else
11778 #include <sys/dir.h>
11779 #endif
11780 #endif
11781 #endif
11782 #endif 
11783 int main() {
11784         DIR *dirp = opendir(".");
11785         if (dirfd(dirp) >= 0)
11786                 exit(0);
11787         else
11788                 exit(1);
11789 }
11790 EOM
11791 val=$undef
11792 set dirfd
11793 if eval $compile; then
11794         val="$define"
11795 fi
11796 case "$val" in
11797 $define)        echo "dirfd() found." >&4       ;;
11798 *)              echo "dirfd() NOT found." >&4   ;;
11799 esac
11800 set d_dirfd
11801 eval $setvar
11802 $rm -f dirfd*
11803
11804 : see if dlerror exists
11805 xxx_runnm="$runnm"
11806 runnm=false
11807 set dlerror d_dlerror
11808 eval $inlibc
11809 runnm="$xxx_runnm"
11810
11811 : see if dlfcn is available
11812 set dlfcn.h i_dlfcn
11813 eval $inhdr
11814
11815 : Check what extension to use for shared libs
11816 case "$usedl" in
11817 $define|y|true)
11818         $cat << EOM
11819
11820 On a few systems, the dynamically loaded modules that perl generates and uses
11821 will need a different extension than shared libs. The default will probably
11822 be appropriate.
11823
11824 EOM
11825         case "$dlext" in
11826         '')     dflt="$so" ;;
11827         *)      dflt="$dlext" ;;
11828         esac
11829         rp='What is the extension of dynamically loaded modules'
11830         . ./myread
11831         dlext="$ans"
11832         ;;
11833 *)
11834         dlext="none"
11835         ;;
11836 esac
11837
11838 : Check if dlsym need a leading underscore
11839 echo " "
11840 val="$undef"
11841
11842 case "$dlsrc" in
11843 dl_dlopen.xs)
11844         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11845         $cat >dyna.c <<'EOM'
11846 fred () { }
11847 EOM
11848
11849 $cat >fred.c<<EOM
11850
11851 #include <stdio.h>
11852 #$i_stdlib I_STDLIB
11853 #ifdef I_STDLIB
11854 #include <stdlib.h>
11855 #endif
11856 #$i_dlfcn I_DLFCN
11857 #ifdef I_DLFCN
11858 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11859 #else
11860 #include <sys/types.h>
11861 #include <nlist.h>
11862 #include <link.h>
11863 #endif
11864
11865 extern int fred() ;
11866
11867 int main()
11868 {
11869     void * handle ;
11870     void * symbol ;
11871 #ifndef RTLD_LAZY
11872     int mode = 1 ;
11873 #else
11874     int mode = RTLD_LAZY ;
11875 #endif
11876     handle = dlopen("./dyna.$dlext", mode) ;
11877     if (handle == NULL) {
11878         printf ("1\n") ;
11879         fflush (stdout) ;
11880         exit(0);
11881     }
11882     symbol = dlsym(handle, "fred") ;
11883     if (symbol == NULL) {
11884         /* try putting a leading underscore */
11885         symbol = dlsym(handle, "_fred") ;
11886         if (symbol == NULL) {
11887             printf ("2\n") ;
11888             fflush (stdout) ;
11889             exit(0);
11890         }
11891         printf ("3\n") ;
11892     }
11893     else
11894         printf ("4\n") ;
11895     fflush (stdout) ;
11896     exit(0);
11897 }
11898 EOM
11899         : Call the object file tmp-dyna.o in case dlext=o.
11900         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11901                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11902                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11903                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11904                 xxx=`$run ./fred`
11905                 case $xxx in
11906                 1)      echo "Test program failed using dlopen." >&4
11907                         echo "Perhaps you should not use dynamic loading." >&4;;
11908                 2)      echo "Test program failed using dlsym." >&4
11909                         echo "Perhaps you should not use dynamic loading." >&4;;
11910                 3)      echo "dlsym needs a leading underscore" >&4
11911                         val="$define" ;;
11912                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11913                 esac
11914         else
11915                 echo "I can't compile and run the test program." >&4
11916                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11917         fi
11918         ;;
11919 esac
11920
11921 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11922
11923 set d_dlsymun
11924 eval $setvar
11925
11926 : see if drand48_r exists
11927 set drand48_r d_drand48_r
11928 eval $inlibc
11929 case "$d_drand48_r" in
11930 "$define")
11931         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11932         case "$d_drand48_r_proto:$usethreads" in
11933         ":define")      d_drand48_r_proto=define
11934                 set d_drand48_r_proto drand48_r $hdrs
11935                 eval $hasproto ;;
11936         *)      ;;
11937         esac
11938         case "$d_drand48_r_proto" in
11939         define)
11940         case "$drand48_r_proto" in
11941         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11942         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
11943         esac
11944         case "$drand48_r_proto" in
11945         ''|0)   d_drand48_r=undef
11946                 drand48_r_proto=0
11947                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11948         * )     case "$drand48_r_proto" in
11949                 REENTRANT_PROTO*) ;;
11950                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11951                 esac
11952                 echo "Prototype: $try" ;;
11953         esac
11954         ;;
11955         *)      case "$usethreads" in
11956                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11957                 esac
11958                 d_drand48_r=undef
11959                 drand48_r_proto=0
11960                 ;;
11961         esac
11962         ;;
11963 *)      drand48_r_proto=0
11964         ;;
11965 esac
11966
11967 : see if prototype for drand48 is available
11968 echo " "
11969 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11970 eval $hasproto
11971
11972 : see if dup2 exists
11973 set dup2 d_dup2
11974 eval $inlibc
11975
11976 : see if eaccess exists
11977 set eaccess d_eaccess
11978 eval $inlibc
11979
11980 : see if endgrent exists
11981 set endgrent d_endgrent
11982 eval $inlibc
11983
11984 : see if this is an grp system
11985 set grp.h i_grp
11986 eval $inhdr
11987
11988 case "$i_grp" in
11989 $define)
11990         xxx=`./findhdr grp.h`
11991         $cppstdin $cppflags $cppminus < $xxx >$$.h
11992
11993         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11994                 val="$define"
11995         else
11996                 val="$undef"
11997         fi
11998         set d_grpasswd
11999         eval $setvar
12000
12001         $rm -f $$.h
12002         ;;
12003 *)
12004         val="$undef";
12005         set d_grpasswd; eval $setvar
12006         ;;
12007 esac
12008
12009 : see if endgrent_r exists
12010 set endgrent_r d_endgrent_r
12011 eval $inlibc
12012 case "$d_endgrent_r" in
12013 "$define")
12014         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12015         case "$d_endgrent_r_proto:$usethreads" in
12016         ":define")      d_endgrent_r_proto=define
12017                 set d_endgrent_r_proto endgrent_r $hdrs
12018                 eval $hasproto ;;
12019         *)      ;;
12020         esac
12021         case "$d_endgrent_r_proto" in
12022         define)
12023         case "$endgrent_r_proto" in
12024         ''|0) try='int endgrent_r(FILE**);'
12025         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12026         esac
12027         case "$endgrent_r_proto" in
12028         ''|0) try='void endgrent_r(FILE**);'
12029         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12030         esac
12031         case "$endgrent_r_proto" in
12032         ''|0)   d_endgrent_r=undef
12033                 endgrent_r_proto=0
12034                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12035         * )     case "$endgrent_r_proto" in
12036                 REENTRANT_PROTO*) ;;
12037                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12038                 esac
12039                 echo "Prototype: $try" ;;
12040         esac
12041         ;;
12042         *)      case "$usethreads" in
12043                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12044                 esac
12045                 d_endgrent_r=undef
12046                 endgrent_r_proto=0
12047                 ;;
12048         esac
12049         ;;
12050 *)      endgrent_r_proto=0
12051         ;;
12052 esac
12053
12054 : see if endhostent exists
12055 set endhostent d_endhent
12056 eval $inlibc
12057
12058 : see if this is a netdb.h system
12059 set netdb.h i_netdb
12060 eval $inhdr
12061
12062 : see if endhostent_r exists
12063 set endhostent_r d_endhostent_r
12064 eval $inlibc
12065 case "$d_endhostent_r" in
12066 "$define")
12067         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12068         case "$d_endhostent_r_proto:$usethreads" in
12069         ":define")      d_endhostent_r_proto=define
12070                 set d_endhostent_r_proto endhostent_r $hdrs
12071                 eval $hasproto ;;
12072         *)      ;;
12073         esac
12074         case "$d_endhostent_r_proto" in
12075         define)
12076         case "$endhostent_r_proto" in
12077         ''|0) try='int endhostent_r(struct hostent_data*);'
12078         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12079         esac
12080         case "$endhostent_r_proto" in
12081         ''|0) try='void endhostent_r(struct hostent_data*);'
12082         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12083         esac
12084         case "$endhostent_r_proto" in
12085         ''|0)   d_endhostent_r=undef
12086                 endhostent_r_proto=0
12087                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12088         * )     case "$endhostent_r_proto" in
12089                 REENTRANT_PROTO*) ;;
12090                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12091                 esac
12092                 echo "Prototype: $try" ;;
12093         esac
12094         ;;
12095         *)      case "$usethreads" in
12096                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12097                 esac
12098                 d_endhostent_r=undef
12099                 endhostent_r_proto=0
12100                 ;;
12101         esac
12102         ;;
12103 *)      endhostent_r_proto=0
12104         ;;
12105 esac
12106
12107 : see if endnetent exists
12108 set endnetent d_endnent
12109 eval $inlibc
12110
12111 : see if endnetent_r exists
12112 set endnetent_r d_endnetent_r
12113 eval $inlibc
12114 case "$d_endnetent_r" in
12115 "$define")
12116         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12117         case "$d_endnetent_r_proto:$usethreads" in
12118         ":define")      d_endnetent_r_proto=define
12119                 set d_endnetent_r_proto endnetent_r $hdrs
12120                 eval $hasproto ;;
12121         *)      ;;
12122         esac
12123         case "$d_endnetent_r_proto" in
12124         define)
12125         case "$endnetent_r_proto" in
12126         ''|0) try='int endnetent_r(struct netent_data*);'
12127         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12128         esac
12129         case "$endnetent_r_proto" in
12130         ''|0) try='void endnetent_r(struct netent_data*);'
12131         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12132         esac
12133         case "$endnetent_r_proto" in
12134         ''|0)   d_endnetent_r=undef
12135                 endnetent_r_proto=0
12136                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12137         * )     case "$endnetent_r_proto" in
12138                 REENTRANT_PROTO*) ;;
12139                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12140                 esac
12141                 echo "Prototype: $try" ;;
12142         esac
12143         ;;
12144         *)      case "$usethreads" in
12145                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12146                 esac
12147                 d_endnetent_r=undef
12148                 endnetent_r_proto=0
12149                 ;;
12150         esac
12151         ;;
12152 *)      endnetent_r_proto=0
12153         ;;
12154 esac
12155
12156 : see if endprotoent exists
12157 set endprotoent d_endpent
12158 eval $inlibc
12159
12160 : see if endprotoent_r exists
12161 set endprotoent_r d_endprotoent_r
12162 eval $inlibc
12163 case "$d_endprotoent_r" in
12164 "$define")
12165         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12166         case "$d_endprotoent_r_proto:$usethreads" in
12167         ":define")      d_endprotoent_r_proto=define
12168                 set d_endprotoent_r_proto endprotoent_r $hdrs
12169                 eval $hasproto ;;
12170         *)      ;;
12171         esac
12172         case "$d_endprotoent_r_proto" in
12173         define)
12174         case "$endprotoent_r_proto" in
12175         ''|0) try='int endprotoent_r(struct protoent_data*);'
12176         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12177         esac
12178         case "$endprotoent_r_proto" in
12179         ''|0) try='void endprotoent_r(struct protoent_data*);'
12180         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12181         esac
12182         case "$endprotoent_r_proto" in
12183         ''|0)   d_endprotoent_r=undef
12184                 endprotoent_r_proto=0
12185                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12186         * )     case "$endprotoent_r_proto" in
12187                 REENTRANT_PROTO*) ;;
12188                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12189                 esac
12190                 echo "Prototype: $try" ;;
12191         esac
12192         ;;
12193         *)      case "$usethreads" in
12194                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12195                 esac
12196                 d_endprotoent_r=undef
12197                 endprotoent_r_proto=0
12198                 ;;
12199         esac
12200         ;;
12201 *)      endprotoent_r_proto=0
12202         ;;
12203 esac
12204
12205 : see if endpwent exists
12206 set endpwent d_endpwent
12207 eval $inlibc
12208
12209 : see if this is a pwd.h system
12210 set pwd.h i_pwd
12211 eval $inhdr
12212
12213 case "$i_pwd" in
12214 $define)
12215         xxx=`./findhdr pwd.h`
12216         $cppstdin $cppflags $cppminus < $xxx >$$.h
12217
12218         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12219                 val="$define"
12220         else
12221                 val="$undef"
12222         fi
12223         set d_pwquota
12224         eval $setvar
12225
12226         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12227                 val="$define"
12228         else
12229                 val="$undef"
12230         fi
12231         set d_pwage
12232         eval $setvar
12233
12234         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12235                 val="$define"
12236         else
12237                 val="$undef"
12238         fi
12239         set d_pwchange
12240         eval $setvar
12241
12242         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12243                 val="$define"
12244         else
12245                 val="$undef"
12246         fi
12247         set d_pwclass
12248         eval $setvar
12249
12250         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12251                 val="$define"
12252         else
12253                 val="$undef"
12254         fi
12255         set d_pwexpire
12256         eval $setvar
12257
12258         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12259                 val="$define"
12260         else
12261                 val="$undef"
12262         fi
12263         set d_pwcomment
12264         eval $setvar
12265
12266         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12267                 val="$define"
12268         else
12269                 val="$undef"
12270         fi
12271         set d_pwgecos
12272         eval $setvar
12273
12274         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12275                 val="$define"
12276         else
12277                 val="$undef"
12278         fi
12279         set d_pwpasswd
12280         eval $setvar
12281
12282         $rm -f $$.h
12283         ;;
12284 *)
12285         val="$undef"; 
12286         set d_pwquota; eval $setvar
12287         set d_pwage; eval $setvar
12288         set d_pwchange; eval $setvar
12289         set d_pwclass; eval $setvar
12290         set d_pwexpire; eval $setvar
12291         set d_pwcomment; eval $setvar
12292         set d_pwgecos; eval $setvar
12293         set d_pwpasswd; eval $setvar
12294         ;;
12295 esac
12296
12297 : see if endpwent_r exists
12298 set endpwent_r d_endpwent_r
12299 eval $inlibc
12300 case "$d_endpwent_r" in
12301 "$define")
12302         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12303         case "$d_endpwent_r_proto:$usethreads" in
12304         ":define")      d_endpwent_r_proto=define
12305                 set d_endpwent_r_proto endpwent_r $hdrs
12306                 eval $hasproto ;;
12307         *)      ;;
12308         esac
12309         case "$d_endpwent_r_proto" in
12310         define)
12311         case "$endpwent_r_proto" in
12312         ''|0) try='int endpwent_r(FILE**);'
12313         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12314         esac
12315         case "$endpwent_r_proto" in
12316         ''|0) try='void endpwent_r(FILE**);'
12317         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12318         esac
12319         case "$endpwent_r_proto" in
12320         ''|0)   d_endpwent_r=undef
12321                 endpwent_r_proto=0
12322                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12323         * )     case "$endpwent_r_proto" in
12324                 REENTRANT_PROTO*) ;;
12325                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12326                 esac
12327                 echo "Prototype: $try" ;;
12328         esac
12329         ;;
12330         *)      case "$usethreads" in
12331                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12332                 esac
12333                 d_endpwent_r=undef
12334                 endpwent_r_proto=0
12335                 ;;
12336         esac
12337         ;;
12338 *)      endpwent_r_proto=0
12339         ;;
12340 esac
12341
12342 : see if endservent exists
12343 set endservent d_endsent
12344 eval $inlibc
12345
12346 : see if endservent_r exists
12347 set endservent_r d_endservent_r
12348 eval $inlibc
12349 case "$d_endservent_r" in
12350 "$define")
12351         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12352         case "$d_endservent_r_proto:$usethreads" in
12353         ":define")      d_endservent_r_proto=define
12354                 set d_endservent_r_proto endservent_r $hdrs
12355                 eval $hasproto ;;
12356         *)      ;;
12357         esac
12358         case "$d_endservent_r_proto" in
12359         define)
12360         case "$endservent_r_proto" in
12361         ''|0) try='int endservent_r(struct servent_data*);'
12362         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12363         esac
12364         case "$endservent_r_proto" in
12365         ''|0) try='void endservent_r(struct servent_data*);'
12366         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12367         esac
12368         case "$endservent_r_proto" in
12369         ''|0)   d_endservent_r=undef
12370                 endservent_r_proto=0
12371                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12372         * )     case "$endservent_r_proto" in
12373                 REENTRANT_PROTO*) ;;
12374                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12375                 esac
12376                 echo "Prototype: $try" ;;
12377         esac
12378         ;;
12379         *)      case "$usethreads" in
12380                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12381                 esac
12382                 d_endservent_r=undef
12383                 endservent_r_proto=0
12384                 ;;
12385         esac
12386         ;;
12387 *)      endservent_r_proto=0
12388         ;;
12389 esac
12390
12391 : Locate the flags for 'open()'
12392 echo " "
12393 $cat >try.c <<EOCP
12394 #include <sys/types.h>
12395 #ifdef I_FCNTL
12396 #include <fcntl.h>
12397 #endif
12398 #ifdef I_SYS_FILE
12399 #include <sys/file.h>
12400 #endif
12401 #$i_stdlib I_STDLIB
12402 #ifdef I_STDLIB
12403 #include <stdlib.h>
12404 #endif
12405 int main() {
12406         if(O_RDONLY);
12407 #ifdef O_TRUNC
12408         exit(0);
12409 #else
12410         exit(1);
12411 #endif
12412 }
12413 EOCP
12414 : check sys/file.h first to get FREAD on Sun
12415 if $test `./findhdr sys/file.h` && \
12416                 set try -DI_SYS_FILE && eval $compile; then
12417         h_sysfile=true;
12418         echo "<sys/file.h> defines the O_* constants..." >&4
12419         if $run ./try; then
12420                 echo "and you have the 3 argument form of open()." >&4
12421                 val="$define"
12422         else
12423                 echo "but not the 3 argument form of open().  Oh, well." >&4
12424                 val="$undef"
12425         fi
12426 elif $test `./findhdr fcntl.h` && \
12427                 set try -DI_FCNTL && eval $compile; then
12428         h_fcntl=true;
12429         echo "<fcntl.h> defines the O_* constants..." >&4
12430         if $run ./try; then
12431                 echo "and you have the 3 argument form of open()." >&4
12432                 val="$define"
12433         else
12434                 echo "but not the 3 argument form of open().  Oh, well." >&4
12435                 val="$undef"
12436         fi
12437 else
12438         val="$undef"
12439         echo "I can't find the O_* constant definitions!  You got problems." >&4
12440 fi
12441 set d_open3
12442 eval $setvar
12443 $rm_try
12444
12445 : see if this is a sys/file.h system
12446 val=''
12447 set sys/file.h val
12448 eval $inhdr
12449
12450 : do we need to include sys/file.h ?
12451 case "$val" in
12452 "$define")
12453         echo " "
12454         if $h_sysfile; then
12455                 val="$define"
12456                 echo "We'll be including <sys/file.h>." >&4
12457         else
12458                 val="$undef"
12459                 echo "We won't be including <sys/file.h>." >&4
12460         fi
12461         ;;
12462 *)
12463         h_sysfile=false
12464         ;;
12465 esac
12466 set i_sysfile
12467 eval $setvar
12468
12469 : see if fcntl.h is there
12470 val=''
12471 set fcntl.h val
12472 eval $inhdr
12473
12474 : see if we can include fcntl.h
12475 case "$val" in
12476 "$define")
12477         echo " "
12478         if $h_fcntl; then
12479                 val="$define"
12480                 echo "We'll be including <fcntl.h>." >&4
12481         else
12482                 val="$undef"
12483                 if $h_sysfile; then
12484         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12485                 else
12486                         echo "We won't be including <fcntl.h>." >&4
12487                 fi
12488         fi
12489         ;;
12490 *)
12491         h_fcntl=false
12492         val="$undef"
12493         ;;
12494 esac
12495 set i_fcntl
12496 eval $setvar
12497
12498 : see if fork exists
12499 set fork d_fork
12500 eval $inlibc
12501
12502 : see if pipe exists
12503 set pipe d_pipe
12504 eval $inlibc
12505
12506 : check for non-blocking I/O stuff
12507 case "$h_sysfile" in
12508 true) echo "#include <sys/file.h>" > head.c;;
12509 *)
12510        case "$h_fcntl" in
12511        true) echo "#include <fcntl.h>" > head.c;;
12512        *) echo "#include <sys/fcntl.h>" > head.c;;
12513        esac
12514        ;;
12515 esac
12516 echo " "
12517 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12518 case "$o_nonblock" in
12519 '')
12520         $cat head.c > try.c
12521         $cat >>try.c <<EOCP
12522 #include <stdio.h>
12523 #$i_stdlib I_STDLIB
12524 #ifdef I_STDLIB
12525 #include <stdlib.h>
12526 #endif
12527 #$i_fcntl I_FCNTL
12528 #ifdef I_FCNTL
12529 #include <fcntl.h>
12530 #endif
12531 int main() {
12532 #ifdef O_NONBLOCK
12533         printf("O_NONBLOCK\n");
12534         exit(0);
12535 #endif
12536 #ifdef O_NDELAY
12537         printf("O_NDELAY\n");
12538         exit(0);
12539 #endif
12540 #ifdef FNDELAY
12541         printf("FNDELAY\n");
12542         exit(0);
12543 #endif
12544         exit(0);
12545 }
12546 EOCP
12547         set try
12548         if eval $compile_ok; then
12549                 o_nonblock=`$run ./try`
12550                 case "$o_nonblock" in
12551                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12552                 *) echo "Seems like we can use $o_nonblock.";;
12553                 esac
12554         else
12555                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12556         fi
12557         ;;
12558 *) echo "Using $hint value $o_nonblock.";;
12559 esac
12560 $rm_try
12561
12562 echo " "
12563 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12564 case "$eagain" in
12565 '')
12566         case "$d_fork:$d_pipe" in
12567         define:define)
12568         $cat head.c > try.c
12569         $cat >>try.c <<EOCP
12570 #include <errno.h>
12571 #include <sys/types.h>
12572 #include <signal.h>
12573 #include <stdio.h>
12574 #$i_stdlib I_STDLIB
12575 #ifdef I_STDLIB
12576 #include <stdlib.h>
12577 #endif
12578 #$i_fcntl I_FCNTL
12579 #ifdef I_FCNTL
12580 #include <fcntl.h>
12581 #endif
12582 #define MY_O_NONBLOCK $o_nonblock
12583 #ifndef errno  /* XXX need better Configure test */
12584 extern int errno;
12585 #endif
12586 #$i_unistd I_UNISTD
12587 #ifdef I_UNISTD
12588 #include <unistd.h>
12589 #endif
12590 #$i_string I_STRING
12591 #ifdef I_STRING
12592 #include <string.h>
12593 #else
12594 #include <strings.h>
12595 #endif
12596 $signal_t blech(int x) { exit(3); }
12597 EOCP
12598         $cat >> try.c <<'EOCP'
12599 int main()
12600 {
12601         int pd[2];
12602         int pu[2];
12603         char buf[1];
12604         char string[100];
12605
12606         pipe(pd);       /* Down: child -> parent */
12607         pipe(pu);       /* Up: parent -> child */
12608         if (0 != fork()) {
12609                 int ret;
12610                 close(pd[1]);   /* Parent reads from pd[0] */
12611                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12612 #ifdef F_SETFL
12613                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12614                         exit(1);
12615 #else
12616                 exit(4);
12617 #endif
12618                 signal(SIGALRM, blech);
12619                 alarm(5);
12620                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12621                         exit(2);
12622                 sprintf(string, "%d\n", ret);
12623                 write(2, string, strlen(string));
12624                 alarm(0);
12625 #ifdef EAGAIN
12626                 if (errno == EAGAIN) {
12627                         printf("EAGAIN\n");
12628                         goto ok;
12629                 }
12630 #endif
12631 #ifdef EWOULDBLOCK
12632                 if (errno == EWOULDBLOCK)
12633                         printf("EWOULDBLOCK\n");
12634 #endif
12635         ok:
12636                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12637                 sleep(2);                               /* Give it time to close our pipe */
12638                 alarm(5);
12639                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12640                 alarm(0);
12641                 sprintf(string, "%d\n", ret);
12642                 write(4, string, strlen(string));
12643                 exit(0);
12644         }
12645
12646         close(pd[0]);                   /* We write to pd[1] */
12647         close(pu[1]);                   /* We read from pu[0] */
12648         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12649         close(pd[1]);                   /* Pipe pd is now fully closed! */
12650         exit(0);                                /* Bye bye, thank you for playing! */
12651 }
12652 EOCP
12653         set try
12654         if eval $compile_ok; then
12655                 echo "$startsh" >mtry
12656                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12657                 chmod +x mtry
12658                 ./mtry >/dev/null 2>&1
12659                 case $? in
12660                 0) eagain=`$cat try.out`;;
12661                 1) echo "Could not perform non-blocking setting!";;
12662                 2) echo "I did a successful read() for something that was not there!";;
12663                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12664                 4) echo "Could not find F_SETFL!";;
12665                 *) echo "Something terribly wrong happened during testing.";;
12666                 esac
12667                 rd_nodata=`$cat try.ret`
12668                 echo "A read() system call with no data present returns $rd_nodata."
12669                 case "$rd_nodata" in
12670                 0|-1) ;;
12671                 *)
12672                         echo "(That's peculiar, fixing that to be -1.)"
12673                         rd_nodata=-1
12674                         ;;
12675                 esac
12676                 case "$eagain" in
12677                 '')
12678                         echo "Forcing errno EAGAIN on read() with no data available."
12679                         eagain=EAGAIN
12680                         ;;
12681                 *)
12682                         echo "Your read() sets errno to $eagain when no data is available."
12683                         ;;
12684                 esac
12685                 status=`$cat try.err`
12686                 case "$status" in
12687                 0) echo "And it correctly returns 0 to signal EOF.";;
12688                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12689                 *) echo "However, your read() returns '$status' on EOF??";;
12690                 esac
12691                 val="$define"
12692                 if test "$status" = "$rd_nodata"; then
12693                         echo "WARNING: you can't distinguish between EOF and no data!"
12694                         val="$undef"
12695                 fi
12696         else
12697                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12698                 eagain=EAGAIN
12699         fi
12700         ;;
12701         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12702                 eagain=EAGAIN
12703                 val="$define"
12704                 ;;
12705         esac
12706         set d_eofnblk
12707         eval $setvar
12708         ;;
12709 *)
12710         echo "Using $hint value $eagain."
12711         echo "Your read() returns $rd_nodata when no data is present."
12712         case "$d_eofnblk" in
12713         "$define") echo "And you can see EOF because read() returns 0.";;
12714         "$undef") echo "But you can't see EOF status from read() returned value.";;
12715         *)
12716                 echo "(Assuming you can't see EOF status from read anyway.)"
12717                 d_eofnblk=$undef
12718                 ;;
12719         esac
12720         ;;
12721 esac
12722 $rm_try head.c mtry
12723
12724 : see if _ptr and _cnt from stdio act std
12725 echo " "
12726
12727 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12728         echo "(Looks like you have stdio.h from BSD.)"
12729         case "$stdio_ptr" in
12730         '') stdio_ptr='((fp)->_p)'
12731                 ptr_lval=$define
12732                 ;;
12733         *)      ptr_lval=$d_stdio_ptr_lval;;
12734         esac
12735         case "$stdio_cnt" in
12736         '') stdio_cnt='((fp)->_r)'
12737                 cnt_lval=$define
12738                 ;;
12739         *)      cnt_lval=$d_stdio_cnt_lval;;
12740         esac
12741         case "$stdio_base" in
12742         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12743         esac
12744         case "$stdio_bufsiz" in
12745         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12746         esac
12747 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12748         echo "(Looks like you have stdio.h from Linux.)"
12749         case "$stdio_ptr" in
12750         '') stdio_ptr='((fp)->_IO_read_ptr)'
12751                 ptr_lval=$define
12752                 ;;
12753         *)      ptr_lval=$d_stdio_ptr_lval;;
12754         esac
12755         case "$stdio_cnt" in
12756         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12757                 cnt_lval=$undef
12758                 ;;
12759         *)      cnt_lval=$d_stdio_cnt_lval;;
12760         esac
12761         case "$stdio_base" in
12762         '') stdio_base='((fp)->_IO_read_base)';;
12763         esac
12764         case "$stdio_bufsiz" in
12765         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12766         esac
12767 else
12768         case "$stdio_ptr" in
12769         '') stdio_ptr='((fp)->_ptr)'
12770                 ptr_lval=$define
12771                 ;;
12772         *)      ptr_lval=$d_stdio_ptr_lval;;
12773         esac
12774         case "$stdio_cnt" in
12775         '') stdio_cnt='((fp)->_cnt)'
12776                 cnt_lval=$define
12777                 ;;
12778         *)      cnt_lval=$d_stdio_cnt_lval;;
12779         esac
12780         case "$stdio_base" in
12781         '') stdio_base='((fp)->_base)';;
12782         esac
12783         case "$stdio_bufsiz" in
12784         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12785         esac
12786 fi
12787
12788 : test whether _ptr and _cnt really work
12789 echo "Checking how std your stdio is..." >&4
12790 $cat >try.c <<EOP
12791 #include <stdio.h>
12792 #$i_stdlib I_STDLIB
12793 #ifdef I_STDLIB
12794 #include <stdlib.h>
12795 #endif
12796 #define FILE_ptr(fp)    $stdio_ptr
12797 #define FILE_cnt(fp)    $stdio_cnt
12798 int main() {
12799         FILE *fp = fopen("try.c", "r");
12800         char c = getc(fp);
12801         if (
12802                 18 <= FILE_cnt(fp) &&
12803                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12804         )
12805                 exit(0);
12806         exit(1);
12807 }
12808 EOP
12809 val="$undef"
12810 set try
12811 if eval $compile && $to try.c; then
12812         if $run ./try; then
12813                 echo "Your stdio acts pretty std."
12814                 val="$define"
12815         else
12816                 echo "Your stdio isn't very std."
12817         fi
12818 else
12819         echo "Your stdio doesn't appear very std."
12820 fi
12821 $rm_try
12822
12823 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12824 # direct buffer manipulation no longer works.  The Configure tests
12825 # should be changed to correctly detect this, but until then,
12826 # the following check should at least let perl compile and run.
12827 # (This quick fix should be updated before 5.8.1.)
12828 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12829 # A. Dougherty, June 3, 2002.
12830 case "$d_gnulibc" in
12831 $define)
12832         case "$gnulibc_version" in
12833         2.[01]*)  ;;
12834         2.2) ;;
12835         2.2.[0-9]) ;;
12836         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12837                 val="$undef"
12838                 ;;
12839         esac
12840         ;;
12841 esac
12842 set d_stdstdio
12843 eval $setvar
12844
12845 : Can _ptr be used as an lvalue?
12846 case "$d_stdstdio$ptr_lval" in
12847 $define$define) val=$define ;;
12848 *) val=$undef ;;
12849 esac
12850 set d_stdio_ptr_lval
12851 eval $setvar
12852
12853 : Can _cnt be used as an lvalue?
12854 case "$d_stdstdio$cnt_lval" in
12855 $define$define) val=$define ;;
12856 *) val=$undef ;;
12857 esac
12858 set d_stdio_cnt_lval
12859 eval $setvar
12860
12861
12862 : test whether setting _ptr sets _cnt as a side effect
12863 d_stdio_ptr_lval_sets_cnt="$undef"
12864 d_stdio_ptr_lval_nochange_cnt="$undef"
12865 case "$d_stdio_ptr_lval$d_stdstdio" in
12866 $define$define)
12867         echo "Checking to see what happens if we set the stdio ptr..." >&4
12868 $cat >try.c <<EOP
12869 #include <stdio.h>
12870 /* Can we scream? */
12871 /* Eat dust sed :-) */
12872 /* In the buffer space, no one can hear you scream. */
12873 #$i_stdlib I_STDLIB
12874 #ifdef I_STDLIB
12875 #include <stdlib.h>
12876 #endif
12877 #define FILE_ptr(fp)    $stdio_ptr
12878 #define FILE_cnt(fp)    $stdio_cnt
12879 #include <sys/types.h>
12880 int main() {
12881         FILE *fp = fopen("try.c", "r");
12882         int c;
12883         char *ptr;
12884         size_t cnt;
12885         if (!fp) {
12886             puts("Fail even to read");
12887             exit(1);
12888         }
12889         c = getc(fp); /* Read away the first # */
12890         if (c == EOF) {
12891             puts("Fail even to read");
12892             exit(1);
12893         }
12894         if (!(
12895                 18 <= FILE_cnt(fp) &&
12896                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12897         )) {
12898                 puts("Fail even to read");
12899                 exit (1);
12900         }
12901         ptr = (char*) FILE_ptr(fp);
12902         cnt = (size_t)FILE_cnt(fp);
12903
12904         FILE_ptr(fp) += 42;
12905
12906         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12907                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12908                 exit (1);
12909         }
12910         if (FILE_cnt(fp) <= 20) {
12911                 printf ("Fail (<20 chars to test)");
12912                 exit (1);
12913         }
12914         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12915                 puts("Fail compare");
12916                 exit (1);
12917         }
12918         if (cnt == FILE_cnt(fp)) {
12919                 puts("Pass_unchanged");
12920                 exit (0);
12921         }
12922         if (FILE_cnt(fp) == (cnt - 42)) {
12923                 puts("Pass_changed");
12924                 exit (0);
12925         }
12926         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12927         return 1;
12928
12929 }
12930 EOP
12931         set try
12932         if eval $compile && $to try.c; then
12933                 case `$run ./try` in
12934                 Pass_changed)
12935                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12936                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12937                 Pass_unchanged)
12938                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12939                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12940                 Fail*)
12941                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12942                 *)
12943                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12944         esac
12945         else
12946                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12947         fi
12948         $rm_try
12949         ;;
12950 esac
12951
12952 : see if _base is also standard
12953 val="$undef"
12954 case "$d_stdstdio" in
12955 $define)
12956         $cat >try.c <<EOP
12957 #include <stdio.h>
12958 #$i_stdlib I_STDLIB
12959 #ifdef I_STDLIB
12960 #include <stdlib.h>
12961 #endif
12962 #define FILE_base(fp)   $stdio_base
12963 #define FILE_bufsiz(fp) $stdio_bufsiz
12964 int main() {
12965         FILE *fp = fopen("try.c", "r");
12966         char c = getc(fp);
12967         if (
12968                 19 <= FILE_bufsiz(fp) &&
12969                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12970         )
12971                 exit(0);
12972         exit(1);
12973 }
12974 EOP
12975         set try
12976         if eval $compile && $to try.c; then
12977                 if $run ./try; then
12978                         echo "And its _base field acts std."
12979                         val="$define"
12980                 else
12981                         echo "But its _base field isn't std."
12982                 fi
12983         else
12984                 echo "However, it seems to be lacking the _base field."
12985         fi
12986         $rm_try
12987         ;;
12988 esac
12989 set d_stdiobase
12990 eval $setvar
12991
12992 : see if fast_stdio exists
12993 val="$undef"
12994 case "$d_stdstdio:$d_stdio_ptr_lval" in
12995 "$define:$define")
12996         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12997         *$define*)
12998                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12999                 val="$define"
13000                 ;;
13001         esac
13002         ;;
13003 esac
13004 set d_faststdio
13005 eval $setvar
13006
13007
13008
13009 : see if fchdir exists
13010 set fchdir d_fchdir
13011 eval $inlibc
13012
13013 : see if fchmod exists
13014 set fchmod d_fchmod
13015 eval $inlibc
13016
13017 : see if fchown exists
13018 set fchown d_fchown
13019 eval $inlibc
13020
13021 : see if this is an fcntl system
13022 set fcntl d_fcntl
13023 eval $inlibc
13024
13025 : See if fcntl-based locking works.
13026 echo " "
13027 $cat >try.c <<EOCP
13028 #$i_stdlib I_STDLIB
13029 #ifdef I_STDLIB
13030 #include <stdlib.h>
13031 #endif
13032 #include <unistd.h>
13033 #include <fcntl.h>
13034 #include <signal.h>
13035 $signal_t blech(int x) { exit(3); }
13036 int main() {
13037 #if defined(F_SETLK) && defined(F_SETLKW)
13038      struct flock flock;
13039      int retval, fd;
13040      fd = open("try.c", O_RDONLY);
13041      flock.l_type = F_RDLCK;
13042      flock.l_whence = SEEK_SET;
13043      flock.l_start = flock.l_len = 0;
13044      signal(SIGALRM, blech);
13045      alarm(10);
13046      retval = fcntl(fd, F_SETLK, &flock);
13047      close(fd);
13048      (retval < 0 ? exit(2) : exit(0));
13049 #else
13050      exit(2);
13051 #endif
13052 }
13053 EOCP
13054 echo "Checking if fcntl-based file locking works... "
13055 case "$d_fcntl" in
13056 "$define")
13057         set try
13058         if eval $compile_ok; then
13059                 if $run ./try; then
13060                         echo "Yes, it seems to work."
13061                         val="$define"
13062                 else
13063                         echo "Nope, it didn't work."
13064                         val="$undef"
13065                         case "$?" in
13066                         3) $cat >&4 <<EOM
13067 ***
13068 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13069 *** This is (almost) impossible.
13070 *** If your NFS lock daemons are not feeling well, something like
13071 *** this may happen, please investigate.  Cannot continue, aborting.
13072 ***
13073 EOM
13074                                 exit 1
13075                                 ;;
13076                         esac
13077                 fi
13078         else
13079                 echo "I'm unable to compile the test program, so I'll assume not."
13080                 val="$undef"
13081         fi
13082         ;;
13083 *) val="$undef";
13084         echo "Nope, since you don't even have fcntl()."
13085         ;;
13086 esac
13087 set d_fcntl_can_lock
13088 eval $setvar
13089 $rm_try
13090
13091 : check for fd_set items
13092 $cat <<EOM
13093
13094 Checking to see how well your C compiler handles fd_set and friends ...
13095 EOM
13096 $cat >try.c <<EOCP
13097 #$i_stdlib I_STDLIB
13098 #ifdef I_STDLIB
13099 #include <stdlib.h>
13100 #endif
13101 #$i_systime I_SYS_TIME
13102 #$i_sysselct I_SYS_SELECT
13103 #$d_socket HAS_SOCKET
13104 #include <sys/types.h>
13105 #ifdef HAS_SOCKET
13106 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13107 #endif
13108 #ifdef I_SYS_TIME
13109 #include <sys/time.h>
13110 #endif
13111 #ifdef I_SYS_SELECT
13112 #include <sys/select.h>
13113 #endif
13114 int main() {
13115         fd_set fds;
13116
13117 #ifdef TRYBITS
13118         if(fds.fds_bits);
13119 #endif
13120
13121 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13122         exit(0);
13123 #else
13124         exit(1);
13125 #endif
13126 }
13127 EOCP
13128 set try -DTRYBITS
13129 if eval $compile; then
13130         d_fds_bits="$define"
13131         d_fd_set="$define"
13132         echo "Well, your system knows about the normal fd_set typedef..." >&4
13133         if $run ./try; then
13134                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13135                 d_fd_macros="$define"
13136         else
13137                 $cat >&4 <<'EOM'
13138 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13139 EOM
13140                 d_fd_macros="$undef"
13141         fi
13142 else
13143         $cat <<'EOM'
13144 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13145 EOM
13146         set try
13147         if eval $compile; then
13148                 d_fds_bits="$undef"
13149                 d_fd_set="$define"
13150                 echo "Well, your system has some sort of fd_set available..." >&4
13151                 if $run ./try; then
13152                         echo "and you have the normal fd_set macros." >&4
13153                         d_fd_macros="$define"
13154                 else
13155                         $cat <<'EOM'
13156 but not the normal fd_set macros!  Gross!  More work for me...
13157 EOM
13158                         d_fd_macros="$undef"
13159                 fi
13160         else
13161         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13162                 d_fd_set="$undef"
13163                 d_fds_bits="$undef"
13164                 d_fd_macros="$undef"
13165         fi
13166 fi
13167 $rm_try
13168
13169 : see if fgetpos exists
13170 set fgetpos d_fgetpos
13171 eval $inlibc
13172
13173 : see if finite exists
13174 set finite d_finite
13175 eval $inlibc
13176
13177 : see if finitel exists
13178 set finitel d_finitel
13179 eval $inlibc
13180
13181 : see if flock exists
13182 set flock d_flock
13183 eval $inlibc
13184
13185 : see if prototype for flock is available
13186 echo " "
13187 set d_flockproto flock $i_sysfile sys/file.h
13188 eval $hasproto
13189
13190 : see if fp_class exists
13191 set fp_class d_fp_class
13192 eval $inlibc
13193
13194 : see if pathconf exists
13195 set pathconf d_pathconf
13196 eval $inlibc
13197
13198 : see if fpathconf exists
13199 set fpathconf d_fpathconf
13200 eval $inlibc
13201
13202 : see if fpclass exists
13203 set fpclass d_fpclass
13204 eval $inlibc
13205
13206 : see if fpclassify exists
13207 set fpclassify d_fpclassify
13208 eval $inlibc
13209
13210 : see if fpclassl exists
13211 set fpclassl d_fpclassl
13212 eval $inlibc
13213
13214 : check for fpos64_t
13215 echo " "
13216 echo "Checking to see if you have fpos64_t..." >&4
13217 $cat >try.c <<EOCP
13218 #include <stdio.h>
13219 int main() { fpos64_t x = 7; }
13220 EOCP
13221 set try
13222 if eval $compile; then
13223         val="$define"
13224         echo "You have fpos64_t."
13225 else
13226         val="$undef"
13227         echo "You do not have fpos64_t."
13228         case "$fpossize" in
13229         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13230         esac
13231 fi
13232 $rm_try
13233 set d_fpos64_t
13234 eval $setvar
13235
13236 : see if frexpl exists
13237 set frexpl d_frexpl
13238 eval $inlibc
13239
13240 : see if this is a sys/param system
13241 set sys/param.h i_sysparam
13242 eval $inhdr
13243
13244 : see if this is a sys/mount.h system
13245 set sys/mount.h i_sysmount
13246 eval $inhdr
13247
13248 : Check for fs_data_s
13249 echo " "
13250 echo "Checking to see if your system supports struct fs_data..." >&4
13251 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13252 eval $hasstruct
13253 case "$d_fs_data_s" in
13254 "$define")      echo "Yes, it does."   ;;
13255 *)              echo "No, it doesn't." ;;
13256 esac
13257
13258 : see if fseeko exists
13259 set fseeko d_fseeko
13260 eval $inlibc
13261 case "$longsize" in
13262 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13263 esac
13264
13265 : see if fsetpos exists
13266 set fsetpos d_fsetpos
13267 eval $inlibc
13268
13269 : see if fstatfs exists
13270 set fstatfs d_fstatfs
13271 eval $inlibc
13272
13273 : see if statvfs exists
13274 set statvfs d_statvfs
13275 eval $inlibc
13276
13277 : see if fstatvfs exists
13278 set fstatvfs d_fstatvfs
13279 eval $inlibc
13280
13281
13282 : see if fsync exists
13283 set fsync d_fsync
13284 eval $inlibc
13285
13286 : see if ftello exists
13287 set ftello d_ftello
13288 eval $inlibc
13289 case "$longsize" in
13290 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13291 esac
13292
13293 : check for a working futimes
13294 d_futimes="$undef"
13295 echo " "
13296 echo "Checking if you have a working futimes()" >&4
13297 $cat >try.c <<EOCP
13298 #include <stdio.h>
13299 #include <sys/time.h>
13300 #include <errno.h>
13301 #include <fcntl.h>
13302
13303 int main ()
13304 {
13305     int fd, rv;
13306     fd = open ("try.c", O_RDWR);
13307     if (-1 == fd) exit (1);
13308     rv = futimes (fd, NULL);
13309     exit (rv == -1 ? errno : 0);
13310 }
13311 EOCP
13312 set try
13313 if eval $compile; then
13314     `$run ./try`
13315     rc=$?
13316     case "$rc" in
13317         0)  echo "Yes, you have" >&4
13318             d_futimes="$define"
13319             ;;
13320         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13321             ;;
13322     esac
13323 else
13324     echo "No, it does not (probably harmless)" >&4
13325 fi
13326 $rm_try
13327
13328 : see if ndbm.h is available
13329 set ndbm.h i_ndbm
13330 eval $inhdr
13331 : Compatibility location for RedHat 7.1
13332 set gdbm/ndbm.h i_gdbmndbm
13333 eval $inhdr
13334 : Compatibility location for Debian 4.0
13335 set gdbm-ndbm.h i_gdbm_ndbm
13336 eval $inhdr
13337
13338 val="$undef"
13339 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13340         : see if dbm_open exists
13341         set dbm_open d_dbm_open
13342         eval $inlibc
13343         case "$d_dbm_open" in
13344         $undef)
13345                 i_ndbm="$undef"
13346                 i_gdbmndbm="$undef"
13347                 i_gdbm_ndbm="$undef"
13348                 echo "We won't be including <ndbm.h>"
13349                 val="$undef"
13350                 ;;
13351         *) val="$define"
13352            ;;
13353         esac
13354 fi
13355 set d_ndbm
13356 eval $setvar
13357
13358 ndbm_hdr_protochk='name=$1; hdr=$2;
13359 eval "ihdr=\$""i_$name";
13360 val="$undef";
13361 if $test "$ihdr" = "$define"; then
13362         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13363         case "$d_cplusplus" in
13364         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13365         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13366         esac;
13367         case "$val" in
13368         $define) $echo "Your <$hdr> seems to have prototypes";;
13369         *) $echo "Your <$hdr> does not seem to have prototypes";;
13370         esac;
13371 fi;
13372 set "d_${name}_h_uses_prototypes";
13373 eval $setvar'
13374
13375 set ndbm ndbm.h
13376 eval $ndbm_hdr_protochk
13377 set gdbmndbm gdbm/ndbm.h
13378 eval $ndbm_hdr_protochk
13379 set gdbm_ndbm gdbm-ndbm.h
13380 eval $ndbm_hdr_protochk
13381
13382 : see if getcwd exists
13383 set getcwd d_getcwd
13384 eval $inlibc
13385
13386 : see if getespwnam exists
13387 set getespwnam d_getespwnam
13388 eval $inlibc
13389
13390 : see if getfsstat exists
13391 set getfsstat d_getfsstat
13392 eval $inlibc
13393
13394 : see if getgrent exists
13395 set getgrent d_getgrent
13396 eval $inlibc
13397
13398 : see if getgrent_r exists
13399 set getgrent_r d_getgrent_r
13400 eval $inlibc
13401 case "$d_getgrent_r" in
13402 "$define")
13403         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13404         case "$d_getgrent_r_proto:$usethreads" in
13405         ":define")      d_getgrent_r_proto=define
13406                 set d_getgrent_r_proto getgrent_r $hdrs
13407                 eval $hasproto ;;
13408         *)      ;;
13409         esac
13410         case "$d_getgrent_r_proto" in
13411         define)
13412         case "$getgrent_r_proto" in
13413         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13414         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13415         esac
13416         case "$getgrent_r_proto" in
13417         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13418         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13419         esac
13420         case "$getgrent_r_proto" in
13421         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13422         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13423         esac
13424         case "$getgrent_r_proto" in
13425         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13426         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13427         esac
13428         case "$getgrent_r_proto" in
13429         ''|0) try='int getgrent_r(struct group*, char*, int);'
13430         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13431         esac
13432         case "$getgrent_r_proto" in
13433         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13434         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13435         esac
13436         case "$getgrent_r_proto" in
13437         ''|0)   d_getgrent_r=undef
13438                 getgrent_r_proto=0
13439                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13440         * )     case "$getgrent_r_proto" in
13441                 REENTRANT_PROTO*) ;;
13442                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13443                 esac
13444                 echo "Prototype: $try" ;;
13445         esac
13446         ;;
13447         *)      case "$usethreads" in
13448                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13449                 esac
13450                 d_getgrent_r=undef
13451                 getgrent_r_proto=0
13452                 ;;
13453         esac
13454         ;;
13455 *)      getgrent_r_proto=0
13456         ;;
13457 esac
13458
13459 : see if getgrgid_r exists
13460 set getgrgid_r d_getgrgid_r
13461 eval $inlibc
13462 case "$d_getgrgid_r" in
13463 "$define")
13464         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13465         case "$d_getgrgid_r_proto:$usethreads" in
13466         ":define")      d_getgrgid_r_proto=define
13467                 set d_getgrgid_r_proto getgrgid_r $hdrs
13468                 eval $hasproto ;;
13469         *)      ;;
13470         esac
13471         case "$d_getgrgid_r_proto" in
13472         define)
13473         case "$getgrgid_r_proto" in
13474         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13475         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13476         esac
13477         case "$getgrgid_r_proto" in
13478         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13479         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13480         esac
13481         case "$getgrgid_r_proto" in
13482         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13483         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13484         esac
13485         case "$getgrgid_r_proto" in
13486         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13487         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13488         esac
13489         case "$getgrgid_r_proto" in
13490         ''|0)   d_getgrgid_r=undef
13491                 getgrgid_r_proto=0
13492                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13493         * )     case "$getgrgid_r_proto" in
13494                 REENTRANT_PROTO*) ;;
13495                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13496                 esac
13497                 echo "Prototype: $try" ;;
13498         esac
13499         ;;
13500         *)      case "$usethreads" in
13501                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13502                 esac
13503                 d_getgrgid_r=undef
13504                 getgrgid_r_proto=0
13505                 ;;
13506         esac
13507         ;;
13508 *)      getgrgid_r_proto=0
13509         ;;
13510 esac
13511
13512 : see if getgrnam_r exists
13513 set getgrnam_r d_getgrnam_r
13514 eval $inlibc
13515 case "$d_getgrnam_r" in
13516 "$define")
13517         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13518         case "$d_getgrnam_r_proto:$usethreads" in
13519         ":define")      d_getgrnam_r_proto=define
13520                 set d_getgrnam_r_proto getgrnam_r $hdrs
13521                 eval $hasproto ;;
13522         *)      ;;
13523         esac
13524         case "$d_getgrnam_r_proto" in
13525         define)
13526         case "$getgrnam_r_proto" in
13527         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13528         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13529         esac
13530         case "$getgrnam_r_proto" in
13531         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13532         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13533         esac
13534         case "$getgrnam_r_proto" in
13535         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13536         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13537         esac
13538         case "$getgrnam_r_proto" in
13539         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13540         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13541         esac
13542         case "$getgrnam_r_proto" in
13543         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13544         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13545         esac
13546         case "$getgrnam_r_proto" in
13547         ''|0)   d_getgrnam_r=undef
13548                 getgrnam_r_proto=0
13549                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13550         * )     case "$getgrnam_r_proto" in
13551                 REENTRANT_PROTO*) ;;
13552                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13553                 esac
13554                 echo "Prototype: $try" ;;
13555         esac
13556         ;;
13557         *)      case "$usethreads" in
13558                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13559                 esac
13560                 d_getgrnam_r=undef
13561                 getgrnam_r_proto=0
13562                 ;;
13563         esac
13564         ;;
13565 *)      getgrnam_r_proto=0
13566         ;;
13567 esac
13568
13569 : see if gethostbyaddr exists
13570 set gethostbyaddr d_gethbyaddr
13571 eval $inlibc
13572
13573 : see if gethostbyname exists
13574 set gethostbyname d_gethbyname
13575 eval $inlibc
13576
13577 : see if gethostent exists
13578 set gethostent d_gethent
13579 eval $inlibc
13580
13581 : see how we will look up host name
13582 echo " "
13583 call=''
13584 if set gethostname val -f d_gethname; eval $csym; $val; then
13585         echo 'gethostname() found.' >&4
13586         d_gethname="$define"
13587         call=gethostname
13588 fi
13589 if set uname val -f d_uname; eval $csym; $val; then
13590         if ./xenix; then
13591                 $cat <<'EOM'
13592 uname() was found, but you're running xenix, and older versions of xenix
13593 have a broken uname(). If you don't really know whether your xenix is old
13594 enough to have a broken system call, use the default answer.
13595
13596 EOM
13597                 dflt=y
13598                 case "$d_uname" in
13599                 "$define") dflt=n;;
13600                 esac
13601                 rp='Is your uname() broken?'
13602                 . ./myread
13603                 case "$ans" in
13604                 n*) d_uname="$define"; call=uname;;
13605                 esac
13606         else
13607                 echo 'uname() found.' >&4
13608                 d_uname="$define"
13609                 case "$call" in
13610                 '') call=uname ;;
13611                 esac
13612         fi
13613 fi
13614 case "$d_gethname" in
13615 '') d_gethname="$undef";;
13616 esac
13617 case "$d_uname" in
13618 '') d_uname="$undef";;
13619 esac
13620 case "$d_uname$d_gethname" in
13621 *define*)
13622         dflt=n
13623         cat <<EOM
13624
13625 Every now and then someone has a $call() that lies about the hostname
13626 but can't be fixed for political or economic reasons.  If you wish, I can
13627 pretend $call() isn't there and maybe compute hostname at run-time
13628 thanks to the '$phostname' command.
13629
13630 EOM
13631         rp="Shall I ignore $call() from now on?"
13632         . ./myread
13633         case "$ans" in
13634         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13635         esac;;
13636 esac
13637 case "$phostname" in
13638 '') aphostname='';;
13639 *) case "$aphostname" in
13640         /*) ;;
13641         *) set X $phostname
13642                 shift
13643                 file=$1
13644                 shift
13645                 file=`./loc $file $file $pth`
13646                 aphostname=`echo $file $*`
13647                 ;;
13648         esac
13649         ;;
13650 esac
13651 case "$d_uname$d_gethname" in
13652 *define*) ;;
13653 *)
13654         case "$phostname" in
13655         '')
13656                 echo "There will be no way for $package to get your hostname." >&4;;
13657         *)
13658         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13659                 ;;
13660         esac;;
13661 esac
13662 case "$d_phostname" in
13663 '') d_phostname="$undef";;
13664 esac
13665
13666 : see if gethostbyaddr_r exists
13667 set gethostbyaddr_r d_gethostbyaddr_r
13668 eval $inlibc
13669 case "$d_gethostbyaddr_r" in
13670 "$define")
13671         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13672         case "$d_gethostbyaddr_r_proto:$usethreads" in
13673         ":define")      d_gethostbyaddr_r_proto=define
13674                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13675                 eval $hasproto ;;
13676         *)      ;;
13677         esac
13678         case "$d_gethostbyaddr_r_proto" in
13679         define)
13680         case "$gethostbyaddr_r_proto" in
13681         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13682         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13683         esac
13684         case "$gethostbyaddr_r_proto" in
13685         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13686         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13687         esac
13688         case "$gethostbyaddr_r_proto" in
13689         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13690         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13691         esac
13692         case "$gethostbyaddr_r_proto" in
13693         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13694         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13695         esac
13696         case "$gethostbyaddr_r_proto" in
13697         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13698         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13699         esac
13700         case "$gethostbyaddr_r_proto" in
13701         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13702         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13703         esac
13704         case "$gethostbyaddr_r_proto" in
13705         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13706         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13707         esac
13708         case "$gethostbyaddr_r_proto" in
13709         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13710         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13711         esac
13712         case "$gethostbyaddr_r_proto" in
13713         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13714         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13715         esac
13716         case "$gethostbyaddr_r_proto" in
13717         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13718         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13719         esac
13720         case "$gethostbyaddr_r_proto" in
13721         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13722         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13723         esac
13724         case "$gethostbyaddr_r_proto" in
13725         ''|0)   d_gethostbyaddr_r=undef
13726                 gethostbyaddr_r_proto=0
13727                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13728         * )     case "$gethostbyaddr_r_proto" in
13729                 REENTRANT_PROTO*) ;;
13730                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13731                 esac
13732                 echo "Prototype: $try" ;;
13733         esac
13734         ;;
13735         *)      case "$usethreads" in
13736                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13737                 esac
13738                 d_gethostbyaddr_r=undef
13739                 gethostbyaddr_r_proto=0
13740                 ;;
13741         esac
13742         ;;
13743 *)      gethostbyaddr_r_proto=0
13744         ;;
13745 esac
13746
13747 : see if gethostbyname_r exists
13748 set gethostbyname_r d_gethostbyname_r
13749 eval $inlibc
13750 case "$d_gethostbyname_r" in
13751 "$define")
13752         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13753         case "$d_gethostbyname_r_proto:$usethreads" in
13754         ":define")      d_gethostbyname_r_proto=define
13755                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13756                 eval $hasproto ;;
13757         *)      ;;
13758         esac
13759         case "$d_gethostbyname_r_proto" in
13760         define)
13761         case "$gethostbyname_r_proto" in
13762         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13763         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13764         esac
13765         case "$gethostbyname_r_proto" in
13766         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13767         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13768         esac
13769         case "$gethostbyname_r_proto" in
13770         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13771         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13772         esac
13773         case "$gethostbyname_r_proto" in
13774         ''|0)   d_gethostbyname_r=undef
13775                 gethostbyname_r_proto=0
13776                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13777         * )     case "$gethostbyname_r_proto" in
13778                 REENTRANT_PROTO*) ;;
13779                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13780                 esac
13781                 echo "Prototype: $try" ;;
13782         esac
13783         ;;
13784         *)      case "$usethreads" in
13785                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13786                 esac
13787                 d_gethostbyname_r=undef
13788                 gethostbyname_r_proto=0
13789                 ;;
13790         esac
13791         ;;
13792 *)      gethostbyname_r_proto=0
13793         ;;
13794 esac
13795
13796 : see if gethostent_r exists
13797 set gethostent_r d_gethostent_r
13798 eval $inlibc
13799 case "$d_gethostent_r" in
13800 "$define")
13801         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13802         case "$d_gethostent_r_proto:$usethreads" in
13803         ":define")      d_gethostent_r_proto=define
13804                 set d_gethostent_r_proto gethostent_r $hdrs
13805                 eval $hasproto ;;
13806         *)      ;;
13807         esac
13808         case "$d_gethostent_r_proto" in
13809         define)
13810         case "$gethostent_r_proto" in
13811         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13812         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13813         esac
13814         case "$gethostent_r_proto" in
13815         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13816         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13817         esac
13818         case "$gethostent_r_proto" in
13819         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13820         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13821         esac
13822         case "$gethostent_r_proto" in
13823         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13824         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13825         esac
13826         case "$gethostent_r_proto" in
13827         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13828         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13829         esac
13830         case "$gethostent_r_proto" in
13831         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13832         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13833         esac
13834         case "$gethostent_r_proto" in
13835         ''|0)   d_gethostent_r=undef
13836                 gethostent_r_proto=0
13837                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13838         * )     case "$gethostent_r_proto" in
13839                 REENTRANT_PROTO*) ;;
13840                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13841                 esac
13842                 echo "Prototype: $try" ;;
13843         esac
13844         ;;
13845         *)      case "$usethreads" in
13846                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13847                 esac
13848                 d_gethostent_r=undef
13849                 gethostent_r_proto=0
13850                 ;;
13851         esac
13852         ;;
13853 *)      gethostent_r_proto=0
13854         ;;
13855 esac
13856
13857 : see if prototypes for various gethostxxx netdb.h functions are available
13858 echo " "
13859 set d_gethostprotos gethostent $i_netdb netdb.h
13860 eval $hasproto
13861
13862 : see if getitimer exists
13863 set getitimer d_getitimer
13864 eval $inlibc
13865
13866 : see if getlogin exists
13867 set getlogin d_getlogin
13868 eval $inlibc
13869
13870 : see if getlogin_r exists
13871 set getlogin_r d_getlogin_r
13872 eval $inlibc
13873 case "$d_getlogin_r" in
13874 "$define")
13875         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13876         case "$d_getlogin_r_proto:$usethreads" in
13877         ":define")      d_getlogin_r_proto=define
13878                 set d_getlogin_r_proto getlogin_r $hdrs
13879                 eval $hasproto ;;
13880         *)      ;;
13881         esac
13882         case "$d_getlogin_r_proto" in
13883         define)
13884         case "$getlogin_r_proto" in
13885         ''|0) try='int getlogin_r(char*, size_t);'
13886         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13887         esac
13888         case "$getlogin_r_proto" in
13889         ''|0) try='int getlogin_r(char*, int);'
13890         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13891         esac
13892         case "$getlogin_r_proto" in
13893         ''|0) try='char* getlogin_r(char*, size_t);'
13894         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13895         esac
13896         case "$getlogin_r_proto" in
13897         ''|0) try='char* getlogin_r(char*, int);'
13898         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
13899         esac
13900         case "$getlogin_r_proto" in
13901         ''|0)   d_getlogin_r=undef
13902                 getlogin_r_proto=0
13903                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13904         * )     case "$getlogin_r_proto" in
13905                 REENTRANT_PROTO*) ;;
13906                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13907                 esac
13908                 echo "Prototype: $try" ;;
13909         esac
13910         ;;
13911         *)      case "$usethreads" in
13912                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13913                 esac
13914                 d_getlogin_r=undef
13915                 getlogin_r_proto=0
13916                 ;;
13917         esac
13918         ;;
13919 *)      getlogin_r_proto=0
13920         ;;
13921 esac
13922
13923 : see if getmnt exists
13924 set getmnt d_getmnt
13925 eval $inlibc
13926
13927 : see if getmntent exists
13928 set getmntent d_getmntent
13929 eval $inlibc
13930
13931 : see if getnetbyaddr exists
13932 set getnetbyaddr d_getnbyaddr
13933 eval $inlibc
13934
13935 : see if getnetbyname exists
13936 set getnetbyname d_getnbyname
13937 eval $inlibc
13938
13939 : see if getnetent exists
13940 set getnetent d_getnent
13941 eval $inlibc
13942
13943 : see if getnetbyaddr_r exists
13944 set getnetbyaddr_r d_getnetbyaddr_r
13945 eval $inlibc
13946 case "$d_getnetbyaddr_r" in
13947 "$define")
13948         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13949         case "$d_getnetbyaddr_r_proto:$usethreads" in
13950         ":define")      d_getnetbyaddr_r_proto=define
13951                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13952                 eval $hasproto ;;
13953         *)      ;;
13954         esac
13955         case "$d_getnetbyaddr_r_proto" in
13956         define)
13957         case "$getnetbyaddr_r_proto" in
13958         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13959         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13960         esac
13961         case "$getnetbyaddr_r_proto" in
13962         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13963         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13964         esac
13965         case "$getnetbyaddr_r_proto" in
13966         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13967         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13968         esac
13969         case "$getnetbyaddr_r_proto" in
13970         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13971         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13972         esac
13973         case "$getnetbyaddr_r_proto" in
13974         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13975         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13976         esac
13977         case "$getnetbyaddr_r_proto" in
13978         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13979         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13980         esac
13981         case "$getnetbyaddr_r_proto" in
13982         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13983         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13984         esac
13985         case "$getnetbyaddr_r_proto" in
13986         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13987         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13988         esac
13989         case "$getnetbyaddr_r_proto" in
13990         ''|0)   d_getnetbyaddr_r=undef
13991                 getnetbyaddr_r_proto=0
13992                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13993         * )     case "$getnetbyaddr_r_proto" in
13994                 REENTRANT_PROTO*) ;;
13995                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13996                 esac
13997                 echo "Prototype: $try" ;;
13998         esac
13999         ;;
14000         *)      case "$usethreads" in
14001                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14002                 esac
14003                 d_getnetbyaddr_r=undef
14004                 getnetbyaddr_r_proto=0
14005                 ;;
14006         esac
14007         ;;
14008 *)      getnetbyaddr_r_proto=0
14009         ;;
14010 esac
14011
14012 : see if getnetbyname_r exists
14013 set getnetbyname_r d_getnetbyname_r
14014 eval $inlibc
14015 case "$d_getnetbyname_r" in
14016 "$define")
14017         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14018         case "$d_getnetbyname_r_proto:$usethreads" in
14019         ":define")      d_getnetbyname_r_proto=define
14020                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14021                 eval $hasproto ;;
14022         *)      ;;
14023         esac
14024         case "$d_getnetbyname_r_proto" in
14025         define)
14026         case "$getnetbyname_r_proto" in
14027         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14028         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14029         esac
14030         case "$getnetbyname_r_proto" in
14031         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14032         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14033         esac
14034         case "$getnetbyname_r_proto" in
14035         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14036         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14037         esac
14038         case "$getnetbyname_r_proto" in
14039         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14040         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14041         esac
14042         case "$getnetbyname_r_proto" in
14043         ''|0)   d_getnetbyname_r=undef
14044                 getnetbyname_r_proto=0
14045                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14046         * )     case "$getnetbyname_r_proto" in
14047                 REENTRANT_PROTO*) ;;
14048                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14049                 esac
14050                 echo "Prototype: $try" ;;
14051         esac
14052         ;;
14053         *)      case "$usethreads" in
14054                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14055                 esac
14056                 d_getnetbyname_r=undef
14057                 getnetbyname_r_proto=0
14058                 ;;
14059         esac
14060         ;;
14061 *)      getnetbyname_r_proto=0
14062         ;;
14063 esac
14064
14065 : see if getnetent_r exists
14066 set getnetent_r d_getnetent_r
14067 eval $inlibc
14068 case "$d_getnetent_r" in
14069 "$define")
14070         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14071         case "$d_getnetent_r_proto:$usethreads" in
14072         ":define")      d_getnetent_r_proto=define
14073                 set d_getnetent_r_proto getnetent_r $hdrs
14074                 eval $hasproto ;;
14075         *)      ;;
14076         esac
14077         case "$d_getnetent_r_proto" in
14078         define)
14079         case "$getnetent_r_proto" in
14080         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14081         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14082         esac
14083         case "$getnetent_r_proto" in
14084         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14085         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14086         esac
14087         case "$getnetent_r_proto" in
14088         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14089         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14090         esac
14091         case "$getnetent_r_proto" in
14092         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14093         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14094         esac
14095         case "$getnetent_r_proto" in
14096         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14097         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14098         esac
14099         case "$getnetent_r_proto" in
14100         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14101         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14102         esac
14103         case "$getnetent_r_proto" in
14104         ''|0)   d_getnetent_r=undef
14105                 getnetent_r_proto=0
14106                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14107         * )     case "$getnetent_r_proto" in
14108                 REENTRANT_PROTO*) ;;
14109                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14110                 esac
14111                 echo "Prototype: $try" ;;
14112         esac
14113         ;;
14114         *)      case "$usethreads" in
14115                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14116                 esac
14117                 d_getnetent_r=undef
14118                 getnetent_r_proto=0
14119                 ;;
14120         esac
14121         ;;
14122 *)      getnetent_r_proto=0
14123         ;;
14124 esac
14125
14126 : see if prototypes for various getnetxxx netdb.h functions are available
14127 echo " "
14128 set d_getnetprotos getnetent $i_netdb netdb.h
14129 eval $hasproto
14130
14131 : see if getpagesize exists
14132 set getpagesize d_getpagsz
14133 eval $inlibc
14134
14135 : Optional checks for getprotobyname and getprotobynumber
14136
14137 : see if getprotobyname exists
14138 set getprotobyname d_getpbyname
14139 eval $inlibc
14140
14141 : see if getprotobynumber exists
14142 set getprotobynumber d_getpbynumber
14143 eval $inlibc
14144
14145 : see if getprotoent exists
14146 set getprotoent d_getpent
14147 eval $inlibc
14148
14149 : see if getpgid exists
14150 set getpgid d_getpgid
14151 eval $inlibc
14152
14153 : see if getpgrp2 exists
14154 set getpgrp2 d_getpgrp2
14155 eval $inlibc
14156
14157 : see if getppid exists
14158 set getppid d_getppid
14159 eval $inlibc
14160
14161 : see if getpriority exists
14162 set getpriority d_getprior
14163 eval $inlibc
14164
14165 : see if getprotobyname_r exists
14166 set getprotobyname_r d_getprotobyname_r
14167 eval $inlibc
14168 case "$d_getprotobyname_r" in
14169 "$define")
14170         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14171         case "$d_getprotobyname_r_proto:$usethreads" in
14172         ":define")      d_getprotobyname_r_proto=define
14173                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14174                 eval $hasproto ;;
14175         *)      ;;
14176         esac
14177         case "$d_getprotobyname_r_proto" in
14178         define)
14179         case "$getprotobyname_r_proto" in
14180         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14181         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14182         esac
14183         case "$getprotobyname_r_proto" in
14184         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14185         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14186         esac
14187         case "$getprotobyname_r_proto" in
14188         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14189         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14190         esac
14191         case "$getprotobyname_r_proto" in
14192         ''|0)   d_getprotobyname_r=undef
14193                 getprotobyname_r_proto=0
14194                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14195         * )     case "$getprotobyname_r_proto" in
14196                 REENTRANT_PROTO*) ;;
14197                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14198                 esac
14199                 echo "Prototype: $try" ;;
14200         esac
14201         ;;
14202         *)      case "$usethreads" in
14203                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14204                 esac
14205                 d_getprotobyname_r=undef
14206                 getprotobyname_r_proto=0
14207                 ;;
14208         esac
14209         ;;
14210 *)      getprotobyname_r_proto=0
14211         ;;
14212 esac
14213
14214 : see if getprotobynumber_r exists
14215 set getprotobynumber_r d_getprotobynumber_r
14216 eval $inlibc
14217 case "$d_getprotobynumber_r" in
14218 "$define")
14219         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14220         case "$d_getprotobynumber_r_proto:$usethreads" in
14221         ":define")      d_getprotobynumber_r_proto=define
14222                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14223                 eval $hasproto ;;
14224         *)      ;;
14225         esac
14226         case "$d_getprotobynumber_r_proto" in
14227         define)
14228         case "$getprotobynumber_r_proto" in
14229         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14230         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14231         esac
14232         case "$getprotobynumber_r_proto" in
14233         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14234         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14235         esac
14236         case "$getprotobynumber_r_proto" in
14237         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14238         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14239         esac
14240         case "$getprotobynumber_r_proto" in
14241         ''|0)   d_getprotobynumber_r=undef
14242                 getprotobynumber_r_proto=0
14243                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14244         * )     case "$getprotobynumber_r_proto" in
14245                 REENTRANT_PROTO*) ;;
14246                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14247                 esac
14248                 echo "Prototype: $try" ;;
14249         esac
14250         ;;
14251         *)      case "$usethreads" in
14252                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14253                 esac
14254                 d_getprotobynumber_r=undef
14255                 getprotobynumber_r_proto=0
14256                 ;;
14257         esac
14258         ;;
14259 *)      getprotobynumber_r_proto=0
14260         ;;
14261 esac
14262
14263 : see if getprotoent_r exists
14264 set getprotoent_r d_getprotoent_r
14265 eval $inlibc
14266 case "$d_getprotoent_r" in
14267 "$define")
14268         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14269         case "$d_getprotoent_r_proto:$usethreads" in
14270         ":define")      d_getprotoent_r_proto=define
14271                 set d_getprotoent_r_proto getprotoent_r $hdrs
14272                 eval $hasproto ;;
14273         *)      ;;
14274         esac
14275         case "$d_getprotoent_r_proto" in
14276         define)
14277         case "$getprotoent_r_proto" in
14278         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14279         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14280         esac
14281         case "$getprotoent_r_proto" in
14282         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14283         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14284         esac
14285         case "$getprotoent_r_proto" in
14286         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14287         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14288         esac
14289         case "$getprotoent_r_proto" in
14290         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14291         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14292         esac
14293         case "$getprotoent_r_proto" in
14294         ''|0)   d_getprotoent_r=undef
14295                 getprotoent_r_proto=0
14296                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14297         * )     case "$getprotoent_r_proto" in
14298                 REENTRANT_PROTO*) ;;
14299                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14300                 esac
14301                 echo "Prototype: $try" ;;
14302         esac
14303         ;;
14304         *)      case "$usethreads" in
14305                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14306                 esac
14307                 d_getprotoent_r=undef
14308                 getprotoent_r_proto=0
14309                 ;;
14310         esac
14311         ;;
14312 *)      getprotoent_r_proto=0
14313         ;;
14314 esac
14315
14316 : see if prototypes for various getprotoxxx netdb.h functions are available
14317 echo " "
14318 set d_getprotoprotos getprotoent $i_netdb netdb.h
14319 eval $hasproto
14320
14321 : see if getprpwnam exists
14322 set getprpwnam d_getprpwnam
14323 eval $inlibc
14324
14325 : see if getpwent exists
14326 set getpwent d_getpwent
14327 eval $inlibc
14328
14329 : see if getpwent_r exists
14330 set getpwent_r d_getpwent_r
14331 eval $inlibc
14332 case "$d_getpwent_r" in
14333 "$define")
14334         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14335         case "$d_getpwent_r_proto:$usethreads" in
14336         ":define")      d_getpwent_r_proto=define
14337                 set d_getpwent_r_proto getpwent_r $hdrs
14338                 eval $hasproto ;;
14339         *)      ;;
14340         esac
14341         case "$d_getpwent_r_proto" in
14342         define)
14343         case "$getpwent_r_proto" in
14344         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14345         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14346         esac
14347         case "$getpwent_r_proto" in
14348         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14349         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14350         esac
14351         case "$getpwent_r_proto" in
14352         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14353         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14354         esac
14355         case "$getpwent_r_proto" in
14356         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14357         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14358         esac
14359         case "$getpwent_r_proto" in
14360         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14361         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14362         esac
14363         case "$getpwent_r_proto" in
14364         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14365         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14366         esac
14367         case "$getpwent_r_proto" in
14368         ''|0)   d_getpwent_r=undef
14369                 getpwent_r_proto=0
14370                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14371         * )     case "$getpwent_r_proto" in
14372                 REENTRANT_PROTO*) ;;
14373                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14374                 esac
14375                 echo "Prototype: $try" ;;
14376         esac
14377         ;;
14378         *)      case "$usethreads" in
14379                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14380                 esac
14381                 d_getpwent_r=undef
14382                 getpwent_r_proto=0
14383                 ;;
14384         esac
14385         ;;
14386 *)      getpwent_r_proto=0
14387         ;;
14388 esac
14389
14390 : see if getpwnam_r exists
14391 set getpwnam_r d_getpwnam_r
14392 eval $inlibc
14393 case "$d_getpwnam_r" in
14394 "$define")
14395         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14396         case "$d_getpwnam_r_proto:$usethreads" in
14397         ":define")      d_getpwnam_r_proto=define
14398                 set d_getpwnam_r_proto getpwnam_r $hdrs
14399                 eval $hasproto ;;
14400         *)      ;;
14401         esac
14402         case "$d_getpwnam_r_proto" in
14403         define)
14404         case "$getpwnam_r_proto" in
14405         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14406         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14407         esac
14408         case "$getpwnam_r_proto" in
14409         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14410         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14411         esac
14412         case "$getpwnam_r_proto" in
14413         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14414         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14415         esac
14416         case "$getpwnam_r_proto" in
14417         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14418         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14419         esac
14420         case "$getpwnam_r_proto" in
14421         ''|0)   d_getpwnam_r=undef
14422                 getpwnam_r_proto=0
14423                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14424         * )     case "$getpwnam_r_proto" in
14425                 REENTRANT_PROTO*) ;;
14426                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14427                 esac
14428                 echo "Prototype: $try" ;;
14429         esac
14430         ;;
14431         *)      case "$usethreads" in
14432                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14433                 esac
14434                 d_getpwnam_r=undef
14435                 getpwnam_r_proto=0
14436                 ;;
14437         esac
14438         ;;
14439 *)      getpwnam_r_proto=0
14440         ;;
14441 esac
14442
14443 : see if getpwuid_r exists
14444 set getpwuid_r d_getpwuid_r
14445 eval $inlibc
14446 case "$d_getpwuid_r" in
14447 "$define")
14448         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14449         case "$d_getpwuid_r_proto:$usethreads" in
14450         ":define")      d_getpwuid_r_proto=define
14451                 set d_getpwuid_r_proto getpwuid_r $hdrs
14452                 eval $hasproto ;;
14453         *)      ;;
14454         esac
14455         case "$d_getpwuid_r_proto" in
14456         define)
14457         case "$getpwuid_r_proto" in
14458         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14459         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14460         esac
14461         case "$getpwuid_r_proto" in
14462         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14463         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14464         esac
14465         case "$getpwuid_r_proto" in
14466         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14467         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14468         esac
14469         case "$getpwuid_r_proto" in
14470         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14471         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14472         esac
14473         case "$getpwuid_r_proto" in
14474         ''|0)   d_getpwuid_r=undef
14475                 getpwuid_r_proto=0
14476                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14477         * )     case "$getpwuid_r_proto" in
14478                 REENTRANT_PROTO*) ;;
14479                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14480                 esac
14481                 echo "Prototype: $try" ;;
14482         esac
14483         ;;
14484         *)      case "$usethreads" in
14485                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14486                 esac
14487                 d_getpwuid_r=undef
14488                 getpwuid_r_proto=0
14489                 ;;
14490         esac
14491         ;;
14492 *)      getpwuid_r_proto=0
14493         ;;
14494 esac
14495
14496 : Optional checks for getsbyname and getsbyport
14497
14498 : see if getservbyname exists
14499 set getservbyname d_getsbyname
14500 eval $inlibc
14501
14502 : see if getservbyport exists
14503 set getservbyport d_getsbyport
14504 eval $inlibc
14505
14506 : see if getservent exists
14507 set getservent d_getsent
14508 eval $inlibc
14509
14510 : see if getservbyname_r exists
14511 set getservbyname_r d_getservbyname_r
14512 eval $inlibc
14513 case "$d_getservbyname_r" in
14514 "$define")
14515         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14516         case "$d_getservbyname_r_proto:$usethreads" in
14517         ":define")      d_getservbyname_r_proto=define
14518                 set d_getservbyname_r_proto getservbyname_r $hdrs
14519                 eval $hasproto ;;
14520         *)      ;;
14521         esac
14522         case "$d_getservbyname_r_proto" in
14523         define)
14524         case "$getservbyname_r_proto" in
14525         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14526         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14527         esac
14528         case "$getservbyname_r_proto" in
14529         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14530         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14531         esac
14532         case "$getservbyname_r_proto" in
14533         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14534         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14535         esac
14536         case "$getservbyname_r_proto" in
14537         ''|0)   d_getservbyname_r=undef
14538                 getservbyname_r_proto=0
14539                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14540         * )     case "$getservbyname_r_proto" in
14541                 REENTRANT_PROTO*) ;;
14542                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14543                 esac
14544                 echo "Prototype: $try" ;;
14545         esac
14546         ;;
14547         *)      case "$usethreads" in
14548                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14549                 esac
14550                 d_getservbyname_r=undef
14551                 getservbyname_r_proto=0
14552                 ;;
14553         esac
14554         ;;
14555 *)      getservbyname_r_proto=0
14556         ;;
14557 esac
14558
14559 : see if getservbyport_r exists
14560 set getservbyport_r d_getservbyport_r
14561 eval $inlibc
14562 case "$d_getservbyport_r" in
14563 "$define")
14564         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14565         case "$d_getservbyport_r_proto:$usethreads" in
14566         ":define")      d_getservbyport_r_proto=define
14567                 set d_getservbyport_r_proto getservbyport_r $hdrs
14568                 eval $hasproto ;;
14569         *)      ;;
14570         esac
14571         case "$d_getservbyport_r_proto" in
14572         define)
14573         case "$getservbyport_r_proto" in
14574         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14575         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14576         esac
14577         case "$getservbyport_r_proto" in
14578         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14579         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14580         esac
14581         case "$getservbyport_r_proto" in
14582         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14583         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14584         esac
14585         case "$getservbyport_r_proto" in
14586         ''|0)   d_getservbyport_r=undef
14587                 getservbyport_r_proto=0
14588                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14589         * )     case "$getservbyport_r_proto" in
14590                 REENTRANT_PROTO*) ;;
14591                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14592                 esac
14593                 echo "Prototype: $try" ;;
14594         esac
14595         ;;
14596         *)      case "$usethreads" in
14597                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14598                 esac
14599                 d_getservbyport_r=undef
14600                 getservbyport_r_proto=0
14601                 ;;
14602         esac
14603         ;;
14604 *)      getservbyport_r_proto=0
14605         ;;
14606 esac
14607
14608 : see if getservent_r exists
14609 set getservent_r d_getservent_r
14610 eval $inlibc
14611 case "$d_getservent_r" in
14612 "$define")
14613         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14614         case "$d_getservent_r_proto:$usethreads" in
14615         ":define")      d_getservent_r_proto=define
14616                 set d_getservent_r_proto getservent_r $hdrs
14617                 eval $hasproto ;;
14618         *)      ;;
14619         esac
14620         case "$d_getservent_r_proto" in
14621         define)
14622         case "$getservent_r_proto" in
14623         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14624         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14625         esac
14626         case "$getservent_r_proto" in
14627         ''|0) try='int getservent_r(struct servent*, char*, int);'
14628         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14629         esac
14630         case "$getservent_r_proto" in
14631         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14632         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14633         esac
14634         case "$getservent_r_proto" in
14635         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14636         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14637         esac
14638         case "$getservent_r_proto" in
14639         ''|0)   d_getservent_r=undef
14640                 getservent_r_proto=0
14641                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14642         * )     case "$getservent_r_proto" in
14643                 REENTRANT_PROTO*) ;;
14644                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14645                 esac
14646                 echo "Prototype: $try" ;;
14647         esac
14648         ;;
14649         *)      case "$usethreads" in
14650                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14651                 esac
14652                 d_getservent_r=undef
14653                 getservent_r_proto=0
14654                 ;;
14655         esac
14656         ;;
14657 *)      getservent_r_proto=0
14658         ;;
14659 esac
14660
14661 : see if prototypes for various getservxxx netdb.h functions are available
14662 echo " "
14663 set d_getservprotos getservent $i_netdb netdb.h
14664 eval $hasproto
14665
14666 : see if getspnam exists
14667 set getspnam d_getspnam
14668 eval $inlibc
14669
14670 : see if this is a shadow.h system
14671 set shadow.h i_shadow
14672 eval $inhdr
14673
14674 : see if getspnam_r exists
14675 set getspnam_r d_getspnam_r
14676 eval $inlibc
14677 case "$d_getspnam_r" in
14678 "$define")
14679         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14680         case "$d_getspnam_r_proto:$usethreads" in
14681         ":define")      d_getspnam_r_proto=define
14682                 set d_getspnam_r_proto getspnam_r $hdrs
14683                 eval $hasproto ;;
14684         *)      ;;
14685         esac
14686         case "$d_getspnam_r_proto" in
14687         define)
14688         case "$getspnam_r_proto" in
14689         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14690         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14691         esac
14692         case "$getspnam_r_proto" in
14693         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14694         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14695         esac
14696         case "$getspnam_r_proto" in
14697         ''|0)   d_getspnam_r=undef
14698                 getspnam_r_proto=0
14699                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14700         * )     case "$getspnam_r_proto" in
14701                 REENTRANT_PROTO*) ;;
14702                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14703                 esac
14704                 echo "Prototype: $try" ;;
14705         esac
14706         ;;
14707         *)      case "$usethreads" in
14708                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14709                 esac
14710                 d_getspnam_r=undef
14711                 getspnam_r_proto=0
14712                 ;;
14713         esac
14714         ;;
14715 *)      getspnam_r_proto=0
14716         ;;
14717 esac
14718
14719 : see if gettimeofday or ftime exists
14720 set gettimeofday d_gettimeod
14721 eval $inlibc
14722 case "$d_gettimeod" in
14723 "$undef")
14724         set ftime d_ftime 
14725         eval $inlibc
14726         ;;
14727 *)
14728         val="$undef"; set d_ftime; eval $setvar
14729         ;;
14730 esac
14731 case "$d_gettimeod$d_ftime" in
14732 "$undef$undef")
14733         echo " "
14734         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14735         ;;
14736 esac
14737
14738 : see if gmtime_r exists
14739 set gmtime_r d_gmtime_r
14740 eval $inlibc
14741 case "$d_gmtime_r" in
14742 "$define")
14743         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14744         case "$d_gmtime_r_proto:$usethreads" in
14745         ":define")      d_gmtime_r_proto=define
14746                 set d_gmtime_r_proto gmtime_r $hdrs
14747                 eval $hasproto ;;
14748         *)      ;;
14749         esac
14750         case "$d_gmtime_r_proto" in
14751         define)
14752         case "$gmtime_r_proto" in
14753         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14754         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14755         esac
14756         case "$gmtime_r_proto" in
14757         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14758         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14759         esac
14760         case "$gmtime_r_proto" in
14761         ''|0)   d_gmtime_r=undef
14762                 gmtime_r_proto=0
14763                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14764         * )     case "$gmtime_r_proto" in
14765                 REENTRANT_PROTO*) ;;
14766                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14767                 esac
14768                 echo "Prototype: $try" ;;
14769         esac
14770         ;;
14771         *)      case "$usethreads" in
14772                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14773                 esac
14774                 d_gmtime_r=undef
14775                 gmtime_r_proto=0
14776                 ;;
14777         esac
14778         ;;
14779 *)      gmtime_r_proto=0
14780         ;;
14781 esac
14782
14783 : see if hasmntopt exists
14784 set hasmntopt d_hasmntopt
14785 eval $inlibc
14786
14787 : see if this is a netinet/in.h or sys/in.h system
14788 set netinet/in.h i_niin sys/in.h i_sysin
14789 eval $inhdr
14790
14791 : see if arpa/inet.h has to be included
14792 set arpa/inet.h i_arpainet
14793 eval $inhdr
14794
14795 : see if htonl --and friends-- exists
14796 val=''
14797 set htonl val
14798 eval $inlibc
14799
14800 : Maybe they are macros.
14801 case "$val" in
14802 $undef)
14803         $cat >htonl.c <<EOM
14804 #include <stdio.h>
14805 #include <sys/types.h>
14806 #$i_niin I_NETINET_IN
14807 #$i_sysin I_SYS_IN
14808 #$i_arpainet I_ARPA_INET
14809 #ifdef I_NETINET_IN
14810 #include <netinet/in.h>
14811 #endif
14812 #ifdef I_SYS_IN
14813 #include <sys/in.h>
14814 #endif
14815 #ifdef I_ARPA_INET
14816 #include <arpa/inet.h>
14817 #endif
14818 #ifdef htonl
14819 printf("Defined as a macro.");
14820 #endif
14821 EOM
14822         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14823         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14824                 val="$define"
14825                 echo "But it seems to be defined as a macro." >&4
14826         fi
14827         $rm -f htonl.?
14828         ;;
14829 esac
14830 set d_htonl
14831 eval $setvar
14832
14833 : see if ilogbl exists
14834 set ilogbl d_ilogbl
14835 eval $inlibc
14836
14837 : index or strchr
14838 echo " "
14839 if set index val -f; eval $csym; $val; then
14840         if set strchr val -f d_strchr; eval $csym; $val; then
14841                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14842                         val="$define"
14843                         vali="$undef"
14844                         echo "strchr() found." >&4
14845                 else
14846                         val="$undef"
14847                         vali="$define"
14848                         echo "index() found." >&4
14849                 fi
14850         else
14851                 val="$undef"
14852                 vali="$define"
14853                 echo "index() found." >&4
14854         fi
14855 else
14856         if set strchr val -f d_strchr; eval $csym; $val; then
14857                 val="$define"
14858                 vali="$undef"
14859                 echo "strchr() found." >&4
14860         else
14861                 echo "No index() or strchr() found!" >&4
14862                 val="$undef"
14863                 vali="$undef"
14864         fi
14865 fi
14866 set d_strchr; eval $setvar
14867 val="$vali"
14868 set d_index; eval $setvar
14869
14870 : check whether inet_aton exists
14871 set inet_aton d_inetaton
14872 eval $inlibc
14873
14874 : Look for isascii
14875 echo " "
14876 $cat >isascii.c <<EOCP
14877 #include <stdio.h>
14878 #include <ctype.h>
14879 #$i_stdlib I_STDLIB
14880 #ifdef I_STDLIB
14881 #include <stdlib.h>
14882 #endif
14883 int main() {
14884         int c = 'A';
14885         if (isascii(c))
14886                 exit(0);
14887         else
14888                 exit(1);
14889 }
14890 EOCP
14891 set isascii
14892 if eval $compile; then
14893         echo "isascii() found." >&4
14894         val="$define"
14895 else
14896         echo "isascii() NOT found." >&4
14897         val="$undef"
14898 fi
14899 set d_isascii
14900 eval $setvar
14901 $rm -f isascii*
14902
14903 : see if isfinite exists
14904 set isfinite d_isfinite
14905 eval $inlibc
14906
14907 : see if isinf exists
14908 set isinf d_isinf
14909 eval $inlibc
14910
14911 : see if isnan exists
14912 set isnan d_isnan
14913 eval $inlibc
14914
14915 : see if isnanl exists
14916 set isnanl d_isnanl
14917 eval $inlibc
14918
14919 : see if killpg exists
14920 set killpg d_killpg
14921 eval $inlibc
14922
14923 : see if lchown exists
14924 echo " "
14925 $cat > try.c <<'EOCP'
14926 /* System header to define __stub macros and hopefully few prototypes,
14927     which can conflict with char lchown(); below.  */
14928 #include <assert.h>
14929 /* Override any gcc2 internal prototype to avoid an error.  */
14930 /* We use char because int might match the return type of a gcc2
14931    builtin and then its argument prototype would still apply.  */
14932 char lchown();
14933 int main() {
14934     /*  The GNU C library defines this for functions which it implements
14935         to always fail with ENOSYS.  Some functions are actually named
14936         something starting with __ and the normal name is an alias.  */
14937 #if defined (__stub_lchown) || defined (__stub___lchown)
14938 choke me
14939 #else
14940 lchown();
14941 #endif
14942 ; return 0; }
14943 EOCP
14944 set try
14945 if eval $compile; then
14946     $echo "lchown() found." >&4
14947     val="$define"
14948 else
14949     $echo "lchown() NOT found." >&4
14950     val="$undef"
14951 fi
14952 set d_lchown
14953 eval $setvar
14954
14955 : See if number of significant digits in a double precision number is known
14956 echo " "
14957 $cat >ldbl_dig.c <<EOM
14958 #$i_limits I_LIMITS
14959 #$i_float I_FLOAT
14960 #ifdef I_LIMITS
14961 #include <limits.h>
14962 #endif
14963 #ifdef I_FLOAT
14964 #include <float.h>
14965 #endif
14966 #ifdef LDBL_DIG
14967 printf("Contains LDBL_DIG");
14968 #endif
14969 EOM
14970 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14971 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14972         echo "LDBL_DIG found." >&4
14973         val="$define"
14974 else
14975         echo "LDBL_DIG NOT found." >&4
14976         val="$undef"
14977 fi
14978 $rm -f ldbl_dig.?
14979 set d_ldbl_dig
14980 eval $setvar
14981
14982 : see if this is a math.h system
14983 set math.h i_math
14984 eval $inhdr
14985
14986 : check to see if math.h defines _LIB_VERSION
14987 d_libm_lib_version="$undef"
14988 case $i_math in
14989     $define)
14990         echo " "
14991         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14992         $cat >try.c <<EOCP
14993 #include <unistd.h>
14994 #include <math.h>
14995 int main (int argc, char *argv[])
14996 {
14997     printf ("%d\n", _LIB_VERSION);
14998     return (0);
14999     } /* main */
15000 EOCP
15001         set try
15002         if eval $compile; then
15003             foo=`$run ./try`
15004             echo "Yes, it does ($foo)" >&4
15005             d_libm_lib_version="$define"
15006         else
15007             echo "No, it does not (probably harmless)" >&4
15008             fi
15009         $rm_try
15010         ;;
15011
15012     esac
15013
15014 : see if link exists
15015 set link d_link
15016 eval $inlibc
15017
15018 : see if localtime_r exists
15019 set localtime_r d_localtime_r
15020 eval $inlibc
15021 case "$d_localtime_r" in
15022 "$define")
15023         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15024         case "$d_localtime_r_proto:$usethreads" in
15025         ":define")      d_localtime_r_proto=define
15026                 set d_localtime_r_proto localtime_r $hdrs
15027                 eval $hasproto ;;
15028         *)      ;;
15029         esac
15030         case "$d_localtime_r_proto" in
15031         define)
15032         case "$localtime_r_proto" in
15033         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15034         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15035         esac
15036         case "$localtime_r_proto" in
15037         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15038         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15039         esac
15040         case "$localtime_r_proto" in
15041         ''|0)   d_localtime_r=undef
15042                 localtime_r_proto=0
15043                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15044         * )     case "$localtime_r_proto" in
15045                 REENTRANT_PROTO*) ;;
15046                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15047                 esac
15048                 echo "Prototype: $try" ;;
15049         esac
15050         ;;
15051         *)      case "$usethreads" in
15052                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15053                 esac
15054                 d_localtime_r=undef
15055                 localtime_r_proto=0
15056                 ;;
15057         esac
15058         ;;
15059 *)      localtime_r_proto=0
15060         ;;
15061 esac
15062
15063 : see if localtime_r calls tzset
15064 case "$localtime_r_proto" in
15065 REENTRANT_PROTO*)
15066         $cat >try.c <<EOCP
15067 /*  Does our libc's localtime_r call tzset ?
15068  *  return 0 if so, 1 otherwise.
15069  */
15070 #$i_systypes    I_SYS_TYPES
15071 #$i_unistd      I_UNISTD
15072 #$i_time        I_TIME
15073 #$i_stdlib      I_STDLIB
15074 #$i_string      I_STRING
15075 #$i_malloc      I_MALLOC
15076 #ifdef I_SYS_TYPES
15077 #  include <sys/types.h>
15078 #endif
15079 #ifdef I_UNISTD
15080 #  include <unistd.h>
15081 #endif
15082 #ifdef I_TIME
15083 #  include <time.h>
15084 #endif
15085 #ifdef I_STDLIB
15086 #include <stdlib.h>
15087 #endif
15088 #ifdef I_STRING
15089 #  include <string.h>
15090 #else
15091 #  include <strings.h>
15092 #endif
15093 #ifdef I_MALLOC
15094 #  include <malloc.h>
15095 #endif
15096 int main()
15097 {
15098     time_t t = time(0L);
15099     char w_tz[]="TZ" "=GMT+5",
15100          e_tz[]="TZ" "=GMT-5",
15101         *tz_e = (char*)malloc(16),
15102         *tz_w = (char*)malloc(16);
15103     struct tm tm_e, tm_w;
15104     memset(&tm_e,'\0',sizeof(struct tm));
15105     memset(&tm_w,'\0',sizeof(struct tm));
15106     strcpy(tz_e,e_tz);
15107     strcpy(tz_w,w_tz);
15108
15109     putenv(tz_e);
15110     localtime_r(&t, &tm_e);
15111
15112     putenv(tz_w);
15113     localtime_r(&t, &tm_w);
15114
15115     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15116         return 1;
15117     return 0;
15118 }
15119 EOCP
15120         set try
15121         if eval $compile; then
15122             if $run ./try; then
15123                 d_localtime_r_needs_tzset=undef;
15124             else
15125                 d_localtime_r_needs_tzset=define;
15126             fi;
15127         else
15128             d_localtime_r_needs_tzset=undef;
15129         fi;
15130      ;;
15131   *)
15132      d_localtime_r_needs_tzset=undef;
15133      ;;
15134 esac
15135 $rm_try
15136
15137 : see if localeconv exists
15138 set localeconv d_locconv
15139 eval $inlibc
15140
15141 : see if lockf exists
15142 set lockf d_lockf
15143 eval $inlibc
15144
15145 : see if prototype for lseek is available
15146 echo " "
15147 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15148 eval $hasproto
15149
15150 : see if lstat exists
15151 set lstat d_lstat
15152 eval $inlibc
15153
15154 : see if madvise exists
15155 set madvise d_madvise
15156 eval $inlibc
15157
15158 : see if malloc_size exists
15159 set malloc_size d_malloc_size
15160 eval $inlibc
15161
15162 : see if malloc_size_good exists
15163 set malloc_good_size d_malloc_good_size
15164 eval $inlibc
15165
15166 : see if mblen exists
15167 set mblen d_mblen
15168 eval $inlibc
15169
15170 : see if mbstowcs exists
15171 set mbstowcs d_mbstowcs
15172 eval $inlibc
15173
15174 : see if mbtowc exists
15175 set mbtowc d_mbtowc
15176 eval $inlibc
15177
15178 : see if memchr exists
15179 set memchr d_memchr
15180 eval $inlibc
15181
15182 : see if memcmp exists
15183 set memcmp d_memcmp
15184 eval $inlibc
15185
15186 : see if memcpy exists
15187 set memcpy d_memcpy
15188 eval $inlibc
15189
15190 : see if memmove exists
15191 set memmove d_memmove
15192 eval $inlibc
15193
15194 : see if memset exists
15195 set memset d_memset
15196 eval $inlibc
15197
15198 : see if mkdir exists
15199 set mkdir d_mkdir
15200 eval $inlibc
15201
15202 : see if mkdtemp exists
15203 set mkdtemp d_mkdtemp
15204 eval $inlibc
15205
15206 : see if mkfifo exists
15207 set mkfifo d_mkfifo
15208 eval $inlibc
15209
15210 : see if mkstemp exists
15211 set mkstemp d_mkstemp
15212 eval $inlibc
15213
15214 : see if mkstemps exists
15215 set mkstemps d_mkstemps
15216 eval $inlibc
15217
15218 : see if mktime exists
15219 set mktime d_mktime
15220 eval $inlibc
15221
15222 : see if this is a sys/mman.h system
15223 set sys/mman.h i_sysmman
15224 eval $inhdr
15225
15226 : see if mmap exists
15227 set mmap d_mmap
15228 eval $inlibc
15229 : see what shmat returns
15230 : default to something harmless
15231 mmaptype='void *'
15232 case "$i_sysmman$d_mmap" in
15233 "$define$define")
15234         $cat >mmap.c <<'END'
15235 #include <sys/mman.h>
15236 void *mmap();
15237 END
15238         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15239                 mmaptype='void *'
15240         else
15241                 mmaptype='caddr_t'
15242         fi
15243         echo "and it returns ($mmaptype)." >&4
15244         ;;
15245 esac
15246
15247
15248
15249 : see if sqrtl exists
15250 set sqrtl d_sqrtl
15251 eval $inlibc
15252
15253 : see if scalbnl exists
15254 set scalbnl d_scalbnl
15255 eval $inlibc
15256
15257 : see if modfl exists
15258 set modfl d_modfl
15259 eval $inlibc
15260
15261 : see if prototype for modfl is available
15262 echo " "
15263 set d_modflproto modfl $i_math math.h
15264 eval $hasproto
15265
15266 d_modfl_pow32_bug="$undef"
15267
15268 case "$d_longdbl$d_modfl" in
15269 $define$define)
15270         $cat <<EOM
15271 Checking to see whether your modfl() is okay for large values...
15272 EOM
15273 $cat >try.c <<EOCP
15274 #include <math.h>
15275 #include <stdio.h>
15276 EOCP
15277 if $test "X$d_modflproto" != "X$define"; then
15278         $cat >>try.c <<EOCP
15279 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15280 long double modfl (long double, long double *);
15281 EOCP
15282 fi
15283 $cat >>try.c <<EOCP
15284 int main() {
15285     long double nv = 4294967303.15;
15286     long double v, w;
15287     v = modfl(nv, &w);
15288 #ifdef __GLIBC__
15289     printf("glibc");
15290 #endif
15291     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15292     return 0;
15293 }
15294 EOCP
15295         case "$osname:$gccversion" in
15296         aix:)   saveccflags="$ccflags"
15297                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15298         esac
15299         set try
15300         if eval $compile; then
15301                 foo=`$run ./try`
15302                 case "$foo" in
15303                 *" 4294967303.150000 1.150000 4294967302.000000")
15304                         echo >&4 "Your modfl() is broken for large values."
15305                         d_modfl_pow32_bug="$define"
15306                         case "$foo" in
15307                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15308                         ;;
15309                         esac
15310                         ;;
15311                 *" 4294967303.150000 0.150000 4294967303.000000")
15312                         echo >&4 "Your modfl() seems okay for large values."
15313                         ;;
15314                 *)      echo >&4 "I don't understand your modfl() at all."
15315                         d_modfl="$undef"
15316                         ;;
15317                 esac
15318                 $rm_try
15319         else
15320                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15321                 d_modfl="$undef"
15322         fi
15323         case "$osname:$gccversion" in
15324         aix:)   ccflags="$saveccflags" ;; # restore
15325         esac
15326         ;;
15327 esac
15328
15329 if $test "$uselongdouble" = "$define"; then
15330     message=""
15331     if $test "$d_sqrtl" != "$define"; then
15332         message="$message sqrtl"
15333     fi
15334     if $test "$d_modfl" != "$define"; then
15335         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15336             echo "You have both aintl and copysignl, so I can emulate modfl."
15337         else
15338             message="$message modfl"
15339         fi
15340     fi
15341     if $test "$d_frexpl" != "$define"; then
15342         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15343             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15344         else
15345             message="$message frexpl"
15346         fi
15347     fi
15348
15349     if $test "$message" != ""; then
15350         $cat <<EOM >&4
15351
15352 *** You requested the use of long doubles but you do not seem to have
15353 *** the following mathematical functions needed for long double support:
15354 ***    $message
15355 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15356 *** Cannot continue, aborting.
15357
15358 EOM
15359
15360         exit 1
15361     fi
15362 fi
15363
15364 : see if mprotect exists
15365 set mprotect d_mprotect
15366 eval $inlibc
15367
15368 : see if msgctl exists
15369 set msgctl d_msgctl
15370 eval $inlibc
15371
15372 : see if msgget exists
15373 set msgget d_msgget
15374 eval $inlibc
15375
15376 : see if msgsnd exists
15377 set msgsnd d_msgsnd
15378 eval $inlibc
15379
15380 : see if msgrcv exists
15381 set msgrcv d_msgrcv
15382 eval $inlibc
15383
15384 : see how much of the 'msg*(2)' library is present.
15385 h_msg=true
15386 echo " "
15387 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15388 *"$undef"*) h_msg=false;;
15389 esac
15390 case "$osname" in
15391 freebsd)
15392     case "`ipcs 2>&1`" in
15393     "SVID messages"*"not configured"*)
15394         echo "Your $osname does not have the msg*(2) configured." >&4
15395         h_msg=false
15396         val="$undef"
15397         set msgctl d_msgctl
15398         eval $setvar
15399         set msgget d_msgget
15400         eval $setvar
15401         set msgsnd d_msgsnd
15402         eval $setvar
15403         set msgrcv d_msgrcv
15404         eval $setvar
15405         ;;
15406     esac
15407     ;;
15408 esac
15409 : we could also check for sys/ipc.h ...
15410 if $h_msg && $test `./findhdr sys/msg.h`; then
15411         echo "You have the full msg*(2) library." >&4
15412         val="$define"
15413 else
15414         echo "You don't have the full msg*(2) library." >&4
15415         val="$undef"
15416 fi
15417 set d_msg
15418 eval $setvar
15419
15420 : Check for msghdr_s
15421 echo " "
15422 echo "Checking to see if your system supports struct msghdr..." >&4
15423 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15424 eval $hasstruct
15425 case "$d_msghdr_s" in
15426 "$define")      echo "Yes, it does."   ;;
15427 *)              echo "No, it doesn't." ;;
15428 esac
15429
15430
15431 : see if msync exists
15432 set msync d_msync
15433 eval $inlibc
15434
15435 : see if munmap exists
15436 set munmap d_munmap
15437 eval $inlibc
15438
15439 : see if nice exists
15440 set nice d_nice
15441 eval $inlibc
15442
15443 : see if this is a langinfo.h system
15444 set langinfo.h i_langinfo
15445 eval $inhdr
15446
15447 : see if nl_langinfo exists
15448 set nl_langinfo d_nl_langinfo
15449 eval $inlibc
15450
15451 : check for volatile keyword
15452 echo " "
15453 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15454 $cat >try.c <<'EOCP'
15455 int main()
15456 {
15457         typedef struct _goo_struct goo_struct;
15458         goo_struct * volatile goo = ((goo_struct *)0);
15459         struct _goo_struct {
15460                 long long_int;
15461                 int reg_int;
15462                 char char_var;
15463         };
15464         typedef unsigned short foo_t;
15465         char *volatile foo;
15466         volatile int bar;
15467         volatile foo_t blech;
15468         foo = foo;
15469 }
15470 EOCP
15471 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15472         val="$define"
15473         echo "Yup, it does."
15474 else
15475         val="$undef"
15476         echo "Nope, it doesn't."
15477 fi
15478 set d_volatile
15479 eval $setvar
15480 $rm_try
15481
15482 : Check basic sizes
15483 echo " "
15484 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15485
15486 case "$use64bitint:$d_quad:$quadtype" in
15487 define:define:?*)
15488         ivtype="$quadtype"
15489         uvtype="$uquadtype"
15490         ivsize=8
15491         uvsize=8
15492         ;;
15493 *)      ivtype="long"
15494         uvtype="unsigned long"
15495         ivsize=$longsize
15496         uvsize=$longsize
15497         ;;
15498 esac
15499
15500 case "$uselongdouble:$d_longdbl" in
15501 define:define)
15502         nvtype="long double"
15503         nvsize=$longdblsize
15504         ;;
15505 *)      nvtype=double
15506         nvsize=$doublesize
15507         ;;
15508 esac
15509
15510 $echo "(IV will be "$ivtype", $ivsize bytes)"
15511 $echo "(UV will be "$uvtype", $uvsize bytes)"
15512 $echo "(NV will be "$nvtype", $nvsize bytes)"
15513
15514 $cat >try.c <<EOCP
15515 #$i_inttypes I_INTTYPES
15516 #ifdef I_INTTYPES
15517 #include <inttypes.h>
15518 #endif
15519 #include <stdio.h>
15520 int main() {
15521 #ifdef INT8
15522    int8_t i =  INT8_MAX;
15523   uint8_t u = UINT8_MAX;
15524   printf("int8_t\n");
15525 #endif
15526 #ifdef INT16
15527    int16_t i =  INT16_MAX;
15528   uint16_t i = UINT16_MAX;
15529   printf("int16_t\n");
15530 #endif
15531 #ifdef INT32
15532    int32_t i =  INT32_MAX;
15533   uint32_t u = UINT32_MAX;
15534   printf("int32_t\n");
15535 #endif
15536 }
15537 EOCP
15538
15539 i8type="signed char"
15540 u8type="unsigned char"
15541 i8size=1
15542 u8size=1
15543
15544 case "$i16type" in
15545 '')     case "$shortsize" in
15546         2)      i16type=short
15547                 u16type="unsigned short"
15548                 i16size=$shortsize
15549                 u16size=$shortsize
15550                 ;;
15551         esac
15552         ;;
15553 esac
15554 case "$i16type" in
15555 '')     set try -DINT16
15556         if eval $compile; then
15557                 case "`$run ./try`" in
15558                 int16_t)
15559                         i16type=int16_t
15560                         u16type=uint16_t
15561                         i16size=2
15562                         u16size=2
15563                         ;;
15564                 esac
15565         fi
15566         ;;
15567 esac
15568 case "$i16type" in
15569 '')     if $test $shortsize -ge 2; then
15570                 i16type=short
15571                 u16type="unsigned short"
15572                 i16size=$shortsize
15573                 u16size=$shortsize
15574         fi
15575         ;;
15576 esac
15577
15578 case "$i32type" in
15579 '')     case "$longsize" in
15580         4)      i32type=long
15581                 u32type="unsigned long"
15582                 i32size=$longsize
15583                 u32size=$longsize
15584                 ;;
15585         *)      case "$intsize" in
15586                 4)      i32type=int
15587                         u32type="unsigned int"
15588                         i32size=$intsize
15589                         u32size=$intsize
15590                         ;;
15591                 esac
15592                 ;;
15593         esac
15594         ;;
15595 esac
15596 case "$i32type" in
15597 '')     set try -DINT32
15598         if eval $compile; then
15599                 case "`$run ./try`" in
15600                 int32_t)
15601                         i32type=int32_t
15602                         u32type=uint32_t
15603                         i32size=4
15604                         u32size=4
15605                         ;;
15606                 esac
15607         fi
15608         ;;
15609 esac
15610 case "$i32type" in
15611 '')     if $test $intsize -ge 4; then
15612                 i32type=int
15613                 u32type="unsigned int"
15614                 i32size=$intsize
15615                 u32size=$intsize
15616         fi
15617         ;;
15618 esac
15619
15620 case "$i64type" in
15621 '')     case "$d_quad:$quadtype" in
15622         define:?*)
15623                 i64type="$quadtype"
15624                 u64type="$uquadtype"
15625                 i64size=8
15626                 u64size=8
15627                 ;;
15628         esac
15629         ;;
15630 esac
15631
15632 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15633 : volatile so that the compiler has to store it out to memory.
15634 if test X"$d_volatile" = X"$define"; then
15635         volatile=volatile
15636 fi
15637 $cat <<EOP >try.c
15638 #include <stdio.h>
15639 #$i_stdlib I_STDLIB
15640 #ifdef I_STDLIB
15641 #include <stdlib.h>
15642 #endif
15643 #include <sys/types.h>
15644 #include <signal.h>
15645 #ifdef SIGFPE
15646 $volatile int bletched = 0;
15647 $signal_t blech(int s) { bletched = 1; }
15648 #endif
15649 int main() {
15650     $uvtype u = 0;
15651     $nvtype d;
15652     int     n = 8 * $uvsize;
15653     int     i;
15654 #ifdef SIGFPE
15655     signal(SIGFPE, blech);
15656 #endif
15657
15658     for (i = 0; i < n; i++) {
15659       u = u << 1 | ($uvtype)1;
15660       d = ($nvtype)u;
15661       if (($uvtype)d != u)
15662         break;
15663       if (d <= 0)
15664         break;
15665       d = ($nvtype)(u - 1);
15666       if (($uvtype)d != (u - 1))
15667         break;
15668 #ifdef SIGFPE
15669       if (bletched)
15670         break;
15671 #endif
15672     }
15673     printf("%d\n", ((i == n) ? -n : i));
15674     exit(0);
15675 }
15676 EOP
15677 set try
15678
15679 d_nv_preserves_uv="$undef"
15680 if eval $compile; then
15681         nv_preserves_uv_bits="`$run ./try`"
15682 fi
15683 case "$nv_preserves_uv_bits" in
15684 \-[1-9]*)
15685         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15686         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15687         d_nv_preserves_uv="$define"
15688         ;;
15689 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15690         d_nv_preserves_uv="$undef" ;;
15691 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15692         nv_preserves_uv_bits="0" ;;
15693 esac
15694 $rm_try
15695
15696 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15697 : volatile so that the compiler has to store it out to memory.
15698 if test X"$d_volatile" = X"$define"; then
15699         volatile=volatile
15700 fi
15701 $cat <<EOP >try.c
15702 #include <stdio.h>
15703
15704 typedef $nvtype NV;
15705
15706 int
15707 main() {
15708   NV value = 2;
15709   int count = 1;
15710
15711   while(count < 256) {
15712     $volatile NV up = value + 1.0;
15713     $volatile NV negated = -value;
15714     $volatile NV down = negated - 1.0;
15715     $volatile NV got_up = up - value;
15716     int up_good = got_up == 1.0;
15717     int got_down = down - negated;
15718     int down_good = got_down == -1.0;
15719
15720     if (down_good != up_good) {
15721       fprintf(stderr,
15722               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15723               up_good, (double) got_up, down_good, (double) got_down,
15724               count, (double) value);
15725       return 1;
15726     }
15727     if (!up_good) {
15728       while (1) {
15729         if (count > 8) {
15730           count -= 8;
15731           fputs("256.0", stdout);
15732         } else {
15733           count--;
15734           fputs("2.0", stdout);
15735         }
15736         if (!count) {
15737           puts("");
15738           return 0;
15739         }
15740         fputs("*", stdout);
15741       }
15742     }
15743     value *= 2;
15744     ++count;
15745   }
15746   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15747           count, (double) value);
15748   return 1;
15749 }
15750 EOP
15751 set try
15752
15753 nv_overflows_integers_at='0'
15754 if eval $compile; then
15755     xxx="`$run ./try`"
15756     case "$?" in
15757         0)
15758             case "$xxx" in
15759                 2*)  cat >&4 <<EOM
15760 The largest integer your NVs can preserve is equal to $xxx
15761 EOM
15762                     nv_overflows_integers_at="$xxx"
15763                     ;;
15764                 *)  cat >&4 <<EOM
15765 Cannot determine the largest integer value your NVs can hold, unexpected output
15766 '$xxx'
15767 EOM
15768                     ;;
15769             esac
15770             ;;
15771         *)  cat >&4 <<EOM
15772 Cannot determine the largest integer value your NVs can hold
15773 EOM
15774             ;;
15775     esac
15776 fi
15777 $rm_try
15778
15779 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15780 : volatile so that the compiler has to store it out to memory.
15781 if test X"$d_volatile" = X"$define"; then
15782         volatile=volatile
15783 fi
15784 $cat <<EOP >try.c
15785 #include <stdio.h>
15786 #$i_stdlib I_STDLIB
15787 #ifdef I_STDLIB
15788 #include <stdlib.h>
15789 #endif
15790 #$i_string I_STRING
15791 #ifdef I_STRING
15792 #  include <string.h>
15793 #else
15794 #  include <strings.h>
15795 #endif
15796 #include <sys/types.h>
15797 #include <signal.h>
15798 #ifdef SIGFPE
15799 $volatile int bletched = 0;
15800 $signal_t blech(int s) { bletched = 1; }
15801 #endif
15802
15803 int checkit($nvtype d, char *where) {
15804     unsigned char *p = (char *)&d;
15805     unsigned char *end = p + sizeof(d);
15806     int fail = 0;
15807
15808     while (p < end)
15809         fail += *p++;
15810
15811     if (!fail)
15812         return 0;
15813
15814     p = (char *)&d;
15815     printf("No - %s: 0x", where);
15816     while (p < end)
15817         printf ("%02X", *p++);
15818     printf("\n");
15819     return 1;
15820 }
15821
15822 int main(int argc, char **argv) {
15823     $nvtype d = 0.0;
15824     int fail = 0;
15825     fail += checkit(d, "0.0");
15826
15827     /* The compiler shouldn't be assuming that bletched is 0  */
15828     d = bletched;
15829
15830     fail += checkit(d, "bleched");
15831
15832 #ifdef SIGFPE
15833     signal(SIGFPE, blech);
15834 #endif
15835
15836     /* Paranoia - the compiler should have no way of knowing that ANSI says
15837        that argv[argc] will always be NULL.  Actually, if it did assume this it
15838        would be buggy, as this is C and main() can be called from elsewhere in
15839        the program.  */
15840     d = argv[argc] ? 1 : 0;
15841
15842     if (d) {
15843         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15844     }
15845
15846     fail += checkit(d, "ternary");
15847
15848     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15849
15850     if (d != 0.0) {
15851         printf("No - memset doesn't give 0.0\n");
15852         /* This might just blow up:  */
15853         printf("(gives %g)\n", d);
15854         return 1;
15855     }
15856
15857 #ifdef SIGFPE
15858     if (bletched) {
15859         printf("No - something bleched\n");
15860         return 1;
15861     }
15862 #endif
15863     if (fail) {
15864       printf("No - %d fail(s)\n", fail);
15865       return 1;
15866     }
15867     printf("Yes\n");
15868     return 0;
15869 }
15870 EOP
15871 set try
15872
15873 d_nv_zero_is_allbits_zero="$undef"
15874 if eval $compile; then
15875     xxx="`$run ./try`"
15876     case "$?" in
15877         0)
15878             case "$xxx" in
15879                 Yes)  cat >&4 <<EOM
15880 0.0 is represented as all bits zero in memory
15881 EOM
15882                     d_nv_zero_is_allbits_zero="$define"
15883                     ;;
15884                 *)  cat >&4 <<EOM
15885 0.0 is not represented as all bits zero in memory
15886 EOM
15887                     d_nv_zero_is_allbits_zero="$undef"
15888                     ;;
15889             esac
15890             ;;
15891         *)  cat >&4 <<EOM
15892 0.0 is not represented as all bits zero in memory
15893 EOM
15894             d_nv_zero_is_allbits_zero="$undef"
15895             ;;
15896     esac
15897 fi
15898 $rm_try
15899
15900 : check for off64_t
15901 echo " "
15902 echo "Checking to see if you have off64_t..." >&4
15903 $cat >try.c <<EOCP
15904 #include <sys/types.h>
15905 #include <unistd.h>
15906 int main() { off64_t x = 7; }
15907 EOCP
15908 set try
15909 if eval $compile; then
15910         val="$define"
15911         echo "You have off64_t."
15912 else
15913         val="$undef"
15914         echo "You do not have off64_t."
15915         case "$lseeksize" in
15916         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15917         esac
15918 fi
15919 $rm_try
15920 set d_off64_t
15921 eval $setvar
15922
15923 : how to create joinable pthreads
15924 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15925         echo " "
15926         echo "Checking what constant to use for creating joinable pthreads..." >&4
15927         $cat >try.c <<'EOCP'
15928 #include <pthread.h>
15929 int main() {
15930     int detachstate = JOINABLE;
15931 }
15932 EOCP
15933         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15934         if eval $compile; then
15935                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15936                 val="$undef" # Yes, undef.
15937                 set d_old_pthread_create_joinable
15938                 eval $setvar
15939                 val=""
15940                 set old_pthread_create_joinable
15941                 eval $setvar
15942         else
15943                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15944                 if eval $compile; then
15945                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15946                         val="$define"
15947                         set d_old_pthread_create_joinable
15948                         eval $setvar
15949                         val=PTHREAD_CREATE_UNDETACHED
15950                         set old_pthread_create_joinable
15951                         eval $setvar
15952                 else
15953                         set try -DJOINABLE=__UNDETACHED
15954                         if eval $compile; then
15955                                 echo "You seem to use __UNDETACHED." >&4
15956                                 val="$define"
15957                                 set d_old_pthread_create_joinable
15958                                 eval $setvar
15959                                 val=__UNDETACHED
15960                                 set old_pthread_create_joinable
15961                                 eval $setvar
15962                         else
15963                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15964                                 val="$define"
15965                                 set d_old_pthread_create_joinable
15966                                 eval $setvar
15967                                 val=0
15968                                 set old_pthread_create_joinable
15969                                 eval $setvar
15970                         fi
15971                 fi
15972         fi
15973         $rm_try
15974 else
15975     d_old_pthread_create_joinable="$undef"
15976     old_pthread_create_joinable=""
15977 fi
15978
15979 : see if pause exists
15980 set pause d_pause
15981 eval $inlibc
15982
15983 : see if poll exists
15984 set poll d_poll
15985 eval $inlibc
15986
15987 : see if readlink exists
15988 set readlink d_readlink
15989 eval $inlibc
15990
15991 : Check if exe is symlink to abs path of executing program
15992 echo " "
15993 procselfexe=''
15994 val="$undef"
15995 case "$d_readlink" in
15996 "$define")
15997         if $issymlink /proc/self/exe ; then
15998                 $ls -l /proc/self/exe > reflect
15999                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16000                         echo "You have Linux-like /proc/self/exe."
16001                         procselfexe='"/proc/self/exe"'
16002                         val="$define"
16003                 fi
16004         fi
16005         if $issymlink /proc/curproc/file ; then
16006                 $ls -l /proc/curproc/file > reflect
16007                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16008                         echo "You have BSD-like /proc/curproc/file."
16009                         procselfexe='"/proc/curproc/file"'
16010                         val="$define"
16011                 fi
16012         fi
16013         ;;
16014 esac
16015 $rm -f reflect
16016 set d_procselfexe
16017 eval $setvar
16018
16019 : backward compatibility for d_hvfork
16020 if test X$d_hvfork != X; then
16021         d_vfork="$d_hvfork"
16022         d_hvfork=''
16023 fi
16024 : see if there is a vfork
16025 val=''
16026 set vfork val
16027 eval $inlibc
16028
16029 d_pseudofork=$undef
16030
16031 : Ok, but do we want to use it. vfork is reportedly unreliable in
16032 : perl on Solaris 2.x, and probably elsewhere.
16033 case "$val" in
16034 $define)
16035         echo " "
16036         case "$usevfork" in
16037         false) dflt='n';;
16038         *) dflt='y';;
16039         esac
16040         cat <<'EOM'
16041
16042 Perl can only use a vfork() that doesn't suffer from strict
16043 restrictions on calling functions or modifying global data in
16044 the child.  For example, glibc-2.1 contains such a vfork()
16045 that is unsuitable.  If your system provides a proper fork()
16046 call, chances are that you do NOT want perl to use vfork().
16047
16048 EOM
16049         rp="Do you still want to use vfork()?"
16050         . ./myread
16051         case "$ans" in
16052         y|Y) ;;
16053         *)
16054                 echo "Ok, we won't use vfork()."
16055                 val="$undef"
16056                 ;;
16057         esac
16058         ;;
16059 esac
16060 set d_vfork
16061 eval $setvar
16062 case "$d_vfork" in
16063 $define) usevfork='true';;
16064 *) usevfork='false';;
16065 esac
16066
16067 : see whether the pthread_atfork exists
16068 $cat >try.c <<EOP
16069 #include <pthread.h>
16070 #include <stdio.h>
16071 int main() {
16072 #ifdef  PTHREAD_ATFORK
16073         pthread_atfork(NULL,NULL,NULL);
16074 #endif
16075 }
16076 EOP
16077
16078 : see if pthread_atfork exists
16079 set try -DPTHREAD_ATFORK
16080 if eval $compile; then
16081     val="$define"
16082 else
16083     val="$undef"
16084 fi
16085 case "$usethreads" in
16086 $define)
16087         case "$val" in
16088         $define) echo 'pthread_atfork found.' >&4        ;;
16089         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16090         esac
16091 esac
16092 set d_pthread_atfork
16093 eval $setvar
16094
16095 : see if pthread_attr_setscope exists
16096 set pthread_attr_setscope d_pthread_attr_setscope
16097 eval $inlibc
16098
16099 : see whether the various POSIXish _yields exist
16100 $cat >try.c <<EOP
16101 #include <pthread.h>
16102 #include <stdio.h>
16103 int main() {
16104 #ifdef SCHED_YIELD
16105         sched_yield();
16106 #else
16107 #ifdef PTHREAD_YIELD
16108         pthread_yield();
16109 #else
16110 #ifdef PTHREAD_YIELD_NULL
16111         pthread_yield(NULL);
16112 #endif
16113 #endif
16114 #endif
16115 }
16116 EOP
16117 : see if sched_yield exists
16118 set try -DSCHED_YIELD
16119 if eval $compile; then
16120     val="$define"
16121     sched_yield='sched_yield()'
16122 else
16123     val="$undef"
16124 fi
16125 case "$usethreads" in
16126 $define)
16127         case "$val" in
16128         $define) echo 'sched_yield() found.' >&4        ;;
16129         *)       echo 'sched_yield() NOT found.' >&4    ;;
16130         esac
16131 esac
16132 set d_sched_yield
16133 eval $setvar
16134
16135 : see if pthread_yield exists
16136 set try -DPTHREAD_YIELD
16137 if eval $compile; then
16138     val="$define"
16139     case "$sched_yield" in
16140     '') sched_yield='pthread_yield()' ;;
16141     esac
16142 else
16143     set try -DPTHREAD_YIELD_NULL
16144     if eval $compile; then
16145         val="$define"
16146         case "$sched_yield" in
16147         '') sched_yield='pthread_yield(NULL)' ;;
16148         esac
16149     else
16150         val="$undef"
16151     fi
16152 fi
16153 case "$usethreads" in
16154 $define)
16155         case "$val" in
16156         $define) echo 'pthread_yield() found.' >&4      ;;
16157         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16158         esac
16159         ;;
16160 esac
16161 set d_pthread_yield
16162 eval $setvar
16163 case "$sched_yield" in
16164 '') sched_yield=undef ;;
16165 esac
16166 $rm_try
16167
16168 : see if random_r exists
16169 set random_r d_random_r
16170 eval $inlibc
16171 case "$d_random_r" in
16172 "$define")
16173         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16174         case "$d_random_r_proto:$usethreads" in
16175         ":define")      d_random_r_proto=define
16176                 set d_random_r_proto random_r $hdrs
16177                 eval $hasproto ;;
16178         *)      ;;
16179         esac
16180         case "$d_random_r_proto" in
16181         define)
16182         case "$random_r_proto" in
16183         ''|0) try='int random_r(int*, struct random_data*);'
16184         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16185         esac
16186         case "$random_r_proto" in
16187         ''|0) try='int random_r(long*, struct random_data*);'
16188         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16189         esac
16190         case "$random_r_proto" in
16191         ''|0) try='int random_r(struct random_data*, int32_t*);'
16192         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16193         esac
16194         case "$random_r_proto" in
16195         ''|0)   d_random_r=undef
16196                 random_r_proto=0
16197                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16198         * )     case "$random_r_proto" in
16199                 REENTRANT_PROTO*) ;;
16200                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16201                 esac
16202                 echo "Prototype: $try" ;;
16203         esac
16204         ;;
16205         *)      case "$usethreads" in
16206                 define) echo "random_r has no prototype, not using it." >&4 ;;
16207                 esac
16208                 d_random_r=undef
16209                 random_r_proto=0
16210                 ;;
16211         esac
16212         ;;
16213 *)      random_r_proto=0
16214         ;;
16215 esac
16216
16217 : see if readdir and friends exist
16218 set readdir d_readdir
16219 eval $inlibc
16220 set seekdir d_seekdir
16221 eval $inlibc
16222 set telldir d_telldir
16223 eval $inlibc
16224 set rewinddir d_rewinddir
16225 eval $inlibc
16226
16227 : see if readdir64_r exists
16228 set readdir64_r d_readdir64_r
16229 eval $inlibc
16230 case "$d_readdir64_r" in
16231 "$define")
16232         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16233         case "$d_readdir64_r_proto:$usethreads" in
16234         ":define")      d_readdir64_r_proto=define
16235                 set d_readdir64_r_proto readdir64_r $hdrs
16236                 eval $hasproto ;;
16237         *)      ;;
16238         esac
16239         case "$d_readdir64_r_proto" in
16240         define)
16241         case "$readdir64_r_proto" in
16242         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16243         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16244         esac
16245         case "$readdir64_r_proto" in
16246         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16247         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16248         esac
16249         case "$readdir64_r_proto" in
16250         ''|0)   d_readdir64_r=undef
16251                 readdir64_r_proto=0
16252                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16253         * )     case "$readdir64_r_proto" in
16254                 REENTRANT_PROTO*) ;;
16255                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16256                 esac
16257                 echo "Prototype: $try" ;;
16258         esac
16259         ;;
16260         *)      case "$usethreads" in
16261                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16262                 esac
16263                 d_readdir64_r=undef
16264                 readdir64_r_proto=0
16265                 ;;
16266         esac
16267         ;;
16268 *)      readdir64_r_proto=0
16269         ;;
16270 esac
16271
16272 : see if readdir_r exists
16273 set readdir_r d_readdir_r
16274 eval $inlibc
16275 case "$d_readdir_r" in
16276 "$define")
16277         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16278         case "$d_readdir_r_proto:$usethreads" in
16279         ":define")      d_readdir_r_proto=define
16280                 set d_readdir_r_proto readdir_r $hdrs
16281                 eval $hasproto ;;
16282         *)      ;;
16283         esac
16284         case "$d_readdir_r_proto" in
16285         define)
16286         case "$readdir_r_proto" in
16287         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16288         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16289         esac
16290         case "$readdir_r_proto" in
16291         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16292         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16293         esac
16294         case "$readdir_r_proto" in
16295         ''|0)   d_readdir_r=undef
16296                 readdir_r_proto=0
16297                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16298         * )     case "$readdir_r_proto" in
16299                 REENTRANT_PROTO*) ;;
16300                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16301                 esac
16302                 echo "Prototype: $try" ;;
16303         esac
16304         ;;
16305         *)      case "$usethreads" in
16306                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16307                 esac
16308                 d_readdir_r=undef
16309                 readdir_r_proto=0
16310                 ;;
16311         esac
16312         ;;
16313 *)      readdir_r_proto=0
16314         ;;
16315 esac
16316
16317 : see if readv exists
16318 set readv d_readv
16319 eval $inlibc
16320
16321 : see if recvmsg exists
16322 set recvmsg d_recvmsg
16323 eval $inlibc
16324
16325 : see if rename exists
16326 set rename d_rename
16327 eval $inlibc
16328
16329 : see if rmdir exists
16330 set rmdir d_rmdir
16331 eval $inlibc
16332
16333 : see if memory.h is available.
16334 val=''
16335 set memory.h val
16336 eval $inhdr
16337
16338 : See if it conflicts with string.h
16339 case "$val" in
16340 $define)
16341         case "$strings" in
16342         '') ;;
16343         *)
16344                 $cppstdin $cppflags $cppminus < $strings > mem.h
16345                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16346                         echo " "
16347                         echo "We won't be including <memory.h>."
16348                         val="$undef"
16349                 fi
16350                 $rm -f mem.h
16351                 ;;
16352         esac
16353 esac
16354 set i_memory
16355 eval $setvar
16356
16357 : can bcopy handle overlapping blocks?
16358 echo " "
16359 val="$undef"
16360 case "$d_memmove" in
16361 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16362 *)      case "$d_bcopy" in
16363         "$define")
16364                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16365                 $cat >try.c <<EOCP
16366 #$i_memory I_MEMORY
16367 #$i_stdlib I_STDLIB
16368 #$i_string I_STRING
16369 #$i_unistd I_UNISTD
16370 EOCP
16371         $cat >>try.c <<'EOCP'
16372 #include <stdio.h>
16373 #ifdef I_MEMORY
16374 #  include <memory.h>
16375 #endif
16376 #ifdef I_STDLIB
16377 #  include <stdlib.h>
16378 #endif
16379 #ifdef I_STRING
16380 #  include <string.h>
16381 #else
16382 #  include <strings.h>
16383 #endif
16384 #ifdef I_UNISTD
16385 #  include <unistd.h>  /* Needed for NetBSD */
16386 #endif
16387 int main()
16388 {
16389 char buf[128], abc[128];
16390 char *b;
16391 int len;
16392 int off;
16393 int align;
16394
16395 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16396    try to store the string in read-only memory. */
16397 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16398
16399 for (align = 7; align >= 0; align--) {
16400         for (len = 36; len; len--) {
16401                 b = buf+align;
16402                 bcopy(abc, b, len);
16403                 for (off = 1; off <= len; off++) {
16404                         bcopy(b, b+off, len);
16405                         bcopy(b+off, b, len);
16406                         if (bcmp(b, abc, len))
16407                                 exit(1);
16408                 }
16409         }
16410 }
16411 exit(0);
16412 }
16413 EOCP
16414                 set try
16415                 if eval $compile_ok; then
16416                         if $run ./try 2>/dev/null; then
16417                                 echo "Yes, it can."
16418                                 val="$define"
16419                         else
16420                                 echo "It can't, sorry."
16421                         fi
16422                 else
16423                         echo "(I can't compile the test program, so we'll assume not...)"
16424                 fi
16425                 ;;
16426         esac
16427         $rm_try
16428         ;;
16429 esac
16430 set d_safebcpy
16431 eval $setvar
16432
16433 : can memcpy handle overlapping blocks?
16434 echo " "
16435 val="$undef"
16436 case "$d_memmove" in
16437 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16438 *)      case "$d_memcpy" in
16439         "$define")
16440                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16441                 $cat >try.c <<EOCP
16442 #$i_memory I_MEMORY
16443 #$i_stdlib I_STDLIB
16444 #$i_string I_STRING
16445 #$i_unistd I_UNISTD
16446 EOCP
16447         $cat >>try.c <<'EOCP'
16448 #include <stdio.h>
16449 #ifdef I_MEMORY
16450 #  include <memory.h>
16451 #endif
16452 #ifdef I_STDLIB
16453 #  include <stdlib.h>
16454 #endif
16455 #ifdef I_STRING
16456 #  include <string.h>
16457 #else
16458 #  include <strings.h>
16459 #endif
16460 #ifdef I_UNISTD
16461 #  include <unistd.h>  /* Needed for NetBSD */
16462 #endif
16463 int main()
16464 {
16465 char buf[128], abc[128];
16466 char *b;
16467 int len;
16468 int off;
16469 int align;
16470
16471 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16472    try to store the string in read-only memory. */
16473 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16474
16475 for (align = 7; align >= 0; align--) {
16476         for (len = 36; len; len--) {
16477                 b = buf+align;
16478                 memcpy(b, abc, len);
16479                 for (off = 1; off <= len; off++) {
16480                         memcpy(b+off, b, len);
16481                         memcpy(b, b+off, len);
16482                         if (memcmp(b, abc, len))
16483                                 exit(1);
16484                 }
16485         }
16486 }
16487 exit(0);
16488 }
16489 EOCP
16490                 set try
16491                 if eval $compile_ok; then
16492                         if $run ./try 2>/dev/null; then
16493                                 echo "Yes, it can."
16494                                 val="$define"
16495                         else
16496                                 echo "It can't, sorry."
16497                         fi
16498                 else
16499                         echo "(I can't compile the test program, so we'll assume not...)"
16500                 fi
16501                 ;;
16502         esac
16503         $rm_try
16504         ;;
16505 esac
16506 set d_safemcpy
16507 eval $setvar
16508
16509 : can memcmp be trusted to compare relative magnitude?
16510 val="$undef"
16511 case "$d_memcmp" in
16512 "$define")
16513         echo " "
16514         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16515         $cat >try.c <<EOCP
16516 #$i_memory I_MEMORY
16517 #$i_stdlib I_STDLIB
16518 #$i_string I_STRING
16519 #$i_unistd I_UNISTD
16520 EOCP
16521         $cat >>try.c <<'EOCP'
16522 #include <stdio.h>
16523 #ifdef I_MEMORY
16524 #  include <memory.h>
16525 #endif
16526 #ifdef I_STDLIB
16527 #  include <stdlib.h>
16528 #endif
16529 #ifdef I_STRING
16530 #  include <string.h>
16531 #else
16532 #  include <strings.h>
16533 #endif
16534 #ifdef I_UNISTD
16535 #  include <unistd.h>  /* Needed for NetBSD */
16536 #endif
16537 int main()
16538 {
16539 char a = -1;
16540 char b = 0;
16541 if ((a < b) && memcmp(&a, &b, 1) < 0)
16542         exit(1);
16543 exit(0);
16544 }
16545 EOCP
16546         set try
16547         if eval $compile_ok; then
16548                 if $run ./try 2>/dev/null; then
16549                         echo "Yes, it can."
16550                         val="$define"
16551                 else
16552                         echo "No, it can't (it uses signed chars)."
16553                 fi
16554         else
16555                 echo "(I can't compile the test program, so we'll assume not...)"
16556         fi
16557         ;;
16558 esac
16559 $rm_try
16560 set d_sanemcmp
16561 eval $setvar
16562
16563 : see if prototype for sbrk is available
16564 echo " "
16565 set d_sbrkproto sbrk $i_unistd unistd.h
16566 eval $hasproto
16567
16568 : see if select exists
16569 set select d_select
16570 eval $inlibc
16571
16572 : see if semctl exists
16573 set semctl d_semctl
16574 eval $inlibc
16575
16576 : see if semget exists
16577 set semget d_semget
16578 eval $inlibc
16579
16580 : see if semop exists
16581 set semop d_semop
16582 eval $inlibc
16583
16584 : see how much of the 'sem*(2)' library is present.
16585 h_sem=true
16586 echo " "
16587 case "$d_semctl$d_semget$d_semop" in
16588 *"$undef"*) h_sem=false;;
16589 esac
16590 case "$osname" in
16591 freebsd)
16592     case "`ipcs 2>&1`" in
16593     "SVID messages"*"not configured"*)
16594         echo "Your $osname does not have the sem*(2) configured." >&4
16595         h_sem=false
16596         val="$undef"
16597         set semctl d_semctl
16598         eval $setvar
16599         set semget d_semget
16600         eval $setvar
16601         set semop d_semop
16602         eval $setvar
16603         ;;
16604     esac
16605     ;;
16606 esac
16607 : we could also check for sys/ipc.h ...
16608 if $h_sem && $test `./findhdr sys/sem.h`; then
16609         echo "You have the full sem*(2) library." >&4
16610         val="$define"
16611 else
16612         echo "You don't have the full sem*(2) library." >&4
16613         val="$undef"
16614 fi
16615 set d_sem
16616 eval $setvar
16617
16618 : see whether sys/sem.h defines union semun
16619 echo " "
16620 $cat > try.c <<'END'
16621 #include <sys/types.h>
16622 #include <sys/ipc.h>
16623 #include <sys/sem.h>
16624 int main () { union semun semun; semun.buf = 0; }
16625 END
16626 set try
16627 if eval $compile; then
16628     echo "You have union semun in <sys/sem.h>." >&4
16629     val="$define"
16630 else
16631     echo "You do not have union semun in <sys/sem.h>." >&4
16632     val="$undef"
16633 fi
16634 $rm_try
16635 set d_union_semun
16636 eval $setvar
16637
16638 : see how to do semctl IPC_STAT
16639 case "$d_sem" in
16640 $define)
16641     echo " "
16642     $cat > tryh.h <<END
16643 #ifndef S_IRUSR
16644 #   ifdef S_IREAD
16645 #       define S_IRUSR S_IREAD
16646 #       define S_IWUSR S_IWRITE
16647 #       define S_IXUSR S_IEXEC
16648 #   else
16649 #       define S_IRUSR 0400
16650 #       define S_IWUSR 0200
16651 #       define S_IXUSR 0100
16652 #   endif
16653 #   define S_IRGRP (S_IRUSR>>3)
16654 #   define S_IWGRP (S_IWUSR>>3)
16655 #   define S_IXGRP (S_IXUSR>>3)
16656 #   define S_IROTH (S_IRUSR>>6)
16657 #   define S_IWOTH (S_IWUSR>>6)
16658 #   define S_IXOTH (S_IXUSR>>6)
16659 #endif
16660 #ifndef S_IRWXU
16661 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16662 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16663 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16664 #endif
16665 END
16666     : see whether semctl IPC_STAT can use union semun
16667     case "$d_semctl_semun" in
16668     '')
16669       val="$undef"
16670       $cat > try.c <<END
16671 #include <sys/types.h>
16672 #include <sys/ipc.h>
16673 #include <sys/sem.h>
16674 #include <sys/stat.h>
16675 #include <stdio.h>
16676 #include <errno.h>
16677 #include "tryh.h"
16678 #ifndef errno
16679 extern int errno;
16680 #endif
16681 #$d_union_semun HAS_UNION_SEMUN
16682 int main() {
16683     union semun
16684 #ifndef HAS_UNION_SEMUN
16685     {
16686         int val;
16687         struct semid_ds *buf;
16688         unsigned short *array;
16689     }
16690 #endif
16691     arg;
16692     int sem, st;
16693
16694 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16695     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16696     if (sem > -1) {
16697         struct semid_ds argbuf;
16698         arg.buf = &argbuf;
16699 #       ifdef IPC_STAT
16700         st = semctl(sem, 0, IPC_STAT, arg);
16701         if (st == 0)
16702             printf("semun\n");
16703         else
16704 #       endif /* IPC_STAT */
16705             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16706 #       ifdef IPC_RMID
16707         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16708 #       endif /* IPC_RMID */
16709             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16710     } else
16711 #endif /* IPC_PRIVATE && ... */
16712         printf("semget failed: errno = %d\n", errno);
16713   return 0;
16714 }
16715 END
16716       set try
16717       if eval $compile; then
16718           xxx=`$run ./try`
16719           case "$xxx" in
16720           semun) val="$define" ;;
16721           esac
16722       fi
16723       $rm_try
16724       set d_semctl_semun
16725       eval $setvar
16726       ;;
16727     esac
16728     case "$d_semctl_semun" in
16729     $define)
16730         echo "You can use union semun for semctl IPC_STAT." >&4
16731         also='also'
16732         ;;
16733     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16734         also=''
16735         ;;
16736     esac
16737
16738     : see whether semctl IPC_STAT can use struct semid_ds pointer
16739     case "$d_semctl_semid_ds" in
16740     '')
16741       val="$undef"
16742       $cat > try.c <<'END'
16743 #include <sys/types.h>
16744 #include <sys/ipc.h>
16745 #include <sys/sem.h>
16746 #include <sys/stat.h>
16747 #include "tryh.h"
16748 #include <stdio.h>
16749 #include <errno.h>
16750 #ifndef errno
16751 extern int errno;
16752 #endif
16753 int main() {
16754     struct semid_ds arg;
16755     int sem, st;
16756
16757 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16758     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16759     if (sem > -1) {
16760 #       ifdef IPC_STAT
16761         st = semctl(sem, 0, IPC_STAT, &arg);
16762         if (st == 0)
16763             printf("semid_ds\n");
16764         else
16765 #       endif /* IPC_STAT */
16766             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16767 #       ifdef IPC_RMID
16768         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16769 #       endif /* IPC_RMID */
16770             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16771     } else
16772 #endif /* IPC_PRIVATE && ... */
16773         printf("semget failed: errno = %d\n", errno);
16774
16775     return 0;
16776 }
16777 END
16778       set try
16779       if eval $compile; then
16780           xxx=`$run ./try`
16781           case "$xxx" in
16782           semid_ds) val="$define" ;;
16783           esac
16784       fi
16785       $rm_try
16786       set d_semctl_semid_ds
16787       eval $setvar
16788       ;;
16789     esac
16790     case "$d_semctl_semid_ds" in
16791     $define)
16792         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16793         ;;
16794     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16795         ;;
16796     esac
16797     ;;
16798 *)  val="$undef"
16799
16800     # We do not have the full sem*(2) library, so assume we can not
16801     # use either.
16802
16803     set d_semctl_semun
16804     eval $setvar
16805
16806     set d_semctl_semid_ds
16807     eval $setvar
16808     ;;
16809 esac
16810 $rm_try tryh.h
16811
16812 : see if sendmsg exists
16813 set sendmsg d_sendmsg
16814 eval $inlibc
16815
16816 : see if setegid exists
16817 set setegid d_setegid
16818 eval $inlibc
16819
16820 : see if seteuid exists
16821 set seteuid d_seteuid
16822 eval $inlibc
16823
16824 : see if setgrent exists
16825 set setgrent d_setgrent
16826 eval $inlibc
16827
16828 : see if setgrent_r exists
16829 set setgrent_r d_setgrent_r
16830 eval $inlibc
16831 case "$d_setgrent_r" in
16832 "$define")
16833         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16834         case "$d_setgrent_r_proto:$usethreads" in
16835         ":define")      d_setgrent_r_proto=define
16836                 set d_setgrent_r_proto setgrent_r $hdrs
16837                 eval $hasproto ;;
16838         *)      ;;
16839         esac
16840         case "$d_setgrent_r_proto" in
16841         define)
16842         case "$setgrent_r_proto" in
16843         ''|0) try='int setgrent_r(FILE**);'
16844         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
16845         esac
16846         case "$setgrent_r_proto" in
16847         ''|0) try='void setgrent_r(FILE**);'
16848         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
16849         esac
16850         case "$setgrent_r_proto" in
16851         ''|0)   d_setgrent_r=undef
16852                 setgrent_r_proto=0
16853                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16854         * )     case "$setgrent_r_proto" in
16855                 REENTRANT_PROTO*) ;;
16856                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16857                 esac
16858                 echo "Prototype: $try" ;;
16859         esac
16860         ;;
16861         *)      case "$usethreads" in
16862                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16863                 esac
16864                 d_setgrent_r=undef
16865                 setgrent_r_proto=0
16866                 ;;
16867         esac
16868         ;;
16869 *)      setgrent_r_proto=0
16870         ;;
16871 esac
16872
16873 : see if sethostent exists
16874 set sethostent d_sethent
16875 eval $inlibc
16876
16877 : see if sethostent_r exists
16878 set sethostent_r d_sethostent_r
16879 eval $inlibc
16880 case "$d_sethostent_r" in
16881 "$define")
16882         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16883         case "$d_sethostent_r_proto:$usethreads" in
16884         ":define")      d_sethostent_r_proto=define
16885                 set d_sethostent_r_proto sethostent_r $hdrs
16886                 eval $hasproto ;;
16887         *)      ;;
16888         esac
16889         case "$d_sethostent_r_proto" in
16890         define)
16891         case "$sethostent_r_proto" in
16892         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16893         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
16894         esac
16895         case "$sethostent_r_proto" in
16896         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16897         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
16898         esac
16899         case "$sethostent_r_proto" in
16900         ''|0)   d_sethostent_r=undef
16901                 sethostent_r_proto=0
16902                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16903         * )     case "$sethostent_r_proto" in
16904                 REENTRANT_PROTO*) ;;
16905                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16906                 esac
16907                 echo "Prototype: $try" ;;
16908         esac
16909         ;;
16910         *)      case "$usethreads" in
16911                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16912                 esac
16913                 d_sethostent_r=undef
16914                 sethostent_r_proto=0
16915                 ;;
16916         esac
16917         ;;
16918 *)      sethostent_r_proto=0
16919         ;;
16920 esac
16921
16922 : see if setitimer exists
16923 set setitimer d_setitimer
16924 eval $inlibc
16925
16926 : see if setlinebuf exists
16927 set setlinebuf d_setlinebuf
16928 eval $inlibc
16929
16930 : see if setlocale exists
16931 set setlocale d_setlocale
16932 eval $inlibc
16933
16934 : see if locale.h is available
16935 set locale.h i_locale
16936 eval $inhdr
16937
16938 : see if setlocale_r exists
16939 set setlocale_r d_setlocale_r
16940 eval $inlibc
16941 case "$d_setlocale_r" in
16942 "$define")
16943         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16944         case "$d_setlocale_r_proto:$usethreads" in
16945         ":define")      d_setlocale_r_proto=define
16946                 set d_setlocale_r_proto setlocale_r $hdrs
16947                 eval $hasproto ;;
16948         *)      ;;
16949         esac
16950         case "$d_setlocale_r_proto" in
16951         define)
16952         case "$setlocale_r_proto" in
16953         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16954         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16955         esac
16956         case "$setlocale_r_proto" in
16957         ''|0)   d_setlocale_r=undef
16958                 setlocale_r_proto=0
16959                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16960         * )     case "$setlocale_r_proto" in
16961                 REENTRANT_PROTO*) ;;
16962                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16963                 esac
16964                 echo "Prototype: $try" ;;
16965         esac
16966         ;;
16967         *)      case "$usethreads" in
16968                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16969                 esac
16970                 d_setlocale_r=undef
16971                 setlocale_r_proto=0
16972                 ;;
16973         esac
16974         ;;
16975 *)      setlocale_r_proto=0
16976         ;;
16977 esac
16978
16979 : see if setnetent exists
16980 set setnetent d_setnent
16981 eval $inlibc
16982
16983 : see if setnetent_r exists
16984 set setnetent_r d_setnetent_r
16985 eval $inlibc
16986 case "$d_setnetent_r" in
16987 "$define")
16988         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16989         case "$d_setnetent_r_proto:$usethreads" in
16990         ":define")      d_setnetent_r_proto=define
16991                 set d_setnetent_r_proto setnetent_r $hdrs
16992                 eval $hasproto ;;
16993         *)      ;;
16994         esac
16995         case "$d_setnetent_r_proto" in
16996         define)
16997         case "$setnetent_r_proto" in
16998         ''|0) try='int setnetent_r(int, struct netent_data*);'
16999         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17000         esac
17001         case "$setnetent_r_proto" in
17002         ''|0) try='void setnetent_r(int, struct netent_data*);'
17003         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17004         esac
17005         case "$setnetent_r_proto" in
17006         ''|0)   d_setnetent_r=undef
17007                 setnetent_r_proto=0
17008                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17009         * )     case "$setnetent_r_proto" in
17010                 REENTRANT_PROTO*) ;;
17011                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17012                 esac
17013                 echo "Prototype: $try" ;;
17014         esac
17015         ;;
17016         *)      case "$usethreads" in
17017                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17018                 esac
17019                 d_setnetent_r=undef
17020                 setnetent_r_proto=0
17021                 ;;
17022         esac
17023         ;;
17024 *)      setnetent_r_proto=0
17025         ;;
17026 esac
17027
17028 : see if setprotoent exists
17029 set setprotoent d_setpent
17030 eval $inlibc
17031
17032 : see if setpgid exists
17033 set setpgid d_setpgid
17034 eval $inlibc
17035
17036 : see if setpgrp2 exists
17037 set setpgrp2 d_setpgrp2
17038 eval $inlibc
17039
17040 : see if setpriority exists
17041 set setpriority d_setprior
17042 eval $inlibc
17043
17044 : see if setproctitle exists
17045 set setproctitle d_setproctitle
17046 eval $inlibc
17047
17048 : see if setprotoent_r exists
17049 set setprotoent_r d_setprotoent_r
17050 eval $inlibc
17051 case "$d_setprotoent_r" in
17052 "$define")
17053         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17054         case "$d_setprotoent_r_proto:$usethreads" in
17055         ":define")      d_setprotoent_r_proto=define
17056                 set d_setprotoent_r_proto setprotoent_r $hdrs
17057                 eval $hasproto ;;
17058         *)      ;;
17059         esac
17060         case "$d_setprotoent_r_proto" in
17061         define)
17062         case "$setprotoent_r_proto" in
17063         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17064         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17065         esac
17066         case "$setprotoent_r_proto" in
17067         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17068         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17069         esac
17070         case "$setprotoent_r_proto" in
17071         ''|0)   d_setprotoent_r=undef
17072                 setprotoent_r_proto=0
17073                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17074         * )     case "$setprotoent_r_proto" in
17075                 REENTRANT_PROTO*) ;;
17076                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17077                 esac
17078                 echo "Prototype: $try" ;;
17079         esac
17080         ;;
17081         *)      case "$usethreads" in
17082                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17083                 esac
17084                 d_setprotoent_r=undef
17085                 setprotoent_r_proto=0
17086                 ;;
17087         esac
17088         ;;
17089 *)      setprotoent_r_proto=0
17090         ;;
17091 esac
17092
17093 : see if setpwent exists
17094 set setpwent d_setpwent
17095 eval $inlibc
17096
17097 : see if setpwent_r exists
17098 set setpwent_r d_setpwent_r
17099 eval $inlibc
17100 case "$d_setpwent_r" in
17101 "$define")
17102         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17103         case "$d_setpwent_r_proto:$usethreads" in
17104         ":define")      d_setpwent_r_proto=define
17105                 set d_setpwent_r_proto setpwent_r $hdrs
17106                 eval $hasproto ;;
17107         *)      ;;
17108         esac
17109         case "$d_setpwent_r_proto" in
17110         define)
17111         case "$setpwent_r_proto" in
17112         ''|0) try='int setpwent_r(FILE**);'
17113         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17114         esac
17115         case "$setpwent_r_proto" in
17116         ''|0) try='void setpwent_r(FILE**);'
17117         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17118         esac
17119         case "$setpwent_r_proto" in
17120         ''|0)   d_setpwent_r=undef
17121                 setpwent_r_proto=0
17122                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17123         * )     case "$setpwent_r_proto" in
17124                 REENTRANT_PROTO*) ;;
17125                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17126                 esac
17127                 echo "Prototype: $try" ;;
17128         esac
17129         ;;
17130         *)      case "$usethreads" in
17131                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17132                 esac
17133                 d_setpwent_r=undef
17134                 setpwent_r_proto=0
17135                 ;;
17136         esac
17137         ;;
17138 *)      setpwent_r_proto=0
17139         ;;
17140 esac
17141
17142 : see if setregid exists
17143 set setregid d_setregid
17144 eval $inlibc
17145 set setresgid d_setresgid
17146 eval $inlibc
17147
17148 : see if setreuid exists
17149 set setreuid d_setreuid
17150 eval $inlibc
17151 set setresuid d_setresuid
17152 eval $inlibc
17153
17154 : see if setrgid exists
17155 set setrgid d_setrgid
17156 eval $inlibc
17157
17158 : see if setruid exists
17159 set setruid d_setruid
17160 eval $inlibc
17161
17162 : see if setservent exists
17163 set setservent d_setsent
17164 eval $inlibc
17165
17166 : see if setservent_r exists
17167 set setservent_r d_setservent_r
17168 eval $inlibc
17169 case "$d_setservent_r" in
17170 "$define")
17171         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17172         case "$d_setservent_r_proto:$usethreads" in
17173         ":define")      d_setservent_r_proto=define
17174                 set d_setservent_r_proto setservent_r $hdrs
17175                 eval $hasproto ;;
17176         *)      ;;
17177         esac
17178         case "$d_setservent_r_proto" in
17179         define)
17180         case "$setservent_r_proto" in
17181         ''|0) try='int setservent_r(int, struct servent_data*);'
17182         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17183         esac
17184         case "$setservent_r_proto" in
17185         ''|0) try='void setservent_r(int, struct servent_data*);'
17186         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17187         esac
17188         case "$setservent_r_proto" in
17189         ''|0)   d_setservent_r=undef
17190                 setservent_r_proto=0
17191                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17192         * )     case "$setservent_r_proto" in
17193                 REENTRANT_PROTO*) ;;
17194                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17195                 esac
17196                 echo "Prototype: $try" ;;
17197         esac
17198         ;;
17199         *)      case "$usethreads" in
17200                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17201                 esac
17202                 d_setservent_r=undef
17203                 setservent_r_proto=0
17204                 ;;
17205         esac
17206         ;;
17207 *)      setservent_r_proto=0
17208         ;;
17209 esac
17210
17211 : see if setsid exists
17212 set setsid d_setsid
17213 eval $inlibc
17214
17215 : see if setvbuf exists
17216 set setvbuf d_setvbuf
17217 eval $inlibc
17218
17219 : see if sfio.h is available
17220 set sfio.h i_sfio
17221 eval $inhdr
17222
17223 : see if sfio library is available
17224 case "$i_sfio" in
17225 $define)
17226         val=''
17227         set sfreserve val
17228         eval $inlibc
17229         ;;
17230 *)
17231         val="$undef"
17232         ;;
17233 esac
17234 : Ok, but do we want to use it.
17235 case "$val" in
17236 $define)
17237         case "$usesfio" in
17238         true|$define|[yY]*) dflt='y';;
17239         *) dflt='n';;
17240         esac
17241         echo "$package can use the sfio library, but it is experimental."
17242         case "$useperlio" in
17243         "$undef")
17244             echo "For sfio also the PerlIO abstraction layer is needed."
17245             echo "Earlier you said you wouldn't want that."
17246             ;;
17247         esac
17248         rp="You seem to have sfio available, do you want to try using it?"
17249         . ./myread
17250         case "$ans" in
17251         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17252                 useperlio="$define"
17253                 val="$define"
17254                 ;;
17255         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17256                 val="$undef"
17257                 ;;
17258         esac
17259         ;;
17260 *)      case "$usesfio" in
17261         true|$define|[yY]*)
17262                 echo "Sorry, cannot find sfio on this machine." >&4
17263                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17264                 val="$undef"
17265                 ;;
17266         esac
17267         ;;
17268 esac
17269 set d_sfio
17270 eval $setvar
17271 case "$d_sfio" in
17272 $define) usesfio='true';;
17273 *) usesfio='false';;
17274 esac
17275 case "$d_sfio" in
17276 $define) ;;
17277 *)      : Remove sfio from list of libraries to use
17278         case "$libs" in
17279         *-lsfio*)
17280                 echo "Removing unneeded -lsfio from library list" >&4
17281                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17282                 shift
17283                 libs="$*"
17284                 echo "libs = $libs" >&4
17285                 ;;
17286         esac
17287 ;;
17288 esac
17289
17290
17291 : see if shmctl exists
17292 set shmctl d_shmctl
17293 eval $inlibc
17294
17295 : see if shmget exists
17296 set shmget d_shmget
17297 eval $inlibc
17298
17299 : see if shmat exists
17300 set shmat d_shmat
17301 eval $inlibc
17302 : see what shmat returns
17303 case "$d_shmat" in
17304 "$define")
17305         $cat >shmat.c <<'END'
17306 #include <sys/shm.h>
17307 void *shmat();
17308 END
17309         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17310                 shmattype='void *'
17311         else
17312                 shmattype='char *'
17313         fi
17314         echo "and it returns ($shmattype)." >&4
17315         : see if a prototype for shmat is available
17316         xxx=`./findhdr sys/shm.h`
17317         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17318         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17319                 val="$define"
17320         else
17321                 val="$undef"
17322         fi
17323         $rm -f shmat.[co]
17324         ;;
17325 *)
17326         val="$undef"
17327         ;;
17328 esac
17329 set d_shmatprototype
17330 eval $setvar
17331
17332 : see if shmdt exists
17333 set shmdt d_shmdt
17334 eval $inlibc
17335
17336 : see how much of the 'shm*(2)' library is present.
17337 h_shm=true
17338 echo " "
17339 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17340 *"$undef"*) h_shm=false;;
17341 esac
17342 case "$osname" in
17343 freebsd)
17344     case "`ipcs 2>&1`" in
17345     "SVID shared memory"*"not configured"*)
17346         echo "Your $osname does not have the shm*(2) configured." >&4
17347         h_shm=false
17348         val="$undef"
17349         set shmctl d_shmctl
17350         evat $setvar
17351         set shmget d_shmget
17352         evat $setvar
17353         set shmat d_shmat
17354         evat $setvar
17355         set shmdt d_shmdt
17356         evat $setvar
17357         ;;
17358     esac
17359     ;;
17360 esac
17361 : we could also check for sys/ipc.h ...
17362 if $h_shm && $test `./findhdr sys/shm.h`; then
17363         echo "You have the full shm*(2) library." >&4
17364         val="$define"
17365 else
17366         echo "You don't have the full shm*(2) library." >&4
17367         val="$undef"
17368 fi
17369 set d_shm
17370 eval $setvar
17371
17372 : see if we have sigaction
17373 echo " "
17374 if set sigaction val -f d_sigaction; eval $csym; $val; then
17375         echo 'sigaction() found.' >&4
17376         $cat > try.c <<EOP
17377 #include <stdio.h>
17378 #include <sys/types.h>
17379 #include <signal.h>
17380 #$i_stdlib I_STDLIB
17381 #ifdef I_STDLIB
17382 #include <stdlib.h>
17383 #endif
17384 int main()
17385 {
17386     struct sigaction act, oact;
17387     act.sa_flags = 0;
17388     oact.sa_handler = 0;
17389     /* so that act and oact are used */
17390     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17391 }
17392 EOP
17393         set try
17394         if eval $compile_ok; then
17395                 val="$define"
17396         else
17397                 echo "But you don't seem to have a useable struct sigaction." >&4
17398                 val="$undef"
17399         fi
17400 else
17401         echo 'sigaction NOT found.' >&4
17402         val="$undef"
17403 fi
17404 set d_sigaction; eval $setvar
17405 $rm_try
17406
17407 : see if this is a sunmath.h system
17408 set sunmath.h i_sunmath
17409 eval $inhdr
17410
17411 : see if signbit exists
17412 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17413 $cat >try.c <<EOCP
17414 #$i_math I_MATH
17415 #$i_sunmath I_SUNMATH
17416 #ifdef I_MATH
17417 #  include <math.h>
17418 #endif
17419 #ifdef I_SUNMATH  /* Solaris special math library */
17420 #  include <sunmath.h>
17421 #endif
17422 #define NV $nvtype
17423 int main(int argc, char **argv)
17424 {
17425     NV x = 0.0;
17426     NV y = -0.0;
17427     if ((signbit(x) == 0) && (signbit(y) != 0))
17428         return 0;
17429     else
17430         return 1;
17431 }
17432 EOCP
17433 val="$undef"
17434 set try
17435 if eval $compile; then
17436     if $run ./try; then
17437         $echo "Yes." >&4
17438         val="$define"
17439     else
17440         $echo "Signbit seems to be available, but doesn't work as I expected."
17441         $echo "I won't use it." >&4
17442         val="$undef"
17443     fi
17444 else
17445     $echo "Nope." >&4
17446     dflt="$undef"
17447 fi
17448 set d_signbit
17449 eval $setvar
17450 $rm_try
17451
17452 : see if sigprocmask exists
17453 set sigprocmask d_sigprocmask
17454 eval $inlibc
17455
17456 : see if sigsetjmp exists
17457 echo " "
17458 case "$d_sigsetjmp" in
17459 '')
17460         $cat >try.c <<EOP
17461 #include <setjmp.h>
17462 #$i_stdlib I_STDLIB
17463 #ifdef I_STDLIB
17464 #include <stdlib.h>
17465 #endif
17466 sigjmp_buf env;
17467 int set = 1;
17468 int main()
17469 {
17470         if (sigsetjmp(env,1))
17471                 exit(set);
17472         set = 0;
17473         siglongjmp(env, 1);
17474         exit(1);
17475 }
17476 EOP
17477         set try
17478         if eval $compile; then
17479                 if $run ./try >/dev/null 2>&1; then
17480                         echo "POSIX sigsetjmp found." >&4
17481                         val="$define"
17482                 else
17483                         $cat >&4 <<EOM
17484 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17485 I'll ignore them.
17486 EOM
17487                         val="$undef"
17488                 fi
17489         else
17490                 echo "sigsetjmp not found." >&4
17491                 val="$undef"
17492         fi
17493         ;;
17494 *) val="$d_sigsetjmp"
17495         case "$d_sigsetjmp" in
17496         $define) echo "POSIX sigsetjmp found." >&4;;
17497         $undef) echo "sigsetjmp not found." >&4;;
17498         esac
17499         ;;
17500 esac
17501 set d_sigsetjmp
17502 eval $setvar
17503 $rm_try
17504
17505 : see if snprintf exists
17506 set snprintf d_snprintf
17507 eval $inlibc
17508
17509 : see if vsnprintf exists
17510 set vsnprintf d_vsnprintf
17511 eval $inlibc
17512
17513 case "$d_snprintf-$d_vsnprintf" in
17514 "$define-$define")
17515     $cat <<EOM
17516 Checking whether your snprintf() and vsnprintf() work okay...
17517 EOM
17518     $cat >try.c <<'EOCP'
17519 /* v?snprintf testing logic courtesy of Russ Allbery.
17520  * According to C99:
17521  * - if the buffer is too short it still must be \0-terminated
17522  * - if the buffer is too short the potentially required length
17523  *   must be returned and not -1
17524  * - if the buffer is NULL the potentially required length
17525  *   must be returned and not -1 or core dump
17526  */
17527 #include <stdio.h>
17528 #include <stdarg.h>
17529
17530 char buf[2];
17531
17532 int test (char *format, ...)
17533 {
17534     va_list args;
17535     int count;
17536
17537     va_start (args, format);
17538     count = vsnprintf (buf, sizeof buf, format, args);
17539     va_end (args);
17540     return count;
17541 }
17542
17543 int main ()
17544 {
17545     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17546              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17547 }
17548 EOCP
17549     set try
17550     if eval $compile; then
17551         `$run ./try`
17552         case "$?" in
17553         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17554         *) cat <<EOM >&4
17555 Your snprintf() and snprintf() don't seem to be working okay.
17556 EOM
17557            d_snprintf="$undef"
17558            d_vsnprintf="$undef"
17559            ;;
17560         esac
17561     else
17562         echo "(I can't seem to compile the test program--assuming they don't)"
17563         d_snprintf="$undef"
17564         d_vsnprintf="$undef"
17565     fi
17566     $rm_try
17567     ;;
17568 esac
17569
17570 : see if sockatmark exists
17571 set sockatmark d_sockatmark
17572 eval $inlibc
17573
17574 : see if prototype for sockatmark is available
17575 echo " "
17576 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17577 eval $hasproto
17578
17579 : see if socks5_init exists
17580 set socks5_init d_socks5_init
17581 eval $inlibc
17582
17583 : see if sprintf returns the length of the string in the buffer as per ANSI
17584 $echo "Checking whether sprintf returns the length of the string..." >&4
17585 $cat <<EOP >try.c
17586 #include <stdio.h>
17587 #$i_stdlib I_STDLIB
17588 #ifdef I_STDLIB
17589 #include <stdlib.h>
17590 #endif
17591 #$i_string I_STRING
17592 #ifdef I_STRING
17593 #  include <string.h>
17594 #else
17595 #  include <strings.h>
17596 #endif
17597 #$i_math I_MATH
17598 #ifdef I_MATH
17599 #include <math.h>
17600 #endif
17601
17602 char buffer[256];
17603
17604 int check (size_t expect, int test) {
17605   size_t got = strlen(buffer);
17606   if (expect == got)
17607     return 0;
17608
17609   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17610        test, buffer);
17611   exit (test);
17612 }
17613
17614 int main(int argc, char **argv) {
17615   int test = 0;
17616
17617   check(sprintf(buffer, ""), ++test);
17618   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17619   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17620
17621   return 0;
17622 }
17623 EOP
17624 set try
17625
17626 if eval $compile; then
17627     xxx="`$run ./try`"
17628     case "$?" in
17629         0) cat >&4 <<EOM
17630 sprintf returns the length of the string (as ANSI says it should)
17631 EOM
17632         d_sprintf_returns_strlen="$define"
17633         ;;
17634         *) cat >&4 <<EOM
17635 sprintf does not return the length of the string (how old is this system?)
17636 EOM
17637         d_sprintf_returns_strlen="$undef"
17638         ;;
17639     esac
17640 else
17641     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17642     d_sprintf_returns_strlen="$undef"
17643 fi
17644 $rm_try
17645
17646 : see if srand48_r exists
17647 set srand48_r d_srand48_r
17648 eval $inlibc
17649 case "$d_srand48_r" in
17650 "$define")
17651         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17652         case "$d_srand48_r_proto:$usethreads" in
17653         ":define")      d_srand48_r_proto=define
17654                 set d_srand48_r_proto srand48_r $hdrs
17655                 eval $hasproto ;;
17656         *)      ;;
17657         esac
17658         case "$d_srand48_r_proto" in
17659         define)
17660         case "$srand48_r_proto" in
17661         ''|0) try='int srand48_r(long, struct drand48_data*);'
17662         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17663         esac
17664         case "$srand48_r_proto" in
17665         ''|0)   d_srand48_r=undef
17666                 srand48_r_proto=0
17667                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17668         * )     case "$srand48_r_proto" in
17669                 REENTRANT_PROTO*) ;;
17670                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17671                 esac
17672                 echo "Prototype: $try" ;;
17673         esac
17674         ;;
17675         *)      case "$usethreads" in
17676                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17677                 esac
17678                 d_srand48_r=undef
17679                 srand48_r_proto=0
17680                 ;;
17681         esac
17682         ;;
17683 *)      srand48_r_proto=0
17684         ;;
17685 esac
17686
17687 : see if srandom_r exists
17688 set srandom_r d_srandom_r
17689 eval $inlibc
17690 case "$d_srandom_r" in
17691 "$define")
17692         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17693         case "$d_srandom_r_proto:$usethreads" in
17694         ":define")      d_srandom_r_proto=define
17695                 set d_srandom_r_proto srandom_r $hdrs
17696                 eval $hasproto ;;
17697         *)      ;;
17698         esac
17699         case "$d_srandom_r_proto" in
17700         define)
17701         case "$srandom_r_proto" in
17702         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17703         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17704         esac
17705         case "$srandom_r_proto" in
17706         ''|0)   d_srandom_r=undef
17707                 srandom_r_proto=0
17708                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17709         * )     case "$srandom_r_proto" in
17710                 REENTRANT_PROTO*) ;;
17711                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17712                 esac
17713                 echo "Prototype: $try" ;;
17714         esac
17715         ;;
17716         *)      case "$usethreads" in
17717                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17718                 esac
17719                 d_srandom_r=undef
17720                 srandom_r_proto=0
17721                 ;;
17722         esac
17723         ;;
17724 *)      srandom_r_proto=0
17725         ;;
17726 esac
17727
17728 : see if prototype for setresgid is available
17729 echo " "
17730 set d_sresgproto setresgid $i_unistd unistd.h
17731 eval $hasproto
17732
17733 : see if prototype for setresuid is available
17734 echo " "
17735 set d_sresuproto setresuid $i_unistd unistd.h
17736 eval $hasproto
17737
17738 : see if sys/stat.h is available
17739 set sys/stat.h i_sysstat
17740 eval $inhdr
17741
17742 : see if stat knows about block sizes
17743 echo " "
17744 echo "Checking to see if your struct stat has st_blocks field..." >&4
17745 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17746 eval $hasfield
17747
17748 : see if this is a sys/vfs.h system
17749 set sys/vfs.h i_sysvfs
17750 eval $inhdr
17751
17752 : see if this is a sys/statfs.h system
17753 set sys/statfs.h i_sysstatfs
17754 eval $inhdr
17755
17756 : Check for statfs_s
17757 echo " "
17758 echo "Checking to see if your system supports struct statfs..." >&4
17759 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
17760 eval $hasstruct
17761 case "$d_statfs_s" in
17762 "$define")      echo "Yes, it does."   ;;
17763 *)              echo "No, it doesn't." ;;
17764 esac
17765
17766
17767 : see if struct statfs knows about f_flags
17768 case "$d_statfs_s" in
17769 define)
17770         echo " "
17771         echo "Checking to see if your struct statfs has f_flags field..." >&4
17772         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
17773         eval $hasfield
17774         ;;
17775 *)      val="$undef"
17776         set d_statfs_f_flags
17777         eval $setvar
17778         ;;
17779 esac
17780 case "$d_statfs_f_flags" in
17781 "$define")      echo "Yes, it does."   ;;
17782 *)              echo "No, it doesn't." ;;
17783 esac
17784
17785 : Check stream access
17786 $cat >&4 <<EOM
17787 Checking how to access stdio streams by file descriptor number...
17788 EOM
17789 case "$stdio_stream_array" in
17790 '')     $cat >try.c <<EOCP
17791 #include <stdio.h>
17792 int main() {
17793   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17794     printf("yes\n");
17795 }
17796 EOCP
17797         for s in _iob __iob __sF
17798         do
17799                 set try -DSTDIO_STREAM_ARRAY=$s
17800                 if eval $compile; then
17801                         case "`$run ./try`" in
17802                         yes)    stdio_stream_array=$s; break ;;
17803                         esac
17804                 fi
17805         done
17806         $rm_try
17807 esac
17808 case "$stdio_stream_array" in
17809 '')     $cat >&4 <<EOM
17810 I can't figure out how to access stdio streams by file descriptor number.
17811 EOM
17812         d_stdio_stream_array="$undef"
17813         ;;
17814 *)      $cat >&4 <<EOM
17815 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17816 EOM
17817         d_stdio_stream_array="$define"
17818         ;;
17819 esac
17820
17821 : see if strcoll exists
17822 set strcoll d_strcoll
17823 eval $inlibc
17824
17825 : check for structure copying
17826 echo " "
17827 echo "Checking to see if your C compiler can copy structs..." >&4
17828 $cat >try.c <<'EOCP'
17829 int main()
17830 {
17831         struct blurfl {
17832                 int dyick;
17833         } foo, bar;
17834
17835         foo = bar;
17836 }
17837 EOCP
17838 if $cc -c try.c >/dev/null 2>&1 ; then
17839         val="$define"
17840         echo "Yup, it can."
17841 else
17842         val="$undef"
17843         echo "Nope, it can't."
17844 fi
17845 set d_strctcpy
17846 eval $setvar
17847 $rm_try
17848
17849 : see if strerror and/or sys_errlist[] exist
17850 echo " "
17851 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17852     if set strerror val -f d_strerror; eval $csym; $val; then
17853                 echo 'strerror() found.' >&4
17854                 d_strerror="$define"
17855                 d_strerrm='strerror(e)'
17856                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17857                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17858                         d_syserrlst="$define"
17859                 else
17860                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17861                         d_syserrlst="$undef"
17862                 fi
17863     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17864                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17865                 echo 'strerror() found in string header.' >&4
17866                 d_strerror="$define"
17867                 d_strerrm='strerror(e)'
17868                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17869                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17870                                 d_syserrlst="$define"
17871                 else
17872                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17873                         d_syserrlst="$undef"
17874                 fi
17875     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17876                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17877                 d_strerror="$undef"
17878                 d_syserrlst="$define"
17879                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17880     else
17881                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17882                 d_strerror="$undef"
17883                 d_syserrlst="$undef"
17884                 d_strerrm='"unknown"'
17885     fi
17886 fi
17887
17888 : see if strerror_r exists
17889 set strerror_r d_strerror_r
17890 eval $inlibc
17891 case "$d_strerror_r" in
17892 "$define")
17893         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17894         case "$d_strerror_r_proto:$usethreads" in
17895         ":define")      d_strerror_r_proto=define
17896                 set d_strerror_r_proto strerror_r $hdrs
17897                 eval $hasproto ;;
17898         *)      ;;
17899         esac
17900         case "$d_strerror_r_proto" in
17901         define)
17902         case "$strerror_r_proto" in
17903         ''|0) try='int strerror_r(int, char*, size_t);'
17904         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
17905         esac
17906         case "$strerror_r_proto" in
17907         ''|0) try='int strerror_r(int, char*, int);'
17908         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
17909         esac
17910         case "$strerror_r_proto" in
17911         ''|0) try='char* strerror_r(int, char*, size_t);'
17912         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
17913         esac
17914         case "$strerror_r_proto" in
17915         ''|0)   d_strerror_r=undef
17916                 strerror_r_proto=0
17917                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17918         * )     case "$strerror_r_proto" in
17919                 REENTRANT_PROTO*) ;;
17920                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17921                 esac
17922                 echo "Prototype: $try" ;;
17923         esac
17924         ;;
17925         *)      case "$usethreads" in
17926                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17927                 esac
17928                 d_strerror_r=undef
17929                 strerror_r_proto=0
17930                 ;;
17931         esac
17932         ;;
17933 *)      strerror_r_proto=0
17934         ;;
17935 esac
17936
17937 : see if strftime exists
17938 set strftime d_strftime
17939 eval $inlibc
17940
17941 : see if strlcat exists
17942 set strlcat d_strlcat
17943 eval $inlibc
17944
17945 : see if strlcpy exists
17946 set strlcpy d_strlcpy
17947 eval $inlibc
17948
17949 : see if strtod exists
17950 set strtod d_strtod
17951 eval $inlibc
17952
17953 : see if strtol exists
17954 set strtol d_strtol
17955 eval $inlibc
17956
17957 : see if strtold exists
17958 set strtold d_strtold
17959 eval $inlibc
17960
17961 : see if strtoll exists
17962 set strtoll d_strtoll
17963 eval $inlibc
17964
17965 case "$d_longlong-$d_strtoll" in
17966 "$define-$define")
17967         $cat <<EOM
17968 Checking whether your strtoll() works okay...
17969 EOM
17970         $cat >try.c <<'EOCP'
17971 #include <errno.h>
17972 #ifdef __hpux
17973 #define strtoll __strtoll
17974 #endif
17975 #ifdef __EMX__
17976 #define strtoll _strtoll
17977 #endif
17978 #include <stdio.h>
17979 extern long long int strtoll(char *s, char **, int);
17980 static int bad = 0;
17981 int check(char *s, long long ell, int een) {
17982         long long gll;
17983         errno = 0;
17984         gll = strtoll(s, 0, 10);
17985         if (!((gll == ell) && (errno == een)))
17986                 bad++;
17987 }
17988 int main() {
17989         check(" 1",                                      1LL, 0);
17990         check(" 0",                                      0LL, 0);
17991         check("-1",                                     -1LL, 0);
17992         check("-9223372036854775808", -9223372036854775808LL, 0);
17993         check("-9223372036854775808", -9223372036854775808LL, 0);
17994         check(" 9223372036854775807",  9223372036854775807LL, 0);
17995         check("-9223372036854775808", -9223372036854775808LL, 0);
17996         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17997         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17998         if (!bad)
17999                 printf("ok\n");
18000 }
18001 EOCP
18002         set try
18003         if eval $compile; then
18004                 yyy=`$run ./try`
18005                 case "$yyy" in
18006                 ok) echo "Your strtoll() seems to be working okay." ;;
18007                 *) cat <<EOM >&4
18008 Your strtoll() doesn't seem to be working okay.
18009 EOM
18010                    d_strtoll="$undef"
18011                    ;;
18012                 esac
18013         else
18014                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18015                 d_strtoll="$undef"
18016         fi
18017         ;;
18018 esac
18019
18020 : see if strtoq exists
18021 set strtoq d_strtoq
18022 eval $inlibc
18023
18024 : see if strtoul exists
18025 set strtoul d_strtoul
18026 eval $inlibc
18027
18028 case "$d_strtoul" in
18029 "$define")
18030         $cat <<EOM
18031 Checking whether your strtoul() works okay...
18032 EOM
18033         $cat >try.c <<'EOCP'
18034 #include <errno.h>
18035 #include <stdio.h>
18036 extern unsigned long int strtoul(char *s, char **, int);
18037 static int bad = 0;
18038 void check(char *s, unsigned long eul, int een) {
18039         unsigned long gul;
18040         errno = 0;
18041         gul = strtoul(s, 0, 10);
18042         if (!((gul == eul) && (errno == een)))
18043                 bad++;
18044 }
18045 int main() {
18046         check(" 1", 1L, 0);
18047         check(" 0", 0L, 0);
18048 EOCP
18049         case "$longsize" in
18050         8)
18051             $cat >>try.c <<'EOCP'
18052         check("18446744073709551615", 18446744073709551615UL, 0);
18053         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18054 #if 0 /* strtoul() for /^-/ strings is undefined. */
18055         check("-1", 18446744073709551615UL, 0);
18056         check("-18446744073709551614", 2, 0);
18057         check("-18446744073709551615", 1, 0);
18058         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18059         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18060 #endif
18061 EOCP
18062                 ;;
18063         4)
18064                     $cat >>try.c <<'EOCP'
18065         check("4294967295", 4294967295UL, 0);
18066         check("4294967296", 4294967295UL, ERANGE);
18067 #if 0 /* strtoul() for /^-/ strings is undefined. */
18068         check("-1", 4294967295UL, 0);
18069         check("-4294967294", 2, 0);
18070         check("-4294967295", 1, 0);
18071         check("-4294967296", 4294967295UL, ERANGE);
18072         check("-4294967297", 4294967295UL, ERANGE);
18073 #endif
18074 EOCP
18075                 ;;
18076         *)
18077 : Should we write these tests to be more portable by sprintf-ing
18078 : ~0 and then manipulating that char string as input for strtol?
18079                 ;;
18080         esac
18081         $cat >>try.c <<'EOCP'
18082         if (!bad)
18083                 printf("ok\n");
18084         return 0;
18085 }
18086 EOCP
18087         set try
18088         if eval $compile; then
18089                 case "`$run ./try`" in
18090                 ok) echo "Your strtoul() seems to be working okay." ;;
18091                 *) cat <<EOM >&4
18092 Your strtoul() doesn't seem to be working okay.
18093 EOM
18094                    d_strtoul="$undef"
18095                    ;;
18096                 esac
18097         else
18098                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18099                 d_strtoul="$undef"
18100         fi
18101         ;;
18102 esac
18103
18104 : see if strtoull exists
18105 set strtoull d_strtoull
18106 eval $inlibc
18107
18108 case "$d_longlong-$d_strtoull" in
18109 "$define-$define")
18110         $cat <<EOM
18111 Checking whether your strtoull() works okay...
18112 EOM
18113         $cat >try.c <<'EOCP'
18114 #include <errno.h>
18115 #ifdef __hpux
18116 #define strtoull __strtoull
18117 #endif
18118 #include <stdio.h>
18119 extern unsigned long long int strtoull(char *s, char **, int);
18120 static int bad = 0;
18121 int check(char *s, long long eull, int een) {
18122         long long gull;
18123         errno = 0;
18124         gull = strtoull(s, 0, 10);
18125         if (!((gull == eull) && (errno == een)))
18126                 bad++;
18127 }
18128 int main() {
18129         check(" 1",                                        1LL, 0);
18130         check(" 0",                                        0LL, 0);
18131         check("18446744073709551615",  18446744073709551615ULL, 0);
18132         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18133 #if 0 /* strtoull() for /^-/ strings is undefined. */
18134         check("-1",                    18446744073709551615ULL, 0);
18135         check("-18446744073709551614",                     2LL, 0);
18136         check("-18446744073709551615",                     1LL, 0);
18137         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18138         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18139 #endif
18140         if (!bad)
18141                 printf("ok\n");
18142 }
18143 EOCP
18144         set try
18145         if eval $compile; then
18146                 case "`$run ./try`" in
18147                 ok) echo "Your strtoull() seems to be working okay." ;;
18148                 *) cat <<EOM >&4
18149 Your strtoull() doesn't seem to be working okay.
18150 EOM
18151                    d_strtoull="$undef"
18152                    ;;
18153                 esac
18154         else
18155                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18156                 d_strtoull="$undef"
18157         fi
18158         ;;
18159 esac
18160
18161 : see if strtouq exists
18162 set strtouq d_strtouq
18163 eval $inlibc
18164
18165 case "$d_strtouq" in
18166 "$define")
18167         $cat <<EOM
18168 Checking whether your strtouq() works okay...
18169 EOM
18170         $cat >try.c <<'EOCP'
18171 #include <errno.h>
18172 #include <stdio.h>
18173 extern unsigned long long int strtouq(char *s, char **, int);
18174 static int bad = 0;
18175 void check(char *s, unsigned long long eull, int een) {
18176         unsigned long long gull;
18177         errno = 0;
18178         gull = strtouq(s, 0, 10);
18179         if (!((gull == eull) && (errno == een)))
18180                 bad++;
18181 }
18182 int main() {
18183         check(" 1",                                        1LL, 0);
18184         check(" 0",                                        0LL, 0);
18185         check("18446744073709551615",  18446744073709551615ULL, 0);
18186         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18187 #if 0 /* strtouq() for /^-/ strings is undefined. */
18188         check("-1",                    18446744073709551615ULL, 0);
18189         check("-18446744073709551614",                     2LL, 0);
18190         check("-18446744073709551615",                     1LL, 0);
18191         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18192         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18193 #endif
18194         if (!bad)
18195                 printf("ok\n");
18196         return 0;
18197 }
18198 EOCP
18199         set try
18200         if eval $compile; then
18201                 case "`$run ./try`" in
18202                 ok) echo "Your strtouq() seems to be working okay." ;;
18203                 *) cat <<EOM >&4
18204 Your strtouq() doesn't seem to be working okay.
18205 EOM
18206                    d_strtouq="$undef"
18207                    ;;
18208                 esac
18209         else
18210                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18211                 d_strtouq="$undef"
18212         fi
18213         ;;
18214 esac
18215
18216 : see if strxfrm exists
18217 set strxfrm d_strxfrm
18218 eval $inlibc
18219
18220 : see if symlink exists
18221 set symlink d_symlink
18222 eval $inlibc
18223
18224 : see if syscall exists
18225 set syscall d_syscall
18226 eval $inlibc
18227
18228 : see if prototype for syscall is available
18229 echo " "
18230 set d_syscallproto syscall $i_unistd unistd.h
18231 eval $hasproto
18232
18233 : see if sysconf exists
18234 set sysconf d_sysconf
18235 eval $inlibc
18236
18237 : see if system exists
18238 set system d_system
18239 eval $inlibc
18240
18241 : see if tcgetpgrp exists
18242 set tcgetpgrp d_tcgetpgrp
18243 eval $inlibc
18244
18245 : see if tcsetpgrp exists
18246 set tcsetpgrp d_tcsetpgrp
18247 eval $inlibc
18248
18249 : see if prototype for telldir is available
18250 echo " "
18251 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18252 eval $hasproto
18253
18254 : see if time exists
18255 echo " "
18256 if test "X$d_time" = X -o X"$timetype" = X; then
18257     if set time val -f d_time; eval $csym; $val; then
18258                 echo 'time() found.' >&4
18259                 val="$define"
18260                 rp="What is the type returned by time() on this system?"
18261                 set time_t timetype long stdio.h sys/types.h
18262                 eval $typedef_ask
18263     else
18264                 echo 'time() not found, hope that will do.' >&4
18265                 val="$undef"
18266                 timetype='int';
18267     fi
18268     set d_time
18269     eval $setvar
18270 fi
18271
18272 : see if timegm exists
18273 set timegm d_timegm
18274 eval $inlibc
18275
18276 : see if this is a sys/times.h system
18277 set sys/times.h i_systimes
18278 eval $inhdr
18279
18280 : see if times exists
18281 echo " "
18282 if set times val -f d_times; eval $csym; $val; then
18283         echo 'times() found.' >&4
18284         d_times="$define"
18285         inc=''
18286         case "$i_systimes" in
18287         "$define") inc='sys/times.h';;
18288         esac
18289         rp="What is the type returned by times() on this system?"
18290         set clock_t clocktype long stdio.h sys/types.h $inc
18291         eval $typedef_ask
18292 else
18293         echo 'times() NOT found, hope that will do.' >&4
18294         d_times="$undef"
18295         clocktype='int'
18296 fi
18297
18298 : see if tmpnam_r exists
18299 set tmpnam_r d_tmpnam_r
18300 eval $inlibc
18301 case "$d_tmpnam_r" in
18302 "$define")
18303         hdrs="$i_systypes sys/types.h define stdio.h "
18304         case "$d_tmpnam_r_proto:$usethreads" in
18305         ":define")      d_tmpnam_r_proto=define
18306                 set d_tmpnam_r_proto tmpnam_r $hdrs
18307                 eval $hasproto ;;
18308         *)      ;;
18309         esac
18310         case "$d_tmpnam_r_proto" in
18311         define)
18312         case "$tmpnam_r_proto" in
18313         ''|0) try='char* tmpnam_r(char*);'
18314         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18315         esac
18316         case "$tmpnam_r_proto" in
18317         ''|0)   d_tmpnam_r=undef
18318                 tmpnam_r_proto=0
18319                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18320         * )     case "$tmpnam_r_proto" in
18321                 REENTRANT_PROTO*) ;;
18322                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18323                 esac
18324                 echo "Prototype: $try" ;;
18325         esac
18326         ;;
18327         *)      case "$usethreads" in
18328                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18329                 esac
18330                 d_tmpnam_r=undef
18331                 tmpnam_r_proto=0
18332                 ;;
18333         esac
18334         ;;
18335 *)      tmpnam_r_proto=0
18336         ;;
18337 esac
18338
18339 : see if truncate exists
18340 set truncate d_truncate
18341 eval $inlibc
18342
18343 : see if ttyname_r exists
18344 set ttyname_r d_ttyname_r
18345 eval $inlibc
18346 case "$d_ttyname_r" in
18347 "$define")
18348         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18349         case "$d_ttyname_r_proto:$usethreads" in
18350         ":define")      d_ttyname_r_proto=define
18351                 set d_ttyname_r_proto ttyname_r $hdrs
18352                 eval $hasproto ;;
18353         *)      ;;
18354         esac
18355         case "$d_ttyname_r_proto" in
18356         define)
18357         case "$ttyname_r_proto" in
18358         ''|0) try='int ttyname_r(int, char*, size_t);'
18359         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18360         esac
18361         case "$ttyname_r_proto" in
18362         ''|0) try='int ttyname_r(int, char*, int);'
18363         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18364         esac
18365         case "$ttyname_r_proto" in
18366         ''|0) try='char* ttyname_r(int, char*, int);'
18367         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18368         esac
18369         case "$ttyname_r_proto" in
18370         ''|0)   d_ttyname_r=undef
18371                 ttyname_r_proto=0
18372                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18373         * )     case "$ttyname_r_proto" in
18374                 REENTRANT_PROTO*) ;;
18375                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18376                 esac
18377                 echo "Prototype: $try" ;;
18378         esac
18379         ;;
18380         *)      case "$usethreads" in
18381                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18382                 esac
18383                 d_ttyname_r=undef
18384                 ttyname_r_proto=0
18385                 ;;
18386         esac
18387         ;;
18388 *)      ttyname_r_proto=0
18389         ;;
18390 esac
18391
18392 : see if tzname[] exists
18393 echo " "
18394 if set tzname val -a d_tzname; eval $csym; $val; then
18395         val="$define"
18396         echo 'tzname[] found.' >&4
18397 else
18398         val="$undef"
18399         echo 'tzname[] NOT found.' >&4
18400 fi
18401 set d_tzname
18402 eval $setvar
18403
18404 : Check if is a multiplatform env
18405 case "$osname" in
18406 next|rhapsody|darwin) multiarch="$define" ;;
18407 esac
18408 case "$multiarch" in
18409 ''|[nN]*) multiarch="$undef" ;;
18410 esac
18411
18412 : check for ordering of bytes in a UV
18413 echo " "
18414 case "$usecrosscompile$multiarch" in
18415 *$define*)
18416         $cat <<EOM
18417 You seem to be either cross-compiling or doing a multiarchitecture build,
18418 skipping the byteorder check.
18419
18420 EOM
18421         byteorder='ffff'
18422         ;;
18423 *)
18424         case "$byteorder" in
18425         '')
18426                 $cat <<'EOM'
18427 In the following, larger digits indicate more significance.  A big-endian
18428 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18429 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18430 machines may have weird orders like 3412.  A Cray will report 87654321,
18431 an Alpha will report 12345678. If the test program works the default is
18432 probably right.
18433 I'm now running the test program...
18434 EOM
18435                 $cat >try.c <<EOCP
18436 #include <stdio.h>
18437 #$i_stdlib I_STDLIB
18438 #ifdef I_STDLIB
18439 #include <stdlib.h>
18440 #endif
18441 #include <sys/types.h>
18442 typedef $uvtype UV;
18443 int main()
18444 {
18445         int i;
18446         union {
18447                 UV l;
18448                 char c[$uvsize];
18449         } u;
18450
18451         if ($uvsize > 4)
18452                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18453         else
18454                 u.l = (UV)0x04030201;
18455         for (i = 0; i < $uvsize; i++)
18456                 printf("%c", u.c[i]+'0');
18457         printf("\n");
18458         exit(0);
18459 }
18460 EOCP
18461                 xxx_prompt=y
18462                 set try
18463                 if eval $compile && $run ./try > /dev/null; then
18464                         dflt=`$run ./try`
18465                         case "$dflt" in
18466                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18467                                 echo "(The test program ran ok.)"
18468                                 echo "byteorder=$dflt"
18469                                 xxx_prompt=n
18470                         ;;
18471                         ????|????????) echo "(The test program ran ok.)" ;;
18472                         *) echo "(The test program didn't run right for some reason.)" ;;
18473                         esac
18474                 else
18475                         dflt='4321'
18476                         cat <<'EOM'
18477 (I can't seem to compile the test program.  Guessing big-endian...)
18478 EOM
18479                 fi
18480                 case "$xxx_prompt" in
18481                 y)
18482                         rp="What is the order of bytes in $uvtype?"
18483                         . ./myread
18484                         byteorder="$ans"
18485                         ;;
18486                 *)      byteorder=$dflt
18487                         ;;
18488                 esac
18489                 ;;
18490         esac
18491         $rm_try
18492         ;;
18493 esac
18494
18495 : Checking 32bit aligndness
18496 $cat <<EOM
18497
18498 Checking to see whether you can access character data unalignedly...
18499 EOM
18500 case "$d_u32align" in
18501 '')   $cat >try.c <<EOCP
18502 #include <stdio.h>
18503 #$i_stdlib I_STDLIB
18504 #ifdef I_STDLIB
18505 #include <stdlib.h>
18506 #endif
18507 #define U32 $u32type
18508 #define BYTEORDER 0x$byteorder
18509 #define U8 $u8type
18510 #include <signal.h>
18511 #ifdef SIGBUS
18512 $signal_t bletch(int s) { exit(4); }
18513 #endif
18514 int main() {
18515 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18516     U8 buf[8];
18517     U32 *up;
18518     int i;
18519
18520     if (sizeof(U32) != 4) {
18521         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18522         exit(1);
18523     }
18524
18525     fflush(stdout);
18526
18527 #ifdef SIGBUS
18528     signal(SIGBUS, bletch);
18529 #endif
18530
18531     buf[0] = 0;
18532     buf[1] = 0;
18533     buf[2] = 0;
18534     buf[3] = 1;
18535     buf[4] = 0;
18536     buf[5] = 0;
18537     buf[6] = 0;
18538     buf[7] = 1;
18539
18540     for (i = 0; i < 4; i++) {
18541         up = (U32*)(buf + i);
18542         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18543                (*up == 1 << (8*(3-i)))  /* little-endian */
18544               )
18545            )
18546         {
18547             printf("read failed (%x)\n", *up);
18548             exit(2);
18549         }
18550     }
18551
18552     /* write test */
18553     for (i = 0; i < 4; i++) {
18554         up = (U32*)(buf + i);
18555         *up = 0xBeef;
18556         if (*up != 0xBeef) {
18557             printf("write failed (%x)\n", *up);
18558             exit(3);
18559         }
18560     }
18561
18562     exit(0);
18563 #else
18564     printf("1\n");
18565     exit(1);
18566 #endif
18567     return 0;
18568 }
18569 EOCP
18570 set try
18571 if eval $compile_ok; then
18572         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18573         $run ./try 2>&1 >/dev/null
18574         case "$?" in
18575         0)      cat >&4 <<EOM
18576 You can access character data pretty unalignedly.
18577 EOM
18578                 d_u32align="$undef"
18579                 ;;
18580         *)      cat >&4 <<EOM
18581 It seems that you must access character data in an aligned manner.
18582 EOM
18583                 d_u32align="$define"
18584                 ;;
18585         esac
18586 else
18587         rp='Can you access character data at unaligned addresses?'
18588         dflt='n'
18589         . ./myread
18590         case "$ans" in
18591         [yY]*)  d_u32align="$undef"  ;;
18592         *)      d_u32align="$define" ;;
18593         esac
18594 fi
18595 $rm_try
18596 ;;
18597 esac
18598
18599 : see if ualarm exists
18600 set ualarm d_ualarm
18601 eval $inlibc
18602
18603 : see if umask exists
18604 set umask d_umask
18605 eval $inlibc
18606
18607 : see if unordered exists
18608 set unordered d_unordered
18609 eval $inlibc
18610
18611 : see if unsetenv exists
18612 set unsetenv d_unsetenv
18613 eval $inlibc
18614
18615 : see if usleep exists
18616 set usleep d_usleep
18617 eval $inlibc
18618
18619 : see if prototype for usleep is available
18620 echo " "
18621 set d_usleepproto usleep $i_unistd unistd.h
18622 eval $hasproto
18623
18624 : see if ustat exists
18625 set ustat d_ustat
18626 eval $inlibc
18627
18628 : see if closedir exists
18629 set closedir d_closedir
18630 eval $inlibc
18631
18632 case "$d_closedir" in
18633 "$define")
18634         echo " "
18635         echo "Checking whether closedir() returns a status..." >&4
18636         cat > try.c <<EOM
18637 #$i_dirent I_DIRENT             /**/
18638 #$i_sysdir I_SYS_DIR            /**/
18639 #$i_sysndir I_SYS_NDIR          /**/
18640 #$i_systypes I_SYS_TYPES        /**/
18641
18642 #if defined(I_SYS_TYPES)
18643 #include <sys/types.h>
18644 #endif
18645 #if defined(I_DIRENT)
18646 #include <dirent.h>
18647 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18648 #include <sys/dir.h>
18649 #endif
18650 #else
18651 #ifdef I_SYS_NDIR
18652 #include <sys/ndir.h>
18653 #else
18654 #ifdef I_SYS_DIR
18655 #ifdef hp9000s500
18656 #include <ndir.h>       /* may be wrong in the future */
18657 #else
18658 #include <sys/dir.h>
18659 #endif
18660 #endif
18661 #endif
18662 #endif
18663 int main() { return closedir(opendir(".")); }
18664 EOM
18665         set try
18666         if eval $compile_ok; then
18667                 if $run ./try > /dev/null 2>&1 ; then
18668                         echo "Yes, it does."
18669                         val="$undef"
18670                 else
18671                         echo "No, it doesn't."
18672                         val="$define"
18673                 fi
18674         else
18675                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18676                 val="$define"
18677         fi
18678         ;;
18679 *)
18680         val="$undef";
18681         ;;
18682 esac
18683 set d_void_closedir
18684 eval $setvar
18685 $rm_try
18686
18687 : see if there is a wait4
18688 set wait4 d_wait4
18689 eval $inlibc
18690
18691 : see if waitpid exists
18692 set waitpid d_waitpid
18693 eval $inlibc
18694
18695 : see if wcstombs exists
18696 set wcstombs d_wcstombs
18697 eval $inlibc
18698
18699 : see if wctomb exists
18700 set wctomb d_wctomb
18701 eval $inlibc
18702
18703 : see if writev exists
18704 set writev d_writev
18705 eval $inlibc
18706
18707 : preserve RCS keywords in files with variable substitution, grrr
18708 Date='$Date'
18709 Id='$Id'
18710 Log='$Log'
18711 RCSfile='$RCSfile'
18712 Revision='$Revision'
18713
18714 : check for alignment requirements
18715 echo " "
18716 case "$usecrosscompile$multiarch" in
18717 *$define*)
18718         $cat <<EOM
18719 You seem to be either cross-compiling or doing a multiarchitecture build,
18720 skipping the memory alignment check.
18721
18722 EOM
18723         case "$alignbytes" in
18724         '') alignbytes=8 ;;
18725         esac
18726         ;;
18727 *)
18728         case "$alignbytes" in
18729         '') echo "Checking alignment constraints..." >&4
18730                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18731                         $cat >try.c <<'EOCP'
18732 typedef long double NV;
18733 EOCP
18734                 else
18735                         $cat >try.c <<'EOCP'
18736 typedef double NV;
18737 EOCP
18738                 fi
18739                 $cat >>try.c <<'EOCP'
18740 #include <stdio.h>
18741 struct foobar {
18742         char foo;
18743         NV bar;
18744 } try_algn;
18745 int main()
18746 {
18747     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18748     return(0);
18749 }
18750 EOCP
18751                 set try
18752                 if eval $compile_ok; then
18753                         dflt=`$run ./try`
18754                 else
18755                         dflt='8'
18756                         echo "(I can't seem to compile the test program...)"
18757                 fi
18758                 ;;
18759         *) dflt="$alignbytes"
18760                 ;;
18761         esac
18762         rp="Doubles must be aligned on a how-many-byte boundary?"
18763         . ./myread
18764         alignbytes="$ans"
18765         $rm_try
18766         ;;
18767 esac
18768
18769
18770 : set the base revision
18771 baserev=5.0
18772
18773 : how do we concatenate cpp tokens here?
18774 echo " "
18775 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18776 $cat >cpp_stuff.c <<'EOCP'
18777 #define RCAT(a,b)a/**/b
18778 #define ACAT(a,b)a ## b
18779 RCAT(Rei,ser)
18780 ACAT(Cir,cus)
18781 EOCP
18782 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18783 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18784         echo "Oh!  Smells like ANSI's been here." >&4
18785         echo "We can catify or stringify, separately or together!"
18786         cpp_stuff=42
18787 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18788         echo "Ah, yes!  The good old days!" >&4
18789         echo "However, in the good old days we don't know how to stringify and"
18790         echo "catify at the same time."
18791         cpp_stuff=1
18792 else
18793         $cat >&4 <<EOM
18794 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18795 You're going to have to edit the values of CAT[2-5] in config.h...
18796 EOM
18797         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18798 fi
18799 $rm -f cpp_stuff.*
18800
18801 : see if this is a db.h system
18802 set db.h i_db
18803 eval $inhdr
18804
18805 case "$i_db" in
18806 $define)
18807         : Check db version.
18808         echo " "
18809         echo "Checking Berkeley DB version ..." >&4
18810         $cat >try.c <<EOCP
18811 #$d_const HASCONST
18812 #ifndef HASCONST
18813 #define const
18814 #endif
18815 #include <sys/types.h>
18816 #include <stdio.h>
18817 #$i_stdlib I_STDLIB
18818 #ifdef I_STDLIB
18819 #include <stdlib.h>
18820 #endif
18821 #include <db.h>
18822 int main(int argc, char *argv[])
18823 {
18824 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18825     int Major, Minor, Patch ;
18826     unsigned long Version ;
18827     (void)db_version(&Major, &Minor, &Patch) ;
18828     if (argc == 2) {
18829         printf("%d %d %d %d %d %d\n",
18830                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18831                Major, Minor, Patch);
18832         exit(0);
18833     }
18834     printf("You have Berkeley DB Version 2 or greater.\n");
18835
18836     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18837                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18838     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18839                 Major, Minor, Patch) ;
18840
18841     /* check that db.h & libdb are compatible */
18842     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18843         printf("db.h and libdb are incompatible.\n") ;
18844         exit(3);
18845     }
18846
18847     printf("db.h and libdb are compatible.\n") ;
18848
18849     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18850                 + DB_VERSION_PATCH ;
18851
18852     /* needs to be >= 2.3.4 */
18853     if (Version < 2003004) {
18854     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18855         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18856         exit(2);
18857     }
18858
18859     exit(0);
18860 #else
18861 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18862     if (argc == 2) {
18863         printf("1 0 0\n");
18864         exit(0);
18865     }
18866     printf("You have Berkeley DB Version 1.\n");
18867     exit(0);    /* DB version < 2: the coast is clear. */
18868 #else
18869     exit(1);    /* <db.h> not Berkeley DB? */
18870 #endif
18871 #endif
18872 }
18873 EOCP
18874         set try
18875         if eval $compile_ok && $run ./try; then
18876                 echo 'Looks OK.' >&4
18877                 set `$run ./try 1`
18878                 db_version_major=$1
18879                 db_version_minor=$2
18880                 db_version_patch=$3
18881         else
18882                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18883                 i_db=$undef
18884                 case " $libs " in
18885                 *"-ldb "*)
18886                         : Remove db from list of libraries to use
18887                         echo "Removing unusable -ldb from library list" >&4
18888                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18889                         shift
18890                         libs="$*"
18891                         echo "libs = $libs" >&4
18892                         ;;
18893                 esac
18894         fi
18895         $rm_try
18896         ;;
18897 esac
18898
18899 case "$i_db" in
18900 define)
18901         : Check the return type needed for hash
18902         echo " "
18903         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18904         $cat >try.c <<EOCP
18905 #$d_const HASCONST
18906 #ifndef HASCONST
18907 #define const
18908 #endif
18909 #include <sys/types.h>
18910 #include <db.h>
18911
18912 #ifndef DB_VERSION_MAJOR
18913 u_int32_t hash_cb (ptr, size)
18914 const void *ptr;
18915 size_t size;
18916 {
18917 }
18918 HASHINFO info;
18919 int main()
18920 {
18921         info.hash = hash_cb;
18922 }
18923 #endif
18924 EOCP
18925         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18926                 if $contains warning try.out >>/dev/null 2>&1 ; then
18927                         db_hashtype='int'
18928                 else
18929                         db_hashtype='u_int32_t'
18930                 fi
18931         else
18932                 : XXX Maybe we should just give up here.
18933                 db_hashtype=u_int32_t
18934                 $cat try.out >&4
18935                 echo "Help:  I can't seem to compile the db test program." >&4
18936                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18937         fi
18938         $rm_try
18939         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18940         ;;
18941 *)      db_hashtype=u_int32_t
18942         ;;
18943 esac
18944 case "$i_db" in
18945 define)
18946         : Check the return type needed for prefix
18947         echo " "
18948         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18949         cat >try.c <<EOCP
18950 #$d_const HASCONST
18951 #ifndef HASCONST
18952 #define const
18953 #endif
18954 #include <sys/types.h>
18955 #include <db.h>
18956
18957 #ifndef DB_VERSION_MAJOR
18958 size_t prefix_cb (key1, key2)
18959 const DBT *key1;
18960 const DBT *key2;
18961 {
18962 }
18963 BTREEINFO info;
18964 int main()
18965 {
18966         info.prefix = prefix_cb;
18967 }
18968 #endif
18969 EOCP
18970         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18971                 if $contains warning try.out >>/dev/null 2>&1 ; then
18972                         db_prefixtype='int'
18973                 else
18974                         db_prefixtype='size_t'
18975                 fi
18976         else
18977                 db_prefixtype='size_t'
18978                 : XXX Maybe we should just give up here.
18979                 $cat try.out >&4
18980                 echo "Help:  I can't seem to compile the db test program." >&4
18981                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18982         fi
18983         $rm_try
18984         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18985         ;;
18986 *)      db_prefixtype='size_t'
18987         ;;
18988 esac
18989
18990 : How can we generate normalized random numbers ?
18991 echo " "
18992 echo "Looking for a random number function..." >&4
18993 case "$randfunc" in
18994 '')
18995         if set drand48 val -f; eval $csym; $val; then
18996                 dflt="drand48"
18997                 echo "Good, found drand48()." >&4
18998         elif set random val -f; eval $csym; $val; then
18999                 dflt="random"
19000                 echo "OK, found random()." >&4
19001         else
19002                 dflt="rand"
19003                 echo "Yick, looks like I have to use rand()." >&4
19004         fi
19005         echo " "
19006         ;;
19007 *)
19008         dflt="$randfunc"
19009         ;;
19010 esac
19011 cont=true
19012
19013 case "$ccflags" in
19014 *-Dmy_rand=*|*-Dmy_srand=*)
19015         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19016         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19017         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19018         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19019         ;;
19020 esac
19021
19022 while $test "$cont"; do
19023         rp="Use which function to generate random numbers?"
19024         . ./myread
19025         if $test "$ans" = "$dflt"; then
19026                 : null
19027         else
19028                 randbits=''
19029         fi
19030         randfunc="$ans"
19031         if set $ans val -f; eval $csym; $val; then
19032                 cont=''
19033         else
19034                 dflt=y
19035                 rp="I cannot find function $ans. Use that name anyway?"
19036                 . ./myread
19037                 dflt=rand
19038                 case "$ans" in
19039                         [yY]*) cont='';;
19040                 esac
19041         fi
19042         case "$cont" in
19043         '')
19044                 case "$randfunc" in
19045                 drand48)
19046                         drand01="drand48()"
19047                         seedfunc="srand48"
19048                         randbits=48
19049                         randseedtype=long
19050                         ;;
19051                 rand|random)
19052                         case "$randbits" in
19053                         '')
19054 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19055                                 $cat >try.c <<EOCP
19056 #$i_unistd I_UNISTD
19057 #$i_stdlib I_STDLIB
19058 #include <stdio.h>
19059 #ifdef I_UNISTD
19060 #  include <unistd.h>
19061 #endif
19062 #ifdef I_STDLIB
19063 #  include <stdlib.h>
19064 #endif
19065 int main()
19066 {
19067         register int i;
19068         register unsigned long tmp;
19069         register unsigned long max = 0L;
19070
19071         for (i = 1000; i; i--) {
19072                 tmp = (unsigned long) $randfunc();
19073                 if (tmp > max) max = tmp;
19074         }
19075         for (i = 0; max; i++)
19076                 max /= 2;
19077         printf("%d\n",i);
19078 }
19079 EOCP
19080                                 set try
19081                                 if eval $compile_ok; then
19082                                         dflt=`try`
19083                                 else
19084                                         dflt='?'
19085                                         echo "(I can't seem to compile the test program...)"
19086                                 fi
19087                                 ;;
19088                         *)
19089                                 dflt="$randbits"
19090                                 ;;
19091                         esac
19092                         rp="How many bits does your $randfunc() function produce?"
19093                         . ./myread
19094                         randbits="$ans"
19095                         $rm_try
19096                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19097                         seedfunc="s$randfunc"
19098                         randseedtype=unsigned
19099                         ;;
19100                 *)
19101                         dflt="31"
19102                         rp="How many bits does your $randfunc() function produce?"
19103                         . ./myread
19104                         randbits="$ans"
19105                         seedfunc="s$randfunc"
19106                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19107                         if set $seedfunc val -f; eval $csym; $val; then
19108                                 echo "(Using $seedfunc() to seed random generator)"
19109                         else
19110                                 echo "(Warning: no $seedfunc() to seed random generator)"
19111                                 seedfunc=rand
19112                         fi
19113                         randseedtype=unsigned
19114                         ;;
19115                 esac
19116                 ;;
19117         esac
19118 done
19119
19120 : Determine if this is an EBCDIC system
19121 echo " "
19122 echo "Determining whether or not we are on an EBCDIC system..." >&4
19123 $cat >try.c <<'EOM'
19124 int main()
19125 {
19126   if ('M'==0xd4) return 0;
19127   return 1;
19128 }
19129 EOM
19130
19131 val=$undef
19132 set try
19133 if eval $compile_ok; then
19134         if $run ./try; then
19135                 echo "You seem to speak EBCDIC." >&4
19136                 val="$define"
19137         else
19138                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19139         fi
19140 else
19141         echo "I'm unable to compile the test program." >&4
19142         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19143 fi
19144 $rm_try
19145 set ebcdic
19146 eval $setvar
19147
19148 : Check how to flush
19149 echo " "
19150 $cat >&4 <<EOM
19151 Checking how to flush all pending stdio output...
19152 EOM
19153 # I only know how to find the first 32 possibly open files on SunOS.
19154 # See also hints/sunos_4_1.sh and util.c  --AD
19155 case "$osname" in
19156 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19157 esac
19158 $cat >>try.c <<EOCP
19159 #include <stdio.h>
19160 #$i_stdlib I_STDLIB
19161 #ifdef I_STDLIB
19162 #include <stdlib.h>
19163 #endif
19164 #$i_unistd I_UNISTD
19165 #ifdef I_UNISTD
19166 # include <unistd.h>
19167 #endif
19168 #$d_sysconf HAS_SYSCONF
19169 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19170 #ifdef HAS_STDIO_STREAM_ARRAY
19171 # define STDIO_STREAM_ARRAY $stdio_stream_array
19172 #endif
19173 int main() {
19174   FILE* p;
19175   unlink("try.out");
19176   p = fopen("try.out", "w");
19177 #ifdef TRY_FPUTC
19178   fputc('x', p);
19179 #else
19180 # ifdef TRY_FPRINTF
19181   fprintf(p, "x");
19182 # endif
19183 #endif
19184 #ifdef TRY_FFLUSH_NULL
19185   fflush(NULL);
19186 #endif
19187 #ifdef TRY_FFLUSH_ALL
19188   {
19189     long open_max = -1;
19190 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19191     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19192 # else
19193 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19194     open_max = sysconf(_SC_OPEN_MAX);
19195 #  else
19196 #   ifdef FOPEN_MAX
19197     open_max = FOPEN_MAX;
19198 #   else
19199 #    ifdef OPEN_MAX
19200     open_max = OPEN_MAX;
19201 #    else
19202 #     ifdef _NFILE
19203     open_max = _NFILE;
19204 #     endif
19205 #    endif
19206 #   endif
19207 #  endif
19208 # endif
19209 # ifdef HAS_STDIO_STREAM_ARRAY
19210     if (open_max > 0) {
19211       long i;
19212       for (i = 0; i < open_max; i++)
19213             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19214                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19215                 STDIO_STREAM_ARRAY[i]._flag)
19216                 fflush(&STDIO_STREAM_ARRAY[i]);
19217     }
19218   }
19219 # endif
19220 #endif
19221   _exit(42);
19222 }
19223 EOCP
19224 : first we have to find out how _not_ to flush
19225 $to try.c
19226 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19227     output=''
19228     set try -DTRY_FPUTC
19229     if eval $compile; then
19230             $run ./try 2>/dev/null
19231             code="$?"
19232             $from try.out
19233             if $test ! -s try.out -a "X$code" = X42; then
19234                 output=-DTRY_FPUTC
19235             fi
19236     fi
19237     case "$output" in
19238     '')
19239             set try -DTRY_FPRINTF
19240             if eval $compile; then
19241                     $run ./try 2>/dev/null
19242                     code="$?"
19243                     $from try.out
19244                     if $test ! -s try.out -a "X$code" = X42; then
19245                         output=-DTRY_FPRINTF
19246                     fi
19247             fi
19248         ;;
19249     esac
19250 fi
19251 : check for fflush NULL behaviour
19252 case "$fflushNULL" in
19253 '')     set try -DTRY_FFLUSH_NULL $output
19254         if eval $compile; then
19255                 $run ./try 2>/dev/null
19256                 code="$?"
19257                 $from try.out
19258                 if $test -s try.out -a "X$code" = X42; then
19259                         fflushNULL="`$cat try.out`"
19260                 else
19261                         if $test "X$code" != X42; then
19262                                 $cat >&4 <<EOM
19263 (If this test failed, don't worry, we'll try another method shortly.)
19264 EOM
19265                         fi
19266                 fi
19267         fi
19268         $rm -f core try.core core.try.*
19269         case "$fflushNULL" in
19270         x)      $cat >&4 <<EOM
19271 Your fflush(NULL) works okay for output streams.
19272 Let's see if it clobbers input pipes...
19273 EOM
19274 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19275 # bug that improperly flushes the input end of pipes.  So we avoid the
19276 # autoflush on fork/system/exec support for now. :-(
19277 $cat >tryp.c <<EOCP
19278 #include <stdio.h>
19279 int
19280 main(int argc, char **argv)
19281 {
19282     char buf[1024];
19283     int i;
19284     char *bp = buf;
19285     while (1) {
19286         while ((i = getc(stdin)) != -1
19287                && (*bp++ = i) != '\n'
19288                && bp < &buf[1024])
19289         /* DO NOTHING */ ;
19290         *bp = '\0';
19291         fprintf(stdout, "%s", buf);
19292         fflush(NULL);
19293         if (i == -1)
19294             return 0;
19295         bp = buf;
19296     }
19297 }
19298 EOCP
19299                 fflushNULL="$define"
19300                 set tryp
19301                 if eval $compile; then
19302                     $rm -f tryp.out
19303                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19304                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19305                        $cat >&4 <<EOM
19306 fflush(NULL) seems to behave okay with input streams.
19307 EOM
19308                         fflushNULL="$define"
19309                     else
19310                         $cat >&4 <<EOM
19311 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19312 EOM
19313                         fflushNULL="$undef"
19314                     fi
19315                 fi
19316                 $rm -f core tryp.c tryp.core core.tryp.*
19317                 ;;
19318         '')     $cat >&4 <<EOM
19319 Your fflush(NULL) isn't working (contrary to ANSI C).
19320 EOM
19321                 fflushNULL="$undef"
19322                 ;;
19323         *)      $cat >&4 <<EOM
19324 Cannot figure out whether your fflush(NULL) works or not.
19325 I'm assuming it doesn't (contrary to ANSI C).
19326 EOM
19327                 fflushNULL="$undef"
19328                 ;;
19329         esac
19330         ;;
19331 $define|true|[yY]*)
19332         fflushNULL="$define"
19333         ;;
19334 *)
19335         fflushNULL="$undef"
19336         ;;
19337 esac
19338 : check explicit looping only if NULL did not work, and if the pipe
19339 : bug does not show up on an explicit flush too
19340 case "$fflushNULL" in
19341 "$undef")
19342         $cat >tryp.c <<EOCP
19343 #include <stdio.h>
19344 int
19345 main(int argc, char **argv)
19346 {
19347     char buf[1024];
19348     int i;
19349     char *bp = buf;
19350     while (1) {
19351         while ((i = getc(stdin)) != -1
19352                && (*bp++ = i) != '\n'
19353                && bp < &buf[1024])
19354         /* DO NOTHING */ ;
19355         *bp = '\0';
19356         fprintf(stdout, "%s", buf);
19357         fflush(stdin);
19358         if (i == -1)
19359             return 0;
19360         bp = buf;
19361     }
19362 }
19363 EOCP
19364         set tryp
19365         if eval $compile; then
19366             $rm -f tryp.out
19367             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19368             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19369                $cat >&4 <<EOM
19370 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19371 EOM
19372                 : now check for fflushall behaviour
19373                 case "$fflushall" in
19374                 '')     set try -DTRY_FFLUSH_ALL $output
19375                         if eval $compile; then
19376                                 $cat >&4 <<EOM
19377 (Now testing the other method--but note that this also may fail.)
19378 EOM
19379                                 $run ./try 2>/dev/null
19380                                 code=$?
19381                                 $from try.out
19382                                 if $test -s try.out -a "X$code" = X42; then
19383                                         fflushall="`$cat try.out`"
19384                                 fi
19385                         fi
19386                         $rm_try
19387                         case "$fflushall" in
19388                         x)      $cat >&4 <<EOM
19389 Whew. Flushing explicitly all the stdio streams works.
19390 EOM
19391                                 fflushall="$define"
19392                                 ;;
19393                         '')     $cat >&4 <<EOM
19394 Sigh. Flushing explicitly all the stdio streams doesn't work.
19395 EOM
19396                                 fflushall="$undef"
19397                                 ;;
19398                         *)      $cat >&4 <<EOM
19399 Cannot figure out whether flushing stdio streams explicitly works or not.
19400 I'm assuming it doesn't.
19401 EOM
19402                                 fflushall="$undef"
19403                                 ;;
19404                         esac
19405                         ;;
19406                 "$define"|true|[yY]*)
19407                         fflushall="$define"
19408                         ;;
19409                 *)
19410                         fflushall="$undef"
19411                         ;;
19412                 esac
19413             else
19414                 $cat >&4 <<EOM
19415 All is futile.  Even fflush(stdin) clobbers input pipes!
19416 EOM
19417                 fflushall="$undef"
19418             fi
19419         else
19420             fflushall="$undef"
19421         fi
19422         $rm -f core tryp.c tryp.core core.tryp.*
19423         ;;
19424 *)      fflushall="$undef"
19425         ;;
19426 esac
19427
19428 case "$fflushNULL$fflushall" in
19429 undefundef)
19430         $cat <<EOM
19431 OK, I give up.  I cannot figure out how to flush pending stdio output.
19432 We won't be flushing handles at all before fork/exec/popen.
19433 EOM
19434         ;;
19435 esac
19436 $rm_try tryp
19437
19438 : Store the full pathname to the ar program for use in the C program
19439 : Respect a hint or command line value for full_ar.
19440 case "$full_ar" in
19441 '') full_ar=$ar ;;
19442 esac
19443
19444 : Store the full pathname to the sed program for use in the C program
19445 full_sed=$sed
19446
19447 : see what type gids are declared as in the kernel
19448 echo " "
19449 echo "Looking for the type for group ids returned by getgid()."
19450 set gid_t gidtype xxx stdio.h sys/types.h
19451 eval $typedef
19452 case "$gidtype" in
19453 xxx)
19454         xxx=`./findhdr sys/user.h`
19455         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19456         case $1 in
19457         unsigned) dflt="$1 $2" ;;
19458         *) dflt="$1" ;;
19459         esac
19460         ;;
19461 *) dflt="$gidtype";;
19462 esac
19463 case "$gidtype" in
19464 gid_t) echo "gid_t found." ;;
19465 *)      rp="What is the type for group ids returned by getgid()?"
19466         . ./myread
19467         gidtype="$ans"
19468         ;;
19469 esac
19470
19471 : Check the size of GID
19472 echo " "
19473 case "$gidtype" in
19474 *_t) zzz="$gidtype"     ;;
19475 *)   zzz="gid"          ;;
19476 esac
19477 echo "Checking the size of $zzz..." >&4
19478 cat > try.c <<EOCP
19479 #include <sys/types.h>
19480 #include <stdio.h>
19481 #$i_stdlib I_STDLIB
19482 #ifdef I_STDLIB
19483 #include <stdlib.h>
19484 #endif
19485 int main() {
19486     printf("%d\n", (int)sizeof($gidtype));
19487     exit(0);
19488 }
19489 EOCP
19490 set try
19491 if eval $compile_ok; then
19492         yyy=`$run ./try`
19493         case "$yyy" in
19494         '')     gidsize=4
19495                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19496                 ;;
19497         *)      gidsize=$yyy
19498                 echo "Your $zzz is $gidsize bytes long."
19499                 ;;
19500         esac
19501 else
19502         gidsize=4
19503         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19504 fi
19505
19506
19507 : Check if GID is signed
19508 echo " "
19509 case "$gidtype" in
19510 *_t) zzz="$gidtype"     ;;
19511 *)   zzz="gid"          ;;
19512 esac
19513 echo "Checking the sign of $zzz..." >&4
19514 cat > try.c <<EOCP
19515 #include <sys/types.h>
19516 #include <stdio.h>
19517 int main() {
19518         $gidtype foo = -1;
19519         if (foo < 0)
19520                 printf("-1\n");
19521         else
19522                 printf("1\n");
19523 }
19524 EOCP
19525 set try
19526 if eval $compile; then
19527         yyy=`$run ./try`
19528         case "$yyy" in
19529         '')     gidsign=1
19530                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19531                 ;;
19532         *)      gidsign=$yyy
19533                 case "$gidsign" in
19534                  1) echo "Your $zzz is unsigned." ;;
19535                 -1) echo "Your $zzz is signed."   ;;
19536                 esac
19537                 ;;
19538         esac
19539 else
19540         gidsign=1
19541         echo "(I can't compile the test program--guessing unsigned.)" >&4
19542 fi
19543
19544
19545 : Check 64bit sizes
19546 echo " "
19547
19548 if $test X"$quadtype" != X; then
19549
19550 echo "Checking how to print 64-bit integers..." >&4
19551
19552 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19553         $cat >try.c <<'EOCP'
19554 #include <sys/types.h>
19555 #include <stdio.h>
19556 int main() {
19557   int q = 12345678901;
19558   printf("%ld\n", q);
19559 }
19560 EOCP
19561         set try
19562         if eval $compile; then
19563                 yyy=`$run ./try`
19564                 case "$yyy" in
19565                 12345678901)
19566                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19567                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19568                         echo "We will use %d."
19569                         ;;
19570                 esac
19571         fi
19572 fi
19573
19574 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19575         $cat >try.c <<'EOCP'
19576 #include <sys/types.h>
19577 #include <stdio.h>
19578 int main() {
19579   long q = 12345678901;
19580   printf("%ld\n", q);
19581 }
19582 EOCP
19583         set try
19584         if eval $compile; then
19585                 yyy=`$run ./try`
19586                 case "$yyy" in
19587                 12345678901)
19588                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19589                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19590                         echo "We will use %ld."
19591                         ;;
19592                 esac
19593         fi
19594 fi
19595
19596 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19597         $cat >try.c <<'EOCP'
19598 #include <sys/types.h>
19599 #include <inttypes.h>
19600 #include <stdio.h>
19601 int main() {
19602   int64_t q = 12345678901;
19603   printf("%" PRId64 "\n", q);
19604 }
19605 EOCP
19606         set try
19607         if eval $compile; then
19608                 yyy=`$run ./try`
19609                 case "$yyy" in
19610                 12345678901)
19611                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19612                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19613                         echo "We will use the C9X style."
19614                         ;;
19615                 esac
19616         fi
19617 fi
19618
19619 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19620         $cat >try.c <<EOCP
19621 #include <sys/types.h>
19622 #include <stdio.h>
19623 int main() {
19624   $quadtype q = 12345678901;
19625   printf("%Ld\n", q);
19626 }
19627 EOCP
19628         set try
19629         if eval $compile; then
19630                 yyy=`$run ./try`
19631                 case "$yyy" in
19632                 12345678901)
19633                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19634                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19635                         echo "We will use %Ld."
19636                         ;;
19637                 esac
19638         fi
19639 fi
19640
19641 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19642         $cat >try.c <<'EOCP'
19643 #include <sys/types.h>
19644 #include <stdio.h>
19645 int main() {
19646   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19647   printf("%lld\n", q);
19648 }
19649 EOCP
19650         set try
19651         if eval $compile; then
19652                 yyy=`$run ./try`
19653                 case "$yyy" in
19654                 12345678901)
19655                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19656                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19657                         echo "We will use the %lld style."
19658                         ;;
19659                 esac
19660         fi
19661 fi
19662
19663 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19664         $cat >try.c <<EOCP
19665 #include <sys/types.h>
19666 #include <stdio.h>
19667 int main() {
19668   $quadtype q = 12345678901;
19669   printf("%qd\n", q);
19670 }
19671 EOCP
19672         set try
19673         if eval $compile; then
19674                 yyy=`$run ./try`
19675                 case "$yyy" in
19676                 12345678901)
19677                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19678                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19679                         echo "We will use %qd."
19680                         ;;
19681                 esac
19682         fi
19683 fi
19684
19685 if $test X"$sPRId64" = X; then
19686         echo "Cannot figure out how to print 64-bit integers." >&4
19687 fi
19688 $rm_try
19689
19690 fi
19691
19692 case "$sPRId64" in
19693 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19694         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19695         ;;
19696 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19697         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19698         ;;
19699 esac
19700
19701 : Check format strings for internal types
19702 echo " "
19703 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19704
19705 if $test X"$ivsize" = X8; then
19706         ivdformat="$sPRId64"
19707         uvuformat="$sPRIu64"
19708         uvoformat="$sPRIo64"
19709         uvxformat="$sPRIx64"
19710         uvXUformat="$sPRIXU64"
19711 else
19712         if $test X"$ivsize" = X"$longsize"; then
19713                 ivdformat='"ld"'
19714                 uvuformat='"lu"'
19715                 uvoformat='"lo"'
19716                 uvxformat='"lx"'
19717                 uvXUformat='"lX"'
19718         else
19719                 if $test X"$ivsize" = X"$intsize"; then
19720                         ivdformat='"d"'
19721                         uvuformat='"u"'
19722                         uvoformat='"o"'
19723                         uvxformat='"x"'
19724                         uvXUformat='"X"'
19725                 else
19726                         : far out
19727                         if $test X"$ivsize" = X"$shortsize"; then
19728                                 ivdformat='"hd"'
19729                                 uvuformat='"hu"'
19730                                 uvoformat='"ho"'
19731                                 uvxformat='"hx"'
19732                                 uvXUformat='"hX"'
19733                         fi
19734                 fi
19735         fi
19736 fi
19737
19738 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19739         nveformat="$sPRIeldbl"
19740         nvfformat="$sPRIfldbl"
19741         nvgformat="$sPRIgldbl"
19742         nvEUformat="$sPRIEUldbl"
19743         nvFUformat="$sPRIFUldbl"
19744         nvGUformat="$sPRIGUldbl"
19745 else
19746         nveformat='"e"'
19747         nvfformat='"f"'
19748         nvgformat='"g"'
19749         nvEUformat='"E"'
19750         nvFUformat='"F"'
19751         nvGUformat='"G"'
19752 fi
19753
19754 case "$ivdformat" in
19755 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19756     exit 1
19757     ;;
19758 esac
19759
19760 : Check format string for GID
19761
19762 echo " "
19763 $echo "Checking the format string to be used for gids..." >&4
19764
19765 case "$gidsign" in
19766 -1)     if $test X"$gidsize" = X"$ivsize"; then
19767                 gidformat="$ivdformat"
19768         else
19769                 if $test X"$gidsize" = X"$longsize"; then
19770                         gidformat='"ld"'
19771                 else
19772                         if $test X"$gidsize" = X"$intsize"; then
19773                                 gidformat='"d"'
19774                         else
19775                                 if $test X"$gidsize" = X"$shortsize"; then
19776                                         gidformat='"hd"'
19777                                 fi
19778                         fi
19779                 fi
19780         fi
19781         ;;
19782 *)      if $test X"$gidsize" = X"$uvsize"; then
19783                 gidformat="$uvuformat"
19784         else
19785                 if $test X"$gidsize" = X"$longsize"; then
19786                         gidformat='"lu"'
19787                 else
19788                         if $test X"$gidsize" = X"$intsize"; then
19789                                 gidformat='"u"'
19790                         else
19791                                 if $test X"$gidsize" = X"$shortsize"; then
19792                                         gidformat='"hu"'
19793                                 fi
19794                         fi
19795                 fi
19796         fi
19797         ;;
19798 esac
19799
19800 : see if getgroups exists
19801 set getgroups d_getgrps
19802 eval $inlibc
19803
19804 : see if setgroups exists
19805 set setgroups d_setgrps
19806 eval $inlibc
19807
19808 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19809 echo " "
19810 case "$d_getgrps$d_setgrps" in
19811 *define*)
19812         case "$groupstype" in
19813         '') dflt="$gidtype" ;;
19814         *)  dflt="$groupstype" ;;
19815         esac
19816         $cat <<EOM
19817 What type of pointer is the second argument to getgroups() and setgroups()?
19818 Usually this is the same as group ids, $gidtype, but not always.
19819
19820 EOM
19821         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19822         . ./myread
19823         groupstype="$ans"
19824         ;;
19825 *)  groupstype="$gidtype";;
19826 esac
19827
19828 : MAD = Misc Attribute Definition
19829
19830 if $test $patchlevel -lt 9; then
19831 : MAD is not available in 5.8.x or earlier.
19832     ans=n;
19833 else
19834     case "$mad" in
19835     $define|true|[yY]*) dflt='y' ;;
19836     *)                  dflt='n' ;;
19837     esac
19838     cat <<EOM
19839
19840 Would you like to build with Misc Attribute Decoration? This is development
19841 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19842 overhead on the interpreter.
19843
19844 If this doesn't make any sense to you, just accept the default '$dflt'.
19845 EOM
19846     rp='Build Perl with MAD?'
19847     . ./myread
19848 fi
19849 case "$ans" in
19850 y|Y)    val="$define"
19851         madlyh='madly.h madly.act madly.tab'
19852         madlysrc='madly.c'
19853         madlyobj="madly$_o" ;;
19854 *)      val="$undef"
19855         madlyh=''
19856         madlysrc=''
19857         madlyobj='' ;;
19858 esac
19859 set mad
19860 eval $setvar
19861
19862 : check whether make sets MAKE
19863 echo " "
19864 echo "Checking if your $make program sets \$(MAKE)..." >&4
19865 case "$make_set_make" in
19866 '')
19867         $sed 's/^X //' > testmake.mak << 'EOF'
19868 Xall:
19869 X       @echo 'maketemp="$(MAKE)"'
19870 EOF
19871         case "`$make -f testmake.mak 2>/dev/null`" in
19872         *maketemp=*) make_set_make='#' ;;
19873         *)      make_set_make="MAKE=$make" ;;
19874         esac
19875         $rm -f testmake.mak
19876         ;;
19877 esac
19878 case "$make_set_make" in
19879 '#') echo "Yup, it does.";;
19880 *) echo "Nope, it doesn't.";;
19881 esac
19882
19883 : see what type is used for mode_t
19884 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19885 set mode_t modetype int stdio.h sys/types.h
19886 eval $typedef_ask
19887
19888 : see if we need va_copy
19889 echo " "
19890 case "$i_stdarg" in
19891 "$define")
19892         $cat >try.c <<EOCP
19893 #include <stdarg.h>
19894 #include <stdio.h>
19895 #$i_stdlib I_STDLIB
19896 #ifdef I_STDLIB
19897 #include <stdlib.h>
19898 #endif
19899 #include <signal.h>
19900
19901 int
19902 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19903 {
19904   return vfprintf(f, fmt, *valp);
19905 }
19906
19907 int
19908 myvfprintf(FILE *f, const  char *fmt, va_list val)
19909 {
19910   return ivfprintf(f, fmt, &val);
19911 }
19912
19913 int
19914 myprintf(char *fmt, ...)
19915 {
19916   va_list val;
19917   va_start(val, fmt);
19918   return myvfprintf(stdout, fmt, val);
19919 }
19920
19921 int
19922 main(int ac, char **av)
19923 {
19924   signal(SIGSEGV, exit);
19925
19926   myprintf("%s%cs all right, then\n", "that", '\'');
19927   exit(0);
19928 }
19929 EOCP
19930         set try
19931         if eval $compile && $run ./try 2>&1 >/dev/null; then
19932                 case "`$run ./try`" in
19933                 "that's all right, then")
19934                         okay=yes
19935                         ;;
19936                 esac
19937         fi
19938         case "$okay" in
19939         yes)    echo "It seems that you don't need va_copy()." >&4
19940                 need_va_copy="$undef"
19941                 ;;
19942         *)      echo "It seems that va_copy() or similar will be needed." >&4
19943                 need_va_copy="$define"
19944                 ;;
19945         esac
19946         $rm_try
19947         ;;
19948 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19949         ;;
19950 esac
19951
19952 : see what type is used for size_t
19953 rp="What is the type used for the length parameter for string functions?"
19954 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19955 eval $typedef_ask
19956
19957 : check for type of arguments to gethostbyaddr. 
19958 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19959         case "$d_gethbyaddr" in
19960         $define)
19961                 $cat <<EOM
19962
19963 Checking to see what type of arguments are accepted by gethostbyaddr().
19964 EOM
19965                 hdrs="$define sys/types.h
19966                         $d_socket sys/socket.h 
19967                         $i_niin netinet/in.h 
19968                         $i_netdb netdb.h
19969                         $i_unistd unistd.h"
19970                 : The first arg can 'char *' or 'void *'
19971                 : The second arg is some of integral type
19972                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19973                         for yyy in size_t long int; do
19974                                 case "$netdb_host_type" in
19975                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
19976                                         if ./protochk "$try" $hdrs; then
19977                                                 echo "Your system accepts $xxx for the first arg."
19978                                                 echo "...and $yyy for the second arg."
19979                                                 netdb_host_type="$xxx"
19980                                                 netdb_hlen_type="$yyy"
19981                                         fi
19982                                         ;;
19983                                 esac
19984                         done
19985                 done
19986                 : In case none of those worked, prompt the user.
19987                 case "$netdb_host_type" in
19988                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19989                         dflt='char *'
19990                         . ./myread
19991                         netdb_host_type=$ans
19992                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19993                         dflt="$sizetype"
19994                         . ./myread
19995                         netdb_hlen_type=$ans
19996                         ;;
19997                 esac
19998                 ;;
19999         *)      : no gethostbyaddr, so pick harmless defaults
20000                 netdb_host_type='char *'
20001                 netdb_hlen_type="$sizetype"
20002                 ;;
20003         esac
20004         # Remove the "const" if needed. -- but then we'll have a 
20005         # prototype clash!
20006         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20007 fi
20008
20009 : check for type of argument to gethostbyname. 
20010 if test "X$netdb_name_type" = X ; then
20011         case "$d_gethbyname" in
20012         $define)
20013                 $cat <<EOM
20014
20015 Checking to see what type of argument is accepted by gethostbyname().
20016 EOM
20017                 hdrs="$define sys/types.h
20018                         $d_socket sys/socket.h 
20019                         $i_niin netinet/in.h 
20020                         $i_netdb netdb.h
20021                         $i_unistd unistd.h"
20022                 for xxx in "const char *" "char *"; do
20023                         case "$netdb_name_type" in
20024                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20025                                 if ./protochk "$try" $hdrs; then
20026                                         echo "Your system accepts $xxx."
20027                                         netdb_name_type="$xxx"
20028                                 fi
20029                                 ;;
20030                         esac
20031                 done
20032                 : In case none of those worked, prompt the user.
20033                 case "$netdb_name_type" in
20034                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20035                         dflt='char *'
20036                         . ./myread
20037                         netdb_name_type=$ans
20038                         ;;
20039                 esac
20040                 ;;
20041         *)      : no gethostbyname, so pick harmless default
20042                 netdb_name_type='char *'
20043                 ;;
20044         esac
20045 fi
20046
20047 : check for type of 1st argument to getnetbyaddr. 
20048 if test "X$netdb_net_type" = X ; then
20049         case "$d_getnbyaddr" in
20050         $define)
20051                 $cat <<EOM
20052
20053 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20054 EOM
20055                 hdrs="$define sys/types.h
20056                         $d_socket sys/socket.h 
20057                         $i_niin netinet/in.h 
20058                         $i_netdb netdb.h
20059                         $i_unistd unistd.h"
20060                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20061                         case "$netdb_net_type" in
20062                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20063                                 if ./protochk "$try" $hdrs; then
20064                                         echo "Your system accepts $xxx."
20065                                         netdb_net_type="$xxx"
20066                                 fi
20067                                 ;;
20068                         esac
20069                 done
20070                 : In case none of those worked, prompt the user.
20071                 case "$netdb_net_type" in
20072                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20073                         dflt='long'
20074                         . ./myread
20075                         netdb_net_type=$ans
20076                         ;;
20077                 esac
20078                 ;;
20079         *)      : no getnetbyaddr, so pick harmless default
20080                 netdb_net_type='long'
20081                 ;;
20082         esac
20083 fi
20084 : locate the preferred pager for this system
20085 fn=f/
20086 case "$pager" in
20087 '')
20088         dflt=''
20089         case "$pg" in
20090         /*) dflt=$pg;;
20091         [a-zA-Z]:/*) dflt=$pg;;
20092         esac
20093         case "$more" in
20094         /*) dflt=$more;;
20095         [a-zA-Z]:/*) dflt=$more;;
20096         esac
20097         case "$less" in
20098         /*) dflt=$less;;
20099         [a-zA-Z]:/*) dflt=$less;;
20100         esac
20101         case "$dflt" in
20102         '') dflt=/usr/ucb/more;;
20103         esac
20104         ;;
20105 *)      dflt="$pager"
20106         fn="f/($pager)"
20107         ;;
20108 esac
20109 echo " "
20110 rp='What pager is used on your system?'
20111 . ./getfile
20112 pager="$ans"
20113
20114 : see what type pids are declared as in the kernel
20115 rp="What is the type of process ids on this system?"
20116 set pid_t pidtype int stdio.h sys/types.h
20117 eval $typedef_ask
20118
20119 : see if ar generates random libraries by itself
20120 echo " "
20121 echo "Checking how to generate random libraries on your machine..." >&4
20122 echo 'int bar1() { return bar2(); }' > bar1.c
20123 echo 'int bar2() { return 2; }' > bar2.c
20124 $cat > foo.c <<EOP
20125 #$i_stdlib I_STDLIB
20126 #ifdef I_STDLIB
20127 #include <stdlib.h>
20128 #endif
20129 int main() { printf("%d\n", bar1()); exit(0); }
20130 EOP
20131 $cc $ccflags -c bar1.c >/dev/null 2>&1
20132 $cc $ccflags -c bar2.c >/dev/null 2>&1
20133 $cc $ccflags -c foo.c >/dev/null 2>&1
20134 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20135 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20136         $run ./foobar >/dev/null 2>&1; then
20137         echo "$ar appears to generate random libraries itself."
20138         orderlib=false
20139         if [ "X$ranlib" = "X" ]; then
20140             ranlib=":"
20141         fi
20142 elif $ar s bar$_a >/dev/null 2>&1 &&
20143         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20144         $run ./foobar >/dev/null 2>&1; then
20145                 echo "a table of contents needs to be added with '$ar s'."
20146                 orderlib=false
20147                 ranlib="$ar s"
20148 elif $ar ts bar$_a >/dev/null 2>&1 &&
20149         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20150         $run ./foobar >/dev/null 2>&1; then
20151                 echo "a table of contents needs to be added with '$ar ts'."
20152                 orderlib=false
20153                 ranlib="$ar ts"
20154 else
20155         case "$ranlib" in
20156         :) ranlib='';;
20157         '')
20158                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20159                 $test -f $ranlib || ranlib=''
20160                 ;;
20161         esac
20162         if $test -n "$ranlib"; then
20163                 echo "your system has '$ranlib'; we'll use that."
20164                 orderlib=false
20165         else
20166                 echo "your system doesn't seem to support random libraries"
20167                 echo "so we'll use lorder and tsort to order the libraries."
20168                 orderlib=true
20169                 ranlib=":"
20170         fi
20171 fi
20172 $rm -f foo* bar*
20173
20174 : see if this is a values.h system
20175 set values.h i_values
20176 eval $inhdr
20177
20178 : Check the max offset that gmtime and localtime accept
20179 echo "Checking max offsets that gmtime () accepts"
20180
20181 case $i_values in
20182     define) yyy="#include <values.h>" ;;
20183     *)      yyy="" ;;
20184     esac
20185
20186 case "$sGMTIME_min/$sGMTIME_max" in
20187     0/0|/)
20188         $cat >try.c <<EOCP
20189 #include <sys/types.h>
20190 #include <stdio.h>
20191 #include <time.h>
20192 $yyy
20193
20194 int i;
20195 struct tm *tmp;
20196 time_t pt;
20197
20198 void gm_check (time_t t, int min_year, int max_year)
20199 {
20200     tmp = gmtime (&t);
20201     if ( tmp == NULL ||
20202         /* Check tm_year overflow */
20203          tmp->tm_year < min_year || tmp->tm_year > max_year)
20204         tmp = NULL;
20205     else
20206         pt = t;
20207     } /* gm_check */
20208
20209 int check_max ()
20210 {
20211     tmp = NULL;
20212     pt  = 0;
20213 #ifdef MAXLONG
20214     gm_check (MAXLONG, 69, 0x7fffffff);
20215 #endif
20216     if (tmp == NULL || tmp->tm_year < 0) {
20217         for (i = 63; i >= 0; i--) {
20218             time_t x = pt | ((time_t)1 << i);
20219             if (x < 0 || x < pt) continue;
20220             gm_check (x, 69, 0x7fffffff);
20221             }
20222         }
20223     printf ("sGMTIME_max=%ld\n", pt);
20224     return (0);
20225     } /* check_max */
20226
20227 int check_min ()
20228 {
20229     tmp = NULL;
20230     pt  = 0;
20231 #ifdef MINLONG
20232     gm_check (MINLONG, -1900, 70);
20233 #endif
20234     if (tmp == NULL) {
20235         for (i = 36; i >= 0; i--) {
20236             time_t x = pt - ((time_t)1 << i);
20237             if (x > 0) continue;
20238             gm_check (x, -1900, 70);
20239             }
20240         }
20241     printf ("sGMTIME_min=%ld\n", pt);
20242     return (0);
20243     } /* check_min */
20244
20245 int main (int argc, char *argv[])
20246 {
20247     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20248     check_max ();
20249     check_min ();
20250     return (0);
20251     } /* main */
20252 EOCP
20253         set try
20254         if eval $compile; then
20255             eval `$run ./try`
20256         else
20257             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20258             fi
20259         $rm_try
20260         ;;
20261     esac
20262
20263 echo "Checking max offsets that localtime () accepts"
20264
20265 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20266     0/0|/)
20267         $cat >try.c <<EOCP
20268 #include <sys/types.h>
20269 #include <stdio.h>
20270 #include <time.h>
20271 $yyy
20272
20273 int i;
20274 struct tm *tmp;
20275 time_t pt;
20276
20277 void local_check (time_t t, int min_year, int max_year)
20278 {
20279     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20280         tmp = NULL;
20281     else
20282         tmp = localtime (&t);
20283     if ( tmp == NULL ||
20284         /* Check tm_year overflow */
20285          tmp->tm_year < min_year || tmp->tm_year > max_year)
20286         tmp = NULL;
20287     else
20288         pt = t;
20289     } /* local_check */
20290
20291 int check_max ()
20292 {
20293     tmp = NULL;
20294     pt  = 0;
20295 #ifdef MAXLONG
20296     local_check (MAXLONG, 69, 0x7fffffff);
20297 #endif
20298     if (tmp == NULL || tmp->tm_year < 0) {
20299         for (i = 63; i >= 0; i--) {
20300             time_t x = pt | ((time_t)1 << i);
20301             if (x < 0 || x < pt) continue;
20302             local_check (x, 69, 0x7fffffff);
20303             }
20304         }
20305     printf ("sLOCALTIME_max=%ld\n", pt);
20306     return (0);
20307    } /* check_max */
20308
20309 int check_min ()
20310 {
20311     tmp = NULL;
20312     pt  = 0;
20313 #ifdef MINLONG
20314     local_check (MINLONG, -1900, 70);
20315 #endif
20316     if (tmp == NULL) {
20317         for (i = 36; i >= 0; i--) {
20318             time_t x = pt - ((time_t)1 << i);
20319             if (x > 0) continue;
20320             local_check (x, -1900, 70);
20321             }
20322         }
20323     printf ("sLOCALTIME_min=%ld\n", pt);
20324     return (0);
20325     } /* check_min */
20326
20327 int main (int argc, char *argv[])
20328 {
20329     check_max ();
20330     check_min ();
20331     return (0);
20332     } /* main */
20333 EOCP
20334         set try
20335         if eval $compile; then
20336             eval `$run ./try`
20337         else
20338             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20339             fi
20340         $rm_try
20341         ;;
20342     esac
20343
20344 : check for type of arguments to select.
20345 case "$selecttype" in
20346 '') case "$d_select" in
20347         $define)
20348                 echo " "
20349                 $cat <<EOM
20350 Checking to see what type of arguments are accepted by select().
20351 EOM
20352                 hdrs="$define sys/types.h
20353                         $i_systime sys/time.h
20354                         $i_sysselct sys/select.h
20355                         $d_socket sys/socket.h"
20356                 : The first arg can be int, unsigned, or size_t
20357                 : The last arg may or may not be 'const'
20358                 val=''
20359                 : void pointer has been seen but using that
20360                 : breaks the selectminbits test
20361                 for xxx in 'fd_set *' 'int *'; do
20362                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20363                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20364                                         case "$val" in
20365                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20366                                                 if ./protochk "$try" $hdrs; then
20367                                                         echo "Your system accepts $xxx."
20368                                                         val="$xxx"
20369                                                 fi
20370                                                 ;;
20371                                         esac
20372                                 done
20373                         done
20374                 done
20375                 case "$val" in
20376                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20377                         case "$d_fd_set" in
20378                                 $define) dflt="fd_set *" ;;
20379                                 *)              dflt="int *" ;;
20380                         esac
20381                         . ./myread
20382                         val=$ans
20383                         ;;
20384                 esac
20385                 selecttype="$val"
20386                 ;;
20387         *)      : no select, so pick a harmless default
20388                 selecttype='int *'
20389                 ;;
20390         esac
20391         ;;
20392 esac
20393
20394 : check for the select 'width'
20395 case "$selectminbits" in
20396 '') safebits=`expr $ptrsize \* 8`
20397     case "$d_select" in
20398         $define)
20399                 $cat <<EOM
20400
20401 Checking to see on how many bits at a time your select() operates...
20402 EOM
20403                 $cat >try.c <<EOCP
20404 #include <sys/types.h>
20405 #$i_time I_TIME
20406 #$i_systime I_SYS_TIME
20407 #$i_systimek I_SYS_TIME_KERNEL
20408 #ifdef I_TIME
20409 #   include <time.h>
20410 #endif
20411 #ifdef I_SYS_TIME
20412 #   ifdef I_SYS_TIME_KERNEL
20413 #       define KERNEL
20414 #   endif
20415 #   include <sys/time.h>
20416 #   ifdef I_SYS_TIME_KERNEL
20417 #       undef KERNEL
20418 #   endif
20419 #endif
20420 #$i_sysselct I_SYS_SELECT
20421 #ifdef I_SYS_SELECT
20422 #include <sys/select.h>
20423 #endif
20424 #$d_socket HAS_SOCKET
20425 #ifdef HAS_SOCKET
20426 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20427 #endif
20428 #include <stdio.h>
20429 #$i_stdlib I_STDLIB
20430 #ifdef I_STDLIB
20431 #include <stdlib.h>
20432 #endif
20433 $selecttype b;
20434 #define S sizeof(*(b))
20435 #define MINBITS 64
20436 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20437 #define NBITS  (NBYTES * 8)
20438 int main() {
20439     char *s = (char *)malloc(NBYTES);
20440     struct timeval t;
20441     int i;
20442     FILE* fp;
20443     int fd;
20444
20445     if (!s)
20446         exit(1);
20447     fclose(stdin);
20448     fp = fopen("try.c", "r");
20449     if (fp == 0)
20450       exit(2);
20451     fd = fileno(fp);
20452     if (fd < 0)
20453       exit(3);
20454     b = ($selecttype)s;
20455     for (i = 0; i < NBITS; i++)
20456         FD_SET(i, b);
20457     t.tv_sec  = 0;
20458     t.tv_usec = 0;
20459     select(fd + 1, b, 0, 0, &t);
20460     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20461     free(s);
20462     printf("%d\n", i + 1);
20463     return 0;
20464 }
20465 EOCP
20466                 set try
20467                 if eval $compile_ok; then
20468                         selectminbits=`$run ./try`
20469                         case "$selectminbits" in
20470                         '')     cat >&4 <<EOM
20471 Cannot figure out on how many bits at a time your select() operates.
20472 I'll play safe and guess it is $safebits bits.
20473 EOM
20474                                 selectminbits=$safebits
20475                                 bits="$safebits bits"
20476                                 ;;
20477                         1)      bits="1 bit" ;;
20478                         *)      bits="$selectminbits bits" ;;
20479                         esac
20480                         echo "Your select() operates on $bits at a time." >&4
20481                 else
20482                         rp='What is the minimum number of bits your select() operates on?'
20483                         case "$byteorder" in
20484                         12345678)       dflt=64 ;;
20485                         1234)           dflt=32 ;;
20486                         *)              dflt=1  ;;
20487                         esac
20488                         . ./myread
20489                         val=$ans
20490                         selectminbits="$val"
20491                 fi
20492                 $rm_try
20493                 ;;
20494         *)      : no select, so pick a harmless default
20495                 selectminbits=$safebits
20496                 ;;
20497         esac
20498         ;;
20499 esac
20500
20501 : Trace out the files included by signal.h, then look for SIGxxx names.
20502 if [ "X$fieldn" = X ]; then
20503         : Just make some guesses.  We check them later.
20504         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20505 else
20506         xxx=`echo '#include <signal.h>' |
20507         $cppstdin $cppminus $cppflags 2>/dev/null |
20508         $grep '^[       ]*#.*include' |
20509         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20510                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20511 fi
20512 xxxfiles=''
20513 for xx in $xxx /dev/null ; do
20514         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20515 done
20516 case "$xxxfiles" in
20517 '')     xxxfiles=`./findhdr signal.h` ;;
20518 esac
20519 xxx=`awk '
20520 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20521         print substr($2, 4, 20)
20522 }
20523 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20524         print substr($3, 4, 20)
20525 }' $xxxfiles`
20526 : Append some common names just in case the awk scan failed.
20527 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20528 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20529 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20530 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20531 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20532
20533 : generate a few handy files for later
20534 $cat > signal.c <<EOCP
20535 #include <sys/types.h>
20536 #include <signal.h>
20537 #$i_stdlib I_STDLIB
20538 #ifdef I_STDLIB
20539 #include <stdlib.h>
20540 #endif
20541 #include <stdio.h>
20542 int main() {
20543
20544 /* Strange style to avoid deeply-nested #if/#else/#endif */
20545 #ifndef NSIG
20546 #  ifdef _NSIG
20547 #    define NSIG (_NSIG)
20548 #  endif
20549 #endif
20550
20551 #ifndef NSIG
20552 #  ifdef SIGMAX
20553 #    define NSIG (SIGMAX+1)
20554 #  endif
20555 #endif
20556
20557 #ifndef NSIG
20558 #  ifdef SIG_MAX
20559 #    define NSIG (SIG_MAX+1)
20560 #  endif
20561 #endif
20562
20563 #ifndef NSIG
20564 #  ifdef _SIG_MAX
20565 #    define NSIG (_SIG_MAX+1)
20566 #  endif
20567 #endif
20568
20569 #ifndef NSIG
20570 #  ifdef MAXSIG
20571 #    define NSIG (MAXSIG+1)
20572 #  endif
20573 #endif
20574
20575 #ifndef NSIG
20576 #  ifdef MAX_SIG
20577 #    define NSIG (MAX_SIG+1)
20578 #  endif
20579 #endif
20580
20581 #ifndef NSIG
20582 #  ifdef SIGARRAYSIZE
20583 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20584 #  endif
20585 #endif
20586
20587 #ifndef NSIG
20588 #  ifdef _sys_nsig
20589 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20590 #  endif
20591 #endif
20592
20593 /* Default to some arbitrary number that's big enough to get most
20594    of the common signals.
20595 */
20596 #ifndef NSIG
20597 #    define NSIG 50
20598 #endif
20599
20600 printf("NSIG %d\n", NSIG);
20601
20602 #ifndef JUST_NSIG
20603
20604 EOCP
20605
20606 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20607 {
20608         printf "#ifdef SIG"; printf $1; printf "\n"
20609         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20610         printf $1; printf ");\n"
20611         printf "#endif\n"
20612 }
20613 END {
20614         printf "#endif /* JUST_NSIG */\n";
20615         printf "exit(0);\n}\n";
20616 }
20617 ' >>signal.c
20618 $cat >signal.awk <<'EOP'
20619 BEGIN { ndups = 0 }
20620 $1 ~ /^NSIG$/ { nsig = $2 }
20621 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20622     if ($2 > maxsig) { maxsig = $2 }
20623     if (sig_name[$2]) {
20624         dup_name[ndups] = $1
20625         dup_num[ndups] = $2
20626         ndups++
20627     }
20628     else {
20629         sig_name[$2] = $1
20630         sig_num[$2] = $2
20631     }
20632 }
20633 END {
20634     if (nsig == 0) {
20635         nsig = maxsig + 1
20636     }
20637     printf("NSIG %d\n", nsig);
20638     for (n = 1; n < nsig; n++) {
20639         if (sig_name[n]) {
20640             printf("%s %d\n", sig_name[n], sig_num[n])
20641         }
20642         else {
20643             printf("NUM%d %d\n", n, n)
20644         }
20645     }
20646     for (n = 0; n < ndups; n++) {
20647         printf("%s %d\n", dup_name[n], dup_num[n])
20648     }
20649 }
20650 EOP
20651 $cat >signal_cmd <<EOS
20652 $startsh
20653 if $test -s signal.lst; then
20654     echo "Using your existing signal.lst file"
20655         exit 0
20656 fi
20657 xxx="$xxx"
20658 EOS
20659 $cat >>signal_cmd <<'EOS'
20660
20661 set signal
20662 if eval $compile_ok; then
20663         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20664                 $uniq | $awk -f signal.awk >signal.lst
20665 else
20666         echo "(I can't seem be able to compile the whole test program)" >&4
20667         echo "(I'll try it in little pieces.)" >&4
20668         set signal -DJUST_NSIG
20669         if eval $compile_ok; then
20670                 $run ./signal$_exe > signal.nsg
20671                 $cat signal.nsg
20672         else
20673                 echo "I can't seem to figure out how many signals you have." >&4
20674                 echo "Guessing 50." >&4
20675                 echo 'NSIG 50' > signal.nsg
20676         fi
20677         : Now look at all the signal names, one at a time.
20678         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20679                 $cat > signal.c <<EOCP
20680 #include <sys/types.h>
20681 #include <signal.h>
20682 #include <stdio.h>
20683 int main() {
20684 printf("$xx %d\n", SIG${xx});
20685 return 0;
20686 }
20687 EOCP
20688                 set signal
20689                 if eval $compile; then
20690                         echo "SIG${xx} found."
20691                         $run ./signal$_exe  >> signal.ls1
20692                 else
20693                         echo "SIG${xx} NOT found."
20694                 fi
20695         done
20696         if $test -s signal.ls1; then
20697                 $cat signal.nsg signal.ls1 |
20698                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20699         fi
20700
20701 fi
20702 if $test -s signal.lst; then
20703         :
20704 else
20705         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20706         echo 'kill -l' >signal
20707         set X `csh -f <signal`
20708         $rm -f signal
20709         shift
20710         case $# in
20711         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20712         esac
20713         echo $@ | $tr ' ' $trnl | \
20714             $awk '{ printf "%s %d\n", $1, ++s; }
20715                   END { printf "NSIG %d\n", ++s }' >signal.lst
20716 fi
20717 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20718 EOS
20719 chmod a+x signal_cmd
20720 $eunicefix signal_cmd
20721
20722 : generate list of signal names
20723 echo " "
20724 case "$sig_name_init" in
20725 '') doinit=yes ;;
20726 *)  case "$sig_num_init" in
20727     ''|*,*) doinit=yes ;;
20728     esac ;;
20729 esac
20730 case "$doinit" in
20731 yes)
20732         echo "Generating a list of signal names and numbers..." >&4
20733         . ./signal_cmd
20734         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20735         sig_name=`$awk 'BEGIN { printf "ZERO " }
20736                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20737         sig_num=`$awk  'BEGIN { printf "0 " }
20738                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20739         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20740                              !/^NSIG/   { printf "\"%s\", ", $1 }
20741                              END        { printf "0\n" }' signal.lst`
20742         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20743                              !/^NSIG/   { printf "%d, ", $2}
20744                              END        { printf "0\n"}' signal.lst`
20745         ;;
20746 esac
20747 echo "The following $sig_count signals are available:"
20748 echo " "
20749 echo $sig_name | $awk \
20750 'BEGIN { linelen = 0 }
20751 {
20752         for (i = 1; i <= NF; i++) {
20753                 name = "SIG" $i " "
20754                 linelen = linelen + length(name)
20755                 if (linelen > 70) {
20756                         printf "\n"
20757                         linelen = length(name)
20758                 }
20759                 printf "%s", name
20760         }
20761         printf "\n"
20762 }'
20763 sig_size=`echo $sig_name | awk '{print NF}'`
20764 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20765
20766 : Check size of size
20767 echo " "
20768 case "$sizetype" in
20769 *_t) zzz="$sizetype"    ;;
20770 *)   zzz="filesize"     ;;
20771 esac
20772 echo "Checking the size of $zzz..." >&4
20773 cat > try.c <<EOCP
20774 #include <sys/types.h>
20775 #include <stdio.h>
20776 #$i_stdlib I_STDLIB
20777 #ifdef I_STDLIB
20778 #include <stdlib.h>
20779 #endif
20780 int main() {
20781     printf("%d\n", (int)sizeof($sizetype));
20782     exit(0);
20783 }
20784 EOCP
20785 set try
20786 if eval $compile_ok; then
20787         yyy=`$run ./try`
20788         case "$yyy" in
20789         '')     sizesize=4
20790                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20791                 ;;
20792         *)      sizesize=$yyy
20793                 echo "Your $zzz size is $sizesize bytes."
20794                 ;;
20795         esac
20796 else
20797         sizesize=4
20798         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20799 fi
20800
20801
20802 : check for socklen_t
20803 echo " "
20804 echo "Checking to see if you have socklen_t..." >&4
20805 $cat >try.c <<EOCP
20806 #include <sys/types.h>
20807 #$d_socket HAS_SOCKET
20808 #ifdef HAS_SOCKET
20809 #include <sys/socket.h>
20810 #endif
20811 int main() { socklen_t x = 16; }
20812 EOCP
20813 set try
20814 if eval $compile; then
20815         val="$define"
20816         echo "You have socklen_t."
20817 else
20818         val="$undef"
20819         echo "You do not have socklen_t."
20820         case "$sizetype" in
20821         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20822         esac
20823 fi
20824 $rm_try
20825 set d_socklen_t
20826 eval $setvar
20827
20828 : see if this is a socks.h system
20829 set socks.h i_socks
20830 eval $inhdr
20831
20832 : check for type of the size argument to socket calls
20833 case "$d_socket" in
20834 "$define")
20835         $cat <<EOM
20836
20837 Checking to see what type is the last argument of accept().
20838 EOM
20839         yyy=''
20840         case "$d_socklen_t" in
20841         "$define") yyy="$yyy socklen_t"
20842         esac
20843         yyy="$yyy $sizetype int long unsigned"
20844         for xxx in $yyy; do
20845                 case "$socksizetype" in
20846                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
20847                         case "$usesocks" in
20848                         "$define")
20849                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20850                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20851                                         socksizetype="$xxx"
20852                                 fi
20853                                 ;;
20854                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20855                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20856                                         socksizetype="$xxx"
20857                                 fi
20858                                 ;;
20859                         esac
20860                         ;;
20861                 esac
20862         done
20863 : In case none of those worked, prompt the user.
20864         case "$socksizetype" in
20865         '')     rp='What is the type for socket address structure sizes?'
20866                 dflt='int'
20867                 . ./myread
20868                 socksizetype=$ans
20869                 ;;
20870         esac
20871         ;;
20872 *)      : no sockets, so pick relatively harmless default
20873         socksizetype='int'
20874         ;;
20875 esac
20876
20877 : see what type is used for signed size_t
20878 set ssize_t ssizetype int stdio.h sys/types.h
20879 eval $typedef
20880 dflt="$ssizetype"
20881 $cat > try.c <<EOM
20882 #include <stdio.h>
20883 #$i_stdlib I_STDLIB
20884 #ifdef I_STDLIB
20885 #include <stdlib.h>
20886 #endif
20887 #include <sys/types.h>
20888 #define Size_t $sizetype
20889 #define SSize_t $dflt
20890 int main()
20891 {
20892         if (sizeof(Size_t) == sizeof(SSize_t))
20893                 printf("$dflt\n");
20894         else if (sizeof(Size_t) == sizeof(int))
20895                 printf("int\n");
20896         else
20897                 printf("long\n");
20898         exit(0);
20899 }
20900 EOM
20901 echo " "
20902 set try
20903 if eval $compile_ok && $run ./try > /dev/null; then
20904         ssizetype=`$run ./try`
20905         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20906 else
20907         $cat >&4 <<EOM
20908 Help! I can't compile and run the ssize_t test program: please enlighten me!
20909 (This is probably a misconfiguration in your system or libraries, and
20910 you really ought to fix it.  Still, I'll try anyway.)
20911
20912 I need a type that is the same size as $sizetype, but is guaranteed to
20913 be signed.  Common values are ssize_t, int and long.
20914
20915 EOM
20916         rp="What signed type is the same size as $sizetype?"
20917         . ./myread
20918         ssizetype="$ans"
20919 fi
20920 $rm_try
20921
20922 : see what type of char stdio uses.
20923 echo " "
20924 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
20925 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20926         echo "Your stdio uses unsigned chars." >&4
20927         stdchar="unsigned char"
20928 else
20929         echo "Your stdio uses signed chars." >&4
20930         stdchar="char"
20931 fi
20932 $rm -f stdioh
20933
20934 : see what type uids are declared as in the kernel
20935 echo " "
20936 echo "Looking for the type for user ids returned by getuid()."
20937 set uid_t uidtype xxx stdio.h sys/types.h
20938 eval $typedef
20939 case "$uidtype" in
20940 xxx)
20941         xxx=`./findhdr sys/user.h`
20942         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20943         case $1 in
20944         unsigned) dflt="$1 $2" ;;
20945         *) dflt="$1" ;;
20946         esac
20947         ;;
20948 *) dflt="$uidtype";;
20949 esac
20950 case "$uidtype" in
20951 uid_t)  echo "uid_t found." ;;
20952 *)      rp="What is the type for user ids returned by getuid()?"
20953         . ./myread
20954         uidtype="$ans"
20955         ;;
20956 esac
20957
20958 : Check size of UID
20959 echo " "
20960 case "$uidtype" in
20961 *_t) zzz="$uidtype"     ;;
20962 *)   zzz="uid"          ;;
20963 esac
20964 echo "Checking the size of $zzz..." >&4
20965 cat > try.c <<EOCP
20966 #include <sys/types.h>
20967 #include <stdio.h>
20968 #$i_stdlib I_STDLIB
20969 #ifdef I_STDLIB
20970 #include <stdlib.h>
20971 #endif
20972 int main() {
20973     printf("%d\n", (int)sizeof($uidtype));
20974     exit(0);
20975 }
20976 EOCP
20977 set try
20978 if eval $compile_ok; then
20979         yyy=`$run ./try`
20980         case "$yyy" in
20981         '')     uidsize=4
20982                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20983                 ;;
20984         *)      uidsize=$yyy
20985                 echo "Your $zzz is $uidsize bytes long."
20986                 ;;
20987         esac
20988 else
20989         uidsize=4
20990         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20991 fi
20992
20993 : Check if UID is signed
20994 echo " "
20995 case "$uidtype" in
20996 *_t) zzz="$uidtype"     ;;
20997 *)   zzz="uid"          ;;
20998 esac
20999 echo "Checking the sign of $zzz..." >&4
21000 cat > try.c <<EOCP
21001 #include <sys/types.h>
21002 #include <stdio.h>
21003 int main() {
21004         $uidtype foo = -1;
21005         if (foo < 0)
21006                 printf("-1\n");
21007         else
21008                 printf("1\n");
21009 }
21010 EOCP
21011 set try
21012 if eval $compile; then
21013         yyy=`$run ./try`
21014         case "$yyy" in
21015         '')     uidsign=1
21016                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21017                 ;;
21018         *)      uidsign=$yyy
21019                 case "$uidsign" in
21020                  1) echo "Your $zzz is unsigned." ;;
21021                 -1) echo "Your $zzz is signed."   ;;
21022                 esac
21023                 ;;
21024         esac
21025 else
21026         uidsign=1
21027         echo "(I can't compile the test program--guessing unsigned.)" >&4
21028 fi
21029
21030
21031 : Check format string for UID
21032 echo " "
21033 $echo "Checking the format string to be used for uids..." >&4
21034
21035 case "$uidsign" in
21036 -1)     if $test X"$uidsize" = X"$ivsize"; then
21037                 uidformat="$ivdformat"
21038         else
21039                 if $test X"$uidsize" = X"$longsize"; then
21040                         uidformat='"ld"'
21041                 else
21042                         if $test X"$uidsize" = X"$intsize"; then
21043                                 uidformat='"d"'
21044                         else
21045                                 if $test X"$uidsize" = X"$shortsize"; then
21046                                         uidformat='"hd"'
21047                                 fi
21048                         fi
21049                 fi
21050         fi
21051         ;;
21052 *)      if $test X"$uidsize" = X"$uvsize"; then
21053                 uidformat="$uvuformat"
21054         else
21055                 if $test X"$uidsize" = X"$longsize"; then
21056                         uidformat='"lu"'
21057                 else
21058                         if $test X"$uidsize" = X"$intsize"; then
21059                                 uidformat='"u"'
21060                         else
21061                                 if $test X"$uidsize" = X"$shortsize"; then
21062                                         uidformat='"hu"'
21063                                 fi
21064                         fi
21065                 fi
21066         fi
21067         ;;
21068 esac
21069
21070 : Check if site customization support was requested
21071 case "$usesitecustomize" in
21072     $define|true|[Yy]*)
21073         usesitecustomize="$define"
21074         ;;
21075     *)
21076         usesitecustomize="$undef"
21077         ;;
21078     esac
21079
21080 : determine compiler compiler
21081 case "$yacc" in
21082 '')
21083         dflt=yacc;;
21084 *)
21085         dflt="$yacc";;
21086 esac
21087 echo " "
21088 comp='yacc'
21089 if $test -f "$byacc$_exe"; then
21090         dflt="$byacc"
21091         comp="byacc or $comp"
21092 fi
21093 if $test -f "$bison$_exe"; then
21094         comp="$comp or bison -y"
21095 fi
21096 rp="Which compiler compiler ($comp) shall I use?"
21097 . ./myread
21098 yacc="$ans"
21099 case "$yacc" in
21100 *bis*)
21101         case "$yacc" in
21102         *-y*) ;;
21103         *)
21104                 yacc="$yacc -y"
21105                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21106                 ;;
21107         esac
21108         ;;
21109 esac
21110
21111 : see if this is a assert.h system
21112 set assert.h i_assert
21113 eval $inhdr
21114
21115 : see if this is a fp.h system
21116 set fp.h i_fp
21117 eval $inhdr
21118
21119 : see if this is a fp_class.h system
21120 set fp_class.h i_fp_class
21121 eval $inhdr
21122
21123 : see if gdbm.h is available
21124 set gdbm.h t_gdbm
21125 eval $inhdr
21126 case "$t_gdbm" in
21127 $define)
21128         : see if gdbm_open exists
21129         set gdbm_open d_gdbm_open
21130         eval $inlibc
21131         case "$d_gdbm_open" in
21132         $undef)
21133                 t_gdbm="$undef"
21134                 echo "We won't be including <gdbm.h>"
21135                 ;;
21136         esac
21137         ;;
21138 esac
21139 val="$t_gdbm"
21140 set i_gdbm
21141 eval $setvar
21142
21143 : see if this is a ieeefp.h system
21144 case "$i_ieeefp" in
21145 '' ) set ieeefp.h i_ieeefp
21146      eval $inhdr
21147      ;;
21148 esac
21149
21150 : see if this is a libutil.h system
21151 set libutil.h i_libutil
21152 eval $inhdr
21153
21154 : see if mach cthreads are available
21155 if test "X$usethreads" = "X$define"; then
21156         set mach/cthreads.h i_machcthr
21157         eval $inhdr
21158 else
21159         i_machcthr="$undef"
21160 fi
21161
21162 : see if this is a mntent.h system
21163 set mntent.h i_mntent
21164 eval $inhdr
21165
21166 : see if net/errno.h is available
21167 val=''
21168 set net/errno.h val
21169 eval $inhdr
21170
21171 : Unfortunately, it causes problems on some systems.  Arrgh.
21172 case "$val" in
21173 $define)
21174         cat > try.c <<'EOM'
21175 #include <stdio.h>
21176 #include <errno.h>
21177 #include <net/errno.h>
21178 int func()
21179 {
21180         return ENOTSOCK;
21181 }
21182 EOM
21183         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21184                 echo "We'll be including <net/errno.h>." >&4
21185         else
21186                 echo "We won't be including <net/errno.h>." >&4
21187                 val="$undef"
21188         fi
21189         $rm_try
21190         ;;
21191 esac
21192 set i_neterrno
21193 eval $setvar
21194
21195 : see if netinet/tcp.h is available
21196 set netinet/tcp.h i_netinettcp
21197 eval $inhdr
21198
21199 : see if this is a poll.h system
21200 set poll.h i_poll
21201 eval $inhdr
21202
21203 : see if this is a prot.h system
21204 set prot.h i_prot
21205 eval $inhdr
21206
21207 : Preprocessor symbols
21208 echo " "
21209 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21210 $cat <<'EOSH' > Cppsym.know
21211 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21212 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21213 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21214 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21215 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21216 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21217 bull c cadmus clipper CMU COFF COMPILER_VERSION
21218 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21219 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21220 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21221 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21222 GLIBC GLIBC_MINOR
21223 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21224 H3050R H3050RX hbullx20 hcx host_mips
21225 hp200 hp300 hp700 HP700 hp800 hp9000
21226 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21227 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21228 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21229 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21230 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21231 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21232 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21233 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21234 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21235 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21236 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21237 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21238 MATH_HAS_NO_SIDE_EFFECTS
21239 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21240 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21241 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21242 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21243 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21244 NetBSD news1500 news1700 news1800 news1900 news3700
21245 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21246 ns32016 ns32332 ns32k nsc32000
21247 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21248 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21249 pc532 pdp11 PGC PIC plexus PORTAR posix
21250 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21251 POSIX_C_SOURCE POSIX_SOURCE POWER
21252 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21253 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21254 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21255 sony sony_news sonyrisc sparc sparclite spectrum
21256 stardent stdc STDC_EXT stratos sun sun3 sun386
21257 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21258 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21259 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21260 sysV68 sysV88 Tek4132 Tek4300 titan
21261 TM3200 TM5400 TM5600
21262 tower tower32 tower32_200 tower32_600 tower32_700
21263 tower32_800 tower32_850 tss
21264 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21265 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21266 unix UNIX95 UNIX99 unixpc unos
21267 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21268 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21269 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21270 USGr4 USGr4_2
21271 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21272 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21273 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21274 z8000
21275 EOSH
21276 # Maybe put other stuff here too.
21277 cat <<EOSH >>Cppsym.know
21278 $osname
21279 EOSH
21280 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21281 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21282 $cat Cppsym.know > Cppsym.c
21283 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21284 $rm -f Cppsym.a Cppsym.b Cppsym.c
21285 cat <<EOSH > Cppsym
21286 $startsh
21287 if $test \$# -gt 0; then
21288     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21289     if $test -s Cppsym.got; then
21290         $rm -f Cppsym.got
21291         exit 0
21292     fi
21293     $rm -f Cppsym.got
21294     exit 1
21295 else
21296     $tr " " "$trnl" | ./Cppsym.try
21297     exit 0
21298 fi
21299 EOSH
21300 chmod +x Cppsym
21301 $eunicefix Cppsym
21302 cat <<EOSH > Cppsym.try
21303 $startsh
21304 cat <<'EOCP' > try.c
21305 #include <stdio.h>
21306 #if cpp_stuff == 1
21307 #define STRINGIFY(a)    "a"
21308 #endif
21309 #if cpp_stuff == 42
21310 #define StGiFy(a)  #a
21311 #define STRINGIFY(a)    StGiFy(a)
21312 #endif
21313 #if $cpp_stuff != 1 && $cpp_stuff != 42
21314 #   include "Bletch: How does this C preprocessor stringify macros?"
21315 #endif
21316 int main() {
21317 EOCP
21318 $awk \\
21319 EOSH
21320 cat <<'EOSH' >> Cppsym.try
21321 'length($1) > 0 {
21322     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21323     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21324     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21325     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21326 }'       >> try.c
21327 echo 'return 0;}' >> try.c
21328 EOSH
21329 cat <<EOSH >> Cppsym.try
21330 ccflags="$ccflags"
21331 case "$osname-$gccversion" in
21332 irix-) ccflags="\$ccflags -woff 1178" ;;
21333 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21334 esac
21335 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21336 EOSH
21337 chmod +x Cppsym.try
21338 $eunicefix Cppsym.try
21339 ./Cppsym < Cppsym.know > Cppsym.true
21340 : Add in any linux cpp "predefined macros":
21341 case "$osname::$gccversion" in
21342   *linux*::*.*)
21343     tHdrH=_tmpHdr
21344     rm -f $tHdrH'.h' $tHdrH
21345     touch $tHdrH'.h'
21346     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21347        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21348        if [ -s $tHdrH'_cppsym.real' ]; then
21349           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21350        fi
21351     fi
21352     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21353   ;;
21354 esac
21355 : now check the C compiler for additional symbols
21356 postprocess_cc_v=''
21357 case "$osname" in
21358 aix) postprocess_cc_v="|$tr , ' '" ;;
21359 esac
21360 $cat >ccsym <<EOS
21361 $startsh
21362 $cat >tmp.c <<EOF
21363 extern int foo;
21364 EOF
21365 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21366 do
21367         case "\$i" in
21368         -D*) echo "\$i" | $sed 's/^-D//';;
21369         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21370         esac
21371 done
21372 $rm_try
21373 EOS
21374 postprocess_cc_v=''
21375 chmod +x ccsym
21376 $eunicefix ccsym
21377 ./ccsym > ccsym1.raw
21378 if $test -s ccsym1.raw; then
21379        $sort ccsym1.raw | $uniq >ccsym.raw
21380 else
21381        mv ccsym1.raw ccsym.raw
21382 fi
21383
21384 $awk '/\=/ { print $0; next }
21385         { print $0"=1" }' ccsym.raw >ccsym.list
21386 $comm -13 Cppsym.true ccsym.list >ccsym.own
21387 $comm -12 Cppsym.true ccsym.list >ccsym.com
21388 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21389 also=''
21390 if $test -z ccsym.raw; then
21391         echo "Your C compiler doesn't seem to define any symbols!" >&4
21392         echo " "
21393         echo "However, your C preprocessor defines the following symbols:"
21394         $cat Cppsym.true
21395         ccsymbols=''
21396         cppsymbols=`$cat Cppsym.true`
21397         cppsymbols=`echo $cppsymbols`
21398         cppccsymbols="$cppsymbols"
21399 else
21400         if $test -s ccsym.com; then
21401                 echo "Your C compiler and pre-processor define these symbols:"
21402                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21403                 also='also '
21404                 symbols='ones'
21405                 cppccsymbols=`$cat ccsym.com`
21406                 cppccsymbols=`echo $cppccsymbols`
21407                 $test "$silent" || sleep 1
21408         fi
21409         if $test -s ccsym.cpp; then
21410                 $test "$also" && echo " "
21411                 echo "Your C pre-processor ${also}defines the following symbols:"
21412                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21413                 also='further '
21414                 cppsymbols=`$cat ccsym.cpp`
21415                 cppsymbols=`echo $cppsymbols`
21416                 $test "$silent" || sleep 1
21417         fi
21418         if $test -s ccsym.own; then
21419                 $test "$also" && echo " "
21420                 echo "Your C compiler ${also}defines the following cpp symbols:"
21421                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21422                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21423                 ccsymbols=`$cat ccsym.own`
21424                 ccsymbols=`echo $ccsymbols`
21425                 $test "$silent" || sleep 1
21426         fi
21427 fi
21428
21429 : see if this is a termio system
21430 val="$undef"
21431 val2="$undef"
21432 val3="$undef"
21433 if $test `./findhdr termios.h`; then
21434         set tcsetattr i_termios
21435         eval $inlibc
21436         val3="$i_termios"
21437 fi
21438 echo " "
21439 case "$val3" in
21440 "$define") echo "You have POSIX termios.h... good!" >&4;;
21441 *) if ./Cppsym pyr; then
21442                 case "`/bin/universe`" in
21443                 ucb) if $test `./findhdr sgtty.h`; then
21444                                 val2="$define"
21445                                 echo "<sgtty.h> found." >&4
21446                         else
21447                                 echo "System is pyramid with BSD universe."
21448                                 ./warn "<sgtty.h> not found--you could have problems."
21449                         fi;;
21450                 *) if $test `./findhdr termio.h`; then
21451                                 val="$define"
21452                                 echo "<termio.h> found." >&4
21453                         else
21454                                 echo "System is pyramid with USG universe."
21455                                 ./warn "<termio.h> not found--you could have problems."
21456                         fi;;
21457                 esac
21458         elif ./usg; then
21459                 if $test `./findhdr termio.h`; then
21460                         echo "<termio.h> found." >&4
21461                         val="$define"
21462                 elif $test `./findhdr sgtty.h`; then
21463                         echo "<sgtty.h> found." >&4
21464                         val2="$define"
21465                 else
21466                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21467                 fi
21468         else
21469                 if $test `./findhdr sgtty.h`; then
21470                         echo "<sgtty.h> found." >&4
21471                         val2="$define"
21472                 elif $test `./findhdr termio.h`; then
21473                         echo "<termio.h> found." >&4
21474                         val="$define"
21475                 else
21476                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21477                 fi
21478         fi;;
21479 esac
21480 set i_termio; eval $setvar
21481 val=$val2; set i_sgtty; eval $setvar
21482 val=$val3; set i_termios; eval $setvar
21483
21484 : see if stddef is available
21485 set stddef.h i_stddef
21486 eval $inhdr
21487
21488 : see if sys/access.h is available
21489 set sys/access.h i_sysaccess
21490 eval $inhdr
21491
21492 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21493 set sys/filio.h i_sysfilio
21494 eval $inhdr
21495 echo " "
21496 if $test `./findhdr sys/ioctl.h`; then
21497         val="$define"
21498         echo '<sys/ioctl.h> found.' >&4
21499 else
21500         val="$undef"
21501         if $test $i_sysfilio = "$define"; then
21502             echo '<sys/ioctl.h> NOT found.' >&4
21503         else
21504                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21505                 $test $i_termio = "$define" && xxx="termio.h"
21506                 $test $i_termios = "$define" && xxx="termios.h"
21507 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21508         fi
21509 fi
21510 set i_sysioctl
21511 eval $setvar
21512
21513 : see if socket ioctl defs are in sys/sockio.h
21514 echo " "
21515 xxx=`./findhdr sys/sockio.h`
21516 if $test "$xxx"; then
21517         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21518                 val="$define"
21519                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21520         else
21521                 val="$undef"
21522                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21523         fi
21524 else
21525         val="$undef"
21526         $cat <<EOM
21527 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21528 EOM
21529 fi
21530 set i_syssockio
21531 eval $setvar
21532
21533 : see if this is a syslog.h system
21534 set syslog.h i_syslog
21535 eval $inhdr
21536
21537 : see if this is a sys/mode.h system
21538 set sys/mode.h i_sysmode
21539 eval $inhdr
21540
21541 : see if there is a sys/poll.h file
21542 set sys/poll.h i_syspoll
21543 eval $inhdr
21544
21545 : see if sys/resource.h has to be included
21546 set sys/resource.h i_sysresrc
21547 eval $inhdr
21548
21549 : see if sys/security.h is available
21550 set sys/security.h i_syssecrt
21551 eval $inhdr
21552
21553 : see if this is a sys/statvfs.h system
21554 set sys/statvfs.h i_sysstatvfs
21555 eval $inhdr
21556
21557 : see if this is a sys/un.h system
21558 set sys/un.h i_sysun
21559 eval $inhdr
21560
21561 : see if this is a sys/utsname.h system
21562 set sys/utsname.h i_sysutsname
21563 eval $inhdr
21564
21565 : see if this is a syswait system
21566 set sys/wait.h i_syswait
21567 eval $inhdr
21568
21569 : see if this is a ustat.h system
21570 set ustat.h i_ustat
21571 eval $inhdr
21572
21573 : see if this is an utime system
21574 set utime.h i_utime
21575 eval $inhdr
21576
21577 : see if this is a vfork system
21578 case "$d_vfork" in
21579 "$define")
21580         set vfork.h i_vfork
21581         eval $inhdr
21582         ;;
21583 *)
21584         i_vfork="$undef"
21585         ;;
21586 esac
21587
21588 : Check extensions
21589 echo " "
21590 echo "Looking for extensions..." >&4
21591 : If we are using the old config.sh, known_extensions may contain
21592 : old or inaccurate or duplicate values.
21593 known_extensions=''
21594 nonxs_extensions=''
21595 : We do not use find because it might not be available.
21596 : We do not just use MANIFEST because the user may have dropped
21597 : some additional extensions into the source tree and expect them
21598 : to be built.
21599
21600 : Function to recursively find available extensions, ignoring DynaLoader
21601 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21602 find_extensions='
21603     for xxx in *; do
21604         case "$xxx" in
21605             DynaLoader|dynaload) ;;
21606             *)
21607             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21608                 known_extensions="$known_extensions $1$xxx";
21609             elif $test -f $xxx/Makefile.PL; then
21610                 nonxs_extensions="$nonxs_extensions $1$xxx";
21611             else
21612                 if $test -d $xxx -a $# -lt 10; then
21613                     set $1$xxx/ $*;
21614                     cd "$xxx";
21615                     eval $find_extensions;
21616                     cd ..;
21617                     shift;
21618                 fi;
21619             fi
21620             ;;
21621         esac;
21622     done'
21623 tdir=`pwd`
21624 cd "$rsrc/ext"
21625 set X
21626 shift
21627 eval $find_extensions
21628 # Special case:  Add in modules that nest beyond the first level.
21629 # Currently threads/shared and Hash/Util/FieldHash, since they are
21630 # not picked up by the recursive find above (and adding in general
21631 # recursive finding breaks SDBM_File/sdbm).
21632 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21633 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21634 set X $known_extensions
21635 shift
21636 known_extensions="$*"
21637 set X $nonxs_extensions
21638 shift
21639 nonxs_extensions="$*"
21640 cd "$tdir"
21641
21642 : Now see which are supported on this system.
21643 avail_ext=''
21644 for xxx in $known_extensions ; do
21645         case "$xxx" in
21646         DB_File|db_file)
21647                 case "$i_db" in
21648                 $define) avail_ext="$avail_ext $xxx" ;;
21649                 esac
21650                 ;;
21651         GDBM_File|gdbm_fil)
21652                 case "$i_gdbm" in
21653                 $define) avail_ext="$avail_ext $xxx" ;;
21654                 esac
21655                 ;;
21656         I18N/Langinfo|i18n_lan)
21657                 case "$i_langinfo$d_nl_langinfo" in
21658                 $define$define) avail_ext="$avail_ext $xxx" ;;
21659                 esac
21660                 ;;
21661         IPC/SysV|ipc/sysv)
21662                 : XXX Do we need a useipcsysv variable here
21663                 case "${d_msg}${d_sem}${d_shm}" in
21664                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21665                 esac
21666                 ;;
21667         NDBM_File|ndbm_fil)
21668                 case "$i_ndbm" in
21669                 $define)
21670                     case "$osname-$use64bitint" in
21671                     hpux-define)
21672                         case "$libs" in
21673                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21674                         esac
21675                         ;;
21676                     *) avail_ext="$avail_ext $xxx" ;;
21677                     esac
21678                     ;;
21679                 esac
21680                 ;;
21681         ODBM_File|odbm_fil)
21682                 case "${i_dbm}${i_rpcsvcdbm}" in
21683                 *"${define}"*)
21684                     case "$d_cplusplus" in
21685                     define) ;; # delete as a function name will not work
21686                     *)  case "$osname-$use64bitint" in
21687                         hpux-define)
21688                             case "$libs" in
21689                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21690                             esac
21691                             ;;
21692                         *) avail_ext="$avail_ext $xxx" ;;
21693                         esac
21694                         ;;
21695                     esac
21696                     ;;
21697                 esac
21698                 ;;
21699         Opcode|opcode)
21700                 case "$useopcode" in
21701                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21702                 esac
21703                 ;;
21704         POSIX|posix)
21705                 case "$useposix" in
21706                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21707                 esac
21708                 ;;
21709         Socket|socket)
21710                 case "$d_socket" in
21711                 true|$define|y)
21712                     case "$osname" in
21713                     beos) ;; # not unless BONE
21714                     *) avail_ext="$avail_ext $xxx" ;;
21715                     esac
21716                     ;;
21717                 esac
21718                 ;;
21719         Sys/Syslog|sys/syslog)
21720                 : XXX syslog requires socket
21721                 case "$d_socket" in
21722                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21723                 esac
21724                 ;;
21725         Thread|thread)
21726                 case "$usethreads" in
21727                 true|$define|y)
21728                         case "$use5005threads" in
21729                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21730                         esac
21731                 esac
21732                 ;;
21733         threads|threads/shared)
21734                 # threads and threads::shared are special cases.
21735                 # To stop people from asking "Perl 5.8.0 was supposed
21736                 # to have this new fancy threads implementation but my
21737                 # perl doesn't have it" and from people trying to
21738                 # (re)install the threads module using CPAN.pm and
21739                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21740                 # the threads.pm and threads/shared.pm will always be
21741                 # there, croaking informatively ("you need to rebuild
21742                 # all of Perl with threads, sorry") when threads haven't
21743                 # been compiled in.
21744                 # --jhi
21745                 avail_ext="$avail_ext $xxx"
21746                 ;;
21747         Win32*)
21748                 case "$osname" in
21749                 cygwin) avail_ext="$avail_ext $xxx" ;;
21750                 esac
21751                 ;;
21752         XS/APItest|xs/apitest)
21753                 # This is just for testing.  Skip it unless we have dynamic loading.
21754
21755                 case "$usedl" in
21756                 $define) avail_ext="$avail_ext $xxx" ;;
21757                 esac
21758                 ;;
21759         XS/Typemap|xs/typemap)
21760                 # This is just for testing.  Skip it unless we have dynamic loading.
21761                 case "$usedl" in
21762                 $define) avail_ext="$avail_ext $xxx" ;;
21763                 esac
21764                 ;;
21765         *)      avail_ext="$avail_ext $xxx"
21766                 ;;
21767         esac
21768 done
21769
21770 set X $avail_ext
21771 shift
21772 avail_ext="$*"
21773
21774 case "$onlyextensions" in
21775 '') ;;
21776 *)  keepextensions=''
21777     echo "You have requested that only certains extensions be included..." >&4
21778     for i in $onlyextensions; do
21779         case " $avail_ext " in
21780         *" $i "*)
21781             echo "Keeping extension $i."
21782             keepextensions="$keepextensions $i"
21783             ;;
21784         *) echo "Ignoring extension $i." ;;
21785         esac
21786     done
21787     avail_ext="$keepextensions"
21788     ;;
21789 esac
21790
21791 case "$noextensions" in
21792 '') ;;
21793 *)  keepextensions=''
21794     echo "You have requested that certain extensions be ignored..." >&4
21795     for i in $avail_ext; do
21796         case " $noextensions " in
21797         *" $i "*) echo "Ignoring extension $i." ;;
21798         *) echo "Keeping extension $i.";
21799            keepextensions="$keepextensions $i"
21800            ;;
21801         esac
21802     done
21803     avail_ext="$keepextensions"
21804     ;;
21805 esac
21806
21807 : Now see which nonxs extensions are supported on this system.
21808 : For now assume all are.
21809 nonxs_ext=''
21810 for xxx in $nonxs_extensions ; do
21811         case "$xxx" in
21812         *)      nonxs_ext="$nonxs_ext $xxx"
21813                 ;;
21814         esac
21815 done
21816
21817 set X $nonxs_ext
21818 shift
21819 nonxs_ext="$*"
21820
21821 case $usedl in
21822 $define)
21823         $cat <<EOM
21824 A number of extensions are supplied with $package.  You may choose to
21825 compile these extensions for dynamic loading (the default), compile
21826 them into the $package executable (static loading), or not include
21827 them at all.  Answer "none" to include no extensions.
21828 Note that DynaLoader is always built and need not be mentioned here.
21829
21830 EOM
21831         case "$dynamic_ext" in
21832         '')
21833                 : Exclude those listed in static_ext
21834                 dflt=''
21835                 for xxx in $avail_ext; do
21836                         case " $static_ext " in
21837                         *" $xxx "*) ;;
21838                         *) dflt="$dflt $xxx" ;;
21839                         esac
21840                 done
21841                 set X $dflt
21842                 shift
21843                 dflt="$*"
21844                 ;;
21845         *)      dflt="$dynamic_ext"
21846                 # Perhaps we are reusing an old out-of-date config.sh.
21847                 case "$hint" in
21848                 previous)
21849                         if test X"$dynamic_ext" != X"$avail_ext"; then
21850                                 $cat <<EOM
21851 NOTICE:  Your previous config.sh list may be incorrect.
21852 The extensions now available to you are
21853         ${avail_ext}
21854 but the default list from your previous config.sh is
21855         ${dynamic_ext}
21856
21857 EOM
21858                         fi
21859                         ;;
21860                 esac
21861                 ;;
21862         esac
21863         case "$dflt" in
21864         '')     dflt=none;;
21865         esac
21866         rp="What extensions do you wish to load dynamically?"
21867         . ./myread
21868         case "$ans" in
21869         none) dynamic_ext=' ' ;;
21870         *) dynamic_ext="$ans" ;;
21871         esac
21872
21873         case "$static_ext" in
21874         '')
21875                 : Exclude those already listed in dynamic linking
21876                 dflt=''
21877                 for xxx in $avail_ext; do
21878                         case " $dynamic_ext " in
21879                         *" $xxx "*) ;;
21880                         *) dflt="$dflt $xxx" ;;
21881                         esac
21882                 done
21883                 set X $dflt
21884                 shift
21885                 dflt="$*"
21886                 ;;
21887         *)  dflt="$static_ext"
21888                 ;;
21889         esac
21890
21891         case "$dflt" in
21892         '')     dflt=none;;
21893         esac
21894         rp="What extensions do you wish to load statically?"
21895         . ./myread
21896         case "$ans" in
21897         none) static_ext=' ' ;;
21898         *) static_ext="$ans" ;;
21899         esac
21900         ;;
21901 *)
21902         $cat <<EOM
21903 A number of extensions are supplied with $package.  Answer "none"
21904 to include no extensions.
21905 Note that DynaLoader is always built and need not be mentioned here.
21906
21907 EOM
21908         case "$static_ext" in
21909         '') dflt="$avail_ext" ;;
21910         *)      dflt="$static_ext"
21911                 # Perhaps we are reusing an old out-of-date config.sh.
21912                 case "$hint" in
21913                 previous)
21914                         if test X"$static_ext" != X"$avail_ext"; then
21915                                 $cat <<EOM
21916 NOTICE:  Your previous config.sh list may be incorrect.
21917 The extensions now available to you are
21918         ${avail_ext}
21919 but the default list from your previous config.sh is
21920         ${static_ext}
21921
21922 EOM
21923                         fi
21924                         ;;
21925                 esac
21926                 ;;
21927         esac
21928         : Exclude those that are not xs extensions
21929         case "$dflt" in
21930         '')     dflt=none;;
21931         esac
21932         rp="What extensions do you wish to include?"
21933         . ./myread
21934         case "$ans" in
21935         none) static_ext=' ' ;;
21936         *) static_ext="$ans" ;;
21937         esac
21938         ;;
21939 esac
21940 #
21941 # Encode is a special case.  If we are building Encode as a static
21942 # extension, we need to explicitly list its subextensions as well.
21943 # For other nested extensions, this is handled automatically by
21944 # the appropriate Makefile.PL.
21945 case " $static_ext " in
21946         *" Encode "*) # Add the subextensions of Encode
21947         cd "$rsrc/ext"
21948         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21949                 static_ext="$static_ext Encode/$xxx"
21950         done
21951         cd "$tdir"
21952         ;;
21953 esac
21954
21955 set X $dynamic_ext $static_ext $nonxs_ext
21956 shift
21957 extensions="$*"
21958
21959 # Sanity check:  We require an extension suitable for use with
21960 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21961 # should show up as failures in the test suite, but it's helpful to
21962 # catch them now.) The 'extensions' list is normally sorted
21963 # alphabetically, so we need to accept either
21964 #    DB_File ... Fcntl ... IO  ....
21965 # or something like
21966 #    Fcntl ... NDBM_File ... IO  ....
21967 case " $extensions"  in
21968 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21969 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21970 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21971 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21972    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21973    ;;
21974 esac
21975
21976 : Remove libraries needed only for extensions
21977 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21978 : The exception is SunOS 4.x, which needs them.
21979 case "${osname}X${osvers}" in
21980 sunos*X4*)
21981     perllibs="$libs"
21982     ;;
21983 *) case "$usedl" in
21984     $define|true|[yY]*)
21985             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21986             shift
21987             perllibs="$*"
21988             ;;
21989     *)  perllibs="$libs"
21990             ;;
21991     esac
21992     ;;
21993 esac
21994
21995 : Remove build directory name from cppstdin so it can be used from
21996 : either the present location or the final installed location.
21997 echo " "
21998 : Get out of the UU directory to get correct path name.
21999 cd ..
22000 case "$cppstdin" in
22001 `pwd`/cppstdin)
22002         echo "Stripping down cppstdin path name"
22003         cppstdin=cppstdin
22004         ;;
22005 esac
22006 cd UU
22007
22008 : end of configuration questions
22009 echo " "
22010 echo "End of configuration questions."
22011 echo " "
22012
22013 : back to where it started
22014 if test -d ../UU; then
22015         cd ..
22016 fi
22017
22018 : configuration may be unconditionally patched via a 'config.arch' file
22019 if $test -f config.arch; then
22020         echo "I see a config.arch file, loading it." >&4
22021         . ./config.arch
22022 fi
22023
22024 : configuration may be patched via a 'config.over' file
22025 if $test -f config.over; then
22026         echo " "
22027         dflt=y
22028         rp='I see a config.over file.  Do you wish to load it?'
22029         . UU/myread
22030         case "$ans" in
22031         n*) echo "OK, I'll ignore it.";;
22032         *)      . ./config.over
22033                 echo "Configuration override changes have been loaded."
22034                 ;;
22035         esac
22036 fi
22037
22038 : in case they want portability, strip down executable paths
22039 case "$d_portable" in
22040 "$define")
22041         echo " "
22042         echo "Stripping down executable paths..." >&4
22043         for file in $loclist $trylist; do
22044                 eval temp=\$$file
22045                 eval $file=`basename $temp`
22046         done
22047         ;;
22048 esac
22049
22050 : create config.sh file
22051 echo " "
22052 echo "Creating config.sh..." >&4
22053 $spitshell <<EOT >config.sh
22054 $startsh
22055 #
22056 # This file was produced by running the Configure script. It holds all the
22057 # definitions figured out by Configure. Should you modify one of these values,
22058 # do not forget to propagate your changes by running "Configure -der". You may
22059 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22060 #
22061
22062 # Package name      : $package
22063 # Source directory  : $src
22064 # Configuration time: $cf_time
22065 # Configured by     : $cf_by
22066 # Target system     : $myuname
22067
22068 EOT
22069 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22070 $spitshell <<EOT >>config.sh
22071
22072 Author='$Author'
22073 Date='$Date'
22074 Header='$Header'
22075 Id='$Id'
22076 Locker='$Locker'
22077 Log='$Log'
22078 RCSfile='$RCSfile'
22079 Revision='$Revision'
22080 Source='$Source'
22081 State='$State'
22082 _a='$_a'
22083 _exe='$_exe'
22084 _o='$_o'
22085 afs='$afs'
22086 afsroot='$afsroot'
22087 alignbytes='$alignbytes'
22088 ansi2knr='$ansi2knr'
22089 aphostname='$aphostname'
22090 api_revision='$api_revision'
22091 api_subversion='$api_subversion'
22092 api_version='$api_version'
22093 api_versionstring='$api_versionstring'
22094 ar='$ar'
22095 archlib='$archlib'
22096 archlibexp='$archlibexp'
22097 archname64='$archname64'
22098 archname='$archname'
22099 archobjs='$archobjs'
22100 asctime_r_proto='$asctime_r_proto'
22101 awk='$awk'
22102 baserev='$baserev'
22103 bash='$bash'
22104 bin='$bin'
22105 binexp='$binexp'
22106 bison='$bison'
22107 byacc='$byacc'
22108 byteorder='$byteorder'
22109 c='$c'
22110 castflags='$castflags'
22111 cat='$cat'
22112 cc='$cc'
22113 cccdlflags='$cccdlflags'
22114 ccdlflags='$ccdlflags'
22115 ccflags='$ccflags'
22116 ccflags_uselargefiles='$ccflags_uselargefiles'
22117 ccname='$ccname'
22118 ccsymbols='$ccsymbols'
22119 ccversion='$ccversion'
22120 cf_by='$cf_by'
22121 cf_email='$cf_email'
22122 cf_time='$cf_time'
22123 chgrp='$chgrp'
22124 chmod='$chmod'
22125 chown='$chown'
22126 clocktype='$clocktype'
22127 comm='$comm'
22128 compress='$compress'
22129 contains='$contains'
22130 cp='$cp'
22131 cpio='$cpio'
22132 cpp='$cpp'
22133 cpp_stuff='$cpp_stuff'
22134 cppccsymbols='$cppccsymbols'
22135 cppflags='$cppflags'
22136 cpplast='$cpplast'
22137 cppminus='$cppminus'
22138 cpprun='$cpprun'
22139 cppstdin='$cppstdin'
22140 cppsymbols='$cppsymbols'
22141 crypt_r_proto='$crypt_r_proto'
22142 cryptlib='$cryptlib'
22143 csh='$csh'
22144 ctermid_r_proto='$ctermid_r_proto'
22145 ctime_r_proto='$ctime_r_proto'
22146 d_Gconvert='$d_Gconvert'
22147 d_PRIEUldbl='$d_PRIEUldbl'
22148 d_PRIFUldbl='$d_PRIFUldbl'
22149 d_PRIGUldbl='$d_PRIGUldbl'
22150 d_PRIXU64='$d_PRIXU64'
22151 d_PRId64='$d_PRId64'
22152 d_PRIeldbl='$d_PRIeldbl'
22153 d_PRIfldbl='$d_PRIfldbl'
22154 d_PRIgldbl='$d_PRIgldbl'
22155 d_PRIi64='$d_PRIi64'
22156 d_PRIo64='$d_PRIo64'
22157 d_PRIu64='$d_PRIu64'
22158 d_PRIx64='$d_PRIx64'
22159 d_SCNfldbl='$d_SCNfldbl'
22160 d__fwalk='$d__fwalk'
22161 d_access='$d_access'
22162 d_accessx='$d_accessx'
22163 d_aintl='$d_aintl'
22164 d_alarm='$d_alarm'
22165 d_archlib='$d_archlib'
22166 d_asctime64='$d_asctime64'
22167 d_asctime_r='$d_asctime_r'
22168 d_atolf='$d_atolf'
22169 d_atoll='$d_atoll'
22170 d_attribute_deprecated='$d_attribute_deprecated'
22171 d_attribute_format='$d_attribute_format'
22172 d_attribute_malloc='$d_attribute_malloc'
22173 d_attribute_nonnull='$d_attribute_nonnull'
22174 d_attribute_noreturn='$d_attribute_noreturn'
22175 d_attribute_pure='$d_attribute_pure'
22176 d_attribute_unused='$d_attribute_unused'
22177 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22178 d_bcmp='$d_bcmp'
22179 d_bcopy='$d_bcopy'
22180 d_bsd='$d_bsd'
22181 d_bsdgetpgrp='$d_bsdgetpgrp'
22182 d_bsdsetpgrp='$d_bsdsetpgrp'
22183 d_builtin_choose_expr='$d_builtin_choose_expr'
22184 d_builtin_expect='$d_builtin_expect'
22185 d_bzero='$d_bzero'
22186 d_c99_variadic_macros='$d_c99_variadic_macros'
22187 d_casti32='$d_casti32'
22188 d_castneg='$d_castneg'
22189 d_charvspr='$d_charvspr'
22190 d_chown='$d_chown'
22191 d_chroot='$d_chroot'
22192 d_chsize='$d_chsize'
22193 d_class='$d_class'
22194 d_clearenv='$d_clearenv'
22195 d_closedir='$d_closedir'
22196 d_cmsghdr_s='$d_cmsghdr_s'
22197 d_const='$d_const'
22198 d_copysignl='$d_copysignl'
22199 d_cplusplus='$d_cplusplus'
22200 d_crypt='$d_crypt'
22201 d_crypt_r='$d_crypt_r'
22202 d_csh='$d_csh'
22203 d_ctermid='$d_ctermid'
22204 d_ctermid_r='$d_ctermid_r'
22205 d_ctime64='$d_ctime64'
22206 d_ctime_r='$d_ctime_r'
22207 d_cuserid='$d_cuserid'
22208 d_dbl_dig='$d_dbl_dig'
22209 d_dbminitproto='$d_dbminitproto'
22210 d_difftime64='$d_difftime64'
22211 d_difftime='$d_difftime'
22212 d_dir_dd_fd='$d_dir_dd_fd'
22213 d_dirfd='$d_dirfd'
22214 d_dirnamlen='$d_dirnamlen'
22215 d_dlerror='$d_dlerror'
22216 d_dlopen='$d_dlopen'
22217 d_dlsymun='$d_dlsymun'
22218 d_dosuid='$d_dosuid'
22219 d_drand48_r='$d_drand48_r'
22220 d_drand48proto='$d_drand48proto'
22221 d_dup2='$d_dup2'
22222 d_eaccess='$d_eaccess'
22223 d_endgrent='$d_endgrent'
22224 d_endgrent_r='$d_endgrent_r'
22225 d_endhent='$d_endhent'
22226 d_endhostent_r='$d_endhostent_r'
22227 d_endnent='$d_endnent'
22228 d_endnetent_r='$d_endnetent_r'
22229 d_endpent='$d_endpent'
22230 d_endprotoent_r='$d_endprotoent_r'
22231 d_endpwent='$d_endpwent'
22232 d_endpwent_r='$d_endpwent_r'
22233 d_endsent='$d_endsent'
22234 d_endservent_r='$d_endservent_r'
22235 d_eofnblk='$d_eofnblk'
22236 d_eunice='$d_eunice'
22237 d_faststdio='$d_faststdio'
22238 d_fchdir='$d_fchdir'
22239 d_fchmod='$d_fchmod'
22240 d_fchown='$d_fchown'
22241 d_fcntl='$d_fcntl'
22242 d_fcntl_can_lock='$d_fcntl_can_lock'
22243 d_fd_macros='$d_fd_macros'
22244 d_fd_set='$d_fd_set'
22245 d_fds_bits='$d_fds_bits'
22246 d_fgetpos='$d_fgetpos'
22247 d_finite='$d_finite'
22248 d_finitel='$d_finitel'
22249 d_flexfnam='$d_flexfnam'
22250 d_flock='$d_flock'
22251 d_flockproto='$d_flockproto'
22252 d_fork='$d_fork'
22253 d_fp_class='$d_fp_class'
22254 d_fpathconf='$d_fpathconf'
22255 d_fpclass='$d_fpclass'
22256 d_fpclassify='$d_fpclassify'
22257 d_fpclassl='$d_fpclassl'
22258 d_fpos64_t='$d_fpos64_t'
22259 d_frexpl='$d_frexpl'
22260 d_fs_data_s='$d_fs_data_s'
22261 d_fseeko='$d_fseeko'
22262 d_fsetpos='$d_fsetpos'
22263 d_fstatfs='$d_fstatfs'
22264 d_fstatvfs='$d_fstatvfs'
22265 d_fsync='$d_fsync'
22266 d_ftello='$d_ftello'
22267 d_ftime='$d_ftime'
22268 d_futimes='$d_futimes'
22269 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22270 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22271 d_getcwd='$d_getcwd'
22272 d_getespwnam='$d_getespwnam'
22273 d_getfsstat='$d_getfsstat'
22274 d_getgrent='$d_getgrent'
22275 d_getgrent_r='$d_getgrent_r'
22276 d_getgrgid_r='$d_getgrgid_r'
22277 d_getgrnam_r='$d_getgrnam_r'
22278 d_getgrps='$d_getgrps'
22279 d_gethbyaddr='$d_gethbyaddr'
22280 d_gethbyname='$d_gethbyname'
22281 d_gethent='$d_gethent'
22282 d_gethname='$d_gethname'
22283 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22284 d_gethostbyname_r='$d_gethostbyname_r'
22285 d_gethostent_r='$d_gethostent_r'
22286 d_gethostprotos='$d_gethostprotos'
22287 d_getitimer='$d_getitimer'
22288 d_getlogin='$d_getlogin'
22289 d_getlogin_r='$d_getlogin_r'
22290 d_getmnt='$d_getmnt'
22291 d_getmntent='$d_getmntent'
22292 d_getnbyaddr='$d_getnbyaddr'
22293 d_getnbyname='$d_getnbyname'
22294 d_getnent='$d_getnent'
22295 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22296 d_getnetbyname_r='$d_getnetbyname_r'
22297 d_getnetent_r='$d_getnetent_r'
22298 d_getnetprotos='$d_getnetprotos'
22299 d_getpagsz='$d_getpagsz'
22300 d_getpbyname='$d_getpbyname'
22301 d_getpbynumber='$d_getpbynumber'
22302 d_getpent='$d_getpent'
22303 d_getpgid='$d_getpgid'
22304 d_getpgrp2='$d_getpgrp2'
22305 d_getpgrp='$d_getpgrp'
22306 d_getppid='$d_getppid'
22307 d_getprior='$d_getprior'
22308 d_getprotobyname_r='$d_getprotobyname_r'
22309 d_getprotobynumber_r='$d_getprotobynumber_r'
22310 d_getprotoent_r='$d_getprotoent_r'
22311 d_getprotoprotos='$d_getprotoprotos'
22312 d_getprpwnam='$d_getprpwnam'
22313 d_getpwent='$d_getpwent'
22314 d_getpwent_r='$d_getpwent_r'
22315 d_getpwnam_r='$d_getpwnam_r'
22316 d_getpwuid_r='$d_getpwuid_r'
22317 d_getsbyname='$d_getsbyname'
22318 d_getsbyport='$d_getsbyport'
22319 d_getsent='$d_getsent'
22320 d_getservbyname_r='$d_getservbyname_r'
22321 d_getservbyport_r='$d_getservbyport_r'
22322 d_getservent_r='$d_getservent_r'
22323 d_getservprotos='$d_getservprotos'
22324 d_getspnam='$d_getspnam'
22325 d_getspnam_r='$d_getspnam_r'
22326 d_gettimeod='$d_gettimeod'
22327 d_gmtime64='$d_gmtime64'
22328 d_gmtime_r='$d_gmtime_r'
22329 d_gnulibc='$d_gnulibc'
22330 d_grpasswd='$d_grpasswd'
22331 d_hasmntopt='$d_hasmntopt'
22332 d_htonl='$d_htonl'
22333 d_ilogbl='$d_ilogbl'
22334 d_inc_version_list='$d_inc_version_list'
22335 d_index='$d_index'
22336 d_inetaton='$d_inetaton'
22337 d_int64_t='$d_int64_t'
22338 d_isascii='$d_isascii'
22339 d_isfinite='$d_isfinite'
22340 d_isinf='$d_isinf'
22341 d_isnan='$d_isnan'
22342 d_isnanl='$d_isnanl'
22343 d_killpg='$d_killpg'
22344 d_lchown='$d_lchown'
22345 d_ldbl_dig='$d_ldbl_dig'
22346 d_libm_lib_version='$d_libm_lib_version'
22347 d_link='$d_link'
22348 d_localtime64='$d_localtime64'
22349 d_localtime_r='$d_localtime_r'
22350 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22351 d_locconv='$d_locconv'
22352 d_lockf='$d_lockf'
22353 d_longdbl='$d_longdbl'
22354 d_longlong='$d_longlong'
22355 d_lseekproto='$d_lseekproto'
22356 d_lstat='$d_lstat'
22357 d_madvise='$d_madvise'
22358 d_malloc_good_size='$d_malloc_good_size'
22359 d_malloc_size='$d_malloc_size'
22360 d_mblen='$d_mblen'
22361 d_mbstowcs='$d_mbstowcs'
22362 d_mbtowc='$d_mbtowc'
22363 d_memchr='$d_memchr'
22364 d_memcmp='$d_memcmp'
22365 d_memcpy='$d_memcpy'
22366 d_memmove='$d_memmove'
22367 d_memset='$d_memset'
22368 d_mkdir='$d_mkdir'
22369 d_mkdtemp='$d_mkdtemp'
22370 d_mkfifo='$d_mkfifo'
22371 d_mkstemp='$d_mkstemp'
22372 d_mkstemps='$d_mkstemps'
22373 d_mktime64='$d_mktime64'
22374 d_mktime='$d_mktime'
22375 d_mmap='$d_mmap'
22376 d_modfl='$d_modfl'
22377 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22378 d_modflproto='$d_modflproto'
22379 d_mprotect='$d_mprotect'
22380 d_msg='$d_msg'
22381 d_msg_ctrunc='$d_msg_ctrunc'
22382 d_msg_dontroute='$d_msg_dontroute'
22383 d_msg_oob='$d_msg_oob'
22384 d_msg_peek='$d_msg_peek'
22385 d_msg_proxy='$d_msg_proxy'
22386 d_msgctl='$d_msgctl'
22387 d_msgget='$d_msgget'
22388 d_msghdr_s='$d_msghdr_s'
22389 d_msgrcv='$d_msgrcv'
22390 d_msgsnd='$d_msgsnd'
22391 d_msync='$d_msync'
22392 d_munmap='$d_munmap'
22393 d_mymalloc='$d_mymalloc'
22394 d_ndbm='$d_ndbm'
22395 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
22396 d_nice='$d_nice'
22397 d_nl_langinfo='$d_nl_langinfo'
22398 d_nv_preserves_uv='$d_nv_preserves_uv'
22399 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22400 d_off64_t='$d_off64_t'
22401 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22402 d_oldpthreads='$d_oldpthreads'
22403 d_oldsock='$d_oldsock'
22404 d_open3='$d_open3'
22405 d_pathconf='$d_pathconf'
22406 d_pause='$d_pause'
22407 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22408 d_phostname='$d_phostname'
22409 d_pipe='$d_pipe'
22410 d_poll='$d_poll'
22411 d_portable='$d_portable'
22412 d_printf_format_null='$d_printf_format_null'
22413 d_procselfexe='$d_procselfexe'
22414 d_pseudofork='$d_pseudofork'
22415 d_pthread_atfork='$d_pthread_atfork'
22416 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22417 d_pthread_yield='$d_pthread_yield'
22418 d_pwage='$d_pwage'
22419 d_pwchange='$d_pwchange'
22420 d_pwclass='$d_pwclass'
22421 d_pwcomment='$d_pwcomment'
22422 d_pwexpire='$d_pwexpire'
22423 d_pwgecos='$d_pwgecos'
22424 d_pwpasswd='$d_pwpasswd'
22425 d_pwquota='$d_pwquota'
22426 d_qgcvt='$d_qgcvt'
22427 d_quad='$d_quad'
22428 d_random_r='$d_random_r'
22429 d_readdir64_r='$d_readdir64_r'
22430 d_readdir='$d_readdir'
22431 d_readdir_r='$d_readdir_r'
22432 d_readlink='$d_readlink'
22433 d_readv='$d_readv'
22434 d_recvmsg='$d_recvmsg'
22435 d_rename='$d_rename'
22436 d_rewinddir='$d_rewinddir'
22437 d_rmdir='$d_rmdir'
22438 d_safebcpy='$d_safebcpy'
22439 d_safemcpy='$d_safemcpy'
22440 d_sanemcmp='$d_sanemcmp'
22441 d_sbrkproto='$d_sbrkproto'
22442 d_scalbnl='$d_scalbnl'
22443 d_sched_yield='$d_sched_yield'
22444 d_scm_rights='$d_scm_rights'
22445 d_seekdir='$d_seekdir'
22446 d_select='$d_select'
22447 d_sem='$d_sem'
22448 d_semctl='$d_semctl'
22449 d_semctl_semid_ds='$d_semctl_semid_ds'
22450 d_semctl_semun='$d_semctl_semun'
22451 d_semget='$d_semget'
22452 d_semop='$d_semop'
22453 d_sendmsg='$d_sendmsg'
22454 d_setegid='$d_setegid'
22455 d_seteuid='$d_seteuid'
22456 d_setgrent='$d_setgrent'
22457 d_setgrent_r='$d_setgrent_r'
22458 d_setgrps='$d_setgrps'
22459 d_sethent='$d_sethent'
22460 d_sethostent_r='$d_sethostent_r'
22461 d_setitimer='$d_setitimer'
22462 d_setlinebuf='$d_setlinebuf'
22463 d_setlocale='$d_setlocale'
22464 d_setlocale_r='$d_setlocale_r'
22465 d_setnent='$d_setnent'
22466 d_setnetent_r='$d_setnetent_r'
22467 d_setpent='$d_setpent'
22468 d_setpgid='$d_setpgid'
22469 d_setpgrp2='$d_setpgrp2'
22470 d_setpgrp='$d_setpgrp'
22471 d_setprior='$d_setprior'
22472 d_setproctitle='$d_setproctitle'
22473 d_setprotoent_r='$d_setprotoent_r'
22474 d_setpwent='$d_setpwent'
22475 d_setpwent_r='$d_setpwent_r'
22476 d_setregid='$d_setregid'
22477 d_setresgid='$d_setresgid'
22478 d_setresuid='$d_setresuid'
22479 d_setreuid='$d_setreuid'
22480 d_setrgid='$d_setrgid'
22481 d_setruid='$d_setruid'
22482 d_setsent='$d_setsent'
22483 d_setservent_r='$d_setservent_r'
22484 d_setsid='$d_setsid'
22485 d_setvbuf='$d_setvbuf'
22486 d_sfio='$d_sfio'
22487 d_shm='$d_shm'
22488 d_shmat='$d_shmat'
22489 d_shmatprototype='$d_shmatprototype'
22490 d_shmctl='$d_shmctl'
22491 d_shmdt='$d_shmdt'
22492 d_shmget='$d_shmget'
22493 d_sigaction='$d_sigaction'
22494 d_signbit='$d_signbit'
22495 d_sigprocmask='$d_sigprocmask'
22496 d_sigsetjmp='$d_sigsetjmp'
22497 d_sitearch='$d_sitearch'
22498 d_snprintf='$d_snprintf'
22499 d_sockatmark='$d_sockatmark'
22500 d_sockatmarkproto='$d_sockatmarkproto'
22501 d_socket='$d_socket'
22502 d_socklen_t='$d_socklen_t'
22503 d_sockpair='$d_sockpair'
22504 d_socks5_init='$d_socks5_init'
22505 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22506 d_sqrtl='$d_sqrtl'
22507 d_srand48_r='$d_srand48_r'
22508 d_srandom_r='$d_srandom_r'
22509 d_sresgproto='$d_sresgproto'
22510 d_sresuproto='$d_sresuproto'
22511 d_statblks='$d_statblks'
22512 d_statfs_f_flags='$d_statfs_f_flags'
22513 d_statfs_s='$d_statfs_s'
22514 d_statvfs='$d_statvfs'
22515 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22516 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22517 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22518 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22519 d_stdio_stream_array='$d_stdio_stream_array'
22520 d_stdiobase='$d_stdiobase'
22521 d_stdstdio='$d_stdstdio'
22522 d_strchr='$d_strchr'
22523 d_strcoll='$d_strcoll'
22524 d_strctcpy='$d_strctcpy'
22525 d_strerrm='$d_strerrm'
22526 d_strerror='$d_strerror'
22527 d_strerror_r='$d_strerror_r'
22528 d_strftime='$d_strftime'
22529 d_strlcat='$d_strlcat'
22530 d_strlcpy='$d_strlcpy'
22531 d_strtod='$d_strtod'
22532 d_strtol='$d_strtol'
22533 d_strtold='$d_strtold'
22534 d_strtoll='$d_strtoll'
22535 d_strtoq='$d_strtoq'
22536 d_strtoul='$d_strtoul'
22537 d_strtoull='$d_strtoull'
22538 d_strtouq='$d_strtouq'
22539 d_strxfrm='$d_strxfrm'
22540 d_suidsafe='$d_suidsafe'
22541 d_symlink='$d_symlink'
22542 d_syscall='$d_syscall'
22543 d_syscallproto='$d_syscallproto'
22544 d_sysconf='$d_sysconf'
22545 d_sysernlst='$d_sysernlst'
22546 d_syserrlst='$d_syserrlst'
22547 d_system='$d_system'
22548 d_tcgetpgrp='$d_tcgetpgrp'
22549 d_tcsetpgrp='$d_tcsetpgrp'
22550 d_telldir='$d_telldir'
22551 d_telldirproto='$d_telldirproto'
22552 d_time='$d_time'
22553 d_timegm='$d_timegm'
22554 d_times='$d_times'
22555 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22556 d_tm_tm_zone='$d_tm_tm_zone'
22557 d_tmpnam_r='$d_tmpnam_r'
22558 d_truncate='$d_truncate'
22559 d_ttyname_r='$d_ttyname_r'
22560 d_tzname='$d_tzname'
22561 d_u32align='$d_u32align'
22562 d_ualarm='$d_ualarm'
22563 d_umask='$d_umask'
22564 d_uname='$d_uname'
22565 d_union_semun='$d_union_semun'
22566 d_unordered='$d_unordered'
22567 d_unsetenv='$d_unsetenv'
22568 d_usleep='$d_usleep'
22569 d_usleepproto='$d_usleepproto'
22570 d_ustat='$d_ustat'
22571 d_vendorarch='$d_vendorarch'
22572 d_vendorbin='$d_vendorbin'
22573 d_vendorlib='$d_vendorlib'
22574 d_vendorscript='$d_vendorscript'
22575 d_vfork='$d_vfork'
22576 d_void_closedir='$d_void_closedir'
22577 d_voidsig='$d_voidsig'
22578 d_voidtty='$d_voidtty'
22579 d_volatile='$d_volatile'
22580 d_vprintf='$d_vprintf'
22581 d_vsnprintf='$d_vsnprintf'
22582 d_wait4='$d_wait4'
22583 d_waitpid='$d_waitpid'
22584 d_wcstombs='$d_wcstombs'
22585 d_wctomb='$d_wctomb'
22586 d_writev='$d_writev'
22587 d_xenix='$d_xenix'
22588 date='$date'
22589 db_hashtype='$db_hashtype'
22590 db_prefixtype='$db_prefixtype'
22591 db_version_major='$db_version_major'
22592 db_version_minor='$db_version_minor'
22593 db_version_patch='$db_version_patch'
22594 defvoidused='$defvoidused'
22595 direntrytype='$direntrytype'
22596 dlext='$dlext'
22597 dlsrc='$dlsrc'
22598 doublesize='$doublesize'
22599 drand01='$drand01'
22600 drand48_r_proto='$drand48_r_proto'
22601 dtrace='$dtrace'
22602 dynamic_ext='$dynamic_ext'
22603 eagain='$eagain'
22604 ebcdic='$ebcdic'
22605 echo='$echo'
22606 egrep='$egrep'
22607 emacs='$emacs'
22608 endgrent_r_proto='$endgrent_r_proto'
22609 endhostent_r_proto='$endhostent_r_proto'
22610 endnetent_r_proto='$endnetent_r_proto'
22611 endprotoent_r_proto='$endprotoent_r_proto'
22612 endpwent_r_proto='$endpwent_r_proto'
22613 endservent_r_proto='$endservent_r_proto'
22614 eunicefix='$eunicefix'
22615 exe_ext='$exe_ext'
22616 expr='$expr'
22617 extensions='$extensions'
22618 extern_C='$extern_C'
22619 extras='$extras'
22620 fflushNULL='$fflushNULL'
22621 fflushall='$fflushall'
22622 find='$find'
22623 firstmakefile='$firstmakefile'
22624 flex='$flex'
22625 fpossize='$fpossize'
22626 fpostype='$fpostype'
22627 freetype='$freetype'
22628 from='$from'
22629 full_ar='$full_ar'
22630 full_csh='$full_csh'
22631 full_sed='$full_sed'
22632 gccansipedantic='$gccansipedantic'
22633 gccosandvers='$gccosandvers'
22634 gccversion='$gccversion'
22635 getgrent_r_proto='$getgrent_r_proto'
22636 getgrgid_r_proto='$getgrgid_r_proto'
22637 getgrnam_r_proto='$getgrnam_r_proto'
22638 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22639 gethostbyname_r_proto='$gethostbyname_r_proto'
22640 gethostent_r_proto='$gethostent_r_proto'
22641 getlogin_r_proto='$getlogin_r_proto'
22642 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22643 getnetbyname_r_proto='$getnetbyname_r_proto'
22644 getnetent_r_proto='$getnetent_r_proto'
22645 getprotobyname_r_proto='$getprotobyname_r_proto'
22646 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22647 getprotoent_r_proto='$getprotoent_r_proto'
22648 getpwent_r_proto='$getpwent_r_proto'
22649 getpwnam_r_proto='$getpwnam_r_proto'
22650 getpwuid_r_proto='$getpwuid_r_proto'
22651 getservbyname_r_proto='$getservbyname_r_proto'
22652 getservbyport_r_proto='$getservbyport_r_proto'
22653 getservent_r_proto='$getservent_r_proto'
22654 getspnam_r_proto='$getspnam_r_proto'
22655 gidformat='$gidformat'
22656 gidsign='$gidsign'
22657 gidsize='$gidsize'
22658 gidtype='$gidtype'
22659 glibpth='$glibpth'
22660 gmake='$gmake'
22661 gmtime_r_proto='$gmtime_r_proto'
22662 gnulibc_version='$gnulibc_version'
22663 grep='$grep'
22664 groupcat='$groupcat'
22665 groupstype='$groupstype'
22666 gzip='$gzip'
22667 h_fcntl='$h_fcntl'
22668 h_sysfile='$h_sysfile'
22669 hint='$hint'
22670 hostcat='$hostcat'
22671 html1dir='$html1dir'
22672 html1direxp='$html1direxp'
22673 html3dir='$html3dir'
22674 html3direxp='$html3direxp'
22675 i16size='$i16size'
22676 i16type='$i16type'
22677 i32size='$i32size'
22678 i32type='$i32type'
22679 i64size='$i64size'
22680 i64type='$i64type'
22681 i8size='$i8size'
22682 i8type='$i8type'
22683 i_arpainet='$i_arpainet'
22684 i_assert='$i_assert'
22685 i_bsdioctl='$i_bsdioctl'
22686 i_crypt='$i_crypt'
22687 i_db='$i_db'
22688 i_dbm='$i_dbm'
22689 i_dirent='$i_dirent'
22690 i_dld='$i_dld'
22691 i_dlfcn='$i_dlfcn'
22692 i_fcntl='$i_fcntl'
22693 i_float='$i_float'
22694 i_fp='$i_fp'
22695 i_fp_class='$i_fp_class'
22696 i_gdbm='$i_gdbm'
22697 i_gdbm_ndbm='$i_gdbm_ndbm'
22698 i_gdbmndbm='$i_gdbmndbm'
22699 i_grp='$i_grp'
22700 i_ieeefp='$i_ieeefp'
22701 i_inttypes='$i_inttypes'
22702 i_langinfo='$i_langinfo'
22703 i_libutil='$i_libutil'
22704 i_limits='$i_limits'
22705 i_locale='$i_locale'
22706 i_machcthr='$i_machcthr'
22707 i_malloc='$i_malloc'
22708 i_mallocmalloc='$i_mallocmalloc'
22709 i_math='$i_math'
22710 i_memory='$i_memory'
22711 i_mntent='$i_mntent'
22712 i_ndbm='$i_ndbm'
22713 i_netdb='$i_netdb'
22714 i_neterrno='$i_neterrno'
22715 i_netinettcp='$i_netinettcp'
22716 i_niin='$i_niin'
22717 i_poll='$i_poll'
22718 i_prot='$i_prot'
22719 i_pthread='$i_pthread'
22720 i_pwd='$i_pwd'
22721 i_rpcsvcdbm='$i_rpcsvcdbm'
22722 i_sfio='$i_sfio'
22723 i_sgtty='$i_sgtty'
22724 i_shadow='$i_shadow'
22725 i_socks='$i_socks'
22726 i_stdarg='$i_stdarg'
22727 i_stddef='$i_stddef'
22728 i_stdlib='$i_stdlib'
22729 i_string='$i_string'
22730 i_sunmath='$i_sunmath'
22731 i_sysaccess='$i_sysaccess'
22732 i_sysdir='$i_sysdir'
22733 i_sysfile='$i_sysfile'
22734 i_sysfilio='$i_sysfilio'
22735 i_sysin='$i_sysin'
22736 i_sysioctl='$i_sysioctl'
22737 i_syslog='$i_syslog'
22738 i_sysmman='$i_sysmman'
22739 i_sysmode='$i_sysmode'
22740 i_sysmount='$i_sysmount'
22741 i_sysndir='$i_sysndir'
22742 i_sysparam='$i_sysparam'
22743 i_syspoll='$i_syspoll'
22744 i_sysresrc='$i_sysresrc'
22745 i_syssecrt='$i_syssecrt'
22746 i_sysselct='$i_sysselct'
22747 i_syssockio='$i_syssockio'
22748 i_sysstat='$i_sysstat'
22749 i_sysstatfs='$i_sysstatfs'
22750 i_sysstatvfs='$i_sysstatvfs'
22751 i_systime='$i_systime'
22752 i_systimek='$i_systimek'
22753 i_systimes='$i_systimes'
22754 i_systypes='$i_systypes'
22755 i_sysuio='$i_sysuio'
22756 i_sysun='$i_sysun'
22757 i_sysutsname='$i_sysutsname'
22758 i_sysvfs='$i_sysvfs'
22759 i_syswait='$i_syswait'
22760 i_termio='$i_termio'
22761 i_termios='$i_termios'
22762 i_time='$i_time'
22763 i_unistd='$i_unistd'
22764 i_ustat='$i_ustat'
22765 i_utime='$i_utime'
22766 i_values='$i_values'
22767 i_varargs='$i_varargs'
22768 i_varhdr='$i_varhdr'
22769 i_vfork='$i_vfork'
22770 ignore_versioned_solibs='$ignore_versioned_solibs'
22771 inc_version_list='$inc_version_list'
22772 inc_version_list_init='$inc_version_list_init'
22773 incpath='$incpath'
22774 inews='$inews'
22775 initialinstalllocation='$initialinstalllocation'
22776 installarchlib='$installarchlib'
22777 installbin='$installbin'
22778 installhtml1dir='$installhtml1dir'
22779 installhtml3dir='$installhtml3dir'
22780 installman1dir='$installman1dir'
22781 installman3dir='$installman3dir'
22782 installprefix='$installprefix'
22783 installprefixexp='$installprefixexp'
22784 installprivlib='$installprivlib'
22785 installscript='$installscript'
22786 installsitearch='$installsitearch'
22787 installsitebin='$installsitebin'
22788 installsitehtml1dir='$installsitehtml1dir'
22789 installsitehtml3dir='$installsitehtml3dir'
22790 installsitelib='$installsitelib'
22791 installsiteman1dir='$installsiteman1dir'
22792 installsiteman3dir='$installsiteman3dir'
22793 installsitescript='$installsitescript'
22794 installstyle='$installstyle'
22795 installusrbinperl='$installusrbinperl'
22796 installvendorarch='$installvendorarch'
22797 installvendorbin='$installvendorbin'
22798 installvendorhtml1dir='$installvendorhtml1dir'
22799 installvendorhtml3dir='$installvendorhtml3dir'
22800 installvendorlib='$installvendorlib'
22801 installvendorman1dir='$installvendorman1dir'
22802 installvendorman3dir='$installvendorman3dir'
22803 installvendorscript='$installvendorscript'
22804 intsize='$intsize'
22805 issymlink='$issymlink'
22806 ivdformat='$ivdformat'
22807 ivsize='$ivsize'
22808 ivtype='$ivtype'
22809 known_extensions='$known_extensions'
22810 ksh='$ksh'
22811 ld='$ld'
22812 lddlflags='$lddlflags'
22813 ldflags='$ldflags'
22814 ldflags_uselargefiles='$ldflags_uselargefiles'
22815 ldlibpthname='$ldlibpthname'
22816 less='$less'
22817 lib_ext='$lib_ext'
22818 libc='$libc'
22819 libperl='$libperl'
22820 libpth='$libpth'
22821 libs='$libs'
22822 libsdirs='$libsdirs'
22823 libsfiles='$libsfiles'
22824 libsfound='$libsfound'
22825 libspath='$libspath'
22826 libswanted='$libswanted'
22827 libswanted_uselargefiles='$libswanted_uselargefiles'
22828 line='$line'
22829 lint='$lint'
22830 lkflags='$lkflags'
22831 ln='$ln'
22832 lns='$lns'
22833 localtime_r_proto='$localtime_r_proto'
22834 locincpth='$locincpth'
22835 loclibpth='$loclibpth'
22836 longdblsize='$longdblsize'
22837 longlongsize='$longlongsize'
22838 longsize='$longsize'
22839 lp='$lp'
22840 lpr='$lpr'
22841 ls='$ls'
22842 lseeksize='$lseeksize'
22843 lseektype='$lseektype'
22844 mad='$mad'
22845 madlyh='$madlyh'
22846 madlyobj='$madlyobj'
22847 madlysrc='$madlysrc'
22848 mail='$mail'
22849 mailx='$mailx'
22850 make='$make'
22851 make_set_make='$make_set_make'
22852 mallocobj='$mallocobj'
22853 mallocsrc='$mallocsrc'
22854 malloctype='$malloctype'
22855 man1dir='$man1dir'
22856 man1direxp='$man1direxp'
22857 man1ext='$man1ext'
22858 man3dir='$man3dir'
22859 man3direxp='$man3direxp'
22860 man3ext='$man3ext'
22861 mips_type='$mips_type'
22862 mistrustnm='$mistrustnm'
22863 mkdir='$mkdir'
22864 mmaptype='$mmaptype'
22865 modetype='$modetype'
22866 more='$more'
22867 multiarch='$multiarch'
22868 mv='$mv'
22869 myarchname='$myarchname'
22870 mydomain='$mydomain'
22871 myhostname='$myhostname'
22872 myuname='$myuname'
22873 n='$n'
22874 need_va_copy='$need_va_copy'
22875 netdb_hlen_type='$netdb_hlen_type'
22876 netdb_host_type='$netdb_host_type'
22877 netdb_name_type='$netdb_name_type'
22878 netdb_net_type='$netdb_net_type'
22879 nm='$nm'
22880 nm_opt='$nm_opt'
22881 nm_so_opt='$nm_so_opt'
22882 nonxs_ext='$nonxs_ext'
22883 nroff='$nroff'
22884 nvEUformat='$nvEUformat'
22885 nvFUformat='$nvFUformat'
22886 nvGUformat='$nvGUformat'
22887 nv_overflows_integers_at='$nv_overflows_integers_at'
22888 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22889 nveformat='$nveformat'
22890 nvfformat='$nvfformat'
22891 nvgformat='$nvgformat'
22892 nvsize='$nvsize'
22893 nvtype='$nvtype'
22894 o_nonblock='$o_nonblock'
22895 obj_ext='$obj_ext'
22896 old_pthread_create_joinable='$old_pthread_create_joinable'
22897 optimize='$optimize'
22898 orderlib='$orderlib'
22899 osname='$osname'
22900 osvers='$osvers'
22901 otherlibdirs='$otherlibdirs'
22902 package='$package'
22903 pager='$pager'
22904 passcat='$passcat'
22905 patchlevel='$patchlevel'
22906 path_sep='$path_sep'
22907 perl5='$perl5'
22908 perl='$perl'
22909 perl_patchlevel='$perl_patchlevel'
22910 perladmin='$perladmin'
22911 perllibs='$perllibs'
22912 perlpath='$perlpath'
22913 pg='$pg'
22914 phostname='$phostname'
22915 pidtype='$pidtype'
22916 plibpth='$plibpth'
22917 pmake='$pmake'
22918 pr='$pr'
22919 prefix='$prefix'
22920 prefixexp='$prefixexp'
22921 privlib='$privlib'
22922 privlibexp='$privlibexp'
22923 procselfexe='$procselfexe'
22924 prototype='$prototype'
22925 ptrsize='$ptrsize'
22926 quadkind='$quadkind'
22927 quadtype='$quadtype'
22928 randbits='$randbits'
22929 randfunc='$randfunc'
22930 random_r_proto='$random_r_proto'
22931 randseedtype='$randseedtype'
22932 ranlib='$ranlib'
22933 rd_nodata='$rd_nodata'
22934 readdir64_r_proto='$readdir64_r_proto'
22935 readdir_r_proto='$readdir_r_proto'
22936 revision='$revision'
22937 rm='$rm'
22938 rm_try='$rm_try'
22939 rmail='$rmail'
22940 run='$run'
22941 runnm='$runnm'
22942 sGMTIME_max='$sGMTIME_max'
22943 sGMTIME_min='$sGMTIME_min'
22944 sLOCALTIME_max='$sLOCALTIME_max'
22945 sLOCALTIME_min='$sLOCALTIME_min'
22946 sPRIEUldbl='$sPRIEUldbl'
22947 sPRIFUldbl='$sPRIFUldbl'
22948 sPRIGUldbl='$sPRIGUldbl'
22949 sPRIXU64='$sPRIXU64'
22950 sPRId64='$sPRId64'
22951 sPRIeldbl='$sPRIeldbl'
22952 sPRIfldbl='$sPRIfldbl'
22953 sPRIgldbl='$sPRIgldbl'
22954 sPRIi64='$sPRIi64'
22955 sPRIo64='$sPRIo64'
22956 sPRIu64='$sPRIu64'
22957 sPRIx64='$sPRIx64'
22958 sSCNfldbl='$sSCNfldbl'
22959 sched_yield='$sched_yield'
22960 scriptdir='$scriptdir'
22961 scriptdirexp='$scriptdirexp'
22962 sed='$sed'
22963 seedfunc='$seedfunc'
22964 selectminbits='$selectminbits'
22965 selecttype='$selecttype'
22966 sendmail='$sendmail'
22967 setgrent_r_proto='$setgrent_r_proto'
22968 sethostent_r_proto='$sethostent_r_proto'
22969 setlocale_r_proto='$setlocale_r_proto'
22970 setnetent_r_proto='$setnetent_r_proto'
22971 setprotoent_r_proto='$setprotoent_r_proto'
22972 setpwent_r_proto='$setpwent_r_proto'
22973 setservent_r_proto='$setservent_r_proto'
22974 sh='$sh'
22975 shar='$shar'
22976 sharpbang='$sharpbang'
22977 shmattype='$shmattype'
22978 shortsize='$shortsize'
22979 shrpenv='$shrpenv'
22980 shsharp='$shsharp'
22981 sig_count='$sig_count'
22982 sig_name='$sig_name'
22983 sig_name_init='$sig_name_init'
22984 sig_num='$sig_num'
22985 sig_num_init='$sig_num_init'
22986 sig_size='$sig_size'
22987 signal_t='$signal_t'
22988 sitearch='$sitearch'
22989 sitearchexp='$sitearchexp'
22990 sitebin='$sitebin'
22991 sitebinexp='$sitebinexp'
22992 sitehtml1dir='$sitehtml1dir'
22993 sitehtml1direxp='$sitehtml1direxp'
22994 sitehtml3dir='$sitehtml3dir'
22995 sitehtml3direxp='$sitehtml3direxp'
22996 sitelib='$sitelib'
22997 sitelib_stem='$sitelib_stem'
22998 sitelibexp='$sitelibexp'
22999 siteman1dir='$siteman1dir'
23000 siteman1direxp='$siteman1direxp'
23001 siteman3dir='$siteman3dir'
23002 siteman3direxp='$siteman3direxp'
23003 siteprefix='$siteprefix'
23004 siteprefixexp='$siteprefixexp'
23005 sitescript='$sitescript'
23006 sitescriptexp='$sitescriptexp'
23007 sizesize='$sizesize'
23008 sizetype='$sizetype'
23009 sleep='$sleep'
23010 smail='$smail'
23011 so='$so'
23012 sockethdr='$sockethdr'
23013 socketlib='$socketlib'
23014 socksizetype='$socksizetype'
23015 sort='$sort'
23016 spackage='$spackage'
23017 spitshell='$spitshell'
23018 srand48_r_proto='$srand48_r_proto'
23019 srandom_r_proto='$srandom_r_proto'
23020 src='$src'
23021 ssizetype='$ssizetype'
23022 startperl='$startperl'
23023 startsh='$startsh'
23024 static_ext='$static_ext'
23025 stdchar='$stdchar'
23026 stdio_base='$stdio_base'
23027 stdio_bufsiz='$stdio_bufsiz'
23028 stdio_cnt='$stdio_cnt'
23029 stdio_filbuf='$stdio_filbuf'
23030 stdio_ptr='$stdio_ptr'
23031 stdio_stream_array='$stdio_stream_array'
23032 strerror_r_proto='$strerror_r_proto'
23033 strings='$strings'
23034 submit='$submit'
23035 subversion='$subversion'
23036 sysman='$sysman'
23037 tail='$tail'
23038 tar='$tar'
23039 targetarch='$targetarch'
23040 tbl='$tbl'
23041 tee='$tee'
23042 test='$test'
23043 timeincl='$timeincl'
23044 timetype='$timetype'
23045 tmpnam_r_proto='$tmpnam_r_proto'
23046 to='$to'
23047 touch='$touch'
23048 tr='$tr'
23049 trnl='$trnl'
23050 troff='$troff'
23051 ttyname_r_proto='$ttyname_r_proto'
23052 u16size='$u16size'
23053 u16type='$u16type'
23054 u32size='$u32size'
23055 u32type='$u32type'
23056 u64size='$u64size'
23057 u64type='$u64type'
23058 u8size='$u8size'
23059 u8type='$u8type'
23060 uidformat='$uidformat'
23061 uidsign='$uidsign'
23062 uidsize='$uidsize'
23063 uidtype='$uidtype'
23064 uname='$uname'
23065 uniq='$uniq'
23066 uquadtype='$uquadtype'
23067 use5005threads='$use5005threads'
23068 use64bitall='$use64bitall'
23069 use64bitint='$use64bitint'
23070 usecrosscompile='$usecrosscompile'
23071 usedevel='$usedevel'
23072 usedl='$usedl'
23073 usedtrace='$usedtrace'
23074 usefaststdio='$usefaststdio'
23075 useithreads='$useithreads'
23076 uselargefiles='$uselargefiles'
23077 uselongdouble='$uselongdouble'
23078 usemallocwrap='$usemallocwrap'
23079 usemorebits='$usemorebits'
23080 usemultiplicity='$usemultiplicity'
23081 usemymalloc='$usemymalloc'
23082 usenm='$usenm'
23083 useopcode='$useopcode'
23084 useperlio='$useperlio'
23085 useposix='$useposix'
23086 usereentrant='$usereentrant'
23087 userelocatableinc='$userelocatableinc'
23088 usesfio='$usesfio'
23089 useshrplib='$useshrplib'
23090 usesitecustomize='$usesitecustomize'
23091 usesocks='$usesocks'
23092 usethreads='$usethreads'
23093 usevendorprefix='$usevendorprefix'
23094 usevfork='$usevfork'
23095 usrinc='$usrinc'
23096 uuname='$uuname'
23097 uvXUformat='$uvXUformat'
23098 uvoformat='$uvoformat'
23099 uvsize='$uvsize'
23100 uvtype='$uvtype'
23101 uvuformat='$uvuformat'
23102 uvxformat='$uvxformat'
23103 vendorarch='$vendorarch'
23104 vendorarchexp='$vendorarchexp'
23105 vendorbin='$vendorbin'
23106 vendorbinexp='$vendorbinexp'
23107 vendorhtml1dir='$vendorhtml1dir'
23108 vendorhtml1direxp='$vendorhtml1direxp'
23109 vendorhtml3dir='$vendorhtml3dir'
23110 vendorhtml3direxp='$vendorhtml3direxp'
23111 vendorlib='$vendorlib'
23112 vendorlib_stem='$vendorlib_stem'
23113 vendorlibexp='$vendorlibexp'
23114 vendorman1dir='$vendorman1dir'
23115 vendorman1direxp='$vendorman1direxp'
23116 vendorman3dir='$vendorman3dir'
23117 vendorman3direxp='$vendorman3direxp'
23118 vendorprefix='$vendorprefix'
23119 vendorprefixexp='$vendorprefixexp'
23120 vendorscript='$vendorscript'
23121 vendorscriptexp='$vendorscriptexp'
23122 version='$version'
23123 version_patchlevel_string='$version_patchlevel_string'
23124 versiononly='$versiononly'
23125 vi='$vi'
23126 voidflags='$voidflags'
23127 xlibpth='$xlibpth'
23128 yacc='$yacc'
23129 yaccflags='$yaccflags'
23130 zcat='$zcat'
23131 zip='$zip'
23132 EOT
23133
23134 : Add in command line options if available
23135 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23136
23137 : add special variables
23138 $test -f $src/patchlevel.h && \
23139 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23140 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23141 echo "PERL_CONFIG_SH=true" >>config.sh
23142
23143 : propagate old symbols
23144 if $test -f UU/config.sh; then
23145         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23146         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23147                 config.sh config.sh UU/oldconfig.sh |\
23148                 $sort | $uniq -u >UU/oldsyms
23149         set X `cat UU/oldsyms`
23150         shift
23151         case $# in
23152         0) ;;
23153         *)
23154                 cat <<EOM
23155 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23156 EOM
23157                 echo ": Variables propagated from previous config.sh file." >>config.sh
23158                 for sym in `cat UU/oldsyms`; do
23159                         echo "    Propagating $hint variable "'$'"$sym..."
23160                         eval 'tmp="$'"${sym}"'"'
23161                         echo "$tmp" | \
23162                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23163                 done
23164                 ;;
23165         esac
23166 fi
23167
23168 : Finish up by extracting the .SH files
23169 case "$alldone" in
23170 exit)
23171         $rm -rf UU
23172         echo "Extraction done."
23173         exit 0
23174         ;;
23175 cont)
23176         ;;
23177 '')
23178         dflt=''
23179         nostick=true
23180         $cat <<EOM
23181
23182 If you'd like to make any changes to the config.sh file before I begin
23183 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23184
23185 EOM
23186         rp="Press return or use a shell escape to edit config.sh:"
23187         . UU/myread
23188         nostick=''
23189         case "$ans" in
23190         '') ;;
23191         *) : in case they cannot read
23192                 sh 1>&4 -c "$ans";;
23193         esac
23194         ;;
23195 esac
23196
23197 : if this fails, just run all the .SH files by hand
23198 . ./config.sh
23199
23200 echo " "
23201 exec 1>&4
23202 pwd=`pwd`
23203 . ./UU/extract
23204 cd "$pwd"
23205
23206 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23207         dflt=y
23208         case "$silent" in
23209         true) ;;
23210         *)
23211                 $cat <<EOM
23212
23213 Now you need to generate make dependencies by running "$make depend".
23214 You might prefer to run it in background: "$make depend > makedepend.out &"
23215 It can take a while, so you might not want to run it right now.
23216
23217 EOM
23218                 ;;
23219         esac
23220         rp="Run $make depend now?"
23221         . UU/myread
23222         case "$ans" in
23223         y*)
23224                 $make depend && echo "Now you must run '$make'."
23225                 ;;
23226         *)
23227                 echo "You must run '$make depend' then '$make'."
23228                 ;;
23229         esac
23230 elif test -f [Mm]akefile; then
23231         echo " "
23232         echo "Now you must run a $make."
23233 else
23234         echo "Configure done."
23235 fi
23236
23237 if $test -f Policy.sh; then
23238     $cat <<EOM
23239
23240 If you compile $package on a different machine or from a different object
23241 directory, copy the Policy.sh file from this object directory to the
23242 new one before you run Configure -- this will help you with most of
23243 the policy defaults.
23244
23245 EOM
23246 fi
23247 if $test -f config.msg; then
23248     echo "Hmm.  I also noted the following information while running:"
23249     echo " "
23250     $cat config.msg >&4
23251     $rm -f config.msg
23252 fi
23253 $rm -f kit*isdone ark*isdone
23254 $rm -rf UU
23255
23256 : End of Configure
23257