Allow lvalue usage of SvRV() and add MUTABLE_SV() check.
[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 Nov  6 21:06:19 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 perllibs=''
213 dynamic_ext=''
214 extensions=''
215 known_extensions=''
216 nonxs_ext=''
217 static_ext=''
218 useopcode=''
219 useposix=''
220 extras=''
221 d_bsd=''
222 d_eunice=''
223 d_xenix=''
224 eunicefix=''
225 ar=''
226 awk=''
227 bash=''
228 bison=''
229 byacc=''
230 cat=''
231 chgrp=''
232 chmod=''
233 chown=''
234 comm=''
235 compress=''
236 cp=''
237 cpio=''
238 cpp=''
239 csh=''
240 date=''
241 echo=''
242 egrep=''
243 emacs=''
244 expr=''
245 find=''
246 flex=''
247 gmake=''
248 grep=''
249 gzip=''
250 inews=''
251 ksh=''
252 less=''
253 line=''
254 lint=''
255 ln=''
256 lp=''
257 lpr=''
258 ls=''
259 mail=''
260 mailx=''
261 make=''
262 mkdir=''
263 more=''
264 mv=''
265 nm=''
266 nroff=''
267 perl=''
268 pg=''
269 pmake=''
270 pr=''
271 rm=''
272 rmail=''
273 sed=''
274 sendmail=''
275 shar=''
276 sleep=''
277 smail=''
278 sort=''
279 submit=''
280 tail=''
281 tar=''
282 tbl=''
283 tee=''
284 test=''
285 touch=''
286 tr=''
287 troff=''
288 uname=''
289 uniq=''
290 uuname=''
291 vi=''
292 zcat=''
293 zip=''
294 full_ar=''
295 full_sed=''
296 libswanted=''
297 hint=''
298 myuname=''
299 osname=''
300 osvers=''
301 Author=''
302 Date=''
303 Header=''
304 Id=''
305 Locker=''
306 Log=''
307 RCSfile=''
308 Revision=''
309 Source=''
310 State=''
311 _a=''
312 _exe=''
313 _o=''
314 archobjs=''
315 exe_ext=''
316 firstmakefile=''
317 lib_ext=''
318 obj_ext=''
319 path_sep=''
320 rm_try=''
321 afs=''
322 afsroot=''
323 alignbytes=''
324 ansi2knr=''
325 archlib=''
326 archlibexp=''
327 d_archlib=''
328 installarchlib=''
329 archname=''
330 myarchname=''
331 d_atolf=''
332 d_atoll=''
333 baserev=''
334 bin=''
335 binexp=''
336 initialinstalllocation=''
337 installbin=''
338 userelocatableinc=''
339 byteorder=''
340 cc=''
341 ccflags=''
342 cppflags=''
343 ldflags=''
344 lkflags=''
345 locincpth=''
346 optimize=''
347 cf_email=''
348 cf_by=''
349 cf_time=''
350 contains=''
351 cpp_stuff=''
352 cpplast=''
353 cppminus=''
354 cpprun=''
355 cppstdin=''
356 d__fwalk=''
357 d_access=''
358 d_accessx=''
359 d_aintl=''
360 d_alarm=''
361 asctime_r_proto=''
362 d_asctime_r=''
363 d_attribute_format=''
364 d_attribute_malloc=''
365 d_attribute_nonnull=''
366 d_attribute_noreturn=''
367 d_attribute_pure=''
368 d_attribute_unused=''
369 d_attribute_warn_unused_result=''
370 d_printf_format_null=''
371 d_bcmp=''
372 d_bcopy=''
373 d_builtin_choose_expr=''
374 d_builtin_expect=''
375 d_bzero=''
376 d_c99_variadic_macros=''
377 d_casti32=''
378 castflags=''
379 d_castneg=''
380 d_chown=''
381 d_chroot=''
382 d_chsize=''
383 d_class=''
384 d_clearenv=''
385 d_closedir=''
386 d_void_closedir=''
387 d_cmsghdr_s=''
388 d_const=''
389 d_copysignl=''
390 d_cplusplus=''
391 cryptlib=''
392 d_crypt=''
393 crypt_r_proto=''
394 d_crypt_r=''
395 d_csh=''
396 full_csh=''
397 d_ctermid=''
398 ctermid_r_proto=''
399 d_ctermid_r=''
400 ctime_r_proto=''
401 d_ctime_r=''
402 d_cuserid=''
403 d_dbl_dig=''
404 d_dbminitproto=''
405 d_difftime=''
406 d_dir_dd_fd=''
407 d_dirfd=''
408 d_dlerror=''
409 d_dlopen=''
410 d_dlsymun=''
411 d_dosuid=''
412 d_suidsafe=''
413 d_drand48_r=''
414 drand48_r_proto=''
415 d_drand48proto=''
416 d_dup2=''
417 d_eaccess=''
418 d_endgrent=''
419 d_endgrent_r=''
420 endgrent_r_proto=''
421 d_endhent=''
422 d_endhostent_r=''
423 endhostent_r_proto=''
424 d_endnent=''
425 d_endnetent_r=''
426 endnetent_r_proto=''
427 d_endpent=''
428 d_endprotoent_r=''
429 endprotoent_r_proto=''
430 d_endpwent=''
431 d_endpwent_r=''
432 endpwent_r_proto=''
433 d_endsent=''
434 d_endservent_r=''
435 endservent_r_proto=''
436 d_faststdio=''
437 d_fchdir=''
438 d_fchmod=''
439 d_fchown=''
440 d_fcntl=''
441 d_fcntl_can_lock=''
442 d_fd_macros=''
443 d_fd_set=''
444 d_fds_bits=''
445 d_fgetpos=''
446 d_finite=''
447 d_finitel=''
448 d_flexfnam=''
449 d_flock=''
450 d_flockproto=''
451 d_fork=''
452 d_fp_class=''
453 d_fpclass=''
454 d_fpclassify=''
455 d_fpclassl=''
456 d_fpos64_t=''
457 d_frexpl=''
458 d_fs_data_s=''
459 d_fseeko=''
460 d_fsetpos=''
461 d_fstatfs=''
462 d_fsync=''
463 d_ftello=''
464 d_ftime=''
465 d_gettimeod=''
466 d_futimes=''
467 d_Gconvert=''
468 d_getcwd=''
469 d_getespwnam=''
470 d_getfsstat=''
471 d_getgrent=''
472 d_getgrent_r=''
473 getgrent_r_proto=''
474 d_getgrgid_r=''
475 getgrgid_r_proto=''
476 d_getgrnam_r=''
477 getgrnam_r_proto=''
478 d_getgrps=''
479 d_gethbyaddr=''
480 d_gethbyname=''
481 d_gethent=''
482 aphostname=''
483 d_gethname=''
484 d_phostname=''
485 d_uname=''
486 d_gethostbyaddr_r=''
487 gethostbyaddr_r_proto=''
488 d_gethostbyname_r=''
489 gethostbyname_r_proto=''
490 d_gethostent_r=''
491 gethostent_r_proto=''
492 d_gethostprotos=''
493 d_getitimer=''
494 d_getlogin=''
495 d_getlogin_r=''
496 getlogin_r_proto=''
497 d_getmnt=''
498 d_getmntent=''
499 d_getnbyaddr=''
500 d_getnbyname=''
501 d_getnent=''
502 d_getnetbyaddr_r=''
503 getnetbyaddr_r_proto=''
504 d_getnetbyname_r=''
505 getnetbyname_r_proto=''
506 d_getnetent_r=''
507 getnetent_r_proto=''
508 d_getnetprotos=''
509 d_getpagsz=''
510 d_getpent=''
511 d_getpgid=''
512 d_getpgrp2=''
513 d_bsdgetpgrp=''
514 d_getpgrp=''
515 d_getppid=''
516 d_getprior=''
517 d_getpbyname=''
518 d_getpbynumber=''
519 d_getprotobyname_r=''
520 getprotobyname_r_proto=''
521 d_getprotobynumber_r=''
522 getprotobynumber_r_proto=''
523 d_getprotoent_r=''
524 getprotoent_r_proto=''
525 d_getprotoprotos=''
526 d_getprpwnam=''
527 d_getpwent=''
528 d_getpwent_r=''
529 getpwent_r_proto=''
530 d_getpwnam_r=''
531 getpwnam_r_proto=''
532 d_getpwuid_r=''
533 getpwuid_r_proto=''
534 d_getsent=''
535 d_getservbyname_r=''
536 getservbyname_r_proto=''
537 d_getservbyport_r=''
538 getservbyport_r_proto=''
539 d_getservent_r=''
540 getservent_r_proto=''
541 d_getservprotos=''
542 d_getspnam=''
543 d_getspnam_r=''
544 getspnam_r_proto=''
545 d_getsbyname=''
546 d_getsbyport=''
547 d_gmtime_r=''
548 gmtime_r_proto=''
549 d_gnulibc=''
550 gnulibc_version=''
551 d_hasmntopt=''
552 d_htonl=''
553 d_ilogbl=''
554 d_inetaton=''
555 d_int64_t=''
556 d_isascii=''
557 d_isfinite=''
558 d_isinf=''
559 d_isnan=''
560 d_isnanl=''
561 d_killpg=''
562 d_lchown=''
563 d_ldbl_dig=''
564 d_libm_lib_version=''
565 d_link=''
566 d_localtime_r=''
567 d_localtime_r_needs_tzset=''
568 localtime_r_proto=''
569 d_locconv=''
570 d_lockf=''
571 d_longdbl=''
572 longdblsize=''
573 d_longlong=''
574 longlongsize=''
575 d_lseekproto=''
576 d_lstat=''
577 d_madvise=''
578 d_malloc_good_size=''
579 d_malloc_size=''
580 d_mblen=''
581 d_mbstowcs=''
582 d_mbtowc=''
583 d_memchr=''
584 d_memcmp=''
585 d_memcpy=''
586 d_memmove=''
587 d_memset=''
588 d_mkdir=''
589 d_mkdtemp=''
590 d_mkfifo=''
591 d_mkstemp=''
592 d_mkstemps=''
593 d_mktime=''
594 d_mmap=''
595 mmaptype=''
596 d_modfl=''
597 d_modfl_pow32_bug=''
598 d_modflproto=''
599 d_mprotect=''
600 d_msg=''
601 d_msgctl=''
602 d_msgget=''
603 d_msghdr_s=''
604 d_msgrcv=''
605 d_msgsnd=''
606 d_msync=''
607 d_munmap=''
608 d_nice=''
609 d_nl_langinfo=''
610 d_off64_t=''
611 d_open3=''
612 d_fpathconf=''
613 d_pathconf=''
614 d_pause=''
615 d_pipe=''
616 d_poll=''
617 d_portable=''
618 d_procselfexe=''
619 procselfexe=''
620 d_old_pthread_create_joinable=''
621 old_pthread_create_joinable=''
622 d_pthread_atfork=''
623 d_pthread_attr_setscope=''
624 d_pthread_yield=''
625 d_sched_yield=''
626 sched_yield=''
627 d_qgcvt=''
628 d_random_r=''
629 random_r_proto=''
630 d_readdir64_r=''
631 readdir64_r_proto=''
632 d_readdir=''
633 d_rewinddir=''
634 d_seekdir=''
635 d_telldir=''
636 d_readdir_r=''
637 readdir_r_proto=''
638 d_readlink=''
639 d_readv=''
640 d_recvmsg=''
641 d_rename=''
642 d_rmdir=''
643 d_safebcpy=''
644 d_safemcpy=''
645 d_sanemcmp=''
646 d_sbrkproto=''
647 d_scalbnl=''
648 d_select=''
649 d_sem=''
650 d_semctl=''
651 d_semget=''
652 d_semop=''
653 d_sendmsg=''
654 d_setegid=''
655 d_seteuid=''
656 d_setgrent=''
657 d_setgrent_r=''
658 setgrent_r_proto=''
659 d_setgrps=''
660 d_sethent=''
661 d_sethostent_r=''
662 sethostent_r_proto=''
663 d_setitimer=''
664 d_setlinebuf=''
665 d_setlocale=''
666 d_setlocale_r=''
667 setlocale_r_proto=''
668 d_setnent=''
669 d_setnetent_r=''
670 setnetent_r_proto=''
671 d_setpent=''
672 d_setpgid=''
673 d_setpgrp2=''
674 d_bsdsetpgrp=''
675 d_setpgrp=''
676 d_setprior=''
677 d_setproctitle=''
678 d_setprotoent_r=''
679 setprotoent_r_proto=''
680 d_setpwent=''
681 d_setpwent_r=''
682 setpwent_r_proto=''
683 d_setregid=''
684 d_setresgid=''
685 d_setresuid=''
686 d_setreuid=''
687 d_setrgid=''
688 d_setruid=''
689 d_setsent=''
690 d_setservent_r=''
691 setservent_r_proto=''
692 d_setsid=''
693 d_setvbuf=''
694 d_sfio=''
695 usesfio=''
696 d_shm=''
697 d_shmat=''
698 d_shmatprototype=''
699 shmattype=''
700 d_shmctl=''
701 d_shmdt=''
702 d_shmget=''
703 d_sigaction=''
704 d_signbit=''
705 d_sigprocmask=''
706 d_sigsetjmp=''
707 usesitecustomize=''
708 d_snprintf=''
709 d_vsnprintf=''
710 d_sockatmark=''
711 d_sockatmarkproto=''
712 d_msg_ctrunc=''
713 d_msg_dontroute=''
714 d_msg_oob=''
715 d_msg_peek=''
716 d_msg_proxy=''
717 d_oldsock=''
718 d_scm_rights=''
719 d_socket=''
720 d_sockpair=''
721 sockethdr=''
722 socketlib=''
723 d_socklen_t=''
724 d_socks5_init=''
725 d_sprintf_returns_strlen=''
726 d_sqrtl=''
727 d_srand48_r=''
728 srand48_r_proto=''
729 d_srandom_r=''
730 srandom_r_proto=''
731 d_sresgproto=''
732 d_sresuproto=''
733 d_statblks=''
734 d_statfs_f_flags=''
735 d_statfs_s=''
736 d_fstatvfs=''
737 d_statvfs=''
738 d_stdio_cnt_lval=''
739 d_stdio_ptr_lval=''
740 d_stdio_ptr_lval_nochange_cnt=''
741 d_stdio_ptr_lval_sets_cnt=''
742 d_stdiobase=''
743 d_stdstdio=''
744 stdio_base=''
745 stdio_bufsiz=''
746 stdio_cnt=''
747 stdio_filbuf=''
748 stdio_ptr=''
749 d_index=''
750 d_strchr=''
751 d_strcoll=''
752 d_strctcpy=''
753 d_strerrm=''
754 d_strerror=''
755 d_sysernlst=''
756 d_syserrlst=''
757 d_strerror_r=''
758 strerror_r_proto=''
759 d_strftime=''
760 d_strlcat=''
761 d_strlcpy=''
762 d_strtod=''
763 d_strtol=''
764 d_strtold=''
765 d_strtoll=''
766 d_strtoq=''
767 d_strtoul=''
768 d_strtoull=''
769 d_strtouq=''
770 d_strxfrm=''
771 d_symlink=''
772 d_syscall=''
773 d_syscallproto=''
774 d_sysconf=''
775 d_system=''
776 d_tcgetpgrp=''
777 d_tcsetpgrp=''
778 d_telldirproto=''
779 d_time=''
780 timetype=''
781 d_asctime64=''
782 d_ctime64=''
783 d_difftime64=''
784 d_gmtime64=''
785 d_localtime64=''
786 d_mktime64=''
787 d_timegm=''
788 clocktype=''
789 d_times=''
790 d_tmpnam_r=''
791 tmpnam_r_proto=''
792 d_truncate=''
793 d_ttyname_r=''
794 ttyname_r_proto=''
795 d_tzname=''
796 d_u32align=''
797 d_ualarm=''
798 d_umask=''
799 d_semctl_semid_ds=''
800 d_semctl_semun=''
801 d_union_semun=''
802 d_unordered=''
803 d_unsetenv=''
804 d_usleep=''
805 d_usleepproto=''
806 d_ustat=''
807 d_pseudofork=''
808 d_vfork=''
809 usevfork=''
810 d_voidsig=''
811 signal_t=''
812 d_volatile=''
813 d_charvspr=''
814 d_vprintf=''
815 d_wait4=''
816 d_waitpid=''
817 d_wcstombs=''
818 d_wctomb=''
819 d_writev=''
820 dlext=''
821 cccdlflags=''
822 ccdlflags=''
823 dlsrc=''
824 ld=''
825 lddlflags=''
826 usedl=''
827 doublesize=''
828 ebcdic=''
829 fflushNULL=''
830 fflushall=''
831 fpossize=''
832 fpostype=''
833 gccansipedantic=''
834 gccosandvers=''
835 gccversion=''
836 gidformat=''
837 gidsign=''
838 gidsize=''
839 gidtype=''
840 groupstype=''
841 h_fcntl=''
842 h_sysfile=''
843 html1dir=''
844 html1direxp=''
845 installhtml1dir=''
846 html3dir=''
847 html3direxp=''
848 installhtml3dir=''
849 i_arpainet=''
850 i_assert=''
851 i_crypt=''
852 db_hashtype=''
853 db_prefixtype=''
854 db_version_major=''
855 db_version_minor=''
856 db_version_patch=''
857 i_db=''
858 i_dbm=''
859 i_rpcsvcdbm=''
860 d_dirnamlen=''
861 direntrytype=''
862 i_dirent=''
863 i_dld=''
864 i_dlfcn=''
865 i_fcntl=''
866 i_float=''
867 i_fp=''
868 i_fp_class=''
869 i_gdbm=''
870 d_grpasswd=''
871 i_grp=''
872 i_ieeefp=''
873 i_inttypes=''
874 i_langinfo=''
875 i_libutil=''
876 i_limits=''
877 i_locale=''
878 i_machcthr=''
879 i_malloc=''
880 i_mallocmalloc=''
881 i_math=''
882 i_memory=''
883 i_mntent=''
884 d_gdbm_ndbm_h_uses_prototypes=''
885 d_gdbmndbm_h_uses_prototypes=''
886 d_ndbm=''
887 d_ndbm_h_uses_prototypes=''
888 i_gdbm_ndbm=''
889 i_gdbmndbm=''
890 i_ndbm=''
891 i_netdb=''
892 i_neterrno=''
893 i_netinettcp=''
894 i_niin=''
895 i_sysin=''
896 i_poll=''
897 i_prot=''
898 i_pthread=''
899 d_pwage=''
900 d_pwchange=''
901 d_pwclass=''
902 d_pwcomment=''
903 d_pwexpire=''
904 d_pwgecos=''
905 d_pwpasswd=''
906 d_pwquota=''
907 i_pwd=''
908 i_sfio=''
909 i_shadow=''
910 i_socks=''
911 i_stddef=''
912 i_stdlib=''
913 i_string=''
914 strings=''
915 i_sunmath=''
916 i_sysaccess=''
917 i_sysdir=''
918 i_sysfile=''
919 d_voidtty=''
920 i_bsdioctl=''
921 i_sysfilio=''
922 i_sysioctl=''
923 i_syssockio=''
924 i_syslog=''
925 i_sysmman=''
926 i_sysmode=''
927 i_sysmount=''
928 i_sysndir=''
929 i_sysparam=''
930 i_syspoll=''
931 i_sysresrc=''
932 i_syssecrt=''
933 i_sysselct=''
934 i_sysstat=''
935 i_sysstatfs=''
936 i_sysstatvfs=''
937 i_systimes=''
938 i_systypes=''
939 i_sysuio=''
940 i_sysun=''
941 i_sysutsname=''
942 i_sysvfs=''
943 i_syswait=''
944 i_sgtty=''
945 i_termio=''
946 i_termios=''
947 d_tm_tm_gmtoff=''
948 d_tm_tm_zone=''
949 i_systime=''
950 i_systimek=''
951 i_time=''
952 timeincl=''
953 i_unistd=''
954 i_ustat=''
955 i_utime=''
956 i_values=''
957 i_stdarg=''
958 i_varargs=''
959 i_varhdr=''
960 i_vfork=''
961 d_inc_version_list=''
962 inc_version_list=''
963 inc_version_list_init=''
964 installprefix=''
965 installprefixexp=''
966 installstyle=''
967 installusrbinperl=''
968 intsize=''
969 longsize=''
970 shortsize=''
971 issymlink=''
972 libc=''
973 ldlibpthname=''
974 libperl=''
975 shrpenv=''
976 useshrplib=''
977 glibpth=''
978 libpth=''
979 loclibpth=''
980 plibpth=''
981 xlibpth=''
982 ignore_versioned_solibs=''
983 libs=''
984 libsdirs=''
985 libsfiles=''
986 libsfound=''
987 libspath=''
988 lns=''
989 d_PRIEUldbl=''
990 d_PRIFUldbl=''
991 d_PRIGUldbl=''
992 d_PRIeldbl=''
993 d_PRIfldbl=''
994 d_PRIgldbl=''
995 d_SCNfldbl=''
996 sPRIEUldbl=''
997 sPRIFUldbl=''
998 sPRIGUldbl=''
999 sPRIeldbl=''
1000 sPRIfldbl=''
1001 sPRIgldbl=''
1002 sSCNfldbl=''
1003 lseeksize=''
1004 lseektype=''
1005 mad=''
1006 madlyh=''
1007 madlyobj=''
1008 madlysrc=''
1009 make_set_make=''
1010 d_mymalloc=''
1011 freetype=''
1012 mallocobj=''
1013 mallocsrc=''
1014 malloctype=''
1015 usemallocwrap=''
1016 usemymalloc=''
1017 installman1dir=''
1018 man1dir=''
1019 man1direxp=''
1020 man1ext=''
1021 installman3dir=''
1022 man3dir=''
1023 man3direxp=''
1024 man3ext=''
1025 modetype=''
1026 multiarch=''
1027 mydomain=''
1028 myhostname=''
1029 phostname=''
1030 c=''
1031 n=''
1032 d_eofnblk=''
1033 eagain=''
1034 o_nonblock=''
1035 rd_nodata=''
1036 need_va_copy=''
1037 netdb_hlen_type=''
1038 netdb_host_type=''
1039 netdb_name_type=''
1040 netdb_net_type=''
1041 groupcat=''
1042 hostcat=''
1043 passcat=''
1044 orderlib=''
1045 ranlib=''
1046 d_perl_otherlibdirs=''
1047 otherlibdirs=''
1048 package=''
1049 spackage=''
1050 pager=''
1051 api_revision=''
1052 api_subversion=''
1053 api_version=''
1054 api_versionstring=''
1055 patchlevel=''
1056 perl_patchlevel=''
1057 revision=''
1058 subversion=''
1059 version=''
1060 version_patchlevel_string=''
1061 perl5=''
1062 perladmin=''
1063 perlpath=''
1064 d_nv_preserves_uv=''
1065 d_nv_zero_is_allbits_zero=''
1066 i16size=''
1067 i16type=''
1068 i32size=''
1069 i32type=''
1070 i64size=''
1071 i64type=''
1072 i8size=''
1073 i8type=''
1074 ivsize=''
1075 ivtype=''
1076 nv_overflows_integers_at=''
1077 nv_preserves_uv_bits=''
1078 nvsize=''
1079 nvtype=''
1080 u16size=''
1081 u16type=''
1082 u32size=''
1083 u32type=''
1084 u64size=''
1085 u64type=''
1086 u8size=''
1087 u8type=''
1088 uvsize=''
1089 uvtype=''
1090 ivdformat=''
1091 nvEUformat=''
1092 nvFUformat=''
1093 nvGUformat=''
1094 nveformat=''
1095 nvfformat=''
1096 nvgformat=''
1097 uvXUformat=''
1098 uvoformat=''
1099 uvuformat=''
1100 uvxformat=''
1101 pidtype=''
1102 prefix=''
1103 prefixexp=''
1104 installprivlib=''
1105 privlib=''
1106 privlibexp=''
1107 prototype=''
1108 ptrsize=''
1109 d_PRIXU64=''
1110 d_PRId64=''
1111 d_PRIi64=''
1112 d_PRIo64=''
1113 d_PRIu64=''
1114 d_PRIx64=''
1115 sPRIXU64=''
1116 sPRId64=''
1117 sPRIi64=''
1118 sPRIo64=''
1119 sPRIu64=''
1120 sPRIx64=''
1121 d_quad=''
1122 quadkind=''
1123 quadtype=''
1124 uquadtype=''
1125 drand01=''
1126 randbits=''
1127 randfunc=''
1128 randseedtype=''
1129 seedfunc=''
1130 installscript=''
1131 scriptdir=''
1132 scriptdirexp=''
1133 selectminbits=''
1134 selecttype=''
1135 sh=''
1136 sig_count=''
1137 sig_name=''
1138 sig_name_init=''
1139 sig_num=''
1140 sig_num_init=''
1141 sig_size=''
1142 d_sitearch=''
1143 installsitearch=''
1144 sitearch=''
1145 sitearchexp=''
1146 installsitebin=''
1147 sitebin=''
1148 sitebinexp=''
1149 installsitehtml1dir=''
1150 sitehtml1dir=''
1151 sitehtml1direxp=''
1152 installsitehtml3dir=''
1153 sitehtml3dir=''
1154 sitehtml3direxp=''
1155 installsitelib=''
1156 sitelib=''
1157 sitelib_stem=''
1158 sitelibexp=''
1159 installsiteman1dir=''
1160 siteman1dir=''
1161 siteman1direxp=''
1162 installsiteman3dir=''
1163 siteman3dir=''
1164 siteman3direxp=''
1165 siteprefix=''
1166 siteprefixexp=''
1167 installsitescript=''
1168 sitescript=''
1169 sitescriptexp=''
1170 sizesize=''
1171 sizetype=''
1172 so=''
1173 socksizetype=''
1174 sharpbang=''
1175 shsharp=''
1176 spitshell=''
1177 src=''
1178 ssizetype=''
1179 startperl=''
1180 startsh=''
1181 stdchar=''
1182 d_stdio_stream_array=''
1183 stdio_stream_array=''
1184 sysman=''
1185 sGMTIME_max=''
1186 sGMTIME_min=''
1187 sLOCALTIME_max=''
1188 sLOCALTIME_min=''
1189 trnl=''
1190 uidformat=''
1191 uidsign=''
1192 uidsize=''
1193 uidtype=''
1194 archname64=''
1195 use64bitall=''
1196 use64bitint=''
1197 dtrace=''
1198 usedtrace=''
1199 usefaststdio=''
1200 ccflags_uselargefiles=''
1201 ldflags_uselargefiles=''
1202 libswanted_uselargefiles=''
1203 uselargefiles=''
1204 uselongdouble=''
1205 usemorebits=''
1206 usemultiplicity=''
1207 nm_opt=''
1208 nm_so_opt=''
1209 runnm=''
1210 usenm=''
1211 useperlio=''
1212 usesocks=''
1213 d_oldpthreads=''
1214 use5005threads=''
1215 useithreads=''
1216 usereentrant=''
1217 usethreads=''
1218 incpath=''
1219 mips_type=''
1220 usrinc=''
1221 d_vendorarch=''
1222 installvendorarch=''
1223 vendorarch=''
1224 vendorarchexp=''
1225 d_vendorbin=''
1226 installvendorbin=''
1227 vendorbin=''
1228 vendorbinexp=''
1229 installvendorhtml1dir=''
1230 vendorhtml1dir=''
1231 vendorhtml1direxp=''
1232 installvendorhtml3dir=''
1233 vendorhtml3dir=''
1234 vendorhtml3direxp=''
1235 d_vendorlib=''
1236 installvendorlib=''
1237 vendorlib=''
1238 vendorlib_stem=''
1239 vendorlibexp=''
1240 installvendorman1dir=''
1241 vendorman1dir=''
1242 vendorman1direxp=''
1243 installvendorman3dir=''
1244 vendorman3dir=''
1245 vendorman3direxp=''
1246 usevendorprefix=''
1247 vendorprefix=''
1248 vendorprefixexp=''
1249 d_vendorscript=''
1250 installvendorscript=''
1251 vendorscript=''
1252 vendorscriptexp=''
1253 versiononly=''
1254 defvoidused=''
1255 voidflags=''
1256 yacc=''
1257 yaccflags=''
1258 CONFIG=''
1259
1260 : Detect odd OSs
1261 define='define'
1262 undef='undef'
1263 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1264 rmlist=''
1265
1266 : We must find out about Eunice early
1267 eunicefix=':'
1268 if test -f /etc/unixtovms; then
1269         eunicefix=/etc/unixtovms
1270 fi
1271 if test -f /etc/unixtovms.exe; then
1272         eunicefix=/etc/unixtovms.exe
1273 fi
1274
1275 : Set executable suffix now -- needed before hints available
1276 if test -f "/libs/version.library"; then
1277 : Amiga OS
1278     _exe=""
1279 elif test -f "/system/gnu_library/bin/ar.pm"; then
1280 : Stratus VOS
1281     _exe=".pm"
1282 elif test -n "$DJGPP"; then
1283 : DOS DJGPP
1284     _exe=".exe"
1285 elif test -d c:/. -o -n "$is_os2" ; then
1286 : OS/2 or cygwin
1287     _exe=".exe"
1288 fi
1289
1290 groupstype=''
1291 i_whoami=''
1292 : Trailing extension.  Override this in a hint file, if needed.
1293 : Extra object files, if any, needed on this platform.
1294 archobjs=''
1295 archname=''
1296 libnames=''
1297 : change the next line if compiling for Xenix/286 on Xenix/386
1298 xlibpth='/usr/lib/386 /lib/386'
1299 : Possible local library directories to search.
1300 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1301 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1302
1303 : general looking path for locating libraries
1304 glibpth="/lib /usr/lib $xlibpth"
1305 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1306 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1307 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1308 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1309
1310 : Private path used by Configure to find libraries.  Its value
1311 : is prepended to libpth. This variable takes care of special
1312 : machines, like the mips.  Usually, it should be empty.
1313 plibpth=''
1314
1315 : default library list
1316 libswanted=''
1317 : some systems want to use only the non-versioned libso:s
1318 ignore_versioned_solibs=''
1319 : set usethreads on the Configure command line to enable threads.
1320 usereentrant='undef'
1321 : full support for void wanted by default
1322 defvoidused=15
1323
1324 : Possible local include directories to search.
1325 : Set locincpth to "" in a hint file to defeat local include searches.
1326 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1327 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1328 :
1329 : no include file wanted by default
1330 inclwanted=''
1331
1332 : Enable -DEBUGGING and -DDEBUGGING from the command line
1333 EBUGGING=''
1334 DEBUGGING=old
1335
1336 ccname=''
1337 ccversion=''
1338 perllibs=''
1339 : set useposix=false in your hint file to disable the POSIX extension.
1340 useposix=true
1341 : set useopcode=false in your hint file to disable the Opcode extension.
1342 useopcode=true
1343 archname64=''
1344 ccflags_uselargefiles=''
1345 ldflags_uselargefiles=''
1346 libswanted_uselargefiles=''
1347 : set usemultiplicity on the Configure command line to enable multiplicity.
1348 : set usesocks on the Configure command line to enable socks.
1349 : List of libraries we want.
1350 : If anyone needs extra -lxxx, put those in a hint file.
1351 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1352 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1353 : We probably want to search /usr/shlib before most other libraries.
1354 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1355 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1356 glibpth="/usr/shlib $glibpth"
1357 : Do not use vfork unless overridden by a hint file.
1358 usevfork=false
1359
1360 : Find the basic shell for Bourne shell scripts
1361 case "$sh" in
1362 '')
1363         case "$SYSTYPE" in
1364         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1365         *) xxx='/bin/sh';;
1366         esac
1367         if test -f "$xxx"; then
1368                 sh="$xxx"
1369         else
1370                 : Build up a list and do a single loop so we can 'break' out.
1371                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1372                 for xxx in sh bash ksh pdksh ash; do
1373                         for p in $pth; do
1374                                 try="$try ${p}/${xxx}"
1375                         done
1376                 done
1377                 for xxx in $try; do
1378                         if test -f "$xxx"; then
1379                                 sh="$xxx";
1380                                 break
1381                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1382                                 sh="$xxx";
1383                                 break
1384                         elif test -f "$xxx.exe"; then
1385                                 sh="$xxx";
1386                                 break
1387                         fi
1388                 done
1389         fi
1390         ;;
1391 esac
1392
1393 case "$sh" in
1394 '')     cat >&2 <<EOM
1395 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1396
1397 Usually it's in /bin/sh.  How did you even get this far?
1398 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1399 we'll try to straighten this all out.
1400 EOM
1401         exit 1
1402         ;;
1403 esac
1404
1405 : see if sh knows # comments
1406 if `$sh -c '#' >/dev/null 2>&1`; then
1407         shsharp=true
1408         spitshell=cat
1409         xcat=/bin/cat
1410         test -f $xcat$_exe || xcat=/usr/bin/cat
1411         if test ! -f $xcat$_exe; then
1412                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1413                         if test -f $p/cat$_exe; then
1414                                 xcat=$p/cat
1415                                 break
1416                         fi
1417                 done
1418                 if test ! -f $xcat$_exe; then
1419                         echo "Can't find cat anywhere!"
1420                         exit 1
1421                 fi
1422         fi
1423         echo "#!$xcat" >sharp
1424         $eunicefix sharp
1425         chmod +x sharp
1426         ./sharp > today 2>/dev/null
1427         if test -s today; then
1428                 sharpbang='#!'
1429         else
1430                 echo "#! $xcat" > sharp
1431                 $eunicefix sharp
1432                 chmod +x sharp
1433                 ./sharp > today 2>/dev/null
1434                 if test -s today; then
1435                         sharpbang='#! '
1436                 else
1437                         sharpbang=': use '
1438                 fi
1439         fi
1440 else
1441         echo " "
1442         echo "Your $sh doesn't grok # comments--I will strip them later on."
1443         shsharp=false
1444         cd ..
1445         echo "exec grep -v '^[  ]*#'" >spitshell
1446         chmod +x spitshell
1447         $eunicefix spitshell
1448         spitshell=`pwd`/spitshell
1449         cd UU
1450         echo "I presume that if # doesn't work, #! won't work either!"
1451         sharpbang=': use '
1452 fi
1453 rm -f sharp today
1454
1455 : figure out how to guarantee sh startup
1456 case "$startsh" in
1457 '') startsh=${sharpbang}${sh} ;;
1458 *)
1459 esac
1460 cat >sharp <<EOSS
1461 $startsh
1462 set abc
1463 test "$?abc" != 1
1464 EOSS
1465
1466 chmod +x sharp
1467 $eunicefix sharp
1468 if ./sharp; then
1469         : echo "Yup, it does."
1470 else
1471         echo "Hmm... '$startsh' does not guarantee sh startup..."
1472         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1473 fi
1474 rm -f sharp
1475
1476 : Save command line options in file UU/cmdline.opt for later use in
1477 : generating config.sh.
1478 cat > cmdline.opt <<EOSH
1479 : Configure command line arguments.
1480 config_arg0='$0'
1481 config_args='$*'
1482 config_argc=$#
1483 EOSH
1484 argn=1
1485 args_exp=''
1486 args_sep=''
1487 for arg in "$@"; do
1488         cat >>cmdline.opt <<EOSH
1489 config_arg$argn='$arg'
1490 EOSH
1491         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1492 $arg
1493 EOC
1494         arg_exp=`cat cmdl.opt`
1495         args_exp="$args_exp$args_sep'$arg_exp'"
1496         argn=`expr $argn + 1`
1497         args_sep=' '
1498 done
1499 rm -f cmdl.opt
1500
1501 : produce awk script to parse command line options
1502 cat >options.awk <<'EOF'
1503 BEGIN {
1504         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1505
1506         len = length(optstr);
1507         for (i = 1; i <= len; i++) {
1508                 c = substr(optstr, i, 1);
1509                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1510                 if (a == ":") {
1511                         arg[c] = 1;
1512                         i++;
1513                 }
1514                 opt[c] = 1;
1515         }
1516 }
1517 {
1518         expect = 0;
1519         str = $0;
1520         if (substr(str, 1, 1) != "-") {
1521                 printf("'%s'\n", str);
1522                 next;
1523         }
1524         len = length($0);
1525         for (i = 2; i <= len; i++) {
1526                 c = substr(str, i, 1);
1527                 if (!opt[c]) {
1528                         printf("-%s\n", substr(str, i));
1529                         next;
1530                 }
1531                 printf("-%s\n", c);
1532                 if (arg[c]) {
1533                         if (i < len)
1534                                 printf("'%s'\n", substr(str, i + 1));
1535                         else
1536                                 expect = 1;
1537                         next;
1538                 }
1539         }
1540 }
1541 END {
1542         if (expect)
1543                 print "?";
1544 }
1545 EOF
1546
1547 : process the command line options
1548 set X `for arg in "$@"; do echo "X$arg"; done |
1549         sed -e s/X// | awk -f options.awk`
1550 eval "set $*"
1551 shift
1552 rm -f options.awk
1553
1554 : set up default values
1555 fastread=''
1556 reuseval=false
1557 config_sh=''
1558 alldone=''
1559 error=''
1560 silent=''
1561 extractsh=''
1562 override=''
1563 knowitall=''
1564 rm -f optdef.sh posthint.sh
1565 cat >optdef.sh <<EOS
1566 $startsh
1567 EOS
1568
1569
1570 : option parsing
1571 while test $# -gt 0; do
1572         case "$1" in
1573         -d) shift; fastread=yes;;
1574         -e) shift; alldone=cont;;
1575         -f)
1576                 shift
1577                 cd ..
1578                 if test -r "$1"; then
1579                         config_sh="$1"
1580                 else
1581                         echo "$me: cannot read config file $1." >&2
1582                         error=true
1583                 fi
1584                 cd UU
1585                 shift;;
1586         --help|\
1587         -h) shift; error=true;;
1588         -r) shift; reuseval=true;;
1589         -s) shift; silent=true; realsilent=true;;
1590         -E) shift; alldone=exit;;
1591         -K) shift; knowitall=true;;
1592         -O) shift; override=true;;
1593         -S) shift; silent=true; extractsh=true;;
1594         -D)
1595                 shift
1596                 case "$1" in
1597                 *=)
1598                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1599                         echo "$me: ignoring -D $1" >&2
1600                         ;;
1601                 *=*) echo "$1" | \
1602                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1603                 *) echo "$1='define'" >> optdef.sh;;
1604                 esac
1605                 shift
1606                 ;;
1607         -U)
1608                 shift
1609                 case "$1" in
1610                 *=) echo "$1" >> optdef.sh;;
1611                 *=*)
1612                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1613                         echo "$me: ignoring -U $1" >&2
1614                         ;;
1615                 *) echo "$1='undef'" >> optdef.sh;;
1616                 esac
1617                 shift
1618                 ;;
1619         -A)
1620             shift
1621             xxx=''
1622             yyy="$1"
1623             zzz=''
1624             uuu=undef
1625             case "$yyy" in
1626             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1627                  case "$zzz" in
1628                  *:*) zzz='' ;;
1629                  *)   xxx=append
1630                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1631                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1632                  esac
1633                  ;;
1634             esac
1635             case "$xxx" in
1636             '')  case "$yyy" in
1637                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1638                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1639                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1640                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1641                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1642                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1643                  esac
1644                  ;;
1645             esac
1646             case "$xxx" in
1647             append)
1648                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1649             clear)
1650                 echo "$yyy=''"                  >> posthint.sh ;;
1651             define)
1652                 case "$zzz" in
1653                 '') zzz=define ;;
1654                 esac
1655                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1656             eval)
1657                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1658             prepend)
1659                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1660             undef)
1661                 case "$zzz" in
1662                 '') zzz="$uuu" ;;
1663                 esac
1664                 echo "$yyy=$zzz"                >> posthint.sh ;;
1665             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1666             esac
1667             shift
1668             ;;
1669         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1670             exit 0;;
1671         --) break;;
1672         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1673         *) break;;
1674         esac
1675 done
1676
1677 case "$error" in
1678 true)
1679         cat >&2 <<EOM
1680 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1681                  [-U symbol] [-U symbol=] [-A command:symbol...]
1682   -d : use defaults for all answers.
1683   -e : go on without questioning past the production of config.sh.
1684   -f : specify an alternate default configuration file.
1685   -h : print this help message and exit (with an error status).
1686   -r : reuse C symbols value if possible (skips costly nm extraction).
1687   -s : silent mode, only echoes questions and essential information.
1688   -D : define symbol to have some value:
1689          -D symbol         symbol gets the value 'define'
1690          -D symbol=value   symbol gets the value 'value'
1691        common used examples (see INSTALL for more info):
1692          -Duse64bitint            use 64bit integers
1693          -Duse64bitall            use 64bit integers and pointers
1694          -Dusethreads             use thread support
1695          -Dinc_version_list=none  do not include older perl trees in @INC
1696          -DEBUGGING=none          DEBUGGING options
1697          -Dcc=gcc                 choose your compiler
1698          -Dprefix=/opt/perl5      choose your destination
1699   -E : stop at the end of questions, after having produced config.sh.
1700   -K : do not use unless you know what you are doing.
1701   -O : let -D and -U override definitions from loaded configuration file.
1702   -S : perform variable substitutions on all .SH files (can mix with -f)
1703   -U : undefine symbol:
1704          -U symbol    symbol gets the value 'undef'
1705          -U symbol=   symbol gets completely empty
1706        e.g.:  -Uversiononly
1707   -A : manipulate symbol after the platform specific hints have been applied:
1708          -A append:symbol=value   append value to symbol
1709          -A symbol=value          like append:, but with a separating space
1710          -A define:symbol=value   define symbol to have value
1711          -A clear:symbol          define symbol to be ''
1712          -A define:symbol         define symbol to be 'define'
1713          -A eval:symbol=value     define symbol to be eval of value
1714          -A prepend:symbol=value  prepend value to symbol
1715          -A undef:symbol          define symbol to be 'undef'
1716          -A undef:symbol=         define symbol to be ''
1717        e.g.:  -A prepend:libswanted='cl pthread '
1718               -A ccflags=-DSOME_MACRO
1719   -V : print version number and exit (with a zero status).
1720 EOM
1721         exit 1
1722         ;;
1723 esac
1724
1725 : Sanity checks
1726 case "$fastread$alldone" in
1727 yescont|yesexit) ;;
1728 *)
1729         case "$extractsh" in
1730         true) ;;
1731         *)
1732                 if test ! -t 0; then
1733                         echo "Say 'sh Configure', not 'sh <Configure'"
1734                         exit 1
1735                 fi
1736                 ;;
1737         esac
1738         ;;
1739 esac
1740
1741 exec 4>&1
1742 case "$silent" in
1743 true) exec 1>/dev/null;;
1744 esac
1745
1746 : run the defines and the undefines, if any, but leave the file out there...
1747 touch optdef.sh
1748 . ./optdef.sh
1749 : create the posthint manipulation script and leave the file out there...
1750 touch posthint.sh
1751
1752 : set package name
1753 package='perl5'
1754 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1755 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1756 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1757 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1758 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1759 esac
1760
1761 : Some greps do not return status, grrr.
1762 echo "grimblepritz" >grimble
1763 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1764         contains=contains
1765 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1766         contains=grep
1767 else
1768         contains=contains
1769 fi
1770 rm -f grimble
1771 : the following should work in any shell
1772 case "$contains" in
1773 contains*)
1774         echo " "
1775         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1776         cat >contains <<'EOSS'
1777 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1778 EOSS
1779 chmod +x contains
1780 esac
1781
1782 : Find the path to the source tree
1783 case "$src" in
1784 '') case "$0" in
1785     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1786          case "$src" in
1787          /*)    ;;
1788          .)     ;;
1789          *)     src=`cd ../$src && pwd` ;;
1790          esac
1791          ;;
1792     *)   src='.';;
1793     esac;;
1794 esac
1795 case "$src" in
1796 '')     src=/
1797         rsrc=/
1798         ;;
1799 /*)     rsrc="$src";;
1800 *)      rsrc="../$src";;
1801 esac
1802 if test -f $rsrc/Configure && \
1803         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1804 then
1805    : found it, so we are ok.
1806 else
1807         rsrc=''
1808         for src in . .. ../.. ../../.. ../../../..; do
1809                 if test -f ../$src/Configure && \
1810                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1811                 then
1812                         rsrc=../$src
1813                         break
1814                 fi
1815         done
1816 fi
1817 case "$rsrc" in
1818 '')
1819         cat <<EOM >&4
1820
1821 Sorry, I can't seem to locate the source dir for $package.  Please start
1822 Configure with an explicit path -- i.e. /some/path/Configure.
1823
1824 EOM
1825         exit 1
1826         ;;
1827 ../.)   rsrc='..';;
1828 *)
1829         echo " "
1830         echo "Sources for $package found in \"$src\"." >&4
1831         ;;
1832 esac
1833
1834 : script used to extract .SH files with variable substitutions
1835 cat >extract <<'EOS'
1836 PERL_CONFIG_SH=true
1837 echo "Doing variable substitutions on .SH files..."
1838 if test -f MANIFEST; then
1839         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1840 else
1841         echo "(Looking for .SH files under the source directory.)"
1842         set x `(cd "$src"; find . -name "*.SH" -print)`
1843 fi
1844 shift
1845 case $# in
1846 0) set x `(cd "$src"; echo *.SH)`; shift;;
1847 esac
1848 if test ! -f "$src/$1"; then
1849         shift
1850 fi
1851 mkdir_p='
1852 name=$1;
1853 create="";
1854 while test $name; do
1855         if test ! -d "$name"; then
1856                 create="$name $create";
1857                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1858                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1859         else
1860                 name="";
1861         fi;
1862 done;
1863 for file in $create; do
1864         mkdir $file;
1865 done
1866 '
1867 for file in $*; do
1868         case "$src" in
1869         ".")
1870                 case "$file" in
1871                 */*)
1872                         dir=`expr X$file : 'X\(.*\)/'`
1873                         file=`expr X$file : 'X.*/\(.*\)'`
1874                         (cd "$dir" && . ./$file)
1875                         ;;
1876                 *)
1877                         . ./$file
1878                         ;;
1879                 esac
1880                 ;;
1881         *)
1882                 case "$file" in
1883                 */*)
1884                         dir=`expr X$file : 'X\(.*\)/'`
1885                         file=`expr X$file : 'X.*/\(.*\)'`
1886                         (set x $dir; shift; eval $mkdir_p)
1887                         sh <"$src/$dir/$file"
1888                         ;;
1889                 *)
1890                         sh <"$src/$file"
1891                         ;;
1892                 esac
1893                 ;;
1894         esac
1895 done
1896 if test -f "$src/config_h.SH"; then
1897         if test ! -f config.h; then
1898         : oops, they left it out of MANIFEST, probably, so do it anyway.
1899         . "$src/config_h.SH"
1900         fi
1901 fi
1902 EOS
1903
1904 : extract files and exit if asked to do so
1905 case "$extractsh" in
1906 true)
1907         case "$realsilent" in
1908         true) ;;
1909         *) exec 1>&4;;
1910         esac
1911         case "$config_sh" in
1912         '') config_sh='config.sh';;
1913         esac
1914         echo " "
1915         echo "Fetching answers from $config_sh..."
1916         cd ..
1917         . $config_sh
1918         test "$override" && . ./optdef.sh
1919         echo " "
1920         . UU/extract
1921         rm -rf UU
1922         echo "Extraction done."
1923         exit 0
1924         ;;
1925 esac
1926
1927 : Eunice requires " " instead of "", can you believe it
1928 echo " "
1929 : Here we go...
1930 echo "Beginning of configuration questions for $package."
1931
1932 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1933
1934 : first determine how to suppress newline on echo command
1935 echo " "
1936 echo "Checking echo to see how to suppress newlines..."
1937 (echo "hi there\c" ; echo " ") >.echotmp
1938 if $contains c .echotmp >/dev/null 2>&1 ; then
1939         echo "...using -n."
1940         n='-n'
1941         c=''
1942 else
1943         cat <<'EOM'
1944 ...using \c
1945 EOM
1946         n=''
1947         c='\c'
1948 fi
1949 echo $n "The star should be here-->$c"
1950 echo '*'
1951 rm -f .echotmp
1952
1953 : Now test for existence of everything in MANIFEST
1954 echo " "
1955 if test -f "$rsrc/MANIFEST"; then
1956         echo "First let's make sure your kit is complete.  Checking..." >&4
1957         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1958                 (split -l 50 2>/dev/null || split -50)
1959         rm -f missing
1960         tmppwd=`pwd`
1961         for filelist in x??; do
1962                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1963                         >/dev/null 2>>"$tmppwd/missing")
1964         done
1965         if test -s missing; then
1966                 cat missing >&4
1967                 cat >&4 <<'EOM'
1968
1969 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1970
1971 You have the option of continuing the configuration process, despite the
1972 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1973 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1974 and contact the author (perlbug@perl.org).
1975
1976 EOM
1977                 echo $n "Continue? [n] $c" >&4
1978                 read ans
1979                 case "$ans" in
1980                 y*)
1981                         echo "Continuing..." >&4
1982                         rm -f missing
1983                         ;;
1984                 *)
1985                         echo "ABORTING..." >&4
1986                         kill $$
1987                         ;;
1988                 esac
1989         else
1990                 echo "Looks good..."
1991         fi
1992 else
1993         echo "There is no MANIFEST file.  I hope your kit is complete !"
1994 fi
1995 rm -f missing x??
1996
1997 : Find the appropriate value for a newline for tr
1998 echo " "
1999 if test -n "$DJGPP"; then
2000        trnl='\012'
2001 fi
2002 if test X"$trnl" = X; then
2003         case "`echo foo|tr '\n' x 2>/dev/null`" in
2004         foox) trnl='\n' ;;
2005         esac
2006 fi
2007 if test X"$trnl" = X; then
2008         case "`echo foo|tr '\012' x 2>/dev/null`" in
2009         foox) trnl='\012' ;;
2010         esac
2011 fi
2012 if test X"$trnl" = X; then
2013        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2014        fooxy) trnl='\n\r' ;;
2015        esac
2016 fi
2017 if test X"$trnl" = X; then
2018         cat <<EOM >&2
2019
2020 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2021
2022 EOM
2023         exit 1
2024 fi
2025
2026 : compute the number of columns on the terminal for proper question formatting
2027 case "$COLUMNS" in
2028 '') COLUMNS='80';;
2029 esac
2030
2031 : set up the echo used in my read
2032 myecho="case \"\$xxxm\" in
2033 '') echo $n \"\$rp $c\" >&4;;
2034 *) case \"\$rp\" in
2035         '') echo $n \"[\$xxxm] $c\";;
2036         *)
2037                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2038                         echo \"\$rp\" >&4
2039                         echo $n \"[\$xxxm] $c\" >&4
2040                 else
2041                         echo $n \"\$rp [\$xxxm] $c\" >&4
2042                 fi
2043                 ;;
2044         esac;;
2045 esac"
2046
2047 : now set up to do reads with possible shell escape and default assignment
2048 cat <<EOSC >myread
2049 $startsh
2050 xxxm=\$dflt
2051 $myecho
2052 ans='!'
2053 case "\$fastread" in
2054 yes) case "\$dflt" in
2055         '') ;;
2056         *) ans='';
2057                 case "\$silent-\$rp" in
2058                 true-) ;;
2059                 *) echo " " >&4;;
2060                 esac;;
2061         esac;;
2062 *) case "\$silent" in
2063         true) case "\$rp" in
2064                 '') ans='';;
2065                 esac;;
2066         esac;;
2067 esac
2068 while expr "X\$ans" : "X!" >/dev/null; do
2069         read answ
2070         set x \$xxxm
2071         shift
2072         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2073         case  "\$answ" in
2074         "!")
2075                 sh 1>&4
2076                 echo " "
2077                 $myecho
2078                 ;;
2079         !*)
2080                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2081                 shift
2082                 sh 1>&4 -c "\$*"
2083                 echo " "
2084                 $myecho
2085                 ;;
2086         "\$ans")
2087                 case "\$ans" in
2088                 \\&*)
2089                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2090                         shift
2091                         case "\$1" in
2092                         -d)
2093                                 fastread=yes
2094                                 echo "(OK, I'll run with -d after this question.)" >&4
2095                                 ;;
2096                         -*)
2097                                 echo "*** Sorry, \$1 not supported yet." >&4
2098                                 ;;
2099                         esac
2100                         $myecho
2101                         ans=!
2102                         ;;
2103                 esac;;
2104         *)
2105                 case "\$aok" in
2106                 y)
2107                         echo "*** Substitution done -- please confirm."
2108                         xxxm="\$ans"
2109                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2110                         xxxm="\$ans"
2111                         ans=!
2112                         ;;
2113                 *)
2114                         echo "*** Error -- try again."
2115                         ans=!
2116                         ;;
2117                 esac
2118                 $myecho
2119                 ;;
2120         esac
2121         case "\$ans\$xxxm\$nostick" in
2122         '')
2123                 ans=!
2124                 $myecho
2125                 ;;
2126         esac
2127 done
2128 case "\$ans" in
2129 '') ans="\$xxxm";;
2130 esac
2131 EOSC
2132
2133 : create .config dir to save info across Configure sessions
2134 test -d ../.config || mkdir ../.config
2135 cat >../.config/README <<EOF
2136 This directory created by Configure to save information that should
2137 persist across sessions for $package.
2138
2139 You may safely delete it if you wish.
2140 EOF
2141
2142 : See if we are using a devel version and want that
2143 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2144 case "$usedevel" in
2145 $define|true|[yY]*) ;;
2146 *) case "$xversion" in
2147    *[13579])
2148         cat >&4 <<EOH
2149 *** WHOA THERE!!! ***
2150
2151     This is an UNSTABLE DEVELOPMENT release.
2152     The version of this $package distribution is $xversion, that is, odd,
2153     (as opposed to even) and that signifies a development release.
2154     If you want a maintenance release, you want an even-numbered version.
2155
2156     Do ***NOT*** install this into production use.
2157     Data corruption and crashes are possible.
2158
2159     It is most seriously suggested that you do not continue any further
2160     unless you want to help in developing and debugging Perl.
2161
2162     If you *still* want to build perl, you can answer 'y' now,
2163     or pass -Dusedevel to Configure.
2164
2165 EOH
2166         rp='Do you really want to continue?'
2167         dflt='n'
2168         . ./myread
2169         case "$ans" in
2170         [yY]) echo >&4 "Okay, continuing."
2171               usedevel="$define" ;;
2172         *) echo >&4 "Okay, bye."
2173            exit 1
2174            ;;
2175         esac
2176         ;;
2177     esac
2178     ;;
2179 esac
2180 case "$usedevel" in
2181 $define|true|[yY]*)
2182         case "$versiononly" in
2183         '') versiononly="$define" ;;
2184         esac
2185         case "$installusrbinperl" in
2186         '') installusrbinperl="$undef" ;;
2187         esac
2188         ;;
2189 esac
2190
2191 : general instructions
2192 needman=true
2193 firsttime=true
2194 user=`(logname) 2>/dev/null`
2195 case "$user" in
2196 '') user=`whoami 2>&1`;;
2197 esac
2198 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2199         firsttime=false
2200         echo " "
2201         rp='Would you like to see the instructions?'
2202         dflt=n
2203         . ./myread
2204         case "$ans" in
2205         [yY]*) ;;
2206         *) needman=false;;
2207         esac
2208 fi
2209 if $needman; then
2210         cat <<EOH
2211
2212 This installation shell script will examine your system and ask you questions
2213 to determine how the perl5 package should be installed. If you get
2214 stuck on a question, you may use a ! shell escape to start a subshell or
2215 execute a command.  Many of the questions will have default answers in square
2216 brackets; typing carriage return will give you the default.
2217
2218 On some of the questions which ask for file or directory names you are allowed
2219 to use the ~name construct to specify the login directory belonging to "name",
2220 even if you don't have a shell which knows about that.  Questions where this is
2221 allowed will be marked "(~name ok)".
2222
2223 EOH
2224         rp=''
2225         dflt='Type carriage return to continue'
2226         . ./myread
2227         cat <<'EOH'
2228
2229 The prompter used in this script allows you to use shell variables and
2230 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2231 in the default answer, as if the default line was a set of arguments given to a
2232 script shell.  This means you may also use $* to repeat the whole default line,
2233 so you do not have to re-type everything to add something to the default.
2234
2235 Everytime there is a substitution, you will have to confirm.  If there is an
2236 error (e.g. an unmatched backtick), the default answer will remain unchanged
2237 and you will be prompted again.
2238
2239 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2240 the questions and use the computed defaults (or the previous answers if there
2241 was already a config.sh file). Type 'Configure -h' for a list of options.
2242 You may also start interactively and then answer '& -d' at any prompt to turn
2243 on the non-interactive behaviour for the remainder of the execution.
2244
2245 EOH
2246         . ./myread
2247         cat <<EOH
2248
2249 Much effort has been expended to ensure that this shell script will run on any
2250 Unix system.  If despite that it blows up on yours, your best bet is to edit
2251 Configure and run it again.  If you can't run Configure for some reason,
2252 you'll have to generate a config.sh file by hand.  Whatever problems you
2253 have, let me (perlbug@perl.org) know how I blew it.
2254
2255 This installation script affects things in two ways:
2256
2257 1) it may do direct variable substitutions on some of the files included
2258    in this kit.
2259 2) it builds a config.h file for inclusion in C programs.  You may edit
2260    any of these files as the need arises after running this script.
2261
2262 If you make a mistake on a question, there is no easy way to back up to it
2263 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2264 files.  Configure will offer to let you do this before it runs the SH files.
2265
2266 EOH
2267         dflt='Type carriage return to continue'
2268         . ./myread
2269         case "$firsttime" in
2270         true) echo $user >>../.config/instruct;;
2271         esac
2272 fi
2273
2274 : find out where common programs are
2275 echo " "
2276 echo "Locating common programs..." >&4
2277 cat <<EOSC >loc
2278 $startsh
2279 case \$# in
2280 0) exit 1;;
2281 esac
2282 thing=\$1
2283 shift
2284 dflt=\$1
2285 shift
2286 for dir in \$*; do
2287         case "\$thing" in
2288         .)
2289         if test -d \$dir/\$thing; then
2290                 echo \$dir
2291                 exit 0
2292         fi
2293         ;;
2294         *)
2295         for thisthing in \$dir/\$thing; do
2296                 : just loop through to pick last item
2297         done
2298         if test -f \$thisthing; then
2299                 echo \$thisthing
2300                 exit 0
2301         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2302                 echo \$thisthing
2303                 exit 0
2304         elif test -f \$dir/\$thing.exe; then
2305                 if test -n "$DJGPP"; then
2306                         echo \$dir/\$thing.exe
2307                 elif test "$eunicefix" != ":"; then
2308                         : on Eunice apparently
2309                         echo \$dir/\$thing
2310                 fi
2311                 exit 0
2312         fi
2313         ;;
2314         esac
2315 done
2316 echo \$dflt
2317 exit 1
2318 EOSC
2319 chmod +x loc
2320 $eunicefix loc
2321 loclist="
2322 awk
2323 cat
2324 chmod
2325 comm
2326 cp
2327 echo
2328 expr
2329 grep
2330 ls
2331 mkdir
2332 rm
2333 sed
2334 sort
2335 touch
2336 tr
2337 uniq
2338 "
2339 trylist="
2340 ar
2341 bison
2342 byacc
2343 cpp
2344 csh
2345 date
2346 egrep
2347 gmake
2348 gzip
2349 less
2350 ln
2351 make
2352 more
2353 nm
2354 nroff
2355 pg
2356 test
2357 uname
2358 zip
2359 "
2360 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2361 pth="$pth /lib /usr/lib"
2362 for file in $loclist; do
2363         eval xxx=\$$file
2364         case "$xxx" in
2365         /*|?:[\\/]*)
2366                 if test -f "$xxx"; then
2367                         : ok
2368                 else
2369                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2370                         xxx=`./loc $file $file $pth`
2371                 fi
2372                 ;;
2373         '') xxx=`./loc $file $file $pth`;;
2374         *) xxx=`./loc $xxx $xxx $pth`;;
2375         esac
2376         eval $file=$xxx$_exe
2377         eval _$file=$xxx
2378         case "$xxx" in
2379         /*)
2380                 echo $file is in $xxx.
2381                 ;;
2382         ?:[\\/]*)
2383                 echo $file is in $xxx.
2384                 ;;
2385         *)
2386                 echo "I don't know where '$file' is, and my life depends on it." >&4
2387                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2388                 exit 1
2389                 ;;
2390         esac
2391 done
2392 echo " "
2393 echo "Don't worry if any of the following aren't found..."
2394 say=offhand
2395 for file in $trylist; do
2396         eval xxx=\$$file
2397         case "$xxx" in
2398         /*|?:[\\/]*)
2399                 if test -f "$xxx"; then
2400                         : ok
2401                 else
2402                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2403                         xxx=`./loc $file $file $pth`
2404                 fi
2405                 ;;
2406         '') xxx=`./loc $file $file $pth`;;
2407         *) xxx=`./loc $xxx $xxx $pth`;;
2408         esac
2409         eval $file=$xxx$_exe
2410         eval _$file=$xxx
2411         case "$xxx" in
2412         /*)
2413                 echo $file is in $xxx.
2414                 ;;
2415         ?:[\\/]*)
2416                 echo $file is in $xxx.
2417                 ;;
2418         *)
2419                 echo "I don't see $file out there, $say."
2420                 say=either
2421                 ;;
2422         esac
2423 done
2424 case "$egrep" in
2425 egrep)
2426         echo "Substituting grep for egrep."
2427         egrep=$grep
2428         _egrep=$grep
2429         ;;
2430 esac
2431 case "$ln" in
2432 ln)
2433         echo "Substituting cp for ln."
2434         ln=$cp
2435         _ln=$cp
2436         ;;
2437 esac
2438 case "$make" in
2439 make)
2440         case "$gmake" in
2441         gmake)
2442         echo "I can't find make or gmake, and my life depends on it." >&4
2443         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2444         exit 1
2445         ;;
2446         esac
2447         ;;
2448 esac
2449 case "$gmake" in
2450 gmake)  ;;
2451 *)      # We can't have osname yet.
2452         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2453                 # Assume that gmake, if found, is definitely GNU make
2454                 # and prefer it over the system make.
2455                 echo "Substituting gmake for make."
2456                 make=$gmake
2457                 _make=$gmake
2458         fi
2459         ;;
2460 esac
2461 case "$test" in
2462 test)
2463         echo "Hopefully test is built into your sh."
2464         ;;
2465 *)
2466         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2467                 echo "Using the test built into your sh."
2468                 test=test
2469                 _test=test
2470         fi
2471         ;;
2472 esac
2473 case "$echo" in
2474 echo)
2475         echo "Hopefully echo is built into your sh."
2476         ;;
2477 '') ;;
2478 *)
2479         echo " "
2480 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2481         $echo $n "hi there$c" >foo1
2482         echo $n "hi there$c" >foo2
2483         if cmp foo1 foo2 >/dev/null 2>&1; then
2484                 echo "They are compatible.  In fact, they may be identical."
2485         else
2486                 case "$n" in
2487                 '-n') n='' c='\c';;
2488                 *) n='-n' c='';;
2489                 esac
2490                 cat <<FOO
2491 They are not compatible!  You are probably running ksh on a non-USG system.
2492 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2493 have echo built in and we may have to run some Bourne shell scripts.  That
2494 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2495
2496 FOO
2497                 $echo $n "The star should be here-->$c"
2498                 $echo "*"
2499         fi
2500         $rm -f foo1 foo2
2501         ;;
2502 esac
2503
2504 # This question was auctioned at YAPC::Europe-2007 in Vienna
2505 # I never promised you could answer it. I only auctioned the question.
2506 cat <<FOO
2507 The following message is sponsored by
2508
2509   Dresden.pm<--The stars should be here.
2510
2511 Dear Perl user, system administrator or package
2512 maintainer, the Perl community sends greetings to
2513 you. Do you (emblematical) greet back [Y/n]? n
2514
2515 FOO
2516
2517 : Check what type of C compiler we use
2518 cat <<EOS >trygcc
2519 $startsh
2520 EOS
2521 cat <<'EOSC' >>trygcc
2522 case "$cc" in
2523 '') ;;
2524 *)  $rm -f try try.*
2525     $cat >try.c <<EOM
2526 int main(int argc, char *argv[]) {
2527   return 0;
2528 }
2529 EOM
2530     if $cc -o try $ccflags $ldflags try.c; then
2531        :
2532     else
2533         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2534         despair=yes
2535         trygcc=yes
2536         case "$cc" in
2537         *gcc*) trygcc=no ;;
2538         esac
2539         # Skip this test because it gives a false match on output like:
2540         #    ./trygcc: line 23: cc: command not found
2541         # case "`$cc -v -c try.c 2>&1`" in
2542         # *gcc*) trygcc=no ;;
2543         # esac
2544         if $test X"$trygcc" = Xyes; then
2545             if gcc -o try -c try.c; then
2546                 echo " "
2547                 echo "You seem to have a working gcc, though." >&4
2548                 # Switching compilers may undo the work of hints files.
2549                 # The most common problem is -D_REENTRANT for threads.
2550                 # This heuristic catches that case, but gets false positives
2551                 # if -Dusethreads was not actually specified.  Better to
2552                 # bail out here with a useful message than fail 
2553                 # mysteriously later. Should we perhaps just try to
2554                 # re-invoke Configure -Dcc=gcc config_args ?
2555                 if $test -f usethreads.cbu; then
2556                         $cat >&4 <<EOM 
2557
2558 *** However, any setting of the C compiler flags (e.g. for thread support)
2559 *** will be lost.  It may be necessary for you to restart Configure and
2560 *** add -Dcc=gcc to your Configure command line.
2561
2562 EOM
2563                         rp="Would you like to go ahead and try gcc anyway?"
2564                         dflt=n
2565                 else
2566                         rp="Would you like to use it?"
2567                         dflt=y
2568                 fi
2569                 if $test -f myread; then
2570                     . ./myread
2571                 else
2572                     if $test -f UU/myread; then
2573                         . ./UU/myread
2574                     else
2575                         echo "Cannot find myread, sorry.  Aborting." >&2
2576                         exit 1
2577                     fi
2578                 fi  
2579                 case "$ans" in
2580                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2581                 esac
2582             fi
2583         fi
2584     fi
2585     $rm -f try try.*
2586     ;;
2587 esac
2588 EOSC
2589
2590 cat <<EOS >checkcc
2591 $startsh
2592 EOS
2593 cat <<'EOSC' >>checkcc
2594 case "$cc" in        
2595 '') ;;
2596 *)  $rm -f try try.*              
2597     $cat >try.c <<EOM
2598 int main(int argc, char *argv[]) {
2599   return 0;
2600 }
2601 EOM
2602     if $cc -o try $ccflags $ldflags try.c; then
2603        :
2604     else
2605         if $test X"$despair" = Xyes; then
2606            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2607         fi
2608         $cat >&4 <<EOM         
2609 You need to find a working C compiler.
2610 Either (purchase and) install the C compiler supplied by your OS vendor,
2611 or for a free C compiler try http://gcc.gnu.org/
2612 I cannot continue any further, aborting.
2613 EOM
2614         exit 1
2615     fi
2616     $rm -f try try.*
2617     ;;
2618 esac
2619 EOSC
2620
2621 : determine whether symbolic links are supported
2622 echo " "
2623 $touch blurfl
2624 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2625         echo "Symbolic links are supported." >&4
2626         lns="$ln -s"
2627 else
2628         echo "Symbolic links are NOT supported." >&4
2629         lns="$ln"
2630 fi
2631 $rm -f blurfl sym
2632
2633 : determine whether symbolic links are supported
2634 echo " "
2635 case "$lns" in
2636 *"ln"*" -s")
2637         echo "Checking how to test for symbolic links..." >&4
2638         $lns blurfl sym
2639         if $test "X$issymlink" = X; then
2640                 case "$newsh" in
2641                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2642                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2643                 esac
2644                 if test $? = 0; then
2645                         issymlink="test -h"
2646                 else
2647                         echo "Your builtin 'test -h' may be broken." >&4
2648                         case "$test" in
2649                         /*)     ;;
2650                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2651                                 for p in $pth
2652                                 do
2653                                         if test -f "$p/$test"; then
2654                                                 test="$p/$test"
2655                                                 break
2656                                         fi
2657                                 done
2658                                 ;;
2659                         esac
2660                         case "$test" in
2661                         /*)
2662                                 echo "Trying external '$test -h'." >&4
2663                                 issymlink="$test -h"
2664                                 if $test ! -h sym >/dev/null 2>&1; then
2665                                         echo "External '$test -h' is broken, too." >&4
2666                                         issymlink=''
2667                                 fi
2668                                 ;;
2669                         *)      issymlink='' ;;
2670                         esac
2671                 fi              
2672         fi
2673         if $test "X$issymlink" = X; then
2674                 if $test -L sym 2>/dev/null; then
2675                         issymlink="$test -L"
2676                         echo "The builtin '$test -L' worked." >&4
2677                 fi
2678         fi
2679         if $test "X$issymlink" != X; then
2680                 echo "You can test for symbolic links with '$issymlink'." >&4
2681         else
2682                 echo "I do not know how you can test for symbolic links." >&4
2683         fi
2684         $rm -f blurfl sym
2685         ;;
2686 *)      echo "No symbolic links, so not testing for their testing..." >&4
2687         ;;
2688 esac
2689 echo " "
2690
2691 : Make symlinks util
2692 case "$mksymlinks" in
2693 $define|true|[yY]*)
2694         case "$src" in
2695         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2696                 exit 1
2697                 ;;
2698         *)      case "$lns:$issymlink" in
2699                 *"ln"*" -s:"*"test -"?)
2700                         echo "Creating the symbolic links..." >&4
2701                         echo "(First creating the subdirectories...)" >&4
2702                         cd ..
2703                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2704                                 read directory
2705                                 test -z "$directory" && break
2706                                 mkdir -p $directory
2707                         done
2708                         # Sanity check 1.
2709                         if test ! -d t/base; then
2710                                 echo "Failed to create the subdirectories.  Aborting." >&4
2711                                 exit 1
2712                         fi
2713                         echo "(Then creating the symlinks...)" >&4
2714                         awk '{print $1}' $src/MANIFEST | while true; do
2715                                 read filename
2716                                 test -z "$filename" && break
2717                                 if test -f $filename; then
2718                                         if $issymlink $filename; then
2719                                                 rm -f $filename
2720                                         fi
2721                                 fi
2722                                 if test -f $filename; then
2723                                         echo "$filename already exists, not symlinking."
2724                                 else
2725                                         ln -s $src/$filename $filename
2726                                 fi
2727                         done
2728                         # Sanity check 2.
2729                         if test ! -f t/base/lex.t; then
2730                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2731                                 exit 1
2732                         fi
2733                         cd UU
2734                         ;;
2735                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2736                         ;;
2737                 esac
2738                 ;;
2739         esac
2740         ;;
2741 esac
2742
2743 : Check for Cross-Compilation
2744 case "$usecrosscompile" in
2745 $define|true|[yY]*)
2746         $echo "Cross-compiling..."
2747         croak=''
2748         case "$cc" in
2749         *-*-gcc) # A cross-compiling gcc, probably.
2750             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2751             ar=$targetarch-ar
2752             # leave out ld, choosing it is more complex
2753             nm=$targetarch-nm
2754             ranlib=$targetarch-ranlib
2755             $echo 'extern int foo;' > try.c
2756             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2757             shift
2758             if $test $# -gt 0; then
2759                 incpth="$incpth $*"
2760                 incpth="`$echo $incpth|$sed 's/^ //'`"
2761                 echo "Guessing incpth '$incpth'." >&4
2762                 for i in $*; do
2763                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2764                     if $test -d $j; then
2765                         libpth="$libpth $j"
2766                     fi
2767                 done   
2768                 libpth="`$echo $libpth|$sed 's/^ //'`"
2769                 echo "Guessing libpth '$libpth'." >&4
2770             fi
2771             $rm -f try.c
2772             ;;
2773         esac
2774         case "$targetarch" in
2775         '') echo "Targetarch not defined." >&4; croak=y ;;
2776         *)  echo "Using targetarch $targetarch." >&4 ;;
2777         esac
2778         case "$incpth" in
2779         '') echo "Incpth not defined." >&4; croak=y ;;
2780         *)  echo "Using incpth '$incpth'." >&4 ;;
2781         esac
2782         case "$libpth" in
2783         '') echo "Libpth not defined." >&4; croak=y ;;
2784         *)  echo "Using libpth '$libpth'." >&4 ;;
2785         esac
2786         case "$usrinc" in
2787         '') for i in $incpth; do
2788                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2789                     usrinc=$i
2790                     echo "Guessing usrinc $usrinc." >&4
2791                     break
2792                 fi
2793             done
2794             case "$usrinc" in
2795             '') echo "Usrinc not defined." >&4; croak=y ;;
2796             esac
2797             ;;
2798         *)  echo "Using usrinc $usrinc." >&4 ;;
2799         esac
2800         case "$targethost" in
2801         '') echo "Targethost not defined." >&4; croak=y ;;
2802         *)  echo "Using targethost $targethost." >&4
2803         esac
2804         locincpth=' '
2805         loclibpth=' '
2806         case "$croak" in
2807         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2808         esac
2809         case "$src" in
2810         /*) run=$src/Cross/run
2811             targetmkdir=$src/Cross/mkdir
2812             to=$src/Cross/to
2813             from=$src/Cross/from
2814             ;;
2815         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2816             run=$pwd/Cross/run
2817             targetmkdir=$pwd/Cross/mkdir
2818             to=$pwd/Cross/to
2819             from=$pwd/Cross/from
2820             ;;
2821         esac
2822         case "$targetrun" in
2823         '') targetrun=ssh ;;
2824         esac
2825         case "$targetto" in
2826         '') targetto=scp ;;
2827         esac
2828         case "$targetfrom" in
2829         '') targetfrom=scp ;;
2830         esac
2831         run=$run-$targetrun
2832         to=$to-$targetto
2833         from=$from-$targetfrom
2834         case "$targetdir" in
2835         '')  targetdir=/tmp
2836              echo "Guessing targetdir $targetdir." >&4
2837              ;;
2838         esac
2839         case "$targetuser" in
2840         '')  targetuser=root
2841              echo "Guessing targetuser $targetuser." >&4
2842              ;;
2843         esac
2844         case "$targetfrom" in
2845         scp)    q=-q ;;
2846         *)      q='' ;;
2847         esac
2848         case "$targetrun" in
2849         ssh|rsh)
2850             cat >$run <<EOF
2851 #!/bin/sh
2852 case "\$1" in
2853 -cwd)
2854   shift
2855   cwd=\$1
2856   shift
2857   ;;
2858 esac
2859 case "\$cwd" in
2860 '') cwd=$targetdir ;;
2861 esac
2862 exe=\$1
2863 shift
2864 if $test ! -f \$exe.xok; then
2865   $to \$exe
2866   $touch \$exe.xok
2867 fi
2868 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2869 EOF
2870             ;;
2871         *)  echo "Unknown targetrun '$targetrun'" >&4
2872             exit 1
2873             ;;
2874         esac
2875         case "$targetmkdir" in
2876         */Cross/mkdir)
2877             cat >$targetmkdir <<EOF
2878 #!/bin/sh
2879 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2880 EOF
2881             $chmod a+rx $targetmkdir
2882             ;;
2883         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2884             exit 1
2885             ;;
2886         esac
2887         case "$targetto" in
2888         scp|rcp)
2889             cat >$to <<EOF
2890 #!/bin/sh
2891 for f in \$@
2892 do
2893   case "\$f" in
2894   /*)
2895     $targetmkdir \`dirname \$f\`
2896     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2897     ;;
2898   *)
2899     $targetmkdir $targetdir/\`dirname \$f\`
2900     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2901     ;;
2902   esac
2903 done
2904 exit 0
2905 EOF
2906             ;;
2907         cp) cat >$to <<EOF
2908 #!/bin/sh
2909 for f in \$@
2910 do
2911   case "\$f" in
2912   /*)
2913     $mkdir -p $targetdir/\`dirname \$f\`
2914     $cp \$f $targetdir/\$f || exit 1
2915     ;;
2916   *)
2917     $targetmkdir $targetdir/\`dirname \$f\`
2918     $cp \$f $targetdir/\$f || exit 1
2919     ;;
2920   esac
2921 done
2922 exit 0
2923 EOF
2924             ;;
2925         *)  echo "Unknown targetto '$targetto'" >&4
2926             exit 1
2927             ;;
2928         esac
2929         case "$targetfrom" in
2930         scp|rcp)
2931           cat >$from <<EOF
2932 #!/bin/sh
2933 for f in \$@
2934 do
2935   $rm -f \$f
2936   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2937 done
2938 exit 0
2939 EOF
2940             ;;
2941         cp) cat >$from <<EOF
2942 #!/bin/sh
2943 for f in \$@
2944 do
2945   $rm -f \$f
2946   cp $targetdir/\$f . || exit 1
2947 done
2948 exit 0
2949 EOF
2950             ;;
2951         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2952             exit 1
2953             ;;
2954         esac
2955         if $test ! -f $run; then
2956             echo "Target 'run' script '$run' not found." >&4
2957         else
2958             $chmod a+rx $run
2959         fi
2960         if $test ! -f $to; then
2961             echo "Target 'to' script '$to' not found." >&4
2962         else
2963             $chmod a+rx $to
2964         fi
2965         if $test ! -f $from; then
2966             echo "Target 'from' script '$from' not found." >&4
2967         else
2968             $chmod a+rx $from
2969         fi
2970         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2971             exit 1
2972         fi
2973         cat >&4 <<EOF
2974 Using '$run' for remote execution,
2975 and '$from' and '$to'
2976 for remote file transfer.
2977 EOF
2978         ;;
2979 *)      run=''
2980         to=:
2981         from=:
2982         usecrosscompile='undef'
2983         targetarch=''
2984         ;;
2985 esac
2986
2987 : see whether [:lower:] and [:upper:] are supported character classes
2988 echo " "
2989 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2990 ABYZ)
2991         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2992         up='[:upper:]'
2993         low='[:lower:]'
2994         ;;
2995 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2996         # (0xd9 and 0xe2), therefore that is a nice testing point.
2997         if test "X$up" = X -o "X$low" = X; then
2998             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2999             rs) up='[A-Z]'
3000                 low='[a-z]'
3001                 ;;
3002             esac
3003         fi
3004         if test "X$up" = X -o "X$low" = X; then
3005             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3006             rs) up='A-Z'
3007                 low='a-z'
3008                 ;;
3009             esac
3010         fi
3011         if test "X$up" = X -o "X$low" = X; then
3012             case "`echo RS | od -x 2>/dev/null`" in
3013             *D9E2*|*d9e2*)
3014                 echo "Hey, this might be EBCDIC." >&4
3015                 if test "X$up" = X -o "X$low" = X; then
3016                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3017                     rs) up='[A-IJ-RS-Z]'
3018                         low='[a-ij-rs-z]'
3019                         ;;
3020                     esac
3021                 fi
3022                 if test "X$up" = X -o "X$low" = X; then
3023                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3024                     rs) up='A-IJ-RS-Z'
3025                         low='a-ij-rs-z'
3026                         ;;
3027                     esac
3028                 fi
3029                 ;;
3030             esac
3031         fi
3032 esac
3033 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3034 rs)
3035     echo "Using $up and $low to convert case." >&4
3036     ;;
3037 *)
3038     echo "I don't know how to translate letters from upper to lower case." >&4
3039     echo "Your tr is not acting any way I know of." >&4
3040     exit 1
3041     ;;
3042 esac
3043 : set up the translation script tr, must be called with ./tr of course
3044 cat >tr <<EOSC
3045 $startsh
3046 case "\$1\$2" in
3047 '[A-Z][a-z]') exec $tr '$up' '$low';;
3048 '[a-z][A-Z]') exec $tr '$low' '$up';;
3049 esac
3050 exec $tr "\$@"
3051 EOSC
3052 chmod +x tr
3053 $eunicefix tr
3054
3055 : Try to determine whether config.sh was made on this system
3056 case "$config_sh" in
3057 '')
3058 myuname=`$uname -a 2>/dev/null`
3059 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3060 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3061 # because the A-Z/a-z are not consecutive.
3062 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3063         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3064 newmyuname="$myuname"
3065 dflt=n
3066 case "$knowitall" in
3067 '')
3068         if test -f ../config.sh; then
3069                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3070                         eval "`grep myuname= ../config.sh`"
3071                 fi
3072                 if test "X$myuname" = "X$newmyuname"; then
3073                         dflt=y
3074                 fi
3075         fi
3076         ;;
3077 *) dflt=y;;
3078 esac
3079
3080 : Get old answers from old config file if Configure was run on the
3081 : same system, otherwise use the hints.
3082 hint=default
3083 cd ..
3084 if test -f config.sh; then
3085         echo " "
3086         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3087         . UU/myread
3088         case "$ans" in
3089         n*|N*) echo "OK, I'll ignore it."
3090                 mv config.sh config.sh.old
3091                 myuname="$newmyuname"
3092                 ;;
3093         *)  echo "Fetching default answers from your old config.sh file..." >&4
3094                 tmp_n="$n"
3095                 tmp_c="$c"
3096                 tmp_sh="$sh"
3097                 . ./config.sh
3098                 cp config.sh UU
3099                 n="$tmp_n"
3100                 c="$tmp_c"
3101                 : Older versions did not always set $sh.  Catch re-use of such
3102                 : an old config.sh.
3103                 case "$sh" in
3104                 '') sh="$tmp_sh" ;;
3105                 esac
3106                 hint=previous
3107                 ;;
3108         esac
3109 fi
3110 . ./UU/checkcc
3111 if test ! -f config.sh; then
3112         $cat <<EOM
3113
3114 First time through, eh?  I have some defaults handy for some systems
3115 that need some extra help getting the Configure answers right:
3116
3117 EOM
3118         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3119         dflt=''
3120         : Half the following guesses are probably wrong... If you have better
3121         : tests or hints, please send them to perlbug@perl.org
3122         : The metaconfig authors would also appreciate a copy...
3123         $test -f /irix && osname=irix
3124         $test -f /xenix && osname=sco_xenix
3125         $test -f /dynix && osname=dynix
3126         $test -f /dnix && osname=dnix
3127         $test -f /lynx.os && osname=lynxos
3128         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3129         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3130         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3131         $test -f /bin/mips && /bin/mips && osname=mips
3132         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3133                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3134         $test -d /usr/apollo/bin && osname=apollo
3135         $test -f /etc/saf/_sactab && osname=svr4
3136         $test -d /usr/include/minix && osname=minix
3137         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3138         if $test -d /MachTen -o -d /MachTen_Folder; then
3139                 osname=machten
3140                 if $test -x /sbin/version; then
3141                         osvers=`/sbin/version | $awk '{print $2}' |
3142                         $sed -e 's/[A-Za-z]$//'`
3143                 elif $test -x /usr/etc/version; then
3144                         osvers=`/usr/etc/version | $awk '{print $2}' |
3145                         $sed -e 's/[A-Za-z]$//'`
3146                 else
3147                         osvers="$2.$3"
3148                 fi
3149         fi
3150
3151         $test -f /sys/posix.dll &&
3152                 $test -f /usr/bin/what &&
3153                 set X `/usr/bin/what /sys/posix.dll` &&
3154                 $test "$3" = UWIN &&
3155                 osname=uwin &&
3156                 osvers="$5"
3157
3158         if $test -f $uname; then
3159                 set X $myuname
3160                 shift
3161
3162                 case "$5" in
3163                 fps*) osname=fps ;;
3164                 mips*)
3165                         case "$4" in
3166                         umips) osname=umips ;;
3167                         *) osname=mips ;;
3168                         esac;;
3169                 [23]100) osname=mips ;;
3170                 next*) osname=next ;;
3171                 i386*)
3172                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3173                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3174                                 osname='sco'
3175                                 osvers=$tmp
3176                         elif $test -f /etc/kconfig; then
3177                                 osname=isc
3178                                 if test "$lns" = "$ln -s"; then
3179                                         osvers=4
3180                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3181                                         osvers=3
3182                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3183                                         osvers=2
3184                                 fi
3185                         fi
3186                         tmp=''
3187                         ;;
3188                 pc*)
3189                         if test -n "$DJGPP"; then
3190                                 osname=dos
3191                                 osvers=djgpp
3192                         fi
3193                         ;;
3194                 esac
3195
3196                 case "$1" in
3197                 aix) osname=aix
3198                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3199                         case "$tmp" in
3200                         # oslevel can fail with:
3201                         # oslevel: Unable to acquire lock.
3202                         *not\ found) osvers="$4"."$3" ;;
3203                         '<3240'|'<>3240') osvers=3.2.0 ;;
3204                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3205                         '=3250'|'>3250') osvers=3.2.5 ;;
3206                         *) osvers=$tmp;;
3207                         esac
3208                         ;;
3209                 bsd386) osname=bsd386
3210                         osvers=`$uname -r`
3211                         ;;
3212                 cygwin*) osname=cygwin
3213                         osvers="$3"
3214                         ;;
3215                 *dc.osx) osname=dcosx
3216                         osvers="$3"
3217                         ;;
3218                 dnix) osname=dnix
3219                         osvers="$3"
3220                         ;;
3221                 domainos) osname=apollo
3222                         osvers="$3"
3223                         ;;
3224                 dgux)   osname=dgux
3225                         osvers="$3"
3226                         ;;
3227                 dragonfly) osname=dragonfly
3228                         osvers="$3"
3229                         ;;
3230                 dynixptx*) osname=dynixptx
3231                         osvers=`echo "$4"|sed 's/^v//'`
3232                         ;;
3233                 freebsd) osname=freebsd
3234                         osvers="$3" ;;
3235                 genix)  osname=genix ;;
3236                 gnu)    osname=gnu
3237                         osvers="$3" ;;
3238                 hp*)    osname=hpux
3239                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3240                         ;;
3241                 irix*)  osname=irix
3242                         case "$3" in
3243                         4*) osvers=4 ;;
3244                         5*) osvers=5 ;;
3245                         *)      osvers="$3" ;;
3246                         esac
3247                         ;;
3248                 linux)  osname=linux
3249                         case "$3" in
3250                         *)      osvers="$3" ;;
3251                         esac
3252                         ;;
3253                 MiNT)   osname=mint
3254                         ;;
3255                 netbsd*) osname=netbsd
3256                         osvers="$3"
3257                         ;;
3258                 news-os) osvers="$3"
3259                         case "$3" in
3260                         4*) osname=newsos4 ;;
3261                         *) osname=newsos ;;
3262                         esac
3263                         ;;
3264                 next*) osname=next ;;
3265                 nonstop-ux) osname=nonstopux ;;
3266                 openbsd) osname=openbsd
3267                         osvers="$3"
3268                         ;;
3269                 os2)    osname=os2
3270                         osvers="$4"
3271                         ;;
3272                 POSIX-BC | posix-bc ) osname=posix-bc
3273                         osvers="$3"
3274                         ;;
3275                 powerux | power_ux | powermax_os | powermaxos | \
3276                 powerunix | power_unix) osname=powerux
3277                         osvers="$3"
3278                         ;;
3279                 qnx) osname=qnx
3280                         osvers="$4"
3281                         ;;
3282                 solaris) osname=solaris
3283                         case "$3" in
3284                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3285                         *)      osvers="$3" ;;
3286                         esac
3287                         ;;
3288                 sunos) osname=sunos
3289                         case "$3" in
3290                         5*) osname=solaris
3291                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3292                         *)      osvers="$3" ;;
3293                         esac
3294                         ;;
3295                 titanos) osname=titanos
3296                         case "$3" in
3297                         1*) osvers=1 ;;
3298                         2*) osvers=2 ;;
3299                         3*) osvers=3 ;;
3300                         4*) osvers=4 ;;
3301                         *)      osvers="$3" ;;
3302                         esac
3303                         ;;
3304                 ultrix) osname=ultrix
3305                         osvers="$3"
3306                         ;;
3307                 osf1|mls+)      case "$5" in
3308                                 alpha)
3309                                         osname=dec_osf
3310                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3311                                         case "$osvers" in
3312                                         [1-9].[0-9]*) ;;
3313                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3314                                         esac
3315                                         ;;
3316                         hp*)    osname=hp_osf1  ;;
3317                         mips)   osname=mips_osf1 ;;
3318                         esac
3319                         ;;
3320                 # UnixWare 7.1.2 is known as Open UNIX 8
3321                 openunix|unixware) osname=svr5
3322                         osvers="$4"
3323                         ;;
3324                 uts)    osname=uts
3325                         osvers="$3"
3326                         ;;
3327                 vos) osvers="$3"
3328                         ;;
3329                 $2) case "$osname" in
3330                         *isc*) ;;
3331                         *freebsd*) ;;
3332                         svr*)
3333                                 : svr4.x or possibly later
3334                                 case "svr$3" in
3335                                 ${osname}*)
3336                                         osname=svr$3
3337                                         osvers=$4
3338                                         ;;
3339                                 esac
3340                                 case "$osname" in
3341                                 svr4.0)
3342                                         : Check for ESIX
3343                                         if test -f /stand/boot ; then
3344                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3345                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3346                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3347                                                         if test -n "$isesix"; then
3348                                                                 osname=esix4
3349                                                         fi
3350                                                 fi
3351                                         fi
3352                                         ;;
3353                                 esac
3354                                 ;;
3355                         *)      if test -f /etc/systemid; then
3356                                         osname=sco
3357                                         set `echo $3 | $sed 's/\./ /g'` $4
3358                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3359                                                 osvers=$1.$2.$3
3360                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3361                                                 osvers=$1.$2
3362                                         elif $test -f $src/hints/sco_$1.sh; then
3363                                                 osvers=$1
3364                                         fi
3365                                 else
3366                                         case "$osname" in
3367                                         '') : Still unknown.  Probably a generic Sys V.
3368                                                 osname="sysv"
3369                                                 osvers="$3"
3370                                                 ;;
3371                                         esac
3372                                 fi
3373                                 ;;
3374                         esac
3375                         ;;
3376                 *)      case "$osname" in
3377                         '') : Still unknown.  Probably a generic BSD.
3378                                 osname="$1"
3379                                 osvers="$3"
3380                                 ;;
3381                         esac
3382                         ;;
3383                 esac
3384         else
3385                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3386                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3387                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3388                                 osname=news_os
3389                         fi
3390                         $rm -f UU/kernel.what
3391                 elif test -d c:/. -o -n "$is_os2" ; then
3392                         set X $myuname
3393                         osname=os2
3394                         osvers="$5"
3395                 fi
3396         fi
3397
3398         case "$targetarch" in
3399         '') ;;
3400         *)  hostarch=$osname
3401             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3402             osvers=''
3403             ;;
3404         esac
3405
3406         : Now look for a hint file osname_osvers, unless one has been
3407         : specified already.
3408         case "$hintfile" in
3409         ''|' ')
3410                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3411                 : Also try without trailing minor version numbers.
3412                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3413                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3414                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3415                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3416                 case "$file" in
3417                 '') dflt=none ;;
3418                 *)  case "$osvers" in
3419                         '') dflt=$file
3420                                 ;;
3421                         *)  if $test -f $src/hints/$file.sh ; then
3422                                         dflt=$file
3423                                 elif $test -f $src/hints/$xfile.sh ; then
3424                                         dflt=$xfile
3425                                 elif $test -f $src/hints/$xxfile.sh ; then
3426                                         dflt=$xxfile
3427                                 elif $test -f $src/hints/$xxxfile.sh ; then
3428                                         dflt=$xxxfile
3429                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3430                                         dflt=$xxxxfile
3431                                 elif $test -f "$src/hints/${osname}.sh" ; then
3432                                         dflt="${osname}"
3433                                 else
3434                                         dflt=none
3435                                 fi
3436                                 ;;
3437                         esac
3438                         ;;
3439                 esac
3440                 if $test -f Policy.sh ; then
3441                         case "$dflt" in
3442                         *Policy*) ;;
3443                         none) dflt="Policy" ;;
3444                         *) dflt="Policy $dflt" ;;
3445                         esac
3446                 fi
3447                 ;;
3448         *)
3449                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3450                 ;;
3451         esac
3452
3453         if $test -f Policy.sh ; then
3454                 $cat <<EOM
3455
3456 There's also a Policy hint file available, which should make the
3457 site-specific (policy) questions easier to answer.
3458 EOM
3459
3460         fi
3461
3462         $cat <<EOM
3463
3464 You may give one or more space-separated answers, or "none" if appropriate.
3465 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3466 previous run of Configure, you may specify it as well as or instead of
3467 OS-specific hints.  If hints are provided for your OS, you should use them:
3468 although Perl can probably be built without hints on many platforms, using
3469 hints often improve performance and may enable features that Configure can't
3470 set up on its own. If there are no hints that match your OS, specify "none";
3471 DO NOT give a wrong version or a wrong OS.
3472
3473 EOM
3474
3475         rp="Which of these apply, if any?"
3476         . UU/myread
3477         tans=$ans
3478         for file in $tans; do
3479                 if $test X$file = XPolicy -a -f Policy.sh; then
3480                         . Policy.sh
3481                         $cat Policy.sh >> UU/config.sh
3482                 elif $test -f $src/hints/$file.sh; then
3483                         . $src/hints/$file.sh
3484                         $cat $src/hints/$file.sh >> UU/config.sh
3485                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3486                         : nothing
3487                 else
3488                         : Give one chance to correct a possible typo.
3489                         echo "$file.sh does not exist"
3490                         dflt=$file
3491                         rp="hint to use instead?"
3492                         . UU/myread
3493                         for file in $ans; do
3494                                 if $test -f "$src/hints/$file.sh"; then
3495                                         . $src/hints/$file.sh
3496                                         $cat $src/hints/$file.sh >> UU/config.sh
3497                                 elif $test X$ans = X -o X$ans = Xnone ; then
3498                                         : nothing
3499                                 else
3500                                         echo "$file.sh does not exist -- ignored."
3501                                 fi
3502                         done
3503                 fi
3504         done
3505
3506         hint=recommended
3507         : Remember our hint file for later.
3508         if $test -f "$src/hints/$file.sh" ; then
3509                 hintfile="$file"
3510         else
3511                 hintfile=''
3512         fi
3513 fi
3514 cd UU
3515 ;;
3516 *)
3517         echo " "
3518         echo "Fetching default answers from $config_sh..." >&4
3519         tmp_n="$n"
3520         tmp_c="$c"
3521         cd ..
3522         cp $config_sh config.sh 2>/dev/null
3523         chmod +w config.sh
3524         . ./config.sh
3525         cd UU
3526         cp ../config.sh .
3527         n="$tmp_n"
3528         c="$tmp_c"
3529         hint=previous
3530         ;;
3531 esac
3532 test "$override" && . ./optdef.sh
3533
3534 : Restore computed paths
3535 for file in $loclist $trylist; do
3536         eval $file="\$_$file"
3537 done
3538
3539 cat << EOM
3540
3541 Configure uses the operating system name and version to set some defaults.
3542 The default value is probably right if the name rings a bell. Otherwise,
3543 since spelling matters for me, either accept the default or answer "none"
3544 to leave it blank.
3545
3546 EOM
3547 case "$osname" in
3548         ''|' ')
3549                 case "$hintfile" in
3550                 ''|' '|none) dflt=none ;;
3551                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3552                 esac
3553                 ;;
3554         *) dflt="$osname" ;;
3555 esac
3556 rp="Operating system name?"
3557 . ./myread
3558 case "$ans" in
3559 none)  osname='' ;;
3560 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3561 esac
3562 echo " "
3563 case "$osvers" in
3564         ''|' ')
3565                 case "$hintfile" in
3566                 ''|' '|none) dflt=none ;;
3567                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3568                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3569                         case "$dflt" in
3570                         ''|' ') dflt=none ;;
3571                         esac
3572                         ;;
3573                 esac
3574                 ;;
3575         *) dflt="$osvers" ;;
3576 esac
3577 rp="Operating system version?"
3578 . ./myread
3579 case "$ans" in
3580 none)  osvers='' ;;
3581 *) osvers="$ans" ;;
3582 esac
3583
3584
3585 . ./posthint.sh
3586
3587 : who configured the system
3588 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3589 case "$cf_by" in
3590 "")
3591         cf_by=`(logname) 2>/dev/null`
3592         case "$cf_by" in
3593         "")
3594                 cf_by=`(whoami) 2>/dev/null`
3595                 case "$cf_by" in
3596                 "") cf_by=unknown ;;
3597                 esac ;;
3598         esac ;;
3599 esac
3600
3601 : decide how portable to be.  Allow command line overrides.
3602 case "$d_portable" in
3603 "$undef") ;;
3604 *)      d_portable="$define" ;;
3605 esac
3606
3607 : set up shell script to do ~ expansion
3608 cat >filexp <<EOSS
3609 $startsh
3610 : expand filename
3611 case "\$1" in
3612  \~/*|\~)
3613         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3614         ;;
3615  \~*)
3616         if $test -f /bin/csh; then
3617                 /bin/csh -f -c "glob \$1"
3618                 failed=\$?
3619                 echo ""
3620                 exit \$failed
3621         else
3622                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3623                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3624                 if $test ! -d "\$dir"; then
3625                         me=\`basename \$0\`
3626                         echo "\$me: can't locate home directory for: \$name" >&2
3627                         exit 1
3628                 fi
3629                 case "\$1" in
3630                 */*)
3631                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3632                         ;;
3633                 *)
3634                         echo \$dir
3635                         ;;
3636                 esac
3637         fi
3638         ;;
3639 *)
3640         echo \$1
3641         ;;
3642 esac
3643 EOSS
3644 chmod +x filexp
3645 $eunicefix filexp
3646
3647 : now set up to get a file name
3648 cat <<EOS >getfile
3649 $startsh
3650 EOS
3651 cat <<'EOSC' >>getfile
3652 tilde=''
3653 fullpath=''
3654 already=''
3655 skip=''
3656 none_ok=''
3657 exp_file=''
3658 nopath_ok=''
3659 orig_rp="$rp"
3660 orig_dflt="$dflt"
3661 case "$gfpth" in
3662 '') gfpth='.' ;;
3663 esac
3664
3665 case "$fn" in
3666 *\(*)
3667         : getfile will accept an answer from the comma-separated list
3668         : enclosed in parentheses even if it does not meet other criteria.
3669         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3670         fn=`echo $fn | sed 's/(.*)//'`
3671         ;;
3672 esac
3673
3674 case "$fn" in
3675 *:*)
3676         loc_file=`expr $fn : '.*:\(.*\)'`
3677         fn=`expr $fn : '\(.*\):.*'`
3678         ;;
3679 esac
3680
3681 case "$fn" in
3682 *~*) tilde=true;;
3683 esac
3684 case "$fn" in
3685 */*) fullpath=true;;
3686 esac
3687 case "$fn" in
3688 *+*) skip=true;;
3689 esac
3690 case "$fn" in
3691 *n*) none_ok=true;;
3692 esac
3693 case "$fn" in
3694 *e*) exp_file=true;;
3695 esac
3696 case "$fn" in
3697 *p*) nopath_ok=true;;
3698 esac
3699
3700 case "$fn" in
3701 *f*) type='File';;
3702 *d*) type='Directory';;
3703 *l*) type='Locate';;
3704 esac
3705
3706 what="$type"
3707 case "$what" in
3708 Locate) what='File';;
3709 esac
3710
3711 case "$exp_file" in
3712 '')
3713         case "$d_portable" in
3714         "$define") ;;
3715         *) exp_file=true;;
3716         esac
3717         ;;
3718 esac
3719
3720 cd ..
3721 while test "$type"; do
3722         redo=''
3723         rp="$orig_rp"
3724         dflt="$orig_dflt"
3725         case "$tilde" in
3726         true) rp="$rp (~name ok)";;
3727         esac
3728         . UU/myread
3729         if test -f UU/getfile.ok && \
3730                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3731         then
3732                 value="$ans"
3733                 ansexp="$ans"
3734                 break
3735         fi
3736         case "$ans" in
3737         none)
3738                 value=''
3739                 ansexp=''
3740                 case "$none_ok" in
3741                 true) type='';;
3742                 esac
3743                 ;;
3744         *)
3745                 case "$tilde" in
3746                 '') value="$ans"
3747                         ansexp="$ans";;
3748                 *)
3749                         value=`UU/filexp $ans`
3750                         case $? in
3751                         0)
3752                                 if test "$ans" != "$value"; then
3753                                         echo "(That expands to $value on this system.)"
3754                                 fi
3755                                 ;;
3756                         *) value="$ans";;
3757                         esac
3758                         ansexp="$value"
3759                         case "$exp_file" in
3760                         '') value="$ans";;
3761                         esac
3762                         ;;
3763                 esac
3764                 case "$fullpath" in
3765                 true)
3766                         case "$ansexp" in
3767                         /*) value="$ansexp" ;;
3768                         [a-zA-Z]:/*) value="$ansexp" ;;
3769                         *)
3770                                 redo=true
3771                                 case "$already" in
3772                                 true)
3773                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3774                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3775                                         ;;
3776                                 *)
3777                                 echo "Please give a full path name, starting with slash." >&4
3778                                         case "$tilde" in
3779                                         true)
3780                                 echo "Note that using ~name is ok provided it expands well." >&4
3781                                                 already=true
3782                                                 ;;
3783                                         esac
3784                                 esac
3785                                 ;;
3786                         esac
3787                         ;;
3788                 esac
3789                 case "$redo" in
3790                 '')
3791                         case "$type" in
3792                         File)
3793                                 for fp in $gfpth; do
3794                                         if test "X$fp" = X.; then
3795                                             pf="$ansexp"
3796                                         else    
3797                                             pf="$fp/$ansexp"
3798                                         fi
3799                                         if test -f "$pf"; then
3800                                                 type=''
3801                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3802                                         then
3803                                                 echo "($value is not a plain file, but that's ok.)"
3804                                                 type=''
3805                                         fi
3806                                         if test X"$type" = X; then
3807                                             value="$pf"
3808                                             break
3809                                         fi
3810                                 done
3811                                 ;;
3812                         Directory)
3813                                 for fp in $gfpth; do
3814                                         if test "X$fp" = X.; then
3815                                             dir="$ans"
3816                                             direxp="$ansexp"
3817                                         else    
3818                                             dir="$fp/$ansexp"
3819                                             direxp="$fp/$ansexp"
3820                                         fi
3821                                         if test -d "$direxp"; then
3822                                                 type=''
3823                                                 value="$dir"
3824                                                 break
3825                                         fi
3826                                 done
3827                                 ;;
3828                         Locate)
3829                                 if test -d "$ansexp"; then
3830                                         echo "(Looking for $loc_file in directory $value.)"
3831                                         value="$value/$loc_file"
3832                                         ansexp="$ansexp/$loc_file"
3833                                 fi
3834                                 if test -f "$ansexp"; then
3835                                         type=''
3836                                 fi
3837                                 case "$nopath_ok" in
3838                                 true)   case "$value" in
3839                                         */*) ;;
3840                                         *)      echo "Assuming $value will be in people's path."
3841                                                 type=''
3842                                                 ;;
3843                                         esac
3844                                         ;;
3845                                 esac
3846                                 ;;
3847                         esac
3848
3849                         case "$skip" in
3850                         true) type='';
3851                         esac
3852
3853                         case "$type" in
3854                         '') ;;
3855                         *)
3856                                 if test "$fastread" = yes; then
3857                                         dflt=y
3858                                 else
3859                                         dflt=n
3860                                 fi
3861                                 rp="$what $value doesn't exist.  Use that name anyway?"
3862                                 . UU/myread
3863                                 dflt=''
3864                                 case "$ans" in
3865                                 y*) type='';;
3866                                 *) echo " ";;
3867                                 esac
3868                                 ;;
3869                         esac
3870                         ;;
3871                 esac
3872                 ;;
3873         esac
3874 done
3875 cd UU
3876 ans="$value"
3877 rp="$orig_rp"
3878 dflt="$orig_dflt"
3879 rm -f getfile.ok
3880 test "X$gfpthkeep" != Xy && gfpth=""
3881 EOSC
3882
3883 : determine root of directory hierarchy where package will be installed.
3884 case "$prefix" in
3885 '')
3886         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3887         ;;
3888 *?/)
3889         dflt=`echo "$prefix" | sed 's/.$//'`
3890         ;;
3891 *)
3892         dflt="$prefix"
3893         ;;
3894 esac
3895 $cat <<EOM
3896
3897 By default, $package will be installed in $dflt/bin, manual pages
3898 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3899 installation directories. Typically this is something like /usr/local.
3900 If you wish to have binaries under /usr/bin but other parts of the
3901 installation under /usr/local, that's ok: you will be prompted
3902 separately for each of the installation directories, the prefix being
3903 only used to set the defaults.
3904
3905 EOM
3906 fn=d~
3907 rp='Installation prefix to use?'
3908 . ./getfile
3909 oldprefix=''
3910 case "$prefix" in
3911 '') ;;
3912 *)
3913         case "$ans" in
3914         "$prefix") ;;
3915         *) oldprefix="$prefix";;
3916         esac
3917         ;;
3918 esac
3919 prefix="$ans"
3920 prefixexp="$ansexp"
3921
3922 : allow them to override the AFS root
3923 case "$afsroot" in
3924 '')     afsroot=/afs ;;
3925 *)      afsroot=$afsroot ;;
3926 esac
3927
3928 : is AFS running?
3929 echo " "
3930 case "$afs" in
3931 $define|true)   afs=true ;;
3932 $undef|false)   afs=false ;;
3933 *)      if $test -d $afsroot; then
3934                 afs=true
3935         else
3936                 afs=false
3937         fi
3938         ;;
3939 esac
3940 if $afs; then
3941         echo "AFS may be running... I'll be extra cautious then..." >&4
3942 else
3943         echo "AFS does not seem to be running..." >&4
3944 fi
3945
3946 : determine installation prefix for where package is to be installed.
3947 if $afs; then 
3948 $cat <<EOM
3949
3950 Since you are running AFS, I need to distinguish the directory in which
3951 files will reside from the directory in which they are installed (and from
3952 which they are presumably copied to the former directory by occult means).
3953
3954 EOM
3955         case "$installprefix" in
3956         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3957         *) dflt="$installprefix";;
3958         esac
3959 else
3960 $cat <<EOM
3961
3962 In some special cases, particularly when building $package for distribution,
3963 it is convenient to distinguish the directory in which files should be
3964 installed from the directory ($prefix) in which they will
3965 eventually reside.  For most users, these two directories are the same.
3966
3967 EOM
3968         case "$installprefix" in
3969         '') dflt=$prefix ;;
3970         *) dflt=$installprefix;;
3971         esac
3972 fi
3973 fn=d~
3974 rp='What installation prefix should I use for installing files?'
3975 . ./getfile
3976 installprefix="$ans"
3977 installprefixexp="$ansexp"
3978
3979 : Perform the prefixexp/installprefixexp correction if necessary
3980 cat <<EOS >installprefix
3981 $startsh
3982 EOS
3983 cat <<'EOSC' >>installprefix
3984 : Change installation prefix, if necessary.
3985 if $test X"$prefix" != X"$installprefix"; then
3986     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3987 else
3988     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3989 fi
3990 EOSC
3991 chmod +x installprefix
3992 $eunicefix installprefix
3993
3994 : Set variables such as privlib and privlibexp from the output of ./getfile
3995 : performing the prefixexp/installprefixexp correction if necessary.
3996 cat <<EOS >setprefixvar
3997 $startsh
3998 EOS
3999 cat <<'EOSC' >>setprefixvar
4000 eval "${prefixvar}=\"\$ans\""
4001 eval "${prefixvar}exp=\"\$ansexp\""
4002 . ./installprefix
4003 EOSC
4004 chmod +x setprefixvar
4005 $eunicefix setprefixvar
4006
4007 : set up the script used to warn in case of inconsistency
4008 cat <<EOS >whoa
4009 $startsh
4010 EOS
4011 cat <<'EOSC' >>whoa
4012 dflt=y
4013 case "$hint" in
4014     recommended)
4015         case "$hintfile" in
4016         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4017                 ;;
4018         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4019                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4020                 ;;
4021         esac
4022         ;;
4023     *)  echo " "
4024         echo "*** WHOA THERE!!! ***" >&4
4025         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4026         ;;
4027 esac
4028 rp="    Keep the $hint value?"
4029 . ./myread
4030 case "$ans" in
4031 y) td=$was; tu=$was;;
4032 esac
4033 EOSC
4034
4035 : function used to set '$1' to '$val'
4036 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4037 case "$val$was" in
4038 $define$undef) . ./whoa; eval "$var=\$td";;
4039 $undef$define) . ./whoa; eval "$var=\$tu";;
4040 *) eval "$var=$val";;
4041 esac'
4042
4043 : Check is we will use socks
4044 case "$usesocks" in
4045 $define|true|[yY]*)     dflt='y';;
4046 *) dflt='n';;
4047 esac
4048 cat <<EOM
4049
4050 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4051 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4052 to use the PerlIO abstraction layer, this will be implicitly selected.
4053
4054 If this doesn't make any sense to you, just accept the default '$dflt'.
4055 EOM
4056 rp='Build Perl for SOCKS?'
4057 . ./myread
4058 case "$ans" in
4059 y|Y)    val="$define" ;;
4060 *)      val="$undef" ;;
4061 esac
4062 set usesocks
4063 eval $setvar
4064
4065 case "$usesocks" in
4066 $define|true|[yY]*) useperlio="$define";;
4067 esac
4068
4069 : Check if we want perlio
4070 case "$useperlio" in
4071 $define|true|[yY]*|'')  dflt='y';;
4072 *) dflt='n';;
4073 esac
4074 cat <<EOM
4075
4076 Previous version of $package used the standard IO mechanisms as
4077 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4078 alternate IO mechanisms via the PerlIO abstraction layer, but the
4079 stdio mechanism is still available if needed.  The abstraction layer
4080 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4081 Using PerlIO with sfio may cause problems with some extension modules.
4082
4083 If this doesn't make any sense to you, just accept the default '$dflt'.
4084 EOM
4085 rp='Use the PerlIO abstraction layer?'
4086 . ./myread
4087 case "$ans" in
4088 y|Y)
4089         val="$define"
4090         ;;
4091 *)
4092         echo "Ok, doing things the stdio way."
4093         val="$undef"
4094         ;;
4095 esac
4096 set useperlio
4097 eval $setvar
4098
4099 case "$usesocks" in
4100 $define|true|[yY]*)
4101         case "$useperlio" in
4102         $define|true|[yY]*) ;;
4103         *)      cat >&4 <<EOM
4104
4105 You are using the SOCKS proxy protocol library which means that you
4106 should also use the PerlIO layer.  You may be headed for trouble.
4107
4108 EOM
4109                 ;;
4110         esac
4111         ;;
4112 esac
4113
4114 : get the patchlevel
4115 echo " "
4116 echo "Getting the current patchlevel..." >&4
4117 if $test -r $rsrc/patchlevel.h;then
4118         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4119         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4120         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4121         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4122         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4123         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4124         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4125 else
4126         revision=0
4127         patchlevel=0
4128         subversion=0
4129         api_revision=0
4130         api_version=0
4131         api_subversion=0
4132         perl_patchlevel=0
4133         $echo "(You do not have patchlevel.h.  Eek.)"
4134 fi
4135 if $test -r $rsrc/.patch ; then
4136         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4137                 perl_patchlevel=`cat $rsrc/.patch`
4138         fi
4139 fi
4140 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4141 version_patchlevel_string="version $patchlevel subversion $subversion"
4142 case "$perl_patchlevel" in
4143 0|'') ;;
4144 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4145 esac
4146
4147 $echo "(You have $package $version_patchlevel_string.)"
4148
4149 case "$osname" in
4150 dos|vms)
4151         : XXX Should be a Configure test for double-dots in filenames.
4152         version=`echo $revision $patchlevel $subversion | \
4153                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4154         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4155                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4156         ;;
4157 *)
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 esac
4164 : Special case the 5.005_xx maintenance series, which used 5.005
4165 : without any subversion label as a subdirectory in $sitelib
4166 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4167         api_versionstring='5.005'
4168 fi
4169
4170 : Do we want threads support and if so, what type
4171 case "$usethreads" in
4172 $define|true|[yY]*)     dflt='y';;
4173 *)     # Catch case where user specified ithreads or 5005threads but
4174        # forgot -Dusethreads (A.D. 4/2002)
4175        case "$useithreads$use5005threads" in
4176        *$define*)
4177                 case "$useperlio" in
4178                 "$define")      dflt='y' ;;
4179                 *)              dflt='n' ;;
4180                 esac
4181                 ;;
4182        *)       dflt='n';;
4183        esac
4184        ;;
4185 esac
4186 cat <<EOM
4187
4188 Perl can be built to take advantage of threads on some systems.
4189 To do so, Configure can be run with -Dusethreads.
4190
4191 Note that Perl built with threading support runs slightly slower
4192 and uses more memory than plain Perl. The current implementation
4193 is believed to be stable, but it is fairly new, and so should be
4194 treated with caution.
4195
4196 If this doesn't make any sense to you, just accept the default '$dflt'.
4197 EOM
4198 rp='Build a threading Perl?'
4199 . ./myread
4200 case "$ans" in
4201 y|Y)    val="$define" ;;
4202 *)      val="$undef" ;;
4203 esac
4204 set usethreads
4205 eval $setvar
4206
4207 if $test $patchlevel -lt 9; then
4208     case "$usethreads" in
4209     $define)
4210         $cat <<EOM
4211
4212 Since release 5.6, Perl has had two different threading implementations,
4213 the newer interpreter-based version (ithreads) with one interpreter per
4214 thread, and the older 5.005 version (5005threads).
4215 The 5005threads version is effectively unmaintained and will probably be
4216 removed in Perl 5.10, so there should be no need to build a Perl using it
4217 unless needed for backwards compatibility with some existing 5.005threads
4218 code.
4219
4220 EOM
4221         : Default to ithreads unless overridden on command line or with
4222         : old config.sh
4223         dflt='y'
4224         case "$use5005threads" in
4225                 $define|true|[yY]*) dflt='n';;
4226         esac
4227         case "$useithreads" in
4228                 $undef|false|[nN]*) dflt='n';;
4229         esac
4230         rp='Use the newer interpreter-based ithreads?'
4231         . ./myread
4232         case "$ans" in
4233         y|Y)    val="$define" ;;
4234         *)      val="$undef" ;;
4235         esac
4236         set useithreads
4237         eval $setvar
4238         : Now set use5005threads to the opposite value.
4239         case "$useithreads" in
4240         $define) val="$undef" ;;
4241         *) val="$define" ;;
4242         esac
4243         set use5005threads
4244         eval $setvar
4245         ;;
4246     *)
4247         useithreads="$undef"
4248         use5005threads="$undef"
4249         ;;
4250     esac
4251
4252     case "$useithreads$use5005threads" in
4253     "$define$define")
4254         $cat >&4 <<EOM
4255
4256 You cannot have both the ithreads and the 5.005 threads enabled
4257 at the same time.  Disabling the 5.005 threads since they are
4258 much less stable than the ithreads.
4259
4260 EOM
4261         use5005threads="$undef"
4262         ;;
4263     esac
4264
4265 else
4266 : perl-5.9.x and later
4267
4268     if test X"$usethreads" = "X$define"; then
4269         case "$use5005threads" in
4270             $define|true|[yY]*)
4271                 $cat >&4 <<EOM
4272
4273 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4274
4275 EOM
4276             ;;
4277         esac
4278     fi
4279
4280     use5005threads="$undef"
4281     useithreads="$usethreads"
4282 fi
4283
4284 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4285         cat >&4 <<EOF
4286 ***
4287 *** To build with ithreads you must also use the PerlIO layer.
4288 *** Cannot continue, aborting.
4289 ***
4290 EOF
4291         exit 1
4292 fi
4293
4294 case "$d_oldpthreads" in
4295 '')     : Configure tests would be welcome here.  For now, assume undef.
4296         val="$undef" ;;
4297 *)      val="$d_oldpthreads" ;;
4298 esac
4299 set d_oldpthreads
4300 eval $setvar
4301
4302
4303 : Look for a hint-file generated 'call-back-unit'.  If the
4304 : user has specified that a threading perl is to be built,
4305 : we may need to set or change some other defaults.
4306 if $test -f usethreads.cbu; then
4307     echo "Your platform has some specific hints regarding threaded builds, using them..."
4308     . ./usethreads.cbu
4309 else
4310     case "$usethreads" in
4311         "$define"|true|[yY]*)
4312                 $cat <<EOM
4313 (Your platform does not have any specific hints for threaded builds.
4314  Assuming POSIX threads, then.)
4315 EOM
4316         ;;
4317     esac
4318 fi
4319
4320 : Check if multiplicity is required
4321 cat <<EOM
4322
4323 Perl can be built so that multiple Perl interpreters can coexist
4324 within the same Perl executable.
4325 EOM
4326
4327 case "$useithreads" in
4328 $define)
4329         cat <<EOM
4330 This multiple interpreter support is required for interpreter-based threads.
4331 EOM
4332         val="$define"
4333         ;;
4334 *)      case "$usemultiplicity" in
4335         $define|true|[yY]*)     dflt='y';;
4336         *) dflt='n';;
4337         esac
4338         echo " "
4339         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4340         rp='Build Perl for multiplicity?'
4341         . ./myread
4342         case "$ans" in
4343         y|Y)    val="$define" ;;
4344         *)      val="$undef" ;;
4345         esac
4346         ;;
4347 esac
4348 set usemultiplicity
4349 eval $setvar
4350
4351 : Check if morebits is requested
4352 case "$usemorebits" in
4353 "$define"|true|[yY]*)
4354         use64bitint="$define"
4355         uselongdouble="$define"
4356         usemorebits="$define"
4357         ;;
4358 *)      usemorebits="$undef"
4359         ;;
4360 esac
4361
4362 : Determine the C compiler to be used
4363 echo " "
4364 case "$cc" in
4365 '') dflt=cc;;
4366 *) dflt="$cc";;
4367 esac
4368 rp="Use which C compiler?"
4369 . ./myread
4370 cc="$ans"
4371
4372 : See whether they have no cc but they do have gcc
4373 . ./trygcc
4374 if $test -f cc.cbu; then
4375     . ./cc.cbu
4376 fi
4377 . ./checkcc
4378
4379 : make some quick guesses about what we are up against
4380 echo " "
4381 $echo $n "Hmm...  $c"
4382 echo exit 1 >bsd
4383 echo exit 1 >usg
4384 echo exit 1 >v7
4385 echo exit 1 >osf1
4386 echo exit 1 >eunice
4387 echo exit 1 >xenix
4388 echo exit 1 >venix
4389 echo exit 1 >os2
4390 d_bsd="$undef"
4391 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4392 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4393 then
4394         echo "Looks kind of like an OSF/1 system, but we'll see..."
4395         echo exit 0 >osf1
4396 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4397         xxx=`./loc addbib blurfl $pth`
4398         if $test -f $xxx; then
4399         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4400                 echo exit 0 >bsd
4401                 echo exit 0 >usg
4402         else
4403                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4404                         echo "Looks kind of like an extended USG system, but we'll see..."
4405                 else
4406                         echo "Looks kind of like a USG system, but we'll see..."
4407                 fi
4408                 echo exit 0 >usg
4409         fi
4410 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4411         echo "Looks kind of like a BSD system, but we'll see..."
4412         d_bsd="$define"
4413         echo exit 0 >bsd
4414 else
4415         echo "Looks kind of like a Version 7 system, but we'll see..."
4416         echo exit 0 >v7
4417 fi
4418 case "$eunicefix" in
4419 *unixtovms*)
4420         $cat <<'EOI'
4421 There is, however, a strange, musty smell in the air that reminds me of
4422 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4423 EOI
4424         echo exit 0 >eunice
4425         d_eunice="$define"
4426 : it so happens the Eunice I know will not run shell scripts in Unix format
4427         ;;
4428 *)
4429         echo " "
4430         echo "Congratulations.  You aren't running Eunice."
4431         d_eunice="$undef"
4432         ;;
4433 esac
4434 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4435 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4436 : semicolon as a patch separator
4437 case "$p_" in
4438 :) ;;
4439 *)
4440         $cat <<'EOI'
4441 I have the feeling something is not exactly right, however...don't tell me...
4442 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4443 (Or you may be running DOS with DJGPP.)
4444 EOI
4445         echo exit 0 >os2
4446         ;;
4447 esac
4448 if test -f /xenix; then
4449         echo "Actually, this looks more like a XENIX system..."
4450         echo exit 0 >xenix
4451         d_xenix="$define"
4452 else
4453         echo " "
4454         echo "It's not Xenix..."
4455         d_xenix="$undef"
4456 fi
4457 chmod +x xenix
4458 $eunicefix xenix
4459 if test -f /venix; then
4460         echo "Actually, this looks more like a VENIX system..."
4461         echo exit 0 >venix
4462 else
4463         echo " "
4464         if ./xenix; then
4465                 : null
4466         else
4467                 echo "Nor is it Venix..."
4468         fi
4469 fi
4470 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4471 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4472 $rm -f foo
4473
4474 : Check if we are using GNU gcc and what its version is
4475 echo " "
4476 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4477 $cat >try.c <<EOM
4478 #include <stdio.h>
4479 int main() {
4480 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4481 #ifdef __VERSION__
4482         printf("%s\n", __VERSION__);
4483 #else
4484         printf("%s\n", "1");
4485 #endif
4486 #endif
4487         return(0);
4488 }
4489 EOM
4490 if $cc -o try $ccflags $ldflags try.c; then
4491         gccversion=`$run ./try`
4492         case "$gccversion" in
4493         '') echo "You are not using GNU cc." ;;
4494         *)  echo "You are using GNU cc $gccversion."
4495             ccname=gcc
4496             ;;
4497         esac
4498 else
4499         echo " "
4500         echo "*** WHOA THERE!!! ***" >&4
4501         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4502         case "$knowitall" in
4503         '')
4504         echo "    You'd better start hunting for one and let me know about it." >&4
4505                 exit 1
4506                 ;;
4507         esac
4508 fi
4509 $rm -f try try.*
4510 case "$gccversion" in
4511 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4512 esac
4513 case "$gccversion" in
4514 '') gccosandvers='' ;;
4515 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4516    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4517    gccshortvers=''
4518    case "$gccosandvers" in
4519    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4520    $osname$osvers) ;; # looking good
4521    $osname*) cat <<EOM >&4
4522
4523 *** WHOA THERE!!! ***
4524
4525     Your gcc has not been compiled for the exact release of
4526     your operating system ($gccosandvers versus $osname$osvers).
4527
4528     In general it is a good idea to keep gcc synchronized with
4529     the operating system because otherwise serious problems
4530     may ensue when trying to compile software, like Perl.
4531
4532     I'm trying to be optimistic here, though, and will continue.
4533     If later during the configuration and build icky compilation
4534     problems appear (headerfile conflicts being the most common
4535     manifestation), I suggest reinstalling the gcc to match
4536     your operating system release.
4537
4538 EOM
4539       ;;
4540    *) gccosandvers='' ;; # failed to parse, better be silent
4541    esac
4542    ;;
4543 esac
4544 case "$ccname" in
4545 '') ccname="$cc" ;;
4546 esac
4547
4548 # gcc 3.* complain about adding -Idirectories that they already know about,
4549 # so we will take those off from locincpth.
4550 case "$gccversion" in
4551 3*)
4552     echo "main(){}">try.c
4553     for incdir in $locincpth; do
4554        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4555              grep '^c[cp]p*[01]: warning: changing search order '`
4556        if test "X$warn" != X; then
4557            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4558        fi
4559     done
4560     $rm -f try try.*
4561 esac
4562
4563 : What should the include directory be ?
4564 echo " "
4565 $echo $n "Hmm...  $c"
4566 dflt='/usr/include'
4567 incpath=''
4568 mips_type=''
4569 if $test -f /bin/mips && /bin/mips; then
4570         echo "Looks like a MIPS system..."
4571         $cat >usr.c <<'EOCP'
4572 #ifdef SYSTYPE_BSD43
4573 /bsd43
4574 #endif
4575 EOCP
4576         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4577                 dflt='/bsd43/usr/include'
4578                 incpath='/bsd43'
4579                 mips_type='BSD 4.3'
4580         else
4581                 mips_type='System V'
4582         fi
4583         $rm -f usr.c usr.out
4584         echo "and you're compiling with the $mips_type compiler and libraries."
4585         xxx_prompt=y
4586         echo "exit 0" >mips
4587 else
4588         echo "Doesn't look like a MIPS system."
4589         xxx_prompt=n
4590         echo "exit 1" >mips
4591 fi
4592 chmod +x mips
4593 $eunicefix mips
4594 case "$usrinc" in
4595 '') ;;
4596 *) dflt="$usrinc";;
4597 esac
4598 case "$xxx_prompt" in
4599 y)      fn=d/
4600         echo " "
4601         rp='Where are the include files you want to use?'
4602         . ./getfile
4603         usrinc="$ans"
4604         ;;
4605 *)      usrinc="$dflt"
4606         ;;
4607 esac
4608
4609 : see how we invoke the C preprocessor
4610 echo " "
4611 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4612 cat <<'EOT' >testcpp.c
4613 #define ABC abc
4614 #define XYZ xyz
4615 ABC.XYZ
4616 EOT
4617 cd ..
4618 if test ! -f cppstdin; then
4619         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4620                 # AIX cc -E doesn't show the absolute headerfile
4621                 # locations but we'll cheat by using the -M flag.
4622                 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
4623         else
4624                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4625         fi
4626 else
4627         echo "Keeping your $hint cppstdin wrapper."
4628 fi
4629 chmod 755 cppstdin
4630 wrapper=`pwd`/cppstdin
4631 ok='false'
4632 cd UU
4633
4634 if $test "X$cppstdin" != "X" && \
4635         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4636         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4637 then
4638         echo "You used to use $cppstdin $cppminus so we'll use that again."
4639         case "$cpprun" in
4640         '') echo "But let's see if we can live without a wrapper..." ;;
4641         *)
4642                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4643                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4644                 then
4645                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4646                         ok='true'
4647                 else
4648                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4649                 fi
4650                 ;;
4651         esac
4652 else
4653         case "$cppstdin" in
4654         '') ;;
4655         *)
4656                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4657                 ;;
4658         esac
4659 fi
4660
4661 if $ok; then
4662         : nothing
4663 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4664         $cc -E <testcpp.c >testcpp.out 2>&1; \
4665         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4666         echo "Yup, it does."
4667         x_cpp="$cc -E"
4668         x_minus='';
4669 elif echo 'Nope...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"' -P" will work...'; \
4676         $cc -P <testcpp.c >testcpp.out 2>&1; \
4677         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4678         echo "Yipee, that works!"
4679         x_cpp="$cc -P"
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 "At long last!"
4685         x_cpp="$cc -P"
4686         x_minus='-';
4687 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4688         $cpp <testcpp.c >testcpp.out 2>&1; \
4689         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4690         echo "It works!"
4691         x_cpp="$cpp"
4692         x_minus='';
4693 elif echo 'Nixed again...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 "Hooray, it works!  I was beginning to wonder."
4697         x_cpp="$cpp"
4698         x_minus='-';
4699 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4700         $wrapper <testcpp.c >testcpp.out 2>&1; \
4701         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4702         x_cpp="$wrapper"
4703         x_minus=''
4704         echo "Eureka!"
4705 else
4706         dflt=''
4707         rp="No dice.  I can't find a C preprocessor.  Name one:"
4708         . ./myread
4709         x_cpp="$ans"
4710         x_minus=''
4711         $x_cpp <testcpp.c >testcpp.out 2>&1
4712         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4713                 echo "OK, that will do." >&4
4714         else
4715 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4716                 exit 1
4717         fi
4718 fi
4719
4720 case "$ok" in
4721 false)
4722         cppstdin="$x_cpp"
4723         cppminus="$x_minus"
4724         cpprun="$x_cpp"
4725         cpplast="$x_minus"
4726         set X $x_cpp
4727         shift
4728         case "$1" in
4729         "$cpp")
4730                 echo "Perhaps can we force $cc -E using a wrapper..."
4731                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4732                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4733                 then
4734                         echo "Yup, we can."
4735                         cppstdin="$wrapper"
4736                         cppminus='';
4737                 else
4738                         echo "Nope, we'll have to live without it..."
4739                 fi
4740                 ;;
4741         esac
4742         case "$cpprun" in
4743         "$wrapper")
4744                 cpprun=''
4745                 cpplast=''
4746                 ;;
4747         esac
4748         ;;
4749 esac
4750
4751 case "$cppstdin" in
4752 "$wrapper"|'cppstdin') ;;
4753 *) $rm -f $wrapper;;
4754 esac
4755 $rm -f testcpp.c testcpp.out
4756
4757 : Set private lib path
4758 case "$plibpth" in
4759 '') if ./mips; then
4760                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4761         fi;;
4762 esac
4763 case "$libpth" in
4764 ' ') dlist='';;
4765 '') dlist="$loclibpth $plibpth $glibpth";;
4766 *) dlist="$libpth";;
4767 esac
4768
4769 : Now check and see which directories actually exist, avoiding duplicates
4770 libpth=''
4771 for xxx in $dlist
4772 do
4773     if $test -d $xxx; then
4774                 case " $libpth " in
4775                 *" $xxx "*) ;;
4776                 *) libpth="$libpth $xxx";;
4777                 esac
4778     fi
4779 done
4780 $cat <<'EOM'
4781
4782 Some systems have incompatible or broken versions of libraries.  Among
4783 the directories listed in the question below, please remove any you
4784 know not to be holding relevant libraries, and add any that are needed.
4785 Say "none" for none.
4786
4787 EOM
4788 case "$libpth" in
4789 '') dflt='none';;
4790 *)
4791         set X $libpth
4792         shift
4793         dflt=${1+"$@"}
4794         ;;
4795 esac
4796 rp="Directories to use for library searches?"
4797 . ./myread
4798 case "$ans" in
4799 none) libpth=' ';;
4800 *) libpth="$ans";;
4801 esac
4802
4803 : compute shared library extension
4804 case "$so" in
4805 '')
4806         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4807                 dflt='sl'
4808         else
4809                 dflt='so'
4810         fi
4811         ;;
4812 *) dflt="$so";;
4813 esac
4814 $cat <<EOM
4815
4816 On some systems, shared libraries may be available.  Answer 'none' if
4817 you want to suppress searching of shared libraries for the remainder
4818 of this configuration.
4819
4820 EOM
4821 rp='What is the file extension used for shared libraries?'
4822 . ./myread
4823 so="$ans"
4824
4825 : Define several unixisms.
4826 : Hints files or command line option can be used to override them.
4827 : The convoluted testing is in case hints files set either the old
4828 : or the new name.
4829 case "$_exe" in
4830 '')     case "$exe_ext" in
4831         '')     ;;
4832         *)      _exe="$exe_ext" ;;
4833         esac
4834         ;;
4835 esac
4836 case "$_a" in
4837 '')     case "$lib_ext" in
4838     '') _a='.a';;
4839         *)      _a="$lib_ext" ;;
4840         esac
4841         ;;
4842 esac
4843 case "$_o" in
4844 '') case "$obj_ext" in
4845         '')     _o='.o';;
4846         *)      _o="$obj_ext";;
4847         esac
4848         ;;
4849 esac
4850 case "$p_" in
4851 '') case "$path_sep" in
4852         '')     p_=':';;
4853         *)      p_="$path_sep";;
4854         esac
4855         ;;
4856 esac
4857 exe_ext=$_exe
4858 lib_ext=$_a
4859 obj_ext=$_o
4860 path_sep=$p_
4861
4862 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4863
4864 : Which makefile gets called first.  This is used by make depend.
4865 case "$firstmakefile" in
4866 '') firstmakefile='makefile';;
4867 esac
4868
4869 : Check for uselongdouble support
4870 case "$ccflags" in
4871 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4872 esac
4873
4874 case "$uselongdouble" in
4875 $define|true|[yY]*)     dflt='y';;
4876 *) dflt='n';;
4877 esac
4878 cat <<EOM
4879
4880 Perl can be built to take advantage of long doubles which
4881 (if available) may give more accuracy and range for floating point numbers.
4882
4883 If this doesn't make any sense to you, just accept the default '$dflt'.
4884 EOM
4885 rp='Try to use long doubles if available?'
4886 . ./myread
4887 case "$ans" in
4888 y|Y)    val="$define"   ;;
4889 *)      val="$undef"    ;;
4890 esac
4891 set uselongdouble
4892 eval $setvar
4893
4894 case "$uselongdouble" in
4895 true|[yY]*) uselongdouble="$define" ;;
4896 esac
4897
4898 : Look for a hint-file generated 'call-back-unit'.  If the
4899 : user has specified that long doubles should be used,
4900 : we may need to set or change some other defaults.
4901 if $test -f uselongdouble.cbu; then
4902     echo "Your platform has some specific hints regarding long doubles, using them..."
4903     . ./uselongdouble.cbu
4904 else
4905     case "$uselongdouble" in
4906         $define)
4907                 $cat <<EOM
4908 (Your platform does not have any specific hints for long doubles.)
4909 EOM
4910         ;;
4911     esac
4912 fi
4913
4914 : Looking for optional libraries
4915 echo " "
4916 echo "Checking for optional libraries..." >&4
4917 case "$libs" in
4918 ' '|'') dflt='';;
4919 *) dflt="$libs";;
4920 esac
4921 case "$libswanted" in
4922 '') libswanted='c_s';;
4923 esac
4924 case "$usesocks" in
4925 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4926 esac
4927 libsfound=''
4928 libsfiles=''
4929 libsdirs=''
4930 libspath=''
4931 for thisdir in $libpth $xlibpth; do
4932   test -d $thisdir && libspath="$libspath $thisdir"
4933 done
4934 for thislib in $libswanted; do
4935         for thisdir in $libspath; do
4936             xxx=''
4937             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4938                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4939                 $test -f "$xxx" && eval $libscheck
4940                 $test -f "$xxx" && libstyle=shared
4941             fi
4942             if test ! -f "$xxx"; then
4943                 xxx=$thisdir/lib$thislib.$so
4944                 $test -f "$xxx" && eval $libscheck
4945                 $test -f "$xxx" && libstyle=shared
4946             fi
4947             if test ! -f "$xxx"; then
4948                 xxx=$thisdir/lib$thislib$_a
4949                 $test -f "$xxx" && eval $libscheck
4950                 $test -f "$xxx" && libstyle=static
4951             fi
4952             if test ! -f "$xxx"; then
4953                 xxx=$thisdir/$thislib$_a
4954                 $test -f "$xxx" && eval $libscheck
4955                 $test -f "$xxx" && libstyle=static
4956             fi
4957             if test ! -f "$xxx"; then
4958                 xxx=$thisdir/lib${thislib}_s$_a
4959                 $test -f "$xxx" && eval $libscheck
4960                 $test -f "$xxx" && libstyle=static
4961                 $test -f "$xxx" && thislib=${thislib}_s
4962             fi
4963             if test ! -f "$xxx"; then
4964                 xxx=$thisdir/Slib$thislib$_a
4965                 $test -f "$xxx" && eval $libscheck
4966                 $test -f "$xxx" && libstyle=static
4967             fi
4968             if $test -f "$xxx"; then
4969                 case "$libstyle" in
4970                 shared) echo "Found -l$thislib (shared)." ;;
4971                 static) echo "Found -l$thislib." ;;
4972                 *)      echo "Found -l$thislib ($libstyle)." ;;
4973                 esac
4974                 case " $dflt " in
4975                 *"-l$thislib "*);;
4976                 *) dflt="$dflt -l$thislib"
4977                    libsfound="$libsfound $xxx"
4978                    yyy=`basename $xxx`
4979                    libsfiles="$libsfiles $yyy"
4980                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4981                    case " $libsdirs " in
4982                    *" $yyy "*) ;;
4983                    *) libsdirs="$libsdirs $yyy" ;;
4984                    esac
4985                    ;;
4986                 esac
4987                 break
4988             fi
4989         done
4990         if $test ! -f "$xxx"; then
4991             echo "No -l$thislib."
4992         fi
4993 done
4994 set X $dflt
4995 shift
4996 dflt="$*"
4997 case "$libs" in
4998 '') dflt="$dflt";;
4999 *) dflt="$libs";;
5000 esac
5001 case "$dflt" in
5002 ' '|'') dflt='none';;
5003 esac
5004
5005 $cat <<EOM
5006
5007 In order to compile $package on your machine, a number of libraries
5008 are usually needed.  Include any other special libraries here as well.
5009 Say "none" for none.  The default list is almost always right.
5010 EOM
5011
5012 echo " "
5013 rp="What libraries to use?"
5014 . ./myread
5015 case "$ans" in
5016 none) libs=' ';;
5017 *) libs="$ans";;
5018 esac
5019
5020 : determine optimization, if desired, or use for debug flag also
5021 case "$optimize" in
5022 ' '|$undef) dflt='none';;
5023 '') dflt='-O';;
5024 *) dflt="$optimize";;
5025 esac
5026 $cat <<EOH
5027
5028 By default, $package compiles with the -O flag to use the optimizer.
5029 Alternately, you might want to use the symbolic debugger, which uses
5030 the -g flag (on traditional Unix systems).  Either flag can be
5031 specified here.  To use neither flag, specify the word "none".
5032
5033 EOH
5034 rp="What optimizer/debugger flag should be used?"
5035 . ./myread
5036 optimize="$ans"
5037 case "$optimize" in
5038 'none') optimize=" ";;
5039 esac
5040
5041 : Check what DEBUGGING is required from the command line
5042 : -DEBUGGING      or -DDEBUGGING or
5043 : -DEBUGGING=both                       = -g + -DDEBUGGING
5044 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5045 : -DEBUGGING=none or -UDEBUGGING        =
5046 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5047 case "$EBUGGING" in
5048 '')     ;;
5049 *)      DEBUGGING=$EBUGGING ;;
5050 esac
5051
5052 case "$DEBUGGING" in
5053 -g|both|$define)
5054     case "$optimize" in
5055         *-g*) ;;
5056         *)    optimize="$optimize -g" ;;
5057     esac ;;
5058 none|$undef)
5059     case "$optimize" in
5060         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5061                 shift
5062                 optimize="$*"
5063                 ;;
5064     esac ;;
5065 esac
5066
5067 dflt=''
5068 case "$DEBUGGING" in
5069 both|$define) dflt='-DDEBUGGING'
5070 esac
5071
5072 : argument order is deliberate, as the flag will start with - which set could
5073 : think is an option
5074 checkccflag='check=$1; flag=$2; callback=$3;
5075 echo " ";
5076 echo "Checking if your compiler accepts $flag" 2>&1;
5077 echo "int main(void) { return 0; }" > gcctest.c;
5078 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5079     echo "Yes, it does." 2>&1;
5080     if $test -s gcctest.out ; then
5081         echo "But your platform does not like it:";
5082         cat gcctest.out;
5083     else
5084         case "$ccflags" in
5085         *$check*)
5086             echo "Leaving current flags $ccflags alone." 2>&1
5087             ;;
5088         *) dflt="$dflt $flag";
5089             eval $callback
5090             ;;
5091         esac
5092     fi
5093 else
5094     echo "Nope, it does not, but that is ok." 2>&1;
5095 fi
5096 '
5097
5098 : We will not override a previous value, but we might want to
5099 : augment a hint file
5100 case "$hint" in
5101 default|recommended)
5102         case "$gccversion" in
5103         1*) dflt="$dflt -fpcc-struct-return" ;;
5104         esac
5105         case "$optimize:$DEBUGGING" in
5106         *-g*:old) dflt="$dflt -DDEBUGGING";;
5107         esac
5108         case "$gccversion" in
5109         2*) if $test -d /etc/conf/kconfig.d &&
5110                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5111                 then
5112                         # Interactive Systems (ISC) POSIX mode.
5113                         dflt="$dflt -posix"
5114                 fi
5115                 ;;
5116         esac
5117         case "$gccversion" in
5118         1*) ;;
5119         2.[0-8]*) ;;
5120         ?*)     set strict-aliasing -fno-strict-aliasing
5121                 eval $checkccflag
5122                 ;;
5123         esac
5124         # For gcc, adding -pipe speeds up compilations for some, but apparently
5125         # some assemblers can't read from stdin.  (It also slows down compilations
5126         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5127         case "$gccversion" in
5128         ?*)     set pipe -pipe
5129                 eval $checkccflag
5130                 ;;
5131         esac
5132
5133         # on x86_64 (at least) we require an extra library (libssp) in the
5134         # link command line. This library is not named, so I infer that it is
5135         # an implementation detail that may change. Hence the safest approach
5136         # is to add the flag to the flags passed to the compiler at link time,
5137         # as that way the compiler can do the right implementation dependant
5138         # thing. (NWC)
5139         case "$gccversion" in
5140         ?*)     set stack-protector -fstack-protector
5141                 eval $checkccflag
5142                 ;;
5143         esac
5144         ;;
5145 esac
5146
5147 case "$mips_type" in
5148 *BSD*|'') inclwanted="$locincpth $usrinc";;
5149 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5150 esac
5151 for thisincl in $inclwanted; do
5152         if $test -d $thisincl; then
5153                 if $test x$thisincl != x$usrinc; then
5154                         case "$dflt" in
5155                         *" -I$thisincl "*);;
5156                         *) dflt="$dflt -I$thisincl ";;
5157                         esac
5158                 fi
5159         fi
5160 done
5161
5162 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5163         xxx=true;
5164 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5165         xxx=true;
5166 else
5167         xxx=false;
5168 fi;
5169 if $xxx; then
5170         case "$dflt" in
5171         *$2*);;
5172         *) dflt="$dflt -D$2";;
5173         esac;
5174 fi'
5175
5176 set signal.h LANGUAGE_C; eval $inctest
5177
5178 case "$usesocks" in
5179 $define)
5180         ccflags="$ccflags -DSOCKS"
5181         ;;
5182 esac
5183
5184 case "$hint" in
5185 default|recommended) dflt="$ccflags $dflt" ;;
5186 *) dflt="$ccflags";;
5187 esac
5188
5189 case "$dflt" in
5190 ''|' ') dflt=none;;
5191 esac
5192
5193 $cat <<EOH
5194
5195 Your C compiler may want other flags.  For this question you should include
5196 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5197 but you should NOT include libraries or ld flags like -lwhatever.  If you
5198 want $package to honor its debug switch, you should include -DDEBUGGING here.
5199 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5200
5201 To use no flags, specify the word "none".
5202
5203 EOH
5204 set X $dflt
5205 shift
5206 dflt=${1+"$@"}
5207 rp="Any additional cc flags?"
5208 . ./myread
5209 case "$ans" in
5210 none) ccflags='';;
5211 *) ccflags="$ans";;
5212 esac
5213
5214 : the following weeds options from ccflags that are of no interest to cpp
5215 case "$cppflags" in
5216 '') cppflags="$ccflags" ;;
5217 *)  cppflags="$cppflags $ccflags" ;;
5218 esac
5219 case "$gccversion" in
5220 1*) cppflags="$cppflags -D__GNUC__"
5221 esac
5222 case "$mips_type" in
5223 '');;
5224 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5225 esac
5226 case "$cppflags" in
5227 '');;
5228 *)
5229         echo " "
5230         echo "Let me guess what the preprocessor flags are..." >&4
5231         set X $cppflags
5232         shift
5233         cppflags=''
5234         $cat >cpp.c <<'EOM'
5235 #define BLURFL foo
5236
5237 BLURFL xx LFRULB
5238 EOM
5239         previous=''
5240         for flag in $*
5241         do
5242                 case "$flag" in
5243                 -*) ftry="$flag";;
5244                 *) ftry="$previous $flag";;
5245                 esac
5246                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5247                         >cpp1.out 2>/dev/null && \
5248                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5249                         >cpp2.out 2>/dev/null && \
5250                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5251                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5252                 then
5253                         cppflags="$cppflags $ftry"
5254                         previous=''
5255                 else
5256                         previous="$flag"
5257                 fi
5258         done
5259         set X $cppflags
5260         shift
5261         cppflags=${1+"$@"}
5262         case "$cppflags" in
5263         *-*)  echo "They appear to be: $cppflags";;
5264         esac
5265         $rm -f cpp.c cpp?.out
5266         ;;
5267 esac
5268
5269 : flags used in final linking phase
5270 case "$ldflags" in
5271 '') if ./venix; then
5272                 dflt='-i -z'
5273         else
5274                 dflt=''
5275         fi
5276         case "$ccflags" in
5277         *-posix*) dflt="$dflt -posix" ;;
5278         esac
5279         ;;
5280 *) dflt="$ldflags";;
5281 esac
5282 # See note above about -fstack-protector
5283 case "$ccflags" in
5284 *-fstack-protector*) 
5285         case "$dflt" in
5286         *-fstack-protector*) ;; # Don't add it again
5287         *) dflt="$dflt -fstack-protector" ;; 
5288         esac
5289         ;;
5290 esac
5291
5292 : Try to guess additional flags to pick up local libraries.
5293 for thislibdir in $libpth; do
5294         case " $loclibpth " in
5295         *" $thislibdir "*)
5296                 case "$dflt " in
5297                 *"-L$thislibdir "*) ;;
5298                 *)  dflt="$dflt -L$thislibdir" ;;
5299                 esac
5300                 ;;
5301         esac
5302 done
5303
5304 case "$dflt" in
5305 '') dflt='none' ;;
5306 esac
5307
5308 $cat <<EOH
5309
5310 Your C linker may need flags.  For this question you should
5311 include -L/whatever and any other flags used by the C linker, but you
5312 should NOT include libraries like -lwhatever.
5313
5314 Make sure you include the appropriate -L/path flags if your C linker
5315 does not normally search all of the directories you specified above,
5316 namely
5317         $libpth
5318 To use no flags, specify the word "none".
5319
5320 EOH
5321
5322 rp="Any additional ld flags (NOT including libraries)?"
5323 . ./myread
5324 case "$ans" in
5325 none) ldflags='';;
5326 *) ldflags="$ans";;
5327 esac
5328 rmlist="$rmlist pdp11"
5329
5330 : coherency check
5331 echo " "
5332 echo "Checking your choice of C compiler and flags for coherency..." >&4
5333 $cat > try.c <<'EOF'
5334 #include <stdio.h>
5335 int main() { printf("Ok\n"); return(0); }
5336 EOF
5337 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5338 shift
5339 $cat >try.msg <<'EOM'
5340 I've tried to compile and run the following simple program:
5341
5342 EOM
5343 $cat try.c >> try.msg
5344
5345 $cat >> try.msg <<EOM
5346
5347 I used the command:
5348
5349         $*
5350         $run ./try
5351
5352 and I got the following output:
5353
5354 EOM
5355 dflt=y
5356 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5357         if $sh -c "$run ./try " >>try.msg 2>&1; then
5358                 xxx=`$run ./try`
5359                 case "$xxx" in
5360                 "Ok") dflt=n ;;
5361                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5362                         case " $libs " in
5363                         *" -lsfio "*)
5364                                 cat >> try.msg <<'EOQS'
5365 If $libs contains -lsfio, and sfio is mis-configured, then it
5366 sometimes (apparently) runs and exits with a 0 status, but with no
5367 output!  It may have to do with sfio's use of _exit vs. exit.
5368
5369 EOQS
5370                                 rp="You have a big problem.  Shall I abort Configure"
5371                                 dflt=y
5372                                 ;;
5373                         esac
5374                         ;;
5375                 esac
5376         else
5377                 echo "The program compiled OK, but exited with status $?." >>try.msg
5378                 rp="You have a problem.  Shall I abort Configure"
5379                 dflt=y
5380         fi
5381 else
5382         echo "I can't compile the test program." >>try.msg
5383         rp="You have a BIG problem.  Shall I abort Configure"
5384         dflt=y
5385 fi
5386 case "$dflt" in
5387 y)
5388         $cat try.msg >&4
5389         case "$knowitall" in
5390         '')
5391                 echo "(The supplied flags or libraries might be incorrect.)"
5392                 ;;
5393         *) dflt=n;;
5394         esac
5395         echo " "
5396         . ./myread
5397         case "$ans" in
5398         n*|N*) ;;
5399         *)      echo "Ok.  Stopping Configure." >&4
5400                 exit 1
5401                 ;;
5402         esac
5403         ;;
5404 n) echo "OK, that should do.";;
5405 esac
5406 $rm_try gcctest gcctest.out
5407
5408 : define a shorthand compile call
5409 compile='
5410 mc_file=$1;
5411 shift;
5412 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5413 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5414 exit 1;
5415 fi;
5416 esac;
5417 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5418 : define a shorthand compile call for compilations that should be ok.
5419 compile_ok='
5420 mc_file=$1;
5421 shift;
5422 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5423
5424 : determine filename position in cpp output
5425 echo " "
5426 echo "Computing filename position in cpp output for #include directives..." >&4
5427 case "$osname" in
5428 vos) testaccess=-e ;;
5429 *)   testaccess=-r ;;
5430 esac
5431 echo '#include <stdio.h>' > foo.c
5432 $cat >fieldn <<EOF
5433 $startsh
5434 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5435 $grep '^[       ]*#.*stdio\.h' | \
5436 while read cline; do
5437         pos=1
5438         set \$cline
5439         while $test \$# -gt 0; do
5440                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5441                         echo "\$pos"
5442                         exit 0
5443                 fi
5444                 shift
5445                 pos=\`expr \$pos + 1\`
5446         done
5447 done
5448 EOF
5449 chmod +x fieldn
5450 fieldn=`./fieldn`
5451 $rm -f foo.c fieldn
5452 case $fieldn in
5453 '') pos='???';;
5454 1) pos=first;;
5455 2) pos=second;;
5456 3) pos=third;;
5457 *) pos="${fieldn}th";;
5458 esac
5459 echo "Your cpp writes the filename in the $pos field of the line."
5460
5461 case "$osname" in
5462 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5463 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5464 *)   cppfilter='' ;;
5465 esac
5466 : locate header file
5467 $cat >findhdr <<EOF
5468 $startsh
5469 wanted=\$1
5470 name=''
5471 for usrincdir in $usrinc
5472 do
5473         if test -f \$usrincdir/\$wanted; then
5474                 echo "\$usrincdir/\$wanted"
5475                 exit 0
5476         fi
5477 done
5478 awkprg='{ print \$$fieldn }'
5479 echo "#include <\$wanted>" > foo\$\$.c
5480 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5481 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5482 while read cline; do
5483         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5484         case "\$name" in
5485         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5486         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5487         *) exit 2;;
5488         esac;
5489 done;
5490 #
5491 # status = 0: grep returned 0 lines, case statement not executed
5492 # status = 1: headerfile found
5493 # status = 2: while loop executed, no headerfile found
5494 #
5495 status=\$?
5496 $rm -f foo\$\$.c;
5497 if test \$status -eq 1; then
5498         exit 0;
5499 fi
5500 exit 1
5501 EOF
5502 chmod +x findhdr
5503
5504 : define an alternate in-header-list? function
5505 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5506 cont=true; xxf="echo \"<\$1> found.\" >&4";
5507 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5508 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5509 esac;
5510 case $# in 4) instead=instead;; *) instead="at last";; esac;
5511 while $test "$cont"; do
5512         xxx=`./findhdr $1`
5513         var=$2; eval "was=\$$2";
5514         if $test "$xxx" && $test -r "$xxx";
5515         then eval $xxf;
5516         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5517                 cont="";
5518         else eval $xxnf;
5519         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5520         set $yyy; shift; shift; yyy=$@;
5521         case $# in 0) cont="";;
5522         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5523                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5524         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5525                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5526         esac;
5527 done;
5528 while $test "$yyy";
5529 do set $yyy; var=$2; eval "was=\$$2";
5530         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5531         set $yyy; shift; shift; yyy=$@;
5532 done'
5533
5534 : see if stdlib is available
5535 set stdlib.h i_stdlib
5536 eval $inhdr
5537
5538 : check for lengths of integral types
5539 echo " "
5540 case "$intsize" in
5541 '')
5542         echo "Checking to see how big your integers are..." >&4
5543         $cat >try.c <<EOCP
5544 #include <stdio.h>
5545 #$i_stdlib I_STDLIB
5546 #ifdef I_STDLIB
5547 #include <stdlib.h>
5548 #endif
5549 int main()
5550 {
5551         printf("intsize=%d;\n", (int)sizeof(int));
5552         printf("longsize=%d;\n", (int)sizeof(long));
5553         printf("shortsize=%d;\n", (int)sizeof(short));
5554         exit(0);
5555 }
5556 EOCP
5557         set try
5558         if eval $compile_ok && $run ./try > /dev/null; then
5559                 eval `$run ./try`
5560                 echo "Your integers are $intsize bytes long."
5561                 echo "Your long integers are $longsize bytes long."
5562                 echo "Your short integers are $shortsize bytes long."
5563         else
5564                 $cat >&4 <<EOM
5565 !
5566 Help! I can't compile and run the intsize test program: please enlighten me!
5567 (This is probably a misconfiguration in your system or libraries, and
5568 you really ought to fix it.  Still, I'll try anyway.)
5569 !
5570 EOM
5571                 dflt=4
5572                 rp="What is the size of an integer (in bytes)?"
5573                 . ./myread
5574                 intsize="$ans"
5575                 dflt=$intsize
5576                 rp="What is the size of a long integer (in bytes)?"
5577                 . ./myread
5578                 longsize="$ans"
5579                 dflt=2
5580                 rp="What is the size of a short integer (in bytes)?"
5581                 . ./myread
5582                 shortsize="$ans"
5583         fi
5584         ;;
5585 esac
5586 $rm_try
5587
5588 : check for long long
5589 echo " "
5590 echo "Checking to see if you have long long..." >&4
5591 echo 'int main() { long long x = 7; return 0; }' > try.c
5592 set try
5593 if eval $compile; then
5594         val="$define"
5595         echo "You have long long."
5596 else
5597         val="$undef"
5598         echo "You do not have long long."
5599 fi
5600 $rm_try
5601 set d_longlong
5602 eval $setvar
5603
5604 : check for length of long long
5605 case "${d_longlong}${longlongsize}" in
5606 $define)
5607         echo " "
5608         echo "Checking to see how big your long longs are..." >&4
5609         $cat >try.c <<'EOCP'
5610 #include <stdio.h>
5611 int main()
5612 {
5613     printf("%d\n", (int)sizeof(long long));
5614     return(0);
5615 }
5616 EOCP
5617         set try
5618         if eval $compile_ok; then
5619                 longlongsize=`$run ./try`
5620                 echo "Your long longs are $longlongsize bytes long."
5621         else
5622                 dflt='8'
5623                 echo " "
5624                 echo "(I can't seem to compile the test program.  Guessing...)"
5625                 rp="What is the size of a long long (in bytes)?"
5626                 . ./myread
5627                 longlongsize="$ans"
5628         fi
5629         if $test "X$longsize" = "X$longlongsize"; then
5630                 echo "(That isn't any different from an ordinary long.)"
5631         fi
5632         ;;
5633 esac
5634 $rm_try
5635
5636 : see if inttypes.h is available
5637 : we want a real compile instead of Inhdr because some systems
5638 : have an inttypes.h which includes non-existent headers
5639 echo " "
5640 $cat >try.c <<EOCP
5641 #include <inttypes.h>
5642 int main() {
5643         static int32_t foo32 = 0x12345678;
5644 }
5645 EOCP
5646 set try
5647 if eval $compile; then
5648         echo "<inttypes.h> found." >&4
5649         val="$define"
5650 else
5651         echo "<inttypes.h> NOT found." >&4
5652         val="$undef"
5653 fi
5654 $rm_try
5655 set i_inttypes
5656 eval $setvar
5657
5658 : check for int64_t
5659 echo " "
5660 echo "Checking to see if you have int64_t..." >&4
5661 $cat >try.c <<EOCP
5662 #include <sys/types.h>
5663 #$i_inttypes I_INTTYPES
5664 #ifdef I_INTTYPES
5665 #include <inttypes.h>
5666 #endif
5667 int main() { int64_t x = 7; }
5668 EOCP
5669 set try
5670 if eval $compile; then
5671         val="$define"
5672         echo "You have int64_t."
5673 else
5674         val="$undef"
5675         echo "You do not have int64_t."
5676 fi
5677 $rm_try
5678 set d_int64_t
5679 eval $setvar
5680
5681 : Check if 64bit ints have a quad type
5682 echo " "
5683 echo "Checking which 64-bit integer type we could use..." >&4
5684
5685 case "$intsize" in
5686 8) val=int
5687    set quadtype
5688    eval $setvar
5689    val='"unsigned int"'
5690    set uquadtype
5691    eval $setvar
5692    quadkind=1
5693    ;;
5694 *) case "$longsize" in
5695    8) val=long
5696       set quadtype
5697       eval $setvar
5698       val='"unsigned long"'
5699       set uquadtype
5700       eval $setvar
5701       quadkind=2
5702       ;;
5703    *) case "$d_longlong:$longlongsize" in
5704       define:8)
5705         val='"long long"'
5706         set quadtype
5707         eval $setvar
5708         val='"unsigned long long"'
5709         set uquadtype
5710         eval $setvar
5711         quadkind=3
5712         ;;
5713       *) case "$d_int64_t" in
5714          define)
5715            val=int64_t
5716            set quadtype
5717            eval $setvar
5718            val=uint64_t
5719            set uquadtype
5720            eval $setvar
5721            quadkind=4
5722            ;;
5723          esac
5724          ;;
5725       esac
5726       ;;
5727    esac
5728    ;;
5729 esac
5730
5731 case "$quadtype" in
5732 '')     echo "Alas, no 64-bit integer types in sight." >&4
5733         d_quad="$undef"
5734         ;;
5735 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5736         d_quad="$define"
5737         ;;
5738 esac
5739
5740 : Do we want 64bit support
5741 case "$uselonglong" in
5742 "$define"|true|[yY]*)
5743         cat <<EOM >&4
5744
5745 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5746 EOM
5747         use64bitint="$define"
5748         ;;
5749 esac
5750 case "$use64bits" in
5751 "$define"|true|[yY]*)
5752         cat <<EOM >&4
5753
5754 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5755 EOM
5756         use64bitint="$define"
5757         ;;
5758 esac
5759 case "$use64bitints" in
5760 "$define"|true|[yY]*)
5761         cat <<EOM >&4
5762
5763 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5764 EOM
5765         use64bitint="$define"
5766         ;;
5767 esac
5768 case "$use64bitsint" in
5769 "$define"|true|[yY]*)
5770         cat <<EOM >&4
5771
5772 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5773 EOM
5774         use64bitint="$define"
5775         ;;
5776 esac
5777 case "$uselonglongs" in
5778 "$define"|true|[yY]*)
5779         cat <<EOM >&4
5780
5781 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5782 EOM
5783         use64bitint="$define"
5784         ;;
5785 esac
5786 case "$use64bitsall" in
5787 "$define"|true|[yY]*)
5788         cat <<EOM >&4
5789
5790 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5791 EOM
5792         use64bitall="$define"
5793         ;;
5794 esac
5795
5796 case "$ccflags" in
5797 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5798 esac
5799 case "$use64bitall" in
5800 "$define"|true|[yY]*) use64bitint="$define" ;;
5801 esac
5802
5803 case "$longsize" in
5804 8) cat <<EOM
5805
5806 You have natively 64-bit long integers.
5807 EOM
5808    val="$define"
5809    ;;
5810 *) case "$use64bitint" in
5811    "$define"|true|[yY]*) dflt='y';;
5812    *) dflt='n';;
5813    esac
5814    case "$d_quad" in
5815    "$define") ;;
5816    *) dflt='n' ;;
5817    esac
5818    cat <<EOM
5819
5820 Perl can be built to take advantage of 64-bit integer types
5821 on some systems.  To do so, Configure can be run with -Duse64bitint.
5822 Choosing this option will most probably introduce binary incompatibilities.
5823
5824 If this doesn't make any sense to you, just accept the default '$dflt'.
5825 (The default has been chosen based on your configuration.)
5826 EOM
5827    rp='Try to use 64-bit integers, if available?'
5828    . ./myread
5829    case "$ans" in
5830    [yY]*) val="$define" ;;
5831    *)     val="$undef"  ;;
5832    esac
5833    ;;
5834 esac
5835 set use64bitint
5836 eval $setvar
5837
5838 case "$use64bitall" in
5839 "$define"|true|[yY]*) dflt='y' ;;
5840 *) case "$longsize" in
5841    8) dflt='y' ;;
5842    *) dflt='n' ;;
5843    esac
5844    ;;
5845 esac
5846 cat <<EOM
5847
5848 You may also choose to try maximal 64-bitness.  It means using as much
5849 64-bitness as possible on the platform.  This in turn means even more
5850 binary incompatibilities.  On the other hand, your platform may not
5851 have any more 64-bitness available than what you already have chosen.
5852
5853 If this doesn't make any sense to you, just accept the default '$dflt'.
5854 (The default has been chosen based on your configuration.)
5855 EOM
5856 rp='Try to use maximal 64-bit support, if available?'
5857 . ./myread
5858 case "$ans" in
5859 [yY]*) val="$define" ;;
5860 *)     val="$undef"  ;;
5861 esac
5862 set use64bitall
5863 eval $setvar
5864 case "$use64bitall" in
5865 "$define")
5866         case "$use64bitint" in
5867         "$undef")
5868                 cat <<EOM
5869
5870 Since you have chosen a maximally 64-bit build, I'm also turning on
5871 the use of 64-bit integers.
5872 EOM
5873                 use64bitint="$define" ;;
5874         esac
5875         ;;
5876 esac
5877
5878 : Look for a hint-file generated 'call-back-unit'.  If the
5879 : user has specified that a 64-bit perl is to be built,
5880 : we may need to set or change some other defaults.
5881 if $test -f use64bitint.cbu; then
5882         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5883         . ./use64bitint.cbu
5884 fi
5885 case "$use64bitint" in
5886 "$define"|true|[yY]*)
5887         case "$longsize" in
5888         4) case "$archname64" in
5889            '') archname64=64int ;;
5890            esac
5891            ;;
5892         esac
5893         ;;
5894 esac
5895
5896 : Look for a hint-file generated 'call-back-unit'.  If the
5897 : user has specified that a maximally 64-bit perl is to be built,
5898 : we may need to set or change some other defaults.
5899 if $test -f use64bitall.cbu; then
5900         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5901         . ./use64bitall.cbu
5902 fi
5903 case "$use64bitall" in
5904 "$define"|true|[yY]*)
5905         case "$longsize" in
5906         4) case "$archname64" in
5907            ''|64int) archname64=64all ;;
5908            esac
5909            ;;
5910         esac
5911         ;;
5912 esac
5913
5914 case "$d_quad:$use64bitint" in
5915 $undef:$define)
5916         cat >&4 <<EOF
5917
5918 *** You have chosen to use 64-bit integers,
5919 *** but none can be found.
5920 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5921 *** Cannot continue, aborting.
5922
5923 EOF
5924         exit 1
5925         ;;
5926 esac
5927
5928 : check for length of double
5929 echo " "
5930 case "$doublesize" in
5931 '')
5932         echo "Checking to see how big your double precision numbers are..." >&4
5933         $cat >try.c <<EOCP
5934 #include <stdio.h>
5935 #$i_stdlib I_STDLIB
5936 #ifdef I_STDLIB
5937 #include <stdlib.h>
5938 #endif
5939 int main()
5940 {
5941     printf("%d\n", (int)sizeof(double));
5942     exit(0);
5943 }
5944 EOCP
5945         set try
5946         if eval $compile_ok; then
5947                 doublesize=`$run ./try`
5948                 echo "Your double is $doublesize bytes long."
5949         else
5950                 dflt='8'
5951                 echo "(I can't seem to compile the test program.  Guessing...)"
5952                 rp="What is the size of a double precision number (in bytes)?"
5953                 . ./myread
5954                 doublesize="$ans"
5955         fi
5956         ;;
5957 esac
5958 $rm_try
5959
5960 : check for long doubles
5961 echo " "
5962 echo "Checking to see if you have long double..." >&4
5963 echo 'int main() { long double x = 7.0; }' > try.c
5964 set try
5965 if eval $compile; then
5966         val="$define"
5967         echo "You have long double."
5968 else
5969         val="$undef"
5970         echo "You do not have long double."
5971 fi
5972 $rm_try
5973 set d_longdbl
5974 eval $setvar
5975
5976 : check for length of long double
5977 case "${d_longdbl}${longdblsize}" in
5978 $define)
5979         echo " "
5980         echo "Checking to see how big your long doubles are..." >&4
5981         $cat >try.c <<'EOCP'
5982 #include <stdio.h>
5983 int main()
5984 {
5985         printf("%d\n", sizeof(long double));
5986 }
5987 EOCP
5988         set try
5989         set try
5990         if eval $compile; then
5991                 longdblsize=`$run ./try`
5992                 echo "Your long doubles are $longdblsize bytes long."
5993         else
5994                 dflt='8'
5995                 echo " "
5996                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5997                 rp="What is the size of a long double (in bytes)?"
5998                 . ./myread
5999                 longdblsize="$ans"
6000         fi
6001         if $test "X$doublesize" = "X$longdblsize"; then
6002                 echo "That isn't any different from an ordinary double."
6003                 echo "I'll keep your setting anyway, but you may see some"
6004                 echo "harmless compilation warnings."
6005         fi
6006         ;;
6007 esac
6008 $rm_try
6009
6010 : determine the architecture name
6011 echo " "
6012 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6013         tarch=`arch`"-$osname"
6014 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6015         if uname -m > tmparch 2>&1 ; then
6016                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6017                         -e 's/$/'"-$osname/" tmparch`
6018         else
6019                 tarch="$osname"
6020         fi
6021         $rm -f tmparch
6022 else
6023         tarch="$osname"
6024 fi
6025 case "$myarchname" in
6026 ''|"$tarch") ;;
6027 *)
6028         echo "(Your architecture name used to be $myarchname.)"
6029         archname=''
6030         ;;
6031 esac
6032 case "$targetarch" in
6033 '') ;;
6034 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6035 esac
6036 myarchname="$tarch"
6037 case "$archname" in
6038 '') dflt="$tarch";;
6039 *) dflt="$archname";;
6040 esac
6041 rp='What is your architecture name'
6042 . ./myread
6043 archname="$ans"
6044 case "$usethreads" in
6045 $define)
6046         echo "Threads selected." >&4
6047         case "$archname" in
6048         *-thread*) echo "...and architecture name already has -thread." >&4
6049                 ;;
6050         *)      archname="$archname-thread"
6051                 echo "...setting architecture name to $archname." >&4
6052                 ;;
6053         esac
6054         ;;
6055 esac
6056 case "$usemultiplicity" in
6057 $define)
6058         echo "Multiplicity selected." >&4
6059         case "$archname" in
6060         *-multi*) echo "...and architecture name already has -multi." >&4
6061                 ;;
6062         *)      archname="$archname-multi"
6063                 echo "...setting architecture name to $archname." >&4
6064                 ;;
6065         esac
6066         ;;
6067 esac
6068 case "$use64bitint$use64bitall" in
6069 *"$define"*)
6070         case "$archname64" in
6071         '')
6072                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6073                 ;;
6074         *)
6075                 case "$use64bitint" in
6076                 "$define") echo "64 bit integers selected." >&4 ;;
6077                 esac
6078                 case "$use64bitall" in
6079                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6080                 esac
6081                 case "$archname" in
6082                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6083                         ;;
6084                 *)      archname="$archname-$archname64"
6085                         echo "...setting architecture name to $archname." >&4
6086                         ;;
6087                 esac
6088                 ;;
6089         esac
6090 esac
6091 case "$uselongdouble" in
6092 $define)
6093         echo "Long doubles selected." >&4
6094         case "$longdblsize" in
6095         $doublesize)
6096                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6097                 ;;
6098         *)
6099                 case "$archname" in
6100                 *-ld*) echo "...and architecture name already has -ld." >&4
6101                         ;;
6102                 *)      archname="$archname-ld"
6103                         echo "...setting architecture name to $archname." >&4
6104                         ;;
6105                 esac
6106                 ;;
6107         esac
6108         ;;
6109 esac
6110 case "$useperlio" in
6111 $define)
6112         echo "Perlio selected." >&4
6113         ;;
6114 *)
6115         echo "Perlio not selected, using stdio." >&4
6116         case "$archname" in
6117         *-stdio*) echo "...and architecture name already has -stdio." >&4
6118                 ;;
6119         *)      archname="$archname-stdio"
6120                 echo "...setting architecture name to $archname." >&4
6121                 ;;
6122         esac
6123         ;;
6124 esac
6125 if $test -f archname.cbu; then
6126         echo "Your platform has some specific hints for architecture name, using them..."
6127         . ./archname.cbu
6128 fi
6129
6130 : set the prefixit variable, to compute a suitable default value
6131 prefixit='case "$3" in
6132 ""|none)
6133         case "$oldprefix" in
6134         "") eval "$1=\"\$$2\"";;
6135         *)
6136                 case "$3" in
6137                 "") eval "$1=";;
6138                 none)
6139                         eval "tp=\"\$$2\"";
6140                         case "$tp" in
6141                         ""|" ") eval "$1=\"\$$2\"";;
6142                         *) eval "$1=";;
6143                         esac;;
6144                 esac;;
6145         esac;;
6146 *)
6147         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6148         case "$tp" in
6149         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6150         /*-$oldprefix/*|\~*-$oldprefix/*)
6151                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6152         *) eval "$1=\"\$$2\"";;
6153         esac;;
6154 esac'
6155
6156 : determine installation style
6157 : For now, try to deduce it from prefix unless it is already set.
6158 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6159 case "$installstyle" in
6160 '')     case "$prefix" in
6161                 *perl*) dflt='lib';;
6162                 *) dflt='lib/perl5' ;;
6163         esac
6164         ;;
6165 *)      dflt="$installstyle" ;;
6166 esac
6167 : Probably not worth prompting for this since we prompt for all
6168 : the directories individually, and the prompt would be too long and
6169 : confusing anyway.
6170 installstyle=$dflt
6171
6172 : determine where public executables go
6173 echo " "
6174 set dflt bin bin
6175 eval $prefixit
6176 fn=d~
6177 rp='Pathname where the public executables will reside?'
6178 . ./getfile
6179 if $test "X$ansexp" != "X$binexp"; then
6180         installbin=''
6181 fi
6182 prefixvar=bin
6183 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6184 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6185 :     this via initialinstalllocation
6186 . ./setprefixvar
6187
6188 case "$userelocatableinc" in
6189 $define|true|[yY]*)     dflt='y' ;;
6190 *)                      dflt='n' ;;
6191 esac
6192 cat <<EOM
6193
6194 Would you like to build Perl so that the installation is relocatable, so that
6195 library paths in @INC are determined relative to the path of the perl binary?
6196 This is not advised for system Perl installs, or if you need to run setid
6197 scripts or scripts under taint mode.
6198
6199 If this doesn't make any sense to you, just accept the default '$dflt'.
6200 EOM
6201 rp='Use relocatable @INC?'
6202 . ./myread
6203 case "$ans" in
6204 y|Y)    val="$define" ;;
6205 *)      val="$undef"  ;;
6206 esac
6207 set userelocatableinc
6208 eval $setvar
6209
6210 initialinstalllocation="$binexp"
6211 : Default prefix is now "up one level from where the binaries are"
6212 case "$userelocatableinc" in
6213 $define|true|[yY]*)
6214     bin=".../"
6215     binexp=".../"
6216     prefix=".../.."
6217     prefixexp=".../.."
6218     installprefixexp=".../.."
6219     ;;
6220 esac
6221
6222 : determine where private library files go
6223 : Usual default is /usr/local/lib/perl5/$version.
6224 : Also allow things like /opt/perl/lib/$version, since
6225 : /opt/perl/lib/perl5... would be redundant.
6226 : The default "style" setting is made in installstyle.U
6227 case "$installstyle" in
6228 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6229 *)       set dflt privlib lib/$version ;;
6230 esac
6231 eval $prefixit
6232 $cat <<EOM
6233
6234 There are some auxiliary files for $package that need to be put into a
6235 private library directory that is accessible by everyone.
6236
6237 EOM
6238 fn=$binexp
6239 fn=d~+
6240 rp='Pathname where the private library files will reside?'
6241 . ./getfile
6242 prefixvar=privlib
6243 . ./setprefixvar
6244
6245 : set the prefixup variable, to restore leading tilda escape
6246 prefixup='case "$prefixexp" in
6247 "$prefix") ;;
6248 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6249 esac'
6250
6251 : determine where public architecture dependent libraries go
6252 set archlib archlib
6253 eval $prefixit
6254 : privlib default is /usr/local/lib/$package/$version
6255 : archlib default is /usr/local/lib/$package/$version/$archname
6256 : privlib may have an optional trailing /share.
6257 tdflt=`echo $privlib | $sed 's,/share$,,'`
6258 tdflt=$tdflt/$archname
6259 case "$archlib" in
6260 '')     dflt=$tdflt
6261         ;;
6262 *)      dflt="$archlib"
6263     ;;
6264 esac
6265 $cat <<EOM
6266
6267 $spackage contains architecture-dependent library files.  If you are
6268 sharing libraries in a heterogeneous environment, you might store
6269 these files in a separate location.  Otherwise, you can just include
6270 them with the rest of the public library files.
6271
6272 EOM
6273 fn=$binexp
6274 fn=d+~
6275 rp='Where do you want to put the public architecture-dependent libraries?'
6276 . ./getfile
6277 prefixvar=archlib
6278 . ./setprefixvar
6279 if $test X"$archlib" = X"$privlib"; then
6280         d_archlib="$undef"
6281 else
6282         d_archlib="$define"
6283 fi
6284
6285 : see if setuid scripts can be secure
6286 $cat <<EOM
6287
6288 Some kernels have a bug that prevents setuid #! scripts from being
6289 secure.  Some sites have disabled setuid #! scripts because of this.
6290
6291 First let's decide if your kernel supports secure setuid #! scripts.
6292 (If setuid #! scripts would be secure but have been disabled anyway,
6293 don't say that they are secure if asked.)
6294
6295 EOM
6296
6297 val="$undef"
6298 if $test -d /dev/fd; then
6299         echo "#!$ls" >reflect
6300         chmod +x,u+s reflect
6301         ./reflect >flect 2>&1
6302         if $contains "/dev/fd" flect >/dev/null; then
6303                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6304                 val="$define"
6305         else
6306                 $cat <<EOM
6307 If you are not sure if they are secure, I can check but I'll need a
6308 username and password different from the one you are using right now.
6309 If you don't have such a username or don't want me to test, simply
6310 enter 'none'.
6311
6312 EOM
6313                 rp='Other username to test security of setuid scripts with?'
6314                 dflt='none'
6315                 . ./myread
6316                 case "$ans" in
6317                 n|none)
6318                         case "$d_suidsafe" in
6319                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6320                                 dflt=n;;
6321                         "$undef")
6322                                 echo "Well, the $hint value is *not* secure." >&4
6323                                 dflt=n;;
6324                         *)      echo "Well, the $hint value *is* secure." >&4
6325                                 dflt=y;;
6326                         esac
6327                         ;;
6328                 *)
6329                         $rm -f reflect flect
6330                         echo "#!$ls" >reflect
6331                         chmod +x,u+s reflect
6332                         echo >flect
6333                         chmod a+w flect
6334                         echo '"su" will (probably) prompt you for '"$ans's password."
6335                         su $ans -c './reflect >flect'
6336                         if $contains "/dev/fd" flect >/dev/null; then
6337                                 echo "Okay, it looks like setuid scripts are secure." >&4
6338                                 dflt=y
6339                         else
6340                                 echo "I don't think setuid scripts are secure." >&4
6341                                 dflt=n
6342                         fi
6343                         ;;
6344                 esac
6345                 rp='Does your kernel have *secure* setuid scripts?'
6346                 . ./myread
6347                 case "$ans" in
6348                 [yY]*)  val="$define";;
6349                 *)      val="$undef";;
6350                 esac
6351         fi
6352 else
6353         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6354         echo "(That's for file descriptors, not floppy disks.)"
6355         val="$undef"
6356 fi
6357 set d_suidsafe
6358 eval $setvar
6359
6360 $rm -f reflect flect
6361
6362 : now see if they want to do setuid emulation
6363 echo " "
6364 val="$undef"
6365 case "$d_suidsafe" in
6366 "$define")
6367         val="$undef"
6368         echo "No need to emulate SUID scripts since they are secure here." >&4
6369         ;;
6370 *)
6371         $cat <<EOM
6372 Some systems have disabled setuid scripts, especially systems where
6373 setuid scripts cannot be secure.  On systems where setuid scripts have
6374 been disabled, the setuid/setgid bits on scripts are currently
6375 useless.  It is possible for $package to detect those bits and emulate
6376 setuid/setgid in a secure fashion.  This emulation will only work if
6377 setuid scripts have been disabled in your kernel.
6378
6379 EOM
6380         case "$d_dosuid" in
6381         "$define") dflt=y ;;
6382         *) dflt=n ;;
6383         esac
6384         rp="Do you want to do setuid/setgid emulation?"
6385         . ./myread
6386         case "$ans" in
6387         [yY]*)  val="$define";;
6388         *)      val="$undef";;
6389         esac
6390         ;;
6391 esac
6392 set d_dosuid
6393 eval $setvar
6394
6395 : Find perl5.005 or later.
6396 echo "Looking for a previously installed perl5.005 or later... "
6397 case "$perl5" in
6398 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6399                 : Check if this perl is recent and can load a simple module
6400                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6401                         perl5=$tdir/perl
6402                         break;
6403                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6404                         perl5=$tdir/perl5
6405                         break;
6406                 fi
6407         done
6408         ;;
6409 *)      perl5="$perl5"
6410         ;;
6411 esac
6412 case "$perl5" in
6413 '')     echo "None found.  That's ok.";;
6414 *)      echo "Using $perl5." ;;
6415 esac
6416
6417 : Set the siteprefix variables
6418 $cat <<EOM
6419
6420 After $package is installed, you may wish to install various
6421 add-on modules and utilities.  Typically, these add-ons will
6422 be installed under $prefix with the rest
6423 of this package.  However, you may wish to install such add-ons
6424 elsewhere under a different prefix.
6425
6426 If you do not wish to put everything under a single prefix, that's
6427 ok.  You will be prompted for the individual locations; this siteprefix
6428 is only used to suggest the defaults.
6429
6430 The default should be fine for most people.
6431
6432 EOM
6433 fn=d~+
6434 rp='Installation prefix to use for add-on modules and utilities?'
6435 : XXX Here might be another good place for an installstyle setting.
6436 case "$siteprefix" in
6437 '') dflt=$prefix ;;
6438 *)  dflt=$siteprefix ;;
6439 esac
6440 . ./getfile
6441 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6442 oldsiteprefix=''
6443 case "$siteprefix" in
6444 '') ;;
6445 *)      case "$ans" in
6446         "$prefix") ;;
6447         *) oldsiteprefix="$prefix";;
6448         esac
6449         ;;
6450 esac
6451 siteprefix="$ans"
6452 siteprefixexp="$ansexp"
6453
6454 : determine where site specific libraries go.
6455 : Usual default is /usr/local/lib/perl5/site_perl/$version
6456 : The default "style" setting is made in installstyle.U
6457 : XXX No longer works with Prefixit stuff.
6458 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6459 case "$sitelib" in
6460 '') case "$installstyle" in
6461         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6462         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6463         esac
6464         ;;
6465 *)      dflt="$sitelib"
6466         ;;
6467 esac
6468 $cat <<EOM
6469
6470 The installation process will create a directory for
6471 site-specific extensions and modules.  Most users find it convenient
6472 to place all site-specific files in this directory rather than in the
6473 main distribution directory.
6474
6475 EOM
6476 fn=d~+
6477 rp='Pathname for the site-specific library files?'
6478 . ./getfile
6479 prefixvar=sitelib
6480 . ./setprefixvar
6481 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6482
6483 : Determine list of previous versions to include in @INC
6484 $cat > getverlist <<EOPL
6485 #!$perl5 -w
6486 use File::Basename;
6487 \$api_versionstring = "$api_versionstring";
6488 \$version = "$version";
6489 \$stem = "$sitelib_stem";
6490 \$archname = "$archname";
6491 EOPL
6492         $cat >> getverlist <<'EOPL'
6493 # The list found is store twice for each entry: the original name, and
6494 # the binary broken down version as pack "sss", so sorting is easy and
6495 # unambiguous. This will work for all versions that have a maximum of
6496 # three digit groups, separate by '.'s or '_'s. Names are extended with
6497 # ".0.0" to ensure at least three elements for the pack.
6498 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6499
6500 # Can't have leading @ because metaconfig interprets it as a command!
6501 ;@inc_version_list=();
6502 # XXX Redo to do opendir/readdir?
6503 if (-d $stem) {
6504     chdir($stem);
6505     ;@candidates = map {
6506         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6507 }
6508 else {
6509     ;@candidates = ();
6510 }
6511
6512 ($pversion, $aversion, $vsn5005) = map {
6513     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6514 foreach $d (@candidates) {
6515     if ($d->[1] lt $pversion) {
6516         if ($d->[1] ge $aversion) {
6517             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6518         }
6519         elsif ($d->[1] ge $vsn5005) {
6520             unshift(@inc_version_list, grep { -d } $d->[0]);
6521         }
6522     }
6523     else {
6524         # Skip newer version.  I.e. don't look in
6525         # 5.7.0 if we're installing 5.6.1.
6526     }
6527 }
6528
6529 if (@inc_version_list) {
6530     print join(' ', @inc_version_list);
6531 }
6532 else {
6533     # Blank space to preserve value for next Configure run.
6534     print " ";
6535 }
6536 EOPL
6537 chmod +x getverlist
6538 case "$inc_version_list" in
6539 '')     if test -x "$perl5$exe_ext"; then
6540                 dflt=`$perl5 getverlist`
6541         else
6542                 dflt='none'
6543         fi
6544         ;;
6545 $undef) dflt='none' ;;
6546 *)  eval dflt=\"$inc_version_list\" ;;
6547 esac
6548 case "$dflt" in
6549 ''|' ') dflt=none ;;
6550 esac
6551 case "$dflt" in
6552 5.005) dflt=none ;;
6553 esac
6554 $cat <<EOM
6555
6556 In order to ease the process of upgrading, this version of perl
6557 can be configured to use modules built and installed with earlier
6558 versions of perl that were installed under $prefix.  Specify here
6559 the list of earlier versions that this version of perl should check.
6560 If Configure detected no earlier versions of perl installed under
6561 $prefix, then the list will be empty.  Answer 'none' to tell perl
6562 to not search earlier versions.
6563
6564 The default should almost always be sensible, so if you're not sure,
6565 just accept the default.
6566 EOM
6567
6568 rp='List of earlier versions to include in @INC?'
6569 . ./myread
6570 case "$ans" in
6571 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6572 *) inc_version_list="$ans" ;;
6573 esac
6574 case "$inc_version_list" in
6575 ''|' ')
6576         inc_version_list_init='0'
6577         d_inc_version_list="$undef"
6578         ;;
6579 *)      inc_version_list_init=`echo $inc_version_list |
6580                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6581         d_inc_version_list="$define"
6582         ;;
6583 esac
6584 $rm -f getverlist
6585
6586 : see if malloc/malloc.h has to be included
6587 set malloc/malloc.h i_mallocmalloc
6588 eval $inhdr
6589
6590 : see if this is a malloc.h system
6591 : we want a real compile instead of Inhdr because some systems have a
6592 : malloc.h that just gives a compile error saying to use stdlib.h instead
6593 echo " "
6594 $cat >try.c <<EOCP
6595 #include <stdlib.h>
6596 #include <malloc.h>
6597 #$i_mallocmalloc I_MALLOCMALLOC
6598 #ifdef I_MALLOCMALLOC
6599 # include <malloc/malloc.h>
6600 #endif
6601
6602 int main () { return 0; }
6603 EOCP
6604 set try
6605 if eval $compile; then
6606     echo "<malloc.h> found." >&4
6607     val="$define"
6608 else
6609     echo "<malloc.h> NOT found." >&4
6610     val="$undef"
6611 fi
6612 $rm_try
6613 set i_malloc
6614 eval $setvar
6615
6616 : check for void type
6617 echo " "
6618 echo "Checking to see how well your C compiler groks the void type..." >&4
6619 case "$voidflags" in
6620 '')
6621         $cat >try.c <<EOCP
6622 #$i_stdlib I_STDLIB
6623 #ifdef I_STDLIB
6624 #include <stdlib.h>
6625 #endif
6626 #if TRY & 1
6627 void sub() {
6628 #else
6629 sub() {
6630 #endif
6631         extern void moo();      /* function returning void */
6632         void (*goo)();          /* ptr to func returning void */
6633 #if TRY & 8
6634         void *hue;              /* generic ptr */
6635 #endif
6636 #if TRY & 2
6637         void (*foo[10])();
6638 #endif
6639
6640 #if TRY & 4
6641         if(goo == moo) {
6642                 exit(0);
6643         }
6644 #endif
6645         exit(0);
6646 }
6647 int main() { sub(); }
6648 EOCP
6649         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6650                 voidflags=$defvoidused
6651         echo "Good.  It appears to support void to the level $package wants.">&4
6652                 if $contains warning .out >/dev/null 2>&1; then
6653                         echo "However, you might get some warnings that look like this:"
6654                         $cat .out
6655                 fi
6656         else
6657 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6658                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6659                         echo "It supports 1..."
6660                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6661                                 echo "It also supports 2..."
6662                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6663                                         voidflags=7
6664                                         echo "And it supports 4 but not 8 definitely."
6665                                 else
6666                                         echo "It doesn't support 4..."
6667                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6668                                                 voidflags=11
6669                                                 echo "But it supports 8."
6670                                         else
6671                                                 voidflags=3
6672                                                 echo "Neither does it support 8."
6673                                         fi
6674                                 fi
6675                         else
6676                                 echo "It does not support 2..."
6677                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6678                                         voidflags=13
6679                                         echo "But it supports 4 and 8."
6680                                 else
6681                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6682                                                 voidflags=5
6683                                                 echo "And it supports 4 but has not heard about 8."
6684                                         else
6685                                                 echo "However it supports 8 but not 4."
6686                                         fi
6687                                 fi
6688                         fi
6689                 else
6690                         echo "There is no support at all for void."
6691                         voidflags=0
6692                 fi
6693         fi
6694 esac
6695 case "$voidflags" in
6696 "$defvoidused") ;;
6697 *)      $cat >&4 <<'EOM'
6698   Support flag bits are:
6699     1: basic void declarations.
6700     2: arrays of pointers to functions returning void.
6701     4: operations between pointers to and addresses of void functions.
6702     8: generic void pointers.
6703 EOM
6704         dflt="$voidflags";
6705         rp="Your void support flags add up to what?"
6706         . ./myread
6707         voidflags="$ans"
6708         ;;
6709 esac
6710 $rm_try
6711
6712 : check for length of pointer
6713 echo " "
6714 case "$ptrsize" in
6715 '')
6716         echo "Checking to see how big your pointers are..." >&4
6717         if test "$voidflags" -gt 7; then
6718                 echo '#define VOID_PTR char *' > try.c
6719         else
6720                 echo '#define VOID_PTR void *' > try.c
6721         fi
6722         $cat >>try.c <<EOCP
6723 #include <stdio.h>
6724 #$i_stdlib I_STDLIB
6725 #ifdef I_STDLIB
6726 #include <stdlib.h>
6727 #endif
6728 int main()
6729 {
6730     printf("%d\n", (int)sizeof(VOID_PTR));
6731     exit(0);
6732 }
6733 EOCP
6734         set try
6735         if eval $compile_ok; then
6736                 ptrsize=`$run ./try`
6737                 echo "Your pointers are $ptrsize bytes long."
6738         else
6739                 dflt='4'
6740                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6741                 rp="What is the size of a pointer (in bytes)?"
6742                 . ./myread
6743                 ptrsize="$ans"
6744         fi
6745         ;;
6746 esac
6747 $rm_try
6748 case "$use64bitall" in
6749 "$define"|true|[yY]*)
6750         case "$ptrsize" in
6751         4)      cat <<EOM >&4
6752
6753 *** You have chosen a maximally 64-bit build,
6754 *** but your pointers are only 4 bytes wide.
6755 *** Please rerun Configure without -Duse64bitall.
6756 EOM
6757                 case "$d_quad" in
6758                 define)
6759                         cat <<EOM >&4
6760 *** Since you have quads, you could possibly try with -Duse64bitint.
6761 EOM
6762                         ;;
6763                 esac
6764                 cat <<EOM >&4
6765 *** Cannot continue, aborting.
6766
6767 EOM
6768
6769                 exit 1
6770                 ;;
6771         esac
6772         ;;
6773 esac
6774
6775
6776 : determine whether to use malloc wrapping
6777 echo " "
6778 case "$usemallocwrap" in
6779 [yY]*|true|$define)     dflt='y' ;;
6780 [nN]*|false|$undef)     dflt='n' ;;
6781 *)      case "$usedevel" in
6782         [yY]*|true|$define)     dflt='y' ;;
6783         *) dflt='n' ;;
6784         esac
6785         ;;
6786 esac
6787 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6788 . ./myread
6789 usemallocwrap="$ans"
6790 case "$ans" in
6791 y*|true)
6792         usemallocwrap="$define" ;;
6793 *)
6794         usemallocwrap="$undef" ;;
6795 esac
6796
6797 : determine which malloc to compile in
6798 echo " "
6799 case "$usemymalloc" in
6800 [yY]*|true|$define)     dflt='y' ;;
6801 [nN]*|false|$undef)     dflt='n' ;;
6802 *)      case "$ptrsize" in
6803         4) dflt='y' ;;
6804         *) dflt='n' ;;
6805         esac
6806         ;;
6807 esac
6808 rp="Do you wish to attempt to use the malloc that comes with $package?"
6809 . ./myread
6810 usemymalloc="$ans"
6811 case "$ans" in
6812 y*|true)
6813         usemymalloc='y'
6814         mallocsrc='malloc.c'
6815         mallocobj="malloc$_o"
6816         d_mymalloc="$define"
6817         case "$libs" in
6818         *-lmalloc*)
6819                 : Remove malloc from list of libraries to use
6820                 echo "Removing unneeded -lmalloc from library list" >&4
6821                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6822                 shift
6823                 libs="$*"
6824                 echo "libs = $libs" >&4
6825                 ;;
6826         esac
6827         ;;
6828 *)
6829         usemymalloc='n'
6830         mallocsrc=''
6831         mallocobj=''
6832         d_mymalloc="$undef"
6833         ;;
6834 esac
6835
6836 : compute the return types of malloc and free
6837 echo " "
6838 $cat >malloc.c <<END
6839 #$i_malloc I_MALLOC
6840 #$i_stdlib I_STDLIB
6841 #include <stdio.h>
6842 #include <sys/types.h>
6843 #ifdef I_MALLOC
6844 #include <malloc.h>
6845 #endif
6846 #ifdef I_STDLIB
6847 #include <stdlib.h>
6848 #endif
6849 #ifdef TRY_MALLOC
6850 void *malloc();
6851 #endif
6852 #ifdef TRY_FREE
6853 void free();
6854 #endif
6855 END
6856 case "$malloctype" in
6857 '')
6858         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6859                 malloctype='void *'
6860         else
6861                 malloctype='char *'
6862         fi
6863         ;;
6864 esac
6865 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6866
6867 case "$freetype" in
6868 '')
6869         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6870                 freetype='void'
6871         else
6872                 freetype='int'
6873         fi
6874         ;;
6875 esac
6876 echo "Your system uses $freetype free(), it would seem." >&4
6877 $rm -f malloc.[co]
6878 : determine where site specific architecture-dependent libraries go.
6879 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6880 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6881 : sitelib may have an optional trailing /share.
6882 case "$sitearch" in
6883 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6884         dflt="$dflt/$archname"
6885         ;;
6886 *)      dflt="$sitearch"
6887         ;;
6888 esac
6889 set sitearch sitearch none
6890 eval $prefixit
6891 $cat <<EOM
6892
6893 The installation process will also create a directory for
6894 architecture-dependent site-specific extensions and modules.
6895
6896 EOM
6897 fn=d~+
6898 rp='Pathname for the site-specific architecture-dependent library files?'
6899 . ./getfile
6900 prefixvar=sitearch
6901 . ./setprefixvar
6902 if $test X"$sitearch" = X"$sitelib"; then
6903         d_sitearch="$undef"
6904 else
6905         d_sitearch="$define"
6906 fi
6907
6908 : Set the vendorprefix variables
6909 $cat <<EOM
6910
6911 The installation process will also create a directory for
6912 vendor-supplied add-ons.  Vendors who supply perl with their system
6913 may find it convenient to place all vendor-supplied files in this
6914 directory rather than in the main distribution directory.  This will
6915 ease upgrades between binary-compatible maintenance versions of perl.
6916
6917 Of course you may also use these directories in whatever way you see
6918 fit.  For example, you might use them to access modules shared over a
6919 company-wide network.
6920
6921 The default answer should be fine for most people.
6922 This causes further questions about vendor add-ons to be skipped
6923 and no vendor-specific directories will be configured for perl.
6924
6925 EOM
6926 rp='Do you want to configure vendor-specific add-on directories?'
6927 case "$usevendorprefix" in
6928 define|true|[yY]*) dflt=y ;;
6929 *)      : User may have set vendorprefix directly on Configure command line.
6930         case "$vendorprefix" in
6931         ''|' ') dflt=n ;;
6932         *)      dflt=y ;;
6933         esac
6934         ;;
6935 esac
6936 . ./myread
6937 case "$ans" in
6938 [yY]*)  fn=d~+
6939         rp='Installation prefix to use for vendor-supplied add-ons?'
6940         case "$vendorprefix" in
6941         '') dflt='' ;;
6942         *)  dflt=$vendorprefix ;;
6943         esac
6944         . ./getfile
6945         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6946         oldvendorprefix=''
6947         case "$vendorprefix" in
6948         '') ;;
6949         *)      case "$ans" in
6950                 "$prefix") ;;
6951                 *) oldvendorprefix="$prefix";;
6952                 esac
6953                 ;;
6954         esac
6955         usevendorprefix="$define"
6956         vendorprefix="$ans"
6957         vendorprefixexp="$ansexp"
6958         ;;
6959 *)      usevendorprefix="$undef"
6960         vendorprefix=''
6961         vendorprefixexp=''
6962         ;;
6963 esac
6964
6965 : Set the vendorlib variables
6966 case "$vendorprefix" in
6967 '')     d_vendorlib="$undef"
6968         vendorlib=''
6969         vendorlibexp=''
6970         ;;
6971 *)      d_vendorlib="$define"
6972         : determine where vendor-supplied modules go.
6973         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6974         case "$vendorlib" in
6975         '')
6976                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6977                 case "$installstyle" in
6978                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6979                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6980                 esac
6981                 ;;
6982         *)      dflt="$vendorlib"
6983                 ;;
6984         esac
6985         fn=d~+
6986         rp='Pathname for the vendor-supplied library files?'
6987         . ./getfile
6988         vendorlib="$ans"
6989         vendorlibexp="$ansexp"
6990         ;;
6991 esac
6992 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6993 prefixvar=vendorlib
6994 . ./installprefix
6995
6996 : Set the vendorarch variables
6997 case "$vendorprefix" in
6998 '')     d_vendorarch="$undef"
6999         vendorarch=''
7000         vendorarchexp=''
7001         ;;
7002 *)      d_vendorarch="$define"
7003         : determine where vendor-supplied architecture-dependent libraries go.
7004         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7005         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7006         : vendorlib may have an optional trailing /share.
7007         case "$vendorarch" in
7008         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7009                 dflt="$dflt/$archname"
7010                 ;;
7011         *)      dflt="$vendorarch" ;;
7012         esac
7013         fn=d~+
7014         rp='Pathname for vendor-supplied architecture-dependent files?'
7015         . ./getfile
7016         vendorarch="$ans"
7017         vendorarchexp="$ansexp"
7018         ;;
7019 esac
7020 prefixvar=vendorarch
7021 . ./installprefix
7022
7023 : Final catch-all directories to search
7024 $cat <<EOM
7025
7026 Lastly, you can have perl look in other directories for extensions and
7027 modules in addition to those already specified.
7028 These directories will be searched after 
7029         $sitearch 
7030         $sitelib 
7031 EOM
7032 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7033 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7034 echo ' '
7035 case "$otherlibdirs" in
7036 ''|' ') dflt='none' ;;
7037 *)      dflt="$otherlibdirs" ;;
7038 esac
7039 $cat <<EOM
7040 Enter a colon-separated set of extra paths to include in perl's @INC
7041 search path, or enter 'none' for no extra paths.
7042
7043 EOM
7044
7045 rp='Colon-separated list of additional directories for perl to search?'
7046 . ./myread
7047 case "$ans" in
7048 ' '|''|none)    otherlibdirs=' ' ;;     
7049 *)      otherlibdirs="$ans" ;;
7050 esac
7051 case "$otherlibdirs" in
7052 ' ') val=$undef ;;
7053 *)      val=$define ;;
7054 esac
7055 set d_perl_otherlibdirs
7056 eval $setvar
7057
7058 : Cruising for prototypes
7059 echo " "
7060 echo "Checking out function prototypes..." >&4
7061 $cat >prototype.c <<EOCP
7062 #$i_stdlib I_STDLIB
7063 #ifdef I_STDLIB
7064 #include <stdlib.h>
7065 #endif
7066 int main(int argc, char *argv[]) {
7067         exit(0);}
7068 EOCP
7069 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7070         echo "Your C compiler appears to support function prototypes."
7071         val="$define"
7072 else
7073         echo "Your C compiler doesn't seem to understand function prototypes."
7074         val="$undef"
7075 fi
7076 set prototype
7077 eval $setvar
7078 $rm -f prototype*
7079
7080 : Check if ansi2knr is required
7081 case "$prototype" in
7082 "$define") ;;
7083 *)      ansi2knr='ansi2knr'
7084         echo " "
7085         cat <<EOM >&4
7086
7087 $me:  FATAL ERROR:
7088 This version of $package can only be compiled by a compiler that 
7089 understands function prototypes.  Unfortunately, your C compiler 
7090         $cc $ccflags
7091 doesn't seem to understand them.  Sorry about that.
7092
7093 If GNU cc is available for your system, perhaps you could try that instead.  
7094
7095 Eventually, we hope to support building Perl with pre-ANSI compilers.
7096 If you would like to help in that effort, please contact <perlbug@perl.org>.
7097
7098 Aborting Configure now.
7099 EOM
7100         exit 2
7101         ;;
7102 esac
7103
7104 : DTrace support
7105 dflt_dtrace='/usr/sbin/dtrace'
7106 cat <<EOM
7107
7108 Perl can be built to support DTrace on platforms that support it.
7109 DTrace is a diagnosis and performance analysis tool from Sun.
7110
7111 If this doesn't make any sense to you, just accept the default '$dflt'.
7112 EOM
7113
7114 while $test 1 ; do
7115         case "$usedtrace" in
7116         $define|true|[yY]*)
7117                 dflt='y'
7118                 ;;
7119         ?*)
7120                 dflt='y'
7121                 dflt_dtrace=$usedtrace
7122                 ;;
7123         *)
7124                 dflt='n'
7125                 ;;
7126         esac
7127
7128         rp='Support DTrace if available?'
7129         . ./myread
7130         case "$ans" in
7131         y|Y)    val="$define" ;;
7132         *)      val="$undef" ;;
7133         esac
7134         set usedtrace
7135         eval $setvar
7136
7137         test "X$usedtrace" != "X$define" && break
7138
7139         echo " "
7140         rp='Where is the dtrace executable?'
7141         dflt=$dflt_dtrace
7142         . ./getfile
7143         val="$ans"
7144         set dtrace
7145         eval $setvar
7146
7147         if $test -f $dtrace
7148         then
7149                 if $dtrace -h -s ../perldtrace.d \
7150                         -o perldtrace.tmp >/dev/null 2>&1 \
7151                         && rm -f perldtrace.tmp
7152                 then
7153                         echo " "
7154                         echo "Good: your $dtrace knows about the -h flag."
7155                 else
7156                         cat >&2 <<EOM
7157
7158 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7159 ***
7160 *** Your installed dtrace doesn't support the -h switch to compile a D
7161 *** program into a C header. Can't continue.
7162
7163 EOM
7164                         exit 1
7165                 fi
7166                 break;
7167         fi
7168
7169         case "$fastread" in
7170         yes)
7171                 cat >&2 <<EOM
7172
7173 *** $me:  Fatal Error:  $dtrace not found.
7174 *** Can't continue.
7175
7176 EOM
7177                 exit 1
7178                 ;;
7179         *)
7180                 echo "*** $dtrace was not found."
7181                 echo " "
7182                 ;;
7183         esac
7184 done
7185
7186 : See if we want extra modules installed
7187 echo " "
7188 case "$extras" in
7189 '') dflt='n';;
7190 *) dflt='y';;
7191 esac
7192 cat <<EOM
7193 Perl can be built with extra modules or bundles of modules which
7194 will be fetched from the CPAN and installed alongside Perl.
7195
7196 Notice that you will need access to the CPAN; either via the Internet,
7197 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7198 be asked later to configure the CPAN.pm module which will in turn do
7199 the installation of the rest of the extra modules or bundles.)
7200
7201 Notice also that if the modules require any external software such as
7202 libraries and headers (the libz library and the zlib.h header for the
7203 Compress::Zlib module, for example) you MUST have any such software
7204 already installed, this configuration process will NOT install such
7205 things for you.
7206
7207 If this doesn't make any sense to you, just accept the default '$dflt'.
7208 EOM
7209 rp='Install any extra modules (y or n)?'
7210 . ./myread
7211 case "$ans" in
7212 y|Y)
7213         cat <<EOM
7214
7215 Please list any extra modules or bundles to be installed from CPAN,
7216 with spaces between the names.  The names can be in any format the
7217 'install' command of CPAN.pm will understand.  (Answer 'none',
7218 without the quotes, to install no extra modules or bundles.)
7219 EOM
7220         rp='Extras?'
7221         dflt="$extras"
7222         . ./myread
7223         extras="$ans"
7224 esac
7225 case "$extras" in
7226 ''|'none')
7227         val=''
7228         $rm -f ../extras.lst
7229         ;;
7230 *)      echo "(Saving the list of extras for later...)"
7231         echo "$extras" > ../extras.lst
7232         val="'$extras'"
7233         ;;
7234 esac
7235 set extras
7236 eval $setvar
7237 echo " "
7238
7239 : determine where html pages for programs go
7240 set html1dir html1dir none
7241 eval $prefixit
7242 $cat <<EOM
7243
7244 If you wish to install html files for programs in $spackage, indicate
7245 the appropriate directory here.  To skip installing html files,
7246 answer "none".
7247 EOM
7248 case "$html1dir" in
7249 ''|none|$undef|' ') dflt=none ;;
7250 *) dflt=$html1dir ;;
7251 esac
7252 fn=dn+~
7253 rp="Directory for the main $spackage html pages?"
7254 . ./getfile
7255 prefixvar=html1dir
7256 . ./setprefixvar
7257 : Use ' ' for none so value is preserved next time through Configure
7258 $test X"$html1dir" = "X" && html1dir=' '
7259
7260 : determine where html pages for libraries and modules go
7261 set html3dir html3dir none
7262 eval $prefixit
7263 $cat <<EOM
7264
7265 If you wish to install html files for modules associated with $spackage,
7266 indicate the appropriate directory here.  To skip installing html files,
7267 answer "none".
7268 EOM
7269 : There is no obvious default.  If they have specified html1dir, then
7270 : try to key off that, possibly changing .../html1 into .../html3.
7271 case "$html3dir" in
7272 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7273 *) dflt=$html3dir ;;
7274 esac
7275 fn=dn+~
7276 rp="Directory for the $spackage module html pages?"
7277 . ./getfile
7278 prefixvar=html3dir
7279 . ./setprefixvar
7280 : Use ' ' for none so value is preserved next time through Configure
7281 $test X"$html3dir" = "X" && html3dir=' '
7282
7283 : determine whether to install perl also as /usr/bin/perl
7284
7285 echo " "
7286 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7287         $cat <<EOM
7288 Many scripts expect perl to be installed as /usr/bin/perl.
7289
7290 If you want to, I can install the perl you are about to compile
7291 as /usr/bin/perl (in addition to $bin/perl).
7292 EOM
7293         if test -f /usr/bin/perl; then
7294             $cat <<EOM
7295
7296 However, please note that because you already have a /usr/bin/perl,
7297 overwriting that with a new Perl would very probably cause problems.
7298 Therefore I'm assuming you don't want to do that (unless you insist).
7299
7300 EOM
7301             case "$installusrbinperl" in
7302             "$define"|[yY]*)    dflt='y';;
7303             *)                  dflt='n';;
7304             esac
7305         else
7306             $cat <<EOM
7307
7308 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7309
7310 EOM
7311             case "$installusrbinperl" in
7312             "$undef"|[nN]*)     dflt='n';;
7313             *)                  dflt='y';;
7314             esac
7315         fi
7316         rp="Do you want to install perl as /usr/bin/perl?"
7317         . ./myread
7318         case "$ans" in
7319         [yY]*)  val="$define";;
7320         *)      val="$undef" ;;
7321         esac
7322 else
7323         val="$undef"
7324 fi
7325 set installusrbinperl
7326 eval $setvar
7327
7328 : Check if we are using the GNU C library
7329 echo " "
7330 echo "Checking for GNU C Library..." >&4
7331 cat >try.c <<'EOCP'
7332 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7333    alone are insufficient to distinguish different versions, such as
7334    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7335    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7336 */
7337 #include <stdio.h>
7338 int main(void)
7339 {
7340 #ifdef __GLIBC__
7341 #   ifdef __GLIBC_MINOR__
7342 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7343 #           include <gnu/libc-version.h>
7344             printf("%s\n",  gnu_get_libc_version());
7345 #       else
7346             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7347 #       endif
7348 #   else
7349         printf("%d\n",  __GLIBC__);
7350 #   endif
7351     return 0;
7352 #else
7353     return 1;
7354 #endif
7355 }
7356 EOCP
7357 set try
7358 if eval $compile_ok && $run ./try > glibc.ver; then
7359         val="$define"
7360         gnulibc_version=`$cat glibc.ver`
7361         echo "You are using the GNU C Library version $gnulibc_version"
7362 else
7363         val="$undef"
7364         gnulibc_version=''
7365         echo "You are not using the GNU C Library"
7366 fi
7367 $rm_try glibc.ver
7368 set d_gnulibc
7369 eval $setvar
7370
7371 : see if nm is to be used to determine whether a symbol is defined or not
7372 case "$usenm" in
7373 '')
7374         dflt=''
7375         case "$d_gnulibc" in
7376         "$define")
7377                 echo " "
7378                 echo "nm probably won't work on the GNU C Library." >&4
7379                 dflt=n
7380                 ;;
7381         esac
7382         case "$dflt" in
7383         '') 
7384                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7385                         echo " "
7386                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7387                         echo "'nm' won't be sufficient on this sytem." >&4
7388                         dflt=n
7389                 fi
7390                 ;;
7391         esac
7392         case "$dflt" in
7393         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7394                 if $test $dflt -gt 20; then
7395                         dflt=y
7396                 else
7397                         dflt=n
7398                 fi
7399                 ;;
7400         esac
7401         ;;
7402 *)
7403         case "$usenm" in
7404         true|$define) dflt=y;;
7405         *) dflt=n;;
7406         esac
7407         ;;
7408 esac
7409 $cat <<EOM
7410
7411 I can use $nm to extract the symbols from your C libraries. This
7412 is a time consuming task which may generate huge output on the disk (up
7413 to 3 megabytes) but that should make the symbols extraction faster. The
7414 alternative is to skip the 'nm' extraction part and to compile a small
7415 test program instead to determine whether each symbol is present. If
7416 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7417 this may be the best solution.
7418
7419 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7420
7421 EOM
7422 rp="Shall I use $nm to extract C symbols from the libraries?"
7423 . ./myread
7424 case "$ans" in
7425 [Nn]*) usenm=false;;
7426 *) usenm=true;;
7427 esac
7428
7429 runnm=$usenm
7430 case "$reuseval" in
7431 true) runnm=false;;
7432 esac
7433
7434 : nm options which may be necessary
7435 case "$nm_opt" in
7436 '') if $test -f /mach_boot; then
7437                 nm_opt=''       # Mach
7438         elif $test -d /usr/ccs/lib; then
7439                 nm_opt='-p'     # Solaris (and SunOS?)
7440         elif $test -f /dgux; then
7441                 nm_opt='-p'     # DG-UX
7442         elif $test -f /lib64/rld; then
7443                 nm_opt='-p'     # 64-bit Irix
7444         else
7445                 nm_opt=''
7446         fi;;
7447 esac
7448
7449 : nm options which may be necessary for shared libraries but illegal
7450 : for archive libraries.  Thank you, Linux.
7451 case "$nm_so_opt" in
7452 '')     case "$myuname" in
7453         *linux*|gnu*)
7454                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7455                         nm_so_opt='--dynamic'
7456                 fi
7457                 ;;
7458         esac
7459         ;;
7460 esac
7461
7462 : Figure out where the libc is located
7463 case "$runnm" in
7464 true)
7465 : get list of predefined functions in a handy place
7466 echo " "
7467 case "$libc" in
7468 '') libc=unknown
7469         case "$libs" in
7470         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7471         esac
7472         ;;
7473 esac
7474 case "$libs" in
7475 '') ;;
7476 *)  for thislib in $libs; do
7477         case "$thislib" in
7478         -lc|-lc_s)
7479                 : Handle C library specially below.
7480                 ;;
7481         -l*)
7482                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7483                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7484                         :
7485                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7486                         :
7487                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7488                         :
7489                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7490                         :
7491                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7492                         :
7493                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7494                         :
7495                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7496                         :
7497                 else
7498                         try=''
7499                 fi
7500                 libnames="$libnames $try"
7501                 ;;
7502         *) libnames="$libnames $thislib" ;;
7503         esac
7504         done
7505         ;;
7506 esac
7507 xxx=normal
7508 case "$libc" in
7509 unknown)
7510         set /lib/libc.$so
7511         for xxx in $libpth; do
7512                 $test -r $1 || set $xxx/libc.$so
7513                 : The messy sed command sorts on library version numbers.
7514                 $test -r $1 || \
7515                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7516                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7517                                 h
7518                                 s/[0-9][0-9]*/0000&/g
7519                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7520                                 G
7521                                 s/\n/ /' | \
7522                          $sort | $sed -e 's/^.* //'`
7523                 eval set \$$#
7524         done
7525         $test -r $1 || set /usr/ccs/lib/libc.$so
7526         $test -r $1 || set /lib/libsys_s$_a
7527         ;;
7528 *)
7529         set blurfl
7530         ;;
7531 esac
7532 if $test -r "$1"; then
7533         echo "Your (shared) C library seems to be in $1."
7534         libc="$1"
7535 elif $test -r /lib/libc && $test -r /lib/clib; then
7536         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7537         xxx=apollo
7538         libc='/lib/clib /lib/libc'
7539         if $test -r /lib/syslib; then
7540                 echo "(Your math library is in /lib/syslib.)"
7541                 libc="$libc /lib/syslib"
7542         fi
7543 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7544         echo "Your C library seems to be in $libc, as you said before."
7545 elif $test -r $incpath/usr/lib/libc$_a; then
7546         libc=$incpath/usr/lib/libc$_a;
7547         echo "Your C library seems to be in $libc.  That's fine."
7548 elif $test -r /lib/libc$_a; then
7549         libc=/lib/libc$_a;
7550         echo "Your C library seems to be in $libc.  You're normal."
7551 else
7552         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7553                 :
7554         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7555                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7556         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7557                 :
7558         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7559                 :
7560         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7561                 :
7562         else
7563                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7564         fi
7565         if $test -r "$tans"; then
7566                 echo "Your C library seems to be in $tans, of all places."
7567                 libc=$tans
7568         else
7569                 libc='blurfl'
7570         fi
7571 fi
7572 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7573         dflt="$libc"
7574         cat <<EOM
7575
7576 If the guess above is wrong (which it might be if you're using a strange
7577 compiler, or your machine supports multiple models), you can override it here.
7578
7579 EOM
7580 else
7581         dflt=''
7582         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7583         cat >&4 <<EOM
7584 I can't seem to find your C library.  I've looked in the following places:
7585
7586 EOM
7587         $sed 's/^/      /' libpath
7588         cat <<EOM
7589
7590 None of these seems to contain your C library. I need to get its name...
7591
7592 EOM
7593 fi
7594 fn=f
7595 rp='Where is your C library?'
7596 . ./getfile
7597 libc="$ans"
7598
7599 echo " "
7600 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7601 set X `cat libnames`
7602 shift
7603 xxx=files
7604 case $# in 1) xxx=file; esac
7605 echo "Extracting names from the following $xxx for later perusal:" >&4
7606 echo " "
7607 $sed 's/^/      /' libnames >&4
7608 echo " "
7609 $echo $n "This may take a while...$c" >&4
7610
7611 for file in $*; do
7612         case $file in
7613         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7614         *) $nm $nm_opt $file 2>/dev/null;;
7615         esac
7616 done >libc.tmp
7617
7618 $echo $n ".$c"
7619 $grep fprintf libc.tmp > libc.ptf
7620 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7621 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7622 xxx='[ADTSIW]'
7623 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7624         eval $xscan;\
7625         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7626                 eval $xrun
7627 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7628         eval $xscan;\
7629         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7630                 eval $xrun
7631 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7632         eval $xscan;\
7633         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7634                 eval $xrun
7635 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7636         eval $xscan;\
7637         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7638                 eval $xrun
7639 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7640         eval $xscan;\
7641         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7642                 eval $xrun
7643 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7644         eval $xscan;\
7645         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7646                 eval $xrun
7647 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7648                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7649         eval $xscan;\
7650         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7651                 eval $xrun
7652 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7653         eval $xscan;\
7654         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7655                 eval $xrun
7656 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7657         eval $xscan;\
7658         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7659                 eval $xrun
7660 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7661         eval $xscan;\
7662         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7663                 eval $xrun
7664 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7665         eval $xscan;\
7666         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7667                 eval $xrun
7668 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7669         eval $xscan;\
7670         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7671                 eval $xrun
7672 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7673         eval $xscan;\
7674         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7675                 eval $xrun
7676 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7677         eval $xscan;\
7678         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7679                 eval $xrun
7680 else
7681         $nm -p $* 2>/dev/null >libc.tmp
7682         $grep fprintf libc.tmp > libc.ptf
7683         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7684                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7685         then
7686                 nm_opt='-p'
7687                 eval $xrun
7688         else
7689                 echo " "
7690                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7691                 com=''
7692                 if $ar t $libc > libc.tmp && \
7693                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7694                 then
7695                         for thisname in $libnames $libc; do
7696                                 $ar t $thisname >>libc.tmp
7697                         done
7698                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7699                         echo "Ok." >&4
7700                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7701                         for thisname in $libnames $libc; do
7702                                 $ar tv $thisname >>libc.tmp
7703                                 emximp -o tmp.imp $thisname \
7704                                     2>/dev/null && \
7705                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7706                                     < tmp.imp >>libc.tmp
7707                                 $rm -f tmp.imp
7708                         done
7709                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7710                         echo "Ok." >&4
7711                 else
7712                         echo "$ar didn't seem to work right." >&4
7713                         echo "Maybe this is a Cray...trying bld instead..." >&4
7714                         if  bld t $libc | \
7715                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7716                                 $test -s libc.list
7717                         then
7718                                 for thisname in $libnames; do
7719                                         bld t $libnames | \
7720                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7721                                         $ar t $thisname >>libc.tmp
7722                                 done
7723                                 echo "Ok." >&4
7724                         else
7725                                 echo "That didn't work either.  Giving up." >&4
7726                                 exit 1
7727                         fi
7728                 fi
7729         fi
7730 fi
7731 nm_extract="$com"
7732 case "$PASE" in
7733 define)
7734     echo " "
7735     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7736     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7737     ;;
7738 *)  if $test -f /lib/syscalls.exp; then
7739         echo " "
7740         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7741         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7742                 /lib/syscalls.exp >>libc.list
7743     fi
7744     ;;
7745 esac
7746 ;;
7747 esac
7748 $rm -f libnames libpath
7749
7750 : see if dld is available
7751 set dld.h i_dld
7752 eval $inhdr
7753
7754 : Check if we are using C++
7755 echo " "
7756 echo "Checking for C++..." >&4
7757 $cat >try.c <<'EOCP'
7758 #include <stdio.h>
7759 int main(void)
7760 {
7761 #ifdef __cplusplus
7762     return 0;
7763 #else
7764     return 1;
7765 #endif
7766 }
7767 EOCP
7768 set try
7769 if eval $compile_ok && $run ./try; then
7770         val="$define"
7771         echo "You are using a C++ compiler."
7772 else
7773         val="$undef"
7774         echo "You are not using a C++ compiler."
7775 fi
7776 $rm_try cplusplus$$
7777 set d_cplusplus
7778 eval $setvar
7779
7780 : is a C symbol defined?
7781 csym='tlook=$1;
7782 case "$3" in
7783 -v) tf=libc.tmp; tdc="";;
7784 -a) tf=libc.tmp; tdc="[]";;
7785 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7786 esac;
7787 case "$d_cplusplus" in
7788     $define)    extern_C="extern \"C\"" ;;
7789     *)          extern_C="extern"       ;;
7790 esac;
7791 tx=yes;
7792 case "$reuseval-$4" in
7793 true-) ;;
7794 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7795 esac;
7796 case "$tx" in
7797 yes)
7798         tval=false;
7799         if $test "$runnm" = true; then
7800                 if $contains $tlook $tf >/dev/null 2>&1; then
7801                         tval=true;
7802                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7803                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7804                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7805                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7806                         $rm_try;
7807                 fi;
7808         else
7809                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7810                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7811                 $rm_try;
7812         fi;
7813         ;;
7814 *)
7815         case "$tval" in
7816         $define) tval=true;;
7817         *) tval=false;;
7818         esac;
7819         ;;
7820 esac;
7821 eval "$2=$tval"'
7822
7823 : define an is-in-libc? function
7824 inlibc='echo " "; td=$define; tu=$undef;
7825 sym=$1; var=$2; eval "was=\$$2";
7826 tx=yes;
7827 case "$reuseval$was" in
7828 true) ;;
7829 true*) tx=no;;
7830 esac;
7831 case "$tx" in
7832 yes)
7833         set $sym tres -f;
7834         eval $csym;
7835         case "$tres" in
7836         true)
7837                 echo "$sym() found." >&4;
7838                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7839         *)
7840                 echo "$sym() NOT found." >&4;
7841                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7842         esac;;
7843 *)
7844         case "$was" in
7845         $define) echo "$sym() found." >&4;;
7846         *) echo "$sym() NOT found." >&4;;
7847         esac;;
7848 esac'
7849
7850 : see if dlopen exists
7851 xxx_runnm="$runnm"
7852 xxx_ccflags="$ccflags"
7853 runnm=false
7854 : with g++ one needs -shared to get is-in-libc to work for dlopen
7855 case "$gccversion" in
7856 '')     ;;
7857 *)      case "$d_cplusplus" in
7858         "$define") ccflags="$ccflags -shared" ;;
7859         esac
7860         ;;
7861 esac
7862 set dlopen d_dlopen
7863 eval $inlibc
7864 runnm="$xxx_runnm"
7865 ccflags="$xxx_ccflags"
7866
7867 : see if this is a unistd.h system
7868 set unistd.h i_unistd
7869 eval $inhdr
7870
7871 : determine which dynamic loading, if any, to compile in
7872 echo " "
7873 dldir="ext/DynaLoader"
7874 case "$usedl" in
7875 $define|y|true)
7876         dflt='y'
7877         usedl="$define"
7878         ;;
7879 $undef|n|false)
7880         dflt='n'
7881         usedl="$undef"
7882         ;;
7883 *)
7884         dflt='n'
7885         case "$d_dlopen" in
7886             $define) dflt='y' ;;
7887         esac
7888         case "$i_dld" in
7889             $define) dflt='y' ;;
7890         esac
7891         : Does a dl_xxx.xs file exist for this operating system
7892         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7893         ;;
7894 esac
7895 rp="Do you wish to use dynamic loading?"
7896 . ./myread
7897 usedl="$ans"
7898 case "$ans" in
7899 y*) usedl="$define"
7900         case "$dlsrc" in
7901         '')
7902                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7903                         dflt="$dldir/dl_${osname}.xs"
7904                 elif $test "$d_dlopen" = "$define" ; then
7905                         dflt="$dldir/dl_dlopen.xs"
7906                 elif $test "$i_dld" = "$define" ; then
7907                         dflt="$dldir/dl_dld.xs"
7908                 else
7909                         dflt=''
7910                 fi
7911                 ;;
7912         *)      dflt="$dldir/$dlsrc"
7913                 ;;
7914         esac
7915     echo "The following dynamic loading files are available:"
7916         : Can not go over to $dldir because getfile has path hard-coded in.
7917         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7918         rp="Source file to use for dynamic loading"
7919         fn="fne"
7920         gfpth="$src"
7921         . ./getfile
7922         usedl="$define"
7923         : emulate basename
7924         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7925
7926         $cat << EOM
7927
7928 Some systems may require passing special flags to $cc -c to
7929 compile modules that will be used to create a shared library.
7930 To use no flags, say "none".
7931
7932 EOM
7933     case "$cccdlflags" in
7934     '') case "$gccversion" in
7935                 '') case "$osname" in
7936                         hpux)   dflt='+z' ;;
7937                         next)   dflt='none' ;;
7938                         irix*)  dflt='-KPIC' ;;
7939                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7940                         sunos)  dflt='-pic' ;;
7941                         *)      dflt='none' ;;
7942                     esac
7943                         ;;
7944                 *)  case "$osname" in
7945                         darwin) dflt='none' ;;
7946                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7947                         *)      dflt='-fpic' ;;
7948                     esac ;;
7949             esac ;;
7950         ' ') dflt='none' ;;
7951     *)  dflt="$cccdlflags" ;;
7952     esac
7953     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7954     . ./myread
7955     case "$ans" in
7956     none) cccdlflags=' ' ;;
7957     *) cccdlflags="$ans" ;;
7958     esac
7959
7960     cat << EOM
7961
7962 Some systems use ld to create libraries that can be dynamically loaded,
7963 while other systems (such as those using ELF) use $cc.
7964
7965 EOM
7966         case "$ld" in
7967         '')     $cat >try.c <<EOM
7968 /* Test for whether ELF binaries are produced */
7969 #include <fcntl.h>
7970 #$i_stdlib I_STDLIB
7971 #ifdef I_STDLIB
7972 #include <stdlib.h>
7973 #endif
7974 #$i_unistd I_UNISTD
7975 #ifdef I_UNISTD
7976 #include <unistd.h>
7977 #endif
7978 int main() {
7979         char b[4];
7980         int i = open("a.out",O_RDONLY);
7981         if(i == -1)
7982                 exit(1); /* fail */
7983         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7984                 exit(0); /* succeed (yes, it's ELF) */
7985         else
7986                 exit(1); /* fail */
7987 }
7988 EOM
7989                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7990                         cat <<EOM
7991 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7992 EOM
7993                         dflt="$cc"
7994                 else
7995                         echo "I'll use ld to build dynamic libraries."
7996                         dflt='ld'
7997                 fi
7998                 $rm_try
7999                 ;;
8000         *)      dflt="$ld"
8001                 ;;
8002         esac
8003
8004     rp="What command should be used to create dynamic libraries?"
8005     . ./myread
8006         ld="$ans"
8007
8008     cat << EOM
8009
8010 Some systems may require passing special flags to $ld to create a
8011 library that can be dynamically loaded.  If your ld flags include
8012 -L/other/path options to locate libraries outside your loader's normal
8013 search path, you may need to specify those -L options here as well.  To
8014 use no flags, say "none".
8015
8016 EOM
8017     case "$lddlflags" in
8018     '') case "$osname" in
8019                         beos) dflt='-nostart' ;;
8020                         haiku) dflt='-shared' ;;
8021                         hpux) dflt='-b';
8022                               case "$gccversion" in
8023                               '') dflt="$dflt +vnocompatwarnings" ;;
8024                               esac
8025                               ;;
8026                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8027                         next)  dflt='none' ;;
8028                         solaris) dflt='-G' ;;
8029                         sunos) dflt='-assert nodefinitions' ;;
8030                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8031                 *)     dflt='none' ;;
8032                         esac
8033                         ;;
8034     *) dflt="$lddlflags" ;;
8035     esac
8036
8037         : Try to guess additional flags to pick up local libraries.
8038         : Be careful not to append to a plain 'none'
8039         case "$dflt" in
8040         none) dflt='' ;;
8041         esac
8042         for thisflag in $ldflags; do
8043                 case "$thisflag" in
8044                 -L*|-R*|-Wl,-R*)
8045                         case " $dflt " in
8046                         *" $thisflag "*) ;;
8047                         *) dflt="$dflt $thisflag" ;;
8048                         esac
8049                         ;;
8050                 esac
8051         done
8052
8053         case "$dflt" in
8054         ''|' ') dflt='none' ;;
8055         esac
8056
8057         case "$ldflags" in
8058         *-fstack-protector*)
8059             case "$dflt" in
8060                         *-fstack-protector*) ;; # Don't add it again
8061                         *) dflt="$dflt -fstack-protector" ;; 
8062                 esac
8063                 ;;
8064         esac
8065
8066
8067     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8068     . ./myread
8069     case "$ans" in
8070     none) lddlflags=' ' ;;
8071     *) lddlflags="$ans" ;;
8072     esac
8073
8074         cat <<EOM
8075
8076 Some systems may require passing special flags to $cc to indicate that
8077 the resulting executable will use dynamic linking.  To use no flags,
8078 say "none".
8079
8080 EOM
8081     case "$ccdlflags" in
8082     '') case "$osname" in
8083             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8084             next|sunos) dflt='none' ;;
8085             *)          dflt='none' ;;
8086             esac ;;
8087     ' ')  dflt='none' ;;
8088     *)  dflt="$ccdlflags" ;;
8089     esac
8090     rp="Any special flags to pass to $cc to use dynamic linking?"
8091     . ./myread
8092     case "$ans" in
8093     none) ccdlflags=' ' ;;
8094     *) ccdlflags="$ans" ;;
8095     esac
8096     ;;
8097 *)  usedl="$undef"
8098         ld='ld'
8099     dlsrc='dl_none.xs'
8100     lddlflags=''
8101     ccdlflags=''
8102     ;;
8103 esac
8104
8105 : Do we want a shared libperl?
8106 also=''
8107 case "$usedl" in
8108 $undef)
8109         # No dynamic loading being used, so don't bother even to prompt.
8110         useshrplib='false'
8111         ;;
8112 *)      case "$useshrplib" in
8113         '')     case "$osname" in
8114                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8115                         dflt=y
8116                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8117                         ;;
8118                 next*)
8119                         case "$osvers" in
8120                         4*)     dflt=y
8121                                 also='Building a shared libperl is needed for MAB support.'
8122                                 ;;
8123                         *)      dflt=n
8124                                 ;;
8125                         esac
8126                         ;;
8127                 *)      dflt=n
8128                         ;;
8129                 esac
8130                 ;;
8131         $define|true|[Yy]*)
8132                 dflt=y
8133                 ;;
8134         *)      dflt=n
8135                 ;;
8136         esac
8137         $cat << EOM
8138
8139 The perl executable is normally obtained by linking perlmain.c with
8140 libperl${_a}, any static extensions (usually just DynaLoader), and
8141 any other libraries needed on this system (such as -lm, etc.).  Since
8142 your system supports dynamic loading, it is probably possible to build
8143 a shared libperl.$so.  If you will have more than one executable linked
8144 to libperl.$so, this will significantly reduce the size of each
8145 executable, but it may have a noticeable effect on performance.  The
8146 default is probably sensible for your system.
8147 $also
8148
8149 EOM
8150         rp="Build a shared libperl.$so (y/n)"
8151         . ./myread
8152         case "$ans" in
8153         true|$define|[Yy]*)
8154                 useshrplib='true'  ;;
8155         *)      useshrplib='false' ;;
8156         esac
8157         ;;
8158 esac
8159
8160 case "$useshrplib" in
8161 true)
8162         case "$libperl" in
8163         '')
8164                 # Figure out a good name for libperl.so.  Since it gets stored in
8165                 # a version-specific architecture-dependent library, the version
8166                 # number isn't really that important, except for making cc/ld happy.
8167                 #
8168                 # A name such as libperl.so.10.1
8169                 majmin="libperl.$so.$patchlevel.$subversion"
8170                 # A name such as libperl.so.100
8171                 majonly=`echo $patchlevel $subversion |
8172                         $awk '{printf "%d%02d", $1, $2}'`
8173                 majonly=libperl.$so.$majonly
8174                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8175                 # rely on figuring it out from the naming of libc.
8176                 case "${osname}${osvers}" in
8177                 next4*)
8178                         dflt=libperl.5.$so
8179                         # XXX How handle the --version stuff for MAB?
8180                         ;;
8181                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8182                         dflt=libperl.$so
8183                         ;;
8184                 cygwin*) # ld links now against the dll directly
8185                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8186                         majonly=`echo $patchlevel $subversion |
8187                                 $awk '{printf "%03d%03d", $1, $2}'`
8188                         majonly=cygperl5.$majonly.$so
8189                         dflt=$majmin
8190                         ;;
8191                 *)      # Try to guess based on whether libc has major.minor.
8192                         case "$libc" in
8193                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8194                         *libc.$so.[0-9]*) dflt=$majonly ;;
8195                         *)      dflt=libperl.$so ;;
8196                         esac
8197                         ;;
8198                 esac
8199                 ;;
8200         *)      dflt=$libperl
8201                 ;;
8202         esac
8203         cat << EOM
8204
8205 I need to select a good name for the shared libperl.  If your system uses
8206 library names with major and minor numbers, then you might want something
8207 like $majmin.  Alternatively, if your system uses a single version
8208 number for shared libraries, then you might want to use $majonly.
8209 Or, your system might be quite happy with a simple libperl.$so.
8210
8211 Since the shared libperl will get installed into a version-specific
8212 architecture-dependent directory, the version number of the shared perl
8213 library probably isn't important, so the default should be o.k.
8214
8215 EOM
8216         rp='What name do you want to give to the shared libperl?'
8217         . ./myread
8218         libperl=$ans
8219         echo "Ok, I'll use $libperl"
8220         ;;
8221 *)
8222         libperl="libperl${_a}"
8223         ;;
8224 esac
8225
8226 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8227 case "$shrpdir" in
8228 '') ;;
8229 *)      $cat >&4 <<EOM
8230 WARNING:  Use of the shrpdir variable for the installation location of
8231 the shared $libperl is not supported.  It was never documented and
8232 will not work in this version.  Let me (perlbug@perl.org)
8233 know of any problems this may cause.
8234
8235 EOM
8236         case "$shrpdir" in
8237         "$archlibexp/CORE")
8238                 $cat >&4 <<EOM
8239 But your current setting of $shrpdir is
8240 the default anyway, so it's harmless.
8241 EOM
8242                 ;;
8243         *)
8244                 $cat >&4 <<EOM
8245 Further, your current attempted setting of $shrpdir
8246 conflicts with the value of $archlibexp/CORE
8247 that installperl will use.
8248 EOM
8249                 ;;
8250         esac
8251         ;;
8252 esac
8253
8254 # How will the perl executable find the installed shared $libperl?
8255 # Add $xxx to ccdlflags.
8256 # If we can't figure out a command-line option, use $shrpenv to
8257 # set env LD_RUN_PATH.  The main perl makefile uses this.
8258 shrpdir=$archlibexp/CORE
8259 xxx=''
8260 tmp_shrpenv=''
8261 if "$useshrplib"; then
8262     case "$osname" in
8263         aix)
8264                 # We'll set it in Makefile.SH...
8265                 ;;
8266         solaris)
8267                 xxx="-R $shrpdir"
8268                 ;;
8269         freebsd|netbsd|openbsd|interix|dragonfly)
8270                 xxx="-Wl,-R$shrpdir"
8271                 ;;
8272         bsdos|linux|irix*|dec_osf|gnu*)
8273                 xxx="-Wl,-rpath,$shrpdir"
8274                 ;;
8275         next)
8276                 # next doesn't like the default...
8277                 ;;
8278         beos)
8279                 # beos doesn't like the default, either.
8280                 ;;
8281         haiku)
8282                 # Haiku doesn't like the default, either.
8283                 ;;
8284         hpux*)
8285                 # hpux doesn't like the default, either.
8286                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8287                 ;;
8288         cygwin)
8289                 # cygwin needs only ldlibpth
8290                 ;;
8291         *)
8292                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8293                 ;;
8294         esac
8295         case "$xxx" in
8296         '') ;;
8297         *)
8298                 # Only add $xxx if it isn't already in ccdlflags.
8299                 case " $ccdlflags " in
8300                 *" $xxx "*)     ;;
8301                 *)      ccdlflags="$ccdlflags $xxx"
8302                         cat <<EOM >&4
8303
8304 Adding $xxx to the flags
8305 passed to $ld so that the perl executable will find the
8306 installed shared $libperl.
8307
8308 EOM
8309                         ;;
8310                 esac
8311                 ;;
8312         esac
8313 fi
8314 # Fix ccdlflags in AIX for building external extensions.
8315 # (For building Perl itself bare -bE:perl.exp is needed,
8316 #  Makefile.SH takes care of this.)
8317 case "$osname" in
8318 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8319 esac
8320 # Respect a hint or command-line value.
8321 case "$shrpenv" in
8322 '') shrpenv="$tmp_shrpenv" ;;
8323 esac
8324 case "$ldlibpthname" in
8325 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8326 none)   ldlibpthname='' ;;
8327 esac
8328
8329 : determine where manual pages are on this system
8330 echo " "
8331 case "$sysman" in
8332 '') 
8333         syspath='/usr/share/man/man1 /usr/man/man1'
8334         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8335         syspath="$syspath /usr/man/u_man/man1"
8336         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8337         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8338         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8339         sysman=`./loc . /usr/man/man1 $syspath`
8340         ;;
8341 esac
8342 if $test -d "$sysman"; then
8343         echo "System manual is in $sysman." >&4
8344 else
8345         echo "Could not find manual pages in source form." >&4
8346 fi
8347
8348 : determine where manual pages go
8349 set man1dir man1dir none
8350 eval $prefixit
8351 $cat <<EOM
8352
8353 $spackage has manual pages available in source form.
8354 EOM
8355 case "$nroff" in
8356 nroff)
8357         echo "However, you don't have nroff, so they're probably useless to you."
8358         case "$man1dir" in
8359         '') man1dir="none";;
8360         esac;;
8361 esac
8362 echo "If you don't want the manual sources installed, answer 'none'."
8363 case "$man1dir" in
8364 ' ') dflt=none
8365         ;;
8366 '')
8367         lookpath="$prefixexp/share/man/man1"
8368         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8369         lookpath="$lookpath $prefixexp/man/p_man/man1"
8370         lookpath="$lookpath $prefixexp/man/u_man/man1"
8371         lookpath="$lookpath $prefixexp/man/man.1"
8372         case "$sysman" in
8373         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8374         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8375         esac
8376         set dflt
8377         eval $prefixup
8378         ;;
8379 *)  dflt="$man1dir"
8380         ;;
8381 esac
8382 echo " "
8383 fn=dn+~
8384 rp="Where do the main $spackage manual pages (source) go?"
8385 . ./getfile
8386 if $test "X$man1direxp" != "X$ansexp"; then
8387         installman1dir=''
8388 fi
8389 prefixvar=man1dir
8390 . ./setprefixvar
8391
8392 case "$man1dir" in
8393 '')     man1dir=' '
8394         installman1dir='';;
8395 esac
8396
8397 : What suffix to use on installed man pages
8398
8399 case "$man1dir" in
8400 ' ')
8401         man1ext='0'
8402         ;;
8403 *)
8404         rp="What suffix should be used for the main $spackage man pages?"
8405         case "$man1ext" in
8406         '')     case "$man1dir" in
8407                 *1)  dflt=1 ;;
8408                 *1p) dflt=1p ;;
8409                 *1pm) dflt=1pm ;;
8410                 *l) dflt=l;;
8411                 *n) dflt=n;;
8412                 *o) dflt=o;;
8413                 *p) dflt=p;;
8414                 *C) dflt=C;;
8415                 *L) dflt=L;;
8416                 *L1) dflt=L1;;
8417                 *) dflt=1;;
8418                 esac
8419                 ;;
8420         *)      dflt="$man1ext";;
8421         esac
8422         . ./myread
8423         man1ext="$ans"
8424         ;;
8425 esac
8426
8427 : see if we can have long filenames
8428 echo " "
8429 first=123456789abcdef
8430 $rm -f $first
8431 if (echo hi >$first) 2>/dev/null; then
8432         if $test -f 123456789abcde; then
8433                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8434                 val="$undef"
8435         else
8436                 echo 'You can have filenames longer than 14 characters.'>&4
8437                 val="$define"
8438         fi
8439 else
8440         $cat <<'EOM'
8441 You can't have filenames longer than 14 chars.
8442 You can't even think about them!
8443 EOM
8444         val="$undef"
8445 fi
8446 set d_flexfnam
8447 eval $setvar
8448 $rm -rf 123456789abcde*
8449
8450 : determine where library module manual pages go
8451 set man3dir man3dir none
8452 eval $prefixit
8453 $cat <<EOM
8454
8455 $spackage has manual pages for many of the library modules.
8456 EOM
8457
8458 case "$nroff" in
8459 nroff)
8460         $cat <<'EOM'
8461 However, you don't have nroff, so they're probably useless to you.
8462 EOM
8463         case "$man3dir" in
8464         '') man3dir="none";;
8465         esac;;
8466 esac
8467
8468 case "$d_flexfnam" in
8469 undef)
8470         $cat <<'EOM'
8471 However, your system can't handle the long file names like File::Basename.3.
8472 EOM
8473         case "$man3dir" in
8474         '') man3dir="none";;
8475         esac;;
8476 esac
8477
8478 echo "If you don't want the manual sources installed, answer 'none'."
8479 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8480 case "$man3dir" in
8481 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8482         if $test -d "$privlib/man/man3"; then
8483                 cat <<EOM >&4
8484
8485 WARNING:  Previous versions of perl installed man3 pages into
8486 $privlib/man/man3.  This version will suggest a
8487 new default of $dflt.
8488 EOM
8489                 tdflt=$dflt
8490                 dflt='n'
8491                 rp='Do you wish to preserve the old behavior?(y/n)'
8492                 . ./myread
8493                 case "$ans" in
8494                 y*) dflt="$privlib/man/man3" ;;
8495                 *)  dflt=$tdflt ;;
8496                 esac
8497     fi
8498         ;;
8499 *)      dflt="$man3dir" ;;
8500 esac
8501 case "$dflt" in
8502 ' ') dflt=none ;;
8503 esac
8504 echo " "
8505 fn=dn+~
8506 rp="Where do the $package library man pages (source) go?"
8507 . ./getfile
8508 prefixvar=man3dir
8509 . ./setprefixvar
8510
8511 case "$man3dir" in
8512 '')     man3dir=' '
8513         installman3dir='';;
8514 esac
8515
8516 : What suffix to use on installed man pages
8517 case "$man3dir" in
8518 ' ')
8519         man3ext='0'
8520         ;;
8521 *)
8522         rp="What suffix should be used for the $package library man pages?"
8523         case "$man3ext" in
8524         '')     case "$man3dir" in
8525                 *3)  dflt=3 ;;
8526                 *3p) dflt=3p ;;
8527                 *3pm) dflt=3pm ;;
8528                 *l) dflt=l;;
8529                 *n) dflt=n;;
8530                 *o) dflt=o;;
8531                 *p) dflt=p;;
8532                 *C) dflt=C;;
8533                 *L) dflt=L;;
8534                 *L3) dflt=L3;;
8535                 *) dflt=3;;
8536                 esac
8537                 ;;
8538         *)      dflt="$man3ext";;
8539         esac
8540         . ./myread
8541         man3ext="$ans"
8542         ;;
8543 esac
8544
8545 : see if we have to deal with yellow pages, now NIS.
8546 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8547         if $test -f /usr/etc/nibindd; then
8548                 echo " "
8549                 echo "I'm fairly confident you're on a NeXT."
8550                 echo " "
8551                 rp='Do you get the hosts file via NetInfo?'
8552                 dflt=y
8553                 case "$hostcat" in
8554                 nidump*) ;;
8555                 '') ;;
8556                 *) dflt=n;;
8557                 esac
8558                 . ./myread
8559                 case "$ans" in
8560                 y*) hostcat='nidump hosts .';;
8561                 *)      case "$hostcat" in
8562                         nidump*) hostcat='';;
8563                         esac
8564                         ;;
8565                 esac
8566         fi
8567         case "$hostcat" in
8568         nidump*) ;;
8569         *)
8570                 case "$hostcat" in
8571                 *ypcat*) dflt=y;;
8572                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8573                                 dflt=y
8574                         else
8575                                 dflt=n
8576                         fi;;
8577                 *) dflt=n;;
8578                 esac
8579                 echo " "
8580                 rp='Are you getting the hosts file via yellow pages?'
8581                 . ./myread
8582                 case "$ans" in
8583                 y*) hostcat='ypcat hosts';;
8584                 *) hostcat='cat /etc/hosts';;
8585                 esac
8586                 ;;
8587         esac
8588 fi
8589 case "$hostcat" in
8590 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8591 esac
8592 case "$groupcat" in
8593 '') test -f /etc/group && groupcat='cat /etc/group';;
8594 esac
8595 case "$passcat" in
8596 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8597 esac
8598
8599 : now get the host name
8600 echo " "
8601 echo "Figuring out host name..." >&4
8602 case "$myhostname" in
8603 '') cont=true
8604         echo 'Maybe "hostname" will work...'
8605         if tans=`sh -c hostname 2>&1` ; then
8606                 myhostname=$tans
8607                 phostname=hostname
8608                 cont=''
8609         fi
8610         ;;
8611 *) cont='';;
8612 esac
8613 if $test "$cont"; then
8614         if ./xenix; then
8615                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8616                 if tans=`cat /etc/systemid 2>&1` ; then
8617                         myhostname=$tans
8618                         phostname='cat /etc/systemid'
8619                         echo "Whadyaknow.  Xenix always was a bit strange..."
8620                         cont=''
8621                 fi
8622         elif $test -r /etc/systemid; then
8623                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8624         fi
8625 fi
8626 if $test "$cont"; then
8627         echo 'No, maybe "uuname -l" will work...'
8628         if tans=`sh -c 'uuname -l' 2>&1` ; then
8629                 myhostname=$tans
8630                 phostname='uuname -l'
8631         else
8632                 echo 'Strange.  Maybe "uname -n" will work...'
8633                 if tans=`sh -c 'uname -n' 2>&1` ; then
8634                         myhostname=$tans
8635                         phostname='uname -n'
8636                 else
8637                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8638                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8639                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8640                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8641                         else
8642                                 case "$myhostname" in
8643                                 '') echo "Does this machine have an identity crisis or something?"
8644                                         phostname='';;
8645                                 *)
8646                                         echo "Well, you said $myhostname before..."
8647                                         phostname='echo $myhostname';;
8648                                 esac
8649                         fi
8650                 fi
8651         fi
8652 fi
8653 case "$myhostname" in
8654 '') myhostname=noname ;;
8655 esac
8656 : you do not want to know about this
8657 set $myhostname
8658 myhostname=$1
8659
8660 : verify guess
8661 if $test "$myhostname" ; then
8662         dflt=y
8663         rp='Your host name appears to be "'$myhostname'".'" Right?"
8664         . ./myread
8665         case "$ans" in
8666         y*) ;;
8667         *) myhostname='';;
8668         esac
8669 fi
8670
8671 : bad guess or no guess
8672 while $test "X$myhostname" = X ; do
8673         dflt=''
8674         rp="Please type the (one word) name of your host:"
8675         . ./myread
8676         myhostname="$ans"
8677 done
8678
8679 : translate upper to lower if necessary
8680 case "$myhostname" in
8681 *[A-Z]*)
8682         echo "(Normalizing case in your host name)"
8683         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8684         ;;
8685 esac
8686
8687 case "$myhostname" in
8688 *.*)
8689         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8690         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8691         echo "(Trimming domain name from host name--host name is now $myhostname)"
8692         ;;
8693 *) case "$mydomain" in
8694         '')
8695                 {
8696                         test "X$hostcat" = "Xypcat hosts" &&
8697                         ypmatch "$myhostname" hosts 2>/dev/null |\
8698                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8699                         $test -s hosts
8700                 } || {
8701                         test "X$hostcat" != "X" &&
8702                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8703                                         /[       ]$myhostname[  . ]/p" > hosts
8704                 }
8705                 tmp_re="[       . ]"
8706                 if $test -f hosts; then
8707                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8708                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8709                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8710                                 hosts | $sort | $uniq | \
8711                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8712                         case `$echo X$dflt` in
8713                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8714                                 dflt=.
8715                                 ;;
8716                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8717                                 ;;
8718                         esac
8719                 else
8720                         echo "(I cannot locate a hosts database anywhere)"
8721                         dflt=.
8722                 fi
8723                 case "$dflt" in
8724                 .)
8725                         tans=`./loc resolv.conf X /etc /usr/etc`
8726                         if $test -f "$tans"; then
8727                                 echo "(Attempting domain name extraction from $tans)"
8728                                 dflt=.`$sed -n -e 's/   / /g' \
8729                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8730                                   -e 1q 2>/dev/null`
8731                                 case "$dflt" in
8732                                 .) dflt=.`$sed -n -e 's/        / /g' \
8733                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8734                                      -e 1q 2>/dev/null`
8735                                         ;;
8736                                 esac
8737                         fi
8738                         ;;
8739                 esac
8740                 case "$dflt" in
8741                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8742                         dflt=.`sh -c domainname 2>/dev/null`
8743                         case "$dflt" in
8744                         '') dflt='.';;
8745                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8746                         esac
8747                         ;;
8748                 esac
8749                 case "$dflt$osname" in
8750                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8751                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8752                         ;;
8753                 esac
8754                 case "$dflt" in
8755                 .) echo "(Lost all hope -- silly guess then)"
8756                         dflt='.nonet'
8757                         ;;
8758                 esac
8759                 $rm -f hosts
8760                 ;;
8761         *) dflt="$mydomain";;
8762         esac;;
8763 esac
8764 echo " "
8765 rp="What is your domain name?"
8766 . ./myread
8767 tans="$ans"
8768 case "$ans" in
8769 '') ;;
8770 .*) ;;
8771 *) tans=".$tans";;
8772 esac
8773 mydomain="$tans"
8774
8775 : translate upper to lower if necessary
8776 case "$mydomain" in
8777 *[A-Z]*)
8778         echo "(Normalizing case in your domain name)"
8779         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8780         ;;
8781 esac
8782
8783 : a little sanity check here
8784 case "$phostname" in
8785 '') ;;
8786 *)
8787         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8788         $myhostname$mydomain|$myhostname) ;;
8789         *)
8790                 case "$phostname" in
8791                 sed*)
8792                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8793                         ;;
8794                 *)
8795                         echo "(That doesn't agree with your $phostname command, by the way.)"
8796                         ;;
8797                 esac
8798         ;;
8799         esac
8800         ;;
8801 esac
8802
8803 : determine the e-mail address of the user who is running us
8804 $cat <<EOM
8805
8806 I need to get your e-mail address in Internet format if possible, i.e.
8807 something like user@host.domain. Please answer accurately since I have
8808 no easy means to double check it. The default value provided below
8809 is most probably close to reality but may not be valid from outside
8810 your organization...
8811
8812 EOM
8813 cont=x
8814 while test "$cont"; do
8815         case "$cf_email" in
8816         '') dflt="$cf_by@$myhostname$mydomain";;
8817         *) dflt="$cf_email";;
8818         esac
8819         rp='What is your e-mail address?'
8820         . ./myread
8821         cf_email="$ans"
8822         case "$cf_email" in
8823         *@*.*) cont='' ;;
8824         *)
8825                 rp='Address does not look like an Internet one.  Use it anyway?'
8826                 case "$fastread" in
8827                 yes) dflt=y ;;
8828                 *) dflt=n ;;
8829                 esac
8830                 . ./myread
8831                 case "$ans" in
8832                 y*) cont='' ;;
8833                 *) echo " " ;;
8834                 esac
8835                 ;;
8836         esac
8837 done
8838
8839 : Ask e-mail of administrator
8840 $cat <<EOM
8841
8842 If you or somebody else will be maintaining perl at your site, please
8843 fill in the correct e-mail address here so that they may be contacted
8844 if necessary. Currently, the "perlbug" program included with perl
8845 will send mail to this address in addition to perlbug@perl.org. You may
8846 enter "none" for no administrator.
8847
8848 EOM
8849 case "$perladmin" in
8850 '') dflt="$cf_email";;
8851 *) dflt="$perladmin";;
8852 esac
8853 rp='Perl administrator e-mail address'
8854 . ./myread
8855 perladmin="$ans"
8856
8857 : determine whether to only install version-specific parts.
8858 echo " "
8859 $cat <<EOM
8860 Do you want to install only the version-specific parts of the perl
8861 distribution?  Usually you do *not* want to do this.
8862 EOM
8863 case "$versiononly" in
8864 "$define"|[Yy]*|true) dflt='y' ;;
8865 *) dflt='n';
8866 esac
8867 rp="Do you want to install only the version-specific parts of perl?"
8868 . ./myread
8869 case "$ans" in
8870 [yY]*)  val="$define";;
8871 *)      val="$undef" ;;
8872 esac
8873 set versiononly
8874 eval $setvar
8875
8876 case "$versiononly" in
8877 "$define") inc_version_list=''
8878            inc_version_list_init=0
8879            ;;
8880 esac
8881
8882 : figure out how to guarantee perl startup
8883 : XXX Note that this currently takes advantage of the bug that binexp ignores
8884 :     the Configure -Dinstallprefix setting, which in turn means that under
8885 :     relocatable @INC, initialinstalllocation is what binexp started as.
8886 case "$startperl" in
8887 '')
8888         case "$sharpbang" in
8889         *!)
8890                 $cat <<EOH
8891
8892 I can use the #! construct to start perl on your system. This will
8893 make startup of perl scripts faster, but may cause problems if you
8894 want to share those scripts and perl is not in a standard place
8895 ($initialinstalllocation/perl) on all your platforms. The alternative
8896 is to force a shell by starting the script with a single ':' character.
8897
8898 EOH
8899                 case "$versiononly" in
8900                 "$define")      dflt="$initialinstalllocation/perl$version";;
8901                 *)              dflt="$initialinstalllocation/perl";;
8902                 esac
8903                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8904                 . ./myread
8905                 case "$ans" in
8906                 none)   startperl=": # use perl";;
8907                 *)      startperl="#!$ans"
8908                         if $test 30 -lt `echo "$ans" | wc -c`; then
8909                                 $cat >&4 <<EOM
8910
8911 WARNING:  Some systems limit the #! command to 32 characters.
8912 If you experience difficulty running Perl scripts with #!, try
8913 installing Perl in a directory with a shorter pathname.
8914
8915 EOM
8916                         fi ;;
8917                 esac
8918                 ;;
8919         *) startperl=": # use perl"
8920                 ;;
8921         esac
8922         ;;
8923 esac
8924 echo "I'll use $startperl to start perl scripts."
8925
8926 : figure best path for perl in scripts
8927 case "$perlpath" in
8928 '')
8929         case "$versiononly" in
8930         "$define")      perlpath="$initialinstalllocation/perl$version";;
8931         *)              perlpath="$initialinstalllocation/perl";;
8932         esac
8933         case "$startperl" in
8934         *!*) ;;
8935         *)
8936                 $cat <<EOH
8937
8938 I will use the "eval 'exec'" idiom to start Perl on your system.
8939 I can use the full path of your Perl binary for this purpose, but
8940 doing so may cause problems if you want to share those scripts and
8941 Perl is not always in a standard place ($initialinstalllocation/perl).
8942
8943 EOH
8944                 dflt="$initialinstalllocation/perl"
8945                 rp="What path shall I use in \"eval 'exec'\"?"
8946                 . ./myread
8947                 perlpath="$ans"
8948                 ;;
8949         esac
8950         ;;
8951 esac
8952 case "$startperl" in
8953 *!*)    ;;
8954 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8955 esac
8956
8957 : determine where public executable scripts go
8958 set scriptdir scriptdir
8959 eval $prefixit
8960 case "$scriptdir" in
8961 '')
8962         dflt="$bin"
8963         : guess some guesses
8964         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8965         $test -d /usr/share/bin     && dflt=/usr/share/bin
8966         $test -d /usr/local/script  && dflt=/usr/local/script
8967         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8968         $test -d $prefixexp/script  && dflt=$prefixexp/script
8969         set dflt
8970         eval $prefixup
8971         ;;
8972 *)  dflt="$scriptdir"
8973         ;;
8974 esac
8975 $cat <<EOM
8976
8977 Some installations have a separate directory just for executable scripts so
8978 that they can mount it across multiple architectures but keep the scripts in
8979 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8980 Or you might just lump your scripts in with all your other executables.
8981
8982 EOM
8983 fn=d~
8984 rp='Where do you keep publicly executable scripts?'
8985 . ./getfile
8986 if $test "X$ansexp" != "X$scriptdirexp"; then
8987         installscript=''
8988 fi
8989 installscriptdir=''
8990 prefixvar=scriptdir
8991 . ./setprefixvar
8992 : A little fix up for an irregularly named variable.
8993 installscript="$installscriptdir"
8994
8995 : determine where add-on public executables go
8996 case "$sitebin" in
8997 '')     dflt=$siteprefix/bin ;;
8998 *)      dflt=$sitebin ;;
8999 esac
9000 fn=d~
9001 rp='Pathname where the add-on public executables should be installed?'
9002 . ./getfile
9003 prefixvar=sitebin
9004 . ./setprefixvar
9005
9006 : determine where add-on html pages go
9007 : There is no standard location, so try to copy the previously-selected
9008 : directory structure for the core html pages.
9009 case "$sitehtml1dir" in
9010 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9011 *)     dflt=$sitehtml1dir ;;
9012 esac
9013 case "$dflt" in
9014 ''|' ') dflt=none ;;
9015 esac
9016 fn=dn+~
9017 rp='Pathname where the site-specific html pages should be installed?'
9018 . ./getfile
9019 prefixvar=sitehtml1dir
9020 . ./setprefixvar
9021
9022 : determine where add-on library html pages go
9023 : There is no standard location, so try to copy the previously-selected
9024 : directory structure for the core html pages.
9025 case "$sitehtml3dir" in
9026 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9027 *)     dflt=$sitehtml3dir ;;
9028 esac
9029 case "$dflt" in
9030 ''|' ') dflt=none ;;
9031 esac
9032 fn=dn+~
9033 rp='Pathname where the site-specific library html pages should be installed?'
9034 . ./getfile
9035 prefixvar=sitehtml3dir
9036 . ./setprefixvar
9037
9038 : determine where add-on manual pages go
9039 case "$siteman1dir" in
9040 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9041 *)      dflt=$siteman1dir ;;
9042 esac
9043 case "$dflt" in
9044 ''|' ') dflt=none ;;
9045 esac
9046 fn=dn+~
9047 rp='Pathname where the site-specific manual pages should be installed?'
9048 . ./getfile
9049 prefixvar=siteman1dir
9050 . ./setprefixvar
9051
9052 : determine where add-on library man pages go
9053 case "$siteman3dir" in
9054 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9055 *)      dflt=$siteman3dir ;;
9056 esac
9057 case "$dflt" in
9058 ''|' ') dflt=none ;;
9059 esac
9060 fn=dn+~
9061 rp='Pathname where the site-specific library manual pages should be installed?'
9062 . ./getfile
9063 prefixvar=siteman3dir
9064 . ./setprefixvar
9065
9066 : determine where add-on public executable scripts go
9067 case "$sitescript" in
9068 '')     dflt=$siteprefix/script
9069         $test -d $dflt || dflt=$sitebin ;;
9070 *)  dflt="$sitescript" ;;
9071 esac
9072 fn=d~+
9073 rp='Pathname where add-on public executable scripts should be installed?'
9074 . ./getfile
9075 prefixvar=sitescript
9076 . ./setprefixvar
9077
9078 : Check if faststdio is requested and available
9079 case "$usefaststdio" in
9080 $define|true|[yY]*|'')
9081         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9082         case "$xversion" in
9083         [68])   dflt='y' ;;
9084         *)      dflt='n' ;;
9085         esac
9086         ;;
9087 *) dflt='n';;
9088 esac
9089 cat <<EOM
9090
9091 Perl can be built to use 'fast stdio', which means using the stdio
9092 library but also directly manipulating the stdio buffers to enable
9093 faster I/O.  Using stdio is better for backward compatibility (especially
9094 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9095 interface has been preferred instead of stdio.
9096
9097 If this doesn't make any sense to you, just accept the default '$dflt'.
9098 EOM
9099 rp='Use the "fast stdio" if available?'
9100 . ./myread
9101 case "$ans" in
9102 y|Y)    val="$define" ;;
9103 *)      val="$undef" ;;
9104 esac
9105 set usefaststdio
9106 eval $setvar
9107
9108
9109 : define an is-a-typedef? function
9110 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9111 case "$inclist" in
9112 "") inclist="sys/types.h";;
9113 esac;
9114 eval "varval=\$$var";
9115 case "$varval" in
9116 "")
9117         $rm -f temp.c;
9118         for inc in $inclist; do
9119                 echo "#include <$inc>" >>temp.c;
9120         done;
9121         echo "#ifdef $type" >> temp.c;
9122         echo "printf(\"We have $type\");" >> temp.c;
9123         echo "#endif" >> temp.c;
9124         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9125         if $contains $type temp.E >/dev/null 2>&1; then
9126                 eval "$var=\$type";
9127         else
9128                 eval "$var=\$def";
9129         fi;
9130         $rm -f temp.?;;
9131 *) eval "$var=\$varval";;
9132 esac'
9133
9134 : define an is-a-typedef? function that prompts if the type is not available.
9135 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9136 case "$inclist" in
9137 "") inclist="sys/types.h";;
9138 esac;
9139 eval "varval=\$$var";
9140 case "$varval" in
9141 "")
9142         $rm -f temp.c;
9143         for inc in $inclist; do
9144                 echo "#include <$inc>" >>temp.c;
9145         done;
9146         echo "#ifdef $type" >> temp.c;
9147         echo "printf(\"We have $type\");" >> temp.c;
9148         echo "#endif" >> temp.c;
9149         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9150         echo " " ;
9151         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9152         if $contains $type temp.E >/dev/null 2>&1; then
9153                 echo "$type found." >&4;
9154                 eval "$var=\$type";
9155         else
9156                 echo "$type NOT found." >&4;
9157                 dflt="$def";
9158                 . ./myread ;
9159                 eval "$var=\$ans";
9160         fi;
9161         $rm -f temp.?;;
9162 *) eval "$var=\$varval";;
9163 esac'
9164
9165 : see what type lseek is declared as in the kernel
9166 rp="What is the type used for lseek's offset on this system?"
9167 set off_t lseektype long stdio.h sys/types.h
9168 eval $typedef_ask
9169
9170 echo " "
9171 echo "Checking to see how big your file offsets are..." >&4
9172 $cat >try.c <<EOCP
9173 #include <sys/types.h>
9174 #include <stdio.h>
9175 int main()
9176 {
9177     printf("%d\n", (int)sizeof($lseektype));
9178     return(0);
9179 }
9180 EOCP
9181 set try
9182 if eval $compile_ok; then
9183         lseeksize=`$run ./try`
9184         echo "Your file offsets are $lseeksize bytes long."
9185 else
9186         dflt=$longsize
9187         echo " "
9188         echo "(I can't seem to compile the test program.  Guessing...)"
9189         rp="What is the size of your file offsets (in bytes)?"
9190         . ./myread
9191         lseeksize="$ans"
9192 fi
9193 $rm_try
9194
9195 : see what type file positions are declared as in the library
9196 rp="What is the type for file position used by fsetpos()?"
9197 set fpos_t fpostype long stdio.h sys/types.h
9198 eval $typedef_ask
9199
9200 : Check size for Fpos_t
9201 echo " "
9202 case "$fpostype" in
9203 *_t) zzz="$fpostype"    ;;
9204 *)   zzz="fpos_t"       ;;
9205 esac
9206 echo "Checking the size of $zzz..." >&4
9207 cat > try.c <<EOCP
9208 #include <sys/types.h>
9209 #include <stdio.h>
9210 #$i_stdlib I_STDLIB
9211 #ifdef I_STDLIB
9212 #include <stdlib.h>
9213 #endif
9214 int main() {
9215     printf("%d\n", (int)sizeof($fpostype));
9216     exit(0);
9217 }
9218 EOCP
9219 set try
9220 if eval $compile_ok; then
9221         yyy=`$run ./try`
9222         case "$yyy" in
9223         '')     fpossize=4
9224                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9225                 ;;
9226         *)      fpossize=$yyy
9227                 echo "Your $zzz is $fpossize bytes long."
9228                 ;;
9229         esac
9230 else
9231         dflt="$longsize"
9232         echo " " >&4
9233         echo "(I can't compile the test program.  Guessing...)" >&4
9234         rp="What is the size of your file positions (in bytes)?"
9235         . ./myread
9236         fpossize="$ans"
9237 fi
9238
9239 : Check for large file support
9240 # Backward compatibility (uselfs is deprecated).
9241 case "$uselfs" in
9242 "$define"|true|[yY]*)
9243         cat <<EOM >&4
9244
9245 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9246 EOM
9247         uselargefiles="$define"
9248         ;;
9249 esac
9250
9251 case "$lseeksize:$fpossize" in
9252 8:8) cat <<EOM
9253
9254 You can have files larger than 2 gigabytes.
9255 EOM
9256    val="$define" ;;
9257 *)    case "$uselargefiles" in
9258    "$undef"|false|[nN]*) dflt='n' ;;
9259    *)   dflt='y' ;;
9260    esac
9261    cat <<EOM
9262
9263 Perl can be built to understand large files (files larger than 2 gigabytes)
9264 on some systems.  To do so, Configure can be run with -Duselargefiles.
9265
9266 If this doesn't make any sense to you, just accept the default '$dflt'.
9267 EOM
9268    rp='Try to understand large files, if available?'
9269    . ./myread
9270    case "$ans" in
9271    y|Y)         val="$define" ;;
9272    *)           val="$undef"  ;;
9273    esac
9274    ;;
9275 esac
9276 set uselargefiles
9277 eval $setvar
9278 : Look for a hint-file generated 'call-back-unit'.  If the
9279 : user has specified that a large files perl is to be built,
9280 : we may need to set or change some other defaults.
9281 if $test -f uselargefiles.cbu; then
9282         echo "Your platform has some specific hints regarding large file builds, using them..."
9283         . ./uselargefiles.cbu
9284 fi
9285 case "$uselargefiles" in
9286 "$define")
9287         if $test -f uselargefiles.cbu; then
9288                 echo " "
9289                 echo "Rechecking to see how big your file offsets are..." >&4
9290                 $cat >try.c <<EOCP
9291 #include <sys/types.h>
9292 #include <stdio.h>
9293 int main()
9294 {
9295     printf("%d\n", (int)sizeof($lseektype));
9296     return(0);
9297 }
9298 EOCP
9299                 set try
9300                 if eval $compile_ok; then
9301                         lseeksize=`$run ./try`
9302                         $echo "Your file offsets are now $lseeksize bytes long."
9303                 else
9304                         dflt="$lseeksize"
9305                         echo " "
9306                         echo "(I can't seem to compile the test program.  Guessing...)"
9307                         rp="What is the size of your file offsets (in bytes)?"
9308                         . ./myread
9309                         lseeksize="$ans"
9310                 fi
9311                 case "$fpostype" in
9312                 *_t) zzz="$fpostype"    ;;
9313                 *)   zzz="fpos_t"       ;;
9314                 esac
9315                 $echo $n "Rechecking the size of $zzz...$c" >&4
9316                 $cat > try.c <<EOCP
9317 #include <sys/types.h>
9318 #include <stdio.h>
9319 #$i_stdlib I_STDLIB
9320 #ifdef I_STDLIB
9321 #include <stdlib.h>
9322 #endif
9323 int main() {
9324     printf("%d\n", (int)sizeof($fpostype));
9325     return(0);
9326 }
9327 EOCP
9328                 set try
9329                 if eval $compile_ok; then
9330                         yyy=`$run ./try`
9331                         dflt="$lseeksize"
9332                         case "$yyy" in
9333                         '')     echo " "
9334                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9335                                 ;;
9336                         *)      fpossize=$yyy
9337                                 echo " $fpossize bytes." >&4
9338                                 ;;
9339                         esac
9340                 else
9341                         dflt="$fpossize"
9342                         echo " "
9343                         echo "(I can't compile the test program.  Guessing...)" >&4
9344                         rp="What is the size of your file positions (in bytes)?"
9345                         . ./myread
9346                         fpossize="$ans"
9347                 fi
9348                 $rm_try
9349         fi
9350         ;;
9351 esac
9352
9353 : Set the vendorbin variables
9354 case "$vendorprefix" in
9355 '')     d_vendorbin="$undef"
9356         vendorbin=''
9357         vendorbinexp=''
9358         ;;
9359 *)      d_vendorbin="$define"
9360         : determine where vendor-supplied executables go.
9361         case "$vendorbin" in
9362         '') dflt=$vendorprefix/bin ;;
9363         *)      dflt="$vendorbin" ;;
9364         esac
9365         fn=d~+
9366         rp='Pathname for the vendor-supplied executables directory?'
9367         . ./getfile
9368         vendorbin="$ans"
9369         vendorbinexp="$ansexp"
9370         ;;
9371 esac
9372 prefixvar=vendorbin
9373 . ./installprefix
9374
9375 : Set the vendorhtml1dir variables
9376 case "$vendorprefix" in
9377 '')     vendorhtml1dir=''
9378         vendorhtml1direxp=''
9379         ;;
9380 *)      : determine where vendor-supplied html pages go.
9381         : There is no standard location, so try to copy the previously-selected
9382         : directory structure for the core html pages.
9383         : XXX Better default suggestions would be welcome.
9384         case "$vendorhtml1dir" in
9385         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9386         *)      dflt=$vendorhtml1dir ;;
9387         esac
9388         case "$dflt" in
9389         ''|' ') dflt=none ;;
9390         esac
9391         fn=dn+~
9392         rp='Pathname for the vendor-supplied html pages?'
9393         . ./getfile
9394         vendorhtml1dir="$ans"
9395         vendorhtml1direxp="$ansexp"
9396         ;;
9397 esac
9398 : Use ' ' for none so value is preserved next time through Configure
9399 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9400 prefixvar=vendorhtml1dir
9401 . ./installprefix
9402
9403 : Set the vendorhtml3dir variables
9404 case "$vendorprefix" in
9405 '')     vendorhtml3dir=''
9406         vendorhtml3direxp=''
9407         ;;
9408 *)      : determine where vendor-supplied module html pages go.
9409         : There is no standard location, so try to copy the previously-selected
9410         : directory structure for the core html pages.
9411         : XXX Better default suggestions would be welcome.
9412         case "$vendorhtml3dir" in
9413         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9414         *)      dflt=$vendorhtml3dir ;;
9415         esac
9416         case "$dflt" in
9417         ''|' ') dflt=none ;;
9418         esac
9419         fn=dn+~
9420         rp='Pathname for the vendor-supplied html pages?'
9421         . ./getfile
9422         vendorhtml3dir="$ans"
9423         vendorhtml3direxp="$ansexp"
9424         ;;
9425 esac
9426 : Use ' ' for none so value is preserved next time through Configure
9427 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9428 prefixvar=vendorhtml3dir
9429 . ./installprefix
9430
9431 : Set the vendorman1dir variables
9432 case "$vendorprefix" in
9433 '')     vendorman1dir=''
9434         vendorman1direxp=''
9435         ;;
9436 *)      : determine where vendor-supplied manual pages go.
9437         case "$vendorman1dir" in
9438         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9439         *)      dflt=$vendorman1dir ;;
9440         esac
9441         case "$dflt" in
9442         ''|' ') dflt=none ;;
9443         esac
9444         fn=nd~+
9445         rp='Pathname for the vendor-supplied manual section 1 pages?'
9446         . ./getfile
9447         vendorman1dir="$ans"
9448         vendorman1direxp="$ansexp"
9449         ;;
9450 esac
9451 : Use ' ' for none so value is preserved next time through Configure
9452 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9453 prefixvar=vendorman1dir
9454 . ./installprefix
9455
9456 : Set the vendorman3dir variables
9457 case "$vendorprefix" in
9458 '')     vendorman3dir=''
9459         vendorman3direxp=''
9460         ;;
9461 *)      : determine where vendor-supplied module manual pages go.
9462         case "$vendorman3dir" in
9463         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9464         *)      dflt=$vendorman3dir ;;
9465         esac
9466         case "$dflt" in
9467         ''|' ') dflt=none ;;
9468         esac
9469         fn=nd~+
9470         rp='Pathname for the vendor-supplied manual section 3 pages?'
9471         . ./getfile
9472         vendorman3dir="$ans"
9473         vendorman3direxp="$ansexp"
9474         ;;
9475 esac
9476 : Use ' ' for none so value is preserved next time through Configure
9477 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9478 prefixvar=vendorman3dir
9479 . ./installprefix
9480
9481 : Set the vendorscript variables
9482 case "$vendorprefix" in
9483 '')     d_vendorscript="$undef"
9484         vendorscript=''
9485         vendorscriptexp=''
9486         ;;
9487 *)      d_vendorscript="$define"
9488         : determine where vendor-supplied scripts go.
9489         case "$vendorscript" in
9490         '')     dflt=$vendorprefix/script
9491                 $test -d $dflt || dflt=$vendorbin ;;
9492         *)  dflt="$vendorscript" ;;
9493         esac
9494         $cat <<EOM
9495
9496 The installation process will create a directory for
9497 vendor-supplied scripts.
9498
9499 EOM
9500         fn=d~+
9501         rp='Pathname for the vendor-supplied scripts directory?'
9502         . ./getfile
9503         vendorscript="$ans"
9504         vendorscriptexp="$ansexp"
9505         ;;
9506 esac
9507 prefixvar=vendorscript
9508 . ./installprefix
9509
9510 : script used to emit important warnings
9511 cat >warn <<EOS
9512 $startsh
9513 if test \$# -gt 0; then
9514         echo "\$@" >msg
9515 else
9516         cat >msg
9517 fi
9518 echo "*** WARNING:" >&4
9519 sed -e 's/^/*** /' <msg >&4
9520 echo "*** " >&4
9521 cat msg >>config.msg
9522 echo " " >>config.msg
9523 rm -f msg
9524 EOS
9525 chmod +x warn
9526 $eunicefix warn
9527
9528 : see which of string.h or strings.h is needed
9529 echo " "
9530 strings=`./findhdr string.h`
9531 if $test "$strings" && $test -r "$strings"; then
9532         echo "Using <string.h> instead of <strings.h>." >&4
9533         val="$define"
9534 else
9535         val="$undef"
9536         strings=`./findhdr strings.h`
9537         if $test "$strings" && $test -r "$strings"; then
9538                 echo "Using <strings.h> instead of <string.h>." >&4
9539         else
9540                 ./warn "No string header found -- You'll surely have problems."
9541         fi
9542 fi
9543 set i_string
9544 eval $setvar
9545 case "$i_string" in
9546 "$undef") strings=`./findhdr strings.h`;;
9547 *)        strings=`./findhdr string.h`;;
9548 esac
9549
9550 : see if qgcvt exists
9551 set qgcvt d_qgcvt
9552 eval $inlibc
9553
9554 : Check print/scan long double stuff
9555 echo " "
9556
9557 if $test X"$d_longdbl" = X"$define"; then
9558
9559 echo "Checking how to print long doubles..." >&4
9560
9561 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9562         $cat >try.c <<'EOCP'
9563 #include <sys/types.h>
9564 #include <stdio.h>
9565 int main() {
9566   double d = 123.456;
9567   printf("%.3f\n", d);
9568 }
9569 EOCP
9570         set try
9571         if eval $compile; then
9572                 yyy=`$run ./try`
9573                 case "$yyy" in
9574                 123.456)
9575                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9576                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9577                         echo "We will use %f."
9578                         ;;
9579                 esac
9580         fi
9581 fi
9582
9583 if $test X"$sPRIfldbl" = X; then
9584         $cat >try.c <<'EOCP'
9585 #include <sys/types.h>
9586 #include <stdio.h>
9587 int main() {
9588   long double d = 123.456;
9589   printf("%.3Lf\n", d);
9590 }
9591 EOCP
9592         set try
9593         if eval $compile; then
9594                 yyy=`$run ./try`
9595                 case "$yyy" in
9596                 123.456)
9597                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9598                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9599                         echo "We will use %Lf."
9600                         ;;
9601                 esac
9602         fi
9603 fi
9604
9605 if $test X"$sPRIfldbl" = X; then
9606         $cat >try.c <<'EOCP'
9607 #include <sys/types.h>
9608 #include <stdio.h>
9609 int main() {
9610   long double d = 123.456;
9611   printf("%.3llf\n", d);
9612 }
9613 EOCP
9614         set try
9615         if eval $compile; then
9616                 yyy=`$run ./try`
9617                 case "$yyy" in
9618                 123.456)
9619                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9620                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9621                         echo "We will use %llf."
9622                         ;;
9623                 esac
9624         fi
9625 fi
9626
9627 if $test X"$sPRIfldbl" = X; then
9628         $cat >try.c <<'EOCP'
9629 #include <sys/types.h>
9630 #include <stdio.h>
9631 int main() {
9632   long double d = 123.456;
9633   printf("%.3lf\n", d);
9634 }
9635 EOCP
9636         set try
9637         if eval $compile; then
9638                 yyy=`$run ./try`
9639                 case "$yyy" in
9640                 123.456)
9641                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9642                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9643                         echo "We will use %lf."
9644                         ;;
9645                 esac
9646         fi
9647 fi
9648
9649 if $test X"$sPRIfldbl" = X; then
9650         echo "Cannot figure out how to print long doubles." >&4
9651 else
9652         sSCNfldbl=$sPRIfldbl    # expect consistency
9653 fi
9654
9655 $rm_try
9656
9657 fi # d_longdbl
9658
9659 case "$sPRIfldbl" in
9660 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9661         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9662         d_SCNfldbl="$undef";
9663         ;;
9664 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9665         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9666         d_SCNfldbl="$define";
9667         ;;
9668 esac
9669
9670 : Check how to convert floats to strings.
9671
9672 if test "X$d_Gconvert" = X; then
9673
9674 echo " "
9675 echo "Checking for an efficient way to convert floats to strings."
9676 echo " " > try.c
9677 case "$uselongdouble" in
9678 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9679 esac
9680 case "$d_longdbl" in
9681 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9682 esac
9683 case "$d_PRIgldbl" in
9684 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9685 esac
9686 $cat >>try.c <<EOP
9687 #ifdef TRY_gconvert
9688 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9689 char *myname = "gconvert";
9690 #endif
9691 #ifdef TRY_gcvt
9692 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9693 char *myname = "gcvt";
9694 #endif
9695 #ifdef TRY_qgcvt
9696 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9697 char *myname = "qgcvt";
9698 #define DOUBLETYPE long double
9699 #endif
9700 #ifdef TRY_sprintf
9701 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9702 #ifdef HAS_PRIgldbl
9703 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9704 #else
9705 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9706 #endif
9707 #else
9708 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9709 #endif
9710 char *myname = "sprintf";
9711 #endif
9712
9713 #ifndef DOUBLETYPE
9714 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9715 #define DOUBLETYPE long double
9716 #else
9717 #define DOUBLETYPE double
9718 #endif
9719 #endif
9720
9721 #include <stdio.h>
9722
9723 #$i_stdlib I_STDLIB
9724 #ifdef I_STDLIB
9725 #include <stdlib.h>
9726 #endif
9727 #$i_string I_STRING
9728 #ifdef I_STRING
9729 #  include <string.h>
9730 #else
9731 #  include <strings.h>
9732 #endif
9733
9734 int checkit(char *expect, char *got)
9735 {
9736     if (strcmp(expect, got)) {
9737                 printf("%s oddity:  Expected %s, got %s\n",
9738                         myname, expect, got);
9739                 exit(1);
9740         }
9741 }
9742
9743 int main()
9744 {
9745         char buf[64];
9746         buf[63] = '\0';
9747
9748         /* This must be 1st test on (which?) platform */
9749         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9750         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9751         checkit("0.1", buf);
9752
9753         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9754         checkit("0.01", buf);
9755
9756         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9757         checkit("0.001", buf);
9758
9759         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9760         checkit("0.0001", buf);
9761
9762         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9763         if (strlen(buf) > 5)
9764             checkit("9e-005", buf); /* for Microsoft ?? */
9765         else
9766             checkit("9e-05", buf);
9767
9768         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9769         checkit("1", buf);
9770
9771         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9772         checkit("1.1", buf);
9773
9774         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9775         checkit("1.01", buf);
9776
9777         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9778         checkit("1.001", buf);
9779
9780         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9781         checkit("1.0001", buf);
9782
9783         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9784         checkit("1.00001", buf);
9785
9786         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9787         checkit("1.000001", buf);
9788
9789         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9790         checkit("0", buf);
9791
9792         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9793         checkit("-1", buf);
9794
9795         /* Some Linux gcvt's give 1.e+5 here. */
9796         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9797         checkit("100000", buf);
9798
9799         /* Some Linux gcvt's give -1.e+5 here. */
9800         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9801         checkit("-100000", buf);
9802
9803         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9804         checkit("123.456", buf);
9805
9806         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9807         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9808         /* 34 should be enough to scare even long double
9809          * places into using the e notation. */
9810         if (strlen(buf) > 5)
9811             checkit("1e+034", buf); /* for Microsoft */
9812         else
9813             checkit("1e+34", buf);
9814
9815         /* For Perl, if you add additional tests here, also add them to
9816          * t/base/num.t for benefit of platforms not using Configure or
9817          * overriding d_Gconvert */
9818
9819         exit(0);
9820 }
9821 EOP
9822 : first add preferred functions to our list
9823 xxx_list=""
9824 for xxx_convert in $gconvert_preference; do
9825     case $xxx_convert in
9826     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9827     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9828     esac
9829 done
9830 : then add any others
9831 for xxx_convert in gconvert gcvt sprintf; do
9832     case "$xxx_list" in
9833     *$xxx_convert*) ;;
9834     *) xxx_list="$xxx_list $xxx_convert" ;;
9835     esac
9836 done
9837
9838 case "$d_longdbl$uselongdouble" in
9839 "$define$define")
9840     : again, add prefered functions to our list first
9841     xxx_ld_list=""
9842     for xxx_convert in $gconvert_ld_preference; do
9843         case $xxx_convert in
9844         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9845         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9846         esac
9847     done
9848     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9849     for xxx_convert in qgcvt sprintf $xxx_list; do
9850         case "$xxx_ld_list" in
9851         $xxx_convert*|*" $xxx_convert"*) ;;
9852         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9853         esac
9854     done
9855     : if sprintf cannot do long doubles, move it to the end
9856     if test "$d_PRIgldbl" != "$define"; then
9857         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9858     fi
9859     : if no qgcvt, remove it
9860     if test "$d_qgcvt" != "$define"; then
9861         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9862     fi
9863     : use the ld_list
9864     xxx_list="$xxx_ld_list"
9865     ;;
9866 esac
9867
9868 for xxx_convert in $xxx_list; do
9869         echo "Trying $xxx_convert..."
9870         $rm -f try try$_o core
9871         set try -DTRY_$xxx_convert
9872         if eval $compile; then
9873                 echo "$xxx_convert() found." >&4
9874                 if $run ./try; then
9875                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9876                         break;
9877                 else
9878                         echo "...But $xxx_convert didn't work as I expected."
9879                         xxx_convert=''
9880                 fi
9881         else
9882                 echo "$xxx_convert NOT found." >&4
9883         fi
9884 done
9885
9886 if test X$xxx_convert = X; then
9887     echo "*** WHOA THERE!!! ***" >&4
9888     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9889     xxx_convert=sprintf
9890 fi
9891
9892 case "$xxx_convert" in
9893 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9894 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9895 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9896 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9897    "$define$define$define")
9898       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9899    "$define$define$undef")
9900       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9901    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9902    esac
9903    ;;
9904 esac
9905
9906 fi
9907 $rm_try
9908
9909 : see if _fwalk exists
9910 set fwalk d__fwalk
9911 eval $inlibc
9912
9913 : Initialize h_fcntl
9914 h_fcntl=false
9915
9916 : Initialize h_sysfile
9917 h_sysfile=false
9918
9919 : access call always available on UNIX
9920 set access d_access
9921 eval $inlibc
9922
9923 : locate the flags for 'access()'
9924 case "$d_access" in
9925 "$define")
9926         echo " "
9927         $cat >access.c <<EOCP
9928 #include <sys/types.h>
9929 #ifdef I_FCNTL
9930 #include <fcntl.h>
9931 #endif
9932 #ifdef I_SYS_FILE
9933 #include <sys/file.h>
9934 #endif
9935 #ifdef I_UNISTD
9936 #include <unistd.h>
9937 #endif
9938 #$i_stdlib I_STDLIB
9939 #ifdef I_STDLIB
9940 #include <stdlib.h>
9941 #endif
9942 int main() {
9943         exit(R_OK);
9944 }
9945 EOCP
9946         : check sys/file.h first, no particular reason here
9947         if $test `./findhdr sys/file.h` && \
9948                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9949                 h_sysfile=true;
9950                 echo "<sys/file.h> defines the *_OK access constants." >&4
9951         elif $test `./findhdr fcntl.h` && \
9952                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9953                 h_fcntl=true;
9954                 echo "<fcntl.h> defines the *_OK access constants." >&4
9955         elif $test `./findhdr unistd.h` && \
9956                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9957                 echo "<unistd.h> defines the *_OK access constants." >&4
9958         else
9959                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9960         fi
9961         ;;
9962 esac
9963 $rm -f access*
9964
9965 : see if accessx exists
9966 set accessx d_accessx
9967 eval $inlibc
9968
9969 : see if aintl exists
9970 set aintl d_aintl
9971 eval $inlibc
9972
9973 : see if alarm exists
9974 set alarm d_alarm
9975 eval $inlibc
9976
9977 : see if 64bit time functions exists
9978
9979 set ctime64 d_ctime64
9980 eval $inlibc
9981
9982 set localtime64 d_localtime64
9983 eval $inlibc
9984
9985 set gmtime64 d_gmtime64
9986 eval $inlibc
9987
9988 set mktime64 d_mktime64
9989 eval $inlibc
9990
9991 set difftime64 d_difftime64
9992 eval $inlibc
9993
9994 set asctime64 d_asctime64
9995 eval $inlibc
9996
9997 : see if POSIX threads are available
9998 set pthread.h i_pthread
9999 eval $inhdr
10000
10001 : define a fucntion to check prototypes
10002 $cat > protochk <<EOSH
10003 $startsh
10004 cc="$cc"
10005 optimize="$optimize"
10006 ccflags="$ccflags"
10007 prototype="$prototype"
10008 define="$define"
10009 rm_try="$rm_try"
10010 usethreads=$usethreads
10011 i_pthread=$i_pthread
10012 pthread_h_first=$pthread_h_first
10013 EOSH
10014
10015 $cat >> protochk <<'EOSH'
10016
10017 $rm_try
10018 foo="$1"
10019 shift
10020 while test $# -ge 2; do
10021         case "$1" in
10022                 $define) echo "#include <$2>" >> try.c ;;
10023                 literal) echo "$2" >> try.c ;;
10024         esac
10025     # Extra magic for the benefit of systems that need pthread.h
10026     # to be included early to correctly detect threadsafe functions.
10027     # Such functions must guarantee themselves, though, that the usethreads
10028     # and i_pthread have been defined, before calling protochk.
10029     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10030         echo "#include <pthread.h>" >> try.c
10031         pthread_h_done=yes
10032     fi
10033     shift 2
10034 done
10035 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10036 cat >> try.c <<'EOCP'
10037 #ifdef CAN_PROTOTYPE
10038 #define _(args) args
10039 #else
10040 #define _(args) ()
10041 #endif
10042 EOCP
10043 echo "$foo" >> try.c
10044 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10045 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10046 status=$?
10047 $rm_try
10048 exit $status
10049 EOSH
10050 chmod +x protochk
10051 $eunicefix protochk
10052
10053 : Define hasproto macro for Configure internal use
10054 hasproto='varname=$1; func=$2; shift; shift;
10055 while $test $# -ge 2; do
10056         case "$1" in
10057         $define) echo "#include <$2>";;
10058         esac ;
10059     shift 2;
10060 done > try.c;
10061 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10062 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10063         echo "$func() prototype found.";
10064         val="$define";
10065 else
10066         echo "$func() prototype NOT found.";
10067         val="$undef";
10068 fi;
10069 set $varname;
10070 eval $setvar;
10071 $rm_try tryout.c'
10072
10073 : see if sys/types.h has to be included
10074 set sys/types.h i_systypes
10075 eval $inhdr
10076
10077 : see if sys/select.h has to be included
10078 set sys/select.h i_sysselct
10079 eval $inhdr
10080
10081 : Define hasfield macro for Configure internal use
10082 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10083 while $test $# -ge 2; do
10084         case "$1" in
10085         $define) echo "#include <$2>";;
10086         esac ;
10087     shift 2;
10088 done > try.c;
10089 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10090 set try;
10091 if eval $compile; then
10092         val="$define";
10093 else
10094         val="$undef";
10095 fi;
10096 set $varname;
10097 eval $setvar;
10098 $rm_try'
10099
10100 : see if we should include time.h, sys/time.h, or both
10101 echo " "
10102 if test "X$timeincl" = X; then
10103         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10104         $echo $n "I'm now running the test program...$c"
10105         $cat >try.c <<EOCP
10106 #include <sys/types.h>
10107 #ifdef I_TIME
10108 #include <time.h>
10109 #endif
10110 #ifdef I_SYSTIME
10111 #ifdef SYSTIMEKERNEL
10112 #define KERNEL
10113 #endif
10114 #include <sys/time.h>
10115 #endif
10116 #ifdef I_SYSSELECT
10117 #include <sys/select.h>
10118 #endif
10119 #$i_stdlib I_STDLIB
10120 #ifdef I_STDLIB
10121 #include <stdlib.h>
10122 #endif
10123 int main()
10124 {
10125         struct tm foo;
10126 #ifdef S_TIMEVAL
10127         struct timeval bar;
10128 #endif
10129 #ifdef S_TIMEZONE
10130         struct timezone tzp;
10131 #endif
10132         if (foo.tm_sec == foo.tm_sec)
10133                 exit(0);
10134 #ifdef S_TIMEVAL
10135         if (bar.tv_sec == bar.tv_sec)
10136                 exit(0);
10137 #endif
10138         exit(1);
10139 }
10140 EOCP
10141         flags=''
10142         for s_timezone in '-DS_TIMEZONE' ''; do
10143         sysselect=''
10144         for s_timeval in '-DS_TIMEVAL' ''; do
10145         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10146         for i_time in '' '-DI_TIME'; do
10147         for i_systime in '-DI_SYSTIME' ''; do
10148                 case "$flags" in
10149                 '') $echo $n ".$c"
10150                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10151                         if eval $compile; then
10152                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10153                                 shift
10154                                 flags="$*"
10155                                 echo " "
10156                                 $echo $n "Succeeded with $flags$c"
10157                         fi
10158                         ;;
10159                 esac
10160         done
10161         done
10162         done
10163         done
10164         done
10165         timeincl=''
10166         echo " "
10167         case "$flags" in
10168         *SYSTIMEKERNEL*) i_systimek="$define"
10169                 timeincl=`./findhdr sys/time.h`
10170                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10171         *) i_systimek="$undef";;
10172         esac
10173         case "$flags" in
10174         *I_TIME*) i_time="$define"
10175                 timeincl=`./findhdr time.h`" $timeincl"
10176                 echo "We'll include <time.h>." >&4;;
10177         *) i_time="$undef";;
10178         esac
10179         case "$flags" in
10180         *I_SYSTIME*) i_systime="$define"
10181                 timeincl=`./findhdr sys/time.h`" $timeincl"
10182                 echo "We'll include <sys/time.h>." >&4;;
10183         *) i_systime="$undef";;
10184         esac
10185         $rm_try
10186 fi
10187 : see if struct tm knows about tm_zone
10188 case "$i_systime$i_time" in
10189 *$define*)
10190         echo " "
10191         echo "Checking to see if your struct tm has tm_zone field..." >&4
10192         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10193         eval $hasfield
10194         ;;
10195 *)      val="$undef"
10196         set d_tm_tm_zone
10197         eval $setvar
10198         ;;
10199 esac
10200 case "$d_tm_tm_zone" in
10201 "$define")      echo "Yes, it does."   ;;
10202 *)              echo "No, it doesn't." ;;
10203 esac
10204 : see if struct tm knows about tm_gmtoff
10205 case "$i_systime$i_time" in
10206 *$define*)
10207         echo " "
10208         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10209         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10210         eval $hasfield
10211         ;;
10212 *)      val="$undef"
10213         set d_tm_tm_gmtoff
10214         eval $setvar
10215         ;;
10216 esac
10217 case "$d_tm_tm_gmtoff" in
10218 "$define")      echo "Yes, it does."   ;;
10219 *)              echo "No, it doesn't." ;;
10220 esac
10221
10222 : see if asctime_r exists
10223 set asctime_r d_asctime_r
10224 eval $inlibc
10225 case "$d_asctime_r" in
10226 "$define")
10227         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10228         case "$d_asctime_r_proto:$usethreads" in
10229         ":define")      d_asctime_r_proto=define
10230                 set d_asctime_r_proto asctime_r $hdrs
10231                 eval $hasproto ;;
10232         *)      ;;
10233         esac
10234         case "$d_asctime_r_proto" in
10235         define)
10236         case "$asctime_r_proto" in
10237         ''|0) try='char* asctime_r(const struct tm*, char*);'
10238         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10239         esac
10240         case "$asctime_r_proto" in
10241         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10242         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10243         esac
10244         case "$asctime_r_proto" in
10245         ''|0) try='int asctime_r(const struct tm*, char*);'
10246         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10247         esac
10248         case "$asctime_r_proto" in
10249         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10250         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10251         esac
10252         case "$asctime_r_proto" in
10253         ''|0)   d_asctime_r=undef
10254                 asctime_r_proto=0
10255                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10256         * )     case "$asctime_r_proto" in
10257                 REENTRANT_PROTO*) ;;
10258                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10259                 esac
10260                 echo "Prototype: $try" ;;
10261         esac
10262         ;;
10263         *)      case "$usethreads" in
10264                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10265                 esac
10266                 d_asctime_r=undef
10267                 asctime_r_proto=0
10268                 ;;
10269         esac
10270         ;;
10271 *)      asctime_r_proto=0
10272         ;;
10273 esac
10274
10275 : see if atolf exists
10276 set atolf d_atolf
10277 eval $inlibc
10278
10279 : see if atoll exists
10280 set atoll d_atoll
10281 eval $inlibc
10282
10283 : Look for GCC-style attribute format
10284 case "$d_attribute_format" in
10285 '')
10286 echo " "
10287 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10288 $cat >attrib.c <<'EOCP'
10289 #include <stdio.h>
10290 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10291 EOCP
10292 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10293         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10294                 echo "Your C compiler doesn't support __attribute__((format))."
10295                 val="$undef"
10296         else
10297                 echo "Your C compiler supports __attribute__((format))."
10298                 val="$define"
10299         fi
10300 else
10301         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10302         val="$undef"
10303 fi
10304 ;;
10305 *) val="$d_attribute_format" ;;
10306 esac
10307 set d_attribute_format
10308 eval $setvar
10309 $rm -f attrib*
10310
10311 : Look for GCC-style attribute format with null format allowed
10312 case "$d_printf_format_null" in
10313 '') case "$d_attribute_format" in
10314     $define)
10315         echo " "
10316         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10317 $cat >attrib.c <<EOCP
10318 #include <stdio.h>
10319 #$i_stdlib I_STDLIB
10320 #ifdef I_STDLIB
10321 #include <stdlib.h>
10322 #endif
10323 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10324 int null_printf (char* pat,...) { return (int)pat; }
10325 int main () { exit(null_printf(NULL)); }
10326 EOCP
10327         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10328             : run the executable in case it produces a run-time warning
10329             if $run ./attrib >>attrib.out 2>&1; then
10330                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10331                     echo "Your C compiler doesn't allow __printf__ format to be null."
10332                     val="$undef"
10333                 else
10334                     echo "Your C compiler allows __printf__ format to be null."
10335                     val="$define"
10336                 fi
10337             else
10338             echo "Your C compiler executable failed with __printf__ format null."
10339             val="$undef"
10340         fi
10341     else
10342         echo "Your C compiler fails with __printf__ format null."
10343         val="$undef"
10344     fi
10345     ;;
10346     *)  val="$undef" ;;
10347     esac
10348 ;;
10349 *)  val="$d_printf_format_null" ;;
10350 esac
10351 set d_printf_format_null
10352 eval $setvar
10353 $rm -f attrib*
10354
10355 : Look for GCC-style attribute malloc
10356 case "$d_attribute_malloc" in
10357 '')
10358 echo " "
10359 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10360 $cat >attrib.c <<'EOCP'
10361 #include <stdio.h>
10362 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10363 EOCP
10364 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10365         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10366                 echo "Your C compiler doesn't support __attribute__((malloc))."
10367                 val="$undef"
10368         else
10369                 echo "Your C compiler supports __attribute__((malloc))."
10370                 val="$define"
10371         fi
10372 else
10373         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10374         val="$undef"
10375 fi
10376 ;;
10377 *) val="$d_attribute_malloc" ;;
10378 esac
10379 set d_attribute_malloc
10380 eval $setvar
10381 $rm -f attrib*
10382
10383 : Look for GCC-style attribute nonnull
10384 case "$d_attribute_nonnull" in
10385 '')
10386 echo " "
10387 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10388 $cat >attrib.c <<'EOCP'
10389 #include <stdio.h>
10390 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10391 EOCP
10392 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10393         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10394                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10395                 val="$undef"
10396         else
10397                 echo "Your C compiler supports __attribute__((nonnull))."
10398                 val="$define"
10399         fi
10400 else
10401         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10402         val="$undef"
10403 fi
10404 ;;
10405 *) val="$d_attribute_nonnull" ;;
10406 esac
10407 set d_attribute_nonnull
10408 eval $setvar
10409 $rm -f attrib*
10410
10411 : Look for GCC-style attribute noreturn
10412 case "$d_attribute_noreturn" in
10413 '')
10414 echo " "
10415 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10416 $cat >attrib.c <<'EOCP'
10417 #include <stdio.h>
10418 void fall_over_dead( void ) __attribute__((noreturn));
10419 EOCP
10420 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10421         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10422                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10423                 val="$undef"
10424         else
10425                 echo "Your C compiler supports __attribute__((noreturn))."
10426                 val="$define"
10427         fi
10428 else
10429         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10430         val="$undef"
10431 fi
10432 ;;
10433 *) val="$d_attribute_noreturn" ;;
10434 esac
10435 set d_attribute_noreturn
10436 eval $setvar
10437 $rm -f attrib*
10438
10439 : Look for GCC-style attribute pure
10440 case "$d_attribute_pure" in
10441 '')
10442 echo " "
10443 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10444 $cat >attrib.c <<'EOCP'
10445 #include <stdio.h>
10446 int square( int n ) __attribute__((pure));
10447 EOCP
10448 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10449         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10450                 echo "Your C compiler doesn't support __attribute__((pure))."
10451                 val="$undef"
10452         else
10453                 echo "Your C compiler supports __attribute__((pure))."
10454                 val="$define"
10455         fi
10456 else
10457         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10458         val="$undef"
10459 fi
10460 ;;
10461 *) val="$d_attribute_pure" ;;
10462 esac
10463 set d_attribute_pure
10464 eval $setvar
10465 $rm -f attrib*
10466
10467 : Look for GCC-style attribute unused
10468 case "$d_attribute_unused" in
10469 '')
10470 echo " "
10471 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10472 $cat >attrib.c <<'EOCP'
10473 #include <stdio.h>
10474 int do_something( int dummy __attribute__((unused)), int n );
10475 EOCP
10476 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10477         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10478                 echo "Your C compiler doesn't support __attribute__((unused))."
10479                 val="$undef"
10480         else
10481                 echo "Your C compiler supports __attribute__((unused))."
10482                 val="$define"
10483         fi
10484 else
10485         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10486         val="$undef"
10487 fi
10488 ;;
10489 *) val="$d_attribute_unused" ;;
10490 esac
10491 set d_attribute_unused
10492 eval $setvar
10493 $rm -f attrib*
10494
10495 : Look for GCC-style attribute warn_unused_result
10496 case "$d_attribute_warn_unused_result" in
10497 '')
10498 echo " "
10499 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10500 $cat >attrib.c <<'EOCP'
10501 #include <stdio.h>
10502 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10503 EOCP
10504 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10505         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10506                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10507                 val="$undef"
10508         else
10509                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10510                 val="$define"
10511         fi
10512 else
10513         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10514         val="$undef"
10515 fi
10516 ;;
10517 *) val="$d_attribute_warn_unused_result" ;;
10518 esac
10519 set d_attribute_warn_unused_result
10520 eval $setvar
10521 $rm -f attrib*
10522
10523 : see if bcmp exists
10524 set bcmp d_bcmp
10525 eval $inlibc
10526
10527 : see if bcopy exists
10528 set bcopy d_bcopy
10529 eval $inlibc
10530
10531 : see if getpgrp exists
10532 set getpgrp d_getpgrp
10533 eval $inlibc
10534
10535 case "$d_getpgrp" in
10536 "$define")
10537         echo " "
10538         echo "Checking to see which flavor of getpgrp is in use..."
10539         $cat >try.c <<EOP
10540 #$i_unistd I_UNISTD
10541 #include <sys/types.h>
10542 #ifdef I_UNISTD
10543 #  include <unistd.h>
10544 #endif
10545 #$i_stdlib I_STDLIB
10546 #ifdef I_STDLIB
10547 #include <stdlib.h>
10548 #endif
10549 int main()
10550 {
10551         if (getuid() == 0) {
10552                 printf("(I see you are running Configure as super-user...)\n");
10553                 setuid(1);
10554         }
10555 #ifdef TRY_BSD_PGRP
10556         if (getpgrp(1) == 0)
10557                 exit(0);
10558 #else
10559         if (getpgrp() > 0)
10560                 exit(0);
10561 #endif
10562         exit(1);
10563 }
10564 EOP
10565         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10566                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10567                 val="$define"
10568         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10569                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10570                 val="$undef"
10571         else
10572                 echo "I can't seem to compile and run the test program."
10573                 if ./usg; then
10574                         xxx="a USG one, i.e. you use getpgrp()."
10575                 else
10576                         # SVR4 systems can appear rather BSD-ish.
10577                         case "$i_unistd" in
10578                         $undef)
10579                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10580                                 val="$define"
10581                                 ;;
10582                         $define)
10583                                 xxx="probably a USG one, i.e. you use getpgrp()."
10584                                 val="$undef"
10585                                 ;;
10586                         esac
10587                 fi
10588                 echo "Assuming your getpgrp is $xxx" >&4
10589         fi
10590         ;;
10591 *) val="$undef";;
10592 esac
10593 set d_bsdgetpgrp
10594 eval $setvar
10595 $rm_try
10596
10597 : see if setpgrp exists
10598 set setpgrp d_setpgrp
10599 eval $inlibc
10600
10601 case "$d_setpgrp" in
10602 "$define")
10603         echo " "
10604         echo "Checking to see which flavor of setpgrp is in use..."
10605         $cat >try.c <<EOP
10606 #$i_unistd I_UNISTD
10607 #include <sys/types.h>
10608 #ifdef I_UNISTD
10609 #  include <unistd.h>
10610 #endif
10611 #$i_stdlib I_STDLIB
10612 #ifdef I_STDLIB
10613 #include <stdlib.h>
10614 #endif
10615 int main()
10616 {
10617         if (getuid() == 0) {
10618                 printf("(I see you are running Configure as super-user...)\n");
10619                 setuid(1);
10620         }
10621 #ifdef TRY_BSD_PGRP
10622         if (-1 == setpgrp(1, 1))
10623                 exit(0);
10624 #else
10625         if (setpgrp() != -1)
10626                 exit(0);
10627 #endif
10628         exit(1);
10629 }
10630 EOP
10631         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10632                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10633                 val="$define"
10634         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10635                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10636                 val="$undef"
10637         else
10638                 echo "(I can't seem to compile and run the test program.)"
10639                 if ./usg; then
10640                         xxx="a USG one, i.e. you use setpgrp()."
10641                 else
10642                         # SVR4 systems can appear rather BSD-ish.
10643                         case "$i_unistd" in
10644                         $undef)
10645                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10646                                 val="$define"
10647                                 ;;
10648                         $define)
10649                                 xxx="probably a USG one, i.e. you use setpgrp()."
10650                                 val="$undef"
10651                                 ;;
10652                         esac
10653                 fi
10654                 echo "Assuming your setpgrp is $xxx" >&4
10655         fi
10656         ;;
10657 *) val="$undef";;
10658 esac
10659 set d_bsdsetpgrp
10660 eval $setvar
10661 $rm_try
10662
10663 : Look for GCC-style __builtin_choose_expr
10664 case "$d_builtin_choose_expr" in
10665 '')
10666     echo " "
10667     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10668     $cat >try.c <<'EOCP'
10669 #include <assert.h>
10670 #include <stdlib.h>
10671 #include <stdio.h>
10672
10673 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10674
10675 int main(void) {
10676     assert( SYRINX(1) == 2112 );
10677     assert( SYRINX(1) != 5150 );
10678     assert( SYRINX(0) == 5150 );
10679     assert( SYRINX(0) != 2112 );
10680     puts( "All good!" );
10681     exit(0);
10682 }
10683
10684 EOCP
10685     set try
10686     if eval $compile && $run ./try; then
10687         echo "Your C compiler supports __builtin_choose_expr."
10688         val="$define"
10689     else
10690         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10691         val="$undef"
10692     fi
10693 ;;
10694 *) val="$d_builtin_choose_expr" ;;
10695 esac
10696
10697 set d_builtin_choose_expr
10698 eval $setvar
10699 $rm_try
10700
10701 : Look for GCC-style __builtin_expect
10702 case "$d_builtin_expect" in
10703 '')
10704     echo " "
10705     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10706     $cat >try.c <<'EOCP'
10707 int main(void) {
10708     int n = 50;
10709     if ( __builtin_expect(n, 0) ) n = 1;
10710     /* Remember shell exit code truth is 0, C truth is non-zero */
10711     return !(n == 1);
10712 }
10713 EOCP
10714     set try
10715     if eval $compile && $run ./try; then
10716         echo "Your C compiler supports __builtin_expect."
10717         val="$define"
10718     else
10719         echo "Your C compiler doesn't seem to understand __builtin_expect."
10720         val="$undef"
10721     fi
10722     ;;
10723 *) val="$d_builtin_expect" ;;
10724 esac
10725
10726 set d_builtin_expect
10727 eval $setvar
10728 $rm_try
10729
10730 : see if bzero exists
10731 set bzero d_bzero
10732 eval $inlibc
10733
10734 : see if stdarg is available
10735 echo " "
10736 if $test `./findhdr stdarg.h`; then
10737         echo "<stdarg.h> found." >&4
10738         valstd="$define"
10739 else
10740         echo "<stdarg.h> NOT found." >&4
10741         valstd="$undef"
10742 fi
10743
10744 : see if varags is available
10745 echo " "
10746 if $test `./findhdr varargs.h`; then
10747         echo "<varargs.h> found." >&4
10748 else
10749         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10750 fi
10751
10752 : set up the varargs testing programs
10753 $cat > varargs.c <<EOP
10754 #ifdef I_STDARG
10755 #include <stdarg.h>
10756 #endif
10757 #ifdef I_VARARGS
10758 #include <varargs.h>
10759 #endif
10760
10761 #ifdef I_STDARG
10762 int f(char *p, ...)
10763 #else
10764 int f(va_alist)
10765 va_dcl
10766 #endif
10767 {
10768         va_list ap;
10769 #ifndef I_STDARG
10770         char *p;
10771 #endif
10772 #ifdef I_STDARG
10773         va_start(ap,p);
10774 #else
10775         va_start(ap);
10776         p = va_arg(ap, char *);
10777 #endif
10778         va_end(ap);
10779         return 0;
10780 }
10781 EOP
10782 $cat > varargs <<EOP
10783 $startsh
10784 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10785         echo "true"
10786 else
10787         echo "false"
10788 fi
10789 $rm -f varargs$_o
10790 EOP
10791 chmod +x varargs
10792
10793 : now check which varargs header should be included
10794 echo " "
10795 i_varhdr=''
10796 case "$valstd" in
10797 "$define")
10798         if `./varargs I_STDARG`; then
10799                 val='stdarg.h'
10800         elif `./varargs I_VARARGS`; then
10801                 val='varargs.h'
10802         fi
10803         ;;
10804 *)
10805         if `./varargs I_VARARGS`; then
10806                 val='varargs.h'
10807         fi
10808         ;;
10809 esac
10810 case "$val" in
10811 '')
10812 echo "I could not find the definition for va_dcl... You have problems..." >&4
10813         val="$undef"; set i_stdarg; eval $setvar
10814         val="$undef"; set i_varargs; eval $setvar
10815         ;;
10816 *)
10817         set i_varhdr
10818         eval $setvar
10819         case "$i_varhdr" in
10820         stdarg.h)
10821                 val="$define"; set i_stdarg; eval $setvar
10822                 val="$undef"; set i_varargs; eval $setvar
10823                 ;;
10824         varargs.h)
10825                 val="$undef"; set i_stdarg; eval $setvar
10826                 val="$define"; set i_varargs; eval $setvar
10827                 ;;
10828         esac
10829         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10830 esac
10831 $rm -f varargs*
10832
10833 : see if the Compiler supports C99 variadic macros
10834 case "$i_stdarg$i_stdlib" in
10835     "$define$define")
10836     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10837     $cat >try.c <<EOCP
10838 #include <stdio.h>
10839 #include <stdarg.h>
10840
10841 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10842
10843 int main() {
10844   char buf[20];
10845   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10846   puts(buf);
10847   return 0;
10848 }
10849 EOCP
10850     set try
10851     if eval $compile && $run ./try 2>&1 >/dev/null; then
10852         case "`$run ./try`" in
10853             "123 456 789")
10854             echo "You have C99 variadic macros." >&4
10855             d_c99_variadic_macros="$define"
10856             ;;
10857             *)
10858             echo "You don't have functional C99 variadic macros." >&4
10859             d_c99_variadic_macros="$undef"
10860             ;;
10861         esac
10862     else
10863         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10864         d_c99_variadic_macros="$undef"
10865     fi
10866     $rm_try
10867     ;;
10868     *)
10869     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10870     d_c99_variadic_macros="$undef"
10871     ;;
10872 esac
10873
10874 : see if signal is declared as pointer to function returning int or void
10875 echo " "
10876 xxx=`./findhdr signal.h`
10877 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10878 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10879         echo "You have int (*signal())() instead of void." >&4
10880         val="$undef"
10881 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10882         echo "You have void (*signal())()." >&4
10883         val="$define"
10884 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10885         echo "You have int (*signal())() instead of void." >&4
10886         val="$undef"
10887 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10888         echo "You have void (*signal())()." >&4
10889         val="$define"
10890 else
10891         case "$d_voidsig" in
10892         '')
10893         echo "I can't determine whether signal handler returns void or int..." >&4
10894                 dflt=void
10895                 rp="What type does your signal handler return?"
10896                 . ./myread
10897                 case "$ans" in
10898                 v*) val="$define";;
10899                 *) val="$undef";;
10900                 esac;;
10901         "$define")
10902                 echo "As you already told me, signal handler returns void." >&4
10903                 val="$define"
10904                 ;;
10905         *)      echo "As you already told me, signal handler returns int." >&4
10906                 val="$undef"
10907                 ;;
10908         esac
10909 fi
10910 set d_voidsig
10911 eval $setvar
10912 case "$d_voidsig" in
10913 "$define") signal_t="void";;
10914 *) signal_t="int";;
10915 esac
10916 $rm -f $$.tmp
10917
10918 : check for ability to cast large floats to 32-bit ints.
10919 echo " "
10920 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10921 if $test "$intsize" -ge 4; then
10922         xxx=int
10923 else
10924         xxx=long
10925 fi
10926 $cat >try.c <<EOCP
10927 #include <stdio.h>
10928 #$i_stdlib I_STDLIB
10929 #ifdef I_STDLIB
10930 #include <stdlib.h>
10931 #endif
10932 #include <sys/types.h>
10933 #include <signal.h>
10934 $signal_t blech(int s) { exit(3); }
10935 int main()
10936 {
10937         $xxx i32;
10938         double f, g;
10939         int result = 0;
10940         char str[16];
10941         signal(SIGFPE, blech);
10942
10943         /* Don't let compiler optimize the test away.  Store the number
10944            in a writable string for gcc to pass to sscanf under HP/UX.
10945         */
10946         sprintf(str, "2147483647");
10947         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10948         g = 10 * f;
10949         i32  = ($xxx) g;
10950
10951         /* x86 processors will probably give 0x8000 0000, which is a
10952            sign change.  We don't want that.  We want to mimic SPARC
10953            behavior here, which is to preserve the sign and give
10954            back 0x7fff ffff.
10955         */
10956         if (i32 != ($xxx) f)
10957                 result |= 1;
10958         exit(result);
10959 }
10960 EOCP
10961 set try
10962 if eval $compile_ok; then
10963         $run ./try
10964         yyy=$?
10965 else
10966         echo "(I can't seem to compile the test program--assuming it can't)"
10967         yyy=1
10968 fi
10969 case "$yyy" in
10970 0)      val="$define"
10971         echo "Yup, it can."
10972         ;;
10973 *)      val="$undef"
10974         echo "Nope, it can't."
10975         ;;
10976 esac
10977 set d_casti32
10978 eval $setvar
10979 $rm_try
10980
10981 : check for ability to cast negative floats to unsigned
10982 echo " "
10983 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10984 $cat >try.c <<EOCP
10985 #include <stdio.h>
10986 #$i_stdlib I_STDLIB
10987 #ifdef I_STDLIB
10988 #include <stdlib.h>
10989 #endif
10990 #include <sys/types.h>
10991 #include <signal.h>
10992 $signal_t blech(int s) { exit(7); }
10993 $signal_t blech_in_list(int s) { exit(4); }
10994 unsigned long dummy_long(unsigned long p) { return p; }
10995 unsigned int dummy_int(unsigned int p) { return p; }
10996 unsigned short dummy_short(unsigned short p) { return p; }
10997 int main()
10998 {
10999         double f;
11000         unsigned long along;
11001         unsigned int aint;
11002         unsigned short ashort;
11003         int result = 0;
11004         char str[16];
11005
11006         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11007            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11008            optimized the whole file away
11009         */
11010         /* Store the number in a writable string for gcc to pass to
11011            sscanf under HP/UX.
11012         */
11013         sprintf(str, "-123");
11014         sscanf(str, "%lf", &f);  /* f = -123.; */
11015
11016         signal(SIGFPE, blech);
11017         along = (unsigned long)f;
11018         aint = (unsigned int)f;
11019         ashort = (unsigned short)f;
11020         if (along != (unsigned long)-123)
11021                 result |= 1;
11022         if (aint != (unsigned int)-123)
11023                 result |= 1;
11024         if (ashort != (unsigned short)-123)
11025                 result |= 1;
11026         sprintf(str, "1073741824.");
11027         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11028         f = f + f;
11029         along = 0;
11030         along = (unsigned long)f;
11031         if (along != 0x80000000)
11032                 result |= 2;
11033         f -= 1.;
11034         along = 0;
11035         along = (unsigned long)f;
11036         if (along != 0x7fffffff)
11037                 result |= 1;
11038         f += 2.;
11039         along = 0;
11040         along = (unsigned long)f;
11041         if (along != 0x80000001)
11042                 result |= 2;
11043         if (result)
11044                 exit(result);
11045         signal(SIGFPE, blech_in_list);
11046         sprintf(str, "123.");
11047         sscanf(str, "%lf", &f);  /* f = 123.; */
11048         along = dummy_long((unsigned long)f);
11049         aint = dummy_int((unsigned int)f);
11050         ashort = dummy_short((unsigned short)f);
11051         if (along != (unsigned long)123)
11052                 result |= 4;
11053         if (aint != (unsigned int)123)
11054                 result |= 4;
11055         if (ashort != (unsigned short)123)
11056                 result |= 4;
11057         exit(result);
11058
11059 }
11060 EOCP
11061 set try
11062 if eval $compile_ok; then
11063         $run ./try
11064         castflags=$?
11065 else
11066         echo "(I can't seem to compile the test program--assuming it can't)"
11067         castflags=7
11068 fi
11069 case "$castflags" in
11070 0)      val="$define"
11071         echo "Yup, it can."
11072         ;;
11073 *)      val="$undef"
11074         echo "Nope, it can't."
11075         ;;
11076 esac
11077 set d_castneg
11078 eval $setvar
11079 $rm_try
11080
11081 : see if vprintf exists
11082 echo " "
11083 if set vprintf val -f d_vprintf; eval $csym; $val; then
11084         echo 'vprintf() found.' >&4
11085         val="$define"
11086         $cat >try.c <<EOF
11087 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11088 #$i_varargs I_VARARGS
11089
11090 #$i_stdlib I_STDLIB
11091 #$i_unistd I_UNISTD
11092
11093 #ifdef I_STDARG
11094 #  include <stdarg.h>
11095 #else /* I_VARARGS */
11096 #  include <varargs.h>
11097 #endif
11098
11099 #ifdef I_UNISTD
11100 #  include <unistd.h>
11101 #endif
11102
11103 #ifdef I_STDLIB
11104 #  include <stdlib.h>
11105 #endif
11106
11107 #include <stdio.h> /* vsprintf prototype */
11108
11109 #ifdef I_STDARG
11110 void xxx(int n, ...)
11111 {
11112     va_list args;
11113     char buf[10];
11114     va_start(args, n);
11115     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11116 }
11117 int main() { xxx(1, "foo"); }
11118
11119 #else /* I_VARARGS */
11120
11121 xxx(va_alist)
11122 va_dcl
11123 {
11124     va_list args;
11125     char buf[10];
11126     va_start(args);
11127     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11128 }
11129 int main() { xxx("foo"); }
11130
11131 #endif
11132
11133 EOF
11134         set try
11135         if eval $compile_ok; then
11136                 if $run ./try; then
11137                         echo "Your vsprintf() returns (int)." >&4
11138                         val2="$undef"
11139                 else
11140                         echo "Your vsprintf() returns (char*)." >&4
11141                         val2="$define"
11142                 fi
11143         else
11144                 echo 'I am unable to compile the vsprintf() test program.' >&4
11145                 # We shouldn't get here.  If we do, assume the standard signature,
11146                 # not the old BSD one.
11147                 echo 'Guessing that vsprintf() returns (int).' >&4
11148                 val2="$undef"
11149         fi
11150 else
11151         echo 'vprintf() NOT found.' >&4
11152         val="$undef"
11153         val2="$undef"
11154 fi
11155 $rm_try
11156 set d_vprintf
11157 eval $setvar
11158 val=$val2
11159 set d_charvspr
11160 eval $setvar
11161
11162 : see if chown exists
11163 set chown d_chown
11164 eval $inlibc
11165
11166 : see if chroot exists
11167 set chroot d_chroot
11168 eval $inlibc
11169
11170 : see if chsize exists
11171 set chsize d_chsize
11172 eval $inlibc
11173
11174 : see if class exists
11175 set class d_class
11176 eval $inlibc
11177
11178 : see if clearenv exists
11179 set clearenv d_clearenv
11180 eval $inlibc
11181
11182 : Define hasstruct macro for Configure internal use
11183 hasstruct='varname=$1; struct=$2; shift; shift;
11184 while $test $# -ge 2; do
11185         case "$1" in
11186         $define) echo "#include <$2>";;
11187         esac ;
11188     shift 2;
11189 done > try.c;
11190 echo "int main () { struct $struct foo; }" >> try.c;
11191 set try;
11192 if eval $compile; then
11193         val="$define";
11194 else
11195         val="$undef";
11196 fi;
11197 set $varname;
11198 eval $setvar;
11199 $rm_try'
11200
11201 : see whether socket exists
11202 socketlib=''
11203 sockethdr=''
11204 echo " "
11205 $echo $n "Hmm... $c" >&4
11206 if set socket val -f d_socket; eval $csym; $val; then
11207         echo "Looks like you have Berkeley networking support." >&4
11208         d_socket="$define"
11209         if set setsockopt val -f; eval $csym; $val; then
11210                 d_oldsock="$undef"
11211         else
11212                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11213                 d_oldsock="$define"
11214         fi
11215 else
11216         if $contains socklib libc.list >/dev/null 2>&1; then
11217                 echo "Looks like you have Berkeley networking support." >&4
11218                 d_socket="$define"
11219                 : we will have to assume that it supports the 4.2 BSD interface
11220                 d_oldsock="$undef"
11221         else
11222                 echo "You don't have Berkeley networking in libc$_a..." >&4
11223                 if test "X$d_socket" = "X$define"; then
11224                    echo "...but you seem to believe that you have sockets." >&4
11225                 else
11226                         for net in net socket
11227                         do
11228                                 if test -f /usr/lib/lib$net$_a; then
11229                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11230                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11231                                         if $contains socket libc.list >/dev/null 2>&1; then
11232                                                 d_socket="$define"
11233                                                 socketlib="-l$net"
11234                                                 case "$net" in
11235                                                 net)
11236                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11237                                                         sockethdr="-I/usr/netinclude"
11238                                                         ;;
11239                                                 esac
11240                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11241                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11242                                                         d_oldsock="$undef"
11243                                                 else
11244                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11245                                                         d_oldsock="$define"
11246                                                 fi
11247                                                 break
11248                                         fi
11249                                 fi
11250                         done
11251                         if test "X$d_socket" != "X$define"; then
11252                            echo "or anywhere else I see." >&4
11253                            d_socket="$undef"
11254                            d_oldsock="$undef"
11255                         fi
11256                 fi
11257         fi
11258 fi
11259
11260 : see if socketpair exists
11261 set socketpair d_sockpair
11262 eval $inlibc
11263
11264
11265 echo " "
11266 echo "Checking the availability of certain socket constants..." >&4
11267 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11268         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11269         $cat >try.c <<EOF
11270 #include <sys/types.h>
11271 #include <sys/socket.h>
11272 int main() {
11273     int i = $ENUM;
11274 }
11275 EOF
11276         val="$undef"
11277         set try; if eval $compile; then
11278                 val="$define"
11279         fi
11280         set d_${enum}; eval $setvar
11281         $rm_try
11282 done
11283
11284 : see if this is a sys/uio.h system
11285 set sys/uio.h i_sysuio
11286 eval $inhdr
11287
11288 : Check for cmsghdr support
11289 echo " "
11290 echo "Checking to see if your system supports struct cmsghdr..." >&4
11291 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11292 eval $hasstruct
11293 case "$d_cmsghdr_s" in
11294 "$define")      echo "Yes, it does."   ;;
11295 *)              echo "No, it doesn't." ;;
11296 esac
11297
11298
11299 : check for const keyword
11300 echo " "
11301 echo 'Checking to see if your C compiler knows about "const"...' >&4
11302 $cat >const.c <<'EOCP'
11303 typedef struct spug { int drokk; } spug;
11304 int main()
11305 {
11306         const char *foo;
11307         const spug y = { 0 };
11308 }
11309 EOCP
11310 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11311         val="$define"
11312         echo "Yup, it does."
11313 else
11314         val="$undef"
11315         echo "Nope, it doesn't."
11316 fi
11317 set d_const
11318 eval $setvar
11319
11320 : see if copysignl exists
11321 set copysignl d_copysignl
11322 eval $inlibc
11323
11324 : see if crypt exists
11325 echo " "
11326 set crypt d_crypt
11327 eval $inlibc
11328 case "$d_crypt" in
11329 $define) cryptlib='' ;;
11330 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11331                 echo 'crypt() found.' >&4
11332                 val="$define"
11333                 cryptlib=''
11334         else
11335                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11336                 if $test -z "$cryptlib"; then
11337                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11338                 else
11339                         cryptlib=-lcrypt
11340                 fi
11341                 if $test -z "$cryptlib"; then
11342                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11343                 else
11344                         cryptlib=-lcrypt
11345                 fi
11346                 if $test -z "$cryptlib"; then
11347                         cryptlib=`./loc libcrypt$_a "" $libpth`
11348                 else
11349                         cryptlib=-lcrypt
11350                 fi
11351                 if $test -z "$cryptlib"; then
11352                         echo 'crypt() NOT found.' >&4
11353                         val="$undef"
11354                 else
11355                         val="$define"
11356                 fi
11357         fi
11358         set d_crypt
11359         eval $setvar
11360         ;;
11361 esac
11362
11363 : see if this is a crypt.h system
11364 set crypt.h i_crypt
11365 eval $inhdr
11366
11367 : see if crypt_r exists
11368 set crypt_r d_crypt_r
11369 eval $inlibc
11370 case "$d_crypt_r" in
11371 "$define")
11372         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11373         case "$d_crypt_r_proto:$usethreads" in
11374         ":define")      d_crypt_r_proto=define
11375                 set d_crypt_r_proto crypt_r $hdrs
11376                 eval $hasproto ;;
11377         *)      ;;
11378         esac
11379         case "$d_crypt_r_proto" in
11380         define)
11381         case "$crypt_r_proto" in
11382         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11383         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11384         esac
11385         case "$crypt_r_proto" in
11386         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11387         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11388         esac
11389         case "$crypt_r_proto" in
11390         ''|0)   d_crypt_r=undef
11391                 crypt_r_proto=0
11392                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11393         * )     case "$crypt_r_proto" in
11394                 REENTRANT_PROTO*) ;;
11395                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11396                 esac
11397                 echo "Prototype: $try" ;;
11398         esac
11399         ;;
11400         *)      case "$usethreads" in
11401                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11402                 esac
11403                 d_crypt_r=undef
11404                 crypt_r_proto=0
11405                 ;;
11406         esac
11407         ;;
11408 *)      crypt_r_proto=0
11409         ;;
11410 esac
11411
11412 : get csh whereabouts
11413 case "$csh" in
11414 'csh') val="$undef" ;;
11415 *) val="$define" ;;
11416 esac
11417 set d_csh
11418 eval $setvar
11419 : Respect a hint or command line value for full_csh.
11420 case "$full_csh" in
11421 '') full_csh=$csh ;;
11422 esac
11423
11424 : see if ctermid exists
11425 set ctermid d_ctermid
11426 eval $inlibc
11427
11428 : see if ctermid_r exists
11429 set ctermid_r d_ctermid_r
11430 eval $inlibc
11431 case "$d_ctermid_r" in
11432 "$define")
11433         hdrs="$i_systypes sys/types.h define stdio.h "
11434         case "$d_ctermid_r_proto:$usethreads" in
11435         ":define")      d_ctermid_r_proto=define
11436                 set d_ctermid_r_proto ctermid_r $hdrs
11437                 eval $hasproto ;;
11438         *)      ;;
11439         esac
11440         case "$d_ctermid_r_proto" in
11441         define)
11442         case "$ctermid_r_proto" in
11443         ''|0) try='char* ctermid_r(char*);'
11444         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11445         esac
11446         case "$ctermid_r_proto" in
11447         ''|0)   d_ctermid_r=undef
11448                 ctermid_r_proto=0
11449                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11450         * )     case "$ctermid_r_proto" in
11451                 REENTRANT_PROTO*) ;;
11452                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11453                 esac
11454                 echo "Prototype: $try" ;;
11455         esac
11456         ;;
11457         *)      case "$usethreads" in
11458                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11459                 esac
11460                 d_ctermid_r=undef
11461                 ctermid_r_proto=0
11462                 ;;
11463         esac
11464         ;;
11465 *)      ctermid_r_proto=0
11466         ;;
11467 esac
11468
11469 : see if ctime_r exists
11470 set ctime_r d_ctime_r
11471 eval $inlibc
11472 case "$d_ctime_r" in
11473 "$define")
11474         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11475         case "$d_ctime_r_proto:$usethreads" in
11476         ":define")      d_ctime_r_proto=define
11477                 set d_ctime_r_proto ctime_r $hdrs
11478                 eval $hasproto ;;
11479         *)      ;;
11480         esac
11481         case "$d_ctime_r_proto" in
11482         define)
11483         case "$ctime_r_proto" in
11484         ''|0) try='char* ctime_r(const time_t*, char*);'
11485         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11486         esac
11487         case "$ctime_r_proto" in
11488         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11489         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11490         esac
11491         case "$ctime_r_proto" in
11492         ''|0) try='int ctime_r(const time_t*, char*);'
11493         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11494         esac
11495         case "$ctime_r_proto" in
11496         ''|0) try='int ctime_r(const time_t*, char*, int);'
11497         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11498         esac
11499         case "$ctime_r_proto" in
11500         ''|0)   d_ctime_r=undef
11501                 ctime_r_proto=0
11502                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11503         * )     case "$ctime_r_proto" in
11504                 REENTRANT_PROTO*) ;;
11505                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11506                 esac
11507                 echo "Prototype: $try" ;;
11508         esac
11509         ;;
11510         *)      case "$usethreads" in
11511                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11512                 esac
11513                 d_ctime_r=undef
11514                 ctime_r_proto=0
11515                 ;;
11516         esac
11517         ;;
11518 *)      ctime_r_proto=0
11519         ;;
11520 esac
11521
11522 : see if cuserid exists
11523 set cuserid d_cuserid
11524 eval $inlibc
11525
11526 : see if this is a limits.h system
11527 set limits.h i_limits
11528 eval $inhdr
11529
11530 : see if this is a float.h system
11531 set float.h i_float
11532 eval $inhdr
11533
11534 : See if number of significant digits in a double precision number is known
11535 echo " "
11536 $cat >dbl_dig.c <<EOM
11537 #$i_limits I_LIMITS
11538 #$i_float I_FLOAT
11539 #ifdef I_LIMITS
11540 #include <limits.h>
11541 #endif
11542 #ifdef I_FLOAT
11543 #include <float.h>
11544 #endif
11545 #ifdef DBL_DIG
11546 printf("Contains DBL_DIG");
11547 #endif
11548 EOM
11549 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11550 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11551         echo "DBL_DIG found." >&4
11552         val="$define"
11553 else
11554         echo "DBL_DIG NOT found." >&4
11555         val="$undef"
11556 fi
11557 $rm -f dbl_dig.?
11558 set d_dbl_dig
11559 eval $setvar
11560
11561 : see if dbm.h is available
11562 : see if dbmclose exists
11563 set dbmclose d_dbmclose
11564 eval $inlibc
11565
11566 case "$d_dbmclose" in
11567 $define)
11568         set dbm.h i_dbm
11569         eval $inhdr
11570         case "$i_dbm" in
11571         $define)
11572                 val="$undef"
11573                 set i_rpcsvcdbm
11574                 eval $setvar
11575                 ;;
11576         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11577                 eval $inhdr
11578                 ;;
11579         esac
11580         ;;
11581 *)      echo "We won't be including <dbm.h>"
11582         val="$undef"
11583         set i_dbm
11584         eval $setvar
11585         val="$undef"
11586         set i_rpcsvcdbm
11587         eval $setvar
11588         ;;
11589 esac
11590
11591 : see if prototype for dbminit is available
11592 echo " "
11593 set d_dbminitproto dbminit $i_dbm dbm.h
11594 eval $hasproto
11595
11596 : see if difftime exists
11597 set difftime d_difftime
11598 eval $inlibc
11599
11600 : see if this is a dirent system
11601 echo " "
11602 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11603         val="$define"
11604         echo "<dirent.h> found." >&4
11605 else
11606         val="$undef"
11607         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11608                 echo "<sys/dir.h> found." >&4
11609                 echo " "
11610         else
11611                 xinc=`./findhdr sys/ndir.h`
11612         fi
11613         echo "<dirent.h> NOT found." >&4
11614 fi
11615 set i_dirent
11616 eval $setvar
11617
11618 : Look for type of directory structure.
11619 echo " "
11620 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11621
11622 case "$direntrytype" in
11623 ''|' ')
11624         case "$i_dirent" in
11625         $define) guess1='struct dirent' ;;
11626         *) guess1='struct direct'  ;;
11627         esac
11628         ;;
11629 *)      guess1="$direntrytype"
11630         ;;
11631 esac
11632
11633 case "$guess1" in
11634 'struct dirent') guess2='struct direct' ;;
11635 *) guess2='struct dirent' ;;
11636 esac
11637
11638 if $contains "$guess1" try.c >/dev/null 2>&1; then
11639         direntrytype="$guess1"
11640         echo "Your directory entries are $direntrytype." >&4
11641 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11642         direntrytype="$guess2"
11643         echo "Your directory entries seem to be $direntrytype." >&4
11644 else
11645         echo "I don't recognize your system's directory entries." >&4
11646         rp="What type is used for directory entries on this system?"
11647         dflt="$guess1"
11648         . ./myread
11649         direntrytype="$ans"
11650 fi
11651 $rm_try
11652
11653 : see if the directory entry stores field length
11654 echo " "
11655 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11656 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11657         echo "Good, your directory entry keeps length information in d_namlen." >&4
11658         val="$define"
11659 else
11660         echo "Your directory entry does not know about the d_namlen field." >&4
11661         val="$undef"
11662 fi
11663 set d_dirnamlen
11664 eval $setvar
11665 $rm_try
11666
11667 : Look for DIR.dd_fd
11668 case "$i_dirent" in
11669 "$define")
11670     echo "Checking to see if DIR has a dd_fd member variable" >&4
11671     $cat >try.c <<EOCP
11672 #$i_stdlib I_STDLIB
11673 #ifdef I_STDLIB
11674 #include <stdlib.h>
11675 #endif
11676 #include <dirent.h>
11677
11678 int main() {
11679     DIR dir;
11680     dir.dd_fd = 1;
11681     return 0;
11682 }
11683 EOCP
11684     val=$undef
11685     set try
11686     if eval $compile; then
11687         echo "Yes, it does."
11688         val="$define"
11689     else
11690         echo "No, it does not."
11691         val="$undef"
11692     fi
11693     ;;
11694 *)
11695     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11696     val="$undef"
11697     ;;
11698 esac
11699 set d_dir_dd_fd
11700 eval $setvar
11701 $rm_try
11702
11703 : see if this is an sysdir system
11704 set sys/dir.h i_sysdir
11705 eval $inhdr
11706
11707 : see if this is an sysndir system
11708 set sys/ndir.h i_sysndir
11709 eval $inhdr
11710
11711 : Look for dirfd
11712 echo " "
11713 $cat >dirfd.c <<EOM
11714 #include <stdio.h>
11715 #$i_stdlib I_STDLIB
11716 #ifdef I_STDLIB
11717 #include <stdlib.h>
11718 #endif
11719 #$i_dirent I_DIRENT             /**/
11720 #$i_sysdir I_SYS_DIR            /**/
11721 #$i_sysndir I_SYS_NDIR          /**/
11722 #$i_systypes I_SYS_TYPES        /**/
11723 #if defined(I_SYS_TYPES)
11724 #include <sys/types.h>
11725 #endif
11726 #if defined(I_DIRENT)
11727 #include <dirent.h>
11728 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11729 #include <sys/dir.h>
11730 #endif
11731 #else
11732 #ifdef I_SYS_NDIR
11733 #include <sys/ndir.h>
11734 #else
11735 #ifdef I_SYS_DIR
11736 #ifdef hp9000s500
11737 #include <ndir.h>       /* may be wrong in the future */
11738 #else
11739 #include <sys/dir.h>
11740 #endif
11741 #endif
11742 #endif
11743 #endif 
11744 int main() {
11745         DIR *dirp = opendir(".");
11746         if (dirfd(dirp) >= 0)
11747                 exit(0);
11748         else
11749                 exit(1);
11750 }
11751 EOM
11752 val=$undef
11753 set dirfd
11754 if eval $compile; then
11755         val="$define"
11756 fi
11757 case "$val" in
11758 $define)        echo "dirfd() found." >&4       ;;
11759 *)              echo "dirfd() NOT found." >&4   ;;
11760 esac
11761 set d_dirfd
11762 eval $setvar
11763 $rm -f dirfd*
11764
11765 : see if dlerror exists
11766 xxx_runnm="$runnm"
11767 runnm=false
11768 set dlerror d_dlerror
11769 eval $inlibc
11770 runnm="$xxx_runnm"
11771
11772 : see if dlfcn is available
11773 set dlfcn.h i_dlfcn
11774 eval $inhdr
11775
11776 : Check what extension to use for shared libs
11777 case "$usedl" in
11778 $define|y|true)
11779         $cat << EOM
11780
11781 On a few systems, the dynamically loaded modules that perl generates and uses
11782 will need a different extension than shared libs. The default will probably
11783 be appropriate.
11784
11785 EOM
11786         case "$dlext" in
11787         '')     dflt="$so" ;;
11788         *)      dflt="$dlext" ;;
11789         esac
11790         rp='What is the extension of dynamically loaded modules'
11791         . ./myread
11792         dlext="$ans"
11793         ;;
11794 *)
11795         dlext="none"
11796         ;;
11797 esac
11798
11799 : Check if dlsym need a leading underscore
11800 echo " "
11801 val="$undef"
11802
11803 case "$dlsrc" in
11804 dl_dlopen.xs)
11805         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11806         $cat >dyna.c <<'EOM'
11807 fred () { }
11808 EOM
11809
11810 $cat >fred.c<<EOM
11811
11812 #include <stdio.h>
11813 #$i_stdlib I_STDLIB
11814 #ifdef I_STDLIB
11815 #include <stdlib.h>
11816 #endif
11817 #$i_dlfcn I_DLFCN
11818 #ifdef I_DLFCN
11819 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11820 #else
11821 #include <sys/types.h>
11822 #include <nlist.h>
11823 #include <link.h>
11824 #endif
11825
11826 extern int fred() ;
11827
11828 int main()
11829 {
11830     void * handle ;
11831     void * symbol ;
11832 #ifndef RTLD_LAZY
11833     int mode = 1 ;
11834 #else
11835     int mode = RTLD_LAZY ;
11836 #endif
11837     handle = dlopen("./dyna.$dlext", mode) ;
11838     if (handle == NULL) {
11839         printf ("1\n") ;
11840         fflush (stdout) ;
11841         exit(0);
11842     }
11843     symbol = dlsym(handle, "fred") ;
11844     if (symbol == NULL) {
11845         /* try putting a leading underscore */
11846         symbol = dlsym(handle, "_fred") ;
11847         if (symbol == NULL) {
11848             printf ("2\n") ;
11849             fflush (stdout) ;
11850             exit(0);
11851         }
11852         printf ("3\n") ;
11853     }
11854     else
11855         printf ("4\n") ;
11856     fflush (stdout) ;
11857     exit(0);
11858 }
11859 EOM
11860         : Call the object file tmp-dyna.o in case dlext=o.
11861         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11862                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11863                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11864                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11865                 xxx=`$run ./fred`
11866                 case $xxx in
11867                 1)      echo "Test program failed using dlopen." >&4
11868                         echo "Perhaps you should not use dynamic loading." >&4;;
11869                 2)      echo "Test program failed using dlsym." >&4
11870                         echo "Perhaps you should not use dynamic loading." >&4;;
11871                 3)      echo "dlsym needs a leading underscore" >&4
11872                         val="$define" ;;
11873                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11874                 esac
11875         else
11876                 echo "I can't compile and run the test program." >&4
11877                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11878         fi
11879         ;;
11880 esac
11881
11882 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11883
11884 set d_dlsymun
11885 eval $setvar
11886
11887 : see if drand48_r exists
11888 set drand48_r d_drand48_r
11889 eval $inlibc
11890 case "$d_drand48_r" in
11891 "$define")
11892         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11893         case "$d_drand48_r_proto:$usethreads" in
11894         ":define")      d_drand48_r_proto=define
11895                 set d_drand48_r_proto drand48_r $hdrs
11896                 eval $hasproto ;;
11897         *)      ;;
11898         esac
11899         case "$d_drand48_r_proto" in
11900         define)
11901         case "$drand48_r_proto" in
11902         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11903         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
11904         esac
11905         case "$drand48_r_proto" in
11906         ''|0)   d_drand48_r=undef
11907                 drand48_r_proto=0
11908                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11909         * )     case "$drand48_r_proto" in
11910                 REENTRANT_PROTO*) ;;
11911                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11912                 esac
11913                 echo "Prototype: $try" ;;
11914         esac
11915         ;;
11916         *)      case "$usethreads" in
11917                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11918                 esac
11919                 d_drand48_r=undef
11920                 drand48_r_proto=0
11921                 ;;
11922         esac
11923         ;;
11924 *)      drand48_r_proto=0
11925         ;;
11926 esac
11927
11928 : see if prototype for drand48 is available
11929 echo " "
11930 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11931 eval $hasproto
11932
11933 : see if dup2 exists
11934 set dup2 d_dup2
11935 eval $inlibc
11936
11937 : see if eaccess exists
11938 set eaccess d_eaccess
11939 eval $inlibc
11940
11941 : see if endgrent exists
11942 set endgrent d_endgrent
11943 eval $inlibc
11944
11945 : see if this is an grp system
11946 set grp.h i_grp
11947 eval $inhdr
11948
11949 case "$i_grp" in
11950 $define)
11951         xxx=`./findhdr grp.h`
11952         $cppstdin $cppflags $cppminus < $xxx >$$.h
11953
11954         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11955                 val="$define"
11956         else
11957                 val="$undef"
11958         fi
11959         set d_grpasswd
11960         eval $setvar
11961
11962         $rm -f $$.h
11963         ;;
11964 *)
11965         val="$undef";
11966         set d_grpasswd; eval $setvar
11967         ;;
11968 esac
11969
11970 : see if endgrent_r exists
11971 set endgrent_r d_endgrent_r
11972 eval $inlibc
11973 case "$d_endgrent_r" in
11974 "$define")
11975         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11976         case "$d_endgrent_r_proto:$usethreads" in
11977         ":define")      d_endgrent_r_proto=define
11978                 set d_endgrent_r_proto endgrent_r $hdrs
11979                 eval $hasproto ;;
11980         *)      ;;
11981         esac
11982         case "$d_endgrent_r_proto" in
11983         define)
11984         case "$endgrent_r_proto" in
11985         ''|0) try='int endgrent_r(FILE**);'
11986         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
11987         esac
11988         case "$endgrent_r_proto" in
11989         ''|0) try='void endgrent_r(FILE**);'
11990         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
11991         esac
11992         case "$endgrent_r_proto" in
11993         ''|0)   d_endgrent_r=undef
11994                 endgrent_r_proto=0
11995                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11996         * )     case "$endgrent_r_proto" in
11997                 REENTRANT_PROTO*) ;;
11998                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11999                 esac
12000                 echo "Prototype: $try" ;;
12001         esac
12002         ;;
12003         *)      case "$usethreads" in
12004                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12005                 esac
12006                 d_endgrent_r=undef
12007                 endgrent_r_proto=0
12008                 ;;
12009         esac
12010         ;;
12011 *)      endgrent_r_proto=0
12012         ;;
12013 esac
12014
12015 : see if endhostent exists
12016 set endhostent d_endhent
12017 eval $inlibc
12018
12019 : see if this is a netdb.h system
12020 set netdb.h i_netdb
12021 eval $inhdr
12022
12023 : see if endhostent_r exists
12024 set endhostent_r d_endhostent_r
12025 eval $inlibc
12026 case "$d_endhostent_r" in
12027 "$define")
12028         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12029         case "$d_endhostent_r_proto:$usethreads" in
12030         ":define")      d_endhostent_r_proto=define
12031                 set d_endhostent_r_proto endhostent_r $hdrs
12032                 eval $hasproto ;;
12033         *)      ;;
12034         esac
12035         case "$d_endhostent_r_proto" in
12036         define)
12037         case "$endhostent_r_proto" in
12038         ''|0) try='int endhostent_r(struct hostent_data*);'
12039         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12040         esac
12041         case "$endhostent_r_proto" in
12042         ''|0) try='void endhostent_r(struct hostent_data*);'
12043         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12044         esac
12045         case "$endhostent_r_proto" in
12046         ''|0)   d_endhostent_r=undef
12047                 endhostent_r_proto=0
12048                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12049         * )     case "$endhostent_r_proto" in
12050                 REENTRANT_PROTO*) ;;
12051                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12052                 esac
12053                 echo "Prototype: $try" ;;
12054         esac
12055         ;;
12056         *)      case "$usethreads" in
12057                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12058                 esac
12059                 d_endhostent_r=undef
12060                 endhostent_r_proto=0
12061                 ;;
12062         esac
12063         ;;
12064 *)      endhostent_r_proto=0
12065         ;;
12066 esac
12067
12068 : see if endnetent exists
12069 set endnetent d_endnent
12070 eval $inlibc
12071
12072 : see if endnetent_r exists
12073 set endnetent_r d_endnetent_r
12074 eval $inlibc
12075 case "$d_endnetent_r" in
12076 "$define")
12077         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12078         case "$d_endnetent_r_proto:$usethreads" in
12079         ":define")      d_endnetent_r_proto=define
12080                 set d_endnetent_r_proto endnetent_r $hdrs
12081                 eval $hasproto ;;
12082         *)      ;;
12083         esac
12084         case "$d_endnetent_r_proto" in
12085         define)
12086         case "$endnetent_r_proto" in
12087         ''|0) try='int endnetent_r(struct netent_data*);'
12088         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12089         esac
12090         case "$endnetent_r_proto" in
12091         ''|0) try='void endnetent_r(struct netent_data*);'
12092         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12093         esac
12094         case "$endnetent_r_proto" in
12095         ''|0)   d_endnetent_r=undef
12096                 endnetent_r_proto=0
12097                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12098         * )     case "$endnetent_r_proto" in
12099                 REENTRANT_PROTO*) ;;
12100                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12101                 esac
12102                 echo "Prototype: $try" ;;
12103         esac
12104         ;;
12105         *)      case "$usethreads" in
12106                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12107                 esac
12108                 d_endnetent_r=undef
12109                 endnetent_r_proto=0
12110                 ;;
12111         esac
12112         ;;
12113 *)      endnetent_r_proto=0
12114         ;;
12115 esac
12116
12117 : see if endprotoent exists
12118 set endprotoent d_endpent
12119 eval $inlibc
12120
12121 : see if endprotoent_r exists
12122 set endprotoent_r d_endprotoent_r
12123 eval $inlibc
12124 case "$d_endprotoent_r" in
12125 "$define")
12126         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12127         case "$d_endprotoent_r_proto:$usethreads" in
12128         ":define")      d_endprotoent_r_proto=define
12129                 set d_endprotoent_r_proto endprotoent_r $hdrs
12130                 eval $hasproto ;;
12131         *)      ;;
12132         esac
12133         case "$d_endprotoent_r_proto" in
12134         define)
12135         case "$endprotoent_r_proto" in
12136         ''|0) try='int endprotoent_r(struct protoent_data*);'
12137         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12138         esac
12139         case "$endprotoent_r_proto" in
12140         ''|0) try='void endprotoent_r(struct protoent_data*);'
12141         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12142         esac
12143         case "$endprotoent_r_proto" in
12144         ''|0)   d_endprotoent_r=undef
12145                 endprotoent_r_proto=0
12146                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12147         * )     case "$endprotoent_r_proto" in
12148                 REENTRANT_PROTO*) ;;
12149                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12150                 esac
12151                 echo "Prototype: $try" ;;
12152         esac
12153         ;;
12154         *)      case "$usethreads" in
12155                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12156                 esac
12157                 d_endprotoent_r=undef
12158                 endprotoent_r_proto=0
12159                 ;;
12160         esac
12161         ;;
12162 *)      endprotoent_r_proto=0
12163         ;;
12164 esac
12165
12166 : see if endpwent exists
12167 set endpwent d_endpwent
12168 eval $inlibc
12169
12170 : see if this is a pwd.h system
12171 set pwd.h i_pwd
12172 eval $inhdr
12173
12174 case "$i_pwd" in
12175 $define)
12176         xxx=`./findhdr pwd.h`
12177         $cppstdin $cppflags $cppminus < $xxx >$$.h
12178
12179         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12180                 val="$define"
12181         else
12182                 val="$undef"
12183         fi
12184         set d_pwquota
12185         eval $setvar
12186
12187         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12188                 val="$define"
12189         else
12190                 val="$undef"
12191         fi
12192         set d_pwage
12193         eval $setvar
12194
12195         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12196                 val="$define"
12197         else
12198                 val="$undef"
12199         fi
12200         set d_pwchange
12201         eval $setvar
12202
12203         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12204                 val="$define"
12205         else
12206                 val="$undef"
12207         fi
12208         set d_pwclass
12209         eval $setvar
12210
12211         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12212                 val="$define"
12213         else
12214                 val="$undef"
12215         fi
12216         set d_pwexpire
12217         eval $setvar
12218
12219         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12220                 val="$define"
12221         else
12222                 val="$undef"
12223         fi
12224         set d_pwcomment
12225         eval $setvar
12226
12227         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12228                 val="$define"
12229         else
12230                 val="$undef"
12231         fi
12232         set d_pwgecos
12233         eval $setvar
12234
12235         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12236                 val="$define"
12237         else
12238                 val="$undef"
12239         fi
12240         set d_pwpasswd
12241         eval $setvar
12242
12243         $rm -f $$.h
12244         ;;
12245 *)
12246         val="$undef"; 
12247         set d_pwquota; eval $setvar
12248         set d_pwage; eval $setvar
12249         set d_pwchange; eval $setvar
12250         set d_pwclass; eval $setvar
12251         set d_pwexpire; eval $setvar
12252         set d_pwcomment; eval $setvar
12253         set d_pwgecos; eval $setvar
12254         set d_pwpasswd; eval $setvar
12255         ;;
12256 esac
12257
12258 : see if endpwent_r exists
12259 set endpwent_r d_endpwent_r
12260 eval $inlibc
12261 case "$d_endpwent_r" in
12262 "$define")
12263         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12264         case "$d_endpwent_r_proto:$usethreads" in
12265         ":define")      d_endpwent_r_proto=define
12266                 set d_endpwent_r_proto endpwent_r $hdrs
12267                 eval $hasproto ;;
12268         *)      ;;
12269         esac
12270         case "$d_endpwent_r_proto" in
12271         define)
12272         case "$endpwent_r_proto" in
12273         ''|0) try='int endpwent_r(FILE**);'
12274         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12275         esac
12276         case "$endpwent_r_proto" in
12277         ''|0) try='void endpwent_r(FILE**);'
12278         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12279         esac
12280         case "$endpwent_r_proto" in
12281         ''|0)   d_endpwent_r=undef
12282                 endpwent_r_proto=0
12283                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12284         * )     case "$endpwent_r_proto" in
12285                 REENTRANT_PROTO*) ;;
12286                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12287                 esac
12288                 echo "Prototype: $try" ;;
12289         esac
12290         ;;
12291         *)      case "$usethreads" in
12292                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12293                 esac
12294                 d_endpwent_r=undef
12295                 endpwent_r_proto=0
12296                 ;;
12297         esac
12298         ;;
12299 *)      endpwent_r_proto=0
12300         ;;
12301 esac
12302
12303 : see if endservent exists
12304 set endservent d_endsent
12305 eval $inlibc
12306
12307 : see if endservent_r exists
12308 set endservent_r d_endservent_r
12309 eval $inlibc
12310 case "$d_endservent_r" in
12311 "$define")
12312         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12313         case "$d_endservent_r_proto:$usethreads" in
12314         ":define")      d_endservent_r_proto=define
12315                 set d_endservent_r_proto endservent_r $hdrs
12316                 eval $hasproto ;;
12317         *)      ;;
12318         esac
12319         case "$d_endservent_r_proto" in
12320         define)
12321         case "$endservent_r_proto" in
12322         ''|0) try='int endservent_r(struct servent_data*);'
12323         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12324         esac
12325         case "$endservent_r_proto" in
12326         ''|0) try='void endservent_r(struct servent_data*);'
12327         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12328         esac
12329         case "$endservent_r_proto" in
12330         ''|0)   d_endservent_r=undef
12331                 endservent_r_proto=0
12332                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12333         * )     case "$endservent_r_proto" in
12334                 REENTRANT_PROTO*) ;;
12335                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12336                 esac
12337                 echo "Prototype: $try" ;;
12338         esac
12339         ;;
12340         *)      case "$usethreads" in
12341                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12342                 esac
12343                 d_endservent_r=undef
12344                 endservent_r_proto=0
12345                 ;;
12346         esac
12347         ;;
12348 *)      endservent_r_proto=0
12349         ;;
12350 esac
12351
12352 : Locate the flags for 'open()'
12353 echo " "
12354 $cat >try.c <<EOCP
12355 #include <sys/types.h>
12356 #ifdef I_FCNTL
12357 #include <fcntl.h>
12358 #endif
12359 #ifdef I_SYS_FILE
12360 #include <sys/file.h>
12361 #endif
12362 #$i_stdlib I_STDLIB
12363 #ifdef I_STDLIB
12364 #include <stdlib.h>
12365 #endif
12366 int main() {
12367         if(O_RDONLY);
12368 #ifdef O_TRUNC
12369         exit(0);
12370 #else
12371         exit(1);
12372 #endif
12373 }
12374 EOCP
12375 : check sys/file.h first to get FREAD on Sun
12376 if $test `./findhdr sys/file.h` && \
12377                 set try -DI_SYS_FILE && eval $compile; then
12378         h_sysfile=true;
12379         echo "<sys/file.h> defines the O_* constants..." >&4
12380         if $run ./try; then
12381                 echo "and you have the 3 argument form of open()." >&4
12382                 val="$define"
12383         else
12384                 echo "but not the 3 argument form of open().  Oh, well." >&4
12385                 val="$undef"
12386         fi
12387 elif $test `./findhdr fcntl.h` && \
12388                 set try -DI_FCNTL && eval $compile; then
12389         h_fcntl=true;
12390         echo "<fcntl.h> defines the O_* constants..." >&4
12391         if $run ./try; then
12392                 echo "and you have the 3 argument form of open()." >&4
12393                 val="$define"
12394         else
12395                 echo "but not the 3 argument form of open().  Oh, well." >&4
12396                 val="$undef"
12397         fi
12398 else
12399         val="$undef"
12400         echo "I can't find the O_* constant definitions!  You got problems." >&4
12401 fi
12402 set d_open3
12403 eval $setvar
12404 $rm_try
12405
12406 : see if this is a sys/file.h system
12407 val=''
12408 set sys/file.h val
12409 eval $inhdr
12410
12411 : do we need to include sys/file.h ?
12412 case "$val" in
12413 "$define")
12414         echo " "
12415         if $h_sysfile; then
12416                 val="$define"
12417                 echo "We'll be including <sys/file.h>." >&4
12418         else
12419                 val="$undef"
12420                 echo "We won't be including <sys/file.h>." >&4
12421         fi
12422         ;;
12423 *)
12424         h_sysfile=false
12425         ;;
12426 esac
12427 set i_sysfile
12428 eval $setvar
12429
12430 : see if fcntl.h is there
12431 val=''
12432 set fcntl.h val
12433 eval $inhdr
12434
12435 : see if we can include fcntl.h
12436 case "$val" in
12437 "$define")
12438         echo " "
12439         if $h_fcntl; then
12440                 val="$define"
12441                 echo "We'll be including <fcntl.h>." >&4
12442         else
12443                 val="$undef"
12444                 if $h_sysfile; then
12445         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12446                 else
12447                         echo "We won't be including <fcntl.h>." >&4
12448                 fi
12449         fi
12450         ;;
12451 *)
12452         h_fcntl=false
12453         val="$undef"
12454         ;;
12455 esac
12456 set i_fcntl
12457 eval $setvar
12458
12459 : see if fork exists
12460 set fork d_fork
12461 eval $inlibc
12462
12463 : see if pipe exists
12464 set pipe d_pipe
12465 eval $inlibc
12466
12467 : check for non-blocking I/O stuff
12468 case "$h_sysfile" in
12469 true) echo "#include <sys/file.h>" > head.c;;
12470 *)
12471        case "$h_fcntl" in
12472        true) echo "#include <fcntl.h>" > head.c;;
12473        *) echo "#include <sys/fcntl.h>" > head.c;;
12474        esac
12475        ;;
12476 esac
12477 echo " "
12478 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12479 case "$o_nonblock" in
12480 '')
12481         $cat head.c > try.c
12482         $cat >>try.c <<EOCP
12483 #include <stdio.h>
12484 #$i_stdlib I_STDLIB
12485 #ifdef I_STDLIB
12486 #include <stdlib.h>
12487 #endif
12488 #$i_fcntl I_FCNTL
12489 #ifdef I_FCNTL
12490 #include <fcntl.h>
12491 #endif
12492 int main() {
12493 #ifdef O_NONBLOCK
12494         printf("O_NONBLOCK\n");
12495         exit(0);
12496 #endif
12497 #ifdef O_NDELAY
12498         printf("O_NDELAY\n");
12499         exit(0);
12500 #endif
12501 #ifdef FNDELAY
12502         printf("FNDELAY\n");
12503         exit(0);
12504 #endif
12505         exit(0);
12506 }
12507 EOCP
12508         set try
12509         if eval $compile_ok; then
12510                 o_nonblock=`$run ./try`
12511                 case "$o_nonblock" in
12512                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12513                 *) echo "Seems like we can use $o_nonblock.";;
12514                 esac
12515         else
12516                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12517         fi
12518         ;;
12519 *) echo "Using $hint value $o_nonblock.";;
12520 esac
12521 $rm_try
12522
12523 echo " "
12524 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12525 case "$eagain" in
12526 '')
12527         case "$d_fork:$d_pipe" in
12528         define:define)
12529         $cat head.c > try.c
12530         $cat >>try.c <<EOCP
12531 #include <errno.h>
12532 #include <sys/types.h>
12533 #include <signal.h>
12534 #include <stdio.h>
12535 #$i_stdlib I_STDLIB
12536 #ifdef I_STDLIB
12537 #include <stdlib.h>
12538 #endif
12539 #$i_fcntl I_FCNTL
12540 #ifdef I_FCNTL
12541 #include <fcntl.h>
12542 #endif
12543 #define MY_O_NONBLOCK $o_nonblock
12544 #ifndef errno  /* XXX need better Configure test */
12545 extern int errno;
12546 #endif
12547 #$i_unistd I_UNISTD
12548 #ifdef I_UNISTD
12549 #include <unistd.h>
12550 #endif
12551 #$i_string I_STRING
12552 #ifdef I_STRING
12553 #include <string.h>
12554 #else
12555 #include <strings.h>
12556 #endif
12557 $signal_t blech(int x) { exit(3); }
12558 EOCP
12559         $cat >> try.c <<'EOCP'
12560 int main()
12561 {
12562         int pd[2];
12563         int pu[2];
12564         char buf[1];
12565         char string[100];
12566
12567         pipe(pd);       /* Down: child -> parent */
12568         pipe(pu);       /* Up: parent -> child */
12569         if (0 != fork()) {
12570                 int ret;
12571                 close(pd[1]);   /* Parent reads from pd[0] */
12572                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12573 #ifdef F_SETFL
12574                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12575                         exit(1);
12576 #else
12577                 exit(4);
12578 #endif
12579                 signal(SIGALRM, blech);
12580                 alarm(5);
12581                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12582                         exit(2);
12583                 sprintf(string, "%d\n", ret);
12584                 write(2, string, strlen(string));
12585                 alarm(0);
12586 #ifdef EAGAIN
12587                 if (errno == EAGAIN) {
12588                         printf("EAGAIN\n");
12589                         goto ok;
12590                 }
12591 #endif
12592 #ifdef EWOULDBLOCK
12593                 if (errno == EWOULDBLOCK)
12594                         printf("EWOULDBLOCK\n");
12595 #endif
12596         ok:
12597                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12598                 sleep(2);                               /* Give it time to close our pipe */
12599                 alarm(5);
12600                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12601                 alarm(0);
12602                 sprintf(string, "%d\n", ret);
12603                 write(4, string, strlen(string));
12604                 exit(0);
12605         }
12606
12607         close(pd[0]);                   /* We write to pd[1] */
12608         close(pu[1]);                   /* We read from pu[0] */
12609         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12610         close(pd[1]);                   /* Pipe pd is now fully closed! */
12611         exit(0);                                /* Bye bye, thank you for playing! */
12612 }
12613 EOCP
12614         set try
12615         if eval $compile_ok; then
12616                 echo "$startsh" >mtry
12617                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12618                 chmod +x mtry
12619                 ./mtry >/dev/null 2>&1
12620                 case $? in
12621                 0) eagain=`$cat try.out`;;
12622                 1) echo "Could not perform non-blocking setting!";;
12623                 2) echo "I did a successful read() for something that was not there!";;
12624                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12625                 4) echo "Could not find F_SETFL!";;
12626                 *) echo "Something terribly wrong happened during testing.";;
12627                 esac
12628                 rd_nodata=`$cat try.ret`
12629                 echo "A read() system call with no data present returns $rd_nodata."
12630                 case "$rd_nodata" in
12631                 0|-1) ;;
12632                 *)
12633                         echo "(That's peculiar, fixing that to be -1.)"
12634                         rd_nodata=-1
12635                         ;;
12636                 esac
12637                 case "$eagain" in
12638                 '')
12639                         echo "Forcing errno EAGAIN on read() with no data available."
12640                         eagain=EAGAIN
12641                         ;;
12642                 *)
12643                         echo "Your read() sets errno to $eagain when no data is available."
12644                         ;;
12645                 esac
12646                 status=`$cat try.err`
12647                 case "$status" in
12648                 0) echo "And it correctly returns 0 to signal EOF.";;
12649                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12650                 *) echo "However, your read() returns '$status' on EOF??";;
12651                 esac
12652                 val="$define"
12653                 if test "$status" = "$rd_nodata"; then
12654                         echo "WARNING: you can't distinguish between EOF and no data!"
12655                         val="$undef"
12656                 fi
12657         else
12658                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12659                 eagain=EAGAIN
12660         fi
12661         ;;
12662         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12663                 eagain=EAGAIN
12664                 val="$define"
12665                 ;;
12666         esac
12667         set d_eofnblk
12668         eval $setvar
12669         ;;
12670 *)
12671         echo "Using $hint value $eagain."
12672         echo "Your read() returns $rd_nodata when no data is present."
12673         case "$d_eofnblk" in
12674         "$define") echo "And you can see EOF because read() returns 0.";;
12675         "$undef") echo "But you can't see EOF status from read() returned value.";;
12676         *)
12677                 echo "(Assuming you can't see EOF status from read anyway.)"
12678                 d_eofnblk=$undef
12679                 ;;
12680         esac
12681         ;;
12682 esac
12683 $rm_try head.c mtry
12684
12685 : see if _ptr and _cnt from stdio act std
12686 echo " "
12687
12688 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12689         echo "(Looks like you have stdio.h from BSD.)"
12690         case "$stdio_ptr" in
12691         '') stdio_ptr='((fp)->_p)'
12692                 ptr_lval=$define
12693                 ;;
12694         *)      ptr_lval=$d_stdio_ptr_lval;;
12695         esac
12696         case "$stdio_cnt" in
12697         '') stdio_cnt='((fp)->_r)'
12698                 cnt_lval=$define
12699                 ;;
12700         *)      cnt_lval=$d_stdio_cnt_lval;;
12701         esac
12702         case "$stdio_base" in
12703         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12704         esac
12705         case "$stdio_bufsiz" in
12706         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12707         esac
12708 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12709         echo "(Looks like you have stdio.h from Linux.)"
12710         case "$stdio_ptr" in
12711         '') stdio_ptr='((fp)->_IO_read_ptr)'
12712                 ptr_lval=$define
12713                 ;;
12714         *)      ptr_lval=$d_stdio_ptr_lval;;
12715         esac
12716         case "$stdio_cnt" in
12717         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12718                 cnt_lval=$undef
12719                 ;;
12720         *)      cnt_lval=$d_stdio_cnt_lval;;
12721         esac
12722         case "$stdio_base" in
12723         '') stdio_base='((fp)->_IO_read_base)';;
12724         esac
12725         case "$stdio_bufsiz" in
12726         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12727         esac
12728 else
12729         case "$stdio_ptr" in
12730         '') stdio_ptr='((fp)->_ptr)'
12731                 ptr_lval=$define
12732                 ;;
12733         *)      ptr_lval=$d_stdio_ptr_lval;;
12734         esac
12735         case "$stdio_cnt" in
12736         '') stdio_cnt='((fp)->_cnt)'
12737                 cnt_lval=$define
12738                 ;;
12739         *)      cnt_lval=$d_stdio_cnt_lval;;
12740         esac
12741         case "$stdio_base" in
12742         '') stdio_base='((fp)->_base)';;
12743         esac
12744         case "$stdio_bufsiz" in
12745         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12746         esac
12747 fi
12748
12749 : test whether _ptr and _cnt really work
12750 echo "Checking how std your stdio is..." >&4
12751 $cat >try.c <<EOP
12752 #include <stdio.h>
12753 #$i_stdlib I_STDLIB
12754 #ifdef I_STDLIB
12755 #include <stdlib.h>
12756 #endif
12757 #define FILE_ptr(fp)    $stdio_ptr
12758 #define FILE_cnt(fp)    $stdio_cnt
12759 int main() {
12760         FILE *fp = fopen("try.c", "r");
12761         char c = getc(fp);
12762         if (
12763                 18 <= FILE_cnt(fp) &&
12764                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12765         )
12766                 exit(0);
12767         exit(1);
12768 }
12769 EOP
12770 val="$undef"
12771 set try
12772 if eval $compile && $to try.c; then
12773         if $run ./try; then
12774                 echo "Your stdio acts pretty std."
12775                 val="$define"
12776         else
12777                 echo "Your stdio isn't very std."
12778         fi
12779 else
12780         echo "Your stdio doesn't appear very std."
12781 fi
12782 $rm_try
12783
12784 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12785 # direct buffer manipulation no longer works.  The Configure tests
12786 # should be changed to correctly detect this, but until then,
12787 # the following check should at least let perl compile and run.
12788 # (This quick fix should be updated before 5.8.1.)
12789 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12790 # A. Dougherty, June 3, 2002.
12791 case "$d_gnulibc" in
12792 $define)
12793         case "$gnulibc_version" in
12794         2.[01]*)  ;;
12795         2.2) ;;
12796         2.2.[0-9]) ;;
12797         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12798                 val="$undef"
12799                 ;;
12800         esac
12801         ;;
12802 esac
12803 set d_stdstdio
12804 eval $setvar
12805
12806 : Can _ptr be used as an lvalue?
12807 case "$d_stdstdio$ptr_lval" in
12808 $define$define) val=$define ;;
12809 *) val=$undef ;;
12810 esac
12811 set d_stdio_ptr_lval
12812 eval $setvar
12813
12814 : Can _cnt be used as an lvalue?
12815 case "$d_stdstdio$cnt_lval" in
12816 $define$define) val=$define ;;
12817 *) val=$undef ;;
12818 esac
12819 set d_stdio_cnt_lval
12820 eval $setvar
12821
12822
12823 : test whether setting _ptr sets _cnt as a side effect
12824 d_stdio_ptr_lval_sets_cnt="$undef"
12825 d_stdio_ptr_lval_nochange_cnt="$undef"
12826 case "$d_stdio_ptr_lval$d_stdstdio" in
12827 $define$define)
12828         echo "Checking to see what happens if we set the stdio ptr..." >&4
12829 $cat >try.c <<EOP
12830 #include <stdio.h>
12831 /* Can we scream? */
12832 /* Eat dust sed :-) */
12833 /* In the buffer space, no one can hear you scream. */
12834 #$i_stdlib I_STDLIB
12835 #ifdef I_STDLIB
12836 #include <stdlib.h>
12837 #endif
12838 #define FILE_ptr(fp)    $stdio_ptr
12839 #define FILE_cnt(fp)    $stdio_cnt
12840 #include <sys/types.h>
12841 int main() {
12842         FILE *fp = fopen("try.c", "r");
12843         int c;
12844         char *ptr;
12845         size_t cnt;
12846         if (!fp) {
12847             puts("Fail even to read");
12848             exit(1);
12849         }
12850         c = getc(fp); /* Read away the first # */
12851         if (c == EOF) {
12852             puts("Fail even to read");
12853             exit(1);
12854         }
12855         if (!(
12856                 18 <= FILE_cnt(fp) &&
12857                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12858         )) {
12859                 puts("Fail even to read");
12860                 exit (1);
12861         }
12862         ptr = (char*) FILE_ptr(fp);
12863         cnt = (size_t)FILE_cnt(fp);
12864
12865         FILE_ptr(fp) += 42;
12866
12867         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12868                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12869                 exit (1);
12870         }
12871         if (FILE_cnt(fp) <= 20) {
12872                 printf ("Fail (<20 chars to test)");
12873                 exit (1);
12874         }
12875         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12876                 puts("Fail compare");
12877                 exit (1);
12878         }
12879         if (cnt == FILE_cnt(fp)) {
12880                 puts("Pass_unchanged");
12881                 exit (0);
12882         }
12883         if (FILE_cnt(fp) == (cnt - 42)) {
12884                 puts("Pass_changed");
12885                 exit (0);
12886         }
12887         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12888         return 1;
12889
12890 }
12891 EOP
12892         set try
12893         if eval $compile && $to try.c; then
12894                 case `$run ./try` in
12895                 Pass_changed)
12896                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12897                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12898                 Pass_unchanged)
12899                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12900                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12901                 Fail*)
12902                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12903                 *)
12904                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12905         esac
12906         else
12907                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12908         fi
12909         $rm_try
12910         ;;
12911 esac
12912
12913 : see if _base is also standard
12914 val="$undef"
12915 case "$d_stdstdio" in
12916 $define)
12917         $cat >try.c <<EOP
12918 #include <stdio.h>
12919 #$i_stdlib I_STDLIB
12920 #ifdef I_STDLIB
12921 #include <stdlib.h>
12922 #endif
12923 #define FILE_base(fp)   $stdio_base
12924 #define FILE_bufsiz(fp) $stdio_bufsiz
12925 int main() {
12926         FILE *fp = fopen("try.c", "r");
12927         char c = getc(fp);
12928         if (
12929                 19 <= FILE_bufsiz(fp) &&
12930                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12931         )
12932                 exit(0);
12933         exit(1);
12934 }
12935 EOP
12936         set try
12937         if eval $compile && $to try.c; then
12938                 if $run ./try; then
12939                         echo "And its _base field acts std."
12940                         val="$define"
12941                 else
12942                         echo "But its _base field isn't std."
12943                 fi
12944         else
12945                 echo "However, it seems to be lacking the _base field."
12946         fi
12947         $rm_try
12948         ;;
12949 esac
12950 set d_stdiobase
12951 eval $setvar
12952
12953 : see if fast_stdio exists
12954 val="$undef"
12955 case "$d_stdstdio:$d_stdio_ptr_lval" in
12956 "$define:$define")
12957         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12958         *$define*)
12959                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12960                 val="$define"
12961                 ;;
12962         esac
12963         ;;
12964 esac
12965 set d_faststdio
12966 eval $setvar
12967
12968
12969
12970 : see if fchdir exists
12971 set fchdir d_fchdir
12972 eval $inlibc
12973
12974 : see if fchmod exists
12975 set fchmod d_fchmod
12976 eval $inlibc
12977
12978 : see if fchown exists
12979 set fchown d_fchown
12980 eval $inlibc
12981
12982 : see if this is an fcntl system
12983 set fcntl d_fcntl
12984 eval $inlibc
12985
12986 : See if fcntl-based locking works.
12987 echo " "
12988 $cat >try.c <<EOCP
12989 #$i_stdlib I_STDLIB
12990 #ifdef I_STDLIB
12991 #include <stdlib.h>
12992 #endif
12993 #include <unistd.h>
12994 #include <fcntl.h>
12995 #include <signal.h>
12996 $signal_t blech(int x) { exit(3); }
12997 int main() {
12998 #if defined(F_SETLK) && defined(F_SETLKW)
12999      struct flock flock;
13000      int retval, fd;
13001      fd = open("try.c", O_RDONLY);
13002      flock.l_type = F_RDLCK;
13003      flock.l_whence = SEEK_SET;
13004      flock.l_start = flock.l_len = 0;
13005      signal(SIGALRM, blech);
13006      alarm(10);
13007      retval = fcntl(fd, F_SETLK, &flock);
13008      close(fd);
13009      (retval < 0 ? exit(2) : exit(0));
13010 #else
13011      exit(2);
13012 #endif
13013 }
13014 EOCP
13015 echo "Checking if fcntl-based file locking works... "
13016 case "$d_fcntl" in
13017 "$define")
13018         set try
13019         if eval $compile_ok; then
13020                 if $run ./try; then
13021                         echo "Yes, it seems to work."
13022                         val="$define"
13023                 else
13024                         echo "Nope, it didn't work."
13025                         val="$undef"
13026                         case "$?" in
13027                         3) $cat >&4 <<EOM
13028 ***
13029 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13030 *** This is (almost) impossible.
13031 *** If your NFS lock daemons are not feeling well, something like
13032 *** this may happen, please investigate.  Cannot continue, aborting.
13033 ***
13034 EOM
13035                                 exit 1
13036                                 ;;
13037                         esac
13038                 fi
13039         else
13040                 echo "I'm unable to compile the test program, so I'll assume not."
13041                 val="$undef"
13042         fi
13043         ;;
13044 *) val="$undef";
13045         echo "Nope, since you don't even have fcntl()."
13046         ;;
13047 esac
13048 set d_fcntl_can_lock
13049 eval $setvar
13050 $rm_try
13051
13052 : check for fd_set items
13053 $cat <<EOM
13054
13055 Checking to see how well your C compiler handles fd_set and friends ...
13056 EOM
13057 $cat >try.c <<EOCP
13058 #$i_stdlib I_STDLIB
13059 #ifdef I_STDLIB
13060 #include <stdlib.h>
13061 #endif
13062 #$i_systime I_SYS_TIME
13063 #$i_sysselct I_SYS_SELECT
13064 #$d_socket HAS_SOCKET
13065 #include <sys/types.h>
13066 #ifdef HAS_SOCKET
13067 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13068 #endif
13069 #ifdef I_SYS_TIME
13070 #include <sys/time.h>
13071 #endif
13072 #ifdef I_SYS_SELECT
13073 #include <sys/select.h>
13074 #endif
13075 int main() {
13076         fd_set fds;
13077
13078 #ifdef TRYBITS
13079         if(fds.fds_bits);
13080 #endif
13081
13082 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13083         exit(0);
13084 #else
13085         exit(1);
13086 #endif
13087 }
13088 EOCP
13089 set try -DTRYBITS
13090 if eval $compile; then
13091         d_fds_bits="$define"
13092         d_fd_set="$define"
13093         echo "Well, your system knows about the normal fd_set typedef..." >&4
13094         if $run ./try; then
13095                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13096                 d_fd_macros="$define"
13097         else
13098                 $cat >&4 <<'EOM'
13099 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13100 EOM
13101                 d_fd_macros="$undef"
13102         fi
13103 else
13104         $cat <<'EOM'
13105 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13106 EOM
13107         set try
13108         if eval $compile; then
13109                 d_fds_bits="$undef"
13110                 d_fd_set="$define"
13111                 echo "Well, your system has some sort of fd_set available..." >&4
13112                 if $run ./try; then
13113                         echo "and you have the normal fd_set macros." >&4
13114                         d_fd_macros="$define"
13115                 else
13116                         $cat <<'EOM'
13117 but not the normal fd_set macros!  Gross!  More work for me...
13118 EOM
13119                         d_fd_macros="$undef"
13120                 fi
13121         else
13122         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13123                 d_fd_set="$undef"
13124                 d_fds_bits="$undef"
13125                 d_fd_macros="$undef"
13126         fi
13127 fi
13128 $rm_try
13129
13130 : see if fgetpos exists
13131 set fgetpos d_fgetpos
13132 eval $inlibc
13133
13134 : see if finite exists
13135 set finite d_finite
13136 eval $inlibc
13137
13138 : see if finitel exists
13139 set finitel d_finitel
13140 eval $inlibc
13141
13142 : see if flock exists
13143 set flock d_flock
13144 eval $inlibc
13145
13146 : see if prototype for flock is available
13147 echo " "
13148 set d_flockproto flock $i_sysfile sys/file.h
13149 eval $hasproto
13150
13151 : see if fp_class exists
13152 set fp_class d_fp_class
13153 eval $inlibc
13154
13155 : see if pathconf exists
13156 set pathconf d_pathconf
13157 eval $inlibc
13158
13159 : see if fpathconf exists
13160 set fpathconf d_fpathconf
13161 eval $inlibc
13162
13163 : see if fpclass exists
13164 set fpclass d_fpclass
13165 eval $inlibc
13166
13167 : see if fpclassify exists
13168 set fpclassify d_fpclassify
13169 eval $inlibc
13170
13171 : see if fpclassl exists
13172 set fpclassl d_fpclassl
13173 eval $inlibc
13174
13175 : check for fpos64_t
13176 echo " "
13177 echo "Checking to see if you have fpos64_t..." >&4
13178 $cat >try.c <<EOCP
13179 #include <stdio.h>
13180 int main() { fpos64_t x = 7; }
13181 EOCP
13182 set try
13183 if eval $compile; then
13184         val="$define"
13185         echo "You have fpos64_t."
13186 else
13187         val="$undef"
13188         echo "You do not have fpos64_t."
13189         case "$fpossize" in
13190         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13191         esac
13192 fi
13193 $rm_try
13194 set d_fpos64_t
13195 eval $setvar
13196
13197 : see if frexpl exists
13198 set frexpl d_frexpl
13199 eval $inlibc
13200
13201 : see if this is a sys/param system
13202 set sys/param.h i_sysparam
13203 eval $inhdr
13204
13205 : see if this is a sys/mount.h system
13206 set sys/mount.h i_sysmount
13207 eval $inhdr
13208
13209 : Check for fs_data_s
13210 echo " "
13211 echo "Checking to see if your system supports struct fs_data..." >&4
13212 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13213 eval $hasstruct
13214 case "$d_fs_data_s" in
13215 "$define")      echo "Yes, it does."   ;;
13216 *)              echo "No, it doesn't." ;;
13217 esac
13218
13219 : see if fseeko exists
13220 set fseeko d_fseeko
13221 eval $inlibc
13222 case "$longsize" in
13223 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13224 esac
13225
13226 : see if fsetpos exists
13227 set fsetpos d_fsetpos
13228 eval $inlibc
13229
13230 : see if fstatfs exists
13231 set fstatfs d_fstatfs
13232 eval $inlibc
13233
13234 : see if statvfs exists
13235 set statvfs d_statvfs
13236 eval $inlibc
13237
13238 : see if fstatvfs exists
13239 set fstatvfs d_fstatvfs
13240 eval $inlibc
13241
13242
13243 : see if fsync exists
13244 set fsync d_fsync
13245 eval $inlibc
13246
13247 : see if ftello exists
13248 set ftello d_ftello
13249 eval $inlibc
13250 case "$longsize" in
13251 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13252 esac
13253
13254 : check for a working futimes
13255 d_futimes="$undef"
13256 echo " "
13257 echo "Checking if you have a working futimes()" >&4
13258 $cat >try.c <<EOCP
13259 #include <stdio.h>
13260 #include <sys/time.h>
13261 #include <errno.h>
13262 #include <fcntl.h>
13263
13264 int main ()
13265 {
13266     int fd, rv;
13267     fd = open ("try.c", O_RDWR);
13268     if (-1 == fd) exit (1);
13269     rv = futimes (fd, NULL);
13270     exit (rv == -1 ? errno : 0);
13271 }
13272 EOCP
13273 set try
13274 if eval $compile; then
13275     `$run ./try`
13276     rc=$?
13277     case "$rc" in
13278         0)  echo "Yes, you have" >&4
13279             d_futimes="$define"
13280             ;;
13281         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13282             ;;
13283     esac
13284 else
13285     echo "No, it does not (probably harmless)" >&4
13286 fi
13287 $rm_try
13288
13289 : see if ndbm.h is available
13290 set ndbm.h i_ndbm
13291 eval $inhdr
13292 : Compatibility location for RedHat 7.1
13293 set gdbm/ndbm.h i_gdbmndbm
13294 eval $inhdr
13295 : Compatibility location for Debian 4.0
13296 set gdbm-ndbm.h i_gdbm_ndbm
13297 eval $inhdr
13298
13299 val="$undef"
13300 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13301         : see if dbm_open exists
13302         set dbm_open d_dbm_open
13303         eval $inlibc
13304         case "$d_dbm_open" in
13305         $undef)
13306                 i_ndbm="$undef"
13307                 i_gdbmndbm="$undef"
13308                 i_gdbm_ndbm="$undef"
13309                 echo "We won't be including <ndbm.h>"
13310                 val="$undef"
13311                 ;;
13312         *) val="$define"
13313            ;;
13314         esac
13315 fi
13316 set d_ndbm
13317 eval $setvar
13318
13319 ndbm_hdr_protochk='name=$1; hdr=$2;
13320 eval "ihdr=\$""i_$name";
13321 val="$undef";
13322 if $test "$ihdr" = "$define"; then
13323         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13324         case "$d_cplusplus" in
13325         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13326         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13327         esac;
13328         case "$val" in
13329         $define) $echo "Your <$hdr> seems to have prototypes";;
13330         *) $echo "Your <$hdr> does not seem to have prototypes";;
13331         esac;
13332 fi;
13333 set "d_${name}_h_uses_prototypes";
13334 eval $setvar'
13335
13336 set ndbm ndbm.h
13337 eval $ndbm_hdr_protochk
13338 set gdbmndbm gdbm/ndbm.h
13339 eval $ndbm_hdr_protochk
13340 set gdbm_ndbm gdbm-ndbm.h
13341 eval $ndbm_hdr_protochk
13342
13343 : see if getcwd exists
13344 set getcwd d_getcwd
13345 eval $inlibc
13346
13347 : see if getespwnam exists
13348 set getespwnam d_getespwnam
13349 eval $inlibc
13350
13351 : see if getfsstat exists
13352 set getfsstat d_getfsstat
13353 eval $inlibc
13354
13355 : see if getgrent exists
13356 set getgrent d_getgrent
13357 eval $inlibc
13358
13359 : see if getgrent_r exists
13360 set getgrent_r d_getgrent_r
13361 eval $inlibc
13362 case "$d_getgrent_r" in
13363 "$define")
13364         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13365         case "$d_getgrent_r_proto:$usethreads" in
13366         ":define")      d_getgrent_r_proto=define
13367                 set d_getgrent_r_proto getgrent_r $hdrs
13368                 eval $hasproto ;;
13369         *)      ;;
13370         esac
13371         case "$d_getgrent_r_proto" in
13372         define)
13373         case "$getgrent_r_proto" in
13374         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13375         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13376         esac
13377         case "$getgrent_r_proto" in
13378         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13379         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13380         esac
13381         case "$getgrent_r_proto" in
13382         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13383         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13384         esac
13385         case "$getgrent_r_proto" in
13386         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13387         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13388         esac
13389         case "$getgrent_r_proto" in
13390         ''|0) try='int getgrent_r(struct group*, char*, int);'
13391         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13392         esac
13393         case "$getgrent_r_proto" in
13394         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13395         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13396         esac
13397         case "$getgrent_r_proto" in
13398         ''|0)   d_getgrent_r=undef
13399                 getgrent_r_proto=0
13400                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13401         * )     case "$getgrent_r_proto" in
13402                 REENTRANT_PROTO*) ;;
13403                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13404                 esac
13405                 echo "Prototype: $try" ;;
13406         esac
13407         ;;
13408         *)      case "$usethreads" in
13409                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13410                 esac
13411                 d_getgrent_r=undef
13412                 getgrent_r_proto=0
13413                 ;;
13414         esac
13415         ;;
13416 *)      getgrent_r_proto=0
13417         ;;
13418 esac
13419
13420 : see if getgrgid_r exists
13421 set getgrgid_r d_getgrgid_r
13422 eval $inlibc
13423 case "$d_getgrgid_r" in
13424 "$define")
13425         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13426         case "$d_getgrgid_r_proto:$usethreads" in
13427         ":define")      d_getgrgid_r_proto=define
13428                 set d_getgrgid_r_proto getgrgid_r $hdrs
13429                 eval $hasproto ;;
13430         *)      ;;
13431         esac
13432         case "$d_getgrgid_r_proto" in
13433         define)
13434         case "$getgrgid_r_proto" in
13435         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13436         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13437         esac
13438         case "$getgrgid_r_proto" in
13439         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13440         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13441         esac
13442         case "$getgrgid_r_proto" in
13443         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13444         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13445         esac
13446         case "$getgrgid_r_proto" in
13447         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13448         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13449         esac
13450         case "$getgrgid_r_proto" in
13451         ''|0)   d_getgrgid_r=undef
13452                 getgrgid_r_proto=0
13453                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13454         * )     case "$getgrgid_r_proto" in
13455                 REENTRANT_PROTO*) ;;
13456                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13457                 esac
13458                 echo "Prototype: $try" ;;
13459         esac
13460         ;;
13461         *)      case "$usethreads" in
13462                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13463                 esac
13464                 d_getgrgid_r=undef
13465                 getgrgid_r_proto=0
13466                 ;;
13467         esac
13468         ;;
13469 *)      getgrgid_r_proto=0
13470         ;;
13471 esac
13472
13473 : see if getgrnam_r exists
13474 set getgrnam_r d_getgrnam_r
13475 eval $inlibc
13476 case "$d_getgrnam_r" in
13477 "$define")
13478         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13479         case "$d_getgrnam_r_proto:$usethreads" in
13480         ":define")      d_getgrnam_r_proto=define
13481                 set d_getgrnam_r_proto getgrnam_r $hdrs
13482                 eval $hasproto ;;
13483         *)      ;;
13484         esac
13485         case "$d_getgrnam_r_proto" in
13486         define)
13487         case "$getgrnam_r_proto" in
13488         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13489         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13490         esac
13491         case "$getgrnam_r_proto" in
13492         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13493         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13494         esac
13495         case "$getgrnam_r_proto" in
13496         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13497         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13498         esac
13499         case "$getgrnam_r_proto" in
13500         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13501         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13502         esac
13503         case "$getgrnam_r_proto" in
13504         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13505         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13506         esac
13507         case "$getgrnam_r_proto" in
13508         ''|0)   d_getgrnam_r=undef
13509                 getgrnam_r_proto=0
13510                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13511         * )     case "$getgrnam_r_proto" in
13512                 REENTRANT_PROTO*) ;;
13513                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13514                 esac
13515                 echo "Prototype: $try" ;;
13516         esac
13517         ;;
13518         *)      case "$usethreads" in
13519                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13520                 esac
13521                 d_getgrnam_r=undef
13522                 getgrnam_r_proto=0
13523                 ;;
13524         esac
13525         ;;
13526 *)      getgrnam_r_proto=0
13527         ;;
13528 esac
13529
13530 : see if gethostbyaddr exists
13531 set gethostbyaddr d_gethbyaddr
13532 eval $inlibc
13533
13534 : see if gethostbyname exists
13535 set gethostbyname d_gethbyname
13536 eval $inlibc
13537
13538 : see if gethostent exists
13539 set gethostent d_gethent
13540 eval $inlibc
13541
13542 : see how we will look up host name
13543 echo " "
13544 call=''
13545 if set gethostname val -f d_gethname; eval $csym; $val; then
13546         echo 'gethostname() found.' >&4
13547         d_gethname="$define"
13548         call=gethostname
13549 fi
13550 if set uname val -f d_uname; eval $csym; $val; then
13551         if ./xenix; then
13552                 $cat <<'EOM'
13553 uname() was found, but you're running xenix, and older versions of xenix
13554 have a broken uname(). If you don't really know whether your xenix is old
13555 enough to have a broken system call, use the default answer.
13556
13557 EOM
13558                 dflt=y
13559                 case "$d_uname" in
13560                 "$define") dflt=n;;
13561                 esac
13562                 rp='Is your uname() broken?'
13563                 . ./myread
13564                 case "$ans" in
13565                 n*) d_uname="$define"; call=uname;;
13566                 esac
13567         else
13568                 echo 'uname() found.' >&4
13569                 d_uname="$define"
13570                 case "$call" in
13571                 '') call=uname ;;
13572                 esac
13573         fi
13574 fi
13575 case "$d_gethname" in
13576 '') d_gethname="$undef";;
13577 esac
13578 case "$d_uname" in
13579 '') d_uname="$undef";;
13580 esac
13581 case "$d_uname$d_gethname" in
13582 *define*)
13583         dflt=n
13584         cat <<EOM
13585
13586 Every now and then someone has a $call() that lies about the hostname
13587 but can't be fixed for political or economic reasons.  If you wish, I can
13588 pretend $call() isn't there and maybe compute hostname at run-time
13589 thanks to the '$phostname' command.
13590
13591 EOM
13592         rp="Shall I ignore $call() from now on?"
13593         . ./myread
13594         case "$ans" in
13595         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13596         esac;;
13597 esac
13598 case "$phostname" in
13599 '') aphostname='';;
13600 *) case "$aphostname" in
13601         /*) ;;
13602         *) set X $phostname
13603                 shift
13604                 file=$1
13605                 shift
13606                 file=`./loc $file $file $pth`
13607                 aphostname=`echo $file $*`
13608                 ;;
13609         esac
13610         ;;
13611 esac
13612 case "$d_uname$d_gethname" in
13613 *define*) ;;
13614 *)
13615         case "$phostname" in
13616         '')
13617                 echo "There will be no way for $package to get your hostname." >&4;;
13618         *)
13619         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13620                 ;;
13621         esac;;
13622 esac
13623 case "$d_phostname" in
13624 '') d_phostname="$undef";;
13625 esac
13626
13627 : see if gethostbyaddr_r exists
13628 set gethostbyaddr_r d_gethostbyaddr_r
13629 eval $inlibc
13630 case "$d_gethostbyaddr_r" in
13631 "$define")
13632         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13633         case "$d_gethostbyaddr_r_proto:$usethreads" in
13634         ":define")      d_gethostbyaddr_r_proto=define
13635                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13636                 eval $hasproto ;;
13637         *)      ;;
13638         esac
13639         case "$d_gethostbyaddr_r_proto" in
13640         define)
13641         case "$gethostbyaddr_r_proto" in
13642         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13643         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13644         esac
13645         case "$gethostbyaddr_r_proto" in
13646         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13647         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13648         esac
13649         case "$gethostbyaddr_r_proto" in
13650         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13651         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13652         esac
13653         case "$gethostbyaddr_r_proto" in
13654         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13655         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13656         esac
13657         case "$gethostbyaddr_r_proto" in
13658         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13659         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13660         esac
13661         case "$gethostbyaddr_r_proto" in
13662         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13663         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13664         esac
13665         case "$gethostbyaddr_r_proto" in
13666         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13667         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13668         esac
13669         case "$gethostbyaddr_r_proto" in
13670         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13671         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13672         esac
13673         case "$gethostbyaddr_r_proto" in
13674         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13675         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13676         esac
13677         case "$gethostbyaddr_r_proto" in
13678         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13679         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13680         esac
13681         case "$gethostbyaddr_r_proto" in
13682         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13683         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13684         esac
13685         case "$gethostbyaddr_r_proto" in
13686         ''|0)   d_gethostbyaddr_r=undef
13687                 gethostbyaddr_r_proto=0
13688                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13689         * )     case "$gethostbyaddr_r_proto" in
13690                 REENTRANT_PROTO*) ;;
13691                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13692                 esac
13693                 echo "Prototype: $try" ;;
13694         esac
13695         ;;
13696         *)      case "$usethreads" in
13697                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13698                 esac
13699                 d_gethostbyaddr_r=undef
13700                 gethostbyaddr_r_proto=0
13701                 ;;
13702         esac
13703         ;;
13704 *)      gethostbyaddr_r_proto=0
13705         ;;
13706 esac
13707
13708 : see if gethostbyname_r exists
13709 set gethostbyname_r d_gethostbyname_r
13710 eval $inlibc
13711 case "$d_gethostbyname_r" in
13712 "$define")
13713         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13714         case "$d_gethostbyname_r_proto:$usethreads" in
13715         ":define")      d_gethostbyname_r_proto=define
13716                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13717                 eval $hasproto ;;
13718         *)      ;;
13719         esac
13720         case "$d_gethostbyname_r_proto" in
13721         define)
13722         case "$gethostbyname_r_proto" in
13723         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13724         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13725         esac
13726         case "$gethostbyname_r_proto" in
13727         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13728         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13729         esac
13730         case "$gethostbyname_r_proto" in
13731         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13732         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13733         esac
13734         case "$gethostbyname_r_proto" in
13735         ''|0)   d_gethostbyname_r=undef
13736                 gethostbyname_r_proto=0
13737                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13738         * )     case "$gethostbyname_r_proto" in
13739                 REENTRANT_PROTO*) ;;
13740                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13741                 esac
13742                 echo "Prototype: $try" ;;
13743         esac
13744         ;;
13745         *)      case "$usethreads" in
13746                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13747                 esac
13748                 d_gethostbyname_r=undef
13749                 gethostbyname_r_proto=0
13750                 ;;
13751         esac
13752         ;;
13753 *)      gethostbyname_r_proto=0
13754         ;;
13755 esac
13756
13757 : see if gethostent_r exists
13758 set gethostent_r d_gethostent_r
13759 eval $inlibc
13760 case "$d_gethostent_r" in
13761 "$define")
13762         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13763         case "$d_gethostent_r_proto:$usethreads" in
13764         ":define")      d_gethostent_r_proto=define
13765                 set d_gethostent_r_proto gethostent_r $hdrs
13766                 eval $hasproto ;;
13767         *)      ;;
13768         esac
13769         case "$d_gethostent_r_proto" in
13770         define)
13771         case "$gethostent_r_proto" in
13772         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13773         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13774         esac
13775         case "$gethostent_r_proto" in
13776         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13777         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13778         esac
13779         case "$gethostent_r_proto" in
13780         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13781         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13782         esac
13783         case "$gethostent_r_proto" in
13784         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13785         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13786         esac
13787         case "$gethostent_r_proto" in
13788         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13789         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13790         esac
13791         case "$gethostent_r_proto" in
13792         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13793         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13794         esac
13795         case "$gethostent_r_proto" in
13796         ''|0)   d_gethostent_r=undef
13797                 gethostent_r_proto=0
13798                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13799         * )     case "$gethostent_r_proto" in
13800                 REENTRANT_PROTO*) ;;
13801                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13802                 esac
13803                 echo "Prototype: $try" ;;
13804         esac
13805         ;;
13806         *)      case "$usethreads" in
13807                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13808                 esac
13809                 d_gethostent_r=undef
13810                 gethostent_r_proto=0
13811                 ;;
13812         esac
13813         ;;
13814 *)      gethostent_r_proto=0
13815         ;;
13816 esac
13817
13818 : see if prototypes for various gethostxxx netdb.h functions are available
13819 echo " "
13820 set d_gethostprotos gethostent $i_netdb netdb.h
13821 eval $hasproto
13822
13823 : see if getitimer exists
13824 set getitimer d_getitimer
13825 eval $inlibc
13826
13827 : see if getlogin exists
13828 set getlogin d_getlogin
13829 eval $inlibc
13830
13831 : see if getlogin_r exists
13832 set getlogin_r d_getlogin_r
13833 eval $inlibc
13834 case "$d_getlogin_r" in
13835 "$define")
13836         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13837         case "$d_getlogin_r_proto:$usethreads" in
13838         ":define")      d_getlogin_r_proto=define
13839                 set d_getlogin_r_proto getlogin_r $hdrs
13840                 eval $hasproto ;;
13841         *)      ;;
13842         esac
13843         case "$d_getlogin_r_proto" in
13844         define)
13845         case "$getlogin_r_proto" in
13846         ''|0) try='int getlogin_r(char*, size_t);'
13847         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13848         esac
13849         case "$getlogin_r_proto" in
13850         ''|0) try='int getlogin_r(char*, int);'
13851         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13852         esac
13853         case "$getlogin_r_proto" in
13854         ''|0) try='char* getlogin_r(char*, size_t);'
13855         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13856         esac
13857         case "$getlogin_r_proto" in
13858         ''|0) try='char* getlogin_r(char*, int);'
13859         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
13860         esac
13861         case "$getlogin_r_proto" in
13862         ''|0)   d_getlogin_r=undef
13863                 getlogin_r_proto=0
13864                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13865         * )     case "$getlogin_r_proto" in
13866                 REENTRANT_PROTO*) ;;
13867                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13868                 esac
13869                 echo "Prototype: $try" ;;
13870         esac
13871         ;;
13872         *)      case "$usethreads" in
13873                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13874                 esac
13875                 d_getlogin_r=undef
13876                 getlogin_r_proto=0
13877                 ;;
13878         esac
13879         ;;
13880 *)      getlogin_r_proto=0
13881         ;;
13882 esac
13883
13884 : see if getmnt exists
13885 set getmnt d_getmnt
13886 eval $inlibc
13887
13888 : see if getmntent exists
13889 set getmntent d_getmntent
13890 eval $inlibc
13891
13892 : see if getnetbyaddr exists
13893 set getnetbyaddr d_getnbyaddr
13894 eval $inlibc
13895
13896 : see if getnetbyname exists
13897 set getnetbyname d_getnbyname
13898 eval $inlibc
13899
13900 : see if getnetent exists
13901 set getnetent d_getnent
13902 eval $inlibc
13903
13904 : see if getnetbyaddr_r exists
13905 set getnetbyaddr_r d_getnetbyaddr_r
13906 eval $inlibc
13907 case "$d_getnetbyaddr_r" in
13908 "$define")
13909         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13910         case "$d_getnetbyaddr_r_proto:$usethreads" in
13911         ":define")      d_getnetbyaddr_r_proto=define
13912                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13913                 eval $hasproto ;;
13914         *)      ;;
13915         esac
13916         case "$d_getnetbyaddr_r_proto" in
13917         define)
13918         case "$getnetbyaddr_r_proto" in
13919         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13920         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13921         esac
13922         case "$getnetbyaddr_r_proto" in
13923         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13924         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13925         esac
13926         case "$getnetbyaddr_r_proto" in
13927         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13928         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13929         esac
13930         case "$getnetbyaddr_r_proto" in
13931         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13932         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13933         esac
13934         case "$getnetbyaddr_r_proto" in
13935         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13936         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13937         esac
13938         case "$getnetbyaddr_r_proto" in
13939         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13940         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13941         esac
13942         case "$getnetbyaddr_r_proto" in
13943         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13944         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13945         esac
13946         case "$getnetbyaddr_r_proto" in
13947         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13948         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13949         esac
13950         case "$getnetbyaddr_r_proto" in
13951         ''|0)   d_getnetbyaddr_r=undef
13952                 getnetbyaddr_r_proto=0
13953                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13954         * )     case "$getnetbyaddr_r_proto" in
13955                 REENTRANT_PROTO*) ;;
13956                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13957                 esac
13958                 echo "Prototype: $try" ;;
13959         esac
13960         ;;
13961         *)      case "$usethreads" in
13962                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13963                 esac
13964                 d_getnetbyaddr_r=undef
13965                 getnetbyaddr_r_proto=0
13966                 ;;
13967         esac
13968         ;;
13969 *)      getnetbyaddr_r_proto=0
13970         ;;
13971 esac
13972
13973 : see if getnetbyname_r exists
13974 set getnetbyname_r d_getnetbyname_r
13975 eval $inlibc
13976 case "$d_getnetbyname_r" in
13977 "$define")
13978         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13979         case "$d_getnetbyname_r_proto:$usethreads" in
13980         ":define")      d_getnetbyname_r_proto=define
13981                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13982                 eval $hasproto ;;
13983         *)      ;;
13984         esac
13985         case "$d_getnetbyname_r_proto" in
13986         define)
13987         case "$getnetbyname_r_proto" in
13988         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13989         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13990         esac
13991         case "$getnetbyname_r_proto" in
13992         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13993         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13994         esac
13995         case "$getnetbyname_r_proto" in
13996         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13997         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13998         esac
13999         case "$getnetbyname_r_proto" in
14000         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14001         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14002         esac
14003         case "$getnetbyname_r_proto" in
14004         ''|0)   d_getnetbyname_r=undef
14005                 getnetbyname_r_proto=0
14006                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14007         * )     case "$getnetbyname_r_proto" in
14008                 REENTRANT_PROTO*) ;;
14009                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14010                 esac
14011                 echo "Prototype: $try" ;;
14012         esac
14013         ;;
14014         *)      case "$usethreads" in
14015                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14016                 esac
14017                 d_getnetbyname_r=undef
14018                 getnetbyname_r_proto=0
14019                 ;;
14020         esac
14021         ;;
14022 *)      getnetbyname_r_proto=0
14023         ;;
14024 esac
14025
14026 : see if getnetent_r exists
14027 set getnetent_r d_getnetent_r
14028 eval $inlibc
14029 case "$d_getnetent_r" in
14030 "$define")
14031         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14032         case "$d_getnetent_r_proto:$usethreads" in
14033         ":define")      d_getnetent_r_proto=define
14034                 set d_getnetent_r_proto getnetent_r $hdrs
14035                 eval $hasproto ;;
14036         *)      ;;
14037         esac
14038         case "$d_getnetent_r_proto" in
14039         define)
14040         case "$getnetent_r_proto" in
14041         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14042         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14043         esac
14044         case "$getnetent_r_proto" in
14045         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14046         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14047         esac
14048         case "$getnetent_r_proto" in
14049         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14050         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14051         esac
14052         case "$getnetent_r_proto" in
14053         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14054         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14055         esac
14056         case "$getnetent_r_proto" in
14057         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14058         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14059         esac
14060         case "$getnetent_r_proto" in
14061         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14062         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14063         esac
14064         case "$getnetent_r_proto" in
14065         ''|0)   d_getnetent_r=undef
14066                 getnetent_r_proto=0
14067                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14068         * )     case "$getnetent_r_proto" in
14069                 REENTRANT_PROTO*) ;;
14070                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14071                 esac
14072                 echo "Prototype: $try" ;;
14073         esac
14074         ;;
14075         *)      case "$usethreads" in
14076                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14077                 esac
14078                 d_getnetent_r=undef
14079                 getnetent_r_proto=0
14080                 ;;
14081         esac
14082         ;;
14083 *)      getnetent_r_proto=0
14084         ;;
14085 esac
14086
14087 : see if prototypes for various getnetxxx netdb.h functions are available
14088 echo " "
14089 set d_getnetprotos getnetent $i_netdb netdb.h
14090 eval $hasproto
14091
14092 : see if getpagesize exists
14093 set getpagesize d_getpagsz
14094 eval $inlibc
14095
14096 : Optional checks for getprotobyname and getprotobynumber
14097
14098 : see if getprotobyname exists
14099 set getprotobyname d_getpbyname
14100 eval $inlibc
14101
14102 : see if getprotobynumber exists
14103 set getprotobynumber d_getpbynumber
14104 eval $inlibc
14105
14106 : see if getprotoent exists
14107 set getprotoent d_getpent
14108 eval $inlibc
14109
14110 : see if getpgid exists
14111 set getpgid d_getpgid
14112 eval $inlibc
14113
14114 : see if getpgrp2 exists
14115 set getpgrp2 d_getpgrp2
14116 eval $inlibc
14117
14118 : see if getppid exists
14119 set getppid d_getppid
14120 eval $inlibc
14121
14122 : see if getpriority exists
14123 set getpriority d_getprior
14124 eval $inlibc
14125
14126 : see if getprotobyname_r exists
14127 set getprotobyname_r d_getprotobyname_r
14128 eval $inlibc
14129 case "$d_getprotobyname_r" in
14130 "$define")
14131         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14132         case "$d_getprotobyname_r_proto:$usethreads" in
14133         ":define")      d_getprotobyname_r_proto=define
14134                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14135                 eval $hasproto ;;
14136         *)      ;;
14137         esac
14138         case "$d_getprotobyname_r_proto" in
14139         define)
14140         case "$getprotobyname_r_proto" in
14141         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14142         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14143         esac
14144         case "$getprotobyname_r_proto" in
14145         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14146         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14147         esac
14148         case "$getprotobyname_r_proto" in
14149         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14150         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14151         esac
14152         case "$getprotobyname_r_proto" in
14153         ''|0)   d_getprotobyname_r=undef
14154                 getprotobyname_r_proto=0
14155                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14156         * )     case "$getprotobyname_r_proto" in
14157                 REENTRANT_PROTO*) ;;
14158                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14159                 esac
14160                 echo "Prototype: $try" ;;
14161         esac
14162         ;;
14163         *)      case "$usethreads" in
14164                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14165                 esac
14166                 d_getprotobyname_r=undef
14167                 getprotobyname_r_proto=0
14168                 ;;
14169         esac
14170         ;;
14171 *)      getprotobyname_r_proto=0
14172         ;;
14173 esac
14174
14175 : see if getprotobynumber_r exists
14176 set getprotobynumber_r d_getprotobynumber_r
14177 eval $inlibc
14178 case "$d_getprotobynumber_r" in
14179 "$define")
14180         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14181         case "$d_getprotobynumber_r_proto:$usethreads" in
14182         ":define")      d_getprotobynumber_r_proto=define
14183                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14184                 eval $hasproto ;;
14185         *)      ;;
14186         esac
14187         case "$d_getprotobynumber_r_proto" in
14188         define)
14189         case "$getprotobynumber_r_proto" in
14190         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14191         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14192         esac
14193         case "$getprotobynumber_r_proto" in
14194         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14195         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14196         esac
14197         case "$getprotobynumber_r_proto" in
14198         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14199         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14200         esac
14201         case "$getprotobynumber_r_proto" in
14202         ''|0)   d_getprotobynumber_r=undef
14203                 getprotobynumber_r_proto=0
14204                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14205         * )     case "$getprotobynumber_r_proto" in
14206                 REENTRANT_PROTO*) ;;
14207                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14208                 esac
14209                 echo "Prototype: $try" ;;
14210         esac
14211         ;;
14212         *)      case "$usethreads" in
14213                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14214                 esac
14215                 d_getprotobynumber_r=undef
14216                 getprotobynumber_r_proto=0
14217                 ;;
14218         esac
14219         ;;
14220 *)      getprotobynumber_r_proto=0
14221         ;;
14222 esac
14223
14224 : see if getprotoent_r exists
14225 set getprotoent_r d_getprotoent_r
14226 eval $inlibc
14227 case "$d_getprotoent_r" in
14228 "$define")
14229         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14230         case "$d_getprotoent_r_proto:$usethreads" in
14231         ":define")      d_getprotoent_r_proto=define
14232                 set d_getprotoent_r_proto getprotoent_r $hdrs
14233                 eval $hasproto ;;
14234         *)      ;;
14235         esac
14236         case "$d_getprotoent_r_proto" in
14237         define)
14238         case "$getprotoent_r_proto" in
14239         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14240         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14241         esac
14242         case "$getprotoent_r_proto" in
14243         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14244         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14245         esac
14246         case "$getprotoent_r_proto" in
14247         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14248         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14249         esac
14250         case "$getprotoent_r_proto" in
14251         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14252         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14253         esac
14254         case "$getprotoent_r_proto" in
14255         ''|0)   d_getprotoent_r=undef
14256                 getprotoent_r_proto=0
14257                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14258         * )     case "$getprotoent_r_proto" in
14259                 REENTRANT_PROTO*) ;;
14260                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14261                 esac
14262                 echo "Prototype: $try" ;;
14263         esac
14264         ;;
14265         *)      case "$usethreads" in
14266                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14267                 esac
14268                 d_getprotoent_r=undef
14269                 getprotoent_r_proto=0
14270                 ;;
14271         esac
14272         ;;
14273 *)      getprotoent_r_proto=0
14274         ;;
14275 esac
14276
14277 : see if prototypes for various getprotoxxx netdb.h functions are available
14278 echo " "
14279 set d_getprotoprotos getprotoent $i_netdb netdb.h
14280 eval $hasproto
14281
14282 : see if getprpwnam exists
14283 set getprpwnam d_getprpwnam
14284 eval $inlibc
14285
14286 : see if getpwent exists
14287 set getpwent d_getpwent
14288 eval $inlibc
14289
14290 : see if getpwent_r exists
14291 set getpwent_r d_getpwent_r
14292 eval $inlibc
14293 case "$d_getpwent_r" in
14294 "$define")
14295         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14296         case "$d_getpwent_r_proto:$usethreads" in
14297         ":define")      d_getpwent_r_proto=define
14298                 set d_getpwent_r_proto getpwent_r $hdrs
14299                 eval $hasproto ;;
14300         *)      ;;
14301         esac
14302         case "$d_getpwent_r_proto" in
14303         define)
14304         case "$getpwent_r_proto" in
14305         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14306         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14307         esac
14308         case "$getpwent_r_proto" in
14309         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14310         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14311         esac
14312         case "$getpwent_r_proto" in
14313         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14314         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14315         esac
14316         case "$getpwent_r_proto" in
14317         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14318         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14319         esac
14320         case "$getpwent_r_proto" in
14321         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14322         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14323         esac
14324         case "$getpwent_r_proto" in
14325         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14326         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14327         esac
14328         case "$getpwent_r_proto" in
14329         ''|0)   d_getpwent_r=undef
14330                 getpwent_r_proto=0
14331                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14332         * )     case "$getpwent_r_proto" in
14333                 REENTRANT_PROTO*) ;;
14334                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14335                 esac
14336                 echo "Prototype: $try" ;;
14337         esac
14338         ;;
14339         *)      case "$usethreads" in
14340                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14341                 esac
14342                 d_getpwent_r=undef
14343                 getpwent_r_proto=0
14344                 ;;
14345         esac
14346         ;;
14347 *)      getpwent_r_proto=0
14348         ;;
14349 esac
14350
14351 : see if getpwnam_r exists
14352 set getpwnam_r d_getpwnam_r
14353 eval $inlibc
14354 case "$d_getpwnam_r" in
14355 "$define")
14356         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14357         case "$d_getpwnam_r_proto:$usethreads" in
14358         ":define")      d_getpwnam_r_proto=define
14359                 set d_getpwnam_r_proto getpwnam_r $hdrs
14360                 eval $hasproto ;;
14361         *)      ;;
14362         esac
14363         case "$d_getpwnam_r_proto" in
14364         define)
14365         case "$getpwnam_r_proto" in
14366         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14367         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14368         esac
14369         case "$getpwnam_r_proto" in
14370         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14371         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14372         esac
14373         case "$getpwnam_r_proto" in
14374         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14375         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14376         esac
14377         case "$getpwnam_r_proto" in
14378         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14379         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14380         esac
14381         case "$getpwnam_r_proto" in
14382         ''|0)   d_getpwnam_r=undef
14383                 getpwnam_r_proto=0
14384                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14385         * )     case "$getpwnam_r_proto" in
14386                 REENTRANT_PROTO*) ;;
14387                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14388                 esac
14389                 echo "Prototype: $try" ;;
14390         esac
14391         ;;
14392         *)      case "$usethreads" in
14393                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14394                 esac
14395                 d_getpwnam_r=undef
14396                 getpwnam_r_proto=0
14397                 ;;
14398         esac
14399         ;;
14400 *)      getpwnam_r_proto=0
14401         ;;
14402 esac
14403
14404 : see if getpwuid_r exists
14405 set getpwuid_r d_getpwuid_r
14406 eval $inlibc
14407 case "$d_getpwuid_r" in
14408 "$define")
14409         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14410         case "$d_getpwuid_r_proto:$usethreads" in
14411         ":define")      d_getpwuid_r_proto=define
14412                 set d_getpwuid_r_proto getpwuid_r $hdrs
14413                 eval $hasproto ;;
14414         *)      ;;
14415         esac
14416         case "$d_getpwuid_r_proto" in
14417         define)
14418         case "$getpwuid_r_proto" in
14419         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14420         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14421         esac
14422         case "$getpwuid_r_proto" in
14423         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14424         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14425         esac
14426         case "$getpwuid_r_proto" in
14427         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14428         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14429         esac
14430         case "$getpwuid_r_proto" in
14431         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14432         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14433         esac
14434         case "$getpwuid_r_proto" in
14435         ''|0)   d_getpwuid_r=undef
14436                 getpwuid_r_proto=0
14437                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14438         * )     case "$getpwuid_r_proto" in
14439                 REENTRANT_PROTO*) ;;
14440                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14441                 esac
14442                 echo "Prototype: $try" ;;
14443         esac
14444         ;;
14445         *)      case "$usethreads" in
14446                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14447                 esac
14448                 d_getpwuid_r=undef
14449                 getpwuid_r_proto=0
14450                 ;;
14451         esac
14452         ;;
14453 *)      getpwuid_r_proto=0
14454         ;;
14455 esac
14456
14457 : Optional checks for getsbyname and getsbyport
14458
14459 : see if getservbyname exists
14460 set getservbyname d_getsbyname
14461 eval $inlibc
14462
14463 : see if getservbyport exists
14464 set getservbyport d_getsbyport
14465 eval $inlibc
14466
14467 : see if getservent exists
14468 set getservent d_getsent
14469 eval $inlibc
14470
14471 : see if getservbyname_r exists
14472 set getservbyname_r d_getservbyname_r
14473 eval $inlibc
14474 case "$d_getservbyname_r" in
14475 "$define")
14476         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14477         case "$d_getservbyname_r_proto:$usethreads" in
14478         ":define")      d_getservbyname_r_proto=define
14479                 set d_getservbyname_r_proto getservbyname_r $hdrs
14480                 eval $hasproto ;;
14481         *)      ;;
14482         esac
14483         case "$d_getservbyname_r_proto" in
14484         define)
14485         case "$getservbyname_r_proto" in
14486         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14487         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14488         esac
14489         case "$getservbyname_r_proto" in
14490         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14491         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14492         esac
14493         case "$getservbyname_r_proto" in
14494         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14495         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14496         esac
14497         case "$getservbyname_r_proto" in
14498         ''|0)   d_getservbyname_r=undef
14499                 getservbyname_r_proto=0
14500                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14501         * )     case "$getservbyname_r_proto" in
14502                 REENTRANT_PROTO*) ;;
14503                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14504                 esac
14505                 echo "Prototype: $try" ;;
14506         esac
14507         ;;
14508         *)      case "$usethreads" in
14509                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14510                 esac
14511                 d_getservbyname_r=undef
14512                 getservbyname_r_proto=0
14513                 ;;
14514         esac
14515         ;;
14516 *)      getservbyname_r_proto=0
14517         ;;
14518 esac
14519
14520 : see if getservbyport_r exists
14521 set getservbyport_r d_getservbyport_r
14522 eval $inlibc
14523 case "$d_getservbyport_r" in
14524 "$define")
14525         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14526         case "$d_getservbyport_r_proto:$usethreads" in
14527         ":define")      d_getservbyport_r_proto=define
14528                 set d_getservbyport_r_proto getservbyport_r $hdrs
14529                 eval $hasproto ;;
14530         *)      ;;
14531         esac
14532         case "$d_getservbyport_r_proto" in
14533         define)
14534         case "$getservbyport_r_proto" in
14535         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14536         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14537         esac
14538         case "$getservbyport_r_proto" in
14539         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14540         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14541         esac
14542         case "$getservbyport_r_proto" in
14543         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14544         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14545         esac
14546         case "$getservbyport_r_proto" in
14547         ''|0)   d_getservbyport_r=undef
14548                 getservbyport_r_proto=0
14549                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14550         * )     case "$getservbyport_r_proto" in
14551                 REENTRANT_PROTO*) ;;
14552                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14553                 esac
14554                 echo "Prototype: $try" ;;
14555         esac
14556         ;;
14557         *)      case "$usethreads" in
14558                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14559                 esac
14560                 d_getservbyport_r=undef
14561                 getservbyport_r_proto=0
14562                 ;;
14563         esac
14564         ;;
14565 *)      getservbyport_r_proto=0
14566         ;;
14567 esac
14568
14569 : see if getservent_r exists
14570 set getservent_r d_getservent_r
14571 eval $inlibc
14572 case "$d_getservent_r" in
14573 "$define")
14574         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14575         case "$d_getservent_r_proto:$usethreads" in
14576         ":define")      d_getservent_r_proto=define
14577                 set d_getservent_r_proto getservent_r $hdrs
14578                 eval $hasproto ;;
14579         *)      ;;
14580         esac
14581         case "$d_getservent_r_proto" in
14582         define)
14583         case "$getservent_r_proto" in
14584         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14585         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14586         esac
14587         case "$getservent_r_proto" in
14588         ''|0) try='int getservent_r(struct servent*, char*, int);'
14589         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14590         esac
14591         case "$getservent_r_proto" in
14592         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14593         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14594         esac
14595         case "$getservent_r_proto" in
14596         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14597         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14598         esac
14599         case "$getservent_r_proto" in
14600         ''|0)   d_getservent_r=undef
14601                 getservent_r_proto=0
14602                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14603         * )     case "$getservent_r_proto" in
14604                 REENTRANT_PROTO*) ;;
14605                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14606                 esac
14607                 echo "Prototype: $try" ;;
14608         esac
14609         ;;
14610         *)      case "$usethreads" in
14611                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14612                 esac
14613                 d_getservent_r=undef
14614                 getservent_r_proto=0
14615                 ;;
14616         esac
14617         ;;
14618 *)      getservent_r_proto=0
14619         ;;
14620 esac
14621
14622 : see if prototypes for various getservxxx netdb.h functions are available
14623 echo " "
14624 set d_getservprotos getservent $i_netdb netdb.h
14625 eval $hasproto
14626
14627 : see if getspnam exists
14628 set getspnam d_getspnam
14629 eval $inlibc
14630
14631 : see if this is a shadow.h system
14632 set shadow.h i_shadow
14633 eval $inhdr
14634
14635 : see if getspnam_r exists
14636 set getspnam_r d_getspnam_r
14637 eval $inlibc
14638 case "$d_getspnam_r" in
14639 "$define")
14640         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14641         case "$d_getspnam_r_proto:$usethreads" in
14642         ":define")      d_getspnam_r_proto=define
14643                 set d_getspnam_r_proto getspnam_r $hdrs
14644                 eval $hasproto ;;
14645         *)      ;;
14646         esac
14647         case "$d_getspnam_r_proto" in
14648         define)
14649         case "$getspnam_r_proto" in
14650         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14651         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14652         esac
14653         case "$getspnam_r_proto" in
14654         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14655         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14656         esac
14657         case "$getspnam_r_proto" in
14658         ''|0)   d_getspnam_r=undef
14659                 getspnam_r_proto=0
14660                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14661         * )     case "$getspnam_r_proto" in
14662                 REENTRANT_PROTO*) ;;
14663                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14664                 esac
14665                 echo "Prototype: $try" ;;
14666         esac
14667         ;;
14668         *)      case "$usethreads" in
14669                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14670                 esac
14671                 d_getspnam_r=undef
14672                 getspnam_r_proto=0
14673                 ;;
14674         esac
14675         ;;
14676 *)      getspnam_r_proto=0
14677         ;;
14678 esac
14679
14680 : see if gettimeofday or ftime exists
14681 set gettimeofday d_gettimeod
14682 eval $inlibc
14683 case "$d_gettimeod" in
14684 "$undef")
14685         set ftime d_ftime 
14686         eval $inlibc
14687         ;;
14688 *)
14689         val="$undef"; set d_ftime; eval $setvar
14690         ;;
14691 esac
14692 case "$d_gettimeod$d_ftime" in
14693 "$undef$undef")
14694         echo " "
14695         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14696         ;;
14697 esac
14698
14699 : see if gmtime_r exists
14700 set gmtime_r d_gmtime_r
14701 eval $inlibc
14702 case "$d_gmtime_r" in
14703 "$define")
14704         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14705         case "$d_gmtime_r_proto:$usethreads" in
14706         ":define")      d_gmtime_r_proto=define
14707                 set d_gmtime_r_proto gmtime_r $hdrs
14708                 eval $hasproto ;;
14709         *)      ;;
14710         esac
14711         case "$d_gmtime_r_proto" in
14712         define)
14713         case "$gmtime_r_proto" in
14714         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14715         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14716         esac
14717         case "$gmtime_r_proto" in
14718         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14719         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14720         esac
14721         case "$gmtime_r_proto" in
14722         ''|0)   d_gmtime_r=undef
14723                 gmtime_r_proto=0
14724                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14725         * )     case "$gmtime_r_proto" in
14726                 REENTRANT_PROTO*) ;;
14727                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14728                 esac
14729                 echo "Prototype: $try" ;;
14730         esac
14731         ;;
14732         *)      case "$usethreads" in
14733                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14734                 esac
14735                 d_gmtime_r=undef
14736                 gmtime_r_proto=0
14737                 ;;
14738         esac
14739         ;;
14740 *)      gmtime_r_proto=0
14741         ;;
14742 esac
14743
14744 : see if hasmntopt exists
14745 set hasmntopt d_hasmntopt
14746 eval $inlibc
14747
14748 : see if this is a netinet/in.h or sys/in.h system
14749 set netinet/in.h i_niin sys/in.h i_sysin
14750 eval $inhdr
14751
14752 : see if arpa/inet.h has to be included
14753 set arpa/inet.h i_arpainet
14754 eval $inhdr
14755
14756 : see if htonl --and friends-- exists
14757 val=''
14758 set htonl val
14759 eval $inlibc
14760
14761 : Maybe they are macros.
14762 case "$val" in
14763 $undef)
14764         $cat >htonl.c <<EOM
14765 #include <stdio.h>
14766 #include <sys/types.h>
14767 #$i_niin I_NETINET_IN
14768 #$i_sysin I_SYS_IN
14769 #$i_arpainet I_ARPA_INET
14770 #ifdef I_NETINET_IN
14771 #include <netinet/in.h>
14772 #endif
14773 #ifdef I_SYS_IN
14774 #include <sys/in.h>
14775 #endif
14776 #ifdef I_ARPA_INET
14777 #include <arpa/inet.h>
14778 #endif
14779 #ifdef htonl
14780 printf("Defined as a macro.");
14781 #endif
14782 EOM
14783         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14784         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14785                 val="$define"
14786                 echo "But it seems to be defined as a macro." >&4
14787         fi
14788         $rm -f htonl.?
14789         ;;
14790 esac
14791 set d_htonl
14792 eval $setvar
14793
14794 : see if ilogbl exists
14795 set ilogbl d_ilogbl
14796 eval $inlibc
14797
14798 : index or strchr
14799 echo " "
14800 if set index val -f; eval $csym; $val; then
14801         if set strchr val -f d_strchr; eval $csym; $val; then
14802                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14803                         val="$define"
14804                         vali="$undef"
14805                         echo "strchr() found." >&4
14806                 else
14807                         val="$undef"
14808                         vali="$define"
14809                         echo "index() found." >&4
14810                 fi
14811         else
14812                 val="$undef"
14813                 vali="$define"
14814                 echo "index() found." >&4
14815         fi
14816 else
14817         if set strchr val -f d_strchr; eval $csym; $val; then
14818                 val="$define"
14819                 vali="$undef"
14820                 echo "strchr() found." >&4
14821         else
14822                 echo "No index() or strchr() found!" >&4
14823                 val="$undef"
14824                 vali="$undef"
14825         fi
14826 fi
14827 set d_strchr; eval $setvar
14828 val="$vali"
14829 set d_index; eval $setvar
14830
14831 : check whether inet_aton exists
14832 set inet_aton d_inetaton
14833 eval $inlibc
14834
14835 : Look for isascii
14836 echo " "
14837 $cat >isascii.c <<EOCP
14838 #include <stdio.h>
14839 #include <ctype.h>
14840 #$i_stdlib I_STDLIB
14841 #ifdef I_STDLIB
14842 #include <stdlib.h>
14843 #endif
14844 int main() {
14845         int c = 'A';
14846         if (isascii(c))
14847                 exit(0);
14848         else
14849                 exit(1);
14850 }
14851 EOCP
14852 set isascii
14853 if eval $compile; then
14854         echo "isascii() found." >&4
14855         val="$define"
14856 else
14857         echo "isascii() NOT found." >&4
14858         val="$undef"
14859 fi
14860 set d_isascii
14861 eval $setvar
14862 $rm -f isascii*
14863
14864 : see if isfinite exists
14865 set isfinite d_isfinite
14866 eval $inlibc
14867
14868 : see if isinf exists
14869 set isinf d_isinf
14870 eval $inlibc
14871
14872 : see if isnan exists
14873 set isnan d_isnan
14874 eval $inlibc
14875
14876 : see if isnanl exists
14877 set isnanl d_isnanl
14878 eval $inlibc
14879
14880 : see if killpg exists
14881 set killpg d_killpg
14882 eval $inlibc
14883
14884 : see if lchown exists
14885 echo " "
14886 $cat > try.c <<'EOCP'
14887 /* System header to define __stub macros and hopefully few prototypes,
14888     which can conflict with char lchown(); below.  */
14889 #include <assert.h>
14890 /* Override any gcc2 internal prototype to avoid an error.  */
14891 /* We use char because int might match the return type of a gcc2
14892    builtin and then its argument prototype would still apply.  */
14893 char lchown();
14894 int main() {
14895     /*  The GNU C library defines this for functions which it implements
14896         to always fail with ENOSYS.  Some functions are actually named
14897         something starting with __ and the normal name is an alias.  */
14898 #if defined (__stub_lchown) || defined (__stub___lchown)
14899 choke me
14900 #else
14901 lchown();
14902 #endif
14903 ; return 0; }
14904 EOCP
14905 set try
14906 if eval $compile; then
14907     $echo "lchown() found." >&4
14908     val="$define"
14909 else
14910     $echo "lchown() NOT found." >&4
14911     val="$undef"
14912 fi
14913 set d_lchown
14914 eval $setvar
14915
14916 : See if number of significant digits in a double precision number is known
14917 echo " "
14918 $cat >ldbl_dig.c <<EOM
14919 #$i_limits I_LIMITS
14920 #$i_float I_FLOAT
14921 #ifdef I_LIMITS
14922 #include <limits.h>
14923 #endif
14924 #ifdef I_FLOAT
14925 #include <float.h>
14926 #endif
14927 #ifdef LDBL_DIG
14928 printf("Contains LDBL_DIG");
14929 #endif
14930 EOM
14931 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14932 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14933         echo "LDBL_DIG found." >&4
14934         val="$define"
14935 else
14936         echo "LDBL_DIG NOT found." >&4
14937         val="$undef"
14938 fi
14939 $rm -f ldbl_dig.?
14940 set d_ldbl_dig
14941 eval $setvar
14942
14943 : see if this is a math.h system
14944 set math.h i_math
14945 eval $inhdr
14946
14947 : check to see if math.h defines _LIB_VERSION
14948 d_libm_lib_version="$undef"
14949 case $i_math in
14950     $define)
14951         echo " "
14952         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14953         $cat >try.c <<EOCP
14954 #include <unistd.h>
14955 #include <math.h>
14956 int main (int argc, char *argv[])
14957 {
14958     printf ("%d\n", _LIB_VERSION);
14959     return (0);
14960     } /* main */
14961 EOCP
14962         set try
14963         if eval $compile; then
14964             foo=`$run ./try`
14965             echo "Yes, it does ($foo)" >&4
14966             d_libm_lib_version="$define"
14967         else
14968             echo "No, it does not (probably harmless)" >&4
14969             fi
14970         $rm_try
14971         ;;
14972
14973     esac
14974
14975 : see if link exists
14976 set link d_link
14977 eval $inlibc
14978
14979 : see if localtime_r exists
14980 set localtime_r d_localtime_r
14981 eval $inlibc
14982 case "$d_localtime_r" in
14983 "$define")
14984         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14985         case "$d_localtime_r_proto:$usethreads" in
14986         ":define")      d_localtime_r_proto=define
14987                 set d_localtime_r_proto localtime_r $hdrs
14988                 eval $hasproto ;;
14989         *)      ;;
14990         esac
14991         case "$d_localtime_r_proto" in
14992         define)
14993         case "$localtime_r_proto" in
14994         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14995         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
14996         esac
14997         case "$localtime_r_proto" in
14998         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14999         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15000         esac
15001         case "$localtime_r_proto" in
15002         ''|0)   d_localtime_r=undef
15003                 localtime_r_proto=0
15004                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15005         * )     case "$localtime_r_proto" in
15006                 REENTRANT_PROTO*) ;;
15007                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15008                 esac
15009                 echo "Prototype: $try" ;;
15010         esac
15011         ;;
15012         *)      case "$usethreads" in
15013                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15014                 esac
15015                 d_localtime_r=undef
15016                 localtime_r_proto=0
15017                 ;;
15018         esac
15019         ;;
15020 *)      localtime_r_proto=0
15021         ;;
15022 esac
15023
15024 : see if localtime_r calls tzset
15025 case "$localtime_r_proto" in
15026 REENTRANT_PROTO*)
15027         $cat >try.c <<EOCP
15028 /*  Does our libc's localtime_r call tzset ?
15029  *  return 0 if so, 1 otherwise.
15030  */
15031 #$i_systypes    I_SYS_TYPES
15032 #$i_unistd      I_UNISTD
15033 #$i_time        I_TIME
15034 #$i_stdlib      I_STDLIB
15035 #$i_string      I_STRING
15036 #$i_malloc      I_MALLOC
15037 #ifdef I_SYS_TYPES
15038 #  include <sys/types.h>
15039 #endif
15040 #ifdef I_UNISTD
15041 #  include <unistd.h>
15042 #endif
15043 #ifdef I_TIME
15044 #  include <time.h>
15045 #endif
15046 #ifdef I_STDLIB
15047 #include <stdlib.h>
15048 #endif
15049 #ifdef I_STRING
15050 #  include <string.h>
15051 #else
15052 #  include <strings.h>
15053 #endif
15054 #ifdef I_MALLOC
15055 #  include <malloc.h>
15056 #endif
15057 int main()
15058 {
15059     time_t t = time(0L);
15060     char w_tz[]="TZ" "=GMT+5",
15061          e_tz[]="TZ" "=GMT-5",
15062         *tz_e = (char*)malloc(16),
15063         *tz_w = (char*)malloc(16);
15064     struct tm tm_e, tm_w;
15065     memset(&tm_e,'\0',sizeof(struct tm));
15066     memset(&tm_w,'\0',sizeof(struct tm));
15067     strcpy(tz_e,e_tz);
15068     strcpy(tz_w,w_tz);
15069
15070     putenv(tz_e);
15071     localtime_r(&t, &tm_e);
15072
15073     putenv(tz_w);
15074     localtime_r(&t, &tm_w);
15075
15076     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15077         return 1;
15078     return 0;
15079 }
15080 EOCP
15081         set try
15082         if eval $compile; then
15083             if $run ./try; then
15084                 d_localtime_r_needs_tzset=undef;
15085             else
15086                 d_localtime_r_needs_tzset=define;
15087             fi;
15088         else
15089             d_localtime_r_needs_tzset=undef;
15090         fi;
15091      ;;
15092   *)
15093      d_localtime_r_needs_tzset=undef;
15094      ;;
15095 esac
15096 $rm_try
15097
15098 : see if localeconv exists
15099 set localeconv d_locconv
15100 eval $inlibc
15101
15102 : see if lockf exists
15103 set lockf d_lockf
15104 eval $inlibc
15105
15106 : see if prototype for lseek is available
15107 echo " "
15108 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15109 eval $hasproto
15110
15111 : see if lstat exists
15112 set lstat d_lstat
15113 eval $inlibc
15114
15115 : see if madvise exists
15116 set madvise d_madvise
15117 eval $inlibc
15118
15119 : see if malloc_size exists
15120 set malloc_size d_malloc_size
15121 eval $inlibc
15122
15123 : see if malloc_size_good exists
15124 set malloc_good_size d_malloc_good_size
15125 eval $inlibc
15126
15127 : see if mblen exists
15128 set mblen d_mblen
15129 eval $inlibc
15130
15131 : see if mbstowcs exists
15132 set mbstowcs d_mbstowcs
15133 eval $inlibc
15134
15135 : see if mbtowc exists
15136 set mbtowc d_mbtowc
15137 eval $inlibc
15138
15139 : see if memchr exists
15140 set memchr d_memchr
15141 eval $inlibc
15142
15143 : see if memcmp exists
15144 set memcmp d_memcmp
15145 eval $inlibc
15146
15147 : see if memcpy exists
15148 set memcpy d_memcpy
15149 eval $inlibc
15150
15151 : see if memmove exists
15152 set memmove d_memmove
15153 eval $inlibc
15154
15155 : see if memset exists
15156 set memset d_memset
15157 eval $inlibc
15158
15159 : see if mkdir exists
15160 set mkdir d_mkdir
15161 eval $inlibc
15162
15163 : see if mkdtemp exists
15164 set mkdtemp d_mkdtemp
15165 eval $inlibc
15166
15167 : see if mkfifo exists
15168 set mkfifo d_mkfifo
15169 eval $inlibc
15170
15171 : see if mkstemp exists
15172 set mkstemp d_mkstemp
15173 eval $inlibc
15174
15175 : see if mkstemps exists
15176 set mkstemps d_mkstemps
15177 eval $inlibc
15178
15179 : see if mktime exists
15180 set mktime d_mktime
15181 eval $inlibc
15182
15183 : see if this is a sys/mman.h system
15184 set sys/mman.h i_sysmman
15185 eval $inhdr
15186
15187 : see if mmap exists
15188 set mmap d_mmap
15189 eval $inlibc
15190 : see what shmat returns
15191 : default to something harmless
15192 mmaptype='void *'
15193 case "$i_sysmman$d_mmap" in
15194 "$define$define")
15195         $cat >mmap.c <<'END'
15196 #include <sys/mman.h>
15197 void *mmap();
15198 END
15199         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15200                 mmaptype='void *'
15201         else
15202                 mmaptype='caddr_t'
15203         fi
15204         echo "and it returns ($mmaptype)." >&4
15205         ;;
15206 esac
15207
15208
15209
15210 : see if sqrtl exists
15211 set sqrtl d_sqrtl
15212 eval $inlibc
15213
15214 : see if scalbnl exists
15215 set scalbnl d_scalbnl
15216 eval $inlibc
15217
15218 : see if modfl exists
15219 set modfl d_modfl
15220 eval $inlibc
15221
15222 : see if prototype for modfl is available
15223 echo " "
15224 set d_modflproto modfl $i_math math.h
15225 eval $hasproto
15226
15227 d_modfl_pow32_bug="$undef"
15228
15229 case "$d_longdbl$d_modfl" in
15230 $define$define)
15231         $cat <<EOM
15232 Checking to see whether your modfl() is okay for large values...
15233 EOM
15234 $cat >try.c <<EOCP
15235 #include <math.h>
15236 #include <stdio.h>
15237 EOCP
15238 if $test "X$d_modflproto" != "X$define"; then
15239         $cat >>try.c <<EOCP
15240 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15241 long double modfl (long double, long double *);
15242 EOCP
15243 fi
15244 $cat >>try.c <<EOCP
15245 int main() {
15246     long double nv = 4294967303.15;
15247     long double v, w;
15248     v = modfl(nv, &w);
15249 #ifdef __GLIBC__
15250     printf("glibc");
15251 #endif
15252     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15253     return 0;
15254 }
15255 EOCP
15256         case "$osname:$gccversion" in
15257         aix:)   saveccflags="$ccflags"
15258                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15259         esac
15260         set try
15261         if eval $compile; then
15262                 foo=`$run ./try`
15263                 case "$foo" in
15264                 *" 4294967303.150000 1.150000 4294967302.000000")
15265                         echo >&4 "Your modfl() is broken for large values."
15266                         d_modfl_pow32_bug="$define"
15267                         case "$foo" in
15268                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15269                         ;;
15270                         esac
15271                         ;;
15272                 *" 4294967303.150000 0.150000 4294967303.000000")
15273                         echo >&4 "Your modfl() seems okay for large values."
15274                         ;;
15275                 *)      echo >&4 "I don't understand your modfl() at all."
15276                         d_modfl="$undef"
15277                         ;;
15278                 esac
15279                 $rm_try
15280         else
15281                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15282                 d_modfl="$undef"
15283         fi
15284         case "$osname:$gccversion" in
15285         aix:)   ccflags="$saveccflags" ;; # restore
15286         esac
15287         ;;
15288 esac
15289
15290 if $test "$uselongdouble" = "$define"; then
15291     message=""
15292     if $test "$d_sqrtl" != "$define"; then
15293         message="$message sqrtl"
15294     fi
15295     if $test "$d_modfl" != "$define"; then
15296         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15297             echo "You have both aintl and copysignl, so I can emulate modfl."
15298         else
15299             message="$message modfl"
15300         fi
15301     fi
15302     if $test "$d_frexpl" != "$define"; then
15303         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15304             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15305         else
15306             message="$message frexpl"
15307         fi
15308     fi
15309
15310     if $test "$message" != ""; then
15311         $cat <<EOM >&4
15312
15313 *** You requested the use of long doubles but you do not seem to have
15314 *** the following mathematical functions needed for long double support:
15315 ***    $message
15316 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15317 *** Cannot continue, aborting.
15318
15319 EOM
15320
15321         exit 1
15322     fi
15323 fi
15324
15325 : see if mprotect exists
15326 set mprotect d_mprotect
15327 eval $inlibc
15328
15329 : see if msgctl exists
15330 set msgctl d_msgctl
15331 eval $inlibc
15332
15333 : see if msgget exists
15334 set msgget d_msgget
15335 eval $inlibc
15336
15337 : see if msgsnd exists
15338 set msgsnd d_msgsnd
15339 eval $inlibc
15340
15341 : see if msgrcv exists
15342 set msgrcv d_msgrcv
15343 eval $inlibc
15344
15345 : see how much of the 'msg*(2)' library is present.
15346 h_msg=true
15347 echo " "
15348 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15349 *"$undef"*) h_msg=false;;
15350 esac
15351 case "$osname" in
15352 freebsd)
15353     case "`ipcs 2>&1`" in
15354     "SVID messages"*"not configured"*)
15355         echo "Your $osname does not have the msg*(2) configured." >&4
15356         h_msg=false
15357         val="$undef"
15358         set msgctl d_msgctl
15359         eval $setvar
15360         set msgget d_msgget
15361         eval $setvar
15362         set msgsnd d_msgsnd
15363         eval $setvar
15364         set msgrcv d_msgrcv
15365         eval $setvar
15366         ;;
15367     esac
15368     ;;
15369 esac
15370 : we could also check for sys/ipc.h ...
15371 if $h_msg && $test `./findhdr sys/msg.h`; then
15372         echo "You have the full msg*(2) library." >&4
15373         val="$define"
15374 else
15375         echo "You don't have the full msg*(2) library." >&4
15376         val="$undef"
15377 fi
15378 set d_msg
15379 eval $setvar
15380
15381 : Check for msghdr_s
15382 echo " "
15383 echo "Checking to see if your system supports struct msghdr..." >&4
15384 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15385 eval $hasstruct
15386 case "$d_msghdr_s" in
15387 "$define")      echo "Yes, it does."   ;;
15388 *)              echo "No, it doesn't." ;;
15389 esac
15390
15391
15392 : see if msync exists
15393 set msync d_msync
15394 eval $inlibc
15395
15396 : see if munmap exists
15397 set munmap d_munmap
15398 eval $inlibc
15399
15400 : see if nice exists
15401 set nice d_nice
15402 eval $inlibc
15403
15404 : see if this is a langinfo.h system
15405 set langinfo.h i_langinfo
15406 eval $inhdr
15407
15408 : see if nl_langinfo exists
15409 set nl_langinfo d_nl_langinfo
15410 eval $inlibc
15411
15412 : check for volatile keyword
15413 echo " "
15414 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15415 $cat >try.c <<'EOCP'
15416 int main()
15417 {
15418         typedef struct _goo_struct goo_struct;
15419         goo_struct * volatile goo = ((goo_struct *)0);
15420         struct _goo_struct {
15421                 long long_int;
15422                 int reg_int;
15423                 char char_var;
15424         };
15425         typedef unsigned short foo_t;
15426         char *volatile foo;
15427         volatile int bar;
15428         volatile foo_t blech;
15429         foo = foo;
15430 }
15431 EOCP
15432 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15433         val="$define"
15434         echo "Yup, it does."
15435 else
15436         val="$undef"
15437         echo "Nope, it doesn't."
15438 fi
15439 set d_volatile
15440 eval $setvar
15441 $rm_try
15442
15443 : Check basic sizes
15444 echo " "
15445 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15446
15447 case "$use64bitint:$d_quad:$quadtype" in
15448 define:define:?*)
15449         ivtype="$quadtype"
15450         uvtype="$uquadtype"
15451         ivsize=8
15452         uvsize=8
15453         ;;
15454 *)      ivtype="long"
15455         uvtype="unsigned long"
15456         ivsize=$longsize
15457         uvsize=$longsize
15458         ;;
15459 esac
15460
15461 case "$uselongdouble:$d_longdbl" in
15462 define:define)
15463         nvtype="long double"
15464         nvsize=$longdblsize
15465         ;;
15466 *)      nvtype=double
15467         nvsize=$doublesize
15468         ;;
15469 esac
15470
15471 $echo "(IV will be "$ivtype", $ivsize bytes)"
15472 $echo "(UV will be "$uvtype", $uvsize bytes)"
15473 $echo "(NV will be "$nvtype", $nvsize bytes)"
15474
15475 $cat >try.c <<EOCP
15476 #$i_inttypes I_INTTYPES
15477 #ifdef I_INTTYPES
15478 #include <inttypes.h>
15479 #endif
15480 #include <stdio.h>
15481 int main() {
15482 #ifdef INT8
15483    int8_t i =  INT8_MAX;
15484   uint8_t u = UINT8_MAX;
15485   printf("int8_t\n");
15486 #endif
15487 #ifdef INT16
15488    int16_t i =  INT16_MAX;
15489   uint16_t i = UINT16_MAX;
15490   printf("int16_t\n");
15491 #endif
15492 #ifdef INT32
15493    int32_t i =  INT32_MAX;
15494   uint32_t u = UINT32_MAX;
15495   printf("int32_t\n");
15496 #endif
15497 }
15498 EOCP
15499
15500 i8type="signed char"
15501 u8type="unsigned char"
15502 i8size=1
15503 u8size=1
15504
15505 case "$i16type" in
15506 '')     case "$shortsize" in
15507         2)      i16type=short
15508                 u16type="unsigned short"
15509                 i16size=$shortsize
15510                 u16size=$shortsize
15511                 ;;
15512         esac
15513         ;;
15514 esac
15515 case "$i16type" in
15516 '')     set try -DINT16
15517         if eval $compile; then
15518                 case "`$run ./try`" in
15519                 int16_t)
15520                         i16type=int16_t
15521                         u16type=uint16_t
15522                         i16size=2
15523                         u16size=2
15524                         ;;
15525                 esac
15526         fi
15527         ;;
15528 esac
15529 case "$i16type" in
15530 '')     if $test $shortsize -ge 2; then
15531                 i16type=short
15532                 u16type="unsigned short"
15533                 i16size=$shortsize
15534                 u16size=$shortsize
15535         fi
15536         ;;
15537 esac
15538
15539 case "$i32type" in
15540 '')     case "$longsize" in
15541         4)      i32type=long
15542                 u32type="unsigned long"
15543                 i32size=$longsize
15544                 u32size=$longsize
15545                 ;;
15546         *)      case "$intsize" in
15547                 4)      i32type=int
15548                         u32type="unsigned int"
15549                         i32size=$intsize
15550                         u32size=$intsize
15551                         ;;
15552                 esac
15553                 ;;
15554         esac
15555         ;;
15556 esac
15557 case "$i32type" in
15558 '')     set try -DINT32
15559         if eval $compile; then
15560                 case "`$run ./try`" in
15561                 int32_t)
15562                         i32type=int32_t
15563                         u32type=uint32_t
15564                         i32size=4
15565                         u32size=4
15566                         ;;
15567                 esac
15568         fi
15569         ;;
15570 esac
15571 case "$i32type" in
15572 '')     if $test $intsize -ge 4; then
15573                 i32type=int
15574                 u32type="unsigned int"
15575                 i32size=$intsize
15576                 u32size=$intsize
15577         fi
15578         ;;
15579 esac
15580
15581 case "$i64type" in
15582 '')     case "$d_quad:$quadtype" in
15583         define:?*)
15584                 i64type="$quadtype"
15585                 u64type="$uquadtype"
15586                 i64size=8
15587                 u64size=8
15588                 ;;
15589         esac
15590         ;;
15591 esac
15592
15593 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15594 : volatile so that the compiler has to store it out to memory.
15595 if test X"$d_volatile" = X"$define"; then
15596         volatile=volatile
15597 fi
15598 $cat <<EOP >try.c
15599 #include <stdio.h>
15600 #$i_stdlib I_STDLIB
15601 #ifdef I_STDLIB
15602 #include <stdlib.h>
15603 #endif
15604 #include <sys/types.h>
15605 #include <signal.h>
15606 #ifdef SIGFPE
15607 $volatile int bletched = 0;
15608 $signal_t blech(int s) { bletched = 1; }
15609 #endif
15610 int main() {
15611     $uvtype u = 0;
15612     $nvtype d;
15613     int     n = 8 * $uvsize;
15614     int     i;
15615 #ifdef SIGFPE
15616     signal(SIGFPE, blech);
15617 #endif
15618
15619     for (i = 0; i < n; i++) {
15620       u = u << 1 | ($uvtype)1;
15621       d = ($nvtype)u;
15622       if (($uvtype)d != u)
15623         break;
15624       if (d <= 0)
15625         break;
15626       d = ($nvtype)(u - 1);
15627       if (($uvtype)d != (u - 1))
15628         break;
15629 #ifdef SIGFPE
15630       if (bletched)
15631         break;
15632 #endif
15633     }
15634     printf("%d\n", ((i == n) ? -n : i));
15635     exit(0);
15636 }
15637 EOP
15638 set try
15639
15640 d_nv_preserves_uv="$undef"
15641 if eval $compile; then
15642         nv_preserves_uv_bits="`$run ./try`"
15643 fi
15644 case "$nv_preserves_uv_bits" in
15645 \-[1-9]*)
15646         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15647         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15648         d_nv_preserves_uv="$define"
15649         ;;
15650 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15651         d_nv_preserves_uv="$undef" ;;
15652 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15653         nv_preserves_uv_bits="0" ;;
15654 esac
15655 $rm_try
15656
15657 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15658 : volatile so that the compiler has to store it out to memory.
15659 if test X"$d_volatile" = X"$define"; then
15660         volatile=volatile
15661 fi
15662 $cat <<EOP >try.c
15663 #include <stdio.h>
15664
15665 typedef $nvtype NV;
15666
15667 int
15668 main() {
15669   NV value = 2;
15670   int count = 1;
15671
15672   while(count < 256) {
15673     $volatile NV up = value + 1.0;
15674     $volatile NV negated = -value;
15675     $volatile NV down = negated - 1.0;
15676     $volatile NV got_up = up - value;
15677     int up_good = got_up == 1.0;
15678     int got_down = down - negated;
15679     int down_good = got_down == -1.0;
15680
15681     if (down_good != up_good) {
15682       fprintf(stderr,
15683               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15684               up_good, (double) got_up, down_good, (double) got_down,
15685               count, (double) value);
15686       return 1;
15687     }
15688     if (!up_good) {
15689       while (1) {
15690         if (count > 8) {
15691           count -= 8;
15692           fputs("256.0", stdout);
15693         } else {
15694           count--;
15695           fputs("2.0", stdout);
15696         }
15697         if (!count) {
15698           puts("");
15699           return 0;
15700         }
15701         fputs("*", stdout);
15702       }
15703     }
15704     value *= 2;
15705     ++count;
15706   }
15707   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15708           count, (double) value);
15709   return 1;
15710 }
15711 EOP
15712 set try
15713
15714 nv_overflows_integers_at='0'
15715 if eval $compile; then
15716     xxx="`$run ./try`"
15717     case "$?" in
15718         0)
15719             case "$xxx" in
15720                 2*)  cat >&4 <<EOM
15721 The largest integer your NVs can preserve is equal to $xxx
15722 EOM
15723                     nv_overflows_integers_at="$xxx"
15724                     ;;
15725                 *)  cat >&4 <<EOM
15726 Cannot determine the largest integer value your NVs can hold, unexpected output
15727 '$xxx'
15728 EOM
15729                     ;;
15730             esac
15731             ;;
15732         *)  cat >&4 <<EOM
15733 Cannot determine the largest integer value your NVs can hold
15734 EOM
15735             ;;
15736     esac
15737 fi
15738 $rm_try
15739
15740 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15741 : volatile so that the compiler has to store it out to memory.
15742 if test X"$d_volatile" = X"$define"; then
15743         volatile=volatile
15744 fi
15745 $cat <<EOP >try.c
15746 #include <stdio.h>
15747 #$i_stdlib I_STDLIB
15748 #ifdef I_STDLIB
15749 #include <stdlib.h>
15750 #endif
15751 #$i_string I_STRING
15752 #ifdef I_STRING
15753 #  include <string.h>
15754 #else
15755 #  include <strings.h>
15756 #endif
15757 #include <sys/types.h>
15758 #include <signal.h>
15759 #ifdef SIGFPE
15760 $volatile int bletched = 0;
15761 $signal_t blech(int s) { bletched = 1; }
15762 #endif
15763
15764 int checkit($nvtype d, char *where) {
15765     unsigned char *p = (char *)&d;
15766     unsigned char *end = p + sizeof(d);
15767     int fail = 0;
15768
15769     while (p < end)
15770         fail += *p++;
15771
15772     if (!fail)
15773         return 0;
15774
15775     p = (char *)&d;
15776     printf("No - %s: 0x", where);
15777     while (p < end)
15778         printf ("%02X", *p++);
15779     printf("\n");
15780     return 1;
15781 }
15782
15783 int main(int argc, char **argv) {
15784     $nvtype d = 0.0;
15785     int fail = 0;
15786     fail += checkit(d, "0.0");
15787
15788     /* The compiler shouldn't be assuming that bletched is 0  */
15789     d = bletched;
15790
15791     fail += checkit(d, "bleched");
15792
15793 #ifdef SIGFPE
15794     signal(SIGFPE, blech);
15795 #endif
15796
15797     /* Paranoia - the compiler should have no way of knowing that ANSI says
15798        that argv[argc] will always be NULL.  Actually, if it did assume this it
15799        would be buggy, as this is C and main() can be called from elsewhere in
15800        the program.  */
15801     d = argv[argc] ? 1 : 0;
15802
15803     if (d) {
15804         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15805     }
15806
15807     fail += checkit(d, "ternary");
15808
15809     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15810
15811     if (d != 0.0) {
15812         printf("No - memset doesn't give 0.0\n");
15813         /* This might just blow up:  */
15814         printf("(gives %g)\n", d);
15815         return 1;
15816     }
15817
15818 #ifdef SIGFPE
15819     if (bletched) {
15820         printf("No - something bleched\n");
15821         return 1;
15822     }
15823 #endif
15824     if (fail) {
15825       printf("No - %d fail(s)\n", fail);
15826       return 1;
15827     }
15828     printf("Yes\n");
15829     return 0;
15830 }
15831 EOP
15832 set try
15833
15834 d_nv_zero_is_allbits_zero="$undef"
15835 if eval $compile; then
15836     xxx="`$run ./try`"
15837     case "$?" in
15838         0)
15839             case "$xxx" in
15840                 Yes)  cat >&4 <<EOM
15841 0.0 is represented as all bits zero in memory
15842 EOM
15843                     d_nv_zero_is_allbits_zero="$define"
15844                     ;;
15845                 *)  cat >&4 <<EOM
15846 0.0 is not represented as all bits zero in memory
15847 EOM
15848                     d_nv_zero_is_allbits_zero="$undef"
15849                     ;;
15850             esac
15851             ;;
15852         *)  cat >&4 <<EOM
15853 0.0 is not represented as all bits zero in memory
15854 EOM
15855             d_nv_zero_is_allbits_zero="$undef"
15856             ;;
15857     esac
15858 fi
15859 $rm_try
15860
15861 : check for off64_t
15862 echo " "
15863 echo "Checking to see if you have off64_t..." >&4
15864 $cat >try.c <<EOCP
15865 #include <sys/types.h>
15866 #include <unistd.h>
15867 int main() { off64_t x = 7; }
15868 EOCP
15869 set try
15870 if eval $compile; then
15871         val="$define"
15872         echo "You have off64_t."
15873 else
15874         val="$undef"
15875         echo "You do not have off64_t."
15876         case "$lseeksize" in
15877         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15878         esac
15879 fi
15880 $rm_try
15881 set d_off64_t
15882 eval $setvar
15883
15884 : how to create joinable pthreads
15885 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15886         echo " "
15887         echo "Checking what constant to use for creating joinable pthreads..." >&4
15888         $cat >try.c <<'EOCP'
15889 #include <pthread.h>
15890 int main() {
15891     int detachstate = JOINABLE;
15892 }
15893 EOCP
15894         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15895         if eval $compile; then
15896                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15897                 val="$undef" # Yes, undef.
15898                 set d_old_pthread_create_joinable
15899                 eval $setvar
15900                 val=""
15901                 set old_pthread_create_joinable
15902                 eval $setvar
15903         else
15904                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15905                 if eval $compile; then
15906                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15907                         val="$define"
15908                         set d_old_pthread_create_joinable
15909                         eval $setvar
15910                         val=PTHREAD_CREATE_UNDETACHED
15911                         set old_pthread_create_joinable
15912                         eval $setvar
15913                 else
15914                         set try -DJOINABLE=__UNDETACHED
15915                         if eval $compile; then
15916                                 echo "You seem to use __UNDETACHED." >&4
15917                                 val="$define"
15918                                 set d_old_pthread_create_joinable
15919                                 eval $setvar
15920                                 val=__UNDETACHED
15921                                 set old_pthread_create_joinable
15922                                 eval $setvar
15923                         else
15924                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15925                                 val="$define"
15926                                 set d_old_pthread_create_joinable
15927                                 eval $setvar
15928                                 val=0
15929                                 set old_pthread_create_joinable
15930                                 eval $setvar
15931                         fi
15932                 fi
15933         fi
15934         $rm_try
15935 else
15936     d_old_pthread_create_joinable="$undef"
15937     old_pthread_create_joinable=""
15938 fi
15939
15940 : see if pause exists
15941 set pause d_pause
15942 eval $inlibc
15943
15944 : see if poll exists
15945 set poll d_poll
15946 eval $inlibc
15947
15948 : see if readlink exists
15949 set readlink d_readlink
15950 eval $inlibc
15951
15952 : Check if exe is symlink to abs path of executing program
15953 echo " "
15954 procselfexe=''
15955 val="$undef"
15956 case "$d_readlink" in
15957 "$define")
15958         if $issymlink /proc/self/exe ; then
15959                 $ls -l /proc/self/exe > reflect
15960                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15961                         echo "You have Linux-like /proc/self/exe."
15962                         procselfexe='"/proc/self/exe"'
15963                         val="$define"
15964                 fi
15965         fi
15966         if $issymlink /proc/curproc/file ; then
15967                 $ls -l /proc/curproc/file > reflect
15968                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15969                         echo "You have BSD-like /proc/curproc/file."
15970                         procselfexe='"/proc/curproc/file"'
15971                         val="$define"
15972                 fi
15973         fi
15974         ;;
15975 esac
15976 $rm -f reflect
15977 set d_procselfexe
15978 eval $setvar
15979
15980 : backward compatibility for d_hvfork
15981 if test X$d_hvfork != X; then
15982         d_vfork="$d_hvfork"
15983         d_hvfork=''
15984 fi
15985 : see if there is a vfork
15986 val=''
15987 set vfork val
15988 eval $inlibc
15989
15990 d_pseudofork=$undef
15991
15992 : Ok, but do we want to use it. vfork is reportedly unreliable in
15993 : perl on Solaris 2.x, and probably elsewhere.
15994 case "$val" in
15995 $define)
15996         echo " "
15997         case "$usevfork" in
15998         false) dflt='n';;
15999         *) dflt='y';;
16000         esac
16001         cat <<'EOM'
16002
16003 Perl can only use a vfork() that doesn't suffer from strict
16004 restrictions on calling functions or modifying global data in
16005 the child.  For example, glibc-2.1 contains such a vfork()
16006 that is unsuitable.  If your system provides a proper fork()
16007 call, chances are that you do NOT want perl to use vfork().
16008
16009 EOM
16010         rp="Do you still want to use vfork()?"
16011         . ./myread
16012         case "$ans" in
16013         y|Y) ;;
16014         *)
16015                 echo "Ok, we won't use vfork()."
16016                 val="$undef"
16017                 ;;
16018         esac
16019         ;;
16020 esac
16021 set d_vfork
16022 eval $setvar
16023 case "$d_vfork" in
16024 $define) usevfork='true';;
16025 *) usevfork='false';;
16026 esac
16027
16028 : see whether the pthread_atfork exists
16029 $cat >try.c <<EOP
16030 #include <pthread.h>
16031 #include <stdio.h>
16032 int main() {
16033 #ifdef  PTHREAD_ATFORK
16034         pthread_atfork(NULL,NULL,NULL);
16035 #endif
16036 }
16037 EOP
16038
16039 : see if pthread_atfork exists
16040 set try -DPTHREAD_ATFORK
16041 if eval $compile; then
16042     val="$define"
16043 else
16044     val="$undef"
16045 fi
16046 case "$usethreads" in
16047 $define)
16048         case "$val" in
16049         $define) echo 'pthread_atfork found.' >&4        ;;
16050         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16051         esac
16052 esac
16053 set d_pthread_atfork
16054 eval $setvar
16055
16056 : see if pthread_attr_setscope exists
16057 set pthread_attr_setscope d_pthread_attr_setscope
16058 eval $inlibc
16059
16060 : see whether the various POSIXish _yields exist
16061 $cat >try.c <<EOP
16062 #include <pthread.h>
16063 #include <stdio.h>
16064 int main() {
16065 #ifdef SCHED_YIELD
16066         sched_yield();
16067 #else
16068 #ifdef PTHREAD_YIELD
16069         pthread_yield();
16070 #else
16071 #ifdef PTHREAD_YIELD_NULL
16072         pthread_yield(NULL);
16073 #endif
16074 #endif
16075 #endif
16076 }
16077 EOP
16078 : see if sched_yield exists
16079 set try -DSCHED_YIELD
16080 if eval $compile; then
16081     val="$define"
16082     sched_yield='sched_yield()'
16083 else
16084     val="$undef"
16085 fi
16086 case "$usethreads" in
16087 $define)
16088         case "$val" in
16089         $define) echo 'sched_yield() found.' >&4        ;;
16090         *)       echo 'sched_yield() NOT found.' >&4    ;;
16091         esac
16092 esac
16093 set d_sched_yield
16094 eval $setvar
16095
16096 : see if pthread_yield exists
16097 set try -DPTHREAD_YIELD
16098 if eval $compile; then
16099     val="$define"
16100     case "$sched_yield" in
16101     '') sched_yield='pthread_yield()' ;;
16102     esac
16103 else
16104     set try -DPTHREAD_YIELD_NULL
16105     if eval $compile; then
16106         val="$define"
16107         case "$sched_yield" in
16108         '') sched_yield='pthread_yield(NULL)' ;;
16109         esac
16110     else
16111         val="$undef"
16112     fi
16113 fi
16114 case "$usethreads" in
16115 $define)
16116         case "$val" in
16117         $define) echo 'pthread_yield() found.' >&4      ;;
16118         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16119         esac
16120         ;;
16121 esac
16122 set d_pthread_yield
16123 eval $setvar
16124 case "$sched_yield" in
16125 '') sched_yield=undef ;;
16126 esac
16127 $rm_try
16128
16129 : see if random_r exists
16130 set random_r d_random_r
16131 eval $inlibc
16132 case "$d_random_r" in
16133 "$define")
16134         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16135         case "$d_random_r_proto:$usethreads" in
16136         ":define")      d_random_r_proto=define
16137                 set d_random_r_proto random_r $hdrs
16138                 eval $hasproto ;;
16139         *)      ;;
16140         esac
16141         case "$d_random_r_proto" in
16142         define)
16143         case "$random_r_proto" in
16144         ''|0) try='int random_r(int*, struct random_data*);'
16145         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16146         esac
16147         case "$random_r_proto" in
16148         ''|0) try='int random_r(long*, struct random_data*);'
16149         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16150         esac
16151         case "$random_r_proto" in
16152         ''|0) try='int random_r(struct random_data*, int32_t*);'
16153         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16154         esac
16155         case "$random_r_proto" in
16156         ''|0)   d_random_r=undef
16157                 random_r_proto=0
16158                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16159         * )     case "$random_r_proto" in
16160                 REENTRANT_PROTO*) ;;
16161                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16162                 esac
16163                 echo "Prototype: $try" ;;
16164         esac
16165         ;;
16166         *)      case "$usethreads" in
16167                 define) echo "random_r has no prototype, not using it." >&4 ;;
16168                 esac
16169                 d_random_r=undef
16170                 random_r_proto=0
16171                 ;;
16172         esac
16173         ;;
16174 *)      random_r_proto=0
16175         ;;
16176 esac
16177
16178 : see if readdir and friends exist
16179 set readdir d_readdir
16180 eval $inlibc
16181 set seekdir d_seekdir
16182 eval $inlibc
16183 set telldir d_telldir
16184 eval $inlibc
16185 set rewinddir d_rewinddir
16186 eval $inlibc
16187
16188 : see if readdir64_r exists
16189 set readdir64_r d_readdir64_r
16190 eval $inlibc
16191 case "$d_readdir64_r" in
16192 "$define")
16193         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16194         case "$d_readdir64_r_proto:$usethreads" in
16195         ":define")      d_readdir64_r_proto=define
16196                 set d_readdir64_r_proto readdir64_r $hdrs
16197                 eval $hasproto ;;
16198         *)      ;;
16199         esac
16200         case "$d_readdir64_r_proto" in
16201         define)
16202         case "$readdir64_r_proto" in
16203         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16204         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16205         esac
16206         case "$readdir64_r_proto" in
16207         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16208         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16209         esac
16210         case "$readdir64_r_proto" in
16211         ''|0)   d_readdir64_r=undef
16212                 readdir64_r_proto=0
16213                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16214         * )     case "$readdir64_r_proto" in
16215                 REENTRANT_PROTO*) ;;
16216                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16217                 esac
16218                 echo "Prototype: $try" ;;
16219         esac
16220         ;;
16221         *)      case "$usethreads" in
16222                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16223                 esac
16224                 d_readdir64_r=undef
16225                 readdir64_r_proto=0
16226                 ;;
16227         esac
16228         ;;
16229 *)      readdir64_r_proto=0
16230         ;;
16231 esac
16232
16233 : see if readdir_r exists
16234 set readdir_r d_readdir_r
16235 eval $inlibc
16236 case "$d_readdir_r" in
16237 "$define")
16238         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16239         case "$d_readdir_r_proto:$usethreads" in
16240         ":define")      d_readdir_r_proto=define
16241                 set d_readdir_r_proto readdir_r $hdrs
16242                 eval $hasproto ;;
16243         *)      ;;
16244         esac
16245         case "$d_readdir_r_proto" in
16246         define)
16247         case "$readdir_r_proto" in
16248         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16249         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16250         esac
16251         case "$readdir_r_proto" in
16252         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16253         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16254         esac
16255         case "$readdir_r_proto" in
16256         ''|0)   d_readdir_r=undef
16257                 readdir_r_proto=0
16258                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16259         * )     case "$readdir_r_proto" in
16260                 REENTRANT_PROTO*) ;;
16261                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16262                 esac
16263                 echo "Prototype: $try" ;;
16264         esac
16265         ;;
16266         *)      case "$usethreads" in
16267                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16268                 esac
16269                 d_readdir_r=undef
16270                 readdir_r_proto=0
16271                 ;;
16272         esac
16273         ;;
16274 *)      readdir_r_proto=0
16275         ;;
16276 esac
16277
16278 : see if readv exists
16279 set readv d_readv
16280 eval $inlibc
16281
16282 : see if recvmsg exists
16283 set recvmsg d_recvmsg
16284 eval $inlibc
16285
16286 : see if rename exists
16287 set rename d_rename
16288 eval $inlibc
16289
16290 : see if rmdir exists
16291 set rmdir d_rmdir
16292 eval $inlibc
16293
16294 : see if memory.h is available.
16295 val=''
16296 set memory.h val
16297 eval $inhdr
16298
16299 : See if it conflicts with string.h
16300 case "$val" in
16301 $define)
16302         case "$strings" in
16303         '') ;;
16304         *)
16305                 $cppstdin $cppflags $cppminus < $strings > mem.h
16306                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16307                         echo " "
16308                         echo "We won't be including <memory.h>."
16309                         val="$undef"
16310                 fi
16311                 $rm -f mem.h
16312                 ;;
16313         esac
16314 esac
16315 set i_memory
16316 eval $setvar
16317
16318 : can bcopy handle overlapping blocks?
16319 echo " "
16320 val="$undef"
16321 case "$d_memmove" in
16322 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16323 *)      case "$d_bcopy" in
16324         "$define")
16325                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16326                 $cat >try.c <<EOCP
16327 #$i_memory I_MEMORY
16328 #$i_stdlib I_STDLIB
16329 #$i_string I_STRING
16330 #$i_unistd I_UNISTD
16331 EOCP
16332         $cat >>try.c <<'EOCP'
16333 #include <stdio.h>
16334 #ifdef I_MEMORY
16335 #  include <memory.h>
16336 #endif
16337 #ifdef I_STDLIB
16338 #  include <stdlib.h>
16339 #endif
16340 #ifdef I_STRING
16341 #  include <string.h>
16342 #else
16343 #  include <strings.h>
16344 #endif
16345 #ifdef I_UNISTD
16346 #  include <unistd.h>  /* Needed for NetBSD */
16347 #endif
16348 int main()
16349 {
16350 char buf[128], abc[128];
16351 char *b;
16352 int len;
16353 int off;
16354 int align;
16355
16356 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16357    try to store the string in read-only memory. */
16358 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16359
16360 for (align = 7; align >= 0; align--) {
16361         for (len = 36; len; len--) {
16362                 b = buf+align;
16363                 bcopy(abc, b, len);
16364                 for (off = 1; off <= len; off++) {
16365                         bcopy(b, b+off, len);
16366                         bcopy(b+off, b, len);
16367                         if (bcmp(b, abc, len))
16368                                 exit(1);
16369                 }
16370         }
16371 }
16372 exit(0);
16373 }
16374 EOCP
16375                 set try
16376                 if eval $compile_ok; then
16377                         if $run ./try 2>/dev/null; then
16378                                 echo "Yes, it can."
16379                                 val="$define"
16380                         else
16381                                 echo "It can't, sorry."
16382                         fi
16383                 else
16384                         echo "(I can't compile the test program, so we'll assume not...)"
16385                 fi
16386                 ;;
16387         esac
16388         $rm_try
16389         ;;
16390 esac
16391 set d_safebcpy
16392 eval $setvar
16393
16394 : can memcpy handle overlapping blocks?
16395 echo " "
16396 val="$undef"
16397 case "$d_memmove" in
16398 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16399 *)      case "$d_memcpy" in
16400         "$define")
16401                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16402                 $cat >try.c <<EOCP
16403 #$i_memory I_MEMORY
16404 #$i_stdlib I_STDLIB
16405 #$i_string I_STRING
16406 #$i_unistd I_UNISTD
16407 EOCP
16408         $cat >>try.c <<'EOCP'
16409 #include <stdio.h>
16410 #ifdef I_MEMORY
16411 #  include <memory.h>
16412 #endif
16413 #ifdef I_STDLIB
16414 #  include <stdlib.h>
16415 #endif
16416 #ifdef I_STRING
16417 #  include <string.h>
16418 #else
16419 #  include <strings.h>
16420 #endif
16421 #ifdef I_UNISTD
16422 #  include <unistd.h>  /* Needed for NetBSD */
16423 #endif
16424 int main()
16425 {
16426 char buf[128], abc[128];
16427 char *b;
16428 int len;
16429 int off;
16430 int align;
16431
16432 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16433    try to store the string in read-only memory. */
16434 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16435
16436 for (align = 7; align >= 0; align--) {
16437         for (len = 36; len; len--) {
16438                 b = buf+align;
16439                 memcpy(b, abc, len);
16440                 for (off = 1; off <= len; off++) {
16441                         memcpy(b+off, b, len);
16442                         memcpy(b, b+off, len);
16443                         if (memcmp(b, abc, len))
16444                                 exit(1);
16445                 }
16446         }
16447 }
16448 exit(0);
16449 }
16450 EOCP
16451                 set try
16452                 if eval $compile_ok; then
16453                         if $run ./try 2>/dev/null; then
16454                                 echo "Yes, it can."
16455                                 val="$define"
16456                         else
16457                                 echo "It can't, sorry."
16458                         fi
16459                 else
16460                         echo "(I can't compile the test program, so we'll assume not...)"
16461                 fi
16462                 ;;
16463         esac
16464         $rm_try
16465         ;;
16466 esac
16467 set d_safemcpy
16468 eval $setvar
16469
16470 : can memcmp be trusted to compare relative magnitude?
16471 val="$undef"
16472 case "$d_memcmp" in
16473 "$define")
16474         echo " "
16475         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16476         $cat >try.c <<EOCP
16477 #$i_memory I_MEMORY
16478 #$i_stdlib I_STDLIB
16479 #$i_string I_STRING
16480 #$i_unistd I_UNISTD
16481 EOCP
16482         $cat >>try.c <<'EOCP'
16483 #include <stdio.h>
16484 #ifdef I_MEMORY
16485 #  include <memory.h>
16486 #endif
16487 #ifdef I_STDLIB
16488 #  include <stdlib.h>
16489 #endif
16490 #ifdef I_STRING
16491 #  include <string.h>
16492 #else
16493 #  include <strings.h>
16494 #endif
16495 #ifdef I_UNISTD
16496 #  include <unistd.h>  /* Needed for NetBSD */
16497 #endif
16498 int main()
16499 {
16500 char a = -1;
16501 char b = 0;
16502 if ((a < b) && memcmp(&a, &b, 1) < 0)
16503         exit(1);
16504 exit(0);
16505 }
16506 EOCP
16507         set try
16508         if eval $compile_ok; then
16509                 if $run ./try 2>/dev/null; then
16510                         echo "Yes, it can."
16511                         val="$define"
16512                 else
16513                         echo "No, it can't (it uses signed chars)."
16514                 fi
16515         else
16516                 echo "(I can't compile the test program, so we'll assume not...)"
16517         fi
16518         ;;
16519 esac
16520 $rm_try
16521 set d_sanemcmp
16522 eval $setvar
16523
16524 : see if prototype for sbrk is available
16525 echo " "
16526 set d_sbrkproto sbrk $i_unistd unistd.h
16527 eval $hasproto
16528
16529 : see if select exists
16530 set select d_select
16531 eval $inlibc
16532
16533 : see if semctl exists
16534 set semctl d_semctl
16535 eval $inlibc
16536
16537 : see if semget exists
16538 set semget d_semget
16539 eval $inlibc
16540
16541 : see if semop exists
16542 set semop d_semop
16543 eval $inlibc
16544
16545 : see how much of the 'sem*(2)' library is present.
16546 h_sem=true
16547 echo " "
16548 case "$d_semctl$d_semget$d_semop" in
16549 *"$undef"*) h_sem=false;;
16550 esac
16551 case "$osname" in
16552 freebsd)
16553     case "`ipcs 2>&1`" in
16554     "SVID messages"*"not configured"*)
16555         echo "Your $osname does not have the sem*(2) configured." >&4
16556         h_sem=false
16557         val="$undef"
16558         set semctl d_semctl
16559         eval $setvar
16560         set semget d_semget
16561         eval $setvar
16562         set semop d_semop
16563         eval $setvar
16564         ;;
16565     esac
16566     ;;
16567 esac
16568 : we could also check for sys/ipc.h ...
16569 if $h_sem && $test `./findhdr sys/sem.h`; then
16570         echo "You have the full sem*(2) library." >&4
16571         val="$define"
16572 else
16573         echo "You don't have the full sem*(2) library." >&4
16574         val="$undef"
16575 fi
16576 set d_sem
16577 eval $setvar
16578
16579 : see whether sys/sem.h defines union semun
16580 echo " "
16581 $cat > try.c <<'END'
16582 #include <sys/types.h>
16583 #include <sys/ipc.h>
16584 #include <sys/sem.h>
16585 int main () { union semun semun; semun.buf = 0; }
16586 END
16587 set try
16588 if eval $compile; then
16589     echo "You have union semun in <sys/sem.h>." >&4
16590     val="$define"
16591 else
16592     echo "You do not have union semun in <sys/sem.h>." >&4
16593     val="$undef"
16594 fi
16595 $rm_try
16596 set d_union_semun
16597 eval $setvar
16598
16599 : see how to do semctl IPC_STAT
16600 case "$d_sem" in
16601 $define)
16602     echo " "
16603     $cat > tryh.h <<END
16604 #ifndef S_IRUSR
16605 #   ifdef S_IREAD
16606 #       define S_IRUSR S_IREAD
16607 #       define S_IWUSR S_IWRITE
16608 #       define S_IXUSR S_IEXEC
16609 #   else
16610 #       define S_IRUSR 0400
16611 #       define S_IWUSR 0200
16612 #       define S_IXUSR 0100
16613 #   endif
16614 #   define S_IRGRP (S_IRUSR>>3)
16615 #   define S_IWGRP (S_IWUSR>>3)
16616 #   define S_IXGRP (S_IXUSR>>3)
16617 #   define S_IROTH (S_IRUSR>>6)
16618 #   define S_IWOTH (S_IWUSR>>6)
16619 #   define S_IXOTH (S_IXUSR>>6)
16620 #endif
16621 #ifndef S_IRWXU
16622 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16623 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16624 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16625 #endif
16626 END
16627     : see whether semctl IPC_STAT can use union semun
16628     case "$d_semctl_semun" in
16629     '')
16630       val="$undef"
16631       $cat > try.c <<END
16632 #include <sys/types.h>
16633 #include <sys/ipc.h>
16634 #include <sys/sem.h>
16635 #include <sys/stat.h>
16636 #include <stdio.h>
16637 #include <errno.h>
16638 #include "tryh.h"
16639 #ifndef errno
16640 extern int errno;
16641 #endif
16642 #$d_union_semun HAS_UNION_SEMUN
16643 int main() {
16644     union semun
16645 #ifndef HAS_UNION_SEMUN
16646     {
16647         int val;
16648         struct semid_ds *buf;
16649         unsigned short *array;
16650     }
16651 #endif
16652     arg;
16653     int sem, st;
16654
16655 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16656     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16657     if (sem > -1) {
16658         struct semid_ds argbuf;
16659         arg.buf = &argbuf;
16660 #       ifdef IPC_STAT
16661         st = semctl(sem, 0, IPC_STAT, arg);
16662         if (st == 0)
16663             printf("semun\n");
16664         else
16665 #       endif /* IPC_STAT */
16666             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16667 #       ifdef IPC_RMID
16668         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16669 #       endif /* IPC_RMID */
16670             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16671     } else
16672 #endif /* IPC_PRIVATE && ... */
16673         printf("semget failed: errno = %d\n", errno);
16674   return 0;
16675 }
16676 END
16677       set try
16678       if eval $compile; then
16679           xxx=`$run ./try`
16680           case "$xxx" in
16681           semun) val="$define" ;;
16682           esac
16683       fi
16684       $rm_try
16685       set d_semctl_semun
16686       eval $setvar
16687       ;;
16688     esac
16689     case "$d_semctl_semun" in
16690     $define)
16691         echo "You can use union semun for semctl IPC_STAT." >&4
16692         also='also'
16693         ;;
16694     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16695         also=''
16696         ;;
16697     esac
16698
16699     : see whether semctl IPC_STAT can use struct semid_ds pointer
16700     case "$d_semctl_semid_ds" in
16701     '')
16702       val="$undef"
16703       $cat > try.c <<'END'
16704 #include <sys/types.h>
16705 #include <sys/ipc.h>
16706 #include <sys/sem.h>
16707 #include <sys/stat.h>
16708 #include "tryh.h"
16709 #include <stdio.h>
16710 #include <errno.h>
16711 #ifndef errno
16712 extern int errno;
16713 #endif
16714 int main() {
16715     struct semid_ds arg;
16716     int sem, st;
16717
16718 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16719     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16720     if (sem > -1) {
16721 #       ifdef IPC_STAT
16722         st = semctl(sem, 0, IPC_STAT, &arg);
16723         if (st == 0)
16724             printf("semid_ds\n");
16725         else
16726 #       endif /* IPC_STAT */
16727             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16728 #       ifdef IPC_RMID
16729         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16730 #       endif /* IPC_RMID */
16731             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16732     } else
16733 #endif /* IPC_PRIVATE && ... */
16734         printf("semget failed: errno = %d\n", errno);
16735
16736     return 0;
16737 }
16738 END
16739       set try
16740       if eval $compile; then
16741           xxx=`$run ./try`
16742           case "$xxx" in
16743           semid_ds) val="$define" ;;
16744           esac
16745       fi
16746       $rm_try
16747       set d_semctl_semid_ds
16748       eval $setvar
16749       ;;
16750     esac
16751     case "$d_semctl_semid_ds" in
16752     $define)
16753         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16754         ;;
16755     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16756         ;;
16757     esac
16758     ;;
16759 *)  val="$undef"
16760
16761     # We do not have the full sem*(2) library, so assume we can not
16762     # use either.
16763
16764     set d_semctl_semun
16765     eval $setvar
16766
16767     set d_semctl_semid_ds
16768     eval $setvar
16769     ;;
16770 esac
16771 $rm_try tryh.h
16772
16773 : see if sendmsg exists
16774 set sendmsg d_sendmsg
16775 eval $inlibc
16776
16777 : see if setegid exists
16778 set setegid d_setegid
16779 eval $inlibc
16780
16781 : see if seteuid exists
16782 set seteuid d_seteuid
16783 eval $inlibc
16784
16785 : see if setgrent exists
16786 set setgrent d_setgrent
16787 eval $inlibc
16788
16789 : see if setgrent_r exists
16790 set setgrent_r d_setgrent_r
16791 eval $inlibc
16792 case "$d_setgrent_r" in
16793 "$define")
16794         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16795         case "$d_setgrent_r_proto:$usethreads" in
16796         ":define")      d_setgrent_r_proto=define
16797                 set d_setgrent_r_proto setgrent_r $hdrs
16798                 eval $hasproto ;;
16799         *)      ;;
16800         esac
16801         case "$d_setgrent_r_proto" in
16802         define)
16803         case "$setgrent_r_proto" in
16804         ''|0) try='int setgrent_r(FILE**);'
16805         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
16806         esac
16807         case "$setgrent_r_proto" in
16808         ''|0) try='void setgrent_r(FILE**);'
16809         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
16810         esac
16811         case "$setgrent_r_proto" in
16812         ''|0)   d_setgrent_r=undef
16813                 setgrent_r_proto=0
16814                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16815         * )     case "$setgrent_r_proto" in
16816                 REENTRANT_PROTO*) ;;
16817                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16818                 esac
16819                 echo "Prototype: $try" ;;
16820         esac
16821         ;;
16822         *)      case "$usethreads" in
16823                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16824                 esac
16825                 d_setgrent_r=undef
16826                 setgrent_r_proto=0
16827                 ;;
16828         esac
16829         ;;
16830 *)      setgrent_r_proto=0
16831         ;;
16832 esac
16833
16834 : see if sethostent exists
16835 set sethostent d_sethent
16836 eval $inlibc
16837
16838 : see if sethostent_r exists
16839 set sethostent_r d_sethostent_r
16840 eval $inlibc
16841 case "$d_sethostent_r" in
16842 "$define")
16843         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16844         case "$d_sethostent_r_proto:$usethreads" in
16845         ":define")      d_sethostent_r_proto=define
16846                 set d_sethostent_r_proto sethostent_r $hdrs
16847                 eval $hasproto ;;
16848         *)      ;;
16849         esac
16850         case "$d_sethostent_r_proto" in
16851         define)
16852         case "$sethostent_r_proto" in
16853         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16854         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
16855         esac
16856         case "$sethostent_r_proto" in
16857         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16858         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
16859         esac
16860         case "$sethostent_r_proto" in
16861         ''|0)   d_sethostent_r=undef
16862                 sethostent_r_proto=0
16863                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16864         * )     case "$sethostent_r_proto" in
16865                 REENTRANT_PROTO*) ;;
16866                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16867                 esac
16868                 echo "Prototype: $try" ;;
16869         esac
16870         ;;
16871         *)      case "$usethreads" in
16872                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16873                 esac
16874                 d_sethostent_r=undef
16875                 sethostent_r_proto=0
16876                 ;;
16877         esac
16878         ;;
16879 *)      sethostent_r_proto=0
16880         ;;
16881 esac
16882
16883 : see if setitimer exists
16884 set setitimer d_setitimer
16885 eval $inlibc
16886
16887 : see if setlinebuf exists
16888 set setlinebuf d_setlinebuf
16889 eval $inlibc
16890
16891 : see if setlocale exists
16892 set setlocale d_setlocale
16893 eval $inlibc
16894
16895 : see if locale.h is available
16896 set locale.h i_locale
16897 eval $inhdr
16898
16899 : see if setlocale_r exists
16900 set setlocale_r d_setlocale_r
16901 eval $inlibc
16902 case "$d_setlocale_r" in
16903 "$define")
16904         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16905         case "$d_setlocale_r_proto:$usethreads" in
16906         ":define")      d_setlocale_r_proto=define
16907                 set d_setlocale_r_proto setlocale_r $hdrs
16908                 eval $hasproto ;;
16909         *)      ;;
16910         esac
16911         case "$d_setlocale_r_proto" in
16912         define)
16913         case "$setlocale_r_proto" in
16914         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16915         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16916         esac
16917         case "$setlocale_r_proto" in
16918         ''|0)   d_setlocale_r=undef
16919                 setlocale_r_proto=0
16920                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16921         * )     case "$setlocale_r_proto" in
16922                 REENTRANT_PROTO*) ;;
16923                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16924                 esac
16925                 echo "Prototype: $try" ;;
16926         esac
16927         ;;
16928         *)      case "$usethreads" in
16929                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16930                 esac
16931                 d_setlocale_r=undef
16932                 setlocale_r_proto=0
16933                 ;;
16934         esac
16935         ;;
16936 *)      setlocale_r_proto=0
16937         ;;
16938 esac
16939
16940 : see if setnetent exists
16941 set setnetent d_setnent
16942 eval $inlibc
16943
16944 : see if setnetent_r exists
16945 set setnetent_r d_setnetent_r
16946 eval $inlibc
16947 case "$d_setnetent_r" in
16948 "$define")
16949         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16950         case "$d_setnetent_r_proto:$usethreads" in
16951         ":define")      d_setnetent_r_proto=define
16952                 set d_setnetent_r_proto setnetent_r $hdrs
16953                 eval $hasproto ;;
16954         *)      ;;
16955         esac
16956         case "$d_setnetent_r_proto" in
16957         define)
16958         case "$setnetent_r_proto" in
16959         ''|0) try='int setnetent_r(int, struct netent_data*);'
16960         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
16961         esac
16962         case "$setnetent_r_proto" in
16963         ''|0) try='void setnetent_r(int, struct netent_data*);'
16964         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
16965         esac
16966         case "$setnetent_r_proto" in
16967         ''|0)   d_setnetent_r=undef
16968                 setnetent_r_proto=0
16969                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16970         * )     case "$setnetent_r_proto" in
16971                 REENTRANT_PROTO*) ;;
16972                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16973                 esac
16974                 echo "Prototype: $try" ;;
16975         esac
16976         ;;
16977         *)      case "$usethreads" in
16978                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16979                 esac
16980                 d_setnetent_r=undef
16981                 setnetent_r_proto=0
16982                 ;;
16983         esac
16984         ;;
16985 *)      setnetent_r_proto=0
16986         ;;
16987 esac
16988
16989 : see if setprotoent exists
16990 set setprotoent d_setpent
16991 eval $inlibc
16992
16993 : see if setpgid exists
16994 set setpgid d_setpgid
16995 eval $inlibc
16996
16997 : see if setpgrp2 exists
16998 set setpgrp2 d_setpgrp2
16999 eval $inlibc
17000
17001 : see if setpriority exists
17002 set setpriority d_setprior
17003 eval $inlibc
17004
17005 : see if setproctitle exists
17006 set setproctitle d_setproctitle
17007 eval $inlibc
17008
17009 : see if setprotoent_r exists
17010 set setprotoent_r d_setprotoent_r
17011 eval $inlibc
17012 case "$d_setprotoent_r" in
17013 "$define")
17014         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17015         case "$d_setprotoent_r_proto:$usethreads" in
17016         ":define")      d_setprotoent_r_proto=define
17017                 set d_setprotoent_r_proto setprotoent_r $hdrs
17018                 eval $hasproto ;;
17019         *)      ;;
17020         esac
17021         case "$d_setprotoent_r_proto" in
17022         define)
17023         case "$setprotoent_r_proto" in
17024         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17025         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17026         esac
17027         case "$setprotoent_r_proto" in
17028         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17029         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17030         esac
17031         case "$setprotoent_r_proto" in
17032         ''|0)   d_setprotoent_r=undef
17033                 setprotoent_r_proto=0
17034                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17035         * )     case "$setprotoent_r_proto" in
17036                 REENTRANT_PROTO*) ;;
17037                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17038                 esac
17039                 echo "Prototype: $try" ;;
17040         esac
17041         ;;
17042         *)      case "$usethreads" in
17043                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17044                 esac
17045                 d_setprotoent_r=undef
17046                 setprotoent_r_proto=0
17047                 ;;
17048         esac
17049         ;;
17050 *)      setprotoent_r_proto=0
17051         ;;
17052 esac
17053
17054 : see if setpwent exists
17055 set setpwent d_setpwent
17056 eval $inlibc
17057
17058 : see if setpwent_r exists
17059 set setpwent_r d_setpwent_r
17060 eval $inlibc
17061 case "$d_setpwent_r" in
17062 "$define")
17063         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17064         case "$d_setpwent_r_proto:$usethreads" in
17065         ":define")      d_setpwent_r_proto=define
17066                 set d_setpwent_r_proto setpwent_r $hdrs
17067                 eval $hasproto ;;
17068         *)      ;;
17069         esac
17070         case "$d_setpwent_r_proto" in
17071         define)
17072         case "$setpwent_r_proto" in
17073         ''|0) try='int setpwent_r(FILE**);'
17074         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17075         esac
17076         case "$setpwent_r_proto" in
17077         ''|0) try='void setpwent_r(FILE**);'
17078         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17079         esac
17080         case "$setpwent_r_proto" in
17081         ''|0)   d_setpwent_r=undef
17082                 setpwent_r_proto=0
17083                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17084         * )     case "$setpwent_r_proto" in
17085                 REENTRANT_PROTO*) ;;
17086                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17087                 esac
17088                 echo "Prototype: $try" ;;
17089         esac
17090         ;;
17091         *)      case "$usethreads" in
17092                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17093                 esac
17094                 d_setpwent_r=undef
17095                 setpwent_r_proto=0
17096                 ;;
17097         esac
17098         ;;
17099 *)      setpwent_r_proto=0
17100         ;;
17101 esac
17102
17103 : see if setregid exists
17104 set setregid d_setregid
17105 eval $inlibc
17106 set setresgid d_setresgid
17107 eval $inlibc
17108
17109 : see if setreuid exists
17110 set setreuid d_setreuid
17111 eval $inlibc
17112 set setresuid d_setresuid
17113 eval $inlibc
17114
17115 : see if setrgid exists
17116 set setrgid d_setrgid
17117 eval $inlibc
17118
17119 : see if setruid exists
17120 set setruid d_setruid
17121 eval $inlibc
17122
17123 : see if setservent exists
17124 set setservent d_setsent
17125 eval $inlibc
17126
17127 : see if setservent_r exists
17128 set setservent_r d_setservent_r
17129 eval $inlibc
17130 case "$d_setservent_r" in
17131 "$define")
17132         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17133         case "$d_setservent_r_proto:$usethreads" in
17134         ":define")      d_setservent_r_proto=define
17135                 set d_setservent_r_proto setservent_r $hdrs
17136                 eval $hasproto ;;
17137         *)      ;;
17138         esac
17139         case "$d_setservent_r_proto" in
17140         define)
17141         case "$setservent_r_proto" in
17142         ''|0) try='int setservent_r(int, struct servent_data*);'
17143         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17144         esac
17145         case "$setservent_r_proto" in
17146         ''|0) try='void setservent_r(int, struct servent_data*);'
17147         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17148         esac
17149         case "$setservent_r_proto" in
17150         ''|0)   d_setservent_r=undef
17151                 setservent_r_proto=0
17152                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17153         * )     case "$setservent_r_proto" in
17154                 REENTRANT_PROTO*) ;;
17155                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17156                 esac
17157                 echo "Prototype: $try" ;;
17158         esac
17159         ;;
17160         *)      case "$usethreads" in
17161                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17162                 esac
17163                 d_setservent_r=undef
17164                 setservent_r_proto=0
17165                 ;;
17166         esac
17167         ;;
17168 *)      setservent_r_proto=0
17169         ;;
17170 esac
17171
17172 : see if setsid exists
17173 set setsid d_setsid
17174 eval $inlibc
17175
17176 : see if setvbuf exists
17177 set setvbuf d_setvbuf
17178 eval $inlibc
17179
17180 : see if sfio.h is available
17181 set sfio.h i_sfio
17182 eval $inhdr
17183
17184 : see if sfio library is available
17185 case "$i_sfio" in
17186 $define)
17187         val=''
17188         set sfreserve val
17189         eval $inlibc
17190         ;;
17191 *)
17192         val="$undef"
17193         ;;
17194 esac
17195 : Ok, but do we want to use it.
17196 case "$val" in
17197 $define)
17198         case "$usesfio" in
17199         true|$define|[yY]*) dflt='y';;
17200         *) dflt='n';;
17201         esac
17202         echo "$package can use the sfio library, but it is experimental."
17203         case "$useperlio" in
17204         "$undef")
17205             echo "For sfio also the PerlIO abstraction layer is needed."
17206             echo "Earlier you said you wouldn't want that."
17207             ;;
17208         esac
17209         rp="You seem to have sfio available, do you want to try using it?"
17210         . ./myread
17211         case "$ans" in
17212         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17213                 useperlio="$define"
17214                 val="$define"
17215                 ;;
17216         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17217                 val="$undef"
17218                 ;;
17219         esac
17220         ;;
17221 *)      case "$usesfio" in
17222         true|$define|[yY]*)
17223                 echo "Sorry, cannot find sfio on this machine." >&4
17224                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17225                 val="$undef"
17226                 ;;
17227         esac
17228         ;;
17229 esac
17230 set d_sfio
17231 eval $setvar
17232 case "$d_sfio" in
17233 $define) usesfio='true';;
17234 *) usesfio='false';;
17235 esac
17236 case "$d_sfio" in
17237 $define) ;;
17238 *)      : Remove sfio from list of libraries to use
17239         case "$libs" in
17240         *-lsfio*)
17241                 echo "Removing unneeded -lsfio from library list" >&4
17242                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17243                 shift
17244                 libs="$*"
17245                 echo "libs = $libs" >&4
17246                 ;;
17247         esac
17248 ;;
17249 esac
17250
17251
17252 : see if shmctl exists
17253 set shmctl d_shmctl
17254 eval $inlibc
17255
17256 : see if shmget exists
17257 set shmget d_shmget
17258 eval $inlibc
17259
17260 : see if shmat exists
17261 set shmat d_shmat
17262 eval $inlibc
17263 : see what shmat returns
17264 case "$d_shmat" in
17265 "$define")
17266         $cat >shmat.c <<'END'
17267 #include <sys/shm.h>
17268 void *shmat();
17269 END
17270         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17271                 shmattype='void *'
17272         else
17273                 shmattype='char *'
17274         fi
17275         echo "and it returns ($shmattype)." >&4
17276         : see if a prototype for shmat is available
17277         xxx=`./findhdr sys/shm.h`
17278         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17279         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17280                 val="$define"
17281         else
17282                 val="$undef"
17283         fi
17284         $rm -f shmat.[co]
17285         ;;
17286 *)
17287         val="$undef"
17288         ;;
17289 esac
17290 set d_shmatprototype
17291 eval $setvar
17292
17293 : see if shmdt exists
17294 set shmdt d_shmdt
17295 eval $inlibc
17296
17297 : see how much of the 'shm*(2)' library is present.
17298 h_shm=true
17299 echo " "
17300 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17301 *"$undef"*) h_shm=false;;
17302 esac
17303 case "$osname" in
17304 freebsd)
17305     case "`ipcs 2>&1`" in
17306     "SVID shared memory"*"not configured"*)
17307         echo "Your $osname does not have the shm*(2) configured." >&4
17308         h_shm=false
17309         val="$undef"
17310         set shmctl d_shmctl
17311         evat $setvar
17312         set shmget d_shmget
17313         evat $setvar
17314         set shmat d_shmat
17315         evat $setvar
17316         set shmdt d_shmdt
17317         evat $setvar
17318         ;;
17319     esac
17320     ;;
17321 esac
17322 : we could also check for sys/ipc.h ...
17323 if $h_shm && $test `./findhdr sys/shm.h`; then
17324         echo "You have the full shm*(2) library." >&4
17325         val="$define"
17326 else
17327         echo "You don't have the full shm*(2) library." >&4
17328         val="$undef"
17329 fi
17330 set d_shm
17331 eval $setvar
17332
17333 : see if we have sigaction
17334 echo " "
17335 if set sigaction val -f d_sigaction; eval $csym; $val; then
17336         echo 'sigaction() found.' >&4
17337         $cat > try.c <<EOP
17338 #include <stdio.h>
17339 #include <sys/types.h>
17340 #include <signal.h>
17341 #$i_stdlib I_STDLIB
17342 #ifdef I_STDLIB
17343 #include <stdlib.h>
17344 #endif
17345 int main()
17346 {
17347     struct sigaction act, oact;
17348     act.sa_flags = 0;
17349     oact.sa_handler = 0;
17350     /* so that act and oact are used */
17351     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17352 }
17353 EOP
17354         set try
17355         if eval $compile_ok; then
17356                 val="$define"
17357         else
17358                 echo "But you don't seem to have a useable struct sigaction." >&4
17359                 val="$undef"
17360         fi
17361 else
17362         echo 'sigaction NOT found.' >&4
17363         val="$undef"
17364 fi
17365 set d_sigaction; eval $setvar
17366 $rm_try
17367
17368 : see if this is a sunmath.h system
17369 set sunmath.h i_sunmath
17370 eval $inhdr
17371
17372 : see if signbit exists
17373 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17374 $cat >try.c <<EOCP
17375 #$i_math I_MATH
17376 #$i_sunmath I_SUNMATH
17377 #ifdef I_MATH
17378 #  include <math.h>
17379 #endif
17380 #ifdef I_SUNMATH  /* Solaris special math library */
17381 #  include <sunmath.h>
17382 #endif
17383 #define NV $nvtype
17384 int main(int argc, char **argv)
17385 {
17386     NV x = 0.0;
17387     NV y = -0.0;
17388     if ((signbit(x) == 0) && (signbit(y) != 0))
17389         return 0;
17390     else
17391         return 1;
17392 }
17393 EOCP
17394 val="$undef"
17395 set try
17396 if eval $compile; then
17397     if $run ./try; then
17398         $echo "Yes." >&4
17399         val="$define"
17400     else
17401         $echo "Signbit seems to be available, but doesn't work as I expected."
17402         $echo "I won't use it." >&4
17403         val="$undef"
17404     fi
17405 else
17406     $echo "Nope." >&4
17407     dflt="$undef"
17408 fi
17409 set d_signbit
17410 eval $setvar
17411 $rm_try
17412
17413 : see if sigprocmask exists
17414 set sigprocmask d_sigprocmask
17415 eval $inlibc
17416
17417 : see if sigsetjmp exists
17418 echo " "
17419 case "$d_sigsetjmp" in
17420 '')
17421         $cat >try.c <<EOP
17422 #include <setjmp.h>
17423 #$i_stdlib I_STDLIB
17424 #ifdef I_STDLIB
17425 #include <stdlib.h>
17426 #endif
17427 sigjmp_buf env;
17428 int set = 1;
17429 int main()
17430 {
17431         if (sigsetjmp(env,1))
17432                 exit(set);
17433         set = 0;
17434         siglongjmp(env, 1);
17435         exit(1);
17436 }
17437 EOP
17438         set try
17439         if eval $compile; then
17440                 if $run ./try >/dev/null 2>&1; then
17441                         echo "POSIX sigsetjmp found." >&4
17442                         val="$define"
17443                 else
17444                         $cat >&4 <<EOM
17445 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17446 I'll ignore them.
17447 EOM
17448                         val="$undef"
17449                 fi
17450         else
17451                 echo "sigsetjmp not found." >&4
17452                 val="$undef"
17453         fi
17454         ;;
17455 *) val="$d_sigsetjmp"
17456         case "$d_sigsetjmp" in
17457         $define) echo "POSIX sigsetjmp found." >&4;;
17458         $undef) echo "sigsetjmp not found." >&4;;
17459         esac
17460         ;;
17461 esac
17462 set d_sigsetjmp
17463 eval $setvar
17464 $rm_try
17465
17466 : see if snprintf exists
17467 set snprintf d_snprintf
17468 eval $inlibc
17469
17470 : see if vsnprintf exists
17471 set vsnprintf d_vsnprintf
17472 eval $inlibc
17473
17474 case "$d_snprintf-$d_vsnprintf" in
17475 "$define-$define")
17476     $cat <<EOM
17477 Checking whether your snprintf() and vsnprintf() work okay...
17478 EOM
17479     $cat >try.c <<'EOCP'
17480 /* v?snprintf testing logic courtesy of Russ Allbery.
17481  * According to C99:
17482  * - if the buffer is too short it still must be \0-terminated
17483  * - if the buffer is too short the potentially required length
17484  *   must be returned and not -1
17485  * - if the buffer is NULL the potentially required length
17486  *   must be returned and not -1 or core dump
17487  */
17488 #include <stdio.h>
17489 #include <stdarg.h>
17490
17491 char buf[2];
17492
17493 int test (char *format, ...)
17494 {
17495     va_list args;
17496     int count;
17497
17498     va_start (args, format);
17499     count = vsnprintf (buf, sizeof buf, format, args);
17500     va_end (args);
17501     return count;
17502 }
17503
17504 int main ()
17505 {
17506     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17507              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17508 }
17509 EOCP
17510     set try
17511     if eval $compile; then
17512         `$run ./try`
17513         case "$?" in
17514         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17515         *) cat <<EOM >&4
17516 Your snprintf() and snprintf() don't seem to be working okay.
17517 EOM
17518            d_snprintf="$undef"
17519            d_vsnprintf="$undef"
17520            ;;
17521         esac
17522     else
17523         echo "(I can't seem to compile the test program--assuming they don't)"
17524         d_snprintf="$undef"
17525         d_vsnprintf="$undef"
17526     fi
17527     $rm_try
17528     ;;
17529 esac
17530
17531 : see if sockatmark exists
17532 set sockatmark d_sockatmark
17533 eval $inlibc
17534
17535 : see if prototype for sockatmark is available
17536 echo " "
17537 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17538 eval $hasproto
17539
17540 : see if socks5_init exists
17541 set socks5_init d_socks5_init
17542 eval $inlibc
17543
17544 : see if sprintf returns the length of the string in the buffer as per ANSI
17545 $echo "Checking whether sprintf returns the length of the string..." >&4
17546 $cat <<EOP >try.c
17547 #include <stdio.h>
17548 #$i_stdlib I_STDLIB
17549 #ifdef I_STDLIB
17550 #include <stdlib.h>
17551 #endif
17552 #$i_string I_STRING
17553 #ifdef I_STRING
17554 #  include <string.h>
17555 #else
17556 #  include <strings.h>
17557 #endif
17558 #$i_math I_MATH
17559 #ifdef I_MATH
17560 #include <math.h>
17561 #endif
17562
17563 char buffer[256];
17564
17565 int check (size_t expect, int test) {
17566   size_t got = strlen(buffer);
17567   if (expect == got)
17568     return 0;
17569
17570   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17571        test, buffer);
17572   exit (test);
17573 }
17574
17575 int main(int argc, char **argv) {
17576   int test = 0;
17577
17578   check(sprintf(buffer, ""), ++test);
17579   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17580   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17581
17582   return 0;
17583 }
17584 EOP
17585 set try
17586
17587 if eval $compile; then
17588     xxx="`$run ./try`"
17589     case "$?" in
17590         0) cat >&4 <<EOM
17591 sprintf returns the length of the string (as ANSI says it should)
17592 EOM
17593         d_sprintf_returns_strlen="$define"
17594         ;;
17595         *) cat >&4 <<EOM
17596 sprintf does not return the length of the string (how old is this system?)
17597 EOM
17598         d_sprintf_returns_strlen="$undef"
17599         ;;
17600     esac
17601 else
17602     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17603     d_sprintf_returns_strlen="$undef"
17604 fi
17605 $rm_try
17606
17607 : see if srand48_r exists
17608 set srand48_r d_srand48_r
17609 eval $inlibc
17610 case "$d_srand48_r" in
17611 "$define")
17612         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17613         case "$d_srand48_r_proto:$usethreads" in
17614         ":define")      d_srand48_r_proto=define
17615                 set d_srand48_r_proto srand48_r $hdrs
17616                 eval $hasproto ;;
17617         *)      ;;
17618         esac
17619         case "$d_srand48_r_proto" in
17620         define)
17621         case "$srand48_r_proto" in
17622         ''|0) try='int srand48_r(long, struct drand48_data*);'
17623         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17624         esac
17625         case "$srand48_r_proto" in
17626         ''|0)   d_srand48_r=undef
17627                 srand48_r_proto=0
17628                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17629         * )     case "$srand48_r_proto" in
17630                 REENTRANT_PROTO*) ;;
17631                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17632                 esac
17633                 echo "Prototype: $try" ;;
17634         esac
17635         ;;
17636         *)      case "$usethreads" in
17637                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17638                 esac
17639                 d_srand48_r=undef
17640                 srand48_r_proto=0
17641                 ;;
17642         esac
17643         ;;
17644 *)      srand48_r_proto=0
17645         ;;
17646 esac
17647
17648 : see if srandom_r exists
17649 set srandom_r d_srandom_r
17650 eval $inlibc
17651 case "$d_srandom_r" in
17652 "$define")
17653         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17654         case "$d_srandom_r_proto:$usethreads" in
17655         ":define")      d_srandom_r_proto=define
17656                 set d_srandom_r_proto srandom_r $hdrs
17657                 eval $hasproto ;;
17658         *)      ;;
17659         esac
17660         case "$d_srandom_r_proto" in
17661         define)
17662         case "$srandom_r_proto" in
17663         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17664         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17665         esac
17666         case "$srandom_r_proto" in
17667         ''|0)   d_srandom_r=undef
17668                 srandom_r_proto=0
17669                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17670         * )     case "$srandom_r_proto" in
17671                 REENTRANT_PROTO*) ;;
17672                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17673                 esac
17674                 echo "Prototype: $try" ;;
17675         esac
17676         ;;
17677         *)      case "$usethreads" in
17678                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17679                 esac
17680                 d_srandom_r=undef
17681                 srandom_r_proto=0
17682                 ;;
17683         esac
17684         ;;
17685 *)      srandom_r_proto=0
17686         ;;
17687 esac
17688
17689 : see if prototype for setresgid is available
17690 echo " "
17691 set d_sresgproto setresgid $i_unistd unistd.h
17692 eval $hasproto
17693
17694 : see if prototype for setresuid is available
17695 echo " "
17696 set d_sresuproto setresuid $i_unistd unistd.h
17697 eval $hasproto
17698
17699 : see if sys/stat.h is available
17700 set sys/stat.h i_sysstat
17701 eval $inhdr
17702
17703 : see if stat knows about block sizes
17704 echo " "
17705 echo "Checking to see if your struct stat has st_blocks field..." >&4
17706 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17707 eval $hasfield
17708
17709 : see if this is a sys/vfs.h system
17710 set sys/vfs.h i_sysvfs
17711 eval $inhdr
17712
17713 : see if this is a sys/statfs.h system
17714 set sys/statfs.h i_sysstatfs
17715 eval $inhdr
17716
17717 : Check for statfs_s
17718 echo " "
17719 echo "Checking to see if your system supports struct statfs..." >&4
17720 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
17721 eval $hasstruct
17722 case "$d_statfs_s" in
17723 "$define")      echo "Yes, it does."   ;;
17724 *)              echo "No, it doesn't." ;;
17725 esac
17726
17727
17728 : see if struct statfs knows about f_flags
17729 case "$d_statfs_s" in
17730 define)
17731         echo " "
17732         echo "Checking to see if your struct statfs has f_flags field..." >&4
17733         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
17734         eval $hasfield
17735         ;;
17736 *)      val="$undef"
17737         set d_statfs_f_flags
17738         eval $setvar
17739         ;;
17740 esac
17741 case "$d_statfs_f_flags" in
17742 "$define")      echo "Yes, it does."   ;;
17743 *)              echo "No, it doesn't." ;;
17744 esac
17745
17746 : Check stream access
17747 $cat >&4 <<EOM
17748 Checking how to access stdio streams by file descriptor number...
17749 EOM
17750 case "$stdio_stream_array" in
17751 '')     $cat >try.c <<EOCP
17752 #include <stdio.h>
17753 int main() {
17754   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17755     printf("yes\n");
17756 }
17757 EOCP
17758         for s in _iob __iob __sF
17759         do
17760                 set try -DSTDIO_STREAM_ARRAY=$s
17761                 if eval $compile; then
17762                         case "`$run ./try`" in
17763                         yes)    stdio_stream_array=$s; break ;;
17764                         esac
17765                 fi
17766         done
17767         $rm_try
17768 esac
17769 case "$stdio_stream_array" in
17770 '')     $cat >&4 <<EOM
17771 I can't figure out how to access stdio streams by file descriptor number.
17772 EOM
17773         d_stdio_stream_array="$undef"
17774         ;;
17775 *)      $cat >&4 <<EOM
17776 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17777 EOM
17778         d_stdio_stream_array="$define"
17779         ;;
17780 esac
17781
17782 : see if strcoll exists
17783 set strcoll d_strcoll
17784 eval $inlibc
17785
17786 : check for structure copying
17787 echo " "
17788 echo "Checking to see if your C compiler can copy structs..." >&4
17789 $cat >try.c <<'EOCP'
17790 int main()
17791 {
17792         struct blurfl {
17793                 int dyick;
17794         } foo, bar;
17795
17796         foo = bar;
17797 }
17798 EOCP
17799 if $cc -c try.c >/dev/null 2>&1 ; then
17800         val="$define"
17801         echo "Yup, it can."
17802 else
17803         val="$undef"
17804         echo "Nope, it can't."
17805 fi
17806 set d_strctcpy
17807 eval $setvar
17808 $rm_try
17809
17810 : see if strerror and/or sys_errlist[] exist
17811 echo " "
17812 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17813     if set strerror val -f d_strerror; eval $csym; $val; then
17814                 echo 'strerror() found.' >&4
17815                 d_strerror="$define"
17816                 d_strerrm='strerror(e)'
17817                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17818                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17819                         d_syserrlst="$define"
17820                 else
17821                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17822                         d_syserrlst="$undef"
17823                 fi
17824     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17825                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17826                 echo 'strerror() found in string header.' >&4
17827                 d_strerror="$define"
17828                 d_strerrm='strerror(e)'
17829                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17830                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17831                                 d_syserrlst="$define"
17832                 else
17833                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17834                         d_syserrlst="$undef"
17835                 fi
17836     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17837                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17838                 d_strerror="$undef"
17839                 d_syserrlst="$define"
17840                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17841     else
17842                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17843                 d_strerror="$undef"
17844                 d_syserrlst="$undef"
17845                 d_strerrm='"unknown"'
17846     fi
17847 fi
17848
17849 : see if strerror_r exists
17850 set strerror_r d_strerror_r
17851 eval $inlibc
17852 case "$d_strerror_r" in
17853 "$define")
17854         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17855         case "$d_strerror_r_proto:$usethreads" in
17856         ":define")      d_strerror_r_proto=define
17857                 set d_strerror_r_proto strerror_r $hdrs
17858                 eval $hasproto ;;
17859         *)      ;;
17860         esac
17861         case "$d_strerror_r_proto" in
17862         define)
17863         case "$strerror_r_proto" in
17864         ''|0) try='int strerror_r(int, char*, size_t);'
17865         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
17866         esac
17867         case "$strerror_r_proto" in
17868         ''|0) try='int strerror_r(int, char*, int);'
17869         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
17870         esac
17871         case "$strerror_r_proto" in
17872         ''|0) try='char* strerror_r(int, char*, size_t);'
17873         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
17874         esac
17875         case "$strerror_r_proto" in
17876         ''|0)   d_strerror_r=undef
17877                 strerror_r_proto=0
17878                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17879         * )     case "$strerror_r_proto" in
17880                 REENTRANT_PROTO*) ;;
17881                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17882                 esac
17883                 echo "Prototype: $try" ;;
17884         esac
17885         ;;
17886         *)      case "$usethreads" in
17887                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17888                 esac
17889                 d_strerror_r=undef
17890                 strerror_r_proto=0
17891                 ;;
17892         esac
17893         ;;
17894 *)      strerror_r_proto=0
17895         ;;
17896 esac
17897
17898 : see if strftime exists
17899 set strftime d_strftime
17900 eval $inlibc
17901
17902 : see if strlcat exists
17903 set strlcat d_strlcat
17904 eval $inlibc
17905
17906 : see if strlcpy exists
17907 set strlcpy d_strlcpy
17908 eval $inlibc
17909
17910 : see if strtod exists
17911 set strtod d_strtod
17912 eval $inlibc
17913
17914 : see if strtol exists
17915 set strtol d_strtol
17916 eval $inlibc
17917
17918 : see if strtold exists
17919 set strtold d_strtold
17920 eval $inlibc
17921
17922 : see if strtoll exists
17923 set strtoll d_strtoll
17924 eval $inlibc
17925
17926 case "$d_longlong-$d_strtoll" in
17927 "$define-$define")
17928         $cat <<EOM
17929 Checking whether your strtoll() works okay...
17930 EOM
17931         $cat >try.c <<'EOCP'
17932 #include <errno.h>
17933 #ifdef __hpux
17934 #define strtoll __strtoll
17935 #endif
17936 #ifdef __EMX__
17937 #define strtoll _strtoll
17938 #endif
17939 #include <stdio.h>
17940 extern long long int strtoll(char *s, char **, int);
17941 static int bad = 0;
17942 int check(char *s, long long ell, int een) {
17943         long long gll;
17944         errno = 0;
17945         gll = strtoll(s, 0, 10);
17946         if (!((gll == ell) && (errno == een)))
17947                 bad++;
17948 }
17949 int main() {
17950         check(" 1",                                      1LL, 0);
17951         check(" 0",                                      0LL, 0);
17952         check("-1",                                     -1LL, 0);
17953         check("-9223372036854775808", -9223372036854775808LL, 0);
17954         check("-9223372036854775808", -9223372036854775808LL, 0);
17955         check(" 9223372036854775807",  9223372036854775807LL, 0);
17956         check("-9223372036854775808", -9223372036854775808LL, 0);
17957         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17958         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17959         if (!bad)
17960                 printf("ok\n");
17961 }
17962 EOCP
17963         set try
17964         if eval $compile; then
17965                 yyy=`$run ./try`
17966                 case "$yyy" in
17967                 ok) echo "Your strtoll() seems to be working okay." ;;
17968                 *) cat <<EOM >&4
17969 Your strtoll() doesn't seem to be working okay.
17970 EOM
17971                    d_strtoll="$undef"
17972                    ;;
17973                 esac
17974         else
17975                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17976                 d_strtoll="$undef"
17977         fi
17978         ;;
17979 esac
17980
17981 : see if strtoq exists
17982 set strtoq d_strtoq
17983 eval $inlibc
17984
17985 : see if strtoul exists
17986 set strtoul d_strtoul
17987 eval $inlibc
17988
17989 case "$d_strtoul" in
17990 "$define")
17991         $cat <<EOM
17992 Checking whether your strtoul() works okay...
17993 EOM
17994         $cat >try.c <<'EOCP'
17995 #include <errno.h>
17996 #include <stdio.h>
17997 extern unsigned long int strtoul(char *s, char **, int);
17998 static int bad = 0;
17999 void check(char *s, unsigned long eul, int een) {
18000         unsigned long gul;
18001         errno = 0;
18002         gul = strtoul(s, 0, 10);
18003         if (!((gul == eul) && (errno == een)))
18004                 bad++;
18005 }
18006 int main() {
18007         check(" 1", 1L, 0);
18008         check(" 0", 0L, 0);
18009 EOCP
18010         case "$longsize" in
18011         8)
18012             $cat >>try.c <<'EOCP'
18013         check("18446744073709551615", 18446744073709551615UL, 0);
18014         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18015 #if 0 /* strtoul() for /^-/ strings is undefined. */
18016         check("-1", 18446744073709551615UL, 0);
18017         check("-18446744073709551614", 2, 0);
18018         check("-18446744073709551615", 1, 0);
18019         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18020         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18021 #endif
18022 EOCP
18023                 ;;
18024         4)
18025                     $cat >>try.c <<'EOCP'
18026         check("4294967295", 4294967295UL, 0);
18027         check("4294967296", 4294967295UL, ERANGE);
18028 #if 0 /* strtoul() for /^-/ strings is undefined. */
18029         check("-1", 4294967295UL, 0);
18030         check("-4294967294", 2, 0);
18031         check("-4294967295", 1, 0);
18032         check("-4294967296", 4294967295UL, ERANGE);
18033         check("-4294967297", 4294967295UL, ERANGE);
18034 #endif
18035 EOCP
18036                 ;;
18037         *)
18038 : Should we write these tests to be more portable by sprintf-ing
18039 : ~0 and then manipulating that char string as input for strtol?
18040                 ;;
18041         esac
18042         $cat >>try.c <<'EOCP'
18043         if (!bad)
18044                 printf("ok\n");
18045         return 0;
18046 }
18047 EOCP
18048         set try
18049         if eval $compile; then
18050                 case "`$run ./try`" in
18051                 ok) echo "Your strtoul() seems to be working okay." ;;
18052                 *) cat <<EOM >&4
18053 Your strtoul() doesn't seem to be working okay.
18054 EOM
18055                    d_strtoul="$undef"
18056                    ;;
18057                 esac
18058         else
18059                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18060                 d_strtoul="$undef"
18061         fi
18062         ;;
18063 esac
18064
18065 : see if strtoull exists
18066 set strtoull d_strtoull
18067 eval $inlibc
18068
18069 case "$d_longlong-$d_strtoull" in
18070 "$define-$define")
18071         $cat <<EOM
18072 Checking whether your strtoull() works okay...
18073 EOM
18074         $cat >try.c <<'EOCP'
18075 #include <errno.h>
18076 #ifdef __hpux
18077 #define strtoull __strtoull
18078 #endif
18079 #include <stdio.h>
18080 extern unsigned long long int strtoull(char *s, char **, int);
18081 static int bad = 0;
18082 int check(char *s, long long eull, int een) {
18083         long long gull;
18084         errno = 0;
18085         gull = strtoull(s, 0, 10);
18086         if (!((gull == eull) && (errno == een)))
18087                 bad++;
18088 }
18089 int main() {
18090         check(" 1",                                        1LL, 0);
18091         check(" 0",                                        0LL, 0);
18092         check("18446744073709551615",  18446744073709551615ULL, 0);
18093         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18094 #if 0 /* strtoull() for /^-/ strings is undefined. */
18095         check("-1",                    18446744073709551615ULL, 0);
18096         check("-18446744073709551614",                     2LL, 0);
18097         check("-18446744073709551615",                     1LL, 0);
18098         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18099         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18100 #endif
18101         if (!bad)
18102                 printf("ok\n");
18103 }
18104 EOCP
18105         set try
18106         if eval $compile; then
18107                 case "`$run ./try`" in
18108                 ok) echo "Your strtoull() seems to be working okay." ;;
18109                 *) cat <<EOM >&4
18110 Your strtoull() doesn't seem to be working okay.
18111 EOM
18112                    d_strtoull="$undef"
18113                    ;;
18114                 esac
18115         else
18116                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18117                 d_strtoull="$undef"
18118         fi
18119         ;;
18120 esac
18121
18122 : see if strtouq exists
18123 set strtouq d_strtouq
18124 eval $inlibc
18125
18126 case "$d_strtouq" in
18127 "$define")
18128         $cat <<EOM
18129 Checking whether your strtouq() works okay...
18130 EOM
18131         $cat >try.c <<'EOCP'
18132 #include <errno.h>
18133 #include <stdio.h>
18134 extern unsigned long long int strtouq(char *s, char **, int);
18135 static int bad = 0;
18136 void check(char *s, unsigned long long eull, int een) {
18137         unsigned long long gull;
18138         errno = 0;
18139         gull = strtouq(s, 0, 10);
18140         if (!((gull == eull) && (errno == een)))
18141                 bad++;
18142 }
18143 int main() {
18144         check(" 1",                                        1LL, 0);
18145         check(" 0",                                        0LL, 0);
18146         check("18446744073709551615",  18446744073709551615ULL, 0);
18147         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18148 #if 0 /* strtouq() for /^-/ strings is undefined. */
18149         check("-1",                    18446744073709551615ULL, 0);
18150         check("-18446744073709551614",                     2LL, 0);
18151         check("-18446744073709551615",                     1LL, 0);
18152         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18153         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18154 #endif
18155         if (!bad)
18156                 printf("ok\n");
18157         return 0;
18158 }
18159 EOCP
18160         set try
18161         if eval $compile; then
18162                 case "`$run ./try`" in
18163                 ok) echo "Your strtouq() seems to be working okay." ;;
18164                 *) cat <<EOM >&4
18165 Your strtouq() doesn't seem to be working okay.
18166 EOM
18167                    d_strtouq="$undef"
18168                    ;;
18169                 esac
18170         else
18171                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18172                 d_strtouq="$undef"
18173         fi
18174         ;;
18175 esac
18176
18177 : see if strxfrm exists
18178 set strxfrm d_strxfrm
18179 eval $inlibc
18180
18181 : see if symlink exists
18182 set symlink d_symlink
18183 eval $inlibc
18184
18185 : see if syscall exists
18186 set syscall d_syscall
18187 eval $inlibc
18188
18189 : see if prototype for syscall is available
18190 echo " "
18191 set d_syscallproto syscall $i_unistd unistd.h
18192 eval $hasproto
18193
18194 : see if sysconf exists
18195 set sysconf d_sysconf
18196 eval $inlibc
18197
18198 : see if system exists
18199 set system d_system
18200 eval $inlibc
18201
18202 : see if tcgetpgrp exists
18203 set tcgetpgrp d_tcgetpgrp
18204 eval $inlibc
18205
18206 : see if tcsetpgrp exists
18207 set tcsetpgrp d_tcsetpgrp
18208 eval $inlibc
18209
18210 : see if prototype for telldir is available
18211 echo " "
18212 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18213 eval $hasproto
18214
18215 : see if time exists
18216 echo " "
18217 if test "X$d_time" = X -o X"$timetype" = X; then
18218     if set time val -f d_time; eval $csym; $val; then
18219                 echo 'time() found.' >&4
18220                 val="$define"
18221                 rp="What is the type returned by time() on this system?"
18222                 set time_t timetype long stdio.h sys/types.h
18223                 eval $typedef_ask
18224     else
18225                 echo 'time() not found, hope that will do.' >&4
18226                 val="$undef"
18227                 timetype='int';
18228     fi
18229     set d_time
18230     eval $setvar
18231 fi
18232
18233 : see if timegm exists
18234 set timegm d_timegm
18235 eval $inlibc
18236
18237 : see if this is a sys/times.h system
18238 set sys/times.h i_systimes
18239 eval $inhdr
18240
18241 : see if times exists
18242 echo " "
18243 if set times val -f d_times; eval $csym; $val; then
18244         echo 'times() found.' >&4
18245         d_times="$define"
18246         inc=''
18247         case "$i_systimes" in
18248         "$define") inc='sys/times.h';;
18249         esac
18250         rp="What is the type returned by times() on this system?"
18251         set clock_t clocktype long stdio.h sys/types.h $inc
18252         eval $typedef_ask
18253 else
18254         echo 'times() NOT found, hope that will do.' >&4
18255         d_times="$undef"
18256         clocktype='int'
18257 fi
18258
18259 : see if tmpnam_r exists
18260 set tmpnam_r d_tmpnam_r
18261 eval $inlibc
18262 case "$d_tmpnam_r" in
18263 "$define")
18264         hdrs="$i_systypes sys/types.h define stdio.h "
18265         case "$d_tmpnam_r_proto:$usethreads" in
18266         ":define")      d_tmpnam_r_proto=define
18267                 set d_tmpnam_r_proto tmpnam_r $hdrs
18268                 eval $hasproto ;;
18269         *)      ;;
18270         esac
18271         case "$d_tmpnam_r_proto" in
18272         define)
18273         case "$tmpnam_r_proto" in
18274         ''|0) try='char* tmpnam_r(char*);'
18275         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18276         esac
18277         case "$tmpnam_r_proto" in
18278         ''|0)   d_tmpnam_r=undef
18279                 tmpnam_r_proto=0
18280                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18281         * )     case "$tmpnam_r_proto" in
18282                 REENTRANT_PROTO*) ;;
18283                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18284                 esac
18285                 echo "Prototype: $try" ;;
18286         esac
18287         ;;
18288         *)      case "$usethreads" in
18289                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18290                 esac
18291                 d_tmpnam_r=undef
18292                 tmpnam_r_proto=0
18293                 ;;
18294         esac
18295         ;;
18296 *)      tmpnam_r_proto=0
18297         ;;
18298 esac
18299
18300 : see if truncate exists
18301 set truncate d_truncate
18302 eval $inlibc
18303
18304 : see if ttyname_r exists
18305 set ttyname_r d_ttyname_r
18306 eval $inlibc
18307 case "$d_ttyname_r" in
18308 "$define")
18309         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18310         case "$d_ttyname_r_proto:$usethreads" in
18311         ":define")      d_ttyname_r_proto=define
18312                 set d_ttyname_r_proto ttyname_r $hdrs
18313                 eval $hasproto ;;
18314         *)      ;;
18315         esac
18316         case "$d_ttyname_r_proto" in
18317         define)
18318         case "$ttyname_r_proto" in
18319         ''|0) try='int ttyname_r(int, char*, size_t);'
18320         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18321         esac
18322         case "$ttyname_r_proto" in
18323         ''|0) try='int ttyname_r(int, char*, int);'
18324         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18325         esac
18326         case "$ttyname_r_proto" in
18327         ''|0) try='char* ttyname_r(int, char*, int);'
18328         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18329         esac
18330         case "$ttyname_r_proto" in
18331         ''|0)   d_ttyname_r=undef
18332                 ttyname_r_proto=0
18333                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18334         * )     case "$ttyname_r_proto" in
18335                 REENTRANT_PROTO*) ;;
18336                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18337                 esac
18338                 echo "Prototype: $try" ;;
18339         esac
18340         ;;
18341         *)      case "$usethreads" in
18342                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18343                 esac
18344                 d_ttyname_r=undef
18345                 ttyname_r_proto=0
18346                 ;;
18347         esac
18348         ;;
18349 *)      ttyname_r_proto=0
18350         ;;
18351 esac
18352
18353 : see if tzname[] exists
18354 echo " "
18355 if set tzname val -a d_tzname; eval $csym; $val; then
18356         val="$define"
18357         echo 'tzname[] found.' >&4
18358 else
18359         val="$undef"
18360         echo 'tzname[] NOT found.' >&4
18361 fi
18362 set d_tzname
18363 eval $setvar
18364
18365 : Check if is a multiplatform env
18366 case "$osname" in
18367 next|rhapsody|darwin) multiarch="$define" ;;
18368 esac
18369 case "$multiarch" in
18370 ''|[nN]*) multiarch="$undef" ;;
18371 esac
18372
18373 : check for ordering of bytes in a UV
18374 echo " "
18375 case "$usecrosscompile$multiarch" in
18376 *$define*)
18377         $cat <<EOM
18378 You seem to be either cross-compiling or doing a multiarchitecture build,
18379 skipping the byteorder check.
18380
18381 EOM
18382         byteorder='ffff'
18383         ;;
18384 *)
18385         case "$byteorder" in
18386         '')
18387                 $cat <<'EOM'
18388 In the following, larger digits indicate more significance.  A big-endian
18389 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18390 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18391 machines may have weird orders like 3412.  A Cray will report 87654321,
18392 an Alpha will report 12345678. If the test program works the default is
18393 probably right.
18394 I'm now running the test program...
18395 EOM
18396                 $cat >try.c <<EOCP
18397 #include <stdio.h>
18398 #$i_stdlib I_STDLIB
18399 #ifdef I_STDLIB
18400 #include <stdlib.h>
18401 #endif
18402 #include <sys/types.h>
18403 typedef $uvtype UV;
18404 int main()
18405 {
18406         int i;
18407         union {
18408                 UV l;
18409                 char c[$uvsize];
18410         } u;
18411
18412         if ($uvsize > 4)
18413                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18414         else
18415                 u.l = (UV)0x04030201;
18416         for (i = 0; i < $uvsize; i++)
18417                 printf("%c", u.c[i]+'0');
18418         printf("\n");
18419         exit(0);
18420 }
18421 EOCP
18422                 xxx_prompt=y
18423                 set try
18424                 if eval $compile && $run ./try > /dev/null; then
18425                         dflt=`$run ./try`
18426                         case "$dflt" in
18427                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18428                                 echo "(The test program ran ok.)"
18429                                 echo "byteorder=$dflt"
18430                                 xxx_prompt=n
18431                         ;;
18432                         ????|????????) echo "(The test program ran ok.)" ;;
18433                         *) echo "(The test program didn't run right for some reason.)" ;;
18434                         esac
18435                 else
18436                         dflt='4321'
18437                         cat <<'EOM'
18438 (I can't seem to compile the test program.  Guessing big-endian...)
18439 EOM
18440                 fi
18441                 case "$xxx_prompt" in
18442                 y)
18443                         rp="What is the order of bytes in $uvtype?"
18444                         . ./myread
18445                         byteorder="$ans"
18446                         ;;
18447                 *)      byteorder=$dflt
18448                         ;;
18449                 esac
18450                 ;;
18451         esac
18452         $rm_try
18453         ;;
18454 esac
18455
18456 : Checking 32bit aligndness
18457 $cat <<EOM
18458
18459 Checking to see whether you can access character data unalignedly...
18460 EOM
18461 case "$d_u32align" in
18462 '')   $cat >try.c <<EOCP
18463 #include <stdio.h>
18464 #$i_stdlib I_STDLIB
18465 #ifdef I_STDLIB
18466 #include <stdlib.h>
18467 #endif
18468 #define U32 $u32type
18469 #define BYTEORDER 0x$byteorder
18470 #define U8 $u8type
18471 #include <signal.h>
18472 #ifdef SIGBUS
18473 $signal_t bletch(int s) { exit(4); }
18474 #endif
18475 int main() {
18476 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18477     U8 buf[8];
18478     U32 *up;
18479     int i;
18480
18481     if (sizeof(U32) != 4) {
18482         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18483         exit(1);
18484     }
18485
18486     fflush(stdout);
18487
18488 #ifdef SIGBUS
18489     signal(SIGBUS, bletch);
18490 #endif
18491
18492     buf[0] = 0;
18493     buf[1] = 0;
18494     buf[2] = 0;
18495     buf[3] = 1;
18496     buf[4] = 0;
18497     buf[5] = 0;
18498     buf[6] = 0;
18499     buf[7] = 1;
18500
18501     for (i = 0; i < 4; i++) {
18502         up = (U32*)(buf + i);
18503         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18504                (*up == 1 << (8*(3-i)))  /* little-endian */
18505               )
18506            )
18507         {
18508             printf("read failed (%x)\n", *up);
18509             exit(2);
18510         }
18511     }
18512
18513     /* write test */
18514     for (i = 0; i < 4; i++) {
18515         up = (U32*)(buf + i);
18516         *up = 0xBeef;
18517         if (*up != 0xBeef) {
18518             printf("write failed (%x)\n", *up);
18519             exit(3);
18520         }
18521     }
18522
18523     exit(0);
18524 #else
18525     printf("1\n");
18526     exit(1);
18527 #endif
18528     return 0;
18529 }
18530 EOCP
18531 set try
18532 if eval $compile_ok; then
18533         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18534         $run ./try 2>&1 >/dev/null
18535         case "$?" in
18536         0)      cat >&4 <<EOM
18537 You can access character data pretty unalignedly.
18538 EOM
18539                 d_u32align="$undef"
18540                 ;;
18541         *)      cat >&4 <<EOM
18542 It seems that you must access character data in an aligned manner.
18543 EOM
18544                 d_u32align="$define"
18545                 ;;
18546         esac
18547 else
18548         rp='Can you access character data at unaligned addresses?'
18549         dflt='n'
18550         . ./myread
18551         case "$ans" in
18552         [yY]*)  d_u32align="$undef"  ;;
18553         *)      d_u32align="$define" ;;
18554         esac
18555 fi
18556 $rm_try
18557 ;;
18558 esac
18559
18560 : see if ualarm exists
18561 set ualarm d_ualarm
18562 eval $inlibc
18563
18564 : see if umask exists
18565 set umask d_umask
18566 eval $inlibc
18567
18568 : see if unordered exists
18569 set unordered d_unordered
18570 eval $inlibc
18571
18572 : see if unsetenv exists
18573 set unsetenv d_unsetenv
18574 eval $inlibc
18575
18576 : see if usleep exists
18577 set usleep d_usleep
18578 eval $inlibc
18579
18580 : see if prototype for usleep is available
18581 echo " "
18582 set d_usleepproto usleep $i_unistd unistd.h
18583 eval $hasproto
18584
18585 : see if ustat exists
18586 set ustat d_ustat
18587 eval $inlibc
18588
18589 : see if closedir exists
18590 set closedir d_closedir
18591 eval $inlibc
18592
18593 case "$d_closedir" in
18594 "$define")
18595         echo " "
18596         echo "Checking whether closedir() returns a status..." >&4
18597         cat > try.c <<EOM
18598 #$i_dirent I_DIRENT             /**/
18599 #$i_sysdir I_SYS_DIR            /**/
18600 #$i_sysndir I_SYS_NDIR          /**/
18601 #$i_systypes I_SYS_TYPES        /**/
18602
18603 #if defined(I_SYS_TYPES)
18604 #include <sys/types.h>
18605 #endif
18606 #if defined(I_DIRENT)
18607 #include <dirent.h>
18608 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18609 #include <sys/dir.h>
18610 #endif
18611 #else
18612 #ifdef I_SYS_NDIR
18613 #include <sys/ndir.h>
18614 #else
18615 #ifdef I_SYS_DIR
18616 #ifdef hp9000s500
18617 #include <ndir.h>       /* may be wrong in the future */
18618 #else
18619 #include <sys/dir.h>
18620 #endif
18621 #endif
18622 #endif
18623 #endif
18624 int main() { return closedir(opendir(".")); }
18625 EOM
18626         set try
18627         if eval $compile_ok; then
18628                 if $run ./try > /dev/null 2>&1 ; then
18629                         echo "Yes, it does."
18630                         val="$undef"
18631                 else
18632                         echo "No, it doesn't."
18633                         val="$define"
18634                 fi
18635         else
18636                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18637                 val="$define"
18638         fi
18639         ;;
18640 *)
18641         val="$undef";
18642         ;;
18643 esac
18644 set d_void_closedir
18645 eval $setvar
18646 $rm_try
18647
18648 : see if there is a wait4
18649 set wait4 d_wait4
18650 eval $inlibc
18651
18652 : see if waitpid exists
18653 set waitpid d_waitpid
18654 eval $inlibc
18655
18656 : see if wcstombs exists
18657 set wcstombs d_wcstombs
18658 eval $inlibc
18659
18660 : see if wctomb exists
18661 set wctomb d_wctomb
18662 eval $inlibc
18663
18664 : see if writev exists
18665 set writev d_writev
18666 eval $inlibc
18667
18668 : preserve RCS keywords in files with variable substitution, grrr
18669 Date='$Date'
18670 Id='$Id'
18671 Log='$Log'
18672 RCSfile='$RCSfile'
18673 Revision='$Revision'
18674
18675 : check for alignment requirements
18676 echo " "
18677 case "$usecrosscompile$multiarch" in
18678 *$define*)
18679         $cat <<EOM
18680 You seem to be either cross-compiling or doing a multiarchitecture build,
18681 skipping the memory alignment check.
18682
18683 EOM
18684         case "$alignbytes" in
18685         '') alignbytes=8 ;;
18686         esac
18687         ;;
18688 *)
18689         case "$alignbytes" in
18690         '') echo "Checking alignment constraints..." >&4
18691                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18692                         $cat >try.c <<'EOCP'
18693 typedef long double NV;
18694 EOCP
18695                 else
18696                         $cat >try.c <<'EOCP'
18697 typedef double NV;
18698 EOCP
18699                 fi
18700                 $cat >>try.c <<'EOCP'
18701 #include <stdio.h>
18702 struct foobar {
18703         char foo;
18704         NV bar;
18705 } try_algn;
18706 int main()
18707 {
18708     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18709     return(0);
18710 }
18711 EOCP
18712                 set try
18713                 if eval $compile_ok; then
18714                         dflt=`$run ./try`
18715                 else
18716                         dflt='8'
18717                         echo "(I can't seem to compile the test program...)"
18718                 fi
18719                 ;;
18720         *) dflt="$alignbytes"
18721                 ;;
18722         esac
18723         rp="Doubles must be aligned on a how-many-byte boundary?"
18724         . ./myread
18725         alignbytes="$ans"
18726         $rm_try
18727         ;;
18728 esac
18729
18730
18731 : set the base revision
18732 baserev=5.0
18733
18734 : how do we concatenate cpp tokens here?
18735 echo " "
18736 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18737 $cat >cpp_stuff.c <<'EOCP'
18738 #define RCAT(a,b)a/**/b
18739 #define ACAT(a,b)a ## b
18740 RCAT(Rei,ser)
18741 ACAT(Cir,cus)
18742 EOCP
18743 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18744 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18745         echo "Oh!  Smells like ANSI's been here." >&4
18746         echo "We can catify or stringify, separately or together!"
18747         cpp_stuff=42
18748 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18749         echo "Ah, yes!  The good old days!" >&4
18750         echo "However, in the good old days we don't know how to stringify and"
18751         echo "catify at the same time."
18752         cpp_stuff=1
18753 else
18754         $cat >&4 <<EOM
18755 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18756 You're going to have to edit the values of CAT[2-5] in config.h...
18757 EOM
18758         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18759 fi
18760 $rm -f cpp_stuff.*
18761
18762 : see if this is a db.h system
18763 set db.h i_db
18764 eval $inhdr
18765
18766 case "$i_db" in
18767 $define)
18768         : Check db version.
18769         echo " "
18770         echo "Checking Berkeley DB version ..." >&4
18771         $cat >try.c <<EOCP
18772 #$d_const HASCONST
18773 #ifndef HASCONST
18774 #define const
18775 #endif
18776 #include <sys/types.h>
18777 #include <stdio.h>
18778 #$i_stdlib I_STDLIB
18779 #ifdef I_STDLIB
18780 #include <stdlib.h>
18781 #endif
18782 #include <db.h>
18783 int main(int argc, char *argv[])
18784 {
18785 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18786     int Major, Minor, Patch ;
18787     unsigned long Version ;
18788     (void)db_version(&Major, &Minor, &Patch) ;
18789     if (argc == 2) {
18790         printf("%d %d %d %d %d %d\n",
18791                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18792                Major, Minor, Patch);
18793         exit(0);
18794     }
18795     printf("You have Berkeley DB Version 2 or greater.\n");
18796
18797     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18798                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18799     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18800                 Major, Minor, Patch) ;
18801
18802     /* check that db.h & libdb are compatible */
18803     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18804         printf("db.h and libdb are incompatible.\n") ;
18805         exit(3);
18806     }
18807
18808     printf("db.h and libdb are compatible.\n") ;
18809
18810     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18811                 + DB_VERSION_PATCH ;
18812
18813     /* needs to be >= 2.3.4 */
18814     if (Version < 2003004) {
18815     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18816         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18817         exit(2);
18818     }
18819
18820     exit(0);
18821 #else
18822 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18823     if (argc == 2) {
18824         printf("1 0 0\n");
18825         exit(0);
18826     }
18827     printf("You have Berkeley DB Version 1.\n");
18828     exit(0);    /* DB version < 2: the coast is clear. */
18829 #else
18830     exit(1);    /* <db.h> not Berkeley DB? */
18831 #endif
18832 #endif
18833 }
18834 EOCP
18835         set try
18836         if eval $compile_ok && $run ./try; then
18837                 echo 'Looks OK.' >&4
18838                 set `$run ./try 1`
18839                 db_version_major=$1
18840                 db_version_minor=$2
18841                 db_version_patch=$3
18842         else
18843                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18844                 i_db=$undef
18845                 case " $libs " in
18846                 *"-ldb "*)
18847                         : Remove db from list of libraries to use
18848                         echo "Removing unusable -ldb from library list" >&4
18849                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18850                         shift
18851                         libs="$*"
18852                         echo "libs = $libs" >&4
18853                         ;;
18854                 esac
18855         fi
18856         $rm_try
18857         ;;
18858 esac
18859
18860 case "$i_db" in
18861 define)
18862         : Check the return type needed for hash
18863         echo " "
18864         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18865         $cat >try.c <<EOCP
18866 #$d_const HASCONST
18867 #ifndef HASCONST
18868 #define const
18869 #endif
18870 #include <sys/types.h>
18871 #include <db.h>
18872
18873 #ifndef DB_VERSION_MAJOR
18874 u_int32_t hash_cb (ptr, size)
18875 const void *ptr;
18876 size_t size;
18877 {
18878 }
18879 HASHINFO info;
18880 int main()
18881 {
18882         info.hash = hash_cb;
18883 }
18884 #endif
18885 EOCP
18886         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18887                 if $contains warning try.out >>/dev/null 2>&1 ; then
18888                         db_hashtype='int'
18889                 else
18890                         db_hashtype='u_int32_t'
18891                 fi
18892         else
18893                 : XXX Maybe we should just give up here.
18894                 db_hashtype=u_int32_t
18895                 $cat try.out >&4
18896                 echo "Help:  I can't seem to compile the db test program." >&4
18897                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18898         fi
18899         $rm_try
18900         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18901         ;;
18902 *)      db_hashtype=u_int32_t
18903         ;;
18904 esac
18905 case "$i_db" in
18906 define)
18907         : Check the return type needed for prefix
18908         echo " "
18909         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18910         cat >try.c <<EOCP
18911 #$d_const HASCONST
18912 #ifndef HASCONST
18913 #define const
18914 #endif
18915 #include <sys/types.h>
18916 #include <db.h>
18917
18918 #ifndef DB_VERSION_MAJOR
18919 size_t prefix_cb (key1, key2)
18920 const DBT *key1;
18921 const DBT *key2;
18922 {
18923 }
18924 BTREEINFO info;
18925 int main()
18926 {
18927         info.prefix = prefix_cb;
18928 }
18929 #endif
18930 EOCP
18931         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18932                 if $contains warning try.out >>/dev/null 2>&1 ; then
18933                         db_prefixtype='int'
18934                 else
18935                         db_prefixtype='size_t'
18936                 fi
18937         else
18938                 db_prefixtype='size_t'
18939                 : XXX Maybe we should just give up here.
18940                 $cat try.out >&4
18941                 echo "Help:  I can't seem to compile the db test program." >&4
18942                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18943         fi
18944         $rm_try
18945         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18946         ;;
18947 *)      db_prefixtype='size_t'
18948         ;;
18949 esac
18950
18951 : How can we generate normalized random numbers ?
18952 echo " "
18953 echo "Looking for a random number function..." >&4
18954 case "$randfunc" in
18955 '')
18956         if set drand48 val -f; eval $csym; $val; then
18957                 dflt="drand48"
18958                 echo "Good, found drand48()." >&4
18959         elif set random val -f; eval $csym; $val; then
18960                 dflt="random"
18961                 echo "OK, found random()." >&4
18962         else
18963                 dflt="rand"
18964                 echo "Yick, looks like I have to use rand()." >&4
18965         fi
18966         echo " "
18967         ;;
18968 *)
18969         dflt="$randfunc"
18970         ;;
18971 esac
18972 cont=true
18973
18974 case "$ccflags" in
18975 *-Dmy_rand=*|*-Dmy_srand=*)
18976         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18977         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18978         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18979         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18980         ;;
18981 esac
18982
18983 while $test "$cont"; do
18984         rp="Use which function to generate random numbers?"
18985         . ./myread
18986         if $test "$ans" = "$dflt"; then
18987                 : null
18988         else
18989                 randbits=''
18990         fi
18991         randfunc="$ans"
18992         if set $ans val -f; eval $csym; $val; then
18993                 cont=''
18994         else
18995                 dflt=y
18996                 rp="I cannot find function $ans. Use that name anyway?"
18997                 . ./myread
18998                 dflt=rand
18999                 case "$ans" in
19000                         [yY]*) cont='';;
19001                 esac
19002         fi
19003         case "$cont" in
19004         '')
19005                 case "$randfunc" in
19006                 drand48)
19007                         drand01="drand48()"
19008                         seedfunc="srand48"
19009                         randbits=48
19010                         randseedtype=long
19011                         ;;
19012                 rand|random)
19013                         case "$randbits" in
19014                         '')
19015 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19016                                 $cat >try.c <<EOCP
19017 #$i_unistd I_UNISTD
19018 #$i_stdlib I_STDLIB
19019 #include <stdio.h>
19020 #ifdef I_UNISTD
19021 #  include <unistd.h>
19022 #endif
19023 #ifdef I_STDLIB
19024 #  include <stdlib.h>
19025 #endif
19026 int main()
19027 {
19028         register int i;
19029         register unsigned long tmp;
19030         register unsigned long max = 0L;
19031
19032         for (i = 1000; i; i--) {
19033                 tmp = (unsigned long) $randfunc();
19034                 if (tmp > max) max = tmp;
19035         }
19036         for (i = 0; max; i++)
19037                 max /= 2;
19038         printf("%d\n",i);
19039 }
19040 EOCP
19041                                 set try
19042                                 if eval $compile_ok; then
19043                                         dflt=`try`
19044                                 else
19045                                         dflt='?'
19046                                         echo "(I can't seem to compile the test program...)"
19047                                 fi
19048                                 ;;
19049                         *)
19050                                 dflt="$randbits"
19051                                 ;;
19052                         esac
19053                         rp="How many bits does your $randfunc() function produce?"
19054                         . ./myread
19055                         randbits="$ans"
19056                         $rm_try
19057                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19058                         seedfunc="s$randfunc"
19059                         randseedtype=unsigned
19060                         ;;
19061                 *)
19062                         dflt="31"
19063                         rp="How many bits does your $randfunc() function produce?"
19064                         . ./myread
19065                         randbits="$ans"
19066                         seedfunc="s$randfunc"
19067                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19068                         if set $seedfunc val -f; eval $csym; $val; then
19069                                 echo "(Using $seedfunc() to seed random generator)"
19070                         else
19071                                 echo "(Warning: no $seedfunc() to seed random generator)"
19072                                 seedfunc=rand
19073                         fi
19074                         randseedtype=unsigned
19075                         ;;
19076                 esac
19077                 ;;
19078         esac
19079 done
19080
19081 : Determine if this is an EBCDIC system
19082 echo " "
19083 echo "Determining whether or not we are on an EBCDIC system..." >&4
19084 $cat >try.c <<'EOM'
19085 int main()
19086 {
19087   if ('M'==0xd4) return 0;
19088   return 1;
19089 }
19090 EOM
19091
19092 val=$undef
19093 set try
19094 if eval $compile_ok; then
19095         if $run ./try; then
19096                 echo "You seem to speak EBCDIC." >&4
19097                 val="$define"
19098         else
19099                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19100         fi
19101 else
19102         echo "I'm unable to compile the test program." >&4
19103         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19104 fi
19105 $rm_try
19106 set ebcdic
19107 eval $setvar
19108
19109 : Check how to flush
19110 echo " "
19111 $cat >&4 <<EOM
19112 Checking how to flush all pending stdio output...
19113 EOM
19114 # I only know how to find the first 32 possibly open files on SunOS.
19115 # See also hints/sunos_4_1.sh and util.c  --AD
19116 case "$osname" in
19117 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19118 esac
19119 $cat >>try.c <<EOCP
19120 #include <stdio.h>
19121 #$i_stdlib I_STDLIB
19122 #ifdef I_STDLIB
19123 #include <stdlib.h>
19124 #endif
19125 #$i_unistd I_UNISTD
19126 #ifdef I_UNISTD
19127 # include <unistd.h>
19128 #endif
19129 #$d_sysconf HAS_SYSCONF
19130 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19131 #ifdef HAS_STDIO_STREAM_ARRAY
19132 # define STDIO_STREAM_ARRAY $stdio_stream_array
19133 #endif
19134 int main() {
19135   FILE* p;
19136   unlink("try.out");
19137   p = fopen("try.out", "w");
19138 #ifdef TRY_FPUTC
19139   fputc('x', p);
19140 #else
19141 # ifdef TRY_FPRINTF
19142   fprintf(p, "x");
19143 # endif
19144 #endif
19145 #ifdef TRY_FFLUSH_NULL
19146   fflush(NULL);
19147 #endif
19148 #ifdef TRY_FFLUSH_ALL
19149   {
19150     long open_max = -1;
19151 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19152     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19153 # else
19154 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19155     open_max = sysconf(_SC_OPEN_MAX);
19156 #  else
19157 #   ifdef FOPEN_MAX
19158     open_max = FOPEN_MAX;
19159 #   else
19160 #    ifdef OPEN_MAX
19161     open_max = OPEN_MAX;
19162 #    else
19163 #     ifdef _NFILE
19164     open_max = _NFILE;
19165 #     endif
19166 #    endif
19167 #   endif
19168 #  endif
19169 # endif
19170 # ifdef HAS_STDIO_STREAM_ARRAY
19171     if (open_max > 0) {
19172       long i;
19173       for (i = 0; i < open_max; i++)
19174             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19175                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19176                 STDIO_STREAM_ARRAY[i]._flag)
19177                 fflush(&STDIO_STREAM_ARRAY[i]);
19178     }
19179   }
19180 # endif
19181 #endif
19182   _exit(42);
19183 }
19184 EOCP
19185 : first we have to find out how _not_ to flush
19186 $to try.c
19187 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19188     output=''
19189     set try -DTRY_FPUTC
19190     if eval $compile; then
19191             $run ./try 2>/dev/null
19192             code="$?"
19193             $from try.out
19194             if $test ! -s try.out -a "X$code" = X42; then
19195                 output=-DTRY_FPUTC
19196             fi
19197     fi
19198     case "$output" in
19199     '')
19200             set try -DTRY_FPRINTF
19201             if eval $compile; then
19202                     $run ./try 2>/dev/null
19203                     code="$?"
19204                     $from try.out
19205                     if $test ! -s try.out -a "X$code" = X42; then
19206                         output=-DTRY_FPRINTF
19207                     fi
19208             fi
19209         ;;
19210     esac
19211 fi
19212 : check for fflush NULL behaviour
19213 case "$fflushNULL" in
19214 '')     set try -DTRY_FFLUSH_NULL $output
19215         if eval $compile; then
19216                 $run ./try 2>/dev/null
19217                 code="$?"
19218                 $from try.out
19219                 if $test -s try.out -a "X$code" = X42; then
19220                         fflushNULL="`$cat try.out`"
19221                 else
19222                         if $test "X$code" != X42; then
19223                                 $cat >&4 <<EOM
19224 (If this test failed, don't worry, we'll try another method shortly.)
19225 EOM
19226                         fi
19227                 fi
19228         fi
19229         $rm -f core try.core core.try.*
19230         case "$fflushNULL" in
19231         x)      $cat >&4 <<EOM
19232 Your fflush(NULL) works okay for output streams.
19233 Let's see if it clobbers input pipes...
19234 EOM
19235 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19236 # bug that improperly flushes the input end of pipes.  So we avoid the
19237 # autoflush on fork/system/exec support for now. :-(
19238 $cat >tryp.c <<EOCP
19239 #include <stdio.h>
19240 int
19241 main(int argc, char **argv)
19242 {
19243     char buf[1024];
19244     int i;
19245     char *bp = buf;
19246     while (1) {
19247         while ((i = getc(stdin)) != -1
19248                && (*bp++ = i) != '\n'
19249                && bp < &buf[1024])
19250         /* DO NOTHING */ ;
19251         *bp = '\0';
19252         fprintf(stdout, "%s", buf);
19253         fflush(NULL);
19254         if (i == -1)
19255             return 0;
19256         bp = buf;
19257     }
19258 }
19259 EOCP
19260                 fflushNULL="$define"
19261                 set tryp
19262                 if eval $compile; then
19263                     $rm -f tryp.out
19264                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19265                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19266                        $cat >&4 <<EOM
19267 fflush(NULL) seems to behave okay with input streams.
19268 EOM
19269                         fflushNULL="$define"
19270                     else
19271                         $cat >&4 <<EOM
19272 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19273 EOM
19274                         fflushNULL="$undef"
19275                     fi
19276                 fi
19277                 $rm -f core tryp.c tryp.core core.tryp.*
19278                 ;;
19279         '')     $cat >&4 <<EOM
19280 Your fflush(NULL) isn't working (contrary to ANSI C).
19281 EOM
19282                 fflushNULL="$undef"
19283                 ;;
19284         *)      $cat >&4 <<EOM
19285 Cannot figure out whether your fflush(NULL) works or not.
19286 I'm assuming it doesn't (contrary to ANSI C).
19287 EOM
19288                 fflushNULL="$undef"
19289                 ;;
19290         esac
19291         ;;
19292 $define|true|[yY]*)
19293         fflushNULL="$define"
19294         ;;
19295 *)
19296         fflushNULL="$undef"
19297         ;;
19298 esac
19299 : check explicit looping only if NULL did not work, and if the pipe
19300 : bug does not show up on an explicit flush too
19301 case "$fflushNULL" in
19302 "$undef")
19303         $cat >tryp.c <<EOCP
19304 #include <stdio.h>
19305 int
19306 main(int argc, char **argv)
19307 {
19308     char buf[1024];
19309     int i;
19310     char *bp = buf;
19311     while (1) {
19312         while ((i = getc(stdin)) != -1
19313                && (*bp++ = i) != '\n'
19314                && bp < &buf[1024])
19315         /* DO NOTHING */ ;
19316         *bp = '\0';
19317         fprintf(stdout, "%s", buf);
19318         fflush(stdin);
19319         if (i == -1)
19320             return 0;
19321         bp = buf;
19322     }
19323 }
19324 EOCP
19325         set tryp
19326         if eval $compile; then
19327             $rm -f tryp.out
19328             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19329             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19330                $cat >&4 <<EOM
19331 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19332 EOM
19333                 : now check for fflushall behaviour
19334                 case "$fflushall" in
19335                 '')     set try -DTRY_FFLUSH_ALL $output
19336                         if eval $compile; then
19337                                 $cat >&4 <<EOM
19338 (Now testing the other method--but note that this also may fail.)
19339 EOM
19340                                 $run ./try 2>/dev/null
19341                                 code=$?
19342                                 $from try.out
19343                                 if $test -s try.out -a "X$code" = X42; then
19344                                         fflushall="`$cat try.out`"
19345                                 fi
19346                         fi
19347                         $rm_try
19348                         case "$fflushall" in
19349                         x)      $cat >&4 <<EOM
19350 Whew. Flushing explicitly all the stdio streams works.
19351 EOM
19352                                 fflushall="$define"
19353                                 ;;
19354                         '')     $cat >&4 <<EOM
19355 Sigh. Flushing explicitly all the stdio streams doesn't work.
19356 EOM
19357                                 fflushall="$undef"
19358                                 ;;
19359                         *)      $cat >&4 <<EOM
19360 Cannot figure out whether flushing stdio streams explicitly works or not.
19361 I'm assuming it doesn't.
19362 EOM
19363                                 fflushall="$undef"
19364                                 ;;
19365                         esac
19366                         ;;
19367                 "$define"|true|[yY]*)
19368                         fflushall="$define"
19369                         ;;
19370                 *)
19371                         fflushall="$undef"
19372                         ;;
19373                 esac
19374             else
19375                 $cat >&4 <<EOM
19376 All is futile.  Even fflush(stdin) clobbers input pipes!
19377 EOM
19378                 fflushall="$undef"
19379             fi
19380         else
19381             fflushall="$undef"
19382         fi
19383         $rm -f core tryp.c tryp.core core.tryp.*
19384         ;;
19385 *)      fflushall="$undef"
19386         ;;
19387 esac
19388
19389 case "$fflushNULL$fflushall" in
19390 undefundef)
19391         $cat <<EOM
19392 OK, I give up.  I cannot figure out how to flush pending stdio output.
19393 We won't be flushing handles at all before fork/exec/popen.
19394 EOM
19395         ;;
19396 esac
19397 $rm_try tryp
19398
19399 : Store the full pathname to the ar program for use in the C program
19400 : Respect a hint or command line value for full_ar.
19401 case "$full_ar" in
19402 '') full_ar=$ar ;;
19403 esac
19404
19405 : Store the full pathname to the sed program for use in the C program
19406 full_sed=$sed
19407
19408 : see what type gids are declared as in the kernel
19409 echo " "
19410 echo "Looking for the type for group ids returned by getgid()."
19411 set gid_t gidtype xxx stdio.h sys/types.h
19412 eval $typedef
19413 case "$gidtype" in
19414 xxx)
19415         xxx=`./findhdr sys/user.h`
19416         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19417         case $1 in
19418         unsigned) dflt="$1 $2" ;;
19419         *) dflt="$1" ;;
19420         esac
19421         ;;
19422 *) dflt="$gidtype";;
19423 esac
19424 case "$gidtype" in
19425 gid_t) echo "gid_t found." ;;
19426 *)      rp="What is the type for group ids returned by getgid()?"
19427         . ./myread
19428         gidtype="$ans"
19429         ;;
19430 esac
19431
19432 : Check the size of GID
19433 echo " "
19434 case "$gidtype" in
19435 *_t) zzz="$gidtype"     ;;
19436 *)   zzz="gid"          ;;
19437 esac
19438 echo "Checking the size of $zzz..." >&4
19439 cat > try.c <<EOCP
19440 #include <sys/types.h>
19441 #include <stdio.h>
19442 #$i_stdlib I_STDLIB
19443 #ifdef I_STDLIB
19444 #include <stdlib.h>
19445 #endif
19446 int main() {
19447     printf("%d\n", (int)sizeof($gidtype));
19448     exit(0);
19449 }
19450 EOCP
19451 set try
19452 if eval $compile_ok; then
19453         yyy=`$run ./try`
19454         case "$yyy" in
19455         '')     gidsize=4
19456                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19457                 ;;
19458         *)      gidsize=$yyy
19459                 echo "Your $zzz is $gidsize bytes long."
19460                 ;;
19461         esac
19462 else
19463         gidsize=4
19464         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19465 fi
19466
19467
19468 : Check if GID is signed
19469 echo " "
19470 case "$gidtype" in
19471 *_t) zzz="$gidtype"     ;;
19472 *)   zzz="gid"          ;;
19473 esac
19474 echo "Checking the sign of $zzz..." >&4
19475 cat > try.c <<EOCP
19476 #include <sys/types.h>
19477 #include <stdio.h>
19478 int main() {
19479         $gidtype foo = -1;
19480         if (foo < 0)
19481                 printf("-1\n");
19482         else
19483                 printf("1\n");
19484 }
19485 EOCP
19486 set try
19487 if eval $compile; then
19488         yyy=`$run ./try`
19489         case "$yyy" in
19490         '')     gidsign=1
19491                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19492                 ;;
19493         *)      gidsign=$yyy
19494                 case "$gidsign" in
19495                  1) echo "Your $zzz is unsigned." ;;
19496                 -1) echo "Your $zzz is signed."   ;;
19497                 esac
19498                 ;;
19499         esac
19500 else
19501         gidsign=1
19502         echo "(I can't compile the test program--guessing unsigned.)" >&4
19503 fi
19504
19505
19506 : Check 64bit sizes
19507 echo " "
19508
19509 if $test X"$quadtype" != X; then
19510
19511 echo "Checking how to print 64-bit integers..." >&4
19512
19513 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19514         $cat >try.c <<'EOCP'
19515 #include <sys/types.h>
19516 #include <stdio.h>
19517 int main() {
19518   int q = 12345678901;
19519   printf("%ld\n", q);
19520 }
19521 EOCP
19522         set try
19523         if eval $compile; then
19524                 yyy=`$run ./try`
19525                 case "$yyy" in
19526                 12345678901)
19527                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19528                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19529                         echo "We will use %d."
19530                         ;;
19531                 esac
19532         fi
19533 fi
19534
19535 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19536         $cat >try.c <<'EOCP'
19537 #include <sys/types.h>
19538 #include <stdio.h>
19539 int main() {
19540   long q = 12345678901;
19541   printf("%ld\n", q);
19542 }
19543 EOCP
19544         set try
19545         if eval $compile; then
19546                 yyy=`$run ./try`
19547                 case "$yyy" in
19548                 12345678901)
19549                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19550                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19551                         echo "We will use %ld."
19552                         ;;
19553                 esac
19554         fi
19555 fi
19556
19557 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19558         $cat >try.c <<'EOCP'
19559 #include <sys/types.h>
19560 #include <inttypes.h>
19561 #include <stdio.h>
19562 int main() {
19563   int64_t q = 12345678901;
19564   printf("%" PRId64 "\n", q);
19565 }
19566 EOCP
19567         set try
19568         if eval $compile; then
19569                 yyy=`$run ./try`
19570                 case "$yyy" in
19571                 12345678901)
19572                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19573                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19574                         echo "We will use the C9X style."
19575                         ;;
19576                 esac
19577         fi
19578 fi
19579
19580 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19581         $cat >try.c <<EOCP
19582 #include <sys/types.h>
19583 #include <stdio.h>
19584 int main() {
19585   $quadtype q = 12345678901;
19586   printf("%Ld\n", q);
19587 }
19588 EOCP
19589         set try
19590         if eval $compile; then
19591                 yyy=`$run ./try`
19592                 case "$yyy" in
19593                 12345678901)
19594                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19595                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19596                         echo "We will use %Ld."
19597                         ;;
19598                 esac
19599         fi
19600 fi
19601
19602 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19603         $cat >try.c <<'EOCP'
19604 #include <sys/types.h>
19605 #include <stdio.h>
19606 int main() {
19607   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19608   printf("%lld\n", q);
19609 }
19610 EOCP
19611         set try
19612         if eval $compile; then
19613                 yyy=`$run ./try`
19614                 case "$yyy" in
19615                 12345678901)
19616                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19617                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19618                         echo "We will use the %lld style."
19619                         ;;
19620                 esac
19621         fi
19622 fi
19623
19624 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19625         $cat >try.c <<EOCP
19626 #include <sys/types.h>
19627 #include <stdio.h>
19628 int main() {
19629   $quadtype q = 12345678901;
19630   printf("%qd\n", q);
19631 }
19632 EOCP
19633         set try
19634         if eval $compile; then
19635                 yyy=`$run ./try`
19636                 case "$yyy" in
19637                 12345678901)
19638                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19639                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19640                         echo "We will use %qd."
19641                         ;;
19642                 esac
19643         fi
19644 fi
19645
19646 if $test X"$sPRId64" = X; then
19647         echo "Cannot figure out how to print 64-bit integers." >&4
19648 fi
19649 $rm_try
19650
19651 fi
19652
19653 case "$sPRId64" in
19654 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19655         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19656         ;;
19657 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19658         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19659         ;;
19660 esac
19661
19662 : Check format strings for internal types
19663 echo " "
19664 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19665
19666 if $test X"$ivsize" = X8; then
19667         ivdformat="$sPRId64"
19668         uvuformat="$sPRIu64"
19669         uvoformat="$sPRIo64"
19670         uvxformat="$sPRIx64"
19671         uvXUformat="$sPRIXU64"
19672 else
19673         if $test X"$ivsize" = X"$longsize"; then
19674                 ivdformat='"ld"'
19675                 uvuformat='"lu"'
19676                 uvoformat='"lo"'
19677                 uvxformat='"lx"'
19678                 uvXUformat='"lX"'
19679         else
19680                 if $test X"$ivsize" = X"$intsize"; then
19681                         ivdformat='"d"'
19682                         uvuformat='"u"'
19683                         uvoformat='"o"'
19684                         uvxformat='"x"'
19685                         uvXUformat='"X"'
19686                 else
19687                         : far out
19688                         if $test X"$ivsize" = X"$shortsize"; then
19689                                 ivdformat='"hd"'
19690                                 uvuformat='"hu"'
19691                                 uvoformat='"ho"'
19692                                 uvxformat='"hx"'
19693                                 uvXUformat='"hX"'
19694                         fi
19695                 fi
19696         fi
19697 fi
19698
19699 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19700         nveformat="$sPRIeldbl"
19701         nvfformat="$sPRIfldbl"
19702         nvgformat="$sPRIgldbl"
19703         nvEUformat="$sPRIEUldbl"
19704         nvFUformat="$sPRIFUldbl"
19705         nvGUformat="$sPRIGUldbl"
19706 else
19707         nveformat='"e"'
19708         nvfformat='"f"'
19709         nvgformat='"g"'
19710         nvEUformat='"E"'
19711         nvFUformat='"F"'
19712         nvGUformat='"G"'
19713 fi
19714
19715 case "$ivdformat" in
19716 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19717     exit 1
19718     ;;
19719 esac
19720
19721 : Check format string for GID
19722
19723 echo " "
19724 $echo "Checking the format string to be used for gids..." >&4
19725
19726 case "$gidsign" in
19727 -1)     if $test X"$gidsize" = X"$ivsize"; then
19728                 gidformat="$ivdformat"
19729         else
19730                 if $test X"$gidsize" = X"$longsize"; then
19731                         gidformat='"ld"'
19732                 else
19733                         if $test X"$gidsize" = X"$intsize"; then
19734                                 gidformat='"d"'
19735                         else
19736                                 if $test X"$gidsize" = X"$shortsize"; then
19737                                         gidformat='"hd"'
19738                                 fi
19739                         fi
19740                 fi
19741         fi
19742         ;;
19743 *)      if $test X"$gidsize" = X"$uvsize"; then
19744                 gidformat="$uvuformat"
19745         else
19746                 if $test X"$gidsize" = X"$longsize"; then
19747                         gidformat='"lu"'
19748                 else
19749                         if $test X"$gidsize" = X"$intsize"; then
19750                                 gidformat='"u"'
19751                         else
19752                                 if $test X"$gidsize" = X"$shortsize"; then
19753                                         gidformat='"hu"'
19754                                 fi
19755                         fi
19756                 fi
19757         fi
19758         ;;
19759 esac
19760
19761 : see if getgroups exists
19762 set getgroups d_getgrps
19763 eval $inlibc
19764
19765 : see if setgroups exists
19766 set setgroups d_setgrps
19767 eval $inlibc
19768
19769 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19770 echo " "
19771 case "$d_getgrps$d_setgrps" in
19772 *define*)
19773         case "$groupstype" in
19774         '') dflt="$gidtype" ;;
19775         *)  dflt="$groupstype" ;;
19776         esac
19777         $cat <<EOM
19778 What type of pointer is the second argument to getgroups() and setgroups()?
19779 Usually this is the same as group ids, $gidtype, but not always.
19780
19781 EOM
19782         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19783         . ./myread
19784         groupstype="$ans"
19785         ;;
19786 *)  groupstype="$gidtype";;
19787 esac
19788
19789 : MAD = Misc Attribute Definition
19790
19791 if $test $patchlevel -lt 9; then
19792 : MAD is not available in 5.8.x or earlier.
19793     ans=n;
19794 else
19795     case "$mad" in
19796     $define|true|[yY]*) dflt='y' ;;
19797     *)                  dflt='n' ;;
19798     esac
19799     cat <<EOM
19800
19801 Would you like to build with Misc Attribute Decoration? This is development
19802 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19803 overhead on the interpreter.
19804
19805 If this doesn't make any sense to you, just accept the default '$dflt'.
19806 EOM
19807     rp='Build Perl with MAD?'
19808     . ./myread
19809 fi
19810 case "$ans" in
19811 y|Y)    val="$define"
19812         madlyh='madly.h madly.act madly.tab'
19813         madlysrc='madly.c'
19814         madlyobj="madly$_o" ;;
19815 *)      val="$undef"
19816         madlyh=''
19817         madlysrc=''
19818         madlyobj='' ;;
19819 esac
19820 set mad
19821 eval $setvar
19822
19823 : check whether make sets MAKE
19824 echo " "
19825 echo "Checking if your $make program sets \$(MAKE)..." >&4
19826 case "$make_set_make" in
19827 '')
19828         $sed 's/^X //' > testmake.mak << 'EOF'
19829 Xall:
19830 X       @echo 'maketemp="$(MAKE)"'
19831 EOF
19832         case "`$make -f testmake.mak 2>/dev/null`" in
19833         *maketemp=*) make_set_make='#' ;;
19834         *)      make_set_make="MAKE=$make" ;;
19835         esac
19836         $rm -f testmake.mak
19837         ;;
19838 esac
19839 case "$make_set_make" in
19840 '#') echo "Yup, it does.";;
19841 *) echo "Nope, it doesn't.";;
19842 esac
19843
19844 : see what type is used for mode_t
19845 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19846 set mode_t modetype int stdio.h sys/types.h
19847 eval $typedef_ask
19848
19849 : see if we need va_copy
19850 echo " "
19851 case "$i_stdarg" in
19852 "$define")
19853         $cat >try.c <<EOCP
19854 #include <stdarg.h>
19855 #include <stdio.h>
19856 #$i_stdlib I_STDLIB
19857 #ifdef I_STDLIB
19858 #include <stdlib.h>
19859 #endif
19860 #include <signal.h>
19861
19862 int
19863 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19864 {
19865   return vfprintf(f, fmt, *valp);
19866 }
19867
19868 int
19869 myvfprintf(FILE *f, const  char *fmt, va_list val)
19870 {
19871   return ivfprintf(f, fmt, &val);
19872 }
19873
19874 int
19875 myprintf(char *fmt, ...)
19876 {
19877   va_list val;
19878   va_start(val, fmt);
19879   return myvfprintf(stdout, fmt, val);
19880 }
19881
19882 int
19883 main(int ac, char **av)
19884 {
19885   signal(SIGSEGV, exit);
19886
19887   myprintf("%s%cs all right, then\n", "that", '\'');
19888   exit(0);
19889 }
19890 EOCP
19891         set try
19892         if eval $compile && $run ./try 2>&1 >/dev/null; then
19893                 case "`$run ./try`" in
19894                 "that's all right, then")
19895                         okay=yes
19896                         ;;
19897                 esac
19898         fi
19899         case "$okay" in
19900         yes)    echo "It seems that you don't need va_copy()." >&4
19901                 need_va_copy="$undef"
19902                 ;;
19903         *)      echo "It seems that va_copy() or similar will be needed." >&4
19904                 need_va_copy="$define"
19905                 ;;
19906         esac
19907         $rm_try
19908         ;;
19909 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19910         ;;
19911 esac
19912
19913 : see what type is used for size_t
19914 rp="What is the type used for the length parameter for string functions?"
19915 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19916 eval $typedef_ask
19917
19918 : check for type of arguments to gethostbyaddr. 
19919 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19920         case "$d_gethbyaddr" in
19921         $define)
19922                 $cat <<EOM
19923
19924 Checking to see what type of arguments are accepted by gethostbyaddr().
19925 EOM
19926                 hdrs="$define sys/types.h
19927                         $d_socket sys/socket.h 
19928                         $i_niin netinet/in.h 
19929                         $i_netdb netdb.h
19930                         $i_unistd unistd.h"
19931                 : The first arg can 'char *' or 'void *'
19932                 : The second arg is some of integral type
19933                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19934                         for yyy in size_t long int; do
19935                                 case "$netdb_host_type" in
19936                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
19937                                         if ./protochk "$try" $hdrs; then
19938                                                 echo "Your system accepts $xxx for the first arg."
19939                                                 echo "...and $yyy for the second arg."
19940                                                 netdb_host_type="$xxx"
19941                                                 netdb_hlen_type="$yyy"
19942                                         fi
19943                                         ;;
19944                                 esac
19945                         done
19946                 done
19947                 : In case none of those worked, prompt the user.
19948                 case "$netdb_host_type" in
19949                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19950                         dflt='char *'
19951                         . ./myread
19952                         netdb_host_type=$ans
19953                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19954                         dflt="$sizetype"
19955                         . ./myread
19956                         netdb_hlen_type=$ans
19957                         ;;
19958                 esac
19959                 ;;
19960         *)      : no gethostbyaddr, so pick harmless defaults
19961                 netdb_host_type='char *'
19962                 netdb_hlen_type="$sizetype"
19963                 ;;
19964         esac
19965         # Remove the "const" if needed. -- but then we'll have a 
19966         # prototype clash!
19967         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19968 fi
19969
19970 : check for type of argument to gethostbyname. 
19971 if test "X$netdb_name_type" = X ; then
19972         case "$d_gethbyname" in
19973         $define)
19974                 $cat <<EOM
19975
19976 Checking to see what type of argument is accepted by gethostbyname().
19977 EOM
19978                 hdrs="$define sys/types.h
19979                         $d_socket sys/socket.h 
19980                         $i_niin netinet/in.h 
19981                         $i_netdb netdb.h
19982                         $i_unistd unistd.h"
19983                 for xxx in "const char *" "char *"; do
19984                         case "$netdb_name_type" in
19985                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
19986                                 if ./protochk "$try" $hdrs; then
19987                                         echo "Your system accepts $xxx."
19988                                         netdb_name_type="$xxx"
19989                                 fi
19990                                 ;;
19991                         esac
19992                 done
19993                 : In case none of those worked, prompt the user.
19994                 case "$netdb_name_type" in
19995                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19996                         dflt='char *'
19997                         . ./myread
19998                         netdb_name_type=$ans
19999                         ;;
20000                 esac
20001                 ;;
20002         *)      : no gethostbyname, so pick harmless default
20003                 netdb_name_type='char *'
20004                 ;;
20005         esac
20006 fi
20007
20008 : check for type of 1st argument to getnetbyaddr. 
20009 if test "X$netdb_net_type" = X ; then
20010         case "$d_getnbyaddr" in
20011         $define)
20012                 $cat <<EOM
20013
20014 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20015 EOM
20016                 hdrs="$define sys/types.h
20017                         $d_socket sys/socket.h 
20018                         $i_niin netinet/in.h 
20019                         $i_netdb netdb.h
20020                         $i_unistd unistd.h"
20021                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20022                         case "$netdb_net_type" in
20023                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20024                                 if ./protochk "$try" $hdrs; then
20025                                         echo "Your system accepts $xxx."
20026                                         netdb_net_type="$xxx"
20027                                 fi
20028                                 ;;
20029                         esac
20030                 done
20031                 : In case none of those worked, prompt the user.
20032                 case "$netdb_net_type" in
20033                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20034                         dflt='long'
20035                         . ./myread
20036                         netdb_net_type=$ans
20037                         ;;
20038                 esac
20039                 ;;
20040         *)      : no getnetbyaddr, so pick harmless default
20041                 netdb_net_type='long'
20042                 ;;
20043         esac
20044 fi
20045 : locate the preferred pager for this system
20046 fn=f/
20047 case "$pager" in
20048 '')
20049         dflt=''
20050         case "$pg" in
20051         /*) dflt=$pg;;
20052         [a-zA-Z]:/*) dflt=$pg;;
20053         esac
20054         case "$more" in
20055         /*) dflt=$more;;
20056         [a-zA-Z]:/*) dflt=$more;;
20057         esac
20058         case "$less" in
20059         /*) dflt=$less;;
20060         [a-zA-Z]:/*) dflt=$less;;
20061         esac
20062         case "$dflt" in
20063         '') dflt=/usr/ucb/more;;
20064         esac
20065         ;;
20066 *)      dflt="$pager"
20067         fn="f/($pager)"
20068         ;;
20069 esac
20070 echo " "
20071 rp='What pager is used on your system?'
20072 . ./getfile
20073 pager="$ans"
20074
20075 : see what type pids are declared as in the kernel
20076 rp="What is the type of process ids on this system?"
20077 set pid_t pidtype int stdio.h sys/types.h
20078 eval $typedef_ask
20079
20080 : see if ar generates random libraries by itself
20081 echo " "
20082 echo "Checking how to generate random libraries on your machine..." >&4
20083 echo 'int bar1() { return bar2(); }' > bar1.c
20084 echo 'int bar2() { return 2; }' > bar2.c
20085 $cat > foo.c <<EOP
20086 #$i_stdlib I_STDLIB
20087 #ifdef I_STDLIB
20088 #include <stdlib.h>
20089 #endif
20090 int main() { printf("%d\n", bar1()); exit(0); }
20091 EOP
20092 $cc $ccflags -c bar1.c >/dev/null 2>&1
20093 $cc $ccflags -c bar2.c >/dev/null 2>&1
20094 $cc $ccflags -c foo.c >/dev/null 2>&1
20095 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20096 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20097         $run ./foobar >/dev/null 2>&1; then
20098         echo "$ar appears to generate random libraries itself."
20099         orderlib=false
20100         if [ "X$ranlib" = "X" ]; then
20101             ranlib=":"
20102         fi
20103 elif $ar s bar$_a >/dev/null 2>&1 &&
20104         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20105         $run ./foobar >/dev/null 2>&1; then
20106                 echo "a table of contents needs to be added with '$ar s'."
20107                 orderlib=false
20108                 ranlib="$ar s"
20109 elif $ar ts bar$_a >/dev/null 2>&1 &&
20110         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20111         $run ./foobar >/dev/null 2>&1; then
20112                 echo "a table of contents needs to be added with '$ar ts'."
20113                 orderlib=false
20114                 ranlib="$ar ts"
20115 else
20116         case "$ranlib" in
20117         :) ranlib='';;
20118         '')
20119                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20120                 $test -f $ranlib || ranlib=''
20121                 ;;
20122         esac
20123         if $test -n "$ranlib"; then
20124                 echo "your system has '$ranlib'; we'll use that."
20125                 orderlib=false
20126         else
20127                 echo "your system doesn't seem to support random libraries"
20128                 echo "so we'll use lorder and tsort to order the libraries."
20129                 orderlib=true
20130                 ranlib=":"
20131         fi
20132 fi
20133 $rm -f foo* bar*
20134
20135 : see if this is a values.h system
20136 set values.h i_values
20137 eval $inhdr
20138
20139 : Check the max offset that gmtime and localtime accept
20140 echo "Checking max offsets that gmtime () accepts"
20141
20142 case $i_values in
20143     define) yyy="#include <values.h>" ;;
20144     *)      yyy="" ;;
20145     esac
20146
20147 case "$sGMTIME_min/$sGMTIME_max" in
20148     0/0|/)
20149         $cat >try.c <<EOCP
20150 #include <sys/types.h>
20151 #include <stdio.h>
20152 #include <time.h>
20153 $yyy
20154
20155 int i;
20156 struct tm *tmp;
20157 time_t pt;
20158
20159 void gm_check (time_t t, int min_year, int max_year)
20160 {
20161     tmp = gmtime (&t);
20162     if ( tmp == NULL ||
20163         /* Check tm_year overflow */
20164          tmp->tm_year < min_year || tmp->tm_year > max_year)
20165         tmp = NULL;
20166     else
20167         pt = t;
20168     } /* gm_check */
20169
20170 int check_max ()
20171 {
20172     tmp = NULL;
20173     pt  = 0;
20174 #ifdef MAXLONG
20175     gm_check (MAXLONG, 69, 0x7fffffff);
20176 #endif
20177     if (tmp == NULL || tmp->tm_year < 0) {
20178         for (i = 63; i >= 0; i--) {
20179             time_t x = pt | ((time_t)1 << i);
20180             if (x < 0 || x < pt) continue;
20181             gm_check (x, 69, 0x7fffffff);
20182             }
20183         }
20184     printf ("sGMTIME_max=%ld\n", pt);
20185     return (0);
20186     } /* check_max */
20187
20188 int check_min ()
20189 {
20190     tmp = NULL;
20191     pt  = 0;
20192 #ifdef MINLONG
20193     gm_check (MINLONG, -1900, 70);
20194 #endif
20195     if (tmp == NULL) {
20196         for (i = 36; i >= 0; i--) {
20197             time_t x = pt - ((time_t)1 << i);
20198             if (x > 0) continue;
20199             gm_check (x, -1900, 70);
20200             }
20201         }
20202     printf ("sGMTIME_min=%ld\n", pt);
20203     return (0);
20204     } /* check_min */
20205
20206 int main (int argc, char *argv[])
20207 {
20208     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20209     check_max ();
20210     check_min ();
20211     return (0);
20212     } /* main */
20213 EOCP
20214         set try
20215         if eval $compile; then
20216             eval `$run ./try`
20217         else
20218             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20219             fi
20220         $rm_try
20221         ;;
20222     esac
20223
20224 echo "Checking max offsets that localtime () accepts"
20225
20226 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20227     0/0|/)
20228         $cat >try.c <<EOCP
20229 #include <sys/types.h>
20230 #include <stdio.h>
20231 #include <time.h>
20232 $yyy
20233
20234 int i;
20235 struct tm *tmp;
20236 time_t pt;
20237
20238 void local_check (time_t t, int min_year, int max_year)
20239 {
20240     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20241         tmp = NULL;
20242     else
20243         tmp = localtime (&t);
20244     if ( tmp == NULL ||
20245         /* Check tm_year overflow */
20246          tmp->tm_year < min_year || tmp->tm_year > max_year)
20247         tmp = NULL;
20248     else
20249         pt = t;
20250     } /* local_check */
20251
20252 int check_max ()
20253 {
20254     tmp = NULL;
20255     pt  = 0;
20256 #ifdef MAXLONG
20257     local_check (MAXLONG, 69, 0x7fffffff);
20258 #endif
20259     if (tmp == NULL || tmp->tm_year < 0) {
20260         for (i = 63; i >= 0; i--) {
20261             time_t x = pt | ((time_t)1 << i);
20262             if (x < 0 || x < pt) continue;
20263             local_check (x, 69, 0x7fffffff);
20264             }
20265         }
20266     printf ("sLOCALTIME_max=%ld\n", pt);
20267     return (0);
20268    } /* check_max */
20269
20270 int check_min ()
20271 {
20272     tmp = NULL;
20273     pt  = 0;
20274 #ifdef MINLONG
20275     local_check (MINLONG, -1900, 70);
20276 #endif
20277     if (tmp == NULL) {
20278         for (i = 36; i >= 0; i--) {
20279             time_t x = pt - ((time_t)1 << i);
20280             if (x > 0) continue;
20281             local_check (x, -1900, 70);
20282             }
20283         }
20284     printf ("sLOCALTIME_min=%ld\n", pt);
20285     return (0);
20286     } /* check_min */
20287
20288 int main (int argc, char *argv[])
20289 {
20290     check_max ();
20291     check_min ();
20292     return (0);
20293     } /* main */
20294 EOCP
20295         set try
20296         if eval $compile; then
20297             eval `$run ./try`
20298         else
20299             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20300             fi
20301         $rm_try
20302         ;;
20303     esac
20304
20305 : check for type of arguments to select.
20306 case "$selecttype" in
20307 '') case "$d_select" in
20308         $define)
20309                 echo " "
20310                 $cat <<EOM
20311 Checking to see what type of arguments are accepted by select().
20312 EOM
20313                 hdrs="$define sys/types.h
20314                         $i_systime sys/time.h
20315                         $i_sysselct sys/select.h
20316                         $d_socket sys/socket.h"
20317                 : The first arg can be int, unsigned, or size_t
20318                 : The last arg may or may not be 'const'
20319                 val=''
20320                 : void pointer has been seen but using that
20321                 : breaks the selectminbits test
20322                 for xxx in 'fd_set *' 'int *'; do
20323                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20324                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20325                                         case "$val" in
20326                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20327                                                 if ./protochk "$try" $hdrs; then
20328                                                         echo "Your system accepts $xxx."
20329                                                         val="$xxx"
20330                                                 fi
20331                                                 ;;
20332                                         esac
20333                                 done
20334                         done
20335                 done
20336                 case "$val" in
20337                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20338                         case "$d_fd_set" in
20339                                 $define) dflt="fd_set *" ;;
20340                                 *)              dflt="int *" ;;
20341                         esac
20342                         . ./myread
20343                         val=$ans
20344                         ;;
20345                 esac
20346                 selecttype="$val"
20347                 ;;
20348         *)      : no select, so pick a harmless default
20349                 selecttype='int *'
20350                 ;;
20351         esac
20352         ;;
20353 esac
20354
20355 : check for the select 'width'
20356 case "$selectminbits" in
20357 '') safebits=`expr $ptrsize \* 8`
20358     case "$d_select" in
20359         $define)
20360                 $cat <<EOM
20361
20362 Checking to see on how many bits at a time your select() operates...
20363 EOM
20364                 $cat >try.c <<EOCP
20365 #include <sys/types.h>
20366 #$i_time I_TIME
20367 #$i_systime I_SYS_TIME
20368 #$i_systimek I_SYS_TIME_KERNEL
20369 #ifdef I_TIME
20370 #   include <time.h>
20371 #endif
20372 #ifdef I_SYS_TIME
20373 #   ifdef I_SYS_TIME_KERNEL
20374 #       define KERNEL
20375 #   endif
20376 #   include <sys/time.h>
20377 #   ifdef I_SYS_TIME_KERNEL
20378 #       undef KERNEL
20379 #   endif
20380 #endif
20381 #$i_sysselct I_SYS_SELECT
20382 #ifdef I_SYS_SELECT
20383 #include <sys/select.h>
20384 #endif
20385 #$d_socket HAS_SOCKET
20386 #ifdef HAS_SOCKET
20387 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20388 #endif
20389 #include <stdio.h>
20390 #$i_stdlib I_STDLIB
20391 #ifdef I_STDLIB
20392 #include <stdlib.h>
20393 #endif
20394 $selecttype b;
20395 #define S sizeof(*(b))
20396 #define MINBITS 64
20397 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20398 #define NBITS  (NBYTES * 8)
20399 int main() {
20400     char *s = (char *)malloc(NBYTES);
20401     struct timeval t;
20402     int i;
20403     FILE* fp;
20404     int fd;
20405
20406     if (!s)
20407         exit(1);
20408     fclose(stdin);
20409     fp = fopen("try.c", "r");
20410     if (fp == 0)
20411       exit(2);
20412     fd = fileno(fp);
20413     if (fd < 0)
20414       exit(3);
20415     b = ($selecttype)s;
20416     for (i = 0; i < NBITS; i++)
20417         FD_SET(i, b);
20418     t.tv_sec  = 0;
20419     t.tv_usec = 0;
20420     select(fd + 1, b, 0, 0, &t);
20421     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20422     free(s);
20423     printf("%d\n", i + 1);
20424     return 0;
20425 }
20426 EOCP
20427                 set try
20428                 if eval $compile_ok; then
20429                         selectminbits=`$run ./try`
20430                         case "$selectminbits" in
20431                         '')     cat >&4 <<EOM
20432 Cannot figure out on how many bits at a time your select() operates.
20433 I'll play safe and guess it is $safebits bits.
20434 EOM
20435                                 selectminbits=$safebits
20436                                 bits="$safebits bits"
20437                                 ;;
20438                         1)      bits="1 bit" ;;
20439                         *)      bits="$selectminbits bits" ;;
20440                         esac
20441                         echo "Your select() operates on $bits at a time." >&4
20442                 else
20443                         rp='What is the minimum number of bits your select() operates on?'
20444                         case "$byteorder" in
20445                         12345678)       dflt=64 ;;
20446                         1234)           dflt=32 ;;
20447                         *)              dflt=1  ;;
20448                         esac
20449                         . ./myread
20450                         val=$ans
20451                         selectminbits="$val"
20452                 fi
20453                 $rm_try
20454                 ;;
20455         *)      : no select, so pick a harmless default
20456                 selectminbits=$safebits
20457                 ;;
20458         esac
20459         ;;
20460 esac
20461
20462 : Trace out the files included by signal.h, then look for SIGxxx names.
20463 if [ "X$fieldn" = X ]; then
20464         : Just make some guesses.  We check them later.
20465         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20466 else
20467         xxx=`echo '#include <signal.h>' |
20468         $cppstdin $cppminus $cppflags 2>/dev/null |
20469         $grep '^[       ]*#.*include' |
20470         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20471                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20472 fi
20473 xxxfiles=''
20474 for xx in $xxx /dev/null ; do
20475         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20476 done
20477 case "$xxxfiles" in
20478 '')     xxxfiles=`./findhdr signal.h` ;;
20479 esac
20480 xxx=`awk '
20481 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20482         print substr($2, 4, 20)
20483 }
20484 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20485         print substr($3, 4, 20)
20486 }' $xxxfiles`
20487 : Append some common names just in case the awk scan failed.
20488 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20489 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20490 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20491 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20492 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20493
20494 : generate a few handy files for later
20495 $cat > signal.c <<EOCP
20496 #include <sys/types.h>
20497 #include <signal.h>
20498 #$i_stdlib I_STDLIB
20499 #ifdef I_STDLIB
20500 #include <stdlib.h>
20501 #endif
20502 #include <stdio.h>
20503 int main() {
20504
20505 /* Strange style to avoid deeply-nested #if/#else/#endif */
20506 #ifndef NSIG
20507 #  ifdef _NSIG
20508 #    define NSIG (_NSIG)
20509 #  endif
20510 #endif
20511
20512 #ifndef NSIG
20513 #  ifdef SIGMAX
20514 #    define NSIG (SIGMAX+1)
20515 #  endif
20516 #endif
20517
20518 #ifndef NSIG
20519 #  ifdef SIG_MAX
20520 #    define NSIG (SIG_MAX+1)
20521 #  endif
20522 #endif
20523
20524 #ifndef NSIG
20525 #  ifdef _SIG_MAX
20526 #    define NSIG (_SIG_MAX+1)
20527 #  endif
20528 #endif
20529
20530 #ifndef NSIG
20531 #  ifdef MAXSIG
20532 #    define NSIG (MAXSIG+1)
20533 #  endif
20534 #endif
20535
20536 #ifndef NSIG
20537 #  ifdef MAX_SIG
20538 #    define NSIG (MAX_SIG+1)
20539 #  endif
20540 #endif
20541
20542 #ifndef NSIG
20543 #  ifdef SIGARRAYSIZE
20544 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20545 #  endif
20546 #endif
20547
20548 #ifndef NSIG
20549 #  ifdef _sys_nsig
20550 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20551 #  endif
20552 #endif
20553
20554 /* Default to some arbitrary number that's big enough to get most
20555    of the common signals.
20556 */
20557 #ifndef NSIG
20558 #    define NSIG 50
20559 #endif
20560
20561 printf("NSIG %d\n", NSIG);
20562
20563 #ifndef JUST_NSIG
20564
20565 EOCP
20566
20567 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20568 {
20569         printf "#ifdef SIG"; printf $1; printf "\n"
20570         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20571         printf $1; printf ");\n"
20572         printf "#endif\n"
20573 }
20574 END {
20575         printf "#endif /* JUST_NSIG */\n";
20576         printf "exit(0);\n}\n";
20577 }
20578 ' >>signal.c
20579 $cat >signal.awk <<'EOP'
20580 BEGIN { ndups = 0 }
20581 $1 ~ /^NSIG$/ { nsig = $2 }
20582 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20583     if ($2 > maxsig) { maxsig = $2 }
20584     if (sig_name[$2]) {
20585         dup_name[ndups] = $1
20586         dup_num[ndups] = $2
20587         ndups++
20588     }
20589     else {
20590         sig_name[$2] = $1
20591         sig_num[$2] = $2
20592     }
20593 }
20594 END {
20595     if (nsig == 0) {
20596         nsig = maxsig + 1
20597     }
20598     printf("NSIG %d\n", nsig);
20599     for (n = 1; n < nsig; n++) {
20600         if (sig_name[n]) {
20601             printf("%s %d\n", sig_name[n], sig_num[n])
20602         }
20603         else {
20604             printf("NUM%d %d\n", n, n)
20605         }
20606     }
20607     for (n = 0; n < ndups; n++) {
20608         printf("%s %d\n", dup_name[n], dup_num[n])
20609     }
20610 }
20611 EOP
20612 $cat >signal_cmd <<EOS
20613 $startsh
20614 if $test -s signal.lst; then
20615     echo "Using your existing signal.lst file"
20616         exit 0
20617 fi
20618 xxx="$xxx"
20619 EOS
20620 $cat >>signal_cmd <<'EOS'
20621
20622 set signal
20623 if eval $compile_ok; then
20624         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20625                 $uniq | $awk -f signal.awk >signal.lst
20626 else
20627         echo "(I can't seem be able to compile the whole test program)" >&4
20628         echo "(I'll try it in little pieces.)" >&4
20629         set signal -DJUST_NSIG
20630         if eval $compile_ok; then
20631                 $run ./signal$_exe > signal.nsg
20632                 $cat signal.nsg
20633         else
20634                 echo "I can't seem to figure out how many signals you have." >&4
20635                 echo "Guessing 50." >&4
20636                 echo 'NSIG 50' > signal.nsg
20637         fi
20638         : Now look at all the signal names, one at a time.
20639         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20640                 $cat > signal.c <<EOCP
20641 #include <sys/types.h>
20642 #include <signal.h>
20643 #include <stdio.h>
20644 int main() {
20645 printf("$xx %d\n", SIG${xx});
20646 return 0;
20647 }
20648 EOCP
20649                 set signal
20650                 if eval $compile; then
20651                         echo "SIG${xx} found."
20652                         $run ./signal$_exe  >> signal.ls1
20653                 else
20654                         echo "SIG${xx} NOT found."
20655                 fi
20656         done
20657         if $test -s signal.ls1; then
20658                 $cat signal.nsg signal.ls1 |
20659                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20660         fi
20661
20662 fi
20663 if $test -s signal.lst; then
20664         :
20665 else
20666         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20667         echo 'kill -l' >signal
20668         set X `csh -f <signal`
20669         $rm -f signal
20670         shift
20671         case $# in
20672         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20673         esac
20674         echo $@ | $tr ' ' $trnl | \
20675             $awk '{ printf "%s %d\n", $1, ++s; }
20676                   END { printf "NSIG %d\n", ++s }' >signal.lst
20677 fi
20678 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20679 EOS
20680 chmod a+x signal_cmd
20681 $eunicefix signal_cmd
20682
20683 : generate list of signal names
20684 echo " "
20685 case "$sig_name_init" in
20686 '') doinit=yes ;;
20687 *)  case "$sig_num_init" in
20688     ''|*,*) doinit=yes ;;
20689     esac ;;
20690 esac
20691 case "$doinit" in
20692 yes)
20693         echo "Generating a list of signal names and numbers..." >&4
20694         . ./signal_cmd
20695         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20696         sig_name=`$awk 'BEGIN { printf "ZERO " }
20697                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20698         sig_num=`$awk  'BEGIN { printf "0 " }
20699                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20700         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20701                              !/^NSIG/   { printf "\"%s\", ", $1 }
20702                              END        { printf "0\n" }' signal.lst`
20703         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20704                              !/^NSIG/   { printf "%d, ", $2}
20705                              END        { printf "0\n"}' signal.lst`
20706         ;;
20707 esac
20708 echo "The following $sig_count signals are available:"
20709 echo " "
20710 echo $sig_name | $awk \
20711 'BEGIN { linelen = 0 }
20712 {
20713         for (i = 1; i <= NF; i++) {
20714                 name = "SIG" $i " "
20715                 linelen = linelen + length(name)
20716                 if (linelen > 70) {
20717                         printf "\n"
20718                         linelen = length(name)
20719                 }
20720                 printf "%s", name
20721         }
20722         printf "\n"
20723 }'
20724 sig_size=`echo $sig_name | awk '{print NF}'`
20725 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20726
20727 : Check size of size
20728 echo " "
20729 case "$sizetype" in
20730 *_t) zzz="$sizetype"    ;;
20731 *)   zzz="filesize"     ;;
20732 esac
20733 echo "Checking the size of $zzz..." >&4
20734 cat > try.c <<EOCP
20735 #include <sys/types.h>
20736 #include <stdio.h>
20737 #$i_stdlib I_STDLIB
20738 #ifdef I_STDLIB
20739 #include <stdlib.h>
20740 #endif
20741 int main() {
20742     printf("%d\n", (int)sizeof($sizetype));
20743     exit(0);
20744 }
20745 EOCP
20746 set try
20747 if eval $compile_ok; then
20748         yyy=`$run ./try`
20749         case "$yyy" in
20750         '')     sizesize=4
20751                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20752                 ;;
20753         *)      sizesize=$yyy
20754                 echo "Your $zzz size is $sizesize bytes."
20755                 ;;
20756         esac
20757 else
20758         sizesize=4
20759         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20760 fi
20761
20762
20763 : check for socklen_t
20764 echo " "
20765 echo "Checking to see if you have socklen_t..." >&4
20766 $cat >try.c <<EOCP
20767 #include <sys/types.h>
20768 #$d_socket HAS_SOCKET
20769 #ifdef HAS_SOCKET
20770 #include <sys/socket.h>
20771 #endif
20772 int main() { socklen_t x = 16; }
20773 EOCP
20774 set try
20775 if eval $compile; then
20776         val="$define"
20777         echo "You have socklen_t."
20778 else
20779         val="$undef"
20780         echo "You do not have socklen_t."
20781         case "$sizetype" in
20782         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20783         esac
20784 fi
20785 $rm_try
20786 set d_socklen_t
20787 eval $setvar
20788
20789 : see if this is a socks.h system
20790 set socks.h i_socks
20791 eval $inhdr
20792
20793 : check for type of the size argument to socket calls
20794 case "$d_socket" in
20795 "$define")
20796         $cat <<EOM
20797
20798 Checking to see what type is the last argument of accept().
20799 EOM
20800         yyy=''
20801         case "$d_socklen_t" in
20802         "$define") yyy="$yyy socklen_t"
20803         esac
20804         yyy="$yyy $sizetype int long unsigned"
20805         for xxx in $yyy; do
20806                 case "$socksizetype" in
20807                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
20808                         case "$usesocks" in
20809                         "$define")
20810                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20811                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20812                                         socksizetype="$xxx"
20813                                 fi
20814                                 ;;
20815                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20816                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20817                                         socksizetype="$xxx"
20818                                 fi
20819                                 ;;
20820                         esac
20821                         ;;
20822                 esac
20823         done
20824 : In case none of those worked, prompt the user.
20825         case "$socksizetype" in
20826         '')     rp='What is the type for socket address structure sizes?'
20827                 dflt='int'
20828                 . ./myread
20829                 socksizetype=$ans
20830                 ;;
20831         esac
20832         ;;
20833 *)      : no sockets, so pick relatively harmless default
20834         socksizetype='int'
20835         ;;
20836 esac
20837
20838 : see what type is used for signed size_t
20839 set ssize_t ssizetype int stdio.h sys/types.h
20840 eval $typedef
20841 dflt="$ssizetype"
20842 $cat > try.c <<EOM
20843 #include <stdio.h>
20844 #$i_stdlib I_STDLIB
20845 #ifdef I_STDLIB
20846 #include <stdlib.h>
20847 #endif
20848 #include <sys/types.h>
20849 #define Size_t $sizetype
20850 #define SSize_t $dflt
20851 int main()
20852 {
20853         if (sizeof(Size_t) == sizeof(SSize_t))
20854                 printf("$dflt\n");
20855         else if (sizeof(Size_t) == sizeof(int))
20856                 printf("int\n");
20857         else
20858                 printf("long\n");
20859         exit(0);
20860 }
20861 EOM
20862 echo " "
20863 set try
20864 if eval $compile_ok && $run ./try > /dev/null; then
20865         ssizetype=`$run ./try`
20866         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20867 else
20868         $cat >&4 <<EOM
20869 Help! I can't compile and run the ssize_t test program: please enlighten me!
20870 (This is probably a misconfiguration in your system or libraries, and
20871 you really ought to fix it.  Still, I'll try anyway.)
20872
20873 I need a type that is the same size as $sizetype, but is guaranteed to
20874 be signed.  Common values are ssize_t, int and long.
20875
20876 EOM
20877         rp="What signed type is the same size as $sizetype?"
20878         . ./myread
20879         ssizetype="$ans"
20880 fi
20881 $rm_try
20882
20883 : see what type of char stdio uses.
20884 echo " "
20885 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
20886 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20887         echo "Your stdio uses unsigned chars." >&4
20888         stdchar="unsigned char"
20889 else
20890         echo "Your stdio uses signed chars." >&4
20891         stdchar="char"
20892 fi
20893 $rm -f stdioh
20894
20895 : see what type uids are declared as in the kernel
20896 echo " "
20897 echo "Looking for the type for user ids returned by getuid()."
20898 set uid_t uidtype xxx stdio.h sys/types.h
20899 eval $typedef
20900 case "$uidtype" in
20901 xxx)
20902         xxx=`./findhdr sys/user.h`
20903         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20904         case $1 in
20905         unsigned) dflt="$1 $2" ;;
20906         *) dflt="$1" ;;
20907         esac
20908         ;;
20909 *) dflt="$uidtype";;
20910 esac
20911 case "$uidtype" in
20912 uid_t)  echo "uid_t found." ;;
20913 *)      rp="What is the type for user ids returned by getuid()?"
20914         . ./myread
20915         uidtype="$ans"
20916         ;;
20917 esac
20918
20919 : Check size of UID
20920 echo " "
20921 case "$uidtype" in
20922 *_t) zzz="$uidtype"     ;;
20923 *)   zzz="uid"          ;;
20924 esac
20925 echo "Checking the size of $zzz..." >&4
20926 cat > try.c <<EOCP
20927 #include <sys/types.h>
20928 #include <stdio.h>
20929 #$i_stdlib I_STDLIB
20930 #ifdef I_STDLIB
20931 #include <stdlib.h>
20932 #endif
20933 int main() {
20934     printf("%d\n", (int)sizeof($uidtype));
20935     exit(0);
20936 }
20937 EOCP
20938 set try
20939 if eval $compile_ok; then
20940         yyy=`$run ./try`
20941         case "$yyy" in
20942         '')     uidsize=4
20943                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20944                 ;;
20945         *)      uidsize=$yyy
20946                 echo "Your $zzz is $uidsize bytes long."
20947                 ;;
20948         esac
20949 else
20950         uidsize=4
20951         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20952 fi
20953
20954 : Check if UID is signed
20955 echo " "
20956 case "$uidtype" in
20957 *_t) zzz="$uidtype"     ;;
20958 *)   zzz="uid"          ;;
20959 esac
20960 echo "Checking the sign of $zzz..." >&4
20961 cat > try.c <<EOCP
20962 #include <sys/types.h>
20963 #include <stdio.h>
20964 int main() {
20965         $uidtype foo = -1;
20966         if (foo < 0)
20967                 printf("-1\n");
20968         else
20969                 printf("1\n");
20970 }
20971 EOCP
20972 set try
20973 if eval $compile; then
20974         yyy=`$run ./try`
20975         case "$yyy" in
20976         '')     uidsign=1
20977                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20978                 ;;
20979         *)      uidsign=$yyy
20980                 case "$uidsign" in
20981                  1) echo "Your $zzz is unsigned." ;;
20982                 -1) echo "Your $zzz is signed."   ;;
20983                 esac
20984                 ;;
20985         esac
20986 else
20987         uidsign=1
20988         echo "(I can't compile the test program--guessing unsigned.)" >&4
20989 fi
20990
20991
20992 : Check format string for UID
20993 echo " "
20994 $echo "Checking the format string to be used for uids..." >&4
20995
20996 case "$uidsign" in
20997 -1)     if $test X"$uidsize" = X"$ivsize"; then
20998                 uidformat="$ivdformat"
20999         else
21000                 if $test X"$uidsize" = X"$longsize"; then
21001                         uidformat='"ld"'
21002                 else
21003                         if $test X"$uidsize" = X"$intsize"; then
21004                                 uidformat='"d"'
21005                         else
21006                                 if $test X"$uidsize" = X"$shortsize"; then
21007                                         uidformat='"hd"'
21008                                 fi
21009                         fi
21010                 fi
21011         fi
21012         ;;
21013 *)      if $test X"$uidsize" = X"$uvsize"; then
21014                 uidformat="$uvuformat"
21015         else
21016                 if $test X"$uidsize" = X"$longsize"; then
21017                         uidformat='"lu"'
21018                 else
21019                         if $test X"$uidsize" = X"$intsize"; then
21020                                 uidformat='"u"'
21021                         else
21022                                 if $test X"$uidsize" = X"$shortsize"; then
21023                                         uidformat='"hu"'
21024                                 fi
21025                         fi
21026                 fi
21027         fi
21028         ;;
21029 esac
21030
21031 : Check if site customization support was requested
21032 case "$usesitecustomize" in
21033     $define|true|[Yy]*)
21034         usesitecustomize="$define"
21035         ;;
21036     *)
21037         usesitecustomize="$undef"
21038         ;;
21039     esac
21040
21041 : determine compiler compiler
21042 case "$yacc" in
21043 '')
21044         dflt=yacc;;
21045 *)
21046         dflt="$yacc";;
21047 esac
21048 echo " "
21049 comp='yacc'
21050 if $test -f "$byacc$_exe"; then
21051         dflt="$byacc"
21052         comp="byacc or $comp"
21053 fi
21054 if $test -f "$bison$_exe"; then
21055         comp="$comp or bison -y"
21056 fi
21057 rp="Which compiler compiler ($comp) shall I use?"
21058 . ./myread
21059 yacc="$ans"
21060 case "$yacc" in
21061 *bis*)
21062         case "$yacc" in
21063         *-y*) ;;
21064         *)
21065                 yacc="$yacc -y"
21066                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21067                 ;;
21068         esac
21069         ;;
21070 esac
21071
21072 : see if this is a assert.h system
21073 set assert.h i_assert
21074 eval $inhdr
21075
21076 : see if this is a fp.h system
21077 set fp.h i_fp
21078 eval $inhdr
21079
21080 : see if this is a fp_class.h system
21081 set fp_class.h i_fp_class
21082 eval $inhdr
21083
21084 : see if gdbm.h is available
21085 set gdbm.h t_gdbm
21086 eval $inhdr
21087 case "$t_gdbm" in
21088 $define)
21089         : see if gdbm_open exists
21090         set gdbm_open d_gdbm_open
21091         eval $inlibc
21092         case "$d_gdbm_open" in
21093         $undef)
21094                 t_gdbm="$undef"
21095                 echo "We won't be including <gdbm.h>"
21096                 ;;
21097         esac
21098         ;;
21099 esac
21100 val="$t_gdbm"
21101 set i_gdbm
21102 eval $setvar
21103
21104 : see if this is a ieeefp.h system
21105 case "$i_ieeefp" in
21106 '' ) set ieeefp.h i_ieeefp
21107      eval $inhdr
21108      ;;
21109 esac
21110
21111 : see if this is a libutil.h system
21112 set libutil.h i_libutil
21113 eval $inhdr
21114
21115 : see if mach cthreads are available
21116 if test "X$usethreads" = "X$define"; then
21117         set mach/cthreads.h i_machcthr
21118         eval $inhdr
21119 else
21120         i_machcthr="$undef"
21121 fi
21122
21123 : see if this is a mntent.h system
21124 set mntent.h i_mntent
21125 eval $inhdr
21126
21127 : see if net/errno.h is available
21128 val=''
21129 set net/errno.h val
21130 eval $inhdr
21131
21132 : Unfortunately, it causes problems on some systems.  Arrgh.
21133 case "$val" in
21134 $define)
21135         cat > try.c <<'EOM'
21136 #include <stdio.h>
21137 #include <errno.h>
21138 #include <net/errno.h>
21139 int func()
21140 {
21141         return ENOTSOCK;
21142 }
21143 EOM
21144         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21145                 echo "We'll be including <net/errno.h>." >&4
21146         else
21147                 echo "We won't be including <net/errno.h>." >&4
21148                 val="$undef"
21149         fi
21150         $rm_try
21151         ;;
21152 esac
21153 set i_neterrno
21154 eval $setvar
21155
21156 : see if netinet/tcp.h is available
21157 set netinet/tcp.h i_netinettcp
21158 eval $inhdr
21159
21160 : see if this is a poll.h system
21161 set poll.h i_poll
21162 eval $inhdr
21163
21164 : see if this is a prot.h system
21165 set prot.h i_prot
21166 eval $inhdr
21167
21168 : Preprocessor symbols
21169 echo " "
21170 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21171 $cat <<'EOSH' > Cppsym.know
21172 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21173 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21174 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21175 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21176 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21177 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21178 bull c cadmus clipper CMU COFF COMPILER_VERSION
21179 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21180 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21181 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21182 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21183 GLIBC GLIBC_MINOR
21184 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21185 H3050R H3050RX hbullx20 hcx host_mips
21186 hp200 hp300 hp700 HP700 hp800 hp9000
21187 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21188 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21189 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21190 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21191 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21192 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21193 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21194 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21195 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21196 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21197 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21198 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21199 MATH_HAS_NO_SIDE_EFFECTS
21200 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21201 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21202 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21203 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21204 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21205 NetBSD news1500 news1700 news1800 news1900 news3700
21206 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21207 ns32016 ns32332 ns32k nsc32000
21208 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21209 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21210 pc532 pdp11 PGC PIC plexus PORTAR posix
21211 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21212 POSIX_C_SOURCE POSIX_SOURCE POWER
21213 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21214 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21215 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21216 sony sony_news sonyrisc sparc sparclite spectrum
21217 stardent stdc STDC_EXT stratos sun sun3 sun386
21218 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21219 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21220 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21221 sysV68 sysV88 Tek4132 Tek4300 titan
21222 TM3200 TM5400 TM5600
21223 tower tower32 tower32_200 tower32_600 tower32_700
21224 tower32_800 tower32_850 tss
21225 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21226 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21227 unix UNIX95 UNIX99 unixpc unos
21228 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21229 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21230 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21231 USGr4 USGr4_2
21232 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21233 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21234 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21235 z8000
21236 EOSH
21237 # Maybe put other stuff here too.
21238 cat <<EOSH >>Cppsym.know
21239 $osname
21240 EOSH
21241 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21242 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21243 $cat Cppsym.know > Cppsym.c
21244 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21245 $rm -f Cppsym.a Cppsym.b Cppsym.c
21246 cat <<EOSH > Cppsym
21247 $startsh
21248 if $test \$# -gt 0; then
21249     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21250     if $test -s Cppsym.got; then
21251         $rm -f Cppsym.got
21252         exit 0
21253     fi
21254     $rm -f Cppsym.got
21255     exit 1
21256 else
21257     $tr " " "$trnl" | ./Cppsym.try
21258     exit 0
21259 fi
21260 EOSH
21261 chmod +x Cppsym
21262 $eunicefix Cppsym
21263 cat <<EOSH > Cppsym.try
21264 $startsh
21265 cat <<'EOCP' > try.c
21266 #include <stdio.h>
21267 #if cpp_stuff == 1
21268 #define STRINGIFY(a)    "a"
21269 #endif
21270 #if cpp_stuff == 42
21271 #define StGiFy(a)  #a
21272 #define STRINGIFY(a)    StGiFy(a)
21273 #endif
21274 #if $cpp_stuff != 1 && $cpp_stuff != 42
21275 #   include "Bletch: How does this C preprocessor stringify macros?"
21276 #endif
21277 int main() {
21278 EOCP
21279 $awk \\
21280 EOSH
21281 cat <<'EOSH' >> Cppsym.try
21282 'length($1) > 0 {
21283     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21284     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21285     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21286     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21287 }'       >> try.c
21288 echo 'return 0;}' >> try.c
21289 EOSH
21290 cat <<EOSH >> Cppsym.try
21291 ccflags="$ccflags"
21292 case "$osname-$gccversion" in
21293 irix-) ccflags="\$ccflags -woff 1178" ;;
21294 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21295 esac
21296 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21297 EOSH
21298 chmod +x Cppsym.try
21299 $eunicefix Cppsym.try
21300 ./Cppsym < Cppsym.know > Cppsym.true
21301 : Add in any linux cpp "predefined macros":
21302 case "$osname::$gccversion" in
21303   *linux*::*.*)
21304     tHdrH=_tmpHdr
21305     rm -f $tHdrH'.h' $tHdrH
21306     touch $tHdrH'.h'
21307     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21308        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21309        if [ -s $tHdrH'_cppsym.real' ]; then
21310           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21311        fi
21312     fi
21313     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21314   ;;
21315 esac
21316 : now check the C compiler for additional symbols
21317 postprocess_cc_v=''
21318 case "$osname" in
21319 aix) postprocess_cc_v="|$tr , ' '" ;;
21320 esac
21321 $cat >ccsym <<EOS
21322 $startsh
21323 $cat >tmp.c <<EOF
21324 extern int foo;
21325 EOF
21326 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21327 do
21328         case "\$i" in
21329         -D*) echo "\$i" | $sed 's/^-D//';;
21330         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21331         esac
21332 done
21333 $rm_try
21334 EOS
21335 postprocess_cc_v=''
21336 chmod +x ccsym
21337 $eunicefix ccsym
21338 ./ccsym > ccsym1.raw
21339 if $test -s ccsym1.raw; then
21340        $sort ccsym1.raw | $uniq >ccsym.raw
21341 else
21342        mv ccsym1.raw ccsym.raw
21343 fi
21344
21345 $awk '/\=/ { print $0; next }
21346         { print $0"=1" }' ccsym.raw >ccsym.list
21347 $comm -13 Cppsym.true ccsym.list >ccsym.own
21348 $comm -12 Cppsym.true ccsym.list >ccsym.com
21349 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21350 also=''
21351 if $test -z ccsym.raw; then
21352         echo "Your C compiler doesn't seem to define any symbols!" >&4
21353         echo " "
21354         echo "However, your C preprocessor defines the following symbols:"
21355         $cat Cppsym.true
21356         ccsymbols=''
21357         cppsymbols=`$cat Cppsym.true`
21358         cppsymbols=`echo $cppsymbols`
21359         cppccsymbols="$cppsymbols"
21360 else
21361         if $test -s ccsym.com; then
21362                 echo "Your C compiler and pre-processor define these symbols:"
21363                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21364                 also='also '
21365                 symbols='ones'
21366                 cppccsymbols=`$cat ccsym.com`
21367                 cppccsymbols=`echo $cppccsymbols`
21368                 $test "$silent" || sleep 1
21369         fi
21370         if $test -s ccsym.cpp; then
21371                 $test "$also" && echo " "
21372                 echo "Your C pre-processor ${also}defines the following symbols:"
21373                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21374                 also='further '
21375                 cppsymbols=`$cat ccsym.cpp`
21376                 cppsymbols=`echo $cppsymbols`
21377                 $test "$silent" || sleep 1
21378         fi
21379         if $test -s ccsym.own; then
21380                 $test "$also" && echo " "
21381                 echo "Your C compiler ${also}defines the following cpp symbols:"
21382                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21383                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21384                 ccsymbols=`$cat ccsym.own`
21385                 ccsymbols=`echo $ccsymbols`
21386                 $test "$silent" || sleep 1
21387         fi
21388 fi
21389
21390 : see if this is a termio system
21391 val="$undef"
21392 val2="$undef"
21393 val3="$undef"
21394 if $test `./findhdr termios.h`; then
21395         set tcsetattr i_termios
21396         eval $inlibc
21397         val3="$i_termios"
21398 fi
21399 echo " "
21400 case "$val3" in
21401 "$define") echo "You have POSIX termios.h... good!" >&4;;
21402 *) if ./Cppsym pyr; then
21403                 case "`/bin/universe`" in
21404                 ucb) if $test `./findhdr sgtty.h`; then
21405                                 val2="$define"
21406                                 echo "<sgtty.h> found." >&4
21407                         else
21408                                 echo "System is pyramid with BSD universe."
21409                                 ./warn "<sgtty.h> not found--you could have problems."
21410                         fi;;
21411                 *) if $test `./findhdr termio.h`; then
21412                                 val="$define"
21413                                 echo "<termio.h> found." >&4
21414                         else
21415                                 echo "System is pyramid with USG universe."
21416                                 ./warn "<termio.h> not found--you could have problems."
21417                         fi;;
21418                 esac
21419         elif ./usg; then
21420                 if $test `./findhdr termio.h`; then
21421                         echo "<termio.h> found." >&4
21422                         val="$define"
21423                 elif $test `./findhdr sgtty.h`; then
21424                         echo "<sgtty.h> found." >&4
21425                         val2="$define"
21426                 else
21427                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21428                 fi
21429         else
21430                 if $test `./findhdr sgtty.h`; then
21431                         echo "<sgtty.h> found." >&4
21432                         val2="$define"
21433                 elif $test `./findhdr termio.h`; then
21434                         echo "<termio.h> found." >&4
21435                         val="$define"
21436                 else
21437                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21438                 fi
21439         fi;;
21440 esac
21441 set i_termio; eval $setvar
21442 val=$val2; set i_sgtty; eval $setvar
21443 val=$val3; set i_termios; eval $setvar
21444
21445 : see if stddef is available
21446 set stddef.h i_stddef
21447 eval $inhdr
21448
21449 : see if sys/access.h is available
21450 set sys/access.h i_sysaccess
21451 eval $inhdr
21452
21453 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21454 set sys/filio.h i_sysfilio
21455 eval $inhdr
21456 echo " "
21457 if $test `./findhdr sys/ioctl.h`; then
21458         val="$define"
21459         echo '<sys/ioctl.h> found.' >&4
21460 else
21461         val="$undef"
21462         if $test $i_sysfilio = "$define"; then
21463             echo '<sys/ioctl.h> NOT found.' >&4
21464         else
21465                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21466                 $test $i_termio = "$define" && xxx="termio.h"
21467                 $test $i_termios = "$define" && xxx="termios.h"
21468 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21469         fi
21470 fi
21471 set i_sysioctl
21472 eval $setvar
21473
21474 : see if socket ioctl defs are in sys/sockio.h
21475 echo " "
21476 xxx=`./findhdr sys/sockio.h`
21477 if $test "$xxx"; then
21478         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21479                 val="$define"
21480                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21481         else
21482                 val="$undef"
21483                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21484         fi
21485 else
21486         val="$undef"
21487         $cat <<EOM
21488 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21489 EOM
21490 fi
21491 set i_syssockio
21492 eval $setvar
21493
21494 : see if this is a syslog.h system
21495 set syslog.h i_syslog
21496 eval $inhdr
21497
21498 : see if this is a sys/mode.h system
21499 set sys/mode.h i_sysmode
21500 eval $inhdr
21501
21502 : see if there is a sys/poll.h file
21503 set sys/poll.h i_syspoll
21504 eval $inhdr
21505
21506 : see if sys/resource.h has to be included
21507 set sys/resource.h i_sysresrc
21508 eval $inhdr
21509
21510 : see if sys/security.h is available
21511 set sys/security.h i_syssecrt
21512 eval $inhdr
21513
21514 : see if this is a sys/statvfs.h system
21515 set sys/statvfs.h i_sysstatvfs
21516 eval $inhdr
21517
21518 : see if this is a sys/un.h system
21519 set sys/un.h i_sysun
21520 eval $inhdr
21521
21522 : see if this is a sys/utsname.h system
21523 set sys/utsname.h i_sysutsname
21524 eval $inhdr
21525
21526 : see if this is a syswait system
21527 set sys/wait.h i_syswait
21528 eval $inhdr
21529
21530 : see if this is a ustat.h system
21531 set ustat.h i_ustat
21532 eval $inhdr
21533
21534 : see if this is an utime system
21535 set utime.h i_utime
21536 eval $inhdr
21537
21538 : see if this is a vfork system
21539 case "$d_vfork" in
21540 "$define")
21541         set vfork.h i_vfork
21542         eval $inhdr
21543         ;;
21544 *)
21545         i_vfork="$undef"
21546         ;;
21547 esac
21548
21549 : Check extensions
21550 echo " "
21551 echo "Looking for extensions..." >&4
21552 : If we are using the old config.sh, known_extensions may contain
21553 : old or inaccurate or duplicate values.
21554 known_extensions=''
21555 nonxs_extensions=''
21556 : We do not use find because it might not be available.
21557 : We do not just use MANIFEST because the user may have dropped
21558 : some additional extensions into the source tree and expect them
21559 : to be built.
21560
21561 : Function to recursively find available extensions, ignoring DynaLoader
21562 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21563 find_extensions='
21564     for xxx in *; do
21565         case "$xxx" in
21566             DynaLoader|dynaload) ;;
21567             *)
21568             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21569                 known_extensions="$known_extensions $1$xxx";
21570             elif $test -f $xxx/Makefile.PL; then
21571                 nonxs_extensions="$nonxs_extensions $1$xxx";
21572             else
21573                 if $test -d $xxx -a $# -lt 10; then
21574                     set $1$xxx/ $*;
21575                     cd "$xxx";
21576                     eval $find_extensions;
21577                     cd ..;
21578                     shift;
21579                 fi;
21580             fi
21581             ;;
21582         esac;
21583     done'
21584 tdir=`pwd`
21585 cd "$rsrc/ext"
21586 set X
21587 shift
21588 eval $find_extensions
21589 # Special case:  Add in modules that nest beyond the first level.
21590 # Currently threads/shared and Hash/Util/FieldHash, since they are
21591 # not picked up by the recursive find above (and adding in general
21592 # recursive finding breaks SDBM_File/sdbm).
21593 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21594 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21595 set X $known_extensions
21596 shift
21597 known_extensions="$*"
21598 set X $nonxs_extensions
21599 shift
21600 nonxs_extensions="$*"
21601 cd "$tdir"
21602
21603 : Now see which are supported on this system.
21604 avail_ext=''
21605 for xxx in $known_extensions ; do
21606         case "$xxx" in
21607         DB_File|db_file)
21608                 case "$i_db" in
21609                 $define) avail_ext="$avail_ext $xxx" ;;
21610                 esac
21611                 ;;
21612         GDBM_File|gdbm_fil)
21613                 case "$i_gdbm" in
21614                 $define) avail_ext="$avail_ext $xxx" ;;
21615                 esac
21616                 ;;
21617         I18N/Langinfo|i18n_lan)
21618                 case "$i_langinfo$d_nl_langinfo" in
21619                 $define$define) avail_ext="$avail_ext $xxx" ;;
21620                 esac
21621                 ;;
21622         IPC/SysV|ipc/sysv)
21623                 : XXX Do we need a useipcsysv variable here
21624                 case "${d_msg}${d_sem}${d_shm}" in
21625                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21626                 esac
21627                 ;;
21628         NDBM_File|ndbm_fil)
21629                 case "$i_ndbm" in
21630                 $define)
21631                     case "$osname-$use64bitint" in
21632                     hpux-define)
21633                         case "$libs" in
21634                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21635                         esac
21636                         ;;
21637                     *) avail_ext="$avail_ext $xxx" ;;
21638                     esac
21639                     ;;
21640                 esac
21641                 ;;
21642         ODBM_File|odbm_fil)
21643                 case "${i_dbm}${i_rpcsvcdbm}" in
21644                 *"${define}"*)
21645                     case "$d_cplusplus" in
21646                     define) ;; # delete as a function name will not work
21647                     *)  case "$osname-$use64bitint" in
21648                         hpux-define)
21649                             case "$libs" in
21650                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21651                             esac
21652                             ;;
21653                         *) avail_ext="$avail_ext $xxx" ;;
21654                         esac
21655                         ;;
21656                     esac
21657                     ;;
21658                 esac
21659                 ;;
21660         Opcode|opcode)
21661                 case "$useopcode" in
21662                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21663                 esac
21664                 ;;
21665         POSIX|posix)
21666                 case "$useposix" in
21667                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21668                 esac
21669                 ;;
21670         Socket|socket)
21671                 case "$d_socket" in
21672                 true|$define|y)
21673                     case "$osname" in
21674                     beos) ;; # not unless BONE
21675                     *) avail_ext="$avail_ext $xxx" ;;
21676                     esac
21677                     ;;
21678                 esac
21679                 ;;
21680         Sys/Syslog|sys/syslog)
21681                 : XXX syslog requires socket
21682                 case "$d_socket" in
21683                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21684                 esac
21685                 ;;
21686         Thread|thread)
21687                 case "$usethreads" in
21688                 true|$define|y)
21689                         case "$use5005threads" in
21690                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21691                         esac
21692                 esac
21693                 ;;
21694         threads|threads/shared)
21695                 # threads and threads::shared are special cases.
21696                 # To stop people from asking "Perl 5.8.0 was supposed
21697                 # to have this new fancy threads implementation but my
21698                 # perl doesn't have it" and from people trying to
21699                 # (re)install the threads module using CPAN.pm and
21700                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21701                 # the threads.pm and threads/shared.pm will always be
21702                 # there, croaking informatively ("you need to rebuild
21703                 # all of Perl with threads, sorry") when threads haven't
21704                 # been compiled in.
21705                 # --jhi
21706                 avail_ext="$avail_ext $xxx"
21707                 ;;
21708         Win32*)
21709                 case "$osname" in
21710                 cygwin) avail_ext="$avail_ext $xxx" ;;
21711                 esac
21712                 ;;
21713         XS/APItest|xs/apitest)
21714                 # This is just for testing.  Skip it unless we have dynamic loading.
21715
21716                 case "$usedl" in
21717                 $define) avail_ext="$avail_ext $xxx" ;;
21718                 esac
21719                 ;;
21720         XS/Typemap|xs/typemap)
21721                 # This is just for testing.  Skip it unless we have dynamic loading.
21722                 case "$usedl" in
21723                 $define) avail_ext="$avail_ext $xxx" ;;
21724                 esac
21725                 ;;
21726         *)      avail_ext="$avail_ext $xxx"
21727                 ;;
21728         esac
21729 done
21730
21731 set X $avail_ext
21732 shift
21733 avail_ext="$*"
21734
21735 case "$onlyextensions" in
21736 '') ;;
21737 *)  keepextensions=''
21738     echo "You have requested that only certains extensions be included..." >&4
21739     for i in $onlyextensions; do
21740         case " $avail_ext " in
21741         *" $i "*)
21742             echo "Keeping extension $i."
21743             keepextensions="$keepextensions $i"
21744             ;;
21745         *) echo "Ignoring extension $i." ;;
21746         esac
21747     done
21748     avail_ext="$keepextensions"
21749     ;;
21750 esac
21751
21752 case "$noextensions" in
21753 '') ;;
21754 *)  keepextensions=''
21755     echo "You have requested that certain extensions be ignored..." >&4
21756     for i in $avail_ext; do
21757         case " $noextensions " in
21758         *" $i "*) echo "Ignoring extension $i." ;;
21759         *) echo "Keeping extension $i.";
21760            keepextensions="$keepextensions $i"
21761            ;;
21762         esac
21763     done
21764     avail_ext="$keepextensions"
21765     ;;
21766 esac
21767
21768 : Now see which nonxs extensions are supported on this system.
21769 : For now assume all are.
21770 nonxs_ext=''
21771 for xxx in $nonxs_extensions ; do
21772         case "$xxx" in
21773         *)      nonxs_ext="$nonxs_ext $xxx"
21774                 ;;
21775         esac
21776 done
21777
21778 set X $nonxs_ext
21779 shift
21780 nonxs_ext="$*"
21781
21782 case $usedl in
21783 $define)
21784         $cat <<EOM
21785 A number of extensions are supplied with $package.  You may choose to
21786 compile these extensions for dynamic loading (the default), compile
21787 them into the $package executable (static loading), or not include
21788 them at all.  Answer "none" to include no extensions.
21789 Note that DynaLoader is always built and need not be mentioned here.
21790
21791 EOM
21792         case "$dynamic_ext" in
21793         '')
21794                 : Exclude those listed in static_ext
21795                 dflt=''
21796                 for xxx in $avail_ext; do
21797                         case " $static_ext " in
21798                         *" $xxx "*) ;;
21799                         *) dflt="$dflt $xxx" ;;
21800                         esac
21801                 done
21802                 set X $dflt
21803                 shift
21804                 dflt="$*"
21805                 ;;
21806         *)      dflt="$dynamic_ext"
21807                 # Perhaps we are reusing an old out-of-date config.sh.
21808                 case "$hint" in
21809                 previous)
21810                         if test X"$dynamic_ext" != X"$avail_ext"; then
21811                                 $cat <<EOM
21812 NOTICE:  Your previous config.sh list may be incorrect.
21813 The extensions now available to you are
21814         ${avail_ext}
21815 but the default list from your previous config.sh is
21816         ${dynamic_ext}
21817
21818 EOM
21819                         fi
21820                         ;;
21821                 esac
21822                 ;;
21823         esac
21824         case "$dflt" in
21825         '')     dflt=none;;
21826         esac
21827         rp="What extensions do you wish to load dynamically?"
21828         . ./myread
21829         case "$ans" in
21830         none) dynamic_ext=' ' ;;
21831         *) dynamic_ext="$ans" ;;
21832         esac
21833
21834         case "$static_ext" in
21835         '')
21836                 : Exclude those already listed in dynamic linking
21837                 dflt=''
21838                 for xxx in $avail_ext; do
21839                         case " $dynamic_ext " in
21840                         *" $xxx "*) ;;
21841                         *) dflt="$dflt $xxx" ;;
21842                         esac
21843                 done
21844                 set X $dflt
21845                 shift
21846                 dflt="$*"
21847                 ;;
21848         *)  dflt="$static_ext"
21849                 ;;
21850         esac
21851
21852         case "$dflt" in
21853         '')     dflt=none;;
21854         esac
21855         rp="What extensions do you wish to load statically?"
21856         . ./myread
21857         case "$ans" in
21858         none) static_ext=' ' ;;
21859         *) static_ext="$ans" ;;
21860         esac
21861         ;;
21862 *)
21863         $cat <<EOM
21864 A number of extensions are supplied with $package.  Answer "none"
21865 to include no extensions.
21866 Note that DynaLoader is always built and need not be mentioned here.
21867
21868 EOM
21869         case "$static_ext" in
21870         '') dflt="$avail_ext" ;;
21871         *)      dflt="$static_ext"
21872                 # Perhaps we are reusing an old out-of-date config.sh.
21873                 case "$hint" in
21874                 previous)
21875                         if test X"$static_ext" != X"$avail_ext"; then
21876                                 $cat <<EOM
21877 NOTICE:  Your previous config.sh list may be incorrect.
21878 The extensions now available to you are
21879         ${avail_ext}
21880 but the default list from your previous config.sh is
21881         ${static_ext}
21882
21883 EOM
21884                         fi
21885                         ;;
21886                 esac
21887                 ;;
21888         esac
21889         : Exclude those that are not xs extensions
21890         case "$dflt" in
21891         '')     dflt=none;;
21892         esac
21893         rp="What extensions do you wish to include?"
21894         . ./myread
21895         case "$ans" in
21896         none) static_ext=' ' ;;
21897         *) static_ext="$ans" ;;
21898         esac
21899         ;;
21900 esac
21901 #
21902 # Encode is a special case.  If we are building Encode as a static
21903 # extension, we need to explicitly list its subextensions as well.
21904 # For other nested extensions, this is handled automatically by
21905 # the appropriate Makefile.PL.
21906 case " $static_ext " in
21907         *" Encode "*) # Add the subextensions of Encode
21908         cd "$rsrc/ext"
21909         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21910                 static_ext="$static_ext Encode/$xxx"
21911         done
21912         cd "$tdir"
21913         ;;
21914 esac
21915
21916 set X $dynamic_ext $static_ext $nonxs_ext
21917 shift
21918 extensions="$*"
21919
21920 # Sanity check:  We require an extension suitable for use with
21921 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21922 # should show up as failures in the test suite, but it's helpful to
21923 # catch them now.) The 'extensions' list is normally sorted
21924 # alphabetically, so we need to accept either
21925 #    DB_File ... Fcntl ... IO  ....
21926 # or something like
21927 #    Fcntl ... NDBM_File ... IO  ....
21928 case " $extensions"  in
21929 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21930 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21931 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21932 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21933    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21934    ;;
21935 esac
21936
21937 : Remove libraries needed only for extensions
21938 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21939 : The exception is SunOS 4.x, which needs them.
21940 case "${osname}X${osvers}" in
21941 sunos*X4*)
21942     perllibs="$libs"
21943     ;;
21944 *) case "$usedl" in
21945     $define|true|[yY]*)
21946             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21947             shift
21948             perllibs="$*"
21949             ;;
21950     *)  perllibs="$libs"
21951             ;;
21952     esac
21953     ;;
21954 esac
21955
21956 : Remove build directory name from cppstdin so it can be used from
21957 : either the present location or the final installed location.
21958 echo " "
21959 : Get out of the UU directory to get correct path name.
21960 cd ..
21961 case "$cppstdin" in
21962 `pwd`/cppstdin)
21963         echo "Stripping down cppstdin path name"
21964         cppstdin=cppstdin
21965         ;;
21966 esac
21967 cd UU
21968
21969 : end of configuration questions
21970 echo " "
21971 echo "End of configuration questions."
21972 echo " "
21973
21974 : back to where it started
21975 if test -d ../UU; then
21976         cd ..
21977 fi
21978
21979 : configuration may be unconditionally patched via a 'config.arch' file
21980 if $test -f config.arch; then
21981         echo "I see a config.arch file, loading it." >&4
21982         . ./config.arch
21983 fi
21984
21985 : configuration may be patched via a 'config.over' file
21986 if $test -f config.over; then
21987         echo " "
21988         dflt=y
21989         rp='I see a config.over file.  Do you wish to load it?'
21990         . UU/myread
21991         case "$ans" in
21992         n*) echo "OK, I'll ignore it.";;
21993         *)      . ./config.over
21994                 echo "Configuration override changes have been loaded."
21995                 ;;
21996         esac
21997 fi
21998
21999 : in case they want portability, strip down executable paths
22000 case "$d_portable" in
22001 "$define")
22002         echo " "
22003         echo "Stripping down executable paths..." >&4
22004         for file in $loclist $trylist; do
22005                 eval temp=\$$file
22006                 eval $file=`basename $temp`
22007         done
22008         ;;
22009 esac
22010
22011 : create config.sh file
22012 echo " "
22013 echo "Creating config.sh..." >&4
22014 $spitshell <<EOT >config.sh
22015 $startsh
22016 #
22017 # This file was produced by running the Configure script. It holds all the
22018 # definitions figured out by Configure. Should you modify one of these values,
22019 # do not forget to propagate your changes by running "Configure -der". You may
22020 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22021 #
22022
22023 # Package name      : $package
22024 # Source directory  : $src
22025 # Configuration time: $cf_time
22026 # Configured by     : $cf_by
22027 # Target system     : $myuname
22028
22029 EOT
22030 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22031 $spitshell <<EOT >>config.sh
22032
22033 Author='$Author'
22034 Date='$Date'
22035 Header='$Header'
22036 Id='$Id'
22037 Locker='$Locker'
22038 Log='$Log'
22039 RCSfile='$RCSfile'
22040 Revision='$Revision'
22041 Source='$Source'
22042 State='$State'
22043 _a='$_a'
22044 _exe='$_exe'
22045 _o='$_o'
22046 afs='$afs'
22047 afsroot='$afsroot'
22048 alignbytes='$alignbytes'
22049 ansi2knr='$ansi2knr'
22050 aphostname='$aphostname'
22051 api_revision='$api_revision'
22052 api_subversion='$api_subversion'
22053 api_version='$api_version'
22054 api_versionstring='$api_versionstring'
22055 ar='$ar'
22056 archlib='$archlib'
22057 archlibexp='$archlibexp'
22058 archname64='$archname64'
22059 archname='$archname'
22060 archobjs='$archobjs'
22061 asctime_r_proto='$asctime_r_proto'
22062 awk='$awk'
22063 baserev='$baserev'
22064 bash='$bash'
22065 bin='$bin'
22066 binexp='$binexp'
22067 bison='$bison'
22068 byacc='$byacc'
22069 byteorder='$byteorder'
22070 c='$c'
22071 castflags='$castflags'
22072 cat='$cat'
22073 cc='$cc'
22074 cccdlflags='$cccdlflags'
22075 ccdlflags='$ccdlflags'
22076 ccflags='$ccflags'
22077 ccflags_uselargefiles='$ccflags_uselargefiles'
22078 ccname='$ccname'
22079 ccsymbols='$ccsymbols'
22080 ccversion='$ccversion'
22081 cf_by='$cf_by'
22082 cf_email='$cf_email'
22083 cf_time='$cf_time'
22084 chgrp='$chgrp'
22085 chmod='$chmod'
22086 chown='$chown'
22087 clocktype='$clocktype'
22088 comm='$comm'
22089 compress='$compress'
22090 contains='$contains'
22091 cp='$cp'
22092 cpio='$cpio'
22093 cpp='$cpp'
22094 cpp_stuff='$cpp_stuff'
22095 cppccsymbols='$cppccsymbols'
22096 cppflags='$cppflags'
22097 cpplast='$cpplast'
22098 cppminus='$cppminus'
22099 cpprun='$cpprun'
22100 cppstdin='$cppstdin'
22101 cppsymbols='$cppsymbols'
22102 crypt_r_proto='$crypt_r_proto'
22103 cryptlib='$cryptlib'
22104 csh='$csh'
22105 ctermid_r_proto='$ctermid_r_proto'
22106 ctime_r_proto='$ctime_r_proto'
22107 d_Gconvert='$d_Gconvert'
22108 d_PRIEUldbl='$d_PRIEUldbl'
22109 d_PRIFUldbl='$d_PRIFUldbl'
22110 d_PRIGUldbl='$d_PRIGUldbl'
22111 d_PRIXU64='$d_PRIXU64'
22112 d_PRId64='$d_PRId64'
22113 d_PRIeldbl='$d_PRIeldbl'
22114 d_PRIfldbl='$d_PRIfldbl'
22115 d_PRIgldbl='$d_PRIgldbl'
22116 d_PRIi64='$d_PRIi64'
22117 d_PRIo64='$d_PRIo64'
22118 d_PRIu64='$d_PRIu64'
22119 d_PRIx64='$d_PRIx64'
22120 d_SCNfldbl='$d_SCNfldbl'
22121 d__fwalk='$d__fwalk'
22122 d_access='$d_access'
22123 d_accessx='$d_accessx'
22124 d_aintl='$d_aintl'
22125 d_alarm='$d_alarm'
22126 d_archlib='$d_archlib'
22127 d_asctime64='$d_asctime64'
22128 d_asctime_r='$d_asctime_r'
22129 d_atolf='$d_atolf'
22130 d_atoll='$d_atoll'
22131 d_attribute_format='$d_attribute_format'
22132 d_attribute_malloc='$d_attribute_malloc'
22133 d_attribute_nonnull='$d_attribute_nonnull'
22134 d_attribute_noreturn='$d_attribute_noreturn'
22135 d_attribute_pure='$d_attribute_pure'
22136 d_attribute_unused='$d_attribute_unused'
22137 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22138 d_bcmp='$d_bcmp'
22139 d_bcopy='$d_bcopy'
22140 d_bsd='$d_bsd'
22141 d_bsdgetpgrp='$d_bsdgetpgrp'
22142 d_bsdsetpgrp='$d_bsdsetpgrp'
22143 d_builtin_choose_expr='$d_builtin_choose_expr'
22144 d_builtin_expect='$d_builtin_expect'
22145 d_bzero='$d_bzero'
22146 d_c99_variadic_macros='$d_c99_variadic_macros'
22147 d_casti32='$d_casti32'
22148 d_castneg='$d_castneg'
22149 d_charvspr='$d_charvspr'
22150 d_chown='$d_chown'
22151 d_chroot='$d_chroot'
22152 d_chsize='$d_chsize'
22153 d_class='$d_class'
22154 d_clearenv='$d_clearenv'
22155 d_closedir='$d_closedir'
22156 d_cmsghdr_s='$d_cmsghdr_s'
22157 d_const='$d_const'
22158 d_copysignl='$d_copysignl'
22159 d_cplusplus='$d_cplusplus'
22160 d_crypt='$d_crypt'
22161 d_crypt_r='$d_crypt_r'
22162 d_csh='$d_csh'
22163 d_ctermid='$d_ctermid'
22164 d_ctermid_r='$d_ctermid_r'
22165 d_ctime64='$d_ctime64'
22166 d_ctime_r='$d_ctime_r'
22167 d_cuserid='$d_cuserid'
22168 d_dbl_dig='$d_dbl_dig'
22169 d_dbminitproto='$d_dbminitproto'
22170 d_difftime64='$d_difftime64'
22171 d_difftime='$d_difftime'
22172 d_dir_dd_fd='$d_dir_dd_fd'
22173 d_dirfd='$d_dirfd'
22174 d_dirnamlen='$d_dirnamlen'
22175 d_dlerror='$d_dlerror'
22176 d_dlopen='$d_dlopen'
22177 d_dlsymun='$d_dlsymun'
22178 d_dosuid='$d_dosuid'
22179 d_drand48_r='$d_drand48_r'
22180 d_drand48proto='$d_drand48proto'
22181 d_dup2='$d_dup2'
22182 d_eaccess='$d_eaccess'
22183 d_endgrent='$d_endgrent'
22184 d_endgrent_r='$d_endgrent_r'
22185 d_endhent='$d_endhent'
22186 d_endhostent_r='$d_endhostent_r'
22187 d_endnent='$d_endnent'
22188 d_endnetent_r='$d_endnetent_r'
22189 d_endpent='$d_endpent'
22190 d_endprotoent_r='$d_endprotoent_r'
22191 d_endpwent='$d_endpwent'
22192 d_endpwent_r='$d_endpwent_r'
22193 d_endsent='$d_endsent'
22194 d_endservent_r='$d_endservent_r'
22195 d_eofnblk='$d_eofnblk'
22196 d_eunice='$d_eunice'
22197 d_faststdio='$d_faststdio'
22198 d_fchdir='$d_fchdir'
22199 d_fchmod='$d_fchmod'
22200 d_fchown='$d_fchown'
22201 d_fcntl='$d_fcntl'
22202 d_fcntl_can_lock='$d_fcntl_can_lock'
22203 d_fd_macros='$d_fd_macros'
22204 d_fd_set='$d_fd_set'
22205 d_fds_bits='$d_fds_bits'
22206 d_fgetpos='$d_fgetpos'
22207 d_finite='$d_finite'
22208 d_finitel='$d_finitel'
22209 d_flexfnam='$d_flexfnam'
22210 d_flock='$d_flock'
22211 d_flockproto='$d_flockproto'
22212 d_fork='$d_fork'
22213 d_fp_class='$d_fp_class'
22214 d_fpathconf='$d_fpathconf'
22215 d_fpclass='$d_fpclass'
22216 d_fpclassify='$d_fpclassify'
22217 d_fpclassl='$d_fpclassl'
22218 d_fpos64_t='$d_fpos64_t'
22219 d_frexpl='$d_frexpl'
22220 d_fs_data_s='$d_fs_data_s'
22221 d_fseeko='$d_fseeko'
22222 d_fsetpos='$d_fsetpos'
22223 d_fstatfs='$d_fstatfs'
22224 d_fstatvfs='$d_fstatvfs'
22225 d_fsync='$d_fsync'
22226 d_ftello='$d_ftello'
22227 d_ftime='$d_ftime'
22228 d_futimes='$d_futimes'
22229 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22230 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22231 d_getcwd='$d_getcwd'
22232 d_getespwnam='$d_getespwnam'
22233 d_getfsstat='$d_getfsstat'
22234 d_getgrent='$d_getgrent'
22235 d_getgrent_r='$d_getgrent_r'
22236 d_getgrgid_r='$d_getgrgid_r'
22237 d_getgrnam_r='$d_getgrnam_r'
22238 d_getgrps='$d_getgrps'
22239 d_gethbyaddr='$d_gethbyaddr'
22240 d_gethbyname='$d_gethbyname'
22241 d_gethent='$d_gethent'
22242 d_gethname='$d_gethname'
22243 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22244 d_gethostbyname_r='$d_gethostbyname_r'
22245 d_gethostent_r='$d_gethostent_r'
22246 d_gethostprotos='$d_gethostprotos'
22247 d_getitimer='$d_getitimer'
22248 d_getlogin='$d_getlogin'
22249 d_getlogin_r='$d_getlogin_r'
22250 d_getmnt='$d_getmnt'
22251 d_getmntent='$d_getmntent'
22252 d_getnbyaddr='$d_getnbyaddr'
22253 d_getnbyname='$d_getnbyname'
22254 d_getnent='$d_getnent'
22255 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22256 d_getnetbyname_r='$d_getnetbyname_r'
22257 d_getnetent_r='$d_getnetent_r'
22258 d_getnetprotos='$d_getnetprotos'
22259 d_getpagsz='$d_getpagsz'
22260 d_getpbyname='$d_getpbyname'
22261 d_getpbynumber='$d_getpbynumber'
22262 d_getpent='$d_getpent'
22263 d_getpgid='$d_getpgid'
22264 d_getpgrp2='$d_getpgrp2'
22265 d_getpgrp='$d_getpgrp'
22266 d_getppid='$d_getppid'
22267 d_getprior='$d_getprior'
22268 d_getprotobyname_r='$d_getprotobyname_r'
22269 d_getprotobynumber_r='$d_getprotobynumber_r'
22270 d_getprotoent_r='$d_getprotoent_r'
22271 d_getprotoprotos='$d_getprotoprotos'
22272 d_getprpwnam='$d_getprpwnam'
22273 d_getpwent='$d_getpwent'
22274 d_getpwent_r='$d_getpwent_r'
22275 d_getpwnam_r='$d_getpwnam_r'
22276 d_getpwuid_r='$d_getpwuid_r'
22277 d_getsbyname='$d_getsbyname'
22278 d_getsbyport='$d_getsbyport'
22279 d_getsent='$d_getsent'
22280 d_getservbyname_r='$d_getservbyname_r'
22281 d_getservbyport_r='$d_getservbyport_r'
22282 d_getservent_r='$d_getservent_r'
22283 d_getservprotos='$d_getservprotos'
22284 d_getspnam='$d_getspnam'
22285 d_getspnam_r='$d_getspnam_r'
22286 d_gettimeod='$d_gettimeod'
22287 d_gmtime64='$d_gmtime64'
22288 d_gmtime_r='$d_gmtime_r'
22289 d_gnulibc='$d_gnulibc'
22290 d_grpasswd='$d_grpasswd'
22291 d_hasmntopt='$d_hasmntopt'
22292 d_htonl='$d_htonl'
22293 d_ilogbl='$d_ilogbl'
22294 d_inc_version_list='$d_inc_version_list'
22295 d_index='$d_index'
22296 d_inetaton='$d_inetaton'
22297 d_int64_t='$d_int64_t'
22298 d_isascii='$d_isascii'
22299 d_isfinite='$d_isfinite'
22300 d_isinf='$d_isinf'
22301 d_isnan='$d_isnan'
22302 d_isnanl='$d_isnanl'
22303 d_killpg='$d_killpg'
22304 d_lchown='$d_lchown'
22305 d_ldbl_dig='$d_ldbl_dig'
22306 d_libm_lib_version='$d_libm_lib_version'
22307 d_link='$d_link'
22308 d_localtime64='$d_localtime64'
22309 d_localtime_r='$d_localtime_r'
22310 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22311 d_locconv='$d_locconv'
22312 d_lockf='$d_lockf'
22313 d_longdbl='$d_longdbl'
22314 d_longlong='$d_longlong'
22315 d_lseekproto='$d_lseekproto'
22316 d_lstat='$d_lstat'
22317 d_madvise='$d_madvise'
22318 d_malloc_good_size='$d_malloc_good_size'
22319 d_malloc_size='$d_malloc_size'
22320 d_mblen='$d_mblen'
22321 d_mbstowcs='$d_mbstowcs'
22322 d_mbtowc='$d_mbtowc'
22323 d_memchr='$d_memchr'
22324 d_memcmp='$d_memcmp'
22325 d_memcpy='$d_memcpy'
22326 d_memmove='$d_memmove'
22327 d_memset='$d_memset'
22328 d_mkdir='$d_mkdir'
22329 d_mkdtemp='$d_mkdtemp'
22330 d_mkfifo='$d_mkfifo'
22331 d_mkstemp='$d_mkstemp'
22332 d_mkstemps='$d_mkstemps'
22333 d_mktime64='$d_mktime64'
22334 d_mktime='$d_mktime'
22335 d_mmap='$d_mmap'
22336 d_modfl='$d_modfl'
22337 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22338 d_modflproto='$d_modflproto'
22339 d_mprotect='$d_mprotect'
22340 d_msg='$d_msg'
22341 d_msg_ctrunc='$d_msg_ctrunc'
22342 d_msg_dontroute='$d_msg_dontroute'
22343 d_msg_oob='$d_msg_oob'
22344 d_msg_peek='$d_msg_peek'
22345 d_msg_proxy='$d_msg_proxy'
22346 d_msgctl='$d_msgctl'
22347 d_msgget='$d_msgget'
22348 d_msghdr_s='$d_msghdr_s'
22349 d_msgrcv='$d_msgrcv'
22350 d_msgsnd='$d_msgsnd'
22351 d_msync='$d_msync'
22352 d_munmap='$d_munmap'
22353 d_mymalloc='$d_mymalloc'
22354 d_ndbm='$d_ndbm'
22355 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
22356 d_nice='$d_nice'
22357 d_nl_langinfo='$d_nl_langinfo'
22358 d_nv_preserves_uv='$d_nv_preserves_uv'
22359 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22360 d_off64_t='$d_off64_t'
22361 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22362 d_oldpthreads='$d_oldpthreads'
22363 d_oldsock='$d_oldsock'
22364 d_open3='$d_open3'
22365 d_pathconf='$d_pathconf'
22366 d_pause='$d_pause'
22367 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22368 d_phostname='$d_phostname'
22369 d_pipe='$d_pipe'
22370 d_poll='$d_poll'
22371 d_portable='$d_portable'
22372 d_printf_format_null='$d_printf_format_null'
22373 d_procselfexe='$d_procselfexe'
22374 d_pseudofork='$d_pseudofork'
22375 d_pthread_atfork='$d_pthread_atfork'
22376 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22377 d_pthread_yield='$d_pthread_yield'
22378 d_pwage='$d_pwage'
22379 d_pwchange='$d_pwchange'
22380 d_pwclass='$d_pwclass'
22381 d_pwcomment='$d_pwcomment'
22382 d_pwexpire='$d_pwexpire'
22383 d_pwgecos='$d_pwgecos'
22384 d_pwpasswd='$d_pwpasswd'
22385 d_pwquota='$d_pwquota'
22386 d_qgcvt='$d_qgcvt'
22387 d_quad='$d_quad'
22388 d_random_r='$d_random_r'
22389 d_readdir64_r='$d_readdir64_r'
22390 d_readdir='$d_readdir'
22391 d_readdir_r='$d_readdir_r'
22392 d_readlink='$d_readlink'
22393 d_readv='$d_readv'
22394 d_recvmsg='$d_recvmsg'
22395 d_rename='$d_rename'
22396 d_rewinddir='$d_rewinddir'
22397 d_rmdir='$d_rmdir'
22398 d_safebcpy='$d_safebcpy'
22399 d_safemcpy='$d_safemcpy'
22400 d_sanemcmp='$d_sanemcmp'
22401 d_sbrkproto='$d_sbrkproto'
22402 d_scalbnl='$d_scalbnl'
22403 d_sched_yield='$d_sched_yield'
22404 d_scm_rights='$d_scm_rights'
22405 d_seekdir='$d_seekdir'
22406 d_select='$d_select'
22407 d_sem='$d_sem'
22408 d_semctl='$d_semctl'
22409 d_semctl_semid_ds='$d_semctl_semid_ds'
22410 d_semctl_semun='$d_semctl_semun'
22411 d_semget='$d_semget'
22412 d_semop='$d_semop'
22413 d_sendmsg='$d_sendmsg'
22414 d_setegid='$d_setegid'
22415 d_seteuid='$d_seteuid'
22416 d_setgrent='$d_setgrent'
22417 d_setgrent_r='$d_setgrent_r'
22418 d_setgrps='$d_setgrps'
22419 d_sethent='$d_sethent'
22420 d_sethostent_r='$d_sethostent_r'
22421 d_setitimer='$d_setitimer'
22422 d_setlinebuf='$d_setlinebuf'
22423 d_setlocale='$d_setlocale'
22424 d_setlocale_r='$d_setlocale_r'
22425 d_setnent='$d_setnent'
22426 d_setnetent_r='$d_setnetent_r'
22427 d_setpent='$d_setpent'
22428 d_setpgid='$d_setpgid'
22429 d_setpgrp2='$d_setpgrp2'
22430 d_setpgrp='$d_setpgrp'
22431 d_setprior='$d_setprior'
22432 d_setproctitle='$d_setproctitle'
22433 d_setprotoent_r='$d_setprotoent_r'
22434 d_setpwent='$d_setpwent'
22435 d_setpwent_r='$d_setpwent_r'
22436 d_setregid='$d_setregid'
22437 d_setresgid='$d_setresgid'
22438 d_setresuid='$d_setresuid'
22439 d_setreuid='$d_setreuid'
22440 d_setrgid='$d_setrgid'
22441 d_setruid='$d_setruid'
22442 d_setsent='$d_setsent'
22443 d_setservent_r='$d_setservent_r'
22444 d_setsid='$d_setsid'
22445 d_setvbuf='$d_setvbuf'
22446 d_sfio='$d_sfio'
22447 d_shm='$d_shm'
22448 d_shmat='$d_shmat'
22449 d_shmatprototype='$d_shmatprototype'
22450 d_shmctl='$d_shmctl'
22451 d_shmdt='$d_shmdt'
22452 d_shmget='$d_shmget'
22453 d_sigaction='$d_sigaction'
22454 d_signbit='$d_signbit'
22455 d_sigprocmask='$d_sigprocmask'
22456 d_sigsetjmp='$d_sigsetjmp'
22457 d_sitearch='$d_sitearch'
22458 d_snprintf='$d_snprintf'
22459 d_sockatmark='$d_sockatmark'
22460 d_sockatmarkproto='$d_sockatmarkproto'
22461 d_socket='$d_socket'
22462 d_socklen_t='$d_socklen_t'
22463 d_sockpair='$d_sockpair'
22464 d_socks5_init='$d_socks5_init'
22465 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22466 d_sqrtl='$d_sqrtl'
22467 d_srand48_r='$d_srand48_r'
22468 d_srandom_r='$d_srandom_r'
22469 d_sresgproto='$d_sresgproto'
22470 d_sresuproto='$d_sresuproto'
22471 d_statblks='$d_statblks'
22472 d_statfs_f_flags='$d_statfs_f_flags'
22473 d_statfs_s='$d_statfs_s'
22474 d_statvfs='$d_statvfs'
22475 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22476 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22477 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22478 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22479 d_stdio_stream_array='$d_stdio_stream_array'
22480 d_stdiobase='$d_stdiobase'
22481 d_stdstdio='$d_stdstdio'
22482 d_strchr='$d_strchr'
22483 d_strcoll='$d_strcoll'
22484 d_strctcpy='$d_strctcpy'
22485 d_strerrm='$d_strerrm'
22486 d_strerror='$d_strerror'
22487 d_strerror_r='$d_strerror_r'
22488 d_strftime='$d_strftime'
22489 d_strlcat='$d_strlcat'
22490 d_strlcpy='$d_strlcpy'
22491 d_strtod='$d_strtod'
22492 d_strtol='$d_strtol'
22493 d_strtold='$d_strtold'
22494 d_strtoll='$d_strtoll'
22495 d_strtoq='$d_strtoq'
22496 d_strtoul='$d_strtoul'
22497 d_strtoull='$d_strtoull'
22498 d_strtouq='$d_strtouq'
22499 d_strxfrm='$d_strxfrm'
22500 d_suidsafe='$d_suidsafe'
22501 d_symlink='$d_symlink'
22502 d_syscall='$d_syscall'
22503 d_syscallproto='$d_syscallproto'
22504 d_sysconf='$d_sysconf'
22505 d_sysernlst='$d_sysernlst'
22506 d_syserrlst='$d_syserrlst'
22507 d_system='$d_system'
22508 d_tcgetpgrp='$d_tcgetpgrp'
22509 d_tcsetpgrp='$d_tcsetpgrp'
22510 d_telldir='$d_telldir'
22511 d_telldirproto='$d_telldirproto'
22512 d_time='$d_time'
22513 d_timegm='$d_timegm'
22514 d_times='$d_times'
22515 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22516 d_tm_tm_zone='$d_tm_tm_zone'
22517 d_tmpnam_r='$d_tmpnam_r'
22518 d_truncate='$d_truncate'
22519 d_ttyname_r='$d_ttyname_r'
22520 d_tzname='$d_tzname'
22521 d_u32align='$d_u32align'
22522 d_ualarm='$d_ualarm'
22523 d_umask='$d_umask'
22524 d_uname='$d_uname'
22525 d_union_semun='$d_union_semun'
22526 d_unordered='$d_unordered'
22527 d_unsetenv='$d_unsetenv'
22528 d_usleep='$d_usleep'
22529 d_usleepproto='$d_usleepproto'
22530 d_ustat='$d_ustat'
22531 d_vendorarch='$d_vendorarch'
22532 d_vendorbin='$d_vendorbin'
22533 d_vendorlib='$d_vendorlib'
22534 d_vendorscript='$d_vendorscript'
22535 d_vfork='$d_vfork'
22536 d_void_closedir='$d_void_closedir'
22537 d_voidsig='$d_voidsig'
22538 d_voidtty='$d_voidtty'
22539 d_volatile='$d_volatile'
22540 d_vprintf='$d_vprintf'
22541 d_vsnprintf='$d_vsnprintf'
22542 d_wait4='$d_wait4'
22543 d_waitpid='$d_waitpid'
22544 d_wcstombs='$d_wcstombs'
22545 d_wctomb='$d_wctomb'
22546 d_writev='$d_writev'
22547 d_xenix='$d_xenix'
22548 date='$date'
22549 db_hashtype='$db_hashtype'
22550 db_prefixtype='$db_prefixtype'
22551 db_version_major='$db_version_major'
22552 db_version_minor='$db_version_minor'
22553 db_version_patch='$db_version_patch'
22554 defvoidused='$defvoidused'
22555 direntrytype='$direntrytype'
22556 dlext='$dlext'
22557 dlsrc='$dlsrc'
22558 doublesize='$doublesize'
22559 drand01='$drand01'
22560 drand48_r_proto='$drand48_r_proto'
22561 dtrace='$dtrace'
22562 dynamic_ext='$dynamic_ext'
22563 eagain='$eagain'
22564 ebcdic='$ebcdic'
22565 echo='$echo'
22566 egrep='$egrep'
22567 emacs='$emacs'
22568 endgrent_r_proto='$endgrent_r_proto'
22569 endhostent_r_proto='$endhostent_r_proto'
22570 endnetent_r_proto='$endnetent_r_proto'
22571 endprotoent_r_proto='$endprotoent_r_proto'
22572 endpwent_r_proto='$endpwent_r_proto'
22573 endservent_r_proto='$endservent_r_proto'
22574 eunicefix='$eunicefix'
22575 exe_ext='$exe_ext'
22576 expr='$expr'
22577 extensions='$extensions'
22578 extern_C='$extern_C'
22579 extras='$extras'
22580 fflushNULL='$fflushNULL'
22581 fflushall='$fflushall'
22582 find='$find'
22583 firstmakefile='$firstmakefile'
22584 flex='$flex'
22585 fpossize='$fpossize'
22586 fpostype='$fpostype'
22587 freetype='$freetype'
22588 from='$from'
22589 full_ar='$full_ar'
22590 full_csh='$full_csh'
22591 full_sed='$full_sed'
22592 gccansipedantic='$gccansipedantic'
22593 gccosandvers='$gccosandvers'
22594 gccversion='$gccversion'
22595 getgrent_r_proto='$getgrent_r_proto'
22596 getgrgid_r_proto='$getgrgid_r_proto'
22597 getgrnam_r_proto='$getgrnam_r_proto'
22598 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22599 gethostbyname_r_proto='$gethostbyname_r_proto'
22600 gethostent_r_proto='$gethostent_r_proto'
22601 getlogin_r_proto='$getlogin_r_proto'
22602 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22603 getnetbyname_r_proto='$getnetbyname_r_proto'
22604 getnetent_r_proto='$getnetent_r_proto'
22605 getprotobyname_r_proto='$getprotobyname_r_proto'
22606 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22607 getprotoent_r_proto='$getprotoent_r_proto'
22608 getpwent_r_proto='$getpwent_r_proto'
22609 getpwnam_r_proto='$getpwnam_r_proto'
22610 getpwuid_r_proto='$getpwuid_r_proto'
22611 getservbyname_r_proto='$getservbyname_r_proto'
22612 getservbyport_r_proto='$getservbyport_r_proto'
22613 getservent_r_proto='$getservent_r_proto'
22614 getspnam_r_proto='$getspnam_r_proto'
22615 gidformat='$gidformat'
22616 gidsign='$gidsign'
22617 gidsize='$gidsize'
22618 gidtype='$gidtype'
22619 glibpth='$glibpth'
22620 gmake='$gmake'
22621 gmtime_r_proto='$gmtime_r_proto'
22622 gnulibc_version='$gnulibc_version'
22623 grep='$grep'
22624 groupcat='$groupcat'
22625 groupstype='$groupstype'
22626 gzip='$gzip'
22627 h_fcntl='$h_fcntl'
22628 h_sysfile='$h_sysfile'
22629 hint='$hint'
22630 hostcat='$hostcat'
22631 html1dir='$html1dir'
22632 html1direxp='$html1direxp'
22633 html3dir='$html3dir'
22634 html3direxp='$html3direxp'
22635 i16size='$i16size'
22636 i16type='$i16type'
22637 i32size='$i32size'
22638 i32type='$i32type'
22639 i64size='$i64size'
22640 i64type='$i64type'
22641 i8size='$i8size'
22642 i8type='$i8type'
22643 i_arpainet='$i_arpainet'
22644 i_assert='$i_assert'
22645 i_bsdioctl='$i_bsdioctl'
22646 i_crypt='$i_crypt'
22647 i_db='$i_db'
22648 i_dbm='$i_dbm'
22649 i_dirent='$i_dirent'
22650 i_dld='$i_dld'
22651 i_dlfcn='$i_dlfcn'
22652 i_fcntl='$i_fcntl'
22653 i_float='$i_float'
22654 i_fp='$i_fp'
22655 i_fp_class='$i_fp_class'
22656 i_gdbm='$i_gdbm'
22657 i_gdbm_ndbm='$i_gdbm_ndbm'
22658 i_gdbmndbm='$i_gdbmndbm'
22659 i_grp='$i_grp'
22660 i_ieeefp='$i_ieeefp'
22661 i_inttypes='$i_inttypes'
22662 i_langinfo='$i_langinfo'
22663 i_libutil='$i_libutil'
22664 i_limits='$i_limits'
22665 i_locale='$i_locale'
22666 i_machcthr='$i_machcthr'
22667 i_malloc='$i_malloc'
22668 i_mallocmalloc='$i_mallocmalloc'
22669 i_math='$i_math'
22670 i_memory='$i_memory'
22671 i_mntent='$i_mntent'
22672 i_ndbm='$i_ndbm'
22673 i_netdb='$i_netdb'
22674 i_neterrno='$i_neterrno'
22675 i_netinettcp='$i_netinettcp'
22676 i_niin='$i_niin'
22677 i_poll='$i_poll'
22678 i_prot='$i_prot'
22679 i_pthread='$i_pthread'
22680 i_pwd='$i_pwd'
22681 i_rpcsvcdbm='$i_rpcsvcdbm'
22682 i_sfio='$i_sfio'
22683 i_sgtty='$i_sgtty'
22684 i_shadow='$i_shadow'
22685 i_socks='$i_socks'
22686 i_stdarg='$i_stdarg'
22687 i_stddef='$i_stddef'
22688 i_stdlib='$i_stdlib'
22689 i_string='$i_string'
22690 i_sunmath='$i_sunmath'
22691 i_sysaccess='$i_sysaccess'
22692 i_sysdir='$i_sysdir'
22693 i_sysfile='$i_sysfile'
22694 i_sysfilio='$i_sysfilio'
22695 i_sysin='$i_sysin'
22696 i_sysioctl='$i_sysioctl'
22697 i_syslog='$i_syslog'
22698 i_sysmman='$i_sysmman'
22699 i_sysmode='$i_sysmode'
22700 i_sysmount='$i_sysmount'
22701 i_sysndir='$i_sysndir'
22702 i_sysparam='$i_sysparam'
22703 i_syspoll='$i_syspoll'
22704 i_sysresrc='$i_sysresrc'
22705 i_syssecrt='$i_syssecrt'
22706 i_sysselct='$i_sysselct'
22707 i_syssockio='$i_syssockio'
22708 i_sysstat='$i_sysstat'
22709 i_sysstatfs='$i_sysstatfs'
22710 i_sysstatvfs='$i_sysstatvfs'
22711 i_systime='$i_systime'
22712 i_systimek='$i_systimek'
22713 i_systimes='$i_systimes'
22714 i_systypes='$i_systypes'
22715 i_sysuio='$i_sysuio'
22716 i_sysun='$i_sysun'
22717 i_sysutsname='$i_sysutsname'
22718 i_sysvfs='$i_sysvfs'
22719 i_syswait='$i_syswait'
22720 i_termio='$i_termio'
22721 i_termios='$i_termios'
22722 i_time='$i_time'
22723 i_unistd='$i_unistd'
22724 i_ustat='$i_ustat'
22725 i_utime='$i_utime'
22726 i_values='$i_values'
22727 i_varargs='$i_varargs'
22728 i_varhdr='$i_varhdr'
22729 i_vfork='$i_vfork'
22730 ignore_versioned_solibs='$ignore_versioned_solibs'
22731 inc_version_list='$inc_version_list'
22732 inc_version_list_init='$inc_version_list_init'
22733 incpath='$incpath'
22734 inews='$inews'
22735 initialinstalllocation='$initialinstalllocation'
22736 installarchlib='$installarchlib'
22737 installbin='$installbin'
22738 installhtml1dir='$installhtml1dir'
22739 installhtml3dir='$installhtml3dir'
22740 installman1dir='$installman1dir'
22741 installman3dir='$installman3dir'
22742 installprefix='$installprefix'
22743 installprefixexp='$installprefixexp'
22744 installprivlib='$installprivlib'
22745 installscript='$installscript'
22746 installsitearch='$installsitearch'
22747 installsitebin='$installsitebin'
22748 installsitehtml1dir='$installsitehtml1dir'
22749 installsitehtml3dir='$installsitehtml3dir'
22750 installsitelib='$installsitelib'
22751 installsiteman1dir='$installsiteman1dir'
22752 installsiteman3dir='$installsiteman3dir'
22753 installsitescript='$installsitescript'
22754 installstyle='$installstyle'
22755 installusrbinperl='$installusrbinperl'
22756 installvendorarch='$installvendorarch'
22757 installvendorbin='$installvendorbin'
22758 installvendorhtml1dir='$installvendorhtml1dir'
22759 installvendorhtml3dir='$installvendorhtml3dir'
22760 installvendorlib='$installvendorlib'
22761 installvendorman1dir='$installvendorman1dir'
22762 installvendorman3dir='$installvendorman3dir'
22763 installvendorscript='$installvendorscript'
22764 intsize='$intsize'
22765 issymlink='$issymlink'
22766 ivdformat='$ivdformat'
22767 ivsize='$ivsize'
22768 ivtype='$ivtype'
22769 known_extensions='$known_extensions'
22770 ksh='$ksh'
22771 ld='$ld'
22772 lddlflags='$lddlflags'
22773 ldflags='$ldflags'
22774 ldflags_uselargefiles='$ldflags_uselargefiles'
22775 ldlibpthname='$ldlibpthname'
22776 less='$less'
22777 lib_ext='$lib_ext'
22778 libc='$libc'
22779 libperl='$libperl'
22780 libpth='$libpth'
22781 libs='$libs'
22782 libsdirs='$libsdirs'
22783 libsfiles='$libsfiles'
22784 libsfound='$libsfound'
22785 libspath='$libspath'
22786 libswanted='$libswanted'
22787 libswanted_uselargefiles='$libswanted_uselargefiles'
22788 line='$line'
22789 lint='$lint'
22790 lkflags='$lkflags'
22791 ln='$ln'
22792 lns='$lns'
22793 localtime_r_proto='$localtime_r_proto'
22794 locincpth='$locincpth'
22795 loclibpth='$loclibpth'
22796 longdblsize='$longdblsize'
22797 longlongsize='$longlongsize'
22798 longsize='$longsize'
22799 lp='$lp'
22800 lpr='$lpr'
22801 ls='$ls'
22802 lseeksize='$lseeksize'
22803 lseektype='$lseektype'
22804 mad='$mad'
22805 madlyh='$madlyh'
22806 madlyobj='$madlyobj'
22807 madlysrc='$madlysrc'
22808 mail='$mail'
22809 mailx='$mailx'
22810 make='$make'
22811 make_set_make='$make_set_make'
22812 mallocobj='$mallocobj'
22813 mallocsrc='$mallocsrc'
22814 malloctype='$malloctype'
22815 man1dir='$man1dir'
22816 man1direxp='$man1direxp'
22817 man1ext='$man1ext'
22818 man3dir='$man3dir'
22819 man3direxp='$man3direxp'
22820 man3ext='$man3ext'
22821 mips_type='$mips_type'
22822 mistrustnm='$mistrustnm'
22823 mkdir='$mkdir'
22824 mmaptype='$mmaptype'
22825 modetype='$modetype'
22826 more='$more'
22827 multiarch='$multiarch'
22828 mv='$mv'
22829 myarchname='$myarchname'
22830 mydomain='$mydomain'
22831 myhostname='$myhostname'
22832 myuname='$myuname'
22833 n='$n'
22834 need_va_copy='$need_va_copy'
22835 netdb_hlen_type='$netdb_hlen_type'
22836 netdb_host_type='$netdb_host_type'
22837 netdb_name_type='$netdb_name_type'
22838 netdb_net_type='$netdb_net_type'
22839 nm='$nm'
22840 nm_opt='$nm_opt'
22841 nm_so_opt='$nm_so_opt'
22842 nonxs_ext='$nonxs_ext'
22843 nroff='$nroff'
22844 nvEUformat='$nvEUformat'
22845 nvFUformat='$nvFUformat'
22846 nvGUformat='$nvGUformat'
22847 nv_overflows_integers_at='$nv_overflows_integers_at'
22848 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22849 nveformat='$nveformat'
22850 nvfformat='$nvfformat'
22851 nvgformat='$nvgformat'
22852 nvsize='$nvsize'
22853 nvtype='$nvtype'
22854 o_nonblock='$o_nonblock'
22855 obj_ext='$obj_ext'
22856 old_pthread_create_joinable='$old_pthread_create_joinable'
22857 optimize='$optimize'
22858 orderlib='$orderlib'
22859 osname='$osname'
22860 osvers='$osvers'
22861 otherlibdirs='$otherlibdirs'
22862 package='$package'
22863 pager='$pager'
22864 passcat='$passcat'
22865 patchlevel='$patchlevel'
22866 path_sep='$path_sep'
22867 perl5='$perl5'
22868 perl='$perl'
22869 perl_patchlevel='$perl_patchlevel'
22870 perladmin='$perladmin'
22871 perllibs='$perllibs'
22872 perlpath='$perlpath'
22873 pg='$pg'
22874 phostname='$phostname'
22875 pidtype='$pidtype'
22876 plibpth='$plibpth'
22877 pmake='$pmake'
22878 pr='$pr'
22879 prefix='$prefix'
22880 prefixexp='$prefixexp'
22881 privlib='$privlib'
22882 privlibexp='$privlibexp'
22883 procselfexe='$procselfexe'
22884 prototype='$prototype'
22885 ptrsize='$ptrsize'
22886 quadkind='$quadkind'
22887 quadtype='$quadtype'
22888 randbits='$randbits'
22889 randfunc='$randfunc'
22890 random_r_proto='$random_r_proto'
22891 randseedtype='$randseedtype'
22892 ranlib='$ranlib'
22893 rd_nodata='$rd_nodata'
22894 readdir64_r_proto='$readdir64_r_proto'
22895 readdir_r_proto='$readdir_r_proto'
22896 revision='$revision'
22897 rm='$rm'
22898 rm_try='$rm_try'
22899 rmail='$rmail'
22900 run='$run'
22901 runnm='$runnm'
22902 sGMTIME_max='$sGMTIME_max'
22903 sGMTIME_min='$sGMTIME_min'
22904 sLOCALTIME_max='$sLOCALTIME_max'
22905 sLOCALTIME_min='$sLOCALTIME_min'
22906 sPRIEUldbl='$sPRIEUldbl'
22907 sPRIFUldbl='$sPRIFUldbl'
22908 sPRIGUldbl='$sPRIGUldbl'
22909 sPRIXU64='$sPRIXU64'
22910 sPRId64='$sPRId64'
22911 sPRIeldbl='$sPRIeldbl'
22912 sPRIfldbl='$sPRIfldbl'
22913 sPRIgldbl='$sPRIgldbl'
22914 sPRIi64='$sPRIi64'
22915 sPRIo64='$sPRIo64'
22916 sPRIu64='$sPRIu64'
22917 sPRIx64='$sPRIx64'
22918 sSCNfldbl='$sSCNfldbl'
22919 sched_yield='$sched_yield'
22920 scriptdir='$scriptdir'
22921 scriptdirexp='$scriptdirexp'
22922 sed='$sed'
22923 seedfunc='$seedfunc'
22924 selectminbits='$selectminbits'
22925 selecttype='$selecttype'
22926 sendmail='$sendmail'
22927 setgrent_r_proto='$setgrent_r_proto'
22928 sethostent_r_proto='$sethostent_r_proto'
22929 setlocale_r_proto='$setlocale_r_proto'
22930 setnetent_r_proto='$setnetent_r_proto'
22931 setprotoent_r_proto='$setprotoent_r_proto'
22932 setpwent_r_proto='$setpwent_r_proto'
22933 setservent_r_proto='$setservent_r_proto'
22934 sh='$sh'
22935 shar='$shar'
22936 sharpbang='$sharpbang'
22937 shmattype='$shmattype'
22938 shortsize='$shortsize'
22939 shrpenv='$shrpenv'
22940 shsharp='$shsharp'
22941 sig_count='$sig_count'
22942 sig_name='$sig_name'
22943 sig_name_init='$sig_name_init'
22944 sig_num='$sig_num'
22945 sig_num_init='$sig_num_init'
22946 sig_size='$sig_size'
22947 signal_t='$signal_t'
22948 sitearch='$sitearch'
22949 sitearchexp='$sitearchexp'
22950 sitebin='$sitebin'
22951 sitebinexp='$sitebinexp'
22952 sitehtml1dir='$sitehtml1dir'
22953 sitehtml1direxp='$sitehtml1direxp'
22954 sitehtml3dir='$sitehtml3dir'
22955 sitehtml3direxp='$sitehtml3direxp'
22956 sitelib='$sitelib'
22957 sitelib_stem='$sitelib_stem'
22958 sitelibexp='$sitelibexp'
22959 siteman1dir='$siteman1dir'
22960 siteman1direxp='$siteman1direxp'
22961 siteman3dir='$siteman3dir'
22962 siteman3direxp='$siteman3direxp'
22963 siteprefix='$siteprefix'
22964 siteprefixexp='$siteprefixexp'
22965 sitescript='$sitescript'
22966 sitescriptexp='$sitescriptexp'
22967 sizesize='$sizesize'
22968 sizetype='$sizetype'
22969 sleep='$sleep'
22970 smail='$smail'
22971 so='$so'
22972 sockethdr='$sockethdr'
22973 socketlib='$socketlib'
22974 socksizetype='$socksizetype'
22975 sort='$sort'
22976 spackage='$spackage'
22977 spitshell='$spitshell'
22978 srand48_r_proto='$srand48_r_proto'
22979 srandom_r_proto='$srandom_r_proto'
22980 src='$src'
22981 ssizetype='$ssizetype'
22982 startperl='$startperl'
22983 startsh='$startsh'
22984 static_ext='$static_ext'
22985 stdchar='$stdchar'
22986 stdio_base='$stdio_base'
22987 stdio_bufsiz='$stdio_bufsiz'
22988 stdio_cnt='$stdio_cnt'
22989 stdio_filbuf='$stdio_filbuf'
22990 stdio_ptr='$stdio_ptr'
22991 stdio_stream_array='$stdio_stream_array'
22992 strerror_r_proto='$strerror_r_proto'
22993 strings='$strings'
22994 submit='$submit'
22995 subversion='$subversion'
22996 sysman='$sysman'
22997 tail='$tail'
22998 tar='$tar'
22999 targetarch='$targetarch'
23000 tbl='$tbl'
23001 tee='$tee'
23002 test='$test'
23003 timeincl='$timeincl'
23004 timetype='$timetype'
23005 tmpnam_r_proto='$tmpnam_r_proto'
23006 to='$to'
23007 touch='$touch'
23008 tr='$tr'
23009 trnl='$trnl'
23010 troff='$troff'
23011 ttyname_r_proto='$ttyname_r_proto'
23012 u16size='$u16size'
23013 u16type='$u16type'
23014 u32size='$u32size'
23015 u32type='$u32type'
23016 u64size='$u64size'
23017 u64type='$u64type'
23018 u8size='$u8size'
23019 u8type='$u8type'
23020 uidformat='$uidformat'
23021 uidsign='$uidsign'
23022 uidsize='$uidsize'
23023 uidtype='$uidtype'
23024 uname='$uname'
23025 uniq='$uniq'
23026 uquadtype='$uquadtype'
23027 use5005threads='$use5005threads'
23028 use64bitall='$use64bitall'
23029 use64bitint='$use64bitint'
23030 usecrosscompile='$usecrosscompile'
23031 usedl='$usedl'
23032 usedtrace='$usedtrace'
23033 usefaststdio='$usefaststdio'
23034 useithreads='$useithreads'
23035 uselargefiles='$uselargefiles'
23036 uselongdouble='$uselongdouble'
23037 usemallocwrap='$usemallocwrap'
23038 usemorebits='$usemorebits'
23039 usemultiplicity='$usemultiplicity'
23040 usemymalloc='$usemymalloc'
23041 usenm='$usenm'
23042 useopcode='$useopcode'
23043 useperlio='$useperlio'
23044 useposix='$useposix'
23045 usereentrant='$usereentrant'
23046 userelocatableinc='$userelocatableinc'
23047 usesfio='$usesfio'
23048 useshrplib='$useshrplib'
23049 usesitecustomize='$usesitecustomize'
23050 usesocks='$usesocks'
23051 usethreads='$usethreads'
23052 usevendorprefix='$usevendorprefix'
23053 usevfork='$usevfork'
23054 usrinc='$usrinc'
23055 uuname='$uuname'
23056 uvXUformat='$uvXUformat'
23057 uvoformat='$uvoformat'
23058 uvsize='$uvsize'
23059 uvtype='$uvtype'
23060 uvuformat='$uvuformat'
23061 uvxformat='$uvxformat'
23062 vendorarch='$vendorarch'
23063 vendorarchexp='$vendorarchexp'
23064 vendorbin='$vendorbin'
23065 vendorbinexp='$vendorbinexp'
23066 vendorhtml1dir='$vendorhtml1dir'
23067 vendorhtml1direxp='$vendorhtml1direxp'
23068 vendorhtml3dir='$vendorhtml3dir'
23069 vendorhtml3direxp='$vendorhtml3direxp'
23070 vendorlib='$vendorlib'
23071 vendorlib_stem='$vendorlib_stem'
23072 vendorlibexp='$vendorlibexp'
23073 vendorman1dir='$vendorman1dir'
23074 vendorman1direxp='$vendorman1direxp'
23075 vendorman3dir='$vendorman3dir'
23076 vendorman3direxp='$vendorman3direxp'
23077 vendorprefix='$vendorprefix'
23078 vendorprefixexp='$vendorprefixexp'
23079 vendorscript='$vendorscript'
23080 vendorscriptexp='$vendorscriptexp'
23081 version='$version'
23082 version_patchlevel_string='$version_patchlevel_string'
23083 versiononly='$versiononly'
23084 vi='$vi'
23085 voidflags='$voidflags'
23086 xlibpth='$xlibpth'
23087 yacc='$yacc'
23088 yaccflags='$yaccflags'
23089 zcat='$zcat'
23090 zip='$zip'
23091 EOT
23092
23093 : Add in command line options if available
23094 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23095
23096 : add special variables
23097 $test -f $src/patchlevel.h && \
23098 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23099 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
23100 echo "PERL_CONFIG_SH=true" >>config.sh
23101
23102 : propagate old symbols
23103 if $test -f UU/config.sh; then
23104         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23105         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23106                 config.sh config.sh UU/oldconfig.sh |\
23107                 $sort | $uniq -u >UU/oldsyms
23108         set X `cat UU/oldsyms`
23109         shift
23110         case $# in
23111         0) ;;
23112         *)
23113                 cat <<EOM
23114 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23115 EOM
23116                 echo ": Variables propagated from previous config.sh file." >>config.sh
23117                 for sym in `cat UU/oldsyms`; do
23118                         echo "    Propagating $hint variable "'$'"$sym..."
23119                         eval 'tmp="$'"${sym}"'"'
23120                         echo "$tmp" | \
23121                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23122                 done
23123                 ;;
23124         esac
23125 fi
23126
23127 : Finish up by extracting the .SH files
23128 case "$alldone" in
23129 exit)
23130         $rm -rf UU
23131         echo "Extraction done."
23132         exit 0
23133         ;;
23134 cont)
23135         ;;
23136 '')
23137         dflt=''
23138         nostick=true
23139         $cat <<EOM
23140
23141 If you'd like to make any changes to the config.sh file before I begin
23142 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23143
23144 EOM
23145         rp="Press return or use a shell escape to edit config.sh:"
23146         . UU/myread
23147         nostick=''
23148         case "$ans" in
23149         '') ;;
23150         *) : in case they cannot read
23151                 sh 1>&4 -c "$ans";;
23152         esac
23153         ;;
23154 esac
23155
23156 : if this fails, just run all the .SH files by hand
23157 . ./config.sh
23158
23159 echo " "
23160 exec 1>&4
23161 pwd=`pwd`
23162 . ./UU/extract
23163 cd "$pwd"
23164
23165 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23166         dflt=y
23167         case "$silent" in
23168         true) ;;
23169         *)
23170                 $cat <<EOM
23171
23172 Now you need to generate make dependencies by running "$make depend".
23173 You might prefer to run it in background: "$make depend > makedepend.out &"
23174 It can take a while, so you might not want to run it right now.
23175
23176 EOM
23177                 ;;
23178         esac
23179         rp="Run $make depend now?"
23180         . UU/myread
23181         case "$ans" in
23182         y*)
23183                 $make depend && echo "Now you must run '$make'."
23184                 ;;
23185         *)
23186                 echo "You must run '$make depend' then '$make'."
23187                 ;;
23188         esac
23189 elif test -f [Mm]akefile; then
23190         echo " "
23191         echo "Now you must run a $make."
23192 else
23193         echo "Configure done."
23194 fi
23195
23196 if $test -f Policy.sh; then
23197     $cat <<EOM
23198
23199 If you compile $package on a different machine or from a different object
23200 directory, copy the Policy.sh file from this object directory to the
23201 new one before you run Configure -- this will help you with most of
23202 the policy defaults.
23203
23204 EOM
23205 fi
23206 if $test -f config.msg; then
23207     echo "Hmm.  I also noted the following information while running:"
23208     echo " "
23209     $cat config.msg >&4
23210     $rm -f config.msg
23211 fi
23212 $rm -f kit*isdone ark*isdone
23213 $rm -rf UU
23214
23215 : End of Configure
23216