could we add usedevel to config.h?
[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 Fri Nov 28 08:39:51 CET 2008 [metaconfig 3.5 PL0]
29 # (with additional metaconfig patches by perlbug@perl.org)
30
31 cat >c1$$ <<EOF
32 ARGGGHHHH!!!!!
33
34 SCO csh still thinks true is false.  Write to SCO today and tell them that next
35 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
36
37 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
38 we'd have to do is go in and swap the && and || tokens, wherever they are.)
39
40 [End of diatribe. We now return you to your regularly scheduled programming...]
41 EOF
42 cat >c2$$ <<EOF
43
44 OOPS!  You naughty creature!  You didn't run Configure with sh!
45 I will attempt to remedy the situation by running sh for you...
46 EOF
47
48 true || cat c1$$ c2$$
49 true || exec sh $0 $argv:q
50
51 (exit $?0) || cat c2$$
52 (exit $?0) || exec sh $0 $argv:q
53 rm -f c1$$ c2$$
54
55 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
56         cat >&4 <<EOF
57 ***
58 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
59 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
60 *** Please read the README.plan9 for further instructions.
61 *** Cannot continue, aborting.
62 ***
63 EOF
64         exit 1
65 fi
66
67 if test ! -c /dev/null ; then
68         cat >&4 <<EOF
69 ***
70 *** I'm sorry, but /dev/null appears to be a file rather than a device.
71 *** Please consult your operating sytem's notes for making a device
72 *** in /dev.
73 *** Cannot continue, aborting.
74 ***
75 EOF
76         exit 1
77 fi
78
79 : compute my invocation name
80 me=$0
81 case "$0" in
82 */*)
83         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
84         test "$me" || me=$0
85         ;;
86 esac
87
88 : Proper separator for the PATH environment variable
89 p_=:
90 : On OS/2 this directory should exist if this is not floppy only system ":-]"
91 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
92         if test -n "$OS2_SHELL"; then
93                 p_=\;
94                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
95                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
96                 is_os2=yes
97         elif test -n "$DJGPP"; then
98                 case "X${MACHTYPE:-nonesuchmach}" in
99                 *cygwin) ;;
100                 *) p_=\; ;;
101                 esac
102         fi
103 fi
104
105 : Proper PATH setting
106 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
107 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
108 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
109 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
110 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
111 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
112 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
113 paths="$paths /sbin /usr/sbin /usr/libexec"
114 paths="$paths /system/gnu_library/bin"
115
116 for p in $paths
117 do
118         case "$p_$PATH$p_" in
119         *$p_$p$p_*) ;;
120         *) test -d $p && PATH=$PATH$p_$p ;;
121         esac
122 done
123
124 PATH=.$p_$PATH
125 export PATH
126
127 : shall we be using ksh?
128 inksh=''
129 needksh=''
130 avoidksh=''
131 newsh=/bin/ksh
132 changesh=''
133 if (PATH=.; alias -x) >/dev/null 2>&1; then
134                 inksh=true
135 fi
136 if test -f /hp-ux -a -f /bin/ksh; then
137         needksh='to avoid sh bug in "here document" expansion'
138 fi
139 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
140         if test X`/usr/bin/uname -v` = X4; then
141                 avoidksh="to avoid AIX 4's /bin/sh"
142                 newsh=/usr/bin/bsh
143         fi
144 fi
145 if test -f /osf_boot -a -f /usr/sbin/setld; then
146         if test X`/usr/bin/uname -s` = XOSF1; then
147                 avoidksh="to avoid Digital UNIX' ksh"
148                 newsh=/bin/sh
149                 unset BIN_SH
150         fi
151 fi
152 case "$inksh/$needksh" in
153 /[a-z]*)
154                 ENV=''
155                 changesh=true
156                 reason="$needksh"
157         ;;
158 esac
159 case "$inksh/$avoidksh" in
160 true/[a-z]*)
161         changesh=true
162         reason="$avoidksh"
163         ;;
164 esac
165 case "$inksh/$needksh-$avoidksh-" in
166 true/--)
167                 cat <<EOM
168 (I see you are using the Korn shell.  Some ksh's blow up on $me,
169 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
170 EOM
171         ;;
172 esac
173 case "$changesh" in
174 true)
175         export newsh
176         echo "(Feeding myself to $newsh $reason.)"
177         case "$0" in
178         Configure|*/Configure) exec $newsh $0 "$@";;
179         *) exec $newsh Configure "$@";;
180         esac
181         ;;
182 esac
183 test -x "${newsh}" || unset newsh
184
185 : if needed, set CDPATH to a harmless value that is not chatty
186 : avoid bash 2.02 problems with empty CDPATH.
187 case "$CDPATH" in
188 '')     ;;
189 *)      case "$SHELL" in
190         *bash*) CDPATH='.' ;;
191         *) CDPATH='' ;;
192         esac
193         ;;
194 esac
195
196 : Configure runs within the UU subdirectory
197 test -d UU || mkdir UU
198 cd UU && rm -f ./*
199
200 ccname=''
201 ccversion=''
202 ccsymbols=''
203 cppccsymbols=''
204 cppsymbols=''
205 from=''
206 run=''
207 targetarch=''
208 to=''
209 usecrosscompile=''
210 extern_C=''
211 mistrustnm=''
212 usedevel=''
213 perllibs=''
214 dynamic_ext=''
215 extensions=''
216 known_extensions=''
217 nonxs_ext=''
218 static_ext=''
219 useopcode=''
220 useposix=''
221 extras=''
222 d_bsd=''
223 d_eunice=''
224 d_xenix=''
225 eunicefix=''
226 ar=''
227 awk=''
228 bash=''
229 bison=''
230 byacc=''
231 cat=''
232 chgrp=''
233 chmod=''
234 chown=''
235 comm=''
236 compress=''
237 cp=''
238 cpio=''
239 cpp=''
240 csh=''
241 date=''
242 echo=''
243 egrep=''
244 emacs=''
245 expr=''
246 find=''
247 flex=''
248 gmake=''
249 grep=''
250 gzip=''
251 inews=''
252 ksh=''
253 less=''
254 line=''
255 lint=''
256 ln=''
257 lp=''
258 lpr=''
259 ls=''
260 mail=''
261 mailx=''
262 make=''
263 mkdir=''
264 more=''
265 mv=''
266 nm=''
267 nroff=''
268 perl=''
269 pg=''
270 pmake=''
271 pr=''
272 rm=''
273 rmail=''
274 sed=''
275 sendmail=''
276 shar=''
277 sleep=''
278 smail=''
279 sort=''
280 submit=''
281 tail=''
282 tar=''
283 tbl=''
284 tee=''
285 test=''
286 touch=''
287 tr=''
288 troff=''
289 uname=''
290 uniq=''
291 uuname=''
292 vi=''
293 zcat=''
294 zip=''
295 full_ar=''
296 full_sed=''
297 libswanted=''
298 hint=''
299 myuname=''
300 osname=''
301 osvers=''
302 Author=''
303 Date=''
304 Header=''
305 Id=''
306 Locker=''
307 Log=''
308 RCSfile=''
309 Revision=''
310 Source=''
311 State=''
312 _a=''
313 _exe=''
314 _o=''
315 archobjs=''
316 exe_ext=''
317 firstmakefile=''
318 lib_ext=''
319 obj_ext=''
320 path_sep=''
321 rm_try=''
322 afs=''
323 afsroot=''
324 alignbytes=''
325 ansi2knr=''
326 archlib=''
327 archlibexp=''
328 d_archlib=''
329 installarchlib=''
330 archname=''
331 myarchname=''
332 d_atolf=''
333 d_atoll=''
334 baserev=''
335 bin=''
336 binexp=''
337 initialinstalllocation=''
338 installbin=''
339 userelocatableinc=''
340 byteorder=''
341 cc=''
342 ccflags=''
343 cppflags=''
344 ldflags=''
345 lkflags=''
346 locincpth=''
347 optimize=''
348 cf_email=''
349 cf_by=''
350 cf_time=''
351 contains=''
352 cpp_stuff=''
353 cpplast=''
354 cppminus=''
355 cpprun=''
356 cppstdin=''
357 d__fwalk=''
358 d_access=''
359 d_accessx=''
360 d_aintl=''
361 d_alarm=''
362 asctime_r_proto=''
363 d_asctime_r=''
364 d_attribute_format=''
365 d_attribute_malloc=''
366 d_attribute_nonnull=''
367 d_attribute_noreturn=''
368 d_attribute_pure=''
369 d_attribute_unused=''
370 d_attribute_warn_unused_result=''
371 d_printf_format_null=''
372 d_bcmp=''
373 d_bcopy=''
374 d_builtin_choose_expr=''
375 d_builtin_expect=''
376 d_bzero=''
377 d_c99_variadic_macros=''
378 d_casti32=''
379 castflags=''
380 d_castneg=''
381 d_chown=''
382 d_chroot=''
383 d_chsize=''
384 d_class=''
385 d_clearenv=''
386 d_closedir=''
387 d_void_closedir=''
388 d_cmsghdr_s=''
389 d_const=''
390 d_copysignl=''
391 d_cplusplus=''
392 cryptlib=''
393 d_crypt=''
394 crypt_r_proto=''
395 d_crypt_r=''
396 d_csh=''
397 full_csh=''
398 d_ctermid=''
399 ctermid_r_proto=''
400 d_ctermid_r=''
401 ctime_r_proto=''
402 d_ctime_r=''
403 d_cuserid=''
404 d_dbl_dig=''
405 d_dbminitproto=''
406 d_difftime=''
407 d_dir_dd_fd=''
408 d_dirfd=''
409 d_dlerror=''
410 d_dlopen=''
411 d_dlsymun=''
412 d_dosuid=''
413 d_suidsafe=''
414 d_drand48_r=''
415 drand48_r_proto=''
416 d_drand48proto=''
417 d_dup2=''
418 d_eaccess=''
419 d_endgrent=''
420 d_endgrent_r=''
421 endgrent_r_proto=''
422 d_endhent=''
423 d_endhostent_r=''
424 endhostent_r_proto=''
425 d_endnent=''
426 d_endnetent_r=''
427 endnetent_r_proto=''
428 d_endpent=''
429 d_endprotoent_r=''
430 endprotoent_r_proto=''
431 d_endpwent=''
432 d_endpwent_r=''
433 endpwent_r_proto=''
434 d_endsent=''
435 d_endservent_r=''
436 endservent_r_proto=''
437 d_faststdio=''
438 d_fchdir=''
439 d_fchmod=''
440 d_fchown=''
441 d_fcntl=''
442 d_fcntl_can_lock=''
443 d_fd_macros=''
444 d_fd_set=''
445 d_fds_bits=''
446 d_fgetpos=''
447 d_finite=''
448 d_finitel=''
449 d_flexfnam=''
450 d_flock=''
451 d_flockproto=''
452 d_fork=''
453 d_fp_class=''
454 d_fpclass=''
455 d_fpclassify=''
456 d_fpclassl=''
457 d_fpos64_t=''
458 d_frexpl=''
459 d_fs_data_s=''
460 d_fseeko=''
461 d_fsetpos=''
462 d_fstatfs=''
463 d_fsync=''
464 d_ftello=''
465 d_ftime=''
466 d_gettimeod=''
467 d_futimes=''
468 d_Gconvert=''
469 d_getcwd=''
470 d_getespwnam=''
471 d_getfsstat=''
472 d_getgrent=''
473 d_getgrent_r=''
474 getgrent_r_proto=''
475 d_getgrgid_r=''
476 getgrgid_r_proto=''
477 d_getgrnam_r=''
478 getgrnam_r_proto=''
479 d_getgrps=''
480 d_gethbyaddr=''
481 d_gethbyname=''
482 d_gethent=''
483 aphostname=''
484 d_gethname=''
485 d_phostname=''
486 d_uname=''
487 d_gethostbyaddr_r=''
488 gethostbyaddr_r_proto=''
489 d_gethostbyname_r=''
490 gethostbyname_r_proto=''
491 d_gethostent_r=''
492 gethostent_r_proto=''
493 d_gethostprotos=''
494 d_getitimer=''
495 d_getlogin=''
496 d_getlogin_r=''
497 getlogin_r_proto=''
498 d_getmnt=''
499 d_getmntent=''
500 d_getnbyaddr=''
501 d_getnbyname=''
502 d_getnent=''
503 d_getnetbyaddr_r=''
504 getnetbyaddr_r_proto=''
505 d_getnetbyname_r=''
506 getnetbyname_r_proto=''
507 d_getnetent_r=''
508 getnetent_r_proto=''
509 d_getnetprotos=''
510 d_getpagsz=''
511 d_getpent=''
512 d_getpgid=''
513 d_getpgrp2=''
514 d_bsdgetpgrp=''
515 d_getpgrp=''
516 d_getppid=''
517 d_getprior=''
518 d_getpbyname=''
519 d_getpbynumber=''
520 d_getprotobyname_r=''
521 getprotobyname_r_proto=''
522 d_getprotobynumber_r=''
523 getprotobynumber_r_proto=''
524 d_getprotoent_r=''
525 getprotoent_r_proto=''
526 d_getprotoprotos=''
527 d_getprpwnam=''
528 d_getpwent=''
529 d_getpwent_r=''
530 getpwent_r_proto=''
531 d_getpwnam_r=''
532 getpwnam_r_proto=''
533 d_getpwuid_r=''
534 getpwuid_r_proto=''
535 d_getsent=''
536 d_getservbyname_r=''
537 getservbyname_r_proto=''
538 d_getservbyport_r=''
539 getservbyport_r_proto=''
540 d_getservent_r=''
541 getservent_r_proto=''
542 d_getservprotos=''
543 d_getspnam=''
544 d_getspnam_r=''
545 getspnam_r_proto=''
546 d_getsbyname=''
547 d_getsbyport=''
548 d_gmtime_r=''
549 gmtime_r_proto=''
550 d_gnulibc=''
551 gnulibc_version=''
552 d_hasmntopt=''
553 d_htonl=''
554 d_ilogbl=''
555 d_inetaton=''
556 d_int64_t=''
557 d_isascii=''
558 d_isfinite=''
559 d_isinf=''
560 d_isnan=''
561 d_isnanl=''
562 d_killpg=''
563 d_lchown=''
564 d_ldbl_dig=''
565 d_libm_lib_version=''
566 d_link=''
567 d_localtime_r=''
568 d_localtime_r_needs_tzset=''
569 localtime_r_proto=''
570 d_locconv=''
571 d_lockf=''
572 d_longdbl=''
573 longdblsize=''
574 d_longlong=''
575 longlongsize=''
576 d_lseekproto=''
577 d_lstat=''
578 d_madvise=''
579 d_malloc_good_size=''
580 d_malloc_size=''
581 d_mblen=''
582 d_mbstowcs=''
583 d_mbtowc=''
584 d_memchr=''
585 d_memcmp=''
586 d_memcpy=''
587 d_memmove=''
588 d_memset=''
589 d_mkdir=''
590 d_mkdtemp=''
591 d_mkfifo=''
592 d_mkstemp=''
593 d_mkstemps=''
594 d_mktime=''
595 d_mmap=''
596 mmaptype=''
597 d_modfl=''
598 d_modfl_pow32_bug=''
599 d_modflproto=''
600 d_mprotect=''
601 d_msg=''
602 d_msgctl=''
603 d_msgget=''
604 d_msghdr_s=''
605 d_msgrcv=''
606 d_msgsnd=''
607 d_msync=''
608 d_munmap=''
609 d_nice=''
610 d_nl_langinfo=''
611 d_off64_t=''
612 d_open3=''
613 d_fpathconf=''
614 d_pathconf=''
615 d_pause=''
616 d_pipe=''
617 d_poll=''
618 d_portable=''
619 d_procselfexe=''
620 procselfexe=''
621 d_old_pthread_create_joinable=''
622 old_pthread_create_joinable=''
623 d_pthread_atfork=''
624 d_pthread_attr_setscope=''
625 d_pthread_yield=''
626 d_sched_yield=''
627 sched_yield=''
628 d_qgcvt=''
629 d_random_r=''
630 random_r_proto=''
631 d_readdir64_r=''
632 readdir64_r_proto=''
633 d_readdir=''
634 d_rewinddir=''
635 d_seekdir=''
636 d_telldir=''
637 d_readdir_r=''
638 readdir_r_proto=''
639 d_readlink=''
640 d_readv=''
641 d_recvmsg=''
642 d_rename=''
643 d_rmdir=''
644 d_safebcpy=''
645 d_safemcpy=''
646 d_sanemcmp=''
647 d_sbrkproto=''
648 d_scalbnl=''
649 d_select=''
650 d_sem=''
651 d_semctl=''
652 d_semget=''
653 d_semop=''
654 d_sendmsg=''
655 d_setegid=''
656 d_seteuid=''
657 d_setgrent=''
658 d_setgrent_r=''
659 setgrent_r_proto=''
660 d_setgrps=''
661 d_sethent=''
662 d_sethostent_r=''
663 sethostent_r_proto=''
664 d_setitimer=''
665 d_setlinebuf=''
666 d_setlocale=''
667 d_setlocale_r=''
668 setlocale_r_proto=''
669 d_setnent=''
670 d_setnetent_r=''
671 setnetent_r_proto=''
672 d_setpent=''
673 d_setpgid=''
674 d_setpgrp2=''
675 d_bsdsetpgrp=''
676 d_setpgrp=''
677 d_setprior=''
678 d_setproctitle=''
679 d_setprotoent_r=''
680 setprotoent_r_proto=''
681 d_setpwent=''
682 d_setpwent_r=''
683 setpwent_r_proto=''
684 d_setregid=''
685 d_setresgid=''
686 d_setresuid=''
687 d_setreuid=''
688 d_setrgid=''
689 d_setruid=''
690 d_setsent=''
691 d_setservent_r=''
692 setservent_r_proto=''
693 d_setsid=''
694 d_setvbuf=''
695 d_sfio=''
696 usesfio=''
697 d_shm=''
698 d_shmat=''
699 d_shmatprototype=''
700 shmattype=''
701 d_shmctl=''
702 d_shmdt=''
703 d_shmget=''
704 d_sigaction=''
705 d_signbit=''
706 d_sigprocmask=''
707 d_sigsetjmp=''
708 usesitecustomize=''
709 d_snprintf=''
710 d_vsnprintf=''
711 d_sockatmark=''
712 d_sockatmarkproto=''
713 d_msg_ctrunc=''
714 d_msg_dontroute=''
715 d_msg_oob=''
716 d_msg_peek=''
717 d_msg_proxy=''
718 d_oldsock=''
719 d_scm_rights=''
720 d_socket=''
721 d_sockpair=''
722 sockethdr=''
723 socketlib=''
724 d_socklen_t=''
725 d_socks5_init=''
726 d_sprintf_returns_strlen=''
727 d_sqrtl=''
728 d_srand48_r=''
729 srand48_r_proto=''
730 d_srandom_r=''
731 srandom_r_proto=''
732 d_sresgproto=''
733 d_sresuproto=''
734 d_statblks=''
735 d_statfs_f_flags=''
736 d_statfs_s=''
737 d_fstatvfs=''
738 d_statvfs=''
739 d_stdio_cnt_lval=''
740 d_stdio_ptr_lval=''
741 d_stdio_ptr_lval_nochange_cnt=''
742 d_stdio_ptr_lval_sets_cnt=''
743 d_stdiobase=''
744 d_stdstdio=''
745 stdio_base=''
746 stdio_bufsiz=''
747 stdio_cnt=''
748 stdio_filbuf=''
749 stdio_ptr=''
750 d_index=''
751 d_strchr=''
752 d_strcoll=''
753 d_strctcpy=''
754 d_strerrm=''
755 d_strerror=''
756 d_sysernlst=''
757 d_syserrlst=''
758 d_strerror_r=''
759 strerror_r_proto=''
760 d_strftime=''
761 d_strlcat=''
762 d_strlcpy=''
763 d_strtod=''
764 d_strtol=''
765 d_strtold=''
766 d_strtoll=''
767 d_strtoq=''
768 d_strtoul=''
769 d_strtoull=''
770 d_strtouq=''
771 d_strxfrm=''
772 d_symlink=''
773 d_syscall=''
774 d_syscallproto=''
775 d_sysconf=''
776 d_system=''
777 d_tcgetpgrp=''
778 d_tcsetpgrp=''
779 d_telldirproto=''
780 d_time=''
781 timetype=''
782 d_asctime64=''
783 d_ctime64=''
784 d_difftime64=''
785 d_gmtime64=''
786 d_localtime64=''
787 d_mktime64=''
788 d_timegm=''
789 clocktype=''
790 d_times=''
791 d_tmpnam_r=''
792 tmpnam_r_proto=''
793 d_truncate=''
794 d_ttyname_r=''
795 ttyname_r_proto=''
796 d_tzname=''
797 d_u32align=''
798 d_ualarm=''
799 d_umask=''
800 d_semctl_semid_ds=''
801 d_semctl_semun=''
802 d_union_semun=''
803 d_unordered=''
804 d_unsetenv=''
805 d_usleep=''
806 d_usleepproto=''
807 d_ustat=''
808 d_pseudofork=''
809 d_vfork=''
810 usevfork=''
811 d_voidsig=''
812 signal_t=''
813 d_volatile=''
814 d_charvspr=''
815 d_vprintf=''
816 d_wait4=''
817 d_waitpid=''
818 d_wcstombs=''
819 d_wctomb=''
820 d_writev=''
821 dlext=''
822 cccdlflags=''
823 ccdlflags=''
824 dlsrc=''
825 ld=''
826 lddlflags=''
827 usedl=''
828 doublesize=''
829 ebcdic=''
830 fflushNULL=''
831 fflushall=''
832 fpossize=''
833 fpostype=''
834 gccansipedantic=''
835 gccosandvers=''
836 gccversion=''
837 gidformat=''
838 gidsign=''
839 gidsize=''
840 gidtype=''
841 groupstype=''
842 h_fcntl=''
843 h_sysfile=''
844 html1dir=''
845 html1direxp=''
846 installhtml1dir=''
847 html3dir=''
848 html3direxp=''
849 installhtml3dir=''
850 i_arpainet=''
851 i_assert=''
852 i_crypt=''
853 db_hashtype=''
854 db_prefixtype=''
855 db_version_major=''
856 db_version_minor=''
857 db_version_patch=''
858 i_db=''
859 i_dbm=''
860 i_rpcsvcdbm=''
861 d_dirnamlen=''
862 direntrytype=''
863 i_dirent=''
864 i_dld=''
865 i_dlfcn=''
866 i_fcntl=''
867 i_float=''
868 i_fp=''
869 i_fp_class=''
870 i_gdbm=''
871 d_grpasswd=''
872 i_grp=''
873 i_ieeefp=''
874 i_inttypes=''
875 i_langinfo=''
876 i_libutil=''
877 i_limits=''
878 i_locale=''
879 i_machcthr=''
880 i_malloc=''
881 i_mallocmalloc=''
882 i_math=''
883 i_memory=''
884 i_mntent=''
885 d_gdbm_ndbm_h_uses_prototypes=''
886 d_gdbmndbm_h_uses_prototypes=''
887 d_ndbm=''
888 d_ndbm_h_uses_prototypes=''
889 i_gdbm_ndbm=''
890 i_gdbmndbm=''
891 i_ndbm=''
892 i_netdb=''
893 i_neterrno=''
894 i_netinettcp=''
895 i_niin=''
896 i_sysin=''
897 i_poll=''
898 i_prot=''
899 i_pthread=''
900 d_pwage=''
901 d_pwchange=''
902 d_pwclass=''
903 d_pwcomment=''
904 d_pwexpire=''
905 d_pwgecos=''
906 d_pwpasswd=''
907 d_pwquota=''
908 i_pwd=''
909 i_sfio=''
910 i_shadow=''
911 i_socks=''
912 i_stddef=''
913 i_stdlib=''
914 i_string=''
915 strings=''
916 i_sunmath=''
917 i_sysaccess=''
918 i_sysdir=''
919 i_sysfile=''
920 d_voidtty=''
921 i_bsdioctl=''
922 i_sysfilio=''
923 i_sysioctl=''
924 i_syssockio=''
925 i_syslog=''
926 i_sysmman=''
927 i_sysmode=''
928 i_sysmount=''
929 i_sysndir=''
930 i_sysparam=''
931 i_syspoll=''
932 i_sysresrc=''
933 i_syssecrt=''
934 i_sysselct=''
935 i_sysstat=''
936 i_sysstatfs=''
937 i_sysstatvfs=''
938 i_systimes=''
939 i_systypes=''
940 i_sysuio=''
941 i_sysun=''
942 i_sysutsname=''
943 i_sysvfs=''
944 i_syswait=''
945 i_sgtty=''
946 i_termio=''
947 i_termios=''
948 d_tm_tm_gmtoff=''
949 d_tm_tm_zone=''
950 i_systime=''
951 i_systimek=''
952 i_time=''
953 timeincl=''
954 i_unistd=''
955 i_ustat=''
956 i_utime=''
957 i_values=''
958 i_stdarg=''
959 i_varargs=''
960 i_varhdr=''
961 i_vfork=''
962 d_inc_version_list=''
963 inc_version_list=''
964 inc_version_list_init=''
965 installprefix=''
966 installprefixexp=''
967 installstyle=''
968 installusrbinperl=''
969 intsize=''
970 longsize=''
971 shortsize=''
972 issymlink=''
973 libc=''
974 ldlibpthname=''
975 libperl=''
976 shrpenv=''
977 useshrplib=''
978 glibpth=''
979 libpth=''
980 loclibpth=''
981 plibpth=''
982 xlibpth=''
983 ignore_versioned_solibs=''
984 libs=''
985 libsdirs=''
986 libsfiles=''
987 libsfound=''
988 libspath=''
989 lns=''
990 d_PRIEUldbl=''
991 d_PRIFUldbl=''
992 d_PRIGUldbl=''
993 d_PRIeldbl=''
994 d_PRIfldbl=''
995 d_PRIgldbl=''
996 d_SCNfldbl=''
997 sPRIEUldbl=''
998 sPRIFUldbl=''
999 sPRIGUldbl=''
1000 sPRIeldbl=''
1001 sPRIfldbl=''
1002 sPRIgldbl=''
1003 sSCNfldbl=''
1004 lseeksize=''
1005 lseektype=''
1006 mad=''
1007 madlyh=''
1008 madlyobj=''
1009 madlysrc=''
1010 make_set_make=''
1011 d_mymalloc=''
1012 freetype=''
1013 mallocobj=''
1014 mallocsrc=''
1015 malloctype=''
1016 usemallocwrap=''
1017 usemymalloc=''
1018 installman1dir=''
1019 man1dir=''
1020 man1direxp=''
1021 man1ext=''
1022 installman3dir=''
1023 man3dir=''
1024 man3direxp=''
1025 man3ext=''
1026 modetype=''
1027 multiarch=''
1028 mydomain=''
1029 myhostname=''
1030 phostname=''
1031 c=''
1032 n=''
1033 d_eofnblk=''
1034 eagain=''
1035 o_nonblock=''
1036 rd_nodata=''
1037 need_va_copy=''
1038 netdb_hlen_type=''
1039 netdb_host_type=''
1040 netdb_name_type=''
1041 netdb_net_type=''
1042 groupcat=''
1043 hostcat=''
1044 passcat=''
1045 orderlib=''
1046 ranlib=''
1047 d_perl_otherlibdirs=''
1048 otherlibdirs=''
1049 package=''
1050 spackage=''
1051 pager=''
1052 api_revision=''
1053 api_subversion=''
1054 api_version=''
1055 api_versionstring=''
1056 patchlevel=''
1057 perl_patchlevel=''
1058 revision=''
1059 subversion=''
1060 version=''
1061 version_patchlevel_string=''
1062 perl5=''
1063 perladmin=''
1064 perlpath=''
1065 d_nv_preserves_uv=''
1066 d_nv_zero_is_allbits_zero=''
1067 i16size=''
1068 i16type=''
1069 i32size=''
1070 i32type=''
1071 i64size=''
1072 i64type=''
1073 i8size=''
1074 i8type=''
1075 ivsize=''
1076 ivtype=''
1077 nv_overflows_integers_at=''
1078 nv_preserves_uv_bits=''
1079 nvsize=''
1080 nvtype=''
1081 u16size=''
1082 u16type=''
1083 u32size=''
1084 u32type=''
1085 u64size=''
1086 u64type=''
1087 u8size=''
1088 u8type=''
1089 uvsize=''
1090 uvtype=''
1091 ivdformat=''
1092 nvEUformat=''
1093 nvFUformat=''
1094 nvGUformat=''
1095 nveformat=''
1096 nvfformat=''
1097 nvgformat=''
1098 uvXUformat=''
1099 uvoformat=''
1100 uvuformat=''
1101 uvxformat=''
1102 pidtype=''
1103 prefix=''
1104 prefixexp=''
1105 installprivlib=''
1106 privlib=''
1107 privlibexp=''
1108 prototype=''
1109 ptrsize=''
1110 d_PRIXU64=''
1111 d_PRId64=''
1112 d_PRIi64=''
1113 d_PRIo64=''
1114 d_PRIu64=''
1115 d_PRIx64=''
1116 sPRIXU64=''
1117 sPRId64=''
1118 sPRIi64=''
1119 sPRIo64=''
1120 sPRIu64=''
1121 sPRIx64=''
1122 d_quad=''
1123 quadkind=''
1124 quadtype=''
1125 uquadtype=''
1126 drand01=''
1127 randbits=''
1128 randfunc=''
1129 randseedtype=''
1130 seedfunc=''
1131 installscript=''
1132 scriptdir=''
1133 scriptdirexp=''
1134 selectminbits=''
1135 selecttype=''
1136 sh=''
1137 sig_count=''
1138 sig_name=''
1139 sig_name_init=''
1140 sig_num=''
1141 sig_num_init=''
1142 sig_size=''
1143 d_sitearch=''
1144 installsitearch=''
1145 sitearch=''
1146 sitearchexp=''
1147 installsitebin=''
1148 sitebin=''
1149 sitebinexp=''
1150 installsitehtml1dir=''
1151 sitehtml1dir=''
1152 sitehtml1direxp=''
1153 installsitehtml3dir=''
1154 sitehtml3dir=''
1155 sitehtml3direxp=''
1156 installsitelib=''
1157 sitelib=''
1158 sitelib_stem=''
1159 sitelibexp=''
1160 installsiteman1dir=''
1161 siteman1dir=''
1162 siteman1direxp=''
1163 installsiteman3dir=''
1164 siteman3dir=''
1165 siteman3direxp=''
1166 siteprefix=''
1167 siteprefixexp=''
1168 installsitescript=''
1169 sitescript=''
1170 sitescriptexp=''
1171 sizesize=''
1172 sizetype=''
1173 so=''
1174 socksizetype=''
1175 sharpbang=''
1176 shsharp=''
1177 spitshell=''
1178 src=''
1179 ssizetype=''
1180 startperl=''
1181 startsh=''
1182 stdchar=''
1183 d_stdio_stream_array=''
1184 stdio_stream_array=''
1185 sysman=''
1186 sGMTIME_max=''
1187 sGMTIME_min=''
1188 sLOCALTIME_max=''
1189 sLOCALTIME_min=''
1190 trnl=''
1191 uidformat=''
1192 uidsign=''
1193 uidsize=''
1194 uidtype=''
1195 archname64=''
1196 use64bitall=''
1197 use64bitint=''
1198 dtrace=''
1199 usedtrace=''
1200 usefaststdio=''
1201 ccflags_uselargefiles=''
1202 ldflags_uselargefiles=''
1203 libswanted_uselargefiles=''
1204 uselargefiles=''
1205 uselongdouble=''
1206 usemorebits=''
1207 usemultiplicity=''
1208 nm_opt=''
1209 nm_so_opt=''
1210 runnm=''
1211 usenm=''
1212 useperlio=''
1213 usesocks=''
1214 d_oldpthreads=''
1215 use5005threads=''
1216 useithreads=''
1217 usereentrant=''
1218 usethreads=''
1219 incpath=''
1220 mips_type=''
1221 usrinc=''
1222 d_vendorarch=''
1223 installvendorarch=''
1224 vendorarch=''
1225 vendorarchexp=''
1226 d_vendorbin=''
1227 installvendorbin=''
1228 vendorbin=''
1229 vendorbinexp=''
1230 installvendorhtml1dir=''
1231 vendorhtml1dir=''
1232 vendorhtml1direxp=''
1233 installvendorhtml3dir=''
1234 vendorhtml3dir=''
1235 vendorhtml3direxp=''
1236 d_vendorlib=''
1237 installvendorlib=''
1238 vendorlib=''
1239 vendorlib_stem=''
1240 vendorlibexp=''
1241 installvendorman1dir=''
1242 vendorman1dir=''
1243 vendorman1direxp=''
1244 installvendorman3dir=''
1245 vendorman3dir=''
1246 vendorman3direxp=''
1247 usevendorprefix=''
1248 vendorprefix=''
1249 vendorprefixexp=''
1250 d_vendorscript=''
1251 installvendorscript=''
1252 vendorscript=''
1253 vendorscriptexp=''
1254 versiononly=''
1255 defvoidused=''
1256 voidflags=''
1257 yacc=''
1258 yaccflags=''
1259 CONFIG=''
1260
1261 : Detect odd OSs
1262 define='define'
1263 undef='undef'
1264 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1265 rmlist=''
1266
1267 : We must find out about Eunice early
1268 eunicefix=':'
1269 if test -f /etc/unixtovms; then
1270         eunicefix=/etc/unixtovms
1271 fi
1272 if test -f /etc/unixtovms.exe; then
1273         eunicefix=/etc/unixtovms.exe
1274 fi
1275
1276 : Set executable suffix now -- needed before hints available
1277 if test -f "/libs/version.library"; then
1278 : Amiga OS
1279     _exe=""
1280 elif test -f "/system/gnu_library/bin/ar.pm"; then
1281 : Stratus VOS
1282     _exe=".pm"
1283 elif test -n "$DJGPP"; then
1284 : DOS DJGPP
1285     _exe=".exe"
1286 elif test -d c:/. -o -n "$is_os2" ; then
1287 : OS/2 or cygwin
1288     _exe=".exe"
1289 fi
1290
1291 groupstype=''
1292 i_whoami=''
1293 : Trailing extension.  Override this in a hint file, if needed.
1294 : Extra object files, if any, needed on this platform.
1295 archobjs=''
1296 archname=''
1297 libnames=''
1298 : change the next line if compiling for Xenix/286 on Xenix/386
1299 xlibpth='/usr/lib/386 /lib/386'
1300 : Possible local library directories to search.
1301 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1302 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1303
1304 : general looking path for locating libraries
1305 glibpth="/lib /usr/lib $xlibpth"
1306 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1307 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1308 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1309 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1310
1311 : Private path used by Configure to find libraries.  Its value
1312 : is prepended to libpth. This variable takes care of special
1313 : machines, like the mips.  Usually, it should be empty.
1314 plibpth=''
1315
1316 : default library list
1317 libswanted=''
1318 : some systems want to use only the non-versioned libso:s
1319 ignore_versioned_solibs=''
1320 : set usethreads on the Configure command line to enable threads.
1321 usereentrant='undef'
1322 : full support for void wanted by default
1323 defvoidused=15
1324
1325 : Possible local include directories to search.
1326 : Set locincpth to "" in a hint file to defeat local include searches.
1327 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1328 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1329 :
1330 : no include file wanted by default
1331 inclwanted=''
1332
1333 : Enable -DEBUGGING and -DDEBUGGING from the command line
1334 EBUGGING=''
1335 DEBUGGING=old
1336
1337 ccname=''
1338 ccversion=''
1339 perllibs=''
1340 : set useposix=false in your hint file to disable the POSIX extension.
1341 useposix=true
1342 : set useopcode=false in your hint file to disable the Opcode extension.
1343 useopcode=true
1344 archname64=''
1345 ccflags_uselargefiles=''
1346 ldflags_uselargefiles=''
1347 libswanted_uselargefiles=''
1348 : set usemultiplicity on the Configure command line to enable multiplicity.
1349 : set usesocks on the Configure command line to enable socks.
1350 : List of libraries we want.
1351 : If anyone needs extra -lxxx, put those in a hint file.
1352 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1353 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1354 : We probably want to search /usr/shlib before most other libraries.
1355 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1356 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1357 glibpth="/usr/shlib $glibpth"
1358 : Do not use vfork unless overridden by a hint file.
1359 usevfork=false
1360
1361 : Find the basic shell for Bourne shell scripts
1362 case "$sh" in
1363 '')
1364         case "$SYSTYPE" in
1365         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1366         *) xxx='/bin/sh';;
1367         esac
1368         if test -f "$xxx"; then
1369                 sh="$xxx"
1370         else
1371                 : Build up a list and do a single loop so we can 'break' out.
1372                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1373                 for xxx in sh bash ksh pdksh ash; do
1374                         for p in $pth; do
1375                                 try="$try ${p}/${xxx}"
1376                         done
1377                 done
1378                 for xxx in $try; do
1379                         if test -f "$xxx"; then
1380                                 sh="$xxx";
1381                                 break
1382                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1383                                 sh="$xxx";
1384                                 break
1385                         elif test -f "$xxx.exe"; then
1386                                 sh="$xxx";
1387                                 break
1388                         fi
1389                 done
1390         fi
1391         ;;
1392 esac
1393
1394 case "$sh" in
1395 '')     cat >&2 <<EOM
1396 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1397
1398 Usually it's in /bin/sh.  How did you even get this far?
1399 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1400 we'll try to straighten this all out.
1401 EOM
1402         exit 1
1403         ;;
1404 esac
1405
1406 : see if sh knows # comments
1407 if `$sh -c '#' >/dev/null 2>&1`; then
1408         shsharp=true
1409         spitshell=cat
1410         xcat=/bin/cat
1411         test -f $xcat$_exe || xcat=/usr/bin/cat
1412         if test ! -f $xcat$_exe; then
1413                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1414                         if test -f $p/cat$_exe; then
1415                                 xcat=$p/cat
1416                                 break
1417                         fi
1418                 done
1419                 if test ! -f $xcat$_exe; then
1420                         echo "Can't find cat anywhere!"
1421                         exit 1
1422                 fi
1423         fi
1424         echo "#!$xcat" >sharp
1425         $eunicefix sharp
1426         chmod +x sharp
1427         ./sharp > today 2>/dev/null
1428         if test -s today; then
1429                 sharpbang='#!'
1430         else
1431                 echo "#! $xcat" > sharp
1432                 $eunicefix sharp
1433                 chmod +x sharp
1434                 ./sharp > today 2>/dev/null
1435                 if test -s today; then
1436                         sharpbang='#! '
1437                 else
1438                         sharpbang=': use '
1439                 fi
1440         fi
1441 else
1442         echo " "
1443         echo "Your $sh doesn't grok # comments--I will strip them later on."
1444         shsharp=false
1445         cd ..
1446         echo "exec grep -v '^[  ]*#'" >spitshell
1447         chmod +x spitshell
1448         $eunicefix spitshell
1449         spitshell=`pwd`/spitshell
1450         cd UU
1451         echo "I presume that if # doesn't work, #! won't work either!"
1452         sharpbang=': use '
1453 fi
1454 rm -f sharp today
1455
1456 : figure out how to guarantee sh startup
1457 case "$startsh" in
1458 '') startsh=${sharpbang}${sh} ;;
1459 *)
1460 esac
1461 cat >sharp <<EOSS
1462 $startsh
1463 set abc
1464 test "$?abc" != 1
1465 EOSS
1466
1467 chmod +x sharp
1468 $eunicefix sharp
1469 if ./sharp; then
1470         : echo "Yup, it does."
1471 else
1472         echo "Hmm... '$startsh' does not guarantee sh startup..."
1473         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1474 fi
1475 rm -f sharp
1476
1477 : Save command line options in file UU/cmdline.opt for later use in
1478 : generating config.sh.
1479 cat > cmdline.opt <<EOSH
1480 : Configure command line arguments.
1481 config_arg0='$0'
1482 config_args='$*'
1483 config_argc=$#
1484 EOSH
1485 argn=1
1486 args_exp=''
1487 args_sep=''
1488 for arg in "$@"; do
1489         cat >>cmdline.opt <<EOSH
1490 config_arg$argn='$arg'
1491 EOSH
1492         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1493 $arg
1494 EOC
1495         arg_exp=`cat cmdl.opt`
1496         args_exp="$args_exp$args_sep'$arg_exp'"
1497         argn=`expr $argn + 1`
1498         args_sep=' '
1499 done
1500 rm -f cmdl.opt
1501
1502 : produce awk script to parse command line options
1503 cat >options.awk <<'EOF'
1504 BEGIN {
1505         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1506
1507         len = length(optstr);
1508         for (i = 1; i <= len; i++) {
1509                 c = substr(optstr, i, 1);
1510                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1511                 if (a == ":") {
1512                         arg[c] = 1;
1513                         i++;
1514                 }
1515                 opt[c] = 1;
1516         }
1517 }
1518 {
1519         expect = 0;
1520         str = $0;
1521         if (substr(str, 1, 1) != "-") {
1522                 printf("'%s'\n", str);
1523                 next;
1524         }
1525         len = length($0);
1526         for (i = 2; i <= len; i++) {
1527                 c = substr(str, i, 1);
1528                 if (!opt[c]) {
1529                         printf("-%s\n", substr(str, i));
1530                         next;
1531                 }
1532                 printf("-%s\n", c);
1533                 if (arg[c]) {
1534                         if (i < len)
1535                                 printf("'%s'\n", substr(str, i + 1));
1536                         else
1537                                 expect = 1;
1538                         next;
1539                 }
1540         }
1541 }
1542 END {
1543         if (expect)
1544                 print "?";
1545 }
1546 EOF
1547
1548 : process the command line options
1549 set X `for arg in "$@"; do echo "X$arg"; done |
1550         sed -e s/X// | awk -f options.awk`
1551 eval "set $*"
1552 shift
1553 rm -f options.awk
1554
1555 : set up default values
1556 fastread=''
1557 reuseval=false
1558 config_sh=''
1559 alldone=''
1560 error=''
1561 silent=''
1562 extractsh=''
1563 override=''
1564 knowitall=''
1565 rm -f optdef.sh posthint.sh
1566 cat >optdef.sh <<EOS
1567 $startsh
1568 EOS
1569
1570
1571 : option parsing
1572 while test $# -gt 0; do
1573         case "$1" in
1574         -d) shift; fastread=yes;;
1575         -e) shift; alldone=cont;;
1576         -f)
1577                 shift
1578                 cd ..
1579                 if test -r "$1"; then
1580                         config_sh="$1"
1581                 else
1582                         echo "$me: cannot read config file $1." >&2
1583                         error=true
1584                 fi
1585                 cd UU
1586                 shift;;
1587         --help|\
1588         -h) shift; error=true;;
1589         -r) shift; reuseval=true;;
1590         -s) shift; silent=true; realsilent=true;;
1591         -E) shift; alldone=exit;;
1592         -K) shift; knowitall=true;;
1593         -O) shift; override=true;;
1594         -S) shift; silent=true; extractsh=true;;
1595         -D)
1596                 shift
1597                 case "$1" in
1598                 *=)
1599                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1600                         echo "$me: ignoring -D $1" >&2
1601                         ;;
1602                 *=*) echo "$1" | \
1603                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1604                 *) echo "$1='define'" >> optdef.sh;;
1605                 esac
1606                 shift
1607                 ;;
1608         -U)
1609                 shift
1610                 case "$1" in
1611                 *=) echo "$1" >> optdef.sh;;
1612                 *=*)
1613                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1614                         echo "$me: ignoring -U $1" >&2
1615                         ;;
1616                 *) echo "$1='undef'" >> optdef.sh;;
1617                 esac
1618                 shift
1619                 ;;
1620         -A)
1621             shift
1622             xxx=''
1623             yyy="$1"
1624             zzz=''
1625             uuu=undef
1626             case "$yyy" in
1627             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1628                  case "$zzz" in
1629                  *:*) zzz='' ;;
1630                  *)   xxx=append
1631                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1632                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1633                  esac
1634                  ;;
1635             esac
1636             case "$xxx" in
1637             '')  case "$yyy" in
1638                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1639                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1640                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1641                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1642                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1643                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1644                  esac
1645                  ;;
1646             esac
1647             case "$xxx" in
1648             append)
1649                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1650             clear)
1651                 echo "$yyy=''"                  >> posthint.sh ;;
1652             define)
1653                 case "$zzz" in
1654                 '') zzz=define ;;
1655                 esac
1656                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1657             eval)
1658                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1659             prepend)
1660                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1661             undef)
1662                 case "$zzz" in
1663                 '') zzz="$uuu" ;;
1664                 esac
1665                 echo "$yyy=$zzz"                >> posthint.sh ;;
1666             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1667             esac
1668             shift
1669             ;;
1670         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1671             exit 0;;
1672         --) break;;
1673         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1674         *) break;;
1675         esac
1676 done
1677
1678 case "$error" in
1679 true)
1680         cat >&2 <<EOM
1681 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1682                  [-U symbol] [-U symbol=] [-A command:symbol...]
1683   -d : use defaults for all answers.
1684   -e : go on without questioning past the production of config.sh.
1685   -f : specify an alternate default configuration file.
1686   -h : print this help message and exit (with an error status).
1687   -r : reuse C symbols value if possible (skips costly nm extraction).
1688   -s : silent mode, only echoes questions and essential information.
1689   -D : define symbol to have some value:
1690          -D symbol         symbol gets the value 'define'
1691          -D symbol=value   symbol gets the value 'value'
1692        common used examples (see INSTALL for more info):
1693          -Duse64bitint            use 64bit integers
1694          -Duse64bitall            use 64bit integers and pointers
1695          -Dusethreads             use thread support
1696          -Dinc_version_list=none  do not include older perl trees in @INC
1697          -DEBUGGING=none          DEBUGGING options
1698          -Dcc=gcc                 choose your compiler
1699          -Dprefix=/opt/perl5      choose your destination
1700   -E : stop at the end of questions, after having produced config.sh.
1701   -K : do not use unless you know what you are doing.
1702   -O : let -D and -U override definitions from loaded configuration file.
1703   -S : perform variable substitutions on all .SH files (can mix with -f)
1704   -U : undefine symbol:
1705          -U symbol    symbol gets the value 'undef'
1706          -U symbol=   symbol gets completely empty
1707        e.g.:  -Uversiononly
1708   -A : manipulate symbol after the platform specific hints have been applied:
1709          -A append:symbol=value   append value to symbol
1710          -A symbol=value          like append:, but with a separating space
1711          -A define:symbol=value   define symbol to have value
1712          -A clear:symbol          define symbol to be ''
1713          -A define:symbol         define symbol to be 'define'
1714          -A eval:symbol=value     define symbol to be eval of value
1715          -A prepend:symbol=value  prepend value to symbol
1716          -A undef:symbol          define symbol to be 'undef'
1717          -A undef:symbol=         define symbol to be ''
1718        e.g.:  -A prepend:libswanted='cl pthread '
1719               -A ccflags=-DSOME_MACRO
1720   -V : print version number and exit (with a zero status).
1721 EOM
1722         exit 1
1723         ;;
1724 esac
1725
1726 : Sanity checks
1727 case "$fastread$alldone" in
1728 yescont|yesexit) ;;
1729 *)
1730         case "$extractsh" in
1731         true) ;;
1732         *)
1733                 if test ! -t 0; then
1734                         echo "Say 'sh Configure', not 'sh <Configure'"
1735                         exit 1
1736                 fi
1737                 ;;
1738         esac
1739         ;;
1740 esac
1741
1742 exec 4>&1
1743 case "$silent" in
1744 true) exec 1>/dev/null;;
1745 esac
1746
1747 : run the defines and the undefines, if any, but leave the file out there...
1748 touch optdef.sh
1749 . ./optdef.sh
1750 : create the posthint manipulation script and leave the file out there...
1751 touch posthint.sh
1752
1753 : set package name
1754 package='perl5'
1755 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1756 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1757 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1758 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1759 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1760 esac
1761
1762 : Some greps do not return status, grrr.
1763 echo "grimblepritz" >grimble
1764 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1765         contains=contains
1766 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1767         contains=grep
1768 else
1769         contains=contains
1770 fi
1771 rm -f grimble
1772 : the following should work in any shell
1773 case "$contains" in
1774 contains*)
1775         echo " "
1776         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1777         cat >contains <<'EOSS'
1778 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1779 EOSS
1780 chmod +x contains
1781 esac
1782
1783 : Find the path to the source tree
1784 case "$src" in
1785 '') case "$0" in
1786     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1787          case "$src" in
1788          /*)    ;;
1789          .)     ;;
1790          *)     src=`cd ../$src && pwd` ;;
1791          esac
1792          ;;
1793     *)   src='.';;
1794     esac;;
1795 esac
1796 case "$src" in
1797 '')     src=/
1798         rsrc=/
1799         ;;
1800 /*)     rsrc="$src";;
1801 *)      rsrc="../$src";;
1802 esac
1803 if test -f $rsrc/Configure && \
1804         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1805 then
1806    : found it, so we are ok.
1807 else
1808         rsrc=''
1809         for src in . .. ../.. ../../.. ../../../..; do
1810                 if test -f ../$src/Configure && \
1811                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1812                 then
1813                         rsrc=../$src
1814                         break
1815                 fi
1816         done
1817 fi
1818 case "$rsrc" in
1819 '')
1820         cat <<EOM >&4
1821
1822 Sorry, I can't seem to locate the source dir for $package.  Please start
1823 Configure with an explicit path -- i.e. /some/path/Configure.
1824
1825 EOM
1826         exit 1
1827         ;;
1828 ../.)   rsrc='..';;
1829 *)
1830         echo " "
1831         echo "Sources for $package found in \"$src\"." >&4
1832         ;;
1833 esac
1834
1835 : script used to extract .SH files with variable substitutions
1836 cat >extract <<'EOS'
1837 PERL_CONFIG_SH=true
1838 echo "Doing variable substitutions on .SH files..."
1839 if test -f MANIFEST; then
1840         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1841 else
1842         echo "(Looking for .SH files under the source directory.)"
1843         set x `(cd "$src"; find . -name "*.SH" -print)`
1844 fi
1845 shift
1846 case $# in
1847 0) set x `(cd "$src"; echo *.SH)`; shift;;
1848 esac
1849 if test ! -f "$src/$1"; then
1850         shift
1851 fi
1852 mkdir_p='
1853 name=$1;
1854 create="";
1855 while test $name; do
1856         if test ! -d "$name"; then
1857                 create="$name $create";
1858                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1859                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1860         else
1861                 name="";
1862         fi;
1863 done;
1864 for file in $create; do
1865         mkdir $file;
1866 done
1867 '
1868 for file in $*; do
1869         case "$src" in
1870         ".")
1871                 case "$file" in
1872                 */*)
1873                         dir=`expr X$file : 'X\(.*\)/'`
1874                         file=`expr X$file : 'X.*/\(.*\)'`
1875                         (cd "$dir" && . ./$file)
1876                         ;;
1877                 *)
1878                         . ./$file
1879                         ;;
1880                 esac
1881                 ;;
1882         *)
1883                 case "$file" in
1884                 */*)
1885                         dir=`expr X$file : 'X\(.*\)/'`
1886                         file=`expr X$file : 'X.*/\(.*\)'`
1887                         (set x $dir; shift; eval $mkdir_p)
1888                         sh <"$src/$dir/$file"
1889                         ;;
1890                 *)
1891                         sh <"$src/$file"
1892                         ;;
1893                 esac
1894                 ;;
1895         esac
1896 done
1897 if test -f "$src/config_h.SH"; then
1898         if test ! -f config.h; then
1899         : oops, they left it out of MANIFEST, probably, so do it anyway.
1900         . "$src/config_h.SH"
1901         fi
1902 fi
1903 EOS
1904
1905 : extract files and exit if asked to do so
1906 case "$extractsh" in
1907 true)
1908         case "$realsilent" in
1909         true) ;;
1910         *) exec 1>&4;;
1911         esac
1912         case "$config_sh" in
1913         '') config_sh='config.sh';;
1914         esac
1915         echo " "
1916         echo "Fetching answers from $config_sh..."
1917         cd ..
1918         . $config_sh
1919         test "$override" && . ./optdef.sh
1920         echo " "
1921         . UU/extract
1922         rm -rf UU
1923         echo "Extraction done."
1924         exit 0
1925         ;;
1926 esac
1927
1928 : Eunice requires " " instead of "", can you believe it
1929 echo " "
1930 : Here we go...
1931 echo "Beginning of configuration questions for $package."
1932
1933 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1934
1935 : first determine how to suppress newline on echo command
1936 echo " "
1937 echo "Checking echo to see how to suppress newlines..."
1938 (echo "hi there\c" ; echo " ") >.echotmp
1939 if $contains c .echotmp >/dev/null 2>&1 ; then
1940         echo "...using -n."
1941         n='-n'
1942         c=''
1943 else
1944         cat <<'EOM'
1945 ...using \c
1946 EOM
1947         n=''
1948         c='\c'
1949 fi
1950 echo $n "The star should be here-->$c"
1951 echo '*'
1952 rm -f .echotmp
1953
1954 : Now test for existence of everything in MANIFEST
1955 echo " "
1956 if test -f "$rsrc/MANIFEST"; then
1957         echo "First let's make sure your kit is complete.  Checking..." >&4
1958         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1959                 (split -l 50 2>/dev/null || split -50)
1960         rm -f missing
1961         tmppwd=`pwd`
1962         for filelist in x??; do
1963                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1964                         >/dev/null 2>>"$tmppwd/missing")
1965         done
1966         if test -s missing; then
1967                 cat missing >&4
1968                 cat >&4 <<'EOM'
1969
1970 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1971
1972 You have the option of continuing the configuration process, despite the
1973 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1974 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1975 and contact the author (perlbug@perl.org).
1976
1977 EOM
1978                 echo $n "Continue? [n] $c" >&4
1979                 read ans
1980                 case "$ans" in
1981                 y*)
1982                         echo "Continuing..." >&4
1983                         rm -f missing
1984                         ;;
1985                 *)
1986                         echo "ABORTING..." >&4
1987                         kill $$
1988                         ;;
1989                 esac
1990         else
1991                 echo "Looks good..."
1992         fi
1993 else
1994         echo "There is no MANIFEST file.  I hope your kit is complete !"
1995 fi
1996 rm -f missing x??
1997
1998 : Find the appropriate value for a newline for tr
1999 echo " "
2000 if test -n "$DJGPP"; then
2001        trnl='\012'
2002 fi
2003 if test X"$trnl" = X; then
2004         case "`echo foo|tr '\n' x 2>/dev/null`" in
2005         foox) trnl='\n' ;;
2006         esac
2007 fi
2008 if test X"$trnl" = X; then
2009         case "`echo foo|tr '\012' x 2>/dev/null`" in
2010         foox) trnl='\012' ;;
2011         esac
2012 fi
2013 if test X"$trnl" = X; then
2014        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2015        fooxy) trnl='\n\r' ;;
2016        esac
2017 fi
2018 if test X"$trnl" = X; then
2019         cat <<EOM >&2
2020
2021 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2022
2023 EOM
2024         exit 1
2025 fi
2026
2027 : compute the number of columns on the terminal for proper question formatting
2028 case "$COLUMNS" in
2029 '') COLUMNS='80';;
2030 esac
2031
2032 : set up the echo used in my read
2033 myecho="case \"\$xxxm\" in
2034 '') echo $n \"\$rp $c\" >&4;;
2035 *) case \"\$rp\" in
2036         '') echo $n \"[\$xxxm] $c\";;
2037         *)
2038                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2039                         echo \"\$rp\" >&4
2040                         echo $n \"[\$xxxm] $c\" >&4
2041                 else
2042                         echo $n \"\$rp [\$xxxm] $c\" >&4
2043                 fi
2044                 ;;
2045         esac;;
2046 esac"
2047
2048 : now set up to do reads with possible shell escape and default assignment
2049 cat <<EOSC >myread
2050 $startsh
2051 xxxm=\$dflt
2052 $myecho
2053 ans='!'
2054 case "\$fastread" in
2055 yes) case "\$dflt" in
2056         '') ;;
2057         *) ans='';
2058                 case "\$silent-\$rp" in
2059                 true-) ;;
2060                 *) echo " " >&4;;
2061                 esac;;
2062         esac;;
2063 *) case "\$silent" in
2064         true) case "\$rp" in
2065                 '') ans='';;
2066                 esac;;
2067         esac;;
2068 esac
2069 while expr "X\$ans" : "X!" >/dev/null; do
2070         read answ
2071         set x \$xxxm
2072         shift
2073         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2074         case  "\$answ" in
2075         "!")
2076                 sh 1>&4
2077                 echo " "
2078                 $myecho
2079                 ;;
2080         !*)
2081                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2082                 shift
2083                 sh 1>&4 -c "\$*"
2084                 echo " "
2085                 $myecho
2086                 ;;
2087         "\$ans")
2088                 case "\$ans" in
2089                 \\&*)
2090                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2091                         shift
2092                         case "\$1" in
2093                         -d)
2094                                 fastread=yes
2095                                 echo "(OK, I'll run with -d after this question.)" >&4
2096                                 ;;
2097                         -*)
2098                                 echo "*** Sorry, \$1 not supported yet." >&4
2099                                 ;;
2100                         esac
2101                         $myecho
2102                         ans=!
2103                         ;;
2104                 esac;;
2105         *)
2106                 case "\$aok" in
2107                 y)
2108                         echo "*** Substitution done -- please confirm."
2109                         xxxm="\$ans"
2110                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2111                         xxxm="\$ans"
2112                         ans=!
2113                         ;;
2114                 *)
2115                         echo "*** Error -- try again."
2116                         ans=!
2117                         ;;
2118                 esac
2119                 $myecho
2120                 ;;
2121         esac
2122         case "\$ans\$xxxm\$nostick" in
2123         '')
2124                 ans=!
2125                 $myecho
2126                 ;;
2127         esac
2128 done
2129 case "\$ans" in
2130 '') ans="\$xxxm";;
2131 esac
2132 EOSC
2133
2134 : create .config dir to save info across Configure sessions
2135 test -d ../.config || mkdir ../.config
2136 cat >../.config/README <<EOF
2137 This directory created by Configure to save information that should
2138 persist across sessions for $package.
2139
2140 You may safely delete it if you wish.
2141 EOF
2142
2143 : See if we are using a devel version and want that
2144 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2145 case "$usedevel" in
2146 $define|true|[yY]*)
2147     usedevel="$define" ;;
2148 *) case "$xversion" in
2149    *[13579])
2150         cat >&4 <<EOH
2151 *** WHOA THERE!!! ***
2152
2153     This is an UNSTABLE DEVELOPMENT release.
2154     The version of this $package distribution is $xversion, that is, odd,
2155     (as opposed to even) and that signifies a development release.
2156     If you want a maintenance release, you want an even-numbered version.
2157
2158     Do ***NOT*** install this into production use.
2159     Data corruption and crashes are possible.
2160
2161     It is most seriously suggested that you do not continue any further
2162     unless you want to help in developing and debugging Perl.
2163
2164     If you *still* want to build perl, you can answer 'y' now,
2165     or pass -Dusedevel to Configure.
2166
2167 EOH
2168         rp='Do you really want to continue?'
2169         dflt='n'
2170         . ./myread
2171         case "$ans" in
2172         [yY]) echo >&4 "Okay, continuing."
2173               usedevel="$define" ;;
2174         *) echo >&4 "Okay, bye."
2175            exit 1
2176            ;;
2177         esac
2178         ;;
2179     esac
2180     usedevel="$undef"
2181     ;;
2182 esac
2183 case "$usedevel" in
2184 $define|true|[yY]*)
2185         case "$versiononly" in
2186         '') versiononly="$define" ;;
2187         esac
2188         case "$installusrbinperl" in
2189         '') installusrbinperl="$undef" ;;
2190         esac
2191         ;;
2192 esac
2193
2194 : general instructions
2195 needman=true
2196 firsttime=true
2197 user=`(logname) 2>/dev/null`
2198 case "$user" in
2199 '') user=`whoami 2>&1`;;
2200 esac
2201 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2202         firsttime=false
2203         echo " "
2204         rp='Would you like to see the instructions?'
2205         dflt=n
2206         . ./myread
2207         case "$ans" in
2208         [yY]*) ;;
2209         *) needman=false;;
2210         esac
2211 fi
2212 if $needman; then
2213         cat <<EOH
2214
2215 This installation shell script will examine your system and ask you questions
2216 to determine how the perl5 package should be installed. If you get
2217 stuck on a question, you may use a ! shell escape to start a subshell or
2218 execute a command.  Many of the questions will have default answers in square
2219 brackets; typing carriage return will give you the default.
2220
2221 On some of the questions which ask for file or directory names you are allowed
2222 to use the ~name construct to specify the login directory belonging to "name",
2223 even if you don't have a shell which knows about that.  Questions where this is
2224 allowed will be marked "(~name ok)".
2225
2226 EOH
2227         rp=''
2228         dflt='Type carriage return to continue'
2229         . ./myread
2230         cat <<'EOH'
2231
2232 The prompter used in this script allows you to use shell variables and
2233 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2234 in the default answer, as if the default line was a set of arguments given to a
2235 script shell.  This means you may also use $* to repeat the whole default line,
2236 so you do not have to re-type everything to add something to the default.
2237
2238 Everytime there is a substitution, you will have to confirm.  If there is an
2239 error (e.g. an unmatched backtick), the default answer will remain unchanged
2240 and you will be prompted again.
2241
2242 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2243 the questions and use the computed defaults (or the previous answers if there
2244 was already a config.sh file). Type 'Configure -h' for a list of options.
2245 You may also start interactively and then answer '& -d' at any prompt to turn
2246 on the non-interactive behaviour for the remainder of the execution.
2247
2248 EOH
2249         . ./myread
2250         cat <<EOH
2251
2252 Much effort has been expended to ensure that this shell script will run on any
2253 Unix system.  If despite that it blows up on yours, your best bet is to edit
2254 Configure and run it again.  If you can't run Configure for some reason,
2255 you'll have to generate a config.sh file by hand.  Whatever problems you
2256 have, let me (perlbug@perl.org) know how I blew it.
2257
2258 This installation script affects things in two ways:
2259
2260 1) it may do direct variable substitutions on some of the files included
2261    in this kit.
2262 2) it builds a config.h file for inclusion in C programs.  You may edit
2263    any of these files as the need arises after running this script.
2264
2265 If you make a mistake on a question, there is no easy way to back up to it
2266 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2267 files.  Configure will offer to let you do this before it runs the SH files.
2268
2269 EOH
2270         dflt='Type carriage return to continue'
2271         . ./myread
2272         case "$firsttime" in
2273         true) echo $user >>../.config/instruct;;
2274         esac
2275 fi
2276
2277 : find out where common programs are
2278 echo " "
2279 echo "Locating common programs..." >&4
2280 cat <<EOSC >loc
2281 $startsh
2282 case \$# in
2283 0) exit 1;;
2284 esac
2285 thing=\$1
2286 shift
2287 dflt=\$1
2288 shift
2289 for dir in \$*; do
2290         case "\$thing" in
2291         .)
2292         if test -d \$dir/\$thing; then
2293                 echo \$dir
2294                 exit 0
2295         fi
2296         ;;
2297         *)
2298         for thisthing in \$dir/\$thing; do
2299                 : just loop through to pick last item
2300         done
2301         if test -f \$thisthing; then
2302                 echo \$thisthing
2303                 exit 0
2304         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2305                 echo \$thisthing
2306                 exit 0
2307         elif test -f \$dir/\$thing.exe; then
2308                 if test -n "$DJGPP"; then
2309                         echo \$dir/\$thing.exe
2310                 elif test "$eunicefix" != ":"; then
2311                         : on Eunice apparently
2312                         echo \$dir/\$thing
2313                 fi
2314                 exit 0
2315         fi
2316         ;;
2317         esac
2318 done
2319 echo \$dflt
2320 exit 1
2321 EOSC
2322 chmod +x loc
2323 $eunicefix loc
2324 loclist="
2325 awk
2326 cat
2327 chmod
2328 comm
2329 cp
2330 echo
2331 expr
2332 grep
2333 ls
2334 mkdir
2335 rm
2336 sed
2337 sort
2338 touch
2339 tr
2340 uniq
2341 "
2342 trylist="
2343 ar
2344 bison
2345 byacc
2346 cpp
2347 csh
2348 date
2349 egrep
2350 gmake
2351 gzip
2352 less
2353 ln
2354 make
2355 more
2356 nm
2357 nroff
2358 pg
2359 test
2360 uname
2361 zip
2362 "
2363 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2364 pth="$pth /lib /usr/lib"
2365 for file in $loclist; do
2366         eval xxx=\$$file
2367         case "$xxx" in
2368         /*|?:[\\/]*)
2369                 if test -f "$xxx"; then
2370                         : ok
2371                 else
2372                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2373                         xxx=`./loc $file $file $pth`
2374                 fi
2375                 ;;
2376         '') xxx=`./loc $file $file $pth`;;
2377         *) xxx=`./loc $xxx $xxx $pth`;;
2378         esac
2379         eval $file=$xxx$_exe
2380         eval _$file=$xxx
2381         case "$xxx" in
2382         /*)
2383                 echo $file is in $xxx.
2384                 ;;
2385         ?:[\\/]*)
2386                 echo $file is in $xxx.
2387                 ;;
2388         *)
2389                 echo "I don't know where '$file' is, and my life depends on it." >&4
2390                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2391                 exit 1
2392                 ;;
2393         esac
2394 done
2395 echo " "
2396 echo "Don't worry if any of the following aren't found..."
2397 say=offhand
2398 for file in $trylist; do
2399         eval xxx=\$$file
2400         case "$xxx" in
2401         /*|?:[\\/]*)
2402                 if test -f "$xxx"; then
2403                         : ok
2404                 else
2405                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2406                         xxx=`./loc $file $file $pth`
2407                 fi
2408                 ;;
2409         '') xxx=`./loc $file $file $pth`;;
2410         *) xxx=`./loc $xxx $xxx $pth`;;
2411         esac
2412         eval $file=$xxx$_exe
2413         eval _$file=$xxx
2414         case "$xxx" in
2415         /*)
2416                 echo $file is in $xxx.
2417                 ;;
2418         ?:[\\/]*)
2419                 echo $file is in $xxx.
2420                 ;;
2421         *)
2422                 echo "I don't see $file out there, $say."
2423                 say=either
2424                 ;;
2425         esac
2426 done
2427 case "$egrep" in
2428 egrep)
2429         echo "Substituting grep for egrep."
2430         egrep=$grep
2431         _egrep=$grep
2432         ;;
2433 esac
2434 case "$ln" in
2435 ln)
2436         echo "Substituting cp for ln."
2437         ln=$cp
2438         _ln=$cp
2439         ;;
2440 esac
2441 case "$make" in
2442 make)
2443         case "$gmake" in
2444         gmake)
2445         echo "I can't find make or gmake, and my life depends on it." >&4
2446         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2447         exit 1
2448         ;;
2449         esac
2450         ;;
2451 esac
2452 case "$gmake" in
2453 gmake)  ;;
2454 *)      # We can't have osname yet.
2455         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2456                 # Assume that gmake, if found, is definitely GNU make
2457                 # and prefer it over the system make.
2458                 echo "Substituting gmake for make."
2459                 make=$gmake
2460                 _make=$gmake
2461         fi
2462         ;;
2463 esac
2464 case "$test" in
2465 test)
2466         echo "Hopefully test is built into your sh."
2467         ;;
2468 *)
2469         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2470                 echo "Using the test built into your sh."
2471                 test=test
2472                 _test=test
2473         fi
2474         ;;
2475 esac
2476 case "$echo" in
2477 echo)
2478         echo "Hopefully echo is built into your sh."
2479         ;;
2480 '') ;;
2481 *)
2482         echo " "
2483 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2484         $echo $n "hi there$c" >foo1
2485         echo $n "hi there$c" >foo2
2486         if cmp foo1 foo2 >/dev/null 2>&1; then
2487                 echo "They are compatible.  In fact, they may be identical."
2488         else
2489                 case "$n" in
2490                 '-n') n='' c='\c';;
2491                 *) n='-n' c='';;
2492                 esac
2493                 cat <<FOO
2494 They are not compatible!  You are probably running ksh on a non-USG system.
2495 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2496 have echo built in and we may have to run some Bourne shell scripts.  That
2497 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2498
2499 FOO
2500                 $echo $n "The star should be here-->$c"
2501                 $echo "*"
2502         fi
2503         $rm -f foo1 foo2
2504         ;;
2505 esac
2506
2507 # This question was auctioned at YAPC::Europe-2007 in Vienna
2508 # I never promised you could answer it. I only auctioned the question.
2509 cat <<FOO
2510 The following message is sponsored by
2511
2512   Dresden.pm<--The stars should be here.
2513
2514 Dear Perl user, system administrator or package
2515 maintainer, the Perl community sends greetings to
2516 you. Do you (emblematical) greet back [Y/n]? n
2517
2518 FOO
2519
2520 : Check what type of C compiler we use
2521 cat <<EOS >trygcc
2522 $startsh
2523 EOS
2524 cat <<'EOSC' >>trygcc
2525 case "$cc" in
2526 '') ;;
2527 *)  $rm -f try try.*
2528     $cat >try.c <<EOM
2529 int main(int argc, char *argv[]) {
2530   return 0;
2531 }
2532 EOM
2533     if $cc -o try $ccflags $ldflags try.c; then
2534        :
2535     else
2536         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2537         despair=yes
2538         trygcc=yes
2539         case "$cc" in
2540         *gcc*) trygcc=no ;;
2541         esac
2542         # Skip this test because it gives a false match on output like:
2543         #    ./trygcc: line 23: cc: command not found
2544         # case "`$cc -v -c try.c 2>&1`" in
2545         # *gcc*) trygcc=no ;;
2546         # esac
2547         if $test X"$trygcc" = Xyes; then
2548             if gcc -o try -c try.c; then
2549                 echo " "
2550                 echo "You seem to have a working gcc, though." >&4
2551                 # Switching compilers may undo the work of hints files.
2552                 # The most common problem is -D_REENTRANT for threads.
2553                 # This heuristic catches that case, but gets false positives
2554                 # if -Dusethreads was not actually specified.  Better to
2555                 # bail out here with a useful message than fail 
2556                 # mysteriously later. Should we perhaps just try to
2557                 # re-invoke Configure -Dcc=gcc config_args ?
2558                 if $test -f usethreads.cbu; then
2559                         $cat >&4 <<EOM 
2560
2561 *** However, any setting of the C compiler flags (e.g. for thread support)
2562 *** will be lost.  It may be necessary for you to restart Configure and
2563 *** add -Dcc=gcc to your Configure command line.
2564
2565 EOM
2566                         rp="Would you like to go ahead and try gcc anyway?"
2567                         dflt=n
2568                 else
2569                         rp="Would you like to use it?"
2570                         dflt=y
2571                 fi
2572                 if $test -f myread; then
2573                     . ./myread
2574                 else
2575                     if $test -f UU/myread; then
2576                         . ./UU/myread
2577                     else
2578                         echo "Cannot find myread, sorry.  Aborting." >&2
2579                         exit 1
2580                     fi
2581                 fi  
2582                 case "$ans" in
2583                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2584                 esac
2585             fi
2586         fi
2587     fi
2588     $rm -f try try.*
2589     ;;
2590 esac
2591 EOSC
2592
2593 cat <<EOS >checkcc
2594 $startsh
2595 EOS
2596 cat <<'EOSC' >>checkcc
2597 case "$cc" in        
2598 '') ;;
2599 *)  $rm -f try try.*              
2600     $cat >try.c <<EOM
2601 int main(int argc, char *argv[]) {
2602   return 0;
2603 }
2604 EOM
2605     if $cc -o try $ccflags $ldflags try.c; then
2606        :
2607     else
2608         if $test X"$despair" = Xyes; then
2609            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2610         fi
2611         $cat >&4 <<EOM         
2612 You need to find a working C compiler.
2613 Either (purchase and) install the C compiler supplied by your OS vendor,
2614 or for a free C compiler try http://gcc.gnu.org/
2615 I cannot continue any further, aborting.
2616 EOM
2617         exit 1
2618     fi
2619     $rm -f try try.*
2620     ;;
2621 esac
2622 EOSC
2623
2624 : determine whether symbolic links are supported
2625 echo " "
2626 $touch blurfl
2627 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2628         echo "Symbolic links are supported." >&4
2629         lns="$ln -s"
2630 else
2631         echo "Symbolic links are NOT supported." >&4
2632         lns="$ln"
2633 fi
2634 $rm -f blurfl sym
2635
2636 : determine whether symbolic links are supported
2637 echo " "
2638 case "$lns" in
2639 *"ln"*" -s")
2640         echo "Checking how to test for symbolic links..." >&4
2641         $lns blurfl sym
2642         if $test "X$issymlink" = X; then
2643                 case "$newsh" in
2644                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2645                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2646                 esac
2647                 if test $? = 0; then
2648                         issymlink="test -h"
2649                 else
2650                         echo "Your builtin 'test -h' may be broken." >&4
2651                         case "$test" in
2652                         /*)     ;;
2653                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2654                                 for p in $pth
2655                                 do
2656                                         if test -f "$p/$test"; then
2657                                                 test="$p/$test"
2658                                                 break
2659                                         fi
2660                                 done
2661                                 ;;
2662                         esac
2663                         case "$test" in
2664                         /*)
2665                                 echo "Trying external '$test -h'." >&4
2666                                 issymlink="$test -h"
2667                                 if $test ! -h sym >/dev/null 2>&1; then
2668                                         echo "External '$test -h' is broken, too." >&4
2669                                         issymlink=''
2670                                 fi
2671                                 ;;
2672                         *)      issymlink='' ;;
2673                         esac
2674                 fi              
2675         fi
2676         if $test "X$issymlink" = X; then
2677                 if $test -L sym 2>/dev/null; then
2678                         issymlink="$test -L"
2679                         echo "The builtin '$test -L' worked." >&4
2680                 fi
2681         fi
2682         if $test "X$issymlink" != X; then
2683                 echo "You can test for symbolic links with '$issymlink'." >&4
2684         else
2685                 echo "I do not know how you can test for symbolic links." >&4
2686         fi
2687         $rm -f blurfl sym
2688         ;;
2689 *)      echo "No symbolic links, so not testing for their testing..." >&4
2690         ;;
2691 esac
2692 echo " "
2693
2694 : Make symlinks util
2695 case "$mksymlinks" in
2696 $define|true|[yY]*)
2697         case "$src" in
2698         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2699                 exit 1
2700                 ;;
2701         *)      case "$lns:$issymlink" in
2702                 *"ln"*" -s:"*"test -"?)
2703                         echo "Creating the symbolic links..." >&4
2704                         echo "(First creating the subdirectories...)" >&4
2705                         cd ..
2706                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2707                                 read directory
2708                                 test -z "$directory" && break
2709                                 mkdir -p $directory
2710                         done
2711                         # Sanity check 1.
2712                         if test ! -d t/base; then
2713                                 echo "Failed to create the subdirectories.  Aborting." >&4
2714                                 exit 1
2715                         fi
2716                         echo "(Then creating the symlinks...)" >&4
2717                         awk '{print $1}' $src/MANIFEST | while true; do
2718                                 read filename
2719                                 test -z "$filename" && break
2720                                 if test -f $filename; then
2721                                         if $issymlink $filename; then
2722                                                 rm -f $filename
2723                                         fi
2724                                 fi
2725                                 if test -f $filename; then
2726                                         echo "$filename already exists, not symlinking."
2727                                 else
2728                                         ln -s $src/$filename $filename
2729                                 fi
2730                         done
2731                         # Sanity check 2.
2732                         if test ! -f t/base/lex.t; then
2733                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2734                                 exit 1
2735                         fi
2736                         cd UU
2737                         ;;
2738                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2739                         ;;
2740                 esac
2741                 ;;
2742         esac
2743         ;;
2744 esac
2745
2746 : Check for Cross-Compilation
2747 case "$usecrosscompile" in
2748 $define|true|[yY]*)
2749         $echo "Cross-compiling..."
2750         croak=''
2751         case "$cc" in
2752         *-*-gcc) # A cross-compiling gcc, probably.
2753             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2754             ar=$targetarch-ar
2755             # leave out ld, choosing it is more complex
2756             nm=$targetarch-nm
2757             ranlib=$targetarch-ranlib
2758             $echo 'extern int foo;' > try.c
2759             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2760             shift
2761             if $test $# -gt 0; then
2762                 incpth="$incpth $*"
2763                 incpth="`$echo $incpth|$sed 's/^ //'`"
2764                 echo "Guessing incpth '$incpth'." >&4
2765                 for i in $*; do
2766                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2767                     if $test -d $j; then
2768                         libpth="$libpth $j"
2769                     fi
2770                 done   
2771                 libpth="`$echo $libpth|$sed 's/^ //'`"
2772                 echo "Guessing libpth '$libpth'." >&4
2773             fi
2774             $rm -f try.c
2775             ;;
2776         esac
2777         case "$targetarch" in
2778         '') echo "Targetarch not defined." >&4; croak=y ;;
2779         *)  echo "Using targetarch $targetarch." >&4 ;;
2780         esac
2781         case "$incpth" in
2782         '') echo "Incpth not defined." >&4; croak=y ;;
2783         *)  echo "Using incpth '$incpth'." >&4 ;;
2784         esac
2785         case "$libpth" in
2786         '') echo "Libpth not defined." >&4; croak=y ;;
2787         *)  echo "Using libpth '$libpth'." >&4 ;;
2788         esac
2789         case "$usrinc" in
2790         '') for i in $incpth; do
2791                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2792                     usrinc=$i
2793                     echo "Guessing usrinc $usrinc." >&4
2794                     break
2795                 fi
2796             done
2797             case "$usrinc" in
2798             '') echo "Usrinc not defined." >&4; croak=y ;;
2799             esac
2800             ;;
2801         *)  echo "Using usrinc $usrinc." >&4 ;;
2802         esac
2803         case "$targethost" in
2804         '') echo "Targethost not defined." >&4; croak=y ;;
2805         *)  echo "Using targethost $targethost." >&4
2806         esac
2807         locincpth=' '
2808         loclibpth=' '
2809         case "$croak" in
2810         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2811         esac
2812         case "$src" in
2813         /*) run=$src/Cross/run
2814             targetmkdir=$src/Cross/mkdir
2815             to=$src/Cross/to
2816             from=$src/Cross/from
2817             ;;
2818         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2819             run=$pwd/Cross/run
2820             targetmkdir=$pwd/Cross/mkdir
2821             to=$pwd/Cross/to
2822             from=$pwd/Cross/from
2823             ;;
2824         esac
2825         case "$targetrun" in
2826         '') targetrun=ssh ;;
2827         esac
2828         case "$targetto" in
2829         '') targetto=scp ;;
2830         esac
2831         case "$targetfrom" in
2832         '') targetfrom=scp ;;
2833         esac
2834         run=$run-$targetrun
2835         to=$to-$targetto
2836         from=$from-$targetfrom
2837         case "$targetdir" in
2838         '')  targetdir=/tmp
2839              echo "Guessing targetdir $targetdir." >&4
2840              ;;
2841         esac
2842         case "$targetuser" in
2843         '')  targetuser=root
2844              echo "Guessing targetuser $targetuser." >&4
2845              ;;
2846         esac
2847         case "$targetfrom" in
2848         scp)    q=-q ;;
2849         *)      q='' ;;
2850         esac
2851         case "$targetrun" in
2852         ssh|rsh)
2853             cat >$run <<EOF
2854 #!/bin/sh
2855 case "\$1" in
2856 -cwd)
2857   shift
2858   cwd=\$1
2859   shift
2860   ;;
2861 esac
2862 case "\$cwd" in
2863 '') cwd=$targetdir ;;
2864 esac
2865 exe=\$1
2866 shift
2867 if $test ! -f \$exe.xok; then
2868   $to \$exe
2869   $touch \$exe.xok
2870 fi
2871 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2872 EOF
2873             ;;
2874         *)  echo "Unknown targetrun '$targetrun'" >&4
2875             exit 1
2876             ;;
2877         esac
2878         case "$targetmkdir" in
2879         */Cross/mkdir)
2880             cat >$targetmkdir <<EOF
2881 #!/bin/sh
2882 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2883 EOF
2884             $chmod a+rx $targetmkdir
2885             ;;
2886         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2887             exit 1
2888             ;;
2889         esac
2890         case "$targetto" in
2891         scp|rcp)
2892             cat >$to <<EOF
2893 #!/bin/sh
2894 for f in \$@
2895 do
2896   case "\$f" in
2897   /*)
2898     $targetmkdir \`dirname \$f\`
2899     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2900     ;;
2901   *)
2902     $targetmkdir $targetdir/\`dirname \$f\`
2903     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2904     ;;
2905   esac
2906 done
2907 exit 0
2908 EOF
2909             ;;
2910         cp) cat >$to <<EOF
2911 #!/bin/sh
2912 for f in \$@
2913 do
2914   case "\$f" in
2915   /*)
2916     $mkdir -p $targetdir/\`dirname \$f\`
2917     $cp \$f $targetdir/\$f || exit 1
2918     ;;
2919   *)
2920     $targetmkdir $targetdir/\`dirname \$f\`
2921     $cp \$f $targetdir/\$f || exit 1
2922     ;;
2923   esac
2924 done
2925 exit 0
2926 EOF
2927             ;;
2928         *)  echo "Unknown targetto '$targetto'" >&4
2929             exit 1
2930             ;;
2931         esac
2932         case "$targetfrom" in
2933         scp|rcp)
2934           cat >$from <<EOF
2935 #!/bin/sh
2936 for f in \$@
2937 do
2938   $rm -f \$f
2939   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2940 done
2941 exit 0
2942 EOF
2943             ;;
2944         cp) cat >$from <<EOF
2945 #!/bin/sh
2946 for f in \$@
2947 do
2948   $rm -f \$f
2949   cp $targetdir/\$f . || exit 1
2950 done
2951 exit 0
2952 EOF
2953             ;;
2954         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2955             exit 1
2956             ;;
2957         esac
2958         if $test ! -f $run; then
2959             echo "Target 'run' script '$run' not found." >&4
2960         else
2961             $chmod a+rx $run
2962         fi
2963         if $test ! -f $to; then
2964             echo "Target 'to' script '$to' not found." >&4
2965         else
2966             $chmod a+rx $to
2967         fi
2968         if $test ! -f $from; then
2969             echo "Target 'from' script '$from' not found." >&4
2970         else
2971             $chmod a+rx $from
2972         fi
2973         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2974             exit 1
2975         fi
2976         cat >&4 <<EOF
2977 Using '$run' for remote execution,
2978 and '$from' and '$to'
2979 for remote file transfer.
2980 EOF
2981         ;;
2982 *)      run=''
2983         to=:
2984         from=:
2985         usecrosscompile='undef'
2986         targetarch=''
2987         ;;
2988 esac
2989
2990 : see whether [:lower:] and [:upper:] are supported character classes
2991 echo " "
2992 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2993 ABYZ)
2994         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2995         up='[:upper:]'
2996         low='[:lower:]'
2997         ;;
2998 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2999         # (0xd9 and 0xe2), therefore that is a nice testing point.
3000         if test "X$up" = X -o "X$low" = X; then
3001             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3002             rs) up='[A-Z]'
3003                 low='[a-z]'
3004                 ;;
3005             esac
3006         fi
3007         if test "X$up" = X -o "X$low" = X; then
3008             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3009             rs) up='A-Z'
3010                 low='a-z'
3011                 ;;
3012             esac
3013         fi
3014         if test "X$up" = X -o "X$low" = X; then
3015             case "`echo RS | od -x 2>/dev/null`" in
3016             *D9E2*|*d9e2*)
3017                 echo "Hey, this might be EBCDIC." >&4
3018                 if test "X$up" = X -o "X$low" = X; then
3019                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3020                     rs) up='[A-IJ-RS-Z]'
3021                         low='[a-ij-rs-z]'
3022                         ;;
3023                     esac
3024                 fi
3025                 if test "X$up" = X -o "X$low" = X; then
3026                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3027                     rs) up='A-IJ-RS-Z'
3028                         low='a-ij-rs-z'
3029                         ;;
3030                     esac
3031                 fi
3032                 ;;
3033             esac
3034         fi
3035 esac
3036 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3037 rs)
3038     echo "Using $up and $low to convert case." >&4
3039     ;;
3040 *)
3041     echo "I don't know how to translate letters from upper to lower case." >&4
3042     echo "Your tr is not acting any way I know of." >&4
3043     exit 1
3044     ;;
3045 esac
3046 : set up the translation script tr, must be called with ./tr of course
3047 cat >tr <<EOSC
3048 $startsh
3049 case "\$1\$2" in
3050 '[A-Z][a-z]') exec $tr '$up' '$low';;
3051 '[a-z][A-Z]') exec $tr '$low' '$up';;
3052 esac
3053 exec $tr "\$@"
3054 EOSC
3055 chmod +x tr
3056 $eunicefix tr
3057
3058 : Try to determine whether config.sh was made on this system
3059 case "$config_sh" in
3060 '')
3061 myuname=`$uname -a 2>/dev/null`
3062 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3063 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3064 # because the A-Z/a-z are not consecutive.
3065 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3066         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3067 newmyuname="$myuname"
3068 dflt=n
3069 case "$knowitall" in
3070 '')
3071         if test -f ../config.sh; then
3072                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3073                         eval "`grep myuname= ../config.sh`"
3074                 fi
3075                 if test "X$myuname" = "X$newmyuname"; then
3076                         dflt=y
3077                 fi
3078         fi
3079         ;;
3080 *) dflt=y;;
3081 esac
3082
3083 : Get old answers from old config file if Configure was run on the
3084 : same system, otherwise use the hints.
3085 hint=default
3086 cd ..
3087 if test -f config.sh; then
3088         echo " "
3089         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3090         . UU/myread
3091         case "$ans" in
3092         n*|N*) echo "OK, I'll ignore it."
3093                 mv config.sh config.sh.old
3094                 myuname="$newmyuname"
3095                 ;;
3096         *)  echo "Fetching default answers from your old config.sh file..." >&4
3097                 tmp_n="$n"
3098                 tmp_c="$c"
3099                 tmp_sh="$sh"
3100                 . ./config.sh
3101                 cp config.sh UU
3102                 n="$tmp_n"
3103                 c="$tmp_c"
3104                 : Older versions did not always set $sh.  Catch re-use of such
3105                 : an old config.sh.
3106                 case "$sh" in
3107                 '') sh="$tmp_sh" ;;
3108                 esac
3109                 hint=previous
3110                 ;;
3111         esac
3112 fi
3113 . ./UU/checkcc
3114 if test ! -f config.sh; then
3115         $cat <<EOM
3116
3117 First time through, eh?  I have some defaults handy for some systems
3118 that need some extra help getting the Configure answers right:
3119
3120 EOM
3121         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3122         dflt=''
3123         : Half the following guesses are probably wrong... If you have better
3124         : tests or hints, please send them to perlbug@perl.org
3125         : The metaconfig authors would also appreciate a copy...
3126         $test -f /irix && osname=irix
3127         $test -f /xenix && osname=sco_xenix
3128         $test -f /dynix && osname=dynix
3129         $test -f /dnix && osname=dnix
3130         $test -f /lynx.os && osname=lynxos
3131         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3132         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3133         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3134         $test -f /bin/mips && /bin/mips && osname=mips
3135         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3136                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3137         $test -d /usr/apollo/bin && osname=apollo
3138         $test -f /etc/saf/_sactab && osname=svr4
3139         $test -d /usr/include/minix && osname=minix
3140         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3141         if $test -d /MachTen -o -d /MachTen_Folder; then
3142                 osname=machten
3143                 if $test -x /sbin/version; then
3144                         osvers=`/sbin/version | $awk '{print $2}' |
3145                         $sed -e 's/[A-Za-z]$//'`
3146                 elif $test -x /usr/etc/version; then
3147                         osvers=`/usr/etc/version | $awk '{print $2}' |
3148                         $sed -e 's/[A-Za-z]$//'`
3149                 else
3150                         osvers="$2.$3"
3151                 fi
3152         fi
3153
3154         $test -f /sys/posix.dll &&
3155                 $test -f /usr/bin/what &&
3156                 set X `/usr/bin/what /sys/posix.dll` &&
3157                 $test "$3" = UWIN &&
3158                 osname=uwin &&
3159                 osvers="$5"
3160
3161         if $test -f $uname; then
3162                 set X $myuname
3163                 shift
3164
3165                 case "$5" in
3166                 fps*) osname=fps ;;
3167                 mips*)
3168                         case "$4" in
3169                         umips) osname=umips ;;
3170                         *) osname=mips ;;
3171                         esac;;
3172                 [23]100) osname=mips ;;
3173                 next*) osname=next ;;
3174                 i386*)
3175                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3176                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3177                                 osname='sco'
3178                                 osvers=$tmp
3179                         elif $test -f /etc/kconfig; then
3180                                 osname=isc
3181                                 if test "$lns" = "$ln -s"; then
3182                                         osvers=4
3183                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3184                                         osvers=3
3185                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3186                                         osvers=2
3187                                 fi
3188                         fi
3189                         tmp=''
3190                         ;;
3191                 pc*)
3192                         if test -n "$DJGPP"; then
3193                                 osname=dos
3194                                 osvers=djgpp
3195                         fi
3196                         ;;
3197                 esac
3198
3199                 case "$1" in
3200                 aix) osname=aix
3201                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3202                         case "$tmp" in
3203                         # oslevel can fail with:
3204                         # oslevel: Unable to acquire lock.
3205                         *not\ found) osvers="$4"."$3" ;;
3206                         '<3240'|'<>3240') osvers=3.2.0 ;;
3207                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3208                         '=3250'|'>3250') osvers=3.2.5 ;;
3209                         *) osvers=$tmp;;
3210                         esac
3211                         ;;
3212                 bsd386) osname=bsd386
3213                         osvers=`$uname -r`
3214                         ;;
3215                 cygwin*) osname=cygwin
3216                         osvers="$3"
3217                         ;;
3218                 *dc.osx) osname=dcosx
3219                         osvers="$3"
3220                         ;;
3221                 dnix) osname=dnix
3222                         osvers="$3"
3223                         ;;
3224                 domainos) osname=apollo
3225                         osvers="$3"
3226                         ;;
3227                 dgux)   osname=dgux
3228                         osvers="$3"
3229                         ;;
3230                 dragonfly) osname=dragonfly
3231                         osvers="$3"
3232                         ;;
3233                 dynixptx*) osname=dynixptx
3234                         osvers=`echo "$4"|sed 's/^v//'`
3235                         ;;
3236                 freebsd) osname=freebsd
3237                         osvers="$3" ;;
3238                 genix)  osname=genix ;;
3239                 gnu)    osname=gnu
3240                         osvers="$3" ;;
3241                 hp*)    osname=hpux
3242                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3243                         ;;
3244                 irix*)  osname=irix
3245                         case "$3" in
3246                         4*) osvers=4 ;;
3247                         5*) osvers=5 ;;
3248                         *)      osvers="$3" ;;
3249                         esac
3250                         ;;
3251                 linux)  osname=linux
3252                         case "$3" in
3253                         *)      osvers="$3" ;;
3254                         esac
3255                         ;;
3256                 MiNT)   osname=mint
3257                         ;;
3258                 netbsd*) osname=netbsd
3259                         osvers="$3"
3260                         ;;
3261                 news-os) osvers="$3"
3262                         case "$3" in
3263                         4*) osname=newsos4 ;;
3264                         *) osname=newsos ;;
3265                         esac
3266                         ;;
3267                 next*) osname=next ;;
3268                 nonstop-ux) osname=nonstopux ;;
3269                 openbsd) osname=openbsd
3270                         osvers="$3"
3271                         ;;
3272                 os2)    osname=os2
3273                         osvers="$4"
3274                         ;;
3275                 POSIX-BC | posix-bc ) osname=posix-bc
3276                         osvers="$3"
3277                         ;;
3278                 powerux | power_ux | powermax_os | powermaxos | \
3279                 powerunix | power_unix) osname=powerux
3280                         osvers="$3"
3281                         ;;
3282                 qnx) osname=qnx
3283                         osvers="$4"
3284                         ;;
3285                 solaris) osname=solaris
3286                         case "$3" in
3287                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3288                         *)      osvers="$3" ;;
3289                         esac
3290                         ;;
3291                 sunos) osname=sunos
3292                         case "$3" in
3293                         5*) osname=solaris
3294                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3295                         *)      osvers="$3" ;;
3296                         esac
3297                         ;;
3298                 titanos) osname=titanos
3299                         case "$3" in
3300                         1*) osvers=1 ;;
3301                         2*) osvers=2 ;;
3302                         3*) osvers=3 ;;
3303                         4*) osvers=4 ;;
3304                         *)      osvers="$3" ;;
3305                         esac
3306                         ;;
3307                 ultrix) osname=ultrix
3308                         osvers="$3"
3309                         ;;
3310                 osf1|mls+)      case "$5" in
3311                                 alpha)
3312                                         osname=dec_osf
3313                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3314                                         case "$osvers" in
3315                                         [1-9].[0-9]*) ;;
3316                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3317                                         esac
3318                                         ;;
3319                         hp*)    osname=hp_osf1  ;;
3320                         mips)   osname=mips_osf1 ;;
3321                         esac
3322                         ;;
3323                 # UnixWare 7.1.2 is known as Open UNIX 8
3324                 openunix|unixware) osname=svr5
3325                         osvers="$4"
3326                         ;;
3327                 uts)    osname=uts
3328                         osvers="$3"
3329                         ;;
3330                 vos) osvers="$3"
3331                         ;;
3332                 $2) case "$osname" in
3333                         *isc*) ;;
3334                         *freebsd*) ;;
3335                         svr*)
3336                                 : svr4.x or possibly later
3337                                 case "svr$3" in
3338                                 ${osname}*)
3339                                         osname=svr$3
3340                                         osvers=$4
3341                                         ;;
3342                                 esac
3343                                 case "$osname" in
3344                                 svr4.0)
3345                                         : Check for ESIX
3346                                         if test -f /stand/boot ; then
3347                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3348                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3349                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3350                                                         if test -n "$isesix"; then
3351                                                                 osname=esix4
3352                                                         fi
3353                                                 fi
3354                                         fi
3355                                         ;;
3356                                 esac
3357                                 ;;
3358                         *)      if test -f /etc/systemid; then
3359                                         osname=sco
3360                                         set `echo $3 | $sed 's/\./ /g'` $4
3361                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3362                                                 osvers=$1.$2.$3
3363                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3364                                                 osvers=$1.$2
3365                                         elif $test -f $src/hints/sco_$1.sh; then
3366                                                 osvers=$1
3367                                         fi
3368                                 else
3369                                         case "$osname" in
3370                                         '') : Still unknown.  Probably a generic Sys V.
3371                                                 osname="sysv"
3372                                                 osvers="$3"
3373                                                 ;;
3374                                         esac
3375                                 fi
3376                                 ;;
3377                         esac
3378                         ;;
3379                 *)      case "$osname" in
3380                         '') : Still unknown.  Probably a generic BSD.
3381                                 osname="$1"
3382                                 osvers="$3"
3383                                 ;;
3384                         esac
3385                         ;;
3386                 esac
3387         else
3388                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3389                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3390                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3391                                 osname=news_os
3392                         fi
3393                         $rm -f UU/kernel.what
3394                 elif test -d c:/. -o -n "$is_os2" ; then
3395                         set X $myuname
3396                         osname=os2
3397                         osvers="$5"
3398                 fi
3399         fi
3400
3401         case "$targetarch" in
3402         '') ;;
3403         *)  hostarch=$osname
3404             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3405             osvers=''
3406             ;;
3407         esac
3408
3409         : Now look for a hint file osname_osvers, unless one has been
3410         : specified already.
3411         case "$hintfile" in
3412         ''|' ')
3413                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3414                 : Also try without trailing minor version numbers.
3415                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3416                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3417                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3418                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3419                 case "$file" in
3420                 '') dflt=none ;;
3421                 *)  case "$osvers" in
3422                         '') dflt=$file
3423                                 ;;
3424                         *)  if $test -f $src/hints/$file.sh ; then
3425                                         dflt=$file
3426                                 elif $test -f $src/hints/$xfile.sh ; then
3427                                         dflt=$xfile
3428                                 elif $test -f $src/hints/$xxfile.sh ; then
3429                                         dflt=$xxfile
3430                                 elif $test -f $src/hints/$xxxfile.sh ; then
3431                                         dflt=$xxxfile
3432                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3433                                         dflt=$xxxxfile
3434                                 elif $test -f "$src/hints/${osname}.sh" ; then
3435                                         dflt="${osname}"
3436                                 else
3437                                         dflt=none
3438                                 fi
3439                                 ;;
3440                         esac
3441                         ;;
3442                 esac
3443                 if $test -f Policy.sh ; then
3444                         case "$dflt" in
3445                         *Policy*) ;;
3446                         none) dflt="Policy" ;;
3447                         *) dflt="Policy $dflt" ;;
3448                         esac
3449                 fi
3450                 ;;
3451         *)
3452                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3453                 ;;
3454         esac
3455
3456         if $test -f Policy.sh ; then
3457                 $cat <<EOM
3458
3459 There's also a Policy hint file available, which should make the
3460 site-specific (policy) questions easier to answer.
3461 EOM
3462
3463         fi
3464
3465         $cat <<EOM
3466
3467 You may give one or more space-separated answers, or "none" if appropriate.
3468 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3469 previous run of Configure, you may specify it as well as or instead of
3470 OS-specific hints.  If hints are provided for your OS, you should use them:
3471 although Perl can probably be built without hints on many platforms, using
3472 hints often improve performance and may enable features that Configure can't
3473 set up on its own. If there are no hints that match your OS, specify "none";
3474 DO NOT give a wrong version or a wrong OS.
3475
3476 EOM
3477
3478         rp="Which of these apply, if any?"
3479         . UU/myread
3480         tans=$ans
3481         for file in $tans; do
3482                 if $test X$file = XPolicy -a -f Policy.sh; then
3483                         . Policy.sh
3484                         $cat Policy.sh >> UU/config.sh
3485                 elif $test -f $src/hints/$file.sh; then
3486                         . $src/hints/$file.sh
3487                         $cat $src/hints/$file.sh >> UU/config.sh
3488                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3489                         : nothing
3490                 else
3491                         : Give one chance to correct a possible typo.
3492                         echo "$file.sh does not exist"
3493                         dflt=$file
3494                         rp="hint to use instead?"
3495                         . UU/myread
3496                         for file in $ans; do
3497                                 if $test -f "$src/hints/$file.sh"; then
3498                                         . $src/hints/$file.sh
3499                                         $cat $src/hints/$file.sh >> UU/config.sh
3500                                 elif $test X$ans = X -o X$ans = Xnone ; then
3501                                         : nothing
3502                                 else
3503                                         echo "$file.sh does not exist -- ignored."
3504                                 fi
3505                         done
3506                 fi
3507         done
3508
3509         hint=recommended
3510         : Remember our hint file for later.
3511         if $test -f "$src/hints/$file.sh" ; then
3512                 hintfile="$file"
3513         else
3514                 hintfile=''
3515         fi
3516 fi
3517 cd UU
3518 ;;
3519 *)
3520         echo " "
3521         echo "Fetching default answers from $config_sh..." >&4
3522         tmp_n="$n"
3523         tmp_c="$c"
3524         cd ..
3525         cp $config_sh config.sh 2>/dev/null
3526         chmod +w config.sh
3527         . ./config.sh
3528         cd UU
3529         cp ../config.sh .
3530         n="$tmp_n"
3531         c="$tmp_c"
3532         hint=previous
3533         ;;
3534 esac
3535 test "$override" && . ./optdef.sh
3536
3537 : Restore computed paths
3538 for file in $loclist $trylist; do
3539         eval $file="\$_$file"
3540 done
3541
3542 cat << EOM
3543
3544 Configure uses the operating system name and version to set some defaults.
3545 The default value is probably right if the name rings a bell. Otherwise,
3546 since spelling matters for me, either accept the default or answer "none"
3547 to leave it blank.
3548
3549 EOM
3550 case "$osname" in
3551         ''|' ')
3552                 case "$hintfile" in
3553                 ''|' '|none) dflt=none ;;
3554                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3555                 esac
3556                 ;;
3557         *) dflt="$osname" ;;
3558 esac
3559 rp="Operating system name?"
3560 . ./myread
3561 case "$ans" in
3562 none)  osname='' ;;
3563 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3564 esac
3565 echo " "
3566 case "$osvers" in
3567         ''|' ')
3568                 case "$hintfile" in
3569                 ''|' '|none) dflt=none ;;
3570                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3571                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3572                         case "$dflt" in
3573                         ''|' ') dflt=none ;;
3574                         esac
3575                         ;;
3576                 esac
3577                 ;;
3578         *) dflt="$osvers" ;;
3579 esac
3580 rp="Operating system version?"
3581 . ./myread
3582 case "$ans" in
3583 none)  osvers='' ;;
3584 *) osvers="$ans" ;;
3585 esac
3586
3587
3588 . ./posthint.sh
3589
3590 : who configured the system
3591 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3592 case "$cf_by" in
3593 "")
3594         cf_by=`(logname) 2>/dev/null`
3595         case "$cf_by" in
3596         "")
3597                 cf_by=`(whoami) 2>/dev/null`
3598                 case "$cf_by" in
3599                 "") cf_by=unknown ;;
3600                 esac ;;
3601         esac ;;
3602 esac
3603
3604 : decide how portable to be.  Allow command line overrides.
3605 case "$d_portable" in
3606 "$undef") ;;
3607 *)      d_portable="$define" ;;
3608 esac
3609
3610 : set up shell script to do ~ expansion
3611 cat >filexp <<EOSS
3612 $startsh
3613 : expand filename
3614 case "\$1" in
3615  \~/*|\~)
3616         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3617         ;;
3618  \~*)
3619         if $test -f /bin/csh; then
3620                 /bin/csh -f -c "glob \$1"
3621                 failed=\$?
3622                 echo ""
3623                 exit \$failed
3624         else
3625                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3626                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3627                 if $test ! -d "\$dir"; then
3628                         me=\`basename \$0\`
3629                         echo "\$me: can't locate home directory for: \$name" >&2
3630                         exit 1
3631                 fi
3632                 case "\$1" in
3633                 */*)
3634                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3635                         ;;
3636                 *)
3637                         echo \$dir
3638                         ;;
3639                 esac
3640         fi
3641         ;;
3642 *)
3643         echo \$1
3644         ;;
3645 esac
3646 EOSS
3647 chmod +x filexp
3648 $eunicefix filexp
3649
3650 : now set up to get a file name
3651 cat <<EOS >getfile
3652 $startsh
3653 EOS
3654 cat <<'EOSC' >>getfile
3655 tilde=''
3656 fullpath=''
3657 already=''
3658 skip=''
3659 none_ok=''
3660 exp_file=''
3661 nopath_ok=''
3662 orig_rp="$rp"
3663 orig_dflt="$dflt"
3664 case "$gfpth" in
3665 '') gfpth='.' ;;
3666 esac
3667
3668 case "$fn" in
3669 *\(*)
3670         : getfile will accept an answer from the comma-separated list
3671         : enclosed in parentheses even if it does not meet other criteria.
3672         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3673         fn=`echo $fn | sed 's/(.*)//'`
3674         ;;
3675 esac
3676
3677 case "$fn" in
3678 *:*)
3679         loc_file=`expr $fn : '.*:\(.*\)'`
3680         fn=`expr $fn : '\(.*\):.*'`
3681         ;;
3682 esac
3683
3684 case "$fn" in
3685 *~*) tilde=true;;
3686 esac
3687 case "$fn" in
3688 */*) fullpath=true;;
3689 esac
3690 case "$fn" in
3691 *+*) skip=true;;
3692 esac
3693 case "$fn" in
3694 *n*) none_ok=true;;
3695 esac
3696 case "$fn" in
3697 *e*) exp_file=true;;
3698 esac
3699 case "$fn" in
3700 *p*) nopath_ok=true;;
3701 esac
3702
3703 case "$fn" in
3704 *f*) type='File';;
3705 *d*) type='Directory';;
3706 *l*) type='Locate';;
3707 esac
3708
3709 what="$type"
3710 case "$what" in
3711 Locate) what='File';;
3712 esac
3713
3714 case "$exp_file" in
3715 '')
3716         case "$d_portable" in
3717         "$define") ;;
3718         *) exp_file=true;;
3719         esac
3720         ;;
3721 esac
3722
3723 cd ..
3724 while test "$type"; do
3725         redo=''
3726         rp="$orig_rp"
3727         dflt="$orig_dflt"
3728         case "$tilde" in
3729         true) rp="$rp (~name ok)";;
3730         esac
3731         . UU/myread
3732         if test -f UU/getfile.ok && \
3733                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3734         then
3735                 value="$ans"
3736                 ansexp="$ans"
3737                 break
3738         fi
3739         case "$ans" in
3740         none)
3741                 value=''
3742                 ansexp=''
3743                 case "$none_ok" in
3744                 true) type='';;
3745                 esac
3746                 ;;
3747         *)
3748                 case "$tilde" in
3749                 '') value="$ans"
3750                         ansexp="$ans";;
3751                 *)
3752                         value=`UU/filexp $ans`
3753                         case $? in
3754                         0)
3755                                 if test "$ans" != "$value"; then
3756                                         echo "(That expands to $value on this system.)"
3757                                 fi
3758                                 ;;
3759                         *) value="$ans";;
3760                         esac
3761                         ansexp="$value"
3762                         case "$exp_file" in
3763                         '') value="$ans";;
3764                         esac
3765                         ;;
3766                 esac
3767                 case "$fullpath" in
3768                 true)
3769                         case "$ansexp" in
3770                         /*) value="$ansexp" ;;
3771                         [a-zA-Z]:/*) value="$ansexp" ;;
3772                         *)
3773                                 redo=true
3774                                 case "$already" in
3775                                 true)
3776                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3777                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3778                                         ;;
3779                                 *)
3780                                 echo "Please give a full path name, starting with slash." >&4
3781                                         case "$tilde" in
3782                                         true)
3783                                 echo "Note that using ~name is ok provided it expands well." >&4
3784                                                 already=true
3785                                                 ;;
3786                                         esac
3787                                 esac
3788                                 ;;
3789                         esac
3790                         ;;
3791                 esac
3792                 case "$redo" in
3793                 '')
3794                         case "$type" in
3795                         File)
3796                                 for fp in $gfpth; do
3797                                         if test "X$fp" = X.; then
3798                                             pf="$ansexp"
3799                                         else    
3800                                             pf="$fp/$ansexp"
3801                                         fi
3802                                         if test -f "$pf"; then
3803                                                 type=''
3804                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3805                                         then
3806                                                 echo "($value is not a plain file, but that's ok.)"
3807                                                 type=''
3808                                         fi
3809                                         if test X"$type" = X; then
3810                                             value="$pf"
3811                                             break
3812                                         fi
3813                                 done
3814                                 ;;
3815                         Directory)
3816                                 for fp in $gfpth; do
3817                                         if test "X$fp" = X.; then
3818                                             dir="$ans"
3819                                             direxp="$ansexp"
3820                                         else    
3821                                             dir="$fp/$ansexp"
3822                                             direxp="$fp/$ansexp"
3823                                         fi
3824                                         if test -d "$direxp"; then
3825                                                 type=''
3826                                                 value="$dir"
3827                                                 break
3828                                         fi
3829                                 done
3830                                 ;;
3831                         Locate)
3832                                 if test -d "$ansexp"; then
3833                                         echo "(Looking for $loc_file in directory $value.)"
3834                                         value="$value/$loc_file"
3835                                         ansexp="$ansexp/$loc_file"
3836                                 fi
3837                                 if test -f "$ansexp"; then
3838                                         type=''
3839                                 fi
3840                                 case "$nopath_ok" in
3841                                 true)   case "$value" in
3842                                         */*) ;;
3843                                         *)      echo "Assuming $value will be in people's path."
3844                                                 type=''
3845                                                 ;;
3846                                         esac
3847                                         ;;
3848                                 esac
3849                                 ;;
3850                         esac
3851
3852                         case "$skip" in
3853                         true) type='';
3854                         esac
3855
3856                         case "$type" in
3857                         '') ;;
3858                         *)
3859                                 if test "$fastread" = yes; then
3860                                         dflt=y
3861                                 else
3862                                         dflt=n
3863                                 fi
3864                                 rp="$what $value doesn't exist.  Use that name anyway?"
3865                                 . UU/myread
3866                                 dflt=''
3867                                 case "$ans" in
3868                                 y*) type='';;
3869                                 *) echo " ";;
3870                                 esac
3871                                 ;;
3872                         esac
3873                         ;;
3874                 esac
3875                 ;;
3876         esac
3877 done
3878 cd UU
3879 ans="$value"
3880 rp="$orig_rp"
3881 dflt="$orig_dflt"
3882 rm -f getfile.ok
3883 test "X$gfpthkeep" != Xy && gfpth=""
3884 EOSC
3885
3886 : determine root of directory hierarchy where package will be installed.
3887 case "$prefix" in
3888 '')
3889         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3890         ;;
3891 *?/)
3892         dflt=`echo "$prefix" | sed 's/.$//'`
3893         ;;
3894 *)
3895         dflt="$prefix"
3896         ;;
3897 esac
3898 $cat <<EOM
3899
3900 By default, $package will be installed in $dflt/bin, manual pages
3901 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3902 installation directories. Typically this is something like /usr/local.
3903 If you wish to have binaries under /usr/bin but other parts of the
3904 installation under /usr/local, that's ok: you will be prompted
3905 separately for each of the installation directories, the prefix being
3906 only used to set the defaults.
3907
3908 EOM
3909 fn=d~
3910 rp='Installation prefix to use?'
3911 . ./getfile
3912 oldprefix=''
3913 case "$prefix" in
3914 '') ;;
3915 *)
3916         case "$ans" in
3917         "$prefix") ;;
3918         *) oldprefix="$prefix";;
3919         esac
3920         ;;
3921 esac
3922 prefix="$ans"
3923 prefixexp="$ansexp"
3924
3925 : allow them to override the AFS root
3926 case "$afsroot" in
3927 '')     afsroot=/afs ;;
3928 *)      afsroot=$afsroot ;;
3929 esac
3930
3931 : is AFS running?
3932 echo " "
3933 case "$afs" in
3934 $define|true)   afs=true ;;
3935 $undef|false)   afs=false ;;
3936 *)      if $test -d $afsroot; then
3937                 afs=true
3938         else
3939                 afs=false
3940         fi
3941         ;;
3942 esac
3943 if $afs; then
3944         echo "AFS may be running... I'll be extra cautious then..." >&4
3945 else
3946         echo "AFS does not seem to be running..." >&4
3947 fi
3948
3949 : determine installation prefix for where package is to be installed.
3950 if $afs; then 
3951 $cat <<EOM
3952
3953 Since you are running AFS, I need to distinguish the directory in which
3954 files will reside from the directory in which they are installed (and from
3955 which they are presumably copied to the former directory by occult means).
3956
3957 EOM
3958         case "$installprefix" in
3959         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3960         *) dflt="$installprefix";;
3961         esac
3962 else
3963 $cat <<EOM
3964
3965 In some special cases, particularly when building $package for distribution,
3966 it is convenient to distinguish the directory in which files should be
3967 installed from the directory ($prefix) in which they will
3968 eventually reside.  For most users, these two directories are the same.
3969
3970 EOM
3971         case "$installprefix" in
3972         '') dflt=$prefix ;;
3973         *) dflt=$installprefix;;
3974         esac
3975 fi
3976 fn=d~
3977 rp='What installation prefix should I use for installing files?'
3978 . ./getfile
3979 installprefix="$ans"
3980 installprefixexp="$ansexp"
3981
3982 : Perform the prefixexp/installprefixexp correction if necessary
3983 cat <<EOS >installprefix
3984 $startsh
3985 EOS
3986 cat <<'EOSC' >>installprefix
3987 : Change installation prefix, if necessary.
3988 if $test X"$prefix" != X"$installprefix"; then
3989     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3990 else
3991     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3992 fi
3993 EOSC
3994 chmod +x installprefix
3995 $eunicefix installprefix
3996
3997 : Set variables such as privlib and privlibexp from the output of ./getfile
3998 : performing the prefixexp/installprefixexp correction if necessary.
3999 cat <<EOS >setprefixvar
4000 $startsh
4001 EOS
4002 cat <<'EOSC' >>setprefixvar
4003 eval "${prefixvar}=\"\$ans\""
4004 eval "${prefixvar}exp=\"\$ansexp\""
4005 . ./installprefix
4006 EOSC
4007 chmod +x setprefixvar
4008 $eunicefix setprefixvar
4009
4010 : set up the script used to warn in case of inconsistency
4011 cat <<EOS >whoa
4012 $startsh
4013 EOS
4014 cat <<'EOSC' >>whoa
4015 dflt=y
4016 case "$hint" in
4017     recommended)
4018         case "$hintfile" in
4019         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4020                 ;;
4021         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4022                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4023                 ;;
4024         esac
4025         ;;
4026     *)  echo " "
4027         echo "*** WHOA THERE!!! ***" >&4
4028         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4029         ;;
4030 esac
4031 rp="    Keep the $hint value?"
4032 . ./myread
4033 case "$ans" in
4034 y) td=$was; tu=$was;;
4035 esac
4036 EOSC
4037
4038 : function used to set '$1' to '$val'
4039 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4040 case "$val$was" in
4041 $define$undef) . ./whoa; eval "$var=\$td";;
4042 $undef$define) . ./whoa; eval "$var=\$tu";;
4043 *) eval "$var=$val";;
4044 esac'
4045
4046 : Check is we will use socks
4047 case "$usesocks" in
4048 $define|true|[yY]*)     dflt='y';;
4049 *) dflt='n';;
4050 esac
4051 cat <<EOM
4052
4053 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4054 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4055 to use the PerlIO abstraction layer, this will be implicitly selected.
4056
4057 If this doesn't make any sense to you, just accept the default '$dflt'.
4058 EOM
4059 rp='Build Perl for SOCKS?'
4060 . ./myread
4061 case "$ans" in
4062 y|Y)    val="$define" ;;
4063 *)      val="$undef" ;;
4064 esac
4065 set usesocks
4066 eval $setvar
4067
4068 case "$usesocks" in
4069 $define|true|[yY]*) useperlio="$define";;
4070 esac
4071
4072 : Check if we want perlio
4073 case "$useperlio" in
4074 $define|true|[yY]*|'')  dflt='y';;
4075 *) dflt='n';;
4076 esac
4077 cat <<EOM
4078
4079 Previous version of $package used the standard IO mechanisms as
4080 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4081 alternate IO mechanisms via the PerlIO abstraction layer, but the
4082 stdio mechanism is still available if needed.  The abstraction layer
4083 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4084 Using PerlIO with sfio may cause problems with some extension modules.
4085
4086 If this doesn't make any sense to you, just accept the default '$dflt'.
4087 EOM
4088 rp='Use the PerlIO abstraction layer?'
4089 . ./myread
4090 case "$ans" in
4091 y|Y)
4092         val="$define"
4093         ;;
4094 *)
4095         echo "Ok, doing things the stdio way."
4096         val="$undef"
4097         ;;
4098 esac
4099 set useperlio
4100 eval $setvar
4101
4102 case "$usesocks" in
4103 $define|true|[yY]*)
4104         case "$useperlio" in
4105         $define|true|[yY]*) ;;
4106         *)      cat >&4 <<EOM
4107
4108 You are using the SOCKS proxy protocol library which means that you
4109 should also use the PerlIO layer.  You may be headed for trouble.
4110
4111 EOM
4112                 ;;
4113         esac
4114         ;;
4115 esac
4116
4117 : get the patchlevel
4118 echo " "
4119 echo "Getting the current patchlevel..." >&4
4120 if $test -r $rsrc/patchlevel.h;then
4121         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4122         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4123         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4124         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4125         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4126         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4127         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4128 else
4129         revision=0
4130         patchlevel=0
4131         subversion=0
4132         api_revision=0
4133         api_version=0
4134         api_subversion=0
4135         perl_patchlevel=0
4136         $echo "(You do not have patchlevel.h.  Eek.)"
4137 fi
4138 if $test -r $rsrc/.patch ; then
4139         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4140                 perl_patchlevel=`cat $rsrc/.patch`
4141         fi
4142 fi
4143 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4144 version_patchlevel_string="version $patchlevel subversion $subversion"
4145 case "$perl_patchlevel" in
4146 0|'') ;;
4147 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4148 esac
4149
4150 $echo "(You have $package $version_patchlevel_string.)"
4151
4152 case "$osname" in
4153 dos|vms)
4154         : XXX Should be a Configure test for double-dots in filenames.
4155         version=`echo $revision $patchlevel $subversion | \
4156                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4157         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4158                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4159         ;;
4160 *)
4161         version=`echo $revision $patchlevel $subversion | \
4162                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4163         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4164                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4165         ;;
4166 esac
4167 : Special case the 5.005_xx maintenance series, which used 5.005
4168 : without any subversion label as a subdirectory in $sitelib
4169 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4170         api_versionstring='5.005'
4171 fi
4172
4173 : Do we want threads support and if so, what type
4174 case "$usethreads" in
4175 $define|true|[yY]*)     dflt='y';;
4176 *)     # Catch case where user specified ithreads or 5005threads but
4177        # forgot -Dusethreads (A.D. 4/2002)
4178        case "$useithreads$use5005threads" in
4179        *$define*)
4180                 case "$useperlio" in
4181                 "$define")      dflt='y' ;;
4182                 *)              dflt='n' ;;
4183                 esac
4184                 ;;
4185        *)       dflt='n';;
4186        esac
4187        ;;
4188 esac
4189 cat <<EOM
4190
4191 Perl can be built to take advantage of threads on some systems.
4192 To do so, Configure can be run with -Dusethreads.
4193
4194 Note that Perl built with threading support runs slightly slower
4195 and uses more memory than plain Perl. The current implementation
4196 is believed to be stable, but it is fairly new, and so should be
4197 treated with caution.
4198
4199 If this doesn't make any sense to you, just accept the default '$dflt'.
4200 EOM
4201 rp='Build a threading Perl?'
4202 . ./myread
4203 case "$ans" in
4204 y|Y)    val="$define" ;;
4205 *)      val="$undef" ;;
4206 esac
4207 set usethreads
4208 eval $setvar
4209
4210 if $test $patchlevel -lt 9; then
4211     case "$usethreads" in
4212     $define)
4213         $cat <<EOM
4214
4215 Since release 5.6, Perl has had two different threading implementations,
4216 the newer interpreter-based version (ithreads) with one interpreter per
4217 thread, and the older 5.005 version (5005threads).
4218 The 5005threads version is effectively unmaintained and will probably be
4219 removed in Perl 5.10, so there should be no need to build a Perl using it
4220 unless needed for backwards compatibility with some existing 5.005threads
4221 code.
4222
4223 EOM
4224         : Default to ithreads unless overridden on command line or with
4225         : old config.sh
4226         dflt='y'
4227         case "$use5005threads" in
4228                 $define|true|[yY]*) dflt='n';;
4229         esac
4230         case "$useithreads" in
4231                 $undef|false|[nN]*) dflt='n';;
4232         esac
4233         rp='Use the newer interpreter-based ithreads?'
4234         . ./myread
4235         case "$ans" in
4236         y|Y)    val="$define" ;;
4237         *)      val="$undef" ;;
4238         esac
4239         set useithreads
4240         eval $setvar
4241         : Now set use5005threads to the opposite value.
4242         case "$useithreads" in
4243         $define) val="$undef" ;;
4244         *) val="$define" ;;
4245         esac
4246         set use5005threads
4247         eval $setvar
4248         ;;
4249     *)
4250         useithreads="$undef"
4251         use5005threads="$undef"
4252         ;;
4253     esac
4254
4255     case "$useithreads$use5005threads" in
4256     "$define$define")
4257         $cat >&4 <<EOM
4258
4259 You cannot have both the ithreads and the 5.005 threads enabled
4260 at the same time.  Disabling the 5.005 threads since they are
4261 much less stable than the ithreads.
4262
4263 EOM
4264         use5005threads="$undef"
4265         ;;
4266     esac
4267
4268 else
4269 : perl-5.9.x and later
4270
4271     if test X"$usethreads" = "X$define"; then
4272         case "$use5005threads" in
4273             $define|true|[yY]*)
4274                 $cat >&4 <<EOM
4275
4276 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4277
4278 EOM
4279             ;;
4280         esac
4281     fi
4282
4283     use5005threads="$undef"
4284     useithreads="$usethreads"
4285 fi
4286
4287 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4288         cat >&4 <<EOF
4289 ***
4290 *** To build with ithreads you must also use the PerlIO layer.
4291 *** Cannot continue, aborting.
4292 ***
4293 EOF
4294         exit 1
4295 fi
4296
4297 case "$d_oldpthreads" in
4298 '')     : Configure tests would be welcome here.  For now, assume undef.
4299         val="$undef" ;;
4300 *)      val="$d_oldpthreads" ;;
4301 esac
4302 set d_oldpthreads
4303 eval $setvar
4304
4305
4306 : Look for a hint-file generated 'call-back-unit'.  If the
4307 : user has specified that a threading perl is to be built,
4308 : we may need to set or change some other defaults.
4309 if $test -f usethreads.cbu; then
4310     echo "Your platform has some specific hints regarding threaded builds, using them..."
4311     . ./usethreads.cbu
4312 else
4313     case "$usethreads" in
4314         "$define"|true|[yY]*)
4315                 $cat <<EOM
4316 (Your platform does not have any specific hints for threaded builds.
4317  Assuming POSIX threads, then.)
4318 EOM
4319         ;;
4320     esac
4321 fi
4322
4323 : Check if multiplicity is required
4324 cat <<EOM
4325
4326 Perl can be built so that multiple Perl interpreters can coexist
4327 within the same Perl executable.
4328 EOM
4329
4330 case "$useithreads" in
4331 $define)
4332         cat <<EOM
4333 This multiple interpreter support is required for interpreter-based threads.
4334 EOM
4335         val="$define"
4336         ;;
4337 *)      case "$usemultiplicity" in
4338         $define|true|[yY]*)     dflt='y';;
4339         *) dflt='n';;
4340         esac
4341         echo " "
4342         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4343         rp='Build Perl for multiplicity?'
4344         . ./myread
4345         case "$ans" in
4346         y|Y)    val="$define" ;;
4347         *)      val="$undef" ;;
4348         esac
4349         ;;
4350 esac
4351 set usemultiplicity
4352 eval $setvar
4353
4354 : Check if morebits is requested
4355 case "$usemorebits" in
4356 "$define"|true|[yY]*)
4357         use64bitint="$define"
4358         uselongdouble="$define"
4359         usemorebits="$define"
4360         ;;
4361 *)      usemorebits="$undef"
4362         ;;
4363 esac
4364
4365 : Determine the C compiler to be used
4366 echo " "
4367 case "$cc" in
4368 '') dflt=cc;;
4369 *) dflt="$cc";;
4370 esac
4371 rp="Use which C compiler?"
4372 . ./myread
4373 cc="$ans"
4374
4375 : See whether they have no cc but they do have gcc
4376 . ./trygcc
4377 if $test -f cc.cbu; then
4378     . ./cc.cbu
4379 fi
4380 . ./checkcc
4381
4382 : make some quick guesses about what we are up against
4383 echo " "
4384 $echo $n "Hmm...  $c"
4385 echo exit 1 >bsd
4386 echo exit 1 >usg
4387 echo exit 1 >v7
4388 echo exit 1 >osf1
4389 echo exit 1 >eunice
4390 echo exit 1 >xenix
4391 echo exit 1 >venix
4392 echo exit 1 >os2
4393 d_bsd="$undef"
4394 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4395 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4396 then
4397         echo "Looks kind of like an OSF/1 system, but we'll see..."
4398         echo exit 0 >osf1
4399 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4400         xxx=`./loc addbib blurfl $pth`
4401         if $test -f $xxx; then
4402         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4403                 echo exit 0 >bsd
4404                 echo exit 0 >usg
4405         else
4406                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4407                         echo "Looks kind of like an extended USG system, but we'll see..."
4408                 else
4409                         echo "Looks kind of like a USG system, but we'll see..."
4410                 fi
4411                 echo exit 0 >usg
4412         fi
4413 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4414         echo "Looks kind of like a BSD system, but we'll see..."
4415         d_bsd="$define"
4416         echo exit 0 >bsd
4417 else
4418         echo "Looks kind of like a Version 7 system, but we'll see..."
4419         echo exit 0 >v7
4420 fi
4421 case "$eunicefix" in
4422 *unixtovms*)
4423         $cat <<'EOI'
4424 There is, however, a strange, musty smell in the air that reminds me of
4425 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4426 EOI
4427         echo exit 0 >eunice
4428         d_eunice="$define"
4429 : it so happens the Eunice I know will not run shell scripts in Unix format
4430         ;;
4431 *)
4432         echo " "
4433         echo "Congratulations.  You aren't running Eunice."
4434         d_eunice="$undef"
4435         ;;
4436 esac
4437 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4438 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4439 : semicolon as a patch separator
4440 case "$p_" in
4441 :) ;;
4442 *)
4443         $cat <<'EOI'
4444 I have the feeling something is not exactly right, however...don't tell me...
4445 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4446 (Or you may be running DOS with DJGPP.)
4447 EOI
4448         echo exit 0 >os2
4449         ;;
4450 esac
4451 if test -f /xenix; then
4452         echo "Actually, this looks more like a XENIX system..."
4453         echo exit 0 >xenix
4454         d_xenix="$define"
4455 else
4456         echo " "
4457         echo "It's not Xenix..."
4458         d_xenix="$undef"
4459 fi
4460 chmod +x xenix
4461 $eunicefix xenix
4462 if test -f /venix; then
4463         echo "Actually, this looks more like a VENIX system..."
4464         echo exit 0 >venix
4465 else
4466         echo " "
4467         if ./xenix; then
4468                 : null
4469         else
4470                 echo "Nor is it Venix..."
4471         fi
4472 fi
4473 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4474 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4475 $rm -f foo
4476
4477 : Check if we are using GNU gcc and what its version is
4478 echo " "
4479 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4480 $cat >try.c <<EOM
4481 #include <stdio.h>
4482 int main() {
4483 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4484 #ifdef __VERSION__
4485         printf("%s\n", __VERSION__);
4486 #else
4487         printf("%s\n", "1");
4488 #endif
4489 #endif
4490         return(0);
4491 }
4492 EOM
4493 if $cc -o try $ccflags $ldflags try.c; then
4494         gccversion=`$run ./try`
4495         case "$gccversion" in
4496         '') echo "You are not using GNU cc." ;;
4497         *)  echo "You are using GNU cc $gccversion."
4498             ccname=gcc
4499             ;;
4500         esac
4501 else
4502         echo " "
4503         echo "*** WHOA THERE!!! ***" >&4
4504         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4505         case "$knowitall" in
4506         '')
4507         echo "    You'd better start hunting for one and let me know about it." >&4
4508                 exit 1
4509                 ;;
4510         esac
4511 fi
4512 $rm -f try try.*
4513 case "$gccversion" in
4514 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4515 esac
4516 case "$gccversion" in
4517 '') gccosandvers='' ;;
4518 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4519    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4520    gccshortvers=''
4521    case "$gccosandvers" in
4522    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4523    $osname$osvers) ;; # looking good
4524    $osname*) cat <<EOM >&4
4525
4526 *** WHOA THERE!!! ***
4527
4528     Your gcc has not been compiled for the exact release of
4529     your operating system ($gccosandvers versus $osname$osvers).
4530
4531     In general it is a good idea to keep gcc synchronized with
4532     the operating system because otherwise serious problems
4533     may ensue when trying to compile software, like Perl.
4534
4535     I'm trying to be optimistic here, though, and will continue.
4536     If later during the configuration and build icky compilation
4537     problems appear (headerfile conflicts being the most common
4538     manifestation), I suggest reinstalling the gcc to match
4539     your operating system release.
4540
4541 EOM
4542       ;;
4543    *) gccosandvers='' ;; # failed to parse, better be silent
4544    esac
4545    ;;
4546 esac
4547 case "$ccname" in
4548 '') ccname="$cc" ;;
4549 esac
4550
4551 # gcc 3.* complain about adding -Idirectories that they already know about,
4552 # so we will take those off from locincpth.
4553 case "$gccversion" in
4554 3*)
4555     echo "main(){}">try.c
4556     for incdir in $locincpth; do
4557        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4558              grep '^c[cp]p*[01]: warning: changing search order '`
4559        if test "X$warn" != X; then
4560            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4561        fi
4562     done
4563     $rm -f try try.*
4564 esac
4565
4566 : What should the include directory be ?
4567 echo " "
4568 $echo $n "Hmm...  $c"
4569 dflt='/usr/include'
4570 incpath=''
4571 mips_type=''
4572 if $test -f /bin/mips && /bin/mips; then
4573         echo "Looks like a MIPS system..."
4574         $cat >usr.c <<'EOCP'
4575 #ifdef SYSTYPE_BSD43
4576 /bsd43
4577 #endif
4578 EOCP
4579         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4580                 dflt='/bsd43/usr/include'
4581                 incpath='/bsd43'
4582                 mips_type='BSD 4.3'
4583         else
4584                 mips_type='System V'
4585         fi
4586         $rm -f usr.c usr.out
4587         echo "and you're compiling with the $mips_type compiler and libraries."
4588         xxx_prompt=y
4589         echo "exit 0" >mips
4590 else
4591         echo "Doesn't look like a MIPS system."
4592         xxx_prompt=n
4593         echo "exit 1" >mips
4594 fi
4595 chmod +x mips
4596 $eunicefix mips
4597 case "$usrinc" in
4598 '') ;;
4599 *) dflt="$usrinc";;
4600 esac
4601 case "$xxx_prompt" in
4602 y)      fn=d/
4603         echo " "
4604         rp='Where are the include files you want to use?'
4605         . ./getfile
4606         usrinc="$ans"
4607         ;;
4608 *)      usrinc="$dflt"
4609         ;;
4610 esac
4611
4612 : see how we invoke the C preprocessor
4613 echo " "
4614 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4615 cat <<'EOT' >testcpp.c
4616 #define ABC abc
4617 #define XYZ xyz
4618 ABC.XYZ
4619 EOT
4620 cd ..
4621 if test ! -f cppstdin; then
4622         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4623                 # AIX cc -E doesn't show the absolute headerfile
4624                 # locations but we'll cheat by using the -M flag.
4625                 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
4626         else
4627                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4628         fi
4629 else
4630         echo "Keeping your $hint cppstdin wrapper."
4631 fi
4632 chmod 755 cppstdin
4633 wrapper=`pwd`/cppstdin
4634 ok='false'
4635 cd UU
4636
4637 if $test "X$cppstdin" != "X" && \
4638         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4639         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4640 then
4641         echo "You used to use $cppstdin $cppminus so we'll use that again."
4642         case "$cpprun" in
4643         '') echo "But let's see if we can live without a wrapper..." ;;
4644         *)
4645                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4646                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4647                 then
4648                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4649                         ok='true'
4650                 else
4651                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4652                 fi
4653                 ;;
4654         esac
4655 else
4656         case "$cppstdin" in
4657         '') ;;
4658         *)
4659                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4660                 ;;
4661         esac
4662 fi
4663
4664 if $ok; then
4665         : nothing
4666 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4667         $cc -E <testcpp.c >testcpp.out 2>&1; \
4668         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4669         echo "Yup, it does."
4670         x_cpp="$cc -E"
4671         x_minus='';
4672 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4673         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4674         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4675         echo "Yup, it does."
4676         x_cpp="$cc -E"
4677         x_minus='-';
4678 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4679         $cc -P <testcpp.c >testcpp.out 2>&1; \
4680         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4681         echo "Yipee, that works!"
4682         x_cpp="$cc -P"
4683         x_minus='';
4684 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4685         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4686         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4687         echo "At long last!"
4688         x_cpp="$cc -P"
4689         x_minus='-';
4690 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4691         $cpp <testcpp.c >testcpp.out 2>&1; \
4692         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4693         echo "It works!"
4694         x_cpp="$cpp"
4695         x_minus='';
4696 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4697         $cpp - <testcpp.c >testcpp.out 2>&1; \
4698         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4699         echo "Hooray, it works!  I was beginning to wonder."
4700         x_cpp="$cpp"
4701         x_minus='-';
4702 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4703         $wrapper <testcpp.c >testcpp.out 2>&1; \
4704         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4705         x_cpp="$wrapper"
4706         x_minus=''
4707         echo "Eureka!"
4708 else
4709         dflt=''
4710         rp="No dice.  I can't find a C preprocessor.  Name one:"
4711         . ./myread
4712         x_cpp="$ans"
4713         x_minus=''
4714         $x_cpp <testcpp.c >testcpp.out 2>&1
4715         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4716                 echo "OK, that will do." >&4
4717         else
4718 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4719                 exit 1
4720         fi
4721 fi
4722
4723 case "$ok" in
4724 false)
4725         cppstdin="$x_cpp"
4726         cppminus="$x_minus"
4727         cpprun="$x_cpp"
4728         cpplast="$x_minus"
4729         set X $x_cpp
4730         shift
4731         case "$1" in
4732         "$cpp")
4733                 echo "Perhaps can we force $cc -E using a wrapper..."
4734                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4735                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4736                 then
4737                         echo "Yup, we can."
4738                         cppstdin="$wrapper"
4739                         cppminus='';
4740                 else
4741                         echo "Nope, we'll have to live without it..."
4742                 fi
4743                 ;;
4744         esac
4745         case "$cpprun" in
4746         "$wrapper")
4747                 cpprun=''
4748                 cpplast=''
4749                 ;;
4750         esac
4751         ;;
4752 esac
4753
4754 case "$cppstdin" in
4755 "$wrapper"|'cppstdin') ;;
4756 *) $rm -f $wrapper;;
4757 esac
4758 $rm -f testcpp.c testcpp.out
4759
4760 : Set private lib path
4761 case "$plibpth" in
4762 '') if ./mips; then
4763                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4764         fi;;
4765 esac
4766 case "$libpth" in
4767 ' ') dlist='';;
4768 '') dlist="$loclibpth $plibpth $glibpth";;
4769 *) dlist="$libpth";;
4770 esac
4771
4772 : Now check and see which directories actually exist, avoiding duplicates
4773 libpth=''
4774 for xxx in $dlist
4775 do
4776     if $test -d $xxx; then
4777                 case " $libpth " in
4778                 *" $xxx "*) ;;
4779                 *) libpth="$libpth $xxx";;
4780                 esac
4781     fi
4782 done
4783 $cat <<'EOM'
4784
4785 Some systems have incompatible or broken versions of libraries.  Among
4786 the directories listed in the question below, please remove any you
4787 know not to be holding relevant libraries, and add any that are needed.
4788 Say "none" for none.
4789
4790 EOM
4791 case "$libpth" in
4792 '') dflt='none';;
4793 *)
4794         set X $libpth
4795         shift
4796         dflt=${1+"$@"}
4797         ;;
4798 esac
4799 rp="Directories to use for library searches?"
4800 . ./myread
4801 case "$ans" in
4802 none) libpth=' ';;
4803 *) libpth="$ans";;
4804 esac
4805
4806 : compute shared library extension
4807 case "$so" in
4808 '')
4809         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4810                 dflt='sl'
4811         else
4812                 dflt='so'
4813         fi
4814         ;;
4815 *) dflt="$so";;
4816 esac
4817 $cat <<EOM
4818
4819 On some systems, shared libraries may be available.  Answer 'none' if
4820 you want to suppress searching of shared libraries for the remainder
4821 of this configuration.
4822
4823 EOM
4824 rp='What is the file extension used for shared libraries?'
4825 . ./myread
4826 so="$ans"
4827
4828 : Define several unixisms.
4829 : Hints files or command line option can be used to override them.
4830 : The convoluted testing is in case hints files set either the old
4831 : or the new name.
4832 case "$_exe" in
4833 '')     case "$exe_ext" in
4834         '')     ;;
4835         *)      _exe="$exe_ext" ;;
4836         esac
4837         ;;
4838 esac
4839 case "$_a" in
4840 '')     case "$lib_ext" in
4841     '') _a='.a';;
4842         *)      _a="$lib_ext" ;;
4843         esac
4844         ;;
4845 esac
4846 case "$_o" in
4847 '') case "$obj_ext" in
4848         '')     _o='.o';;
4849         *)      _o="$obj_ext";;
4850         esac
4851         ;;
4852 esac
4853 case "$p_" in
4854 '') case "$path_sep" in
4855         '')     p_=':';;
4856         *)      p_="$path_sep";;
4857         esac
4858         ;;
4859 esac
4860 exe_ext=$_exe
4861 lib_ext=$_a
4862 obj_ext=$_o
4863 path_sep=$p_
4864
4865 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4866
4867 : Which makefile gets called first.  This is used by make depend.
4868 case "$firstmakefile" in
4869 '') firstmakefile='makefile';;
4870 esac
4871
4872 : Check for uselongdouble support
4873 case "$ccflags" in
4874 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4875 esac
4876
4877 case "$uselongdouble" in
4878 $define|true|[yY]*)     dflt='y';;
4879 *) dflt='n';;
4880 esac
4881 cat <<EOM
4882
4883 Perl can be built to take advantage of long doubles which
4884 (if available) may give more accuracy and range for floating point numbers.
4885
4886 If this doesn't make any sense to you, just accept the default '$dflt'.
4887 EOM
4888 rp='Try to use long doubles if available?'
4889 . ./myread
4890 case "$ans" in
4891 y|Y)    val="$define"   ;;
4892 *)      val="$undef"    ;;
4893 esac
4894 set uselongdouble
4895 eval $setvar
4896
4897 case "$uselongdouble" in
4898 true|[yY]*) uselongdouble="$define" ;;
4899 esac
4900
4901 : Look for a hint-file generated 'call-back-unit'.  If the
4902 : user has specified that long doubles should be used,
4903 : we may need to set or change some other defaults.
4904 if $test -f uselongdouble.cbu; then
4905     echo "Your platform has some specific hints regarding long doubles, using them..."
4906     . ./uselongdouble.cbu
4907 else
4908     case "$uselongdouble" in
4909         $define)
4910                 $cat <<EOM
4911 (Your platform does not have any specific hints for long doubles.)
4912 EOM
4913         ;;
4914     esac
4915 fi
4916
4917 : Looking for optional libraries
4918 echo " "
4919 echo "Checking for optional libraries..." >&4
4920 case "$libs" in
4921 ' '|'') dflt='';;
4922 *) dflt="$libs";;
4923 esac
4924 case "$libswanted" in
4925 '') libswanted='c_s';;
4926 esac
4927 case "$usesocks" in
4928 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4929 esac
4930 libsfound=''
4931 libsfiles=''
4932 libsdirs=''
4933 libspath=''
4934 for thisdir in $libpth $xlibpth; do
4935   test -d $thisdir && libspath="$libspath $thisdir"
4936 done
4937 for thislib in $libswanted; do
4938         for thisdir in $libspath; do
4939             xxx=''
4940             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4941                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4942                 $test -f "$xxx" && eval $libscheck
4943                 $test -f "$xxx" && libstyle=shared
4944             fi
4945             if test ! -f "$xxx"; then
4946                 xxx=$thisdir/lib$thislib.$so
4947                 $test -f "$xxx" && eval $libscheck
4948                 $test -f "$xxx" && libstyle=shared
4949             fi
4950             if test ! -f "$xxx"; then
4951                 xxx=$thisdir/lib$thislib$_a
4952                 $test -f "$xxx" && eval $libscheck
4953                 $test -f "$xxx" && libstyle=static
4954             fi
4955             if test ! -f "$xxx"; then
4956                 xxx=$thisdir/$thislib$_a
4957                 $test -f "$xxx" && eval $libscheck
4958                 $test -f "$xxx" && libstyle=static
4959             fi
4960             if test ! -f "$xxx"; then
4961                 xxx=$thisdir/lib${thislib}_s$_a
4962                 $test -f "$xxx" && eval $libscheck
4963                 $test -f "$xxx" && libstyle=static
4964                 $test -f "$xxx" && thislib=${thislib}_s
4965             fi
4966             if test ! -f "$xxx"; then
4967                 xxx=$thisdir/Slib$thislib$_a
4968                 $test -f "$xxx" && eval $libscheck
4969                 $test -f "$xxx" && libstyle=static
4970             fi
4971             if $test -f "$xxx"; then
4972                 case "$libstyle" in
4973                 shared) echo "Found -l$thislib (shared)." ;;
4974                 static) echo "Found -l$thislib." ;;
4975                 *)      echo "Found -l$thislib ($libstyle)." ;;
4976                 esac
4977                 case " $dflt " in
4978                 *"-l$thislib "*);;
4979                 *) dflt="$dflt -l$thislib"
4980                    libsfound="$libsfound $xxx"
4981                    yyy=`basename $xxx`
4982                    libsfiles="$libsfiles $yyy"
4983                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4984                    case " $libsdirs " in
4985                    *" $yyy "*) ;;
4986                    *) libsdirs="$libsdirs $yyy" ;;
4987                    esac
4988                    ;;
4989                 esac
4990                 break
4991             fi
4992         done
4993         if $test ! -f "$xxx"; then
4994             echo "No -l$thislib."
4995         fi
4996 done
4997 set X $dflt
4998 shift
4999 dflt="$*"
5000 case "$libs" in
5001 '') dflt="$dflt";;
5002 *) dflt="$libs";;
5003 esac
5004 case "$dflt" in
5005 ' '|'') dflt='none';;
5006 esac
5007
5008 $cat <<EOM
5009
5010 In order to compile $package on your machine, a number of libraries
5011 are usually needed.  Include any other special libraries here as well.
5012 Say "none" for none.  The default list is almost always right.
5013 EOM
5014
5015 echo " "
5016 rp="What libraries to use?"
5017 . ./myread
5018 case "$ans" in
5019 none) libs=' ';;
5020 *) libs="$ans";;
5021 esac
5022
5023 : determine optimization, if desired, or use for debug flag also
5024 case "$optimize" in
5025 ' '|$undef) dflt='none';;
5026 '') dflt='-O';;
5027 *) dflt="$optimize";;
5028 esac
5029 $cat <<EOH
5030
5031 By default, $package compiles with the -O flag to use the optimizer.
5032 Alternately, you might want to use the symbolic debugger, which uses
5033 the -g flag (on traditional Unix systems).  Either flag can be
5034 specified here.  To use neither flag, specify the word "none".
5035
5036 EOH
5037 rp="What optimizer/debugger flag should be used?"
5038 . ./myread
5039 optimize="$ans"
5040 case "$optimize" in
5041 'none') optimize=" ";;
5042 esac
5043
5044 : Check what DEBUGGING is required from the command line
5045 : -DEBUGGING      or -DDEBUGGING or
5046 : -DEBUGGING=both                       = -g + -DDEBUGGING
5047 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5048 : -DEBUGGING=none or -UDEBUGGING        =
5049 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5050 case "$EBUGGING" in
5051 '')     ;;
5052 *)      DEBUGGING=$EBUGGING ;;
5053 esac
5054
5055 case "$DEBUGGING" in
5056 -g|both|$define)
5057     case "$optimize" in
5058         *-g*) ;;
5059         *)    optimize="$optimize -g" ;;
5060     esac ;;
5061 none|$undef)
5062     case "$optimize" in
5063         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5064                 shift
5065                 optimize="$*"
5066                 ;;
5067     esac ;;
5068 esac
5069
5070 dflt=''
5071 case "$DEBUGGING" in
5072 both|$define) dflt='-DDEBUGGING'
5073 esac
5074
5075 : argument order is deliberate, as the flag will start with - which set could
5076 : think is an option
5077 checkccflag='check=$1; flag=$2; callback=$3;
5078 echo " ";
5079 echo "Checking if your compiler accepts $flag" 2>&1;
5080 echo "int main(void) { return 0; }" > gcctest.c;
5081 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5082     echo "Yes, it does." 2>&1;
5083     if $test -s gcctest.out ; then
5084         echo "But your platform does not like it:";
5085         cat gcctest.out;
5086     else
5087         case "$ccflags" in
5088         *$check*)
5089             echo "Leaving current flags $ccflags alone." 2>&1
5090             ;;
5091         *) dflt="$dflt $flag";
5092             eval $callback
5093             ;;
5094         esac
5095     fi
5096 else
5097     echo "Nope, it does not, but that is ok." 2>&1;
5098 fi
5099 '
5100
5101 : We will not override a previous value, but we might want to
5102 : augment a hint file
5103 case "$hint" in
5104 default|recommended)
5105         case "$gccversion" in
5106         1*) dflt="$dflt -fpcc-struct-return" ;;
5107         esac
5108         case "$optimize:$DEBUGGING" in
5109         *-g*:old) dflt="$dflt -DDEBUGGING";;
5110         esac
5111         case "$gccversion" in
5112         2*) if $test -d /etc/conf/kconfig.d &&
5113                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5114                 then
5115                         # Interactive Systems (ISC) POSIX mode.
5116                         dflt="$dflt -posix"
5117                 fi
5118                 ;;
5119         esac
5120         case "$gccversion" in
5121         1*) ;;
5122         2.[0-8]*) ;;
5123         ?*)     set strict-aliasing -fno-strict-aliasing
5124                 eval $checkccflag
5125                 ;;
5126         esac
5127         # For gcc, adding -pipe speeds up compilations for some, but apparently
5128         # some assemblers can't read from stdin.  (It also slows down compilations
5129         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5130         case "$gccversion" in
5131         ?*)     set pipe -pipe
5132                 eval $checkccflag
5133                 ;;
5134         esac
5135
5136         # on x86_64 (at least) we require an extra library (libssp) in the
5137         # link command line. This library is not named, so I infer that it is
5138         # an implementation detail that may change. Hence the safest approach
5139         # is to add the flag to the flags passed to the compiler at link time,
5140         # as that way the compiler can do the right implementation dependant
5141         # thing. (NWC)
5142         case "$gccversion" in
5143         ?*)     set stack-protector -fstack-protector
5144                 eval $checkccflag
5145                 ;;
5146         esac
5147         ;;
5148 esac
5149
5150 case "$mips_type" in
5151 *BSD*|'') inclwanted="$locincpth $usrinc";;
5152 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5153 esac
5154 for thisincl in $inclwanted; do
5155         if $test -d $thisincl; then
5156                 if $test x$thisincl != x$usrinc; then
5157                         case "$dflt" in
5158                         *" -I$thisincl "*);;
5159                         *) dflt="$dflt -I$thisincl ";;
5160                         esac
5161                 fi
5162         fi
5163 done
5164
5165 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5166         xxx=true;
5167 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5168         xxx=true;
5169 else
5170         xxx=false;
5171 fi;
5172 if $xxx; then
5173         case "$dflt" in
5174         *$2*);;
5175         *) dflt="$dflt -D$2";;
5176         esac;
5177 fi'
5178
5179 set signal.h LANGUAGE_C; eval $inctest
5180
5181 case "$usesocks" in
5182 $define)
5183         ccflags="$ccflags -DSOCKS"
5184         ;;
5185 esac
5186
5187 case "$hint" in
5188 default|recommended) dflt="$ccflags $dflt" ;;
5189 *) dflt="$ccflags";;
5190 esac
5191
5192 case "$dflt" in
5193 ''|' ') dflt=none;;
5194 esac
5195
5196 $cat <<EOH
5197
5198 Your C compiler may want other flags.  For this question you should include
5199 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5200 but you should NOT include libraries or ld flags like -lwhatever.  If you
5201 want $package to honor its debug switch, you should include -DDEBUGGING here.
5202 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5203
5204 To use no flags, specify the word "none".
5205
5206 EOH
5207 set X $dflt
5208 shift
5209 dflt=${1+"$@"}
5210 rp="Any additional cc flags?"
5211 . ./myread
5212 case "$ans" in
5213 none) ccflags='';;
5214 *) ccflags="$ans";;
5215 esac
5216
5217 : the following weeds options from ccflags that are of no interest to cpp
5218 case "$cppflags" in
5219 '') cppflags="$ccflags" ;;
5220 *)  cppflags="$cppflags $ccflags" ;;
5221 esac
5222 case "$gccversion" in
5223 1*) cppflags="$cppflags -D__GNUC__"
5224 esac
5225 case "$mips_type" in
5226 '');;
5227 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5228 esac
5229 case "$cppflags" in
5230 '');;
5231 *)
5232         echo " "
5233         echo "Let me guess what the preprocessor flags are..." >&4
5234         set X $cppflags
5235         shift
5236         cppflags=''
5237         $cat >cpp.c <<'EOM'
5238 #define BLURFL foo
5239
5240 BLURFL xx LFRULB
5241 EOM
5242         previous=''
5243         for flag in $*
5244         do
5245                 case "$flag" in
5246                 -*) ftry="$flag";;
5247                 *) ftry="$previous $flag";;
5248                 esac
5249                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5250                         >cpp1.out 2>/dev/null && \
5251                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5252                         >cpp2.out 2>/dev/null && \
5253                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5254                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5255                 then
5256                         cppflags="$cppflags $ftry"
5257                         previous=''
5258                 else
5259                         previous="$flag"
5260                 fi
5261         done
5262         set X $cppflags
5263         shift
5264         cppflags=${1+"$@"}
5265         case "$cppflags" in
5266         *-*)  echo "They appear to be: $cppflags";;
5267         esac
5268         $rm -f cpp.c cpp?.out
5269         ;;
5270 esac
5271
5272 : flags used in final linking phase
5273 case "$ldflags" in
5274 '') if ./venix; then
5275                 dflt='-i -z'
5276         else
5277                 dflt=''
5278         fi
5279         case "$ccflags" in
5280         *-posix*) dflt="$dflt -posix" ;;
5281         esac
5282         ;;
5283 *) dflt="$ldflags";;
5284 esac
5285 # See note above about -fstack-protector
5286 case "$ccflags" in
5287 *-fstack-protector*) 
5288         case "$dflt" in
5289         *-fstack-protector*) ;; # Don't add it again
5290         *) dflt="$dflt -fstack-protector" ;; 
5291         esac
5292         ;;
5293 esac
5294
5295 : Try to guess additional flags to pick up local libraries.
5296 for thislibdir in $libpth; do
5297         case " $loclibpth " in
5298         *" $thislibdir "*)
5299                 case "$dflt " in
5300                 *"-L$thislibdir "*) ;;
5301                 *)  dflt="$dflt -L$thislibdir" ;;
5302                 esac
5303                 ;;
5304         esac
5305 done
5306
5307 case "$dflt" in
5308 '') dflt='none' ;;
5309 esac
5310
5311 $cat <<EOH
5312
5313 Your C linker may need flags.  For this question you should
5314 include -L/whatever and any other flags used by the C linker, but you
5315 should NOT include libraries like -lwhatever.
5316
5317 Make sure you include the appropriate -L/path flags if your C linker
5318 does not normally search all of the directories you specified above,
5319 namely
5320         $libpth
5321 To use no flags, specify the word "none".
5322
5323 EOH
5324
5325 rp="Any additional ld flags (NOT including libraries)?"
5326 . ./myread
5327 case "$ans" in
5328 none) ldflags='';;
5329 *) ldflags="$ans";;
5330 esac
5331 rmlist="$rmlist pdp11"
5332
5333 : coherency check
5334 echo " "
5335 echo "Checking your choice of C compiler and flags for coherency..." >&4
5336 $cat > try.c <<'EOF'
5337 #include <stdio.h>
5338 int main() { printf("Ok\n"); return(0); }
5339 EOF
5340 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5341 shift
5342 $cat >try.msg <<'EOM'
5343 I've tried to compile and run the following simple program:
5344
5345 EOM
5346 $cat try.c >> try.msg
5347
5348 $cat >> try.msg <<EOM
5349
5350 I used the command:
5351
5352         $*
5353         $run ./try
5354
5355 and I got the following output:
5356
5357 EOM
5358 dflt=y
5359 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5360         if $sh -c "$run ./try " >>try.msg 2>&1; then
5361                 xxx=`$run ./try`
5362                 case "$xxx" in
5363                 "Ok") dflt=n ;;
5364                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5365                         case " $libs " in
5366                         *" -lsfio "*)
5367                                 cat >> try.msg <<'EOQS'
5368 If $libs contains -lsfio, and sfio is mis-configured, then it
5369 sometimes (apparently) runs and exits with a 0 status, but with no
5370 output!  It may have to do with sfio's use of _exit vs. exit.
5371
5372 EOQS
5373                                 rp="You have a big problem.  Shall I abort Configure"
5374                                 dflt=y
5375                                 ;;
5376                         esac
5377                         ;;
5378                 esac
5379         else
5380                 echo "The program compiled OK, but exited with status $?." >>try.msg
5381                 rp="You have a problem.  Shall I abort Configure"
5382                 dflt=y
5383         fi
5384 else
5385         echo "I can't compile the test program." >>try.msg
5386         rp="You have a BIG problem.  Shall I abort Configure"
5387         dflt=y
5388 fi
5389 case "$dflt" in
5390 y)
5391         $cat try.msg >&4
5392         case "$knowitall" in
5393         '')
5394                 echo "(The supplied flags or libraries might be incorrect.)"
5395                 ;;
5396         *) dflt=n;;
5397         esac
5398         echo " "
5399         . ./myread
5400         case "$ans" in
5401         n*|N*) ;;
5402         *)      echo "Ok.  Stopping Configure." >&4
5403                 exit 1
5404                 ;;
5405         esac
5406         ;;
5407 n) echo "OK, that should do.";;
5408 esac
5409 $rm_try gcctest gcctest.out
5410
5411 : define a shorthand compile call
5412 compile='
5413 mc_file=$1;
5414 shift;
5415 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5416 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5417 exit 1;
5418 fi;
5419 esac;
5420 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5421 : define a shorthand compile call for compilations that should be ok.
5422 compile_ok='
5423 mc_file=$1;
5424 shift;
5425 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5426
5427 : determine filename position in cpp output
5428 echo " "
5429 echo "Computing filename position in cpp output for #include directives..." >&4
5430 case "$osname" in
5431 vos) testaccess=-e ;;
5432 *)   testaccess=-r ;;
5433 esac
5434 echo '#include <stdio.h>' > foo.c
5435 $cat >fieldn <<EOF
5436 $startsh
5437 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5438 $grep '^[       ]*#.*stdio\.h' | \
5439 while read cline; do
5440         pos=1
5441         set \$cline
5442         while $test \$# -gt 0; do
5443                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5444                         echo "\$pos"
5445                         exit 0
5446                 fi
5447                 shift
5448                 pos=\`expr \$pos + 1\`
5449         done
5450 done
5451 EOF
5452 chmod +x fieldn
5453 fieldn=`./fieldn`
5454 $rm -f foo.c fieldn
5455 case $fieldn in
5456 '') pos='???';;
5457 1) pos=first;;
5458 2) pos=second;;
5459 3) pos=third;;
5460 *) pos="${fieldn}th";;
5461 esac
5462 echo "Your cpp writes the filename in the $pos field of the line."
5463
5464 case "$osname" in
5465 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5466 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5467 *)   cppfilter='' ;;
5468 esac
5469 : locate header file
5470 $cat >findhdr <<EOF
5471 $startsh
5472 wanted=\$1
5473 name=''
5474 for usrincdir in $usrinc
5475 do
5476         if test -f \$usrincdir/\$wanted; then
5477                 echo "\$usrincdir/\$wanted"
5478                 exit 0
5479         fi
5480 done
5481 awkprg='{ print \$$fieldn }'
5482 echo "#include <\$wanted>" > foo\$\$.c
5483 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5484 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5485 while read cline; do
5486         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5487         case "\$name" in
5488         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5489         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5490         *) exit 2;;
5491         esac;
5492 done;
5493 #
5494 # status = 0: grep returned 0 lines, case statement not executed
5495 # status = 1: headerfile found
5496 # status = 2: while loop executed, no headerfile found
5497 #
5498 status=\$?
5499 $rm -f foo\$\$.c;
5500 if test \$status -eq 1; then
5501         exit 0;
5502 fi
5503 exit 1
5504 EOF
5505 chmod +x findhdr
5506
5507 : define an alternate in-header-list? function
5508 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5509 cont=true; xxf="echo \"<\$1> found.\" >&4";
5510 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5511 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5512 esac;
5513 case $# in 4) instead=instead;; *) instead="at last";; esac;
5514 while $test "$cont"; do
5515         xxx=`./findhdr $1`
5516         var=$2; eval "was=\$$2";
5517         if $test "$xxx" && $test -r "$xxx";
5518         then eval $xxf;
5519         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5520                 cont="";
5521         else eval $xxnf;
5522         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5523         set $yyy; shift; shift; yyy=$@;
5524         case $# in 0) cont="";;
5525         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5526                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5527         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5528                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5529         esac;
5530 done;
5531 while $test "$yyy";
5532 do set $yyy; var=$2; eval "was=\$$2";
5533         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5534         set $yyy; shift; shift; yyy=$@;
5535 done'
5536
5537 : see if stdlib is available
5538 set stdlib.h i_stdlib
5539 eval $inhdr
5540
5541 : check for lengths of integral types
5542 echo " "
5543 case "$intsize" in
5544 '')
5545         echo "Checking to see how big your integers are..." >&4
5546         $cat >try.c <<EOCP
5547 #include <stdio.h>
5548 #$i_stdlib I_STDLIB
5549 #ifdef I_STDLIB
5550 #include <stdlib.h>
5551 #endif
5552 int main()
5553 {
5554         printf("intsize=%d;\n", (int)sizeof(int));
5555         printf("longsize=%d;\n", (int)sizeof(long));
5556         printf("shortsize=%d;\n", (int)sizeof(short));
5557         exit(0);
5558 }
5559 EOCP
5560         set try
5561         if eval $compile_ok && $run ./try > /dev/null; then
5562                 eval `$run ./try`
5563                 echo "Your integers are $intsize bytes long."
5564                 echo "Your long integers are $longsize bytes long."
5565                 echo "Your short integers are $shortsize bytes long."
5566         else
5567                 $cat >&4 <<EOM
5568 !
5569 Help! I can't compile and run the intsize test program: please enlighten me!
5570 (This is probably a misconfiguration in your system or libraries, and
5571 you really ought to fix it.  Still, I'll try anyway.)
5572 !
5573 EOM
5574                 dflt=4
5575                 rp="What is the size of an integer (in bytes)?"
5576                 . ./myread
5577                 intsize="$ans"
5578                 dflt=$intsize
5579                 rp="What is the size of a long integer (in bytes)?"
5580                 . ./myread
5581                 longsize="$ans"
5582                 dflt=2
5583                 rp="What is the size of a short integer (in bytes)?"
5584                 . ./myread
5585                 shortsize="$ans"
5586         fi
5587         ;;
5588 esac
5589 $rm_try
5590
5591 : check for long long
5592 echo " "
5593 echo "Checking to see if you have long long..." >&4
5594 echo 'int main() { long long x = 7; return 0; }' > try.c
5595 set try
5596 if eval $compile; then
5597         val="$define"
5598         echo "You have long long."
5599 else
5600         val="$undef"
5601         echo "You do not have long long."
5602 fi
5603 $rm_try
5604 set d_longlong
5605 eval $setvar
5606
5607 : check for length of long long
5608 case "${d_longlong}${longlongsize}" in
5609 $define)
5610         echo " "
5611         echo "Checking to see how big your long longs are..." >&4
5612         $cat >try.c <<'EOCP'
5613 #include <stdio.h>
5614 int main()
5615 {
5616     printf("%d\n", (int)sizeof(long long));
5617     return(0);
5618 }
5619 EOCP
5620         set try
5621         if eval $compile_ok; then
5622                 longlongsize=`$run ./try`
5623                 echo "Your long longs are $longlongsize bytes long."
5624         else
5625                 dflt='8'
5626                 echo " "
5627                 echo "(I can't seem to compile the test program.  Guessing...)"
5628                 rp="What is the size of a long long (in bytes)?"
5629                 . ./myread
5630                 longlongsize="$ans"
5631         fi
5632         if $test "X$longsize" = "X$longlongsize"; then
5633                 echo "(That isn't any different from an ordinary long.)"
5634         fi
5635         ;;
5636 esac
5637 $rm_try
5638
5639 : see if inttypes.h is available
5640 : we want a real compile instead of Inhdr because some systems
5641 : have an inttypes.h which includes non-existent headers
5642 echo " "
5643 $cat >try.c <<EOCP
5644 #include <inttypes.h>
5645 int main() {
5646         static int32_t foo32 = 0x12345678;
5647 }
5648 EOCP
5649 set try
5650 if eval $compile; then
5651         echo "<inttypes.h> found." >&4
5652         val="$define"
5653 else
5654         echo "<inttypes.h> NOT found." >&4
5655         val="$undef"
5656 fi
5657 $rm_try
5658 set i_inttypes
5659 eval $setvar
5660
5661 : check for int64_t
5662 echo " "
5663 echo "Checking to see if you have int64_t..." >&4
5664 $cat >try.c <<EOCP
5665 #include <sys/types.h>
5666 #$i_inttypes I_INTTYPES
5667 #ifdef I_INTTYPES
5668 #include <inttypes.h>
5669 #endif
5670 int main() { int64_t x = 7; }
5671 EOCP
5672 set try
5673 if eval $compile; then
5674         val="$define"
5675         echo "You have int64_t."
5676 else
5677         val="$undef"
5678         echo "You do not have int64_t."
5679 fi
5680 $rm_try
5681 set d_int64_t
5682 eval $setvar
5683
5684 : Check if 64bit ints have a quad type
5685 echo " "
5686 echo "Checking which 64-bit integer type we could use..." >&4
5687
5688 case "$intsize" in
5689 8) val=int
5690    set quadtype
5691    eval $setvar
5692    val='"unsigned int"'
5693    set uquadtype
5694    eval $setvar
5695    quadkind=1
5696    ;;
5697 *) case "$longsize" in
5698    8) val=long
5699       set quadtype
5700       eval $setvar
5701       val='"unsigned long"'
5702       set uquadtype
5703       eval $setvar
5704       quadkind=2
5705       ;;
5706    *) case "$d_longlong:$longlongsize" in
5707       define:8)
5708         val='"long long"'
5709         set quadtype
5710         eval $setvar
5711         val='"unsigned long long"'
5712         set uquadtype
5713         eval $setvar
5714         quadkind=3
5715         ;;
5716       *) case "$d_int64_t" in
5717          define)
5718            val=int64_t
5719            set quadtype
5720            eval $setvar
5721            val=uint64_t
5722            set uquadtype
5723            eval $setvar
5724            quadkind=4
5725            ;;
5726          esac
5727          ;;
5728       esac
5729       ;;
5730    esac
5731    ;;
5732 esac
5733
5734 case "$quadtype" in
5735 '')     echo "Alas, no 64-bit integer types in sight." >&4
5736         d_quad="$undef"
5737         ;;
5738 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5739         d_quad="$define"
5740         ;;
5741 esac
5742
5743 : Do we want 64bit support
5744 case "$uselonglong" in
5745 "$define"|true|[yY]*)
5746         cat <<EOM >&4
5747
5748 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5749 EOM
5750         use64bitint="$define"
5751         ;;
5752 esac
5753 case "$use64bits" in
5754 "$define"|true|[yY]*)
5755         cat <<EOM >&4
5756
5757 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5758 EOM
5759         use64bitint="$define"
5760         ;;
5761 esac
5762 case "$use64bitints" in
5763 "$define"|true|[yY]*)
5764         cat <<EOM >&4
5765
5766 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5767 EOM
5768         use64bitint="$define"
5769         ;;
5770 esac
5771 case "$use64bitsint" in
5772 "$define"|true|[yY]*)
5773         cat <<EOM >&4
5774
5775 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5776 EOM
5777         use64bitint="$define"
5778         ;;
5779 esac
5780 case "$uselonglongs" in
5781 "$define"|true|[yY]*)
5782         cat <<EOM >&4
5783
5784 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5785 EOM
5786         use64bitint="$define"
5787         ;;
5788 esac
5789 case "$use64bitsall" in
5790 "$define"|true|[yY]*)
5791         cat <<EOM >&4
5792
5793 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5794 EOM
5795         use64bitall="$define"
5796         ;;
5797 esac
5798
5799 case "$ccflags" in
5800 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5801 esac
5802 case "$use64bitall" in
5803 "$define"|true|[yY]*) use64bitint="$define" ;;
5804 esac
5805
5806 case "$longsize" in
5807 8) cat <<EOM
5808
5809 You have natively 64-bit long integers.
5810 EOM
5811    val="$define"
5812    ;;
5813 *) case "$use64bitint" in
5814    "$define"|true|[yY]*) dflt='y';;
5815    *) dflt='n';;
5816    esac
5817    case "$d_quad" in
5818    "$define") ;;
5819    *) dflt='n' ;;
5820    esac
5821    cat <<EOM
5822
5823 Perl can be built to take advantage of 64-bit integer types
5824 on some systems.  To do so, Configure can be run with -Duse64bitint.
5825 Choosing this option will most probably introduce binary incompatibilities.
5826
5827 If this doesn't make any sense to you, just accept the default '$dflt'.
5828 (The default has been chosen based on your configuration.)
5829 EOM
5830    rp='Try to use 64-bit integers, if available?'
5831    . ./myread
5832    case "$ans" in
5833    [yY]*) val="$define" ;;
5834    *)     val="$undef"  ;;
5835    esac
5836    ;;
5837 esac
5838 set use64bitint
5839 eval $setvar
5840
5841 case "$use64bitall" in
5842 "$define"|true|[yY]*) dflt='y' ;;
5843 *) case "$longsize" in
5844    8) dflt='y' ;;
5845    *) dflt='n' ;;
5846    esac
5847    ;;
5848 esac
5849 cat <<EOM
5850
5851 You may also choose to try maximal 64-bitness.  It means using as much
5852 64-bitness as possible on the platform.  This in turn means even more
5853 binary incompatibilities.  On the other hand, your platform may not
5854 have any more 64-bitness available than what you already have chosen.
5855
5856 If this doesn't make any sense to you, just accept the default '$dflt'.
5857 (The default has been chosen based on your configuration.)
5858 EOM
5859 rp='Try to use maximal 64-bit support, if available?'
5860 . ./myread
5861 case "$ans" in
5862 [yY]*) val="$define" ;;
5863 *)     val="$undef"  ;;
5864 esac
5865 set use64bitall
5866 eval $setvar
5867 case "$use64bitall" in
5868 "$define")
5869         case "$use64bitint" in
5870         "$undef")
5871                 cat <<EOM
5872
5873 Since you have chosen a maximally 64-bit build, I'm also turning on
5874 the use of 64-bit integers.
5875 EOM
5876                 use64bitint="$define" ;;
5877         esac
5878         ;;
5879 esac
5880
5881 : Look for a hint-file generated 'call-back-unit'.  If the
5882 : user has specified that a 64-bit perl is to be built,
5883 : we may need to set or change some other defaults.
5884 if $test -f use64bitint.cbu; then
5885         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5886         . ./use64bitint.cbu
5887 fi
5888 case "$use64bitint" in
5889 "$define"|true|[yY]*)
5890         case "$longsize" in
5891         4) case "$archname64" in
5892            '') archname64=64int ;;
5893            esac
5894            ;;
5895         esac
5896         ;;
5897 esac
5898
5899 : Look for a hint-file generated 'call-back-unit'.  If the
5900 : user has specified that a maximally 64-bit perl is to be built,
5901 : we may need to set or change some other defaults.
5902 if $test -f use64bitall.cbu; then
5903         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5904         . ./use64bitall.cbu
5905 fi
5906 case "$use64bitall" in
5907 "$define"|true|[yY]*)
5908         case "$longsize" in
5909         4) case "$archname64" in
5910            ''|64int) archname64=64all ;;
5911            esac
5912            ;;
5913         esac
5914         ;;
5915 esac
5916
5917 case "$d_quad:$use64bitint" in
5918 $undef:$define)
5919         cat >&4 <<EOF
5920
5921 *** You have chosen to use 64-bit integers,
5922 *** but none can be found.
5923 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5924 *** Cannot continue, aborting.
5925
5926 EOF
5927         exit 1
5928         ;;
5929 esac
5930
5931 : check for length of double
5932 echo " "
5933 case "$doublesize" in
5934 '')
5935         echo "Checking to see how big your double precision numbers are..." >&4
5936         $cat >try.c <<EOCP
5937 #include <stdio.h>
5938 #$i_stdlib I_STDLIB
5939 #ifdef I_STDLIB
5940 #include <stdlib.h>
5941 #endif
5942 int main()
5943 {
5944     printf("%d\n", (int)sizeof(double));
5945     exit(0);
5946 }
5947 EOCP
5948         set try
5949         if eval $compile_ok; then
5950                 doublesize=`$run ./try`
5951                 echo "Your double is $doublesize bytes long."
5952         else
5953                 dflt='8'
5954                 echo "(I can't seem to compile the test program.  Guessing...)"
5955                 rp="What is the size of a double precision number (in bytes)?"
5956                 . ./myread
5957                 doublesize="$ans"
5958         fi
5959         ;;
5960 esac
5961 $rm_try
5962
5963 : check for long doubles
5964 echo " "
5965 echo "Checking to see if you have long double..." >&4
5966 echo 'int main() { long double x = 7.0; }' > try.c
5967 set try
5968 if eval $compile; then
5969         val="$define"
5970         echo "You have long double."
5971 else
5972         val="$undef"
5973         echo "You do not have long double."
5974 fi
5975 $rm_try
5976 set d_longdbl
5977 eval $setvar
5978
5979 : check for length of long double
5980 case "${d_longdbl}${longdblsize}" in
5981 $define)
5982         echo " "
5983         echo "Checking to see how big your long doubles are..." >&4
5984         $cat >try.c <<'EOCP'
5985 #include <stdio.h>
5986 int main()
5987 {
5988         printf("%d\n", sizeof(long double));
5989 }
5990 EOCP
5991         set try
5992         set try
5993         if eval $compile; then
5994                 longdblsize=`$run ./try`
5995                 echo "Your long doubles are $longdblsize bytes long."
5996         else
5997                 dflt='8'
5998                 echo " "
5999                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6000                 rp="What is the size of a long double (in bytes)?"
6001                 . ./myread
6002                 longdblsize="$ans"
6003         fi
6004         if $test "X$doublesize" = "X$longdblsize"; then
6005                 echo "That isn't any different from an ordinary double."
6006                 echo "I'll keep your setting anyway, but you may see some"
6007                 echo "harmless compilation warnings."
6008         fi
6009         ;;
6010 esac
6011 $rm_try
6012
6013 : determine the architecture name
6014 echo " "
6015 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6016         tarch=`arch`"-$osname"
6017 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6018         if uname -m > tmparch 2>&1 ; then
6019                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6020                         -e 's/$/'"-$osname/" tmparch`
6021         else
6022                 tarch="$osname"
6023         fi
6024         $rm -f tmparch
6025 else
6026         tarch="$osname"
6027 fi
6028 case "$myarchname" in
6029 ''|"$tarch") ;;
6030 *)
6031         echo "(Your architecture name used to be $myarchname.)"
6032         archname=''
6033         ;;
6034 esac
6035 case "$targetarch" in
6036 '') ;;
6037 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6038 esac
6039 myarchname="$tarch"
6040 case "$archname" in
6041 '') dflt="$tarch";;
6042 *) dflt="$archname";;
6043 esac
6044 rp='What is your architecture name'
6045 . ./myread
6046 archname="$ans"
6047 case "$usethreads" in
6048 $define)
6049         echo "Threads selected." >&4
6050         case "$archname" in
6051         *-thread*) echo "...and architecture name already has -thread." >&4
6052                 ;;
6053         *)      archname="$archname-thread"
6054                 echo "...setting architecture name to $archname." >&4
6055                 ;;
6056         esac
6057         ;;
6058 esac
6059 case "$usemultiplicity" in
6060 $define)
6061         echo "Multiplicity selected." >&4
6062         case "$archname" in
6063         *-multi*) echo "...and architecture name already has -multi." >&4
6064                 ;;
6065         *)      archname="$archname-multi"
6066                 echo "...setting architecture name to $archname." >&4
6067                 ;;
6068         esac
6069         ;;
6070 esac
6071 case "$use64bitint$use64bitall" in
6072 *"$define"*)
6073         case "$archname64" in
6074         '')
6075                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6076                 ;;
6077         *)
6078                 case "$use64bitint" in
6079                 "$define") echo "64 bit integers selected." >&4 ;;
6080                 esac
6081                 case "$use64bitall" in
6082                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6083                 esac
6084                 case "$archname" in
6085                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6086                         ;;
6087                 *)      archname="$archname-$archname64"
6088                         echo "...setting architecture name to $archname." >&4
6089                         ;;
6090                 esac
6091                 ;;
6092         esac
6093 esac
6094 case "$uselongdouble" in
6095 $define)
6096         echo "Long doubles selected." >&4
6097         case "$longdblsize" in
6098         $doublesize)
6099                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6100                 ;;
6101         *)
6102                 case "$archname" in
6103                 *-ld*) echo "...and architecture name already has -ld." >&4
6104                         ;;
6105                 *)      archname="$archname-ld"
6106                         echo "...setting architecture name to $archname." >&4
6107                         ;;
6108                 esac
6109                 ;;
6110         esac
6111         ;;
6112 esac
6113 case "$useperlio" in
6114 $define)
6115         echo "Perlio selected." >&4
6116         ;;
6117 *)
6118         echo "Perlio not selected, using stdio." >&4
6119         case "$archname" in
6120         *-stdio*) echo "...and architecture name already has -stdio." >&4
6121                 ;;
6122         *)      archname="$archname-stdio"
6123                 echo "...setting architecture name to $archname." >&4
6124                 ;;
6125         esac
6126         ;;
6127 esac
6128 if $test -f archname.cbu; then
6129         echo "Your platform has some specific hints for architecture name, using them..."
6130         . ./archname.cbu
6131 fi
6132
6133 : set the prefixit variable, to compute a suitable default value
6134 prefixit='case "$3" in
6135 ""|none)
6136         case "$oldprefix" in
6137         "") eval "$1=\"\$$2\"";;
6138         *)
6139                 case "$3" in
6140                 "") eval "$1=";;
6141                 none)
6142                         eval "tp=\"\$$2\"";
6143                         case "$tp" in
6144                         ""|" ") eval "$1=\"\$$2\"";;
6145                         *) eval "$1=";;
6146                         esac;;
6147                 esac;;
6148         esac;;
6149 *)
6150         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6151         case "$tp" in
6152         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6153         /*-$oldprefix/*|\~*-$oldprefix/*)
6154                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6155         *) eval "$1=\"\$$2\"";;
6156         esac;;
6157 esac'
6158
6159 : determine installation style
6160 : For now, try to deduce it from prefix unless it is already set.
6161 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6162 case "$installstyle" in
6163 '')     case "$prefix" in
6164                 *perl*) dflt='lib';;
6165                 *) dflt='lib/perl5' ;;
6166         esac
6167         ;;
6168 *)      dflt="$installstyle" ;;
6169 esac
6170 : Probably not worth prompting for this since we prompt for all
6171 : the directories individually, and the prompt would be too long and
6172 : confusing anyway.
6173 installstyle=$dflt
6174
6175 : determine where public executables go
6176 echo " "
6177 set dflt bin bin
6178 eval $prefixit
6179 fn=d~
6180 rp='Pathname where the public executables will reside?'
6181 . ./getfile
6182 if $test "X$ansexp" != "X$binexp"; then
6183         installbin=''
6184 fi
6185 prefixvar=bin
6186 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6187 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6188 :     this via initialinstalllocation
6189 . ./setprefixvar
6190
6191 case "$userelocatableinc" in
6192 $define|true|[yY]*)     dflt='y' ;;
6193 *)                      dflt='n' ;;
6194 esac
6195 cat <<EOM
6196
6197 Would you like to build Perl so that the installation is relocatable, so that
6198 library paths in @INC are determined relative to the path of the perl binary?
6199 This is not advised for system Perl installs, or if you need to run setid
6200 scripts or scripts under taint mode.
6201
6202 If this doesn't make any sense to you, just accept the default '$dflt'.
6203 EOM
6204 rp='Use relocatable @INC?'
6205 . ./myread
6206 case "$ans" in
6207 y|Y)    val="$define" ;;
6208 *)      val="$undef"  ;;
6209 esac
6210 set userelocatableinc
6211 eval $setvar
6212
6213 initialinstalllocation="$binexp"
6214 : Default prefix is now "up one level from where the binaries are"
6215 case "$userelocatableinc" in
6216 $define|true|[yY]*)
6217     bin=".../"
6218     binexp=".../"
6219     prefix=".../.."
6220     prefixexp=".../.."
6221     installprefixexp=".../.."
6222     ;;
6223 esac
6224
6225 : determine where private library files go
6226 : Usual default is /usr/local/lib/perl5/$version.
6227 : Also allow things like /opt/perl/lib/$version, since
6228 : /opt/perl/lib/perl5... would be redundant.
6229 : The default "style" setting is made in installstyle.U
6230 case "$installstyle" in
6231 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6232 *)       set dflt privlib lib/$version ;;
6233 esac
6234 eval $prefixit
6235 $cat <<EOM
6236
6237 There are some auxiliary files for $package that need to be put into a
6238 private library directory that is accessible by everyone.
6239
6240 EOM
6241 fn=$binexp
6242 fn=d~+
6243 rp='Pathname where the private library files will reside?'
6244 . ./getfile
6245 prefixvar=privlib
6246 . ./setprefixvar
6247
6248 : set the prefixup variable, to restore leading tilda escape
6249 prefixup='case "$prefixexp" in
6250 "$prefix") ;;
6251 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6252 esac'
6253
6254 : determine where public architecture dependent libraries go
6255 set archlib archlib
6256 eval $prefixit
6257 : privlib default is /usr/local/lib/$package/$version
6258 : archlib default is /usr/local/lib/$package/$version/$archname
6259 : privlib may have an optional trailing /share.
6260 tdflt=`echo $privlib | $sed 's,/share$,,'`
6261 tdflt=$tdflt/$archname
6262 case "$archlib" in
6263 '')     dflt=$tdflt
6264         ;;
6265 *)      dflt="$archlib"
6266     ;;
6267 esac
6268 $cat <<EOM
6269
6270 $spackage contains architecture-dependent library files.  If you are
6271 sharing libraries in a heterogeneous environment, you might store
6272 these files in a separate location.  Otherwise, you can just include
6273 them with the rest of the public library files.
6274
6275 EOM
6276 fn=$binexp
6277 fn=d+~
6278 rp='Where do you want to put the public architecture-dependent libraries?'
6279 . ./getfile
6280 prefixvar=archlib
6281 . ./setprefixvar
6282 if $test X"$archlib" = X"$privlib"; then
6283         d_archlib="$undef"
6284 else
6285         d_archlib="$define"
6286 fi
6287
6288 : see if setuid scripts can be secure
6289 $cat <<EOM
6290
6291 Some kernels have a bug that prevents setuid #! scripts from being
6292 secure.  Some sites have disabled setuid #! scripts because of this.
6293
6294 First let's decide if your kernel supports secure setuid #! scripts.
6295 (If setuid #! scripts would be secure but have been disabled anyway,
6296 don't say that they are secure if asked.)
6297
6298 EOM
6299
6300 val="$undef"
6301 if $test -d /dev/fd; then
6302         echo "#!$ls" >reflect
6303         chmod +x,u+s reflect
6304         ./reflect >flect 2>&1
6305         if $contains "/dev/fd" flect >/dev/null; then
6306                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6307                 val="$define"
6308         else
6309                 $cat <<EOM
6310 If you are not sure if they are secure, I can check but I'll need a
6311 username and password different from the one you are using right now.
6312 If you don't have such a username or don't want me to test, simply
6313 enter 'none'.
6314
6315 EOM
6316                 rp='Other username to test security of setuid scripts with?'
6317                 dflt='none'
6318                 . ./myread
6319                 case "$ans" in
6320                 n|none)
6321                         case "$d_suidsafe" in
6322                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6323                                 dflt=n;;
6324                         "$undef")
6325                                 echo "Well, the $hint value is *not* secure." >&4
6326                                 dflt=n;;
6327                         *)      echo "Well, the $hint value *is* secure." >&4
6328                                 dflt=y;;
6329                         esac
6330                         ;;
6331                 *)
6332                         $rm -f reflect flect
6333                         echo "#!$ls" >reflect
6334                         chmod +x,u+s reflect
6335                         echo >flect
6336                         chmod a+w flect
6337                         echo '"su" will (probably) prompt you for '"$ans's password."
6338                         su $ans -c './reflect >flect'
6339                         if $contains "/dev/fd" flect >/dev/null; then
6340                                 echo "Okay, it looks like setuid scripts are secure." >&4
6341                                 dflt=y
6342                         else
6343                                 echo "I don't think setuid scripts are secure." >&4
6344                                 dflt=n
6345                         fi
6346                         ;;
6347                 esac
6348                 rp='Does your kernel have *secure* setuid scripts?'
6349                 . ./myread
6350                 case "$ans" in
6351                 [yY]*)  val="$define";;
6352                 *)      val="$undef";;
6353                 esac
6354         fi
6355 else
6356         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6357         echo "(That's for file descriptors, not floppy disks.)"
6358         val="$undef"
6359 fi
6360 set d_suidsafe
6361 eval $setvar
6362
6363 $rm -f reflect flect
6364
6365 : now see if they want to do setuid emulation
6366 echo " "
6367 val="$undef"
6368 case "$d_suidsafe" in
6369 "$define")
6370         val="$undef"
6371         echo "No need to emulate SUID scripts since they are secure here." >&4
6372         ;;
6373 *)
6374         $cat <<EOM
6375 Some systems have disabled setuid scripts, especially systems where
6376 setuid scripts cannot be secure.  On systems where setuid scripts have
6377 been disabled, the setuid/setgid bits on scripts are currently
6378 useless.  It is possible for $package to detect those bits and emulate
6379 setuid/setgid in a secure fashion.  This emulation will only work if
6380 setuid scripts have been disabled in your kernel.
6381
6382 EOM
6383         case "$d_dosuid" in
6384         "$define") dflt=y ;;
6385         *) dflt=n ;;
6386         esac
6387         rp="Do you want to do setuid/setgid emulation?"
6388         . ./myread
6389         case "$ans" in
6390         [yY]*)  val="$define";;
6391         *)      val="$undef";;
6392         esac
6393         ;;
6394 esac
6395 set d_dosuid
6396 eval $setvar
6397
6398 : Find perl5.005 or later.
6399 echo "Looking for a previously installed perl5.005 or later... "
6400 case "$perl5" in
6401 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6402                 : Check if this perl is recent and can load a simple module
6403                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6404                         perl5=$tdir/perl
6405                         break;
6406                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6407                         perl5=$tdir/perl5
6408                         break;
6409                 fi
6410         done
6411         ;;
6412 *)      perl5="$perl5"
6413         ;;
6414 esac
6415 case "$perl5" in
6416 '')     echo "None found.  That's ok.";;
6417 *)      echo "Using $perl5." ;;
6418 esac
6419
6420 : Set the siteprefix variables
6421 $cat <<EOM
6422
6423 After $package is installed, you may wish to install various
6424 add-on modules and utilities.  Typically, these add-ons will
6425 be installed under $prefix with the rest
6426 of this package.  However, you may wish to install such add-ons
6427 elsewhere under a different prefix.
6428
6429 If you do not wish to put everything under a single prefix, that's
6430 ok.  You will be prompted for the individual locations; this siteprefix
6431 is only used to suggest the defaults.
6432
6433 The default should be fine for most people.
6434
6435 EOM
6436 fn=d~+
6437 rp='Installation prefix to use for add-on modules and utilities?'
6438 : XXX Here might be another good place for an installstyle setting.
6439 case "$siteprefix" in
6440 '') dflt=$prefix ;;
6441 *)  dflt=$siteprefix ;;
6442 esac
6443 . ./getfile
6444 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6445 oldsiteprefix=''
6446 case "$siteprefix" in
6447 '') ;;
6448 *)      case "$ans" in
6449         "$prefix") ;;
6450         *) oldsiteprefix="$prefix";;
6451         esac
6452         ;;
6453 esac
6454 siteprefix="$ans"
6455 siteprefixexp="$ansexp"
6456
6457 : determine where site specific libraries go.
6458 : Usual default is /usr/local/lib/perl5/site_perl/$version
6459 : The default "style" setting is made in installstyle.U
6460 : XXX No longer works with Prefixit stuff.
6461 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6462 case "$sitelib" in
6463 '') case "$installstyle" in
6464         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6465         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6466         esac
6467         ;;
6468 *)      dflt="$sitelib"
6469         ;;
6470 esac
6471 $cat <<EOM
6472
6473 The installation process will create a directory for
6474 site-specific extensions and modules.  Most users find it convenient
6475 to place all site-specific files in this directory rather than in the
6476 main distribution directory.
6477
6478 EOM
6479 fn=d~+
6480 rp='Pathname for the site-specific library files?'
6481 . ./getfile
6482 prefixvar=sitelib
6483 . ./setprefixvar
6484 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6485
6486 : Determine list of previous versions to include in @INC
6487 $cat > getverlist <<EOPL
6488 #!$perl5 -w
6489 use File::Basename;
6490 \$api_versionstring = "$api_versionstring";
6491 \$version = "$version";
6492 \$stem = "$sitelib_stem";
6493 \$archname = "$archname";
6494 EOPL
6495         $cat >> getverlist <<'EOPL'
6496 # The list found is store twice for each entry: the original name, and
6497 # the binary broken down version as pack "sss", so sorting is easy and
6498 # unambiguous. This will work for all versions that have a maximum of
6499 # three digit groups, separate by '.'s or '_'s. Names are extended with
6500 # ".0.0" to ensure at least three elements for the pack.
6501 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6502
6503 # Can't have leading @ because metaconfig interprets it as a command!
6504 ;@inc_version_list=();
6505 # XXX Redo to do opendir/readdir?
6506 if (-d $stem) {
6507     chdir($stem);
6508     ;@candidates = map {
6509         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6510 }
6511 else {
6512     ;@candidates = ();
6513 }
6514
6515 ($pversion, $aversion, $vsn5005) = map {
6516     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6517 foreach $d (@candidates) {
6518     if ($d->[1] lt $pversion) {
6519         if ($d->[1] ge $aversion) {
6520             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6521         }
6522         elsif ($d->[1] ge $vsn5005) {
6523             unshift(@inc_version_list, grep { -d } $d->[0]);
6524         }
6525     }
6526     else {
6527         # Skip newer version.  I.e. don't look in
6528         # 5.7.0 if we're installing 5.6.1.
6529     }
6530 }
6531
6532 if (@inc_version_list) {
6533     print join(' ', @inc_version_list);
6534 }
6535 else {
6536     # Blank space to preserve value for next Configure run.
6537     print " ";
6538 }
6539 EOPL
6540 chmod +x getverlist
6541 case "$inc_version_list" in
6542 '')     if test -x "$perl5$exe_ext"; then
6543                 dflt=`$perl5 getverlist`
6544         else
6545                 dflt='none'
6546         fi
6547         ;;
6548 $undef) dflt='none' ;;
6549 *)  eval dflt=\"$inc_version_list\" ;;
6550 esac
6551 case "$dflt" in
6552 ''|' ') dflt=none ;;
6553 esac
6554 case "$dflt" in
6555 5.005) dflt=none ;;
6556 esac
6557 $cat <<EOM
6558
6559 In order to ease the process of upgrading, this version of perl
6560 can be configured to use modules built and installed with earlier
6561 versions of perl that were installed under $prefix.  Specify here
6562 the list of earlier versions that this version of perl should check.
6563 If Configure detected no earlier versions of perl installed under
6564 $prefix, then the list will be empty.  Answer 'none' to tell perl
6565 to not search earlier versions.
6566
6567 The default should almost always be sensible, so if you're not sure,
6568 just accept the default.
6569 EOM
6570
6571 rp='List of earlier versions to include in @INC?'
6572 . ./myread
6573 case "$ans" in
6574 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6575 *) inc_version_list="$ans" ;;
6576 esac
6577 case "$inc_version_list" in
6578 ''|' ')
6579         inc_version_list_init='0'
6580         d_inc_version_list="$undef"
6581         ;;
6582 *)      inc_version_list_init=`echo $inc_version_list |
6583                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6584         d_inc_version_list="$define"
6585         ;;
6586 esac
6587 $rm -f getverlist
6588
6589 : see if malloc/malloc.h has to be included
6590 set malloc/malloc.h i_mallocmalloc
6591 eval $inhdr
6592
6593 : see if this is a malloc.h system
6594 : we want a real compile instead of Inhdr because some systems have a
6595 : malloc.h that just gives a compile error saying to use stdlib.h instead
6596 echo " "
6597 $cat >try.c <<EOCP
6598 #include <stdlib.h>
6599 #include <malloc.h>
6600 #$i_mallocmalloc I_MALLOCMALLOC
6601 #ifdef I_MALLOCMALLOC
6602 # include <malloc/malloc.h>
6603 #endif
6604
6605 int main () { return 0; }
6606 EOCP
6607 set try
6608 if eval $compile; then
6609     echo "<malloc.h> found." >&4
6610     val="$define"
6611 else
6612     echo "<malloc.h> NOT found." >&4
6613     val="$undef"
6614 fi
6615 $rm_try
6616 set i_malloc
6617 eval $setvar
6618
6619 : check for void type
6620 echo " "
6621 echo "Checking to see how well your C compiler groks the void type..." >&4
6622 case "$voidflags" in
6623 '')
6624         $cat >try.c <<EOCP
6625 #$i_stdlib I_STDLIB
6626 #ifdef I_STDLIB
6627 #include <stdlib.h>
6628 #endif
6629 #if TRY & 1
6630 void sub() {
6631 #else
6632 sub() {
6633 #endif
6634         extern void moo();      /* function returning void */
6635         void (*goo)();          /* ptr to func returning void */
6636 #if TRY & 8
6637         void *hue;              /* generic ptr */
6638 #endif
6639 #if TRY & 2
6640         void (*foo[10])();
6641 #endif
6642
6643 #if TRY & 4
6644         if(goo == moo) {
6645                 exit(0);
6646         }
6647 #endif
6648         exit(0);
6649 }
6650 int main() { sub(); }
6651 EOCP
6652         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6653                 voidflags=$defvoidused
6654         echo "Good.  It appears to support void to the level $package wants.">&4
6655                 if $contains warning .out >/dev/null 2>&1; then
6656                         echo "However, you might get some warnings that look like this:"
6657                         $cat .out
6658                 fi
6659         else
6660 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6661                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6662                         echo "It supports 1..."
6663                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6664                                 echo "It also supports 2..."
6665                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6666                                         voidflags=7
6667                                         echo "And it supports 4 but not 8 definitely."
6668                                 else
6669                                         echo "It doesn't support 4..."
6670                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6671                                                 voidflags=11
6672                                                 echo "But it supports 8."
6673                                         else
6674                                                 voidflags=3
6675                                                 echo "Neither does it support 8."
6676                                         fi
6677                                 fi
6678                         else
6679                                 echo "It does not support 2..."
6680                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6681                                         voidflags=13
6682                                         echo "But it supports 4 and 8."
6683                                 else
6684                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6685                                                 voidflags=5
6686                                                 echo "And it supports 4 but has not heard about 8."
6687                                         else
6688                                                 echo "However it supports 8 but not 4."
6689                                         fi
6690                                 fi
6691                         fi
6692                 else
6693                         echo "There is no support at all for void."
6694                         voidflags=0
6695                 fi
6696         fi
6697 esac
6698 case "$voidflags" in
6699 "$defvoidused") ;;
6700 *)      $cat >&4 <<'EOM'
6701   Support flag bits are:
6702     1: basic void declarations.
6703     2: arrays of pointers to functions returning void.
6704     4: operations between pointers to and addresses of void functions.
6705     8: generic void pointers.
6706 EOM
6707         dflt="$voidflags";
6708         rp="Your void support flags add up to what?"
6709         . ./myread
6710         voidflags="$ans"
6711         ;;
6712 esac
6713 $rm_try
6714
6715 : check for length of pointer
6716 echo " "
6717 case "$ptrsize" in
6718 '')
6719         echo "Checking to see how big your pointers are..." >&4
6720         if test "$voidflags" -gt 7; then
6721                 echo '#define VOID_PTR char *' > try.c
6722         else
6723                 echo '#define VOID_PTR void *' > try.c
6724         fi
6725         $cat >>try.c <<EOCP
6726 #include <stdio.h>
6727 #$i_stdlib I_STDLIB
6728 #ifdef I_STDLIB
6729 #include <stdlib.h>
6730 #endif
6731 int main()
6732 {
6733     printf("%d\n", (int)sizeof(VOID_PTR));
6734     exit(0);
6735 }
6736 EOCP
6737         set try
6738         if eval $compile_ok; then
6739                 ptrsize=`$run ./try`
6740                 echo "Your pointers are $ptrsize bytes long."
6741         else
6742                 dflt='4'
6743                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6744                 rp="What is the size of a pointer (in bytes)?"
6745                 . ./myread
6746                 ptrsize="$ans"
6747         fi
6748         ;;
6749 esac
6750 $rm_try
6751 case "$use64bitall" in
6752 "$define"|true|[yY]*)
6753         case "$ptrsize" in
6754         4)      cat <<EOM >&4
6755
6756 *** You have chosen a maximally 64-bit build,
6757 *** but your pointers are only 4 bytes wide.
6758 *** Please rerun Configure without -Duse64bitall.
6759 EOM
6760                 case "$d_quad" in
6761                 define)
6762                         cat <<EOM >&4
6763 *** Since you have quads, you could possibly try with -Duse64bitint.
6764 EOM
6765                         ;;
6766                 esac
6767                 cat <<EOM >&4
6768 *** Cannot continue, aborting.
6769
6770 EOM
6771
6772                 exit 1
6773                 ;;
6774         esac
6775         ;;
6776 esac
6777
6778
6779 : determine whether to use malloc wrapping
6780 echo " "
6781 case "$usemallocwrap" in
6782 [yY]*|true|$define)     dflt='y' ;;
6783 [nN]*|false|$undef)     dflt='n' ;;
6784 *)      case "$usedevel" in
6785         [yY]*|true|$define)     dflt='y' ;;
6786         *) dflt='n' ;;
6787         esac
6788         ;;
6789 esac
6790 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6791 . ./myread
6792 usemallocwrap="$ans"
6793 case "$ans" in
6794 y*|true)
6795         usemallocwrap="$define" ;;
6796 *)
6797         usemallocwrap="$undef" ;;
6798 esac
6799
6800 : determine which malloc to compile in
6801 echo " "
6802 case "$usemymalloc" in
6803 [yY]*|true|$define)     dflt='y' ;;
6804 [nN]*|false|$undef)     dflt='n' ;;
6805 *)      case "$ptrsize" in
6806         4) dflt='y' ;;
6807         *) dflt='n' ;;
6808         esac
6809         ;;
6810 esac
6811 rp="Do you wish to attempt to use the malloc that comes with $package?"
6812 . ./myread
6813 usemymalloc="$ans"
6814 case "$ans" in
6815 y*|true)
6816         usemymalloc='y'
6817         mallocsrc='malloc.c'
6818         mallocobj="malloc$_o"
6819         d_mymalloc="$define"
6820         case "$libs" in
6821         *-lmalloc*)
6822                 : Remove malloc from list of libraries to use
6823                 echo "Removing unneeded -lmalloc from library list" >&4
6824                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6825                 shift
6826                 libs="$*"
6827                 echo "libs = $libs" >&4
6828                 ;;
6829         esac
6830         ;;
6831 *)
6832         usemymalloc='n'
6833         mallocsrc=''
6834         mallocobj=''
6835         d_mymalloc="$undef"
6836         ;;
6837 esac
6838
6839 : compute the return types of malloc and free
6840 echo " "
6841 $cat >malloc.c <<END
6842 #$i_malloc I_MALLOC
6843 #$i_stdlib I_STDLIB
6844 #include <stdio.h>
6845 #include <sys/types.h>
6846 #ifdef I_MALLOC
6847 #include <malloc.h>
6848 #endif
6849 #ifdef I_STDLIB
6850 #include <stdlib.h>
6851 #endif
6852 #ifdef TRY_MALLOC
6853 void *malloc();
6854 #endif
6855 #ifdef TRY_FREE
6856 void free();
6857 #endif
6858 END
6859 case "$malloctype" in
6860 '')
6861         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6862                 malloctype='void *'
6863         else
6864                 malloctype='char *'
6865         fi
6866         ;;
6867 esac
6868 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6869
6870 case "$freetype" in
6871 '')
6872         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6873                 freetype='void'
6874         else
6875                 freetype='int'
6876         fi
6877         ;;
6878 esac
6879 echo "Your system uses $freetype free(), it would seem." >&4
6880 $rm -f malloc.[co]
6881 : determine where site specific architecture-dependent libraries go.
6882 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6883 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6884 : sitelib may have an optional trailing /share.
6885 case "$sitearch" in
6886 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6887         dflt="$dflt/$archname"
6888         ;;
6889 *)      dflt="$sitearch"
6890         ;;
6891 esac
6892 set sitearch sitearch none
6893 eval $prefixit
6894 $cat <<EOM
6895
6896 The installation process will also create a directory for
6897 architecture-dependent site-specific extensions and modules.
6898
6899 EOM
6900 fn=d~+
6901 rp='Pathname for the site-specific architecture-dependent library files?'
6902 . ./getfile
6903 prefixvar=sitearch
6904 . ./setprefixvar
6905 if $test X"$sitearch" = X"$sitelib"; then
6906         d_sitearch="$undef"
6907 else
6908         d_sitearch="$define"
6909 fi
6910
6911 : Set the vendorprefix variables
6912 $cat <<EOM
6913
6914 The installation process will also create a directory for
6915 vendor-supplied add-ons.  Vendors who supply perl with their system
6916 may find it convenient to place all vendor-supplied files in this
6917 directory rather than in the main distribution directory.  This will
6918 ease upgrades between binary-compatible maintenance versions of perl.
6919
6920 Of course you may also use these directories in whatever way you see
6921 fit.  For example, you might use them to access modules shared over a
6922 company-wide network.
6923
6924 The default answer should be fine for most people.
6925 This causes further questions about vendor add-ons to be skipped
6926 and no vendor-specific directories will be configured for perl.
6927
6928 EOM
6929 rp='Do you want to configure vendor-specific add-on directories?'
6930 case "$usevendorprefix" in
6931 define|true|[yY]*) dflt=y ;;
6932 *)      : User may have set vendorprefix directly on Configure command line.
6933         case "$vendorprefix" in
6934         ''|' ') dflt=n ;;
6935         *)      dflt=y ;;
6936         esac
6937         ;;
6938 esac
6939 . ./myread
6940 case "$ans" in
6941 [yY]*)  fn=d~+
6942         rp='Installation prefix to use for vendor-supplied add-ons?'
6943         case "$vendorprefix" in
6944         '') dflt='' ;;
6945         *)  dflt=$vendorprefix ;;
6946         esac
6947         . ./getfile
6948         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6949         oldvendorprefix=''
6950         case "$vendorprefix" in
6951         '') ;;
6952         *)      case "$ans" in
6953                 "$prefix") ;;
6954                 *) oldvendorprefix="$prefix";;
6955                 esac
6956                 ;;
6957         esac
6958         usevendorprefix="$define"
6959         vendorprefix="$ans"
6960         vendorprefixexp="$ansexp"
6961         ;;
6962 *)      usevendorprefix="$undef"
6963         vendorprefix=''
6964         vendorprefixexp=''
6965         ;;
6966 esac
6967
6968 : Set the vendorlib variables
6969 case "$vendorprefix" in
6970 '')     d_vendorlib="$undef"
6971         vendorlib=''
6972         vendorlibexp=''
6973         ;;
6974 *)      d_vendorlib="$define"
6975         : determine where vendor-supplied modules go.
6976         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6977         case "$vendorlib" in
6978         '')
6979                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6980                 case "$installstyle" in
6981                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6982                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6983                 esac
6984                 ;;
6985         *)      dflt="$vendorlib"
6986                 ;;
6987         esac
6988         fn=d~+
6989         rp='Pathname for the vendor-supplied library files?'
6990         . ./getfile
6991         vendorlib="$ans"
6992         vendorlibexp="$ansexp"
6993         ;;
6994 esac
6995 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6996 prefixvar=vendorlib
6997 . ./installprefix
6998
6999 : Set the vendorarch variables
7000 case "$vendorprefix" in
7001 '')     d_vendorarch="$undef"
7002         vendorarch=''
7003         vendorarchexp=''
7004         ;;
7005 *)      d_vendorarch="$define"
7006         : determine where vendor-supplied architecture-dependent libraries go.
7007         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7008         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7009         : vendorlib may have an optional trailing /share.
7010         case "$vendorarch" in
7011         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7012                 dflt="$dflt/$archname"
7013                 ;;
7014         *)      dflt="$vendorarch" ;;
7015         esac
7016         fn=d~+
7017         rp='Pathname for vendor-supplied architecture-dependent files?'
7018         . ./getfile
7019         vendorarch="$ans"
7020         vendorarchexp="$ansexp"
7021         ;;
7022 esac
7023 prefixvar=vendorarch
7024 . ./installprefix
7025 if $test X"$vendorarch" = X"$vendorlib"; then
7026         d_vendorarch="$undef"
7027 else
7028         d_vendorarch="$define"
7029 fi
7030
7031 : Final catch-all directories to search
7032 $cat <<EOM
7033
7034 Lastly, you can have perl look in other directories for extensions and
7035 modules in addition to those already specified.
7036 These directories will be searched after 
7037         $sitearch 
7038         $sitelib 
7039 EOM
7040 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7041 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7042 echo ' '
7043 case "$otherlibdirs" in
7044 ''|' ') dflt='none' ;;
7045 *)      dflt="$otherlibdirs" ;;
7046 esac
7047 $cat <<EOM
7048 Enter a colon-separated set of extra paths to include in perl's @INC
7049 search path, or enter 'none' for no extra paths.
7050
7051 EOM
7052
7053 rp='Colon-separated list of additional directories for perl to search?'
7054 . ./myread
7055 case "$ans" in
7056 ' '|''|none)    otherlibdirs=' ' ;;     
7057 *)      otherlibdirs="$ans" ;;
7058 esac
7059 case "$otherlibdirs" in
7060 ' ') val=$undef ;;
7061 *)      val=$define ;;
7062 esac
7063 set d_perl_otherlibdirs
7064 eval $setvar
7065
7066 : Cruising for prototypes
7067 echo " "
7068 echo "Checking out function prototypes..." >&4
7069 $cat >prototype.c <<EOCP
7070 #$i_stdlib I_STDLIB
7071 #ifdef I_STDLIB
7072 #include <stdlib.h>
7073 #endif
7074 int main(int argc, char *argv[]) {
7075         exit(0);}
7076 EOCP
7077 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7078         echo "Your C compiler appears to support function prototypes."
7079         val="$define"
7080 else
7081         echo "Your C compiler doesn't seem to understand function prototypes."
7082         val="$undef"
7083 fi
7084 set prototype
7085 eval $setvar
7086 $rm -f prototype*
7087
7088 : Check if ansi2knr is required
7089 case "$prototype" in
7090 "$define") ;;
7091 *)      ansi2knr='ansi2knr'
7092         echo " "
7093         cat <<EOM >&4
7094
7095 $me:  FATAL ERROR:
7096 This version of $package can only be compiled by a compiler that 
7097 understands function prototypes.  Unfortunately, your C compiler 
7098         $cc $ccflags
7099 doesn't seem to understand them.  Sorry about that.
7100
7101 If GNU cc is available for your system, perhaps you could try that instead.  
7102
7103 Eventually, we hope to support building Perl with pre-ANSI compilers.
7104 If you would like to help in that effort, please contact <perlbug@perl.org>.
7105
7106 Aborting Configure now.
7107 EOM
7108         exit 2
7109         ;;
7110 esac
7111
7112 : DTrace support
7113 dflt_dtrace='/usr/sbin/dtrace'
7114 cat <<EOM
7115
7116 Perl can be built to support DTrace on platforms that support it.
7117 DTrace is a diagnosis and performance analysis tool from Sun.
7118
7119 If this doesn't make any sense to you, just accept the default '$dflt'.
7120 EOM
7121
7122 while $test 1 ; do
7123         case "$usedtrace" in
7124         $define|true|[yY]*)
7125                 dflt='y'
7126                 ;;
7127         ?*)
7128                 dflt='y'
7129                 dflt_dtrace=$usedtrace
7130                 ;;
7131         *)
7132                 dflt='n'
7133                 ;;
7134         esac
7135
7136         rp='Support DTrace if available?'
7137         . ./myread
7138         case "$ans" in
7139         y|Y)    val="$define" ;;
7140         *)      val="$undef" ;;
7141         esac
7142         set usedtrace
7143         eval $setvar
7144
7145         test "X$usedtrace" != "X$define" && break
7146
7147         echo " "
7148         rp='Where is the dtrace executable?'
7149         dflt=$dflt_dtrace
7150         . ./getfile
7151         val="$ans"
7152         set dtrace
7153         eval $setvar
7154
7155         if $test -f $dtrace
7156         then
7157                 if $dtrace -h -s ../perldtrace.d \
7158                         -o perldtrace.tmp >/dev/null 2>&1 \
7159                         && rm -f perldtrace.tmp
7160                 then
7161                         echo " "
7162                         echo "Good: your $dtrace knows about the -h flag."
7163                 else
7164                         cat >&2 <<EOM
7165
7166 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7167 ***
7168 *** Your installed dtrace doesn't support the -h switch to compile a D
7169 *** program into a C header. Can't continue.
7170
7171 EOM
7172                         exit 1
7173                 fi
7174                 break;
7175         fi
7176
7177         case "$fastread" in
7178         yes)
7179                 cat >&2 <<EOM
7180
7181 *** $me:  Fatal Error:  $dtrace not found.
7182 *** Can't continue.
7183
7184 EOM
7185                 exit 1
7186                 ;;
7187         *)
7188                 echo "*** $dtrace was not found."
7189                 echo " "
7190                 ;;
7191         esac
7192 done
7193
7194 : See if we want extra modules installed
7195 echo " "
7196 case "$extras" in
7197 '') dflt='n';;
7198 *) dflt='y';;
7199 esac
7200 cat <<EOM
7201 Perl can be built with extra modules or bundles of modules which
7202 will be fetched from the CPAN and installed alongside Perl.
7203
7204 Notice that you will need access to the CPAN; either via the Internet,
7205 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7206 be asked later to configure the CPAN.pm module which will in turn do
7207 the installation of the rest of the extra modules or bundles.)
7208
7209 Notice also that if the modules require any external software such as
7210 libraries and headers (the libz library and the zlib.h header for the
7211 Compress::Zlib module, for example) you MUST have any such software
7212 already installed, this configuration process will NOT install such
7213 things for you.
7214
7215 If this doesn't make any sense to you, just accept the default '$dflt'.
7216 EOM
7217 rp='Install any extra modules (y or n)?'
7218 . ./myread
7219 case "$ans" in
7220 y|Y)
7221         cat <<EOM
7222
7223 Please list any extra modules or bundles to be installed from CPAN,
7224 with spaces between the names.  The names can be in any format the
7225 'install' command of CPAN.pm will understand.  (Answer 'none',
7226 without the quotes, to install no extra modules or bundles.)
7227 EOM
7228         rp='Extras?'
7229         dflt="$extras"
7230         . ./myread
7231         extras="$ans"
7232 esac
7233 case "$extras" in
7234 ''|'none')
7235         val=''
7236         $rm -f ../extras.lst
7237         ;;
7238 *)      echo "(Saving the list of extras for later...)"
7239         echo "$extras" > ../extras.lst
7240         val="'$extras'"
7241         ;;
7242 esac
7243 set extras
7244 eval $setvar
7245 echo " "
7246
7247 : determine where html pages for programs go
7248 set html1dir html1dir none
7249 eval $prefixit
7250 $cat <<EOM
7251
7252 If you wish to install html files for programs in $spackage, indicate
7253 the appropriate directory here.  To skip installing html files,
7254 answer "none".
7255 EOM
7256 case "$html1dir" in
7257 ''|none|$undef|' ') dflt=none ;;
7258 *) dflt=$html1dir ;;
7259 esac
7260 fn=dn+~
7261 rp="Directory for the main $spackage html pages?"
7262 . ./getfile
7263 prefixvar=html1dir
7264 . ./setprefixvar
7265 : Use ' ' for none so value is preserved next time through Configure
7266 $test X"$html1dir" = "X" && html1dir=' '
7267
7268 : determine where html pages for libraries and modules go
7269 set html3dir html3dir none
7270 eval $prefixit
7271 $cat <<EOM
7272
7273 If you wish to install html files for modules associated with $spackage,
7274 indicate the appropriate directory here.  To skip installing html files,
7275 answer "none".
7276 EOM
7277 : There is no obvious default.  If they have specified html1dir, then
7278 : try to key off that, possibly changing .../html1 into .../html3.
7279 case "$html3dir" in
7280 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7281 *) dflt=$html3dir ;;
7282 esac
7283 fn=dn+~
7284 rp="Directory for the $spackage module html pages?"
7285 . ./getfile
7286 prefixvar=html3dir
7287 . ./setprefixvar
7288 : Use ' ' for none so value is preserved next time through Configure
7289 $test X"$html3dir" = "X" && html3dir=' '
7290
7291 : determine whether to install perl also as /usr/bin/perl
7292
7293 echo " "
7294 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7295         $cat <<EOM
7296 Many scripts expect perl to be installed as /usr/bin/perl.
7297
7298 If you want to, I can install the perl you are about to compile
7299 as /usr/bin/perl (in addition to $bin/perl).
7300 EOM
7301         if test -f /usr/bin/perl; then
7302             $cat <<EOM
7303
7304 However, please note that because you already have a /usr/bin/perl,
7305 overwriting that with a new Perl would very probably cause problems.
7306 Therefore I'm assuming you don't want to do that (unless you insist).
7307
7308 EOM
7309             case "$installusrbinperl" in
7310             "$define"|[yY]*)    dflt='y';;
7311             *)                  dflt='n';;
7312             esac
7313         else
7314             $cat <<EOM
7315
7316 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7317
7318 EOM
7319             case "$installusrbinperl" in
7320             "$undef"|[nN]*)     dflt='n';;
7321             *)                  dflt='y';;
7322             esac
7323         fi
7324         rp="Do you want to install perl as /usr/bin/perl?"
7325         . ./myread
7326         case "$ans" in
7327         [yY]*)  val="$define";;
7328         *)      val="$undef" ;;
7329         esac
7330 else
7331         val="$undef"
7332 fi
7333 set installusrbinperl
7334 eval $setvar
7335
7336 : Check if we are using the GNU C library
7337 echo " "
7338 echo "Checking for GNU C Library..." >&4
7339 cat >try.c <<'EOCP'
7340 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7341    alone are insufficient to distinguish different versions, such as
7342    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7343    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7344 */
7345 #include <stdio.h>
7346 int main(void)
7347 {
7348 #ifdef __GLIBC__
7349 #   ifdef __GLIBC_MINOR__
7350 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7351 #           include <gnu/libc-version.h>
7352             printf("%s\n",  gnu_get_libc_version());
7353 #       else
7354             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7355 #       endif
7356 #   else
7357         printf("%d\n",  __GLIBC__);
7358 #   endif
7359     return 0;
7360 #else
7361     return 1;
7362 #endif
7363 }
7364 EOCP
7365 set try
7366 if eval $compile_ok && $run ./try > glibc.ver; then
7367         val="$define"
7368         gnulibc_version=`$cat glibc.ver`
7369         echo "You are using the GNU C Library version $gnulibc_version"
7370 else
7371         val="$undef"
7372         gnulibc_version=''
7373         echo "You are not using the GNU C Library"
7374 fi
7375 $rm_try glibc.ver
7376 set d_gnulibc
7377 eval $setvar
7378
7379 : see if nm is to be used to determine whether a symbol is defined or not
7380 case "$usenm" in
7381 '')
7382         dflt=''
7383         case "$d_gnulibc" in
7384         "$define")
7385                 echo " "
7386                 echo "nm probably won't work on the GNU C Library." >&4
7387                 dflt=n
7388                 ;;
7389         esac
7390         case "$dflt" in
7391         '') 
7392                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7393                         echo " "
7394                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7395                         echo "'nm' won't be sufficient on this sytem." >&4
7396                         dflt=n
7397                 fi
7398                 ;;
7399         esac
7400         case "$dflt" in
7401         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7402                 if $test $dflt -gt 20; then
7403                         dflt=y
7404                 else
7405                         dflt=n
7406                 fi
7407                 ;;
7408         esac
7409         ;;
7410 *)
7411         case "$usenm" in
7412         true|$define) dflt=y;;
7413         *) dflt=n;;
7414         esac
7415         ;;
7416 esac
7417 $cat <<EOM
7418
7419 I can use $nm to extract the symbols from your C libraries. This
7420 is a time consuming task which may generate huge output on the disk (up
7421 to 3 megabytes) but that should make the symbols extraction faster. The
7422 alternative is to skip the 'nm' extraction part and to compile a small
7423 test program instead to determine whether each symbol is present. If
7424 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7425 this may be the best solution.
7426
7427 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7428
7429 EOM
7430 rp="Shall I use $nm to extract C symbols from the libraries?"
7431 . ./myread
7432 case "$ans" in
7433 [Nn]*) usenm=false;;
7434 *) usenm=true;;
7435 esac
7436
7437 runnm=$usenm
7438 case "$reuseval" in
7439 true) runnm=false;;
7440 esac
7441
7442 : nm options which may be necessary
7443 case "$nm_opt" in
7444 '') if $test -f /mach_boot; then
7445                 nm_opt=''       # Mach
7446         elif $test -d /usr/ccs/lib; then
7447                 nm_opt='-p'     # Solaris (and SunOS?)
7448         elif $test -f /dgux; then
7449                 nm_opt='-p'     # DG-UX
7450         elif $test -f /lib64/rld; then
7451                 nm_opt='-p'     # 64-bit Irix
7452         else
7453                 nm_opt=''
7454         fi;;
7455 esac
7456
7457 : nm options which may be necessary for shared libraries but illegal
7458 : for archive libraries.  Thank you, Linux.
7459 case "$nm_so_opt" in
7460 '')     case "$myuname" in
7461         *linux*|gnu*)
7462                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7463                         nm_so_opt='--dynamic'
7464                 fi
7465                 ;;
7466         esac
7467         ;;
7468 esac
7469
7470 : Figure out where the libc is located
7471 case "$runnm" in
7472 true)
7473 : get list of predefined functions in a handy place
7474 echo " "
7475 case "$libc" in
7476 '') libc=unknown
7477         case "$libs" in
7478         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7479         esac
7480         ;;
7481 esac
7482 case "$libs" in
7483 '') ;;
7484 *)  for thislib in $libs; do
7485         case "$thislib" in
7486         -lc|-lc_s)
7487                 : Handle C library specially below.
7488                 ;;
7489         -l*)
7490                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7491                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7492                         :
7493                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7494                         :
7495                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7496                         :
7497                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7498                         :
7499                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7500                         :
7501                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7502                         :
7503                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7504                         :
7505                 else
7506                         try=''
7507                 fi
7508                 libnames="$libnames $try"
7509                 ;;
7510         *) libnames="$libnames $thislib" ;;
7511         esac
7512         done
7513         ;;
7514 esac
7515 xxx=normal
7516 case "$libc" in
7517 unknown)
7518         set /lib/libc.$so
7519         for xxx in $libpth; do
7520                 $test -r $1 || set $xxx/libc.$so
7521                 : The messy sed command sorts on library version numbers.
7522                 $test -r $1 || \
7523                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7524                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7525                                 h
7526                                 s/[0-9][0-9]*/0000&/g
7527                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7528                                 G
7529                                 s/\n/ /' | \
7530                          $sort | $sed -e 's/^.* //'`
7531                 eval set \$$#
7532         done
7533         $test -r $1 || set /usr/ccs/lib/libc.$so
7534         $test -r $1 || set /lib/libsys_s$_a
7535         ;;
7536 *)
7537         set blurfl
7538         ;;
7539 esac
7540 if $test -r "$1"; then
7541         echo "Your (shared) C library seems to be in $1."
7542         libc="$1"
7543 elif $test -r /lib/libc && $test -r /lib/clib; then
7544         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7545         xxx=apollo
7546         libc='/lib/clib /lib/libc'
7547         if $test -r /lib/syslib; then
7548                 echo "(Your math library is in /lib/syslib.)"
7549                 libc="$libc /lib/syslib"
7550         fi
7551 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7552         echo "Your C library seems to be in $libc, as you said before."
7553 elif $test -r $incpath/usr/lib/libc$_a; then
7554         libc=$incpath/usr/lib/libc$_a;
7555         echo "Your C library seems to be in $libc.  That's fine."
7556 elif $test -r /lib/libc$_a; then
7557         libc=/lib/libc$_a;
7558         echo "Your C library seems to be in $libc.  You're normal."
7559 else
7560         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7561                 :
7562         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7563                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7564         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7565                 :
7566         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7567                 :
7568         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7569                 :
7570         else
7571                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7572         fi
7573         if $test -r "$tans"; then
7574                 echo "Your C library seems to be in $tans, of all places."
7575                 libc=$tans
7576         else
7577                 libc='blurfl'
7578         fi
7579 fi
7580 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7581         dflt="$libc"
7582         cat <<EOM
7583
7584 If the guess above is wrong (which it might be if you're using a strange
7585 compiler, or your machine supports multiple models), you can override it here.
7586
7587 EOM
7588 else
7589         dflt=''
7590         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7591         cat >&4 <<EOM
7592 I can't seem to find your C library.  I've looked in the following places:
7593
7594 EOM
7595         $sed 's/^/      /' libpath
7596         cat <<EOM
7597
7598 None of these seems to contain your C library. I need to get its name...
7599
7600 EOM
7601 fi
7602 fn=f
7603 rp='Where is your C library?'
7604 . ./getfile
7605 libc="$ans"
7606
7607 echo " "
7608 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7609 set X `cat libnames`
7610 shift
7611 xxx=files
7612 case $# in 1) xxx=file; esac
7613 echo "Extracting names from the following $xxx for later perusal:" >&4
7614 echo " "
7615 $sed 's/^/      /' libnames >&4
7616 echo " "
7617 $echo $n "This may take a while...$c" >&4
7618
7619 for file in $*; do
7620         case $file in
7621         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7622         *) $nm $nm_opt $file 2>/dev/null;;
7623         esac
7624 done >libc.tmp
7625
7626 $echo $n ".$c"
7627 $grep fprintf libc.tmp > libc.ptf
7628 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7629 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7630 xxx='[ADTSIW]'
7631 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7632         eval $xscan;\
7633         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7634                 eval $xrun
7635 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7636         eval $xscan;\
7637         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7638                 eval $xrun
7639 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7640         eval $xscan;\
7641         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7642                 eval $xrun
7643 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7644         eval $xscan;\
7645         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7646                 eval $xrun
7647 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7648         eval $xscan;\
7649         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7650                 eval $xrun
7651 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7652         eval $xscan;\
7653         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7654                 eval $xrun
7655 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7656                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7657         eval $xscan;\
7658         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7659                 eval $xrun
7660 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7661         eval $xscan;\
7662         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7663                 eval $xrun
7664 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7665         eval $xscan;\
7666         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7667                 eval $xrun
7668 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7669         eval $xscan;\
7670         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7671                 eval $xrun
7672 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7673         eval $xscan;\
7674         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7675                 eval $xrun
7676 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7677         eval $xscan;\
7678         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7679                 eval $xrun
7680 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7681         eval $xscan;\
7682         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7683                 eval $xrun
7684 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7685         eval $xscan;\
7686         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7687                 eval $xrun
7688 else
7689         $nm -p $* 2>/dev/null >libc.tmp
7690         $grep fprintf libc.tmp > libc.ptf
7691         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7692                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7693         then
7694                 nm_opt='-p'
7695                 eval $xrun
7696         else
7697                 echo " "
7698                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7699                 com=''
7700                 if $ar t $libc > libc.tmp && \
7701                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7702                 then
7703                         for thisname in $libnames $libc; do
7704                                 $ar t $thisname >>libc.tmp
7705                         done
7706                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7707                         echo "Ok." >&4
7708                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7709                         for thisname in $libnames $libc; do
7710                                 $ar tv $thisname >>libc.tmp
7711                                 emximp -o tmp.imp $thisname \
7712                                     2>/dev/null && \
7713                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7714                                     < tmp.imp >>libc.tmp
7715                                 $rm -f tmp.imp
7716                         done
7717                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7718                         echo "Ok." >&4
7719                 else
7720                         echo "$ar didn't seem to work right." >&4
7721                         echo "Maybe this is a Cray...trying bld instead..." >&4
7722                         if  bld t $libc | \
7723                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7724                                 $test -s libc.list
7725                         then
7726                                 for thisname in $libnames; do
7727                                         bld t $libnames | \
7728                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7729                                         $ar t $thisname >>libc.tmp
7730                                 done
7731                                 echo "Ok." >&4
7732                         else
7733                                 echo "That didn't work either.  Giving up." >&4
7734                                 exit 1
7735                         fi
7736                 fi
7737         fi
7738 fi
7739 nm_extract="$com"
7740 case "$PASE" in
7741 define)
7742     echo " "
7743     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7744     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7745     ;;
7746 *)  if $test -f /lib/syscalls.exp; then
7747         echo " "
7748         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7749         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7750                 /lib/syscalls.exp >>libc.list
7751     fi
7752     ;;
7753 esac
7754 ;;
7755 esac
7756 $rm -f libnames libpath
7757
7758 : see if dld is available
7759 set dld.h i_dld
7760 eval $inhdr
7761
7762 : Check if we are using C++
7763 echo " "
7764 echo "Checking for C++..." >&4
7765 $cat >try.c <<'EOCP'
7766 #include <stdio.h>
7767 int main(void)
7768 {
7769 #ifdef __cplusplus
7770     return 0;
7771 #else
7772     return 1;
7773 #endif
7774 }
7775 EOCP
7776 set try
7777 if eval $compile_ok && $run ./try; then
7778         val="$define"
7779         echo "You are using a C++ compiler."
7780 else
7781         val="$undef"
7782         echo "You are not using a C++ compiler."
7783 fi
7784 $rm_try cplusplus$$
7785 set d_cplusplus
7786 eval $setvar
7787
7788 : is a C symbol defined?
7789 csym='tlook=$1;
7790 case "$3" in
7791 -v) tf=libc.tmp; tdc="";;
7792 -a) tf=libc.tmp; tdc="[]";;
7793 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7794 esac;
7795 case "$d_cplusplus" in
7796     $define)    extern_C="extern \"C\"" ;;
7797     *)          extern_C="extern"       ;;
7798 esac;
7799 tx=yes;
7800 case "$reuseval-$4" in
7801 true-) ;;
7802 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7803 esac;
7804 case "$tx" in
7805 yes)
7806         tval=false;
7807         if $test "$runnm" = true; then
7808                 if $contains $tlook $tf >/dev/null 2>&1; then
7809                         tval=true;
7810                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7811                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7812                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7813                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7814                         $rm_try;
7815                 fi;
7816         else
7817                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7818                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7819                 $rm_try;
7820         fi;
7821         ;;
7822 *)
7823         case "$tval" in
7824         $define) tval=true;;
7825         *) tval=false;;
7826         esac;
7827         ;;
7828 esac;
7829 eval "$2=$tval"'
7830
7831 : define an is-in-libc? function
7832 inlibc='echo " "; td=$define; tu=$undef;
7833 sym=$1; var=$2; eval "was=\$$2";
7834 tx=yes;
7835 case "$reuseval$was" in
7836 true) ;;
7837 true*) tx=no;;
7838 esac;
7839 case "$tx" in
7840 yes)
7841         set $sym tres -f;
7842         eval $csym;
7843         case "$tres" in
7844         true)
7845                 echo "$sym() found." >&4;
7846                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7847         *)
7848                 echo "$sym() NOT found." >&4;
7849                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7850         esac;;
7851 *)
7852         case "$was" in
7853         $define) echo "$sym() found." >&4;;
7854         *) echo "$sym() NOT found." >&4;;
7855         esac;;
7856 esac'
7857
7858 : see if dlopen exists
7859 xxx_runnm="$runnm"
7860 xxx_ccflags="$ccflags"
7861 runnm=false
7862 : with g++ one needs -shared to get is-in-libc to work for dlopen
7863 case "$gccversion" in
7864 '')     ;;
7865 *)      case "$d_cplusplus" in
7866         "$define") ccflags="$ccflags -shared" ;;
7867         esac
7868         ;;
7869 esac
7870 set dlopen d_dlopen
7871 eval $inlibc
7872 runnm="$xxx_runnm"
7873 ccflags="$xxx_ccflags"
7874
7875 : see if this is a unistd.h system
7876 set unistd.h i_unistd
7877 eval $inhdr
7878
7879 : determine which dynamic loading, if any, to compile in
7880 echo " "
7881 dldir="ext/DynaLoader"
7882 case "$usedl" in
7883 $define|y|true)
7884         dflt='y'
7885         usedl="$define"
7886         ;;
7887 $undef|n|false)
7888         dflt='n'
7889         usedl="$undef"
7890         ;;
7891 *)
7892         dflt='n'
7893         case "$d_dlopen" in
7894             $define) dflt='y' ;;
7895         esac
7896         case "$i_dld" in
7897             $define) dflt='y' ;;
7898         esac
7899         : Does a dl_xxx.xs file exist for this operating system
7900         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7901         ;;
7902 esac
7903 rp="Do you wish to use dynamic loading?"
7904 . ./myread
7905 usedl="$ans"
7906 case "$ans" in
7907 y*) usedl="$define"
7908         case "$dlsrc" in
7909         '')
7910                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7911                         dflt="$dldir/dl_${osname}.xs"
7912                 elif $test "$d_dlopen" = "$define" ; then
7913                         dflt="$dldir/dl_dlopen.xs"
7914                 elif $test "$i_dld" = "$define" ; then
7915                         dflt="$dldir/dl_dld.xs"
7916                 else
7917                         dflt=''
7918                 fi
7919                 ;;
7920         *)      dflt="$dldir/$dlsrc"
7921                 ;;
7922         esac
7923     echo "The following dynamic loading files are available:"
7924         : Can not go over to $dldir because getfile has path hard-coded in.
7925         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7926         rp="Source file to use for dynamic loading"
7927         fn="fne"
7928         gfpth="$src"
7929         . ./getfile
7930         usedl="$define"
7931         : emulate basename
7932         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7933
7934         $cat << EOM
7935
7936 Some systems may require passing special flags to $cc -c to
7937 compile modules that will be used to create a shared library.
7938 To use no flags, say "none".
7939
7940 EOM
7941     case "$cccdlflags" in
7942     '') case "$gccversion" in
7943                 '') case "$osname" in
7944                         hpux)   dflt='+z' ;;
7945                         next)   dflt='none' ;;
7946                         irix*)  dflt='-KPIC' ;;
7947                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7948                         sunos)  dflt='-pic' ;;
7949                         *)      dflt='none' ;;
7950                     esac
7951                         ;;
7952                 *)  case "$osname" in
7953                         darwin) dflt='none' ;;
7954                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7955                         *)      dflt='-fpic' ;;
7956                     esac ;;
7957             esac ;;
7958         ' ') dflt='none' ;;
7959     *)  dflt="$cccdlflags" ;;
7960     esac
7961     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7962     . ./myread
7963     case "$ans" in
7964     none) cccdlflags=' ' ;;
7965     *) cccdlflags="$ans" ;;
7966     esac
7967
7968     cat << EOM
7969
7970 Some systems use ld to create libraries that can be dynamically loaded,
7971 while other systems (such as those using ELF) use $cc.
7972
7973 EOM
7974         case "$ld" in
7975         '')     $cat >try.c <<EOM
7976 /* Test for whether ELF binaries are produced */
7977 #include <fcntl.h>
7978 #$i_stdlib I_STDLIB
7979 #ifdef I_STDLIB
7980 #include <stdlib.h>
7981 #endif
7982 #$i_unistd I_UNISTD
7983 #ifdef I_UNISTD
7984 #include <unistd.h>
7985 #endif
7986 int main() {
7987         char b[4];
7988         int i = open("a.out",O_RDONLY);
7989         if(i == -1)
7990                 exit(1); /* fail */
7991         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7992                 exit(0); /* succeed (yes, it's ELF) */
7993         else
7994                 exit(1); /* fail */
7995 }
7996 EOM
7997                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7998                         cat <<EOM
7999 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8000 EOM
8001                         dflt="$cc"
8002                 else
8003                         echo "I'll use ld to build dynamic libraries."
8004                         dflt='ld'
8005                 fi
8006                 $rm_try
8007                 ;;
8008         *)      dflt="$ld"
8009                 ;;
8010         esac
8011
8012     rp="What command should be used to create dynamic libraries?"
8013     . ./myread
8014         ld="$ans"
8015
8016     cat << EOM
8017
8018 Some systems may require passing special flags to $ld to create a
8019 library that can be dynamically loaded.  If your ld flags include
8020 -L/other/path options to locate libraries outside your loader's normal
8021 search path, you may need to specify those -L options here as well.  To
8022 use no flags, say "none".
8023
8024 EOM
8025     case "$lddlflags" in
8026     '') case "$osname" in
8027                         beos) dflt='-nostart' ;;
8028                         haiku) dflt='-shared' ;;
8029                         hpux) dflt='-b';
8030                               case "$gccversion" in
8031                               '') dflt="$dflt +vnocompatwarnings" ;;
8032                               esac
8033                               ;;
8034                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8035                         next)  dflt='none' ;;
8036                         solaris) dflt='-G' ;;
8037                         sunos) dflt='-assert nodefinitions' ;;
8038                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8039                 *)     dflt='none' ;;
8040                         esac
8041                         ;;
8042     *) dflt="$lddlflags" ;;
8043     esac
8044
8045         : Try to guess additional flags to pick up local libraries.
8046         : Be careful not to append to a plain 'none'
8047         case "$dflt" in
8048         none) dflt='' ;;
8049         esac
8050         for thisflag in $ldflags; do
8051                 case "$thisflag" in
8052                 -L*|-R*|-Wl,-R*)
8053                         case " $dflt " in
8054                         *" $thisflag "*) ;;
8055                         *) dflt="$dflt $thisflag" ;;
8056                         esac
8057                         ;;
8058                 esac
8059         done
8060
8061         case "$dflt" in
8062         ''|' ') dflt='none' ;;
8063         esac
8064
8065         case "$ldflags" in
8066         *-fstack-protector*)
8067             case "$dflt" in
8068                         *-fstack-protector*) ;; # Don't add it again
8069                         *) dflt="$dflt -fstack-protector" ;; 
8070                 esac
8071                 ;;
8072         esac
8073
8074
8075     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8076     . ./myread
8077     case "$ans" in
8078     none) lddlflags=' ' ;;
8079     *) lddlflags="$ans" ;;
8080     esac
8081
8082         cat <<EOM
8083
8084 Some systems may require passing special flags to $cc to indicate that
8085 the resulting executable will use dynamic linking.  To use no flags,
8086 say "none".
8087
8088 EOM
8089     case "$ccdlflags" in
8090     '') case "$osname" in
8091             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8092             next|sunos) dflt='none' ;;
8093             *)          dflt='none' ;;
8094             esac ;;
8095     ' ')  dflt='none' ;;
8096     *)  dflt="$ccdlflags" ;;
8097     esac
8098     rp="Any special flags to pass to $cc to use dynamic linking?"
8099     . ./myread
8100     case "$ans" in
8101     none) ccdlflags=' ' ;;
8102     *) ccdlflags="$ans" ;;
8103     esac
8104     ;;
8105 *)  usedl="$undef"
8106         ld='ld'
8107     dlsrc='dl_none.xs'
8108     lddlflags=''
8109     ccdlflags=''
8110     ;;
8111 esac
8112
8113 : Do we want a shared libperl?
8114 also=''
8115 case "$usedl" in
8116 $undef)
8117         # No dynamic loading being used, so don't bother even to prompt.
8118         useshrplib='false'
8119         ;;
8120 *)      case "$useshrplib" in
8121         '')     case "$osname" in
8122                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8123                         dflt=y
8124                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8125                         ;;
8126                 next*)
8127                         case "$osvers" in
8128                         4*)     dflt=y
8129                                 also='Building a shared libperl is needed for MAB support.'
8130                                 ;;
8131                         *)      dflt=n
8132                                 ;;
8133                         esac
8134                         ;;
8135                 *)      dflt=n
8136                         ;;
8137                 esac
8138                 ;;
8139         $define|true|[Yy]*)
8140                 dflt=y
8141                 ;;
8142         *)      dflt=n
8143                 ;;
8144         esac
8145         $cat << EOM
8146
8147 The perl executable is normally obtained by linking perlmain.c with
8148 libperl${_a}, any static extensions (usually just DynaLoader), and
8149 any other libraries needed on this system (such as -lm, etc.).  Since
8150 your system supports dynamic loading, it is probably possible to build
8151 a shared libperl.$so.  If you will have more than one executable linked
8152 to libperl.$so, this will significantly reduce the size of each
8153 executable, but it may have a noticeable effect on performance.  The
8154 default is probably sensible for your system.
8155 $also
8156
8157 EOM
8158         rp="Build a shared libperl.$so (y/n)"
8159         . ./myread
8160         case "$ans" in
8161         true|$define|[Yy]*)
8162                 useshrplib='true'  ;;
8163         *)      useshrplib='false' ;;
8164         esac
8165         ;;
8166 esac
8167
8168 case "$useshrplib" in
8169 true)
8170         case "$libperl" in
8171         '')
8172                 # Figure out a good name for libperl.so.  Since it gets stored in
8173                 # a version-specific architecture-dependent library, the version
8174                 # number isn't really that important, except for making cc/ld happy.
8175                 #
8176                 # A name such as libperl.so.10.1
8177                 majmin="libperl.$so.$patchlevel.$subversion"
8178                 # A name such as libperl.so.100
8179                 majonly=`echo $patchlevel $subversion |
8180                         $awk '{printf "%d%02d", $1, $2}'`
8181                 majonly=libperl.$so.$majonly
8182                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8183                 # rely on figuring it out from the naming of libc.
8184                 case "${osname}${osvers}" in
8185                 next4*)
8186                         dflt=libperl.5.$so
8187                         # XXX How handle the --version stuff for MAB?
8188                         ;;
8189                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8190                         dflt=libperl.$so
8191                         ;;
8192                 cygwin*) # ld links now against the dll directly
8193                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8194                         majonly=`echo $patchlevel $subversion |
8195                                 $awk '{printf "%03d%03d", $1, $2}'`
8196                         majonly=cygperl5.$majonly.$so
8197                         dflt=$majmin
8198                         ;;
8199                 *)      # Try to guess based on whether libc has major.minor.
8200                         case "$libc" in
8201                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8202                         *libc.$so.[0-9]*) dflt=$majonly ;;
8203                         *)      dflt=libperl.$so ;;
8204                         esac
8205                         ;;
8206                 esac
8207                 ;;
8208         *)      dflt=$libperl
8209                 ;;
8210         esac
8211         cat << EOM
8212
8213 I need to select a good name for the shared libperl.  If your system uses
8214 library names with major and minor numbers, then you might want something
8215 like $majmin.  Alternatively, if your system uses a single version
8216 number for shared libraries, then you might want to use $majonly.
8217 Or, your system might be quite happy with a simple libperl.$so.
8218
8219 Since the shared libperl will get installed into a version-specific
8220 architecture-dependent directory, the version number of the shared perl
8221 library probably isn't important, so the default should be o.k.
8222
8223 EOM
8224         rp='What name do you want to give to the shared libperl?'
8225         . ./myread
8226         libperl=$ans
8227         echo "Ok, I'll use $libperl"
8228         ;;
8229 *)
8230         libperl="libperl${_a}"
8231         ;;
8232 esac
8233
8234 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8235 case "$shrpdir" in
8236 '') ;;
8237 *)      $cat >&4 <<EOM
8238 WARNING:  Use of the shrpdir variable for the installation location of
8239 the shared $libperl is not supported.  It was never documented and
8240 will not work in this version.  Let me (perlbug@perl.org)
8241 know of any problems this may cause.
8242
8243 EOM
8244         case "$shrpdir" in
8245         "$archlibexp/CORE")
8246                 $cat >&4 <<EOM
8247 But your current setting of $shrpdir is
8248 the default anyway, so it's harmless.
8249 EOM
8250                 ;;
8251         *)
8252                 $cat >&4 <<EOM
8253 Further, your current attempted setting of $shrpdir
8254 conflicts with the value of $archlibexp/CORE
8255 that installperl will use.
8256 EOM
8257                 ;;
8258         esac
8259         ;;
8260 esac
8261
8262 # How will the perl executable find the installed shared $libperl?
8263 # Add $xxx to ccdlflags.
8264 # If we can't figure out a command-line option, use $shrpenv to
8265 # set env LD_RUN_PATH.  The main perl makefile uses this.
8266 shrpdir=$archlibexp/CORE
8267 xxx=''
8268 tmp_shrpenv=''
8269 if "$useshrplib"; then
8270     case "$osname" in
8271         aix)
8272                 # We'll set it in Makefile.SH...
8273                 ;;
8274         solaris)
8275                 xxx="-R $shrpdir"
8276                 ;;
8277         freebsd|netbsd|openbsd|interix|dragonfly)
8278                 xxx="-Wl,-R$shrpdir"
8279                 ;;
8280         bsdos|linux|irix*|dec_osf|gnu*)
8281                 xxx="-Wl,-rpath,$shrpdir"
8282                 ;;
8283         next)
8284                 # next doesn't like the default...
8285                 ;;
8286         beos)
8287                 # beos doesn't like the default, either.
8288                 ;;
8289         haiku)
8290                 # Haiku doesn't like the default, either.
8291                 ;;
8292         hpux*)
8293                 # hpux doesn't like the default, either.
8294                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8295                 ;;
8296         cygwin)
8297                 # cygwin needs only ldlibpth
8298                 ;;
8299         *)
8300                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8301                 ;;
8302         esac
8303         case "$xxx" in
8304         '') ;;
8305         *)
8306                 # Only add $xxx if it isn't already in ccdlflags.
8307                 case " $ccdlflags " in
8308                 *" $xxx "*)     ;;
8309                 *)      ccdlflags="$ccdlflags $xxx"
8310                         cat <<EOM >&4
8311
8312 Adding $xxx to the flags
8313 passed to $ld so that the perl executable will find the
8314 installed shared $libperl.
8315
8316 EOM
8317                         ;;
8318                 esac
8319                 ;;
8320         esac
8321 fi
8322 # Fix ccdlflags in AIX for building external extensions.
8323 # (For building Perl itself bare -bE:perl.exp is needed,
8324 #  Makefile.SH takes care of this.)
8325 case "$osname" in
8326 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8327 esac
8328 # Respect a hint or command-line value.
8329 case "$shrpenv" in
8330 '') shrpenv="$tmp_shrpenv" ;;
8331 esac
8332 case "$ldlibpthname" in
8333 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8334 none)   ldlibpthname='' ;;
8335 esac
8336
8337 : determine where manual pages are on this system
8338 echo " "
8339 case "$sysman" in
8340 '') 
8341         syspath='/usr/share/man/man1 /usr/man/man1'
8342         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8343         syspath="$syspath /usr/man/u_man/man1"
8344         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8345         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8346         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8347         sysman=`./loc . /usr/man/man1 $syspath`
8348         ;;
8349 esac
8350 if $test -d "$sysman"; then
8351         echo "System manual is in $sysman." >&4
8352 else
8353         echo "Could not find manual pages in source form." >&4
8354 fi
8355
8356 : determine where manual pages go
8357 set man1dir man1dir none
8358 eval $prefixit
8359 $cat <<EOM
8360
8361 $spackage has manual pages available in source form.
8362 EOM
8363 case "$nroff" in
8364 nroff)
8365         echo "However, you don't have nroff, so they're probably useless to you."
8366         case "$man1dir" in
8367         '') man1dir="none";;
8368         esac;;
8369 esac
8370 echo "If you don't want the manual sources installed, answer 'none'."
8371 case "$man1dir" in
8372 ' ') dflt=none
8373         ;;
8374 '')
8375         lookpath="$prefixexp/share/man/man1"
8376         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8377         lookpath="$lookpath $prefixexp/man/p_man/man1"
8378         lookpath="$lookpath $prefixexp/man/u_man/man1"
8379         lookpath="$lookpath $prefixexp/man/man.1"
8380         case "$sysman" in
8381         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8382         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8383         esac
8384         set dflt
8385         eval $prefixup
8386         ;;
8387 *)  dflt="$man1dir"
8388         ;;
8389 esac
8390 echo " "
8391 fn=dn+~
8392 rp="Where do the main $spackage manual pages (source) go?"
8393 . ./getfile
8394 if $test "X$man1direxp" != "X$ansexp"; then
8395         installman1dir=''
8396 fi
8397 prefixvar=man1dir
8398 . ./setprefixvar
8399
8400 case "$man1dir" in
8401 '')     man1dir=' '
8402         installman1dir='';;
8403 esac
8404
8405 : What suffix to use on installed man pages
8406
8407 case "$man1dir" in
8408 ' ')
8409         man1ext='0'
8410         ;;
8411 *)
8412         rp="What suffix should be used for the main $spackage man pages?"
8413         case "$man1ext" in
8414         '')     case "$man1dir" in
8415                 *1)  dflt=1 ;;
8416                 *1p) dflt=1p ;;
8417                 *1pm) dflt=1pm ;;
8418                 *l) dflt=l;;
8419                 *n) dflt=n;;
8420                 *o) dflt=o;;
8421                 *p) dflt=p;;
8422                 *C) dflt=C;;
8423                 *L) dflt=L;;
8424                 *L1) dflt=L1;;
8425                 *) dflt=1;;
8426                 esac
8427                 ;;
8428         *)      dflt="$man1ext";;
8429         esac
8430         . ./myread
8431         man1ext="$ans"
8432         ;;
8433 esac
8434
8435 : see if we can have long filenames
8436 echo " "
8437 first=123456789abcdef
8438 $rm -f $first
8439 if (echo hi >$first) 2>/dev/null; then
8440         if $test -f 123456789abcde; then
8441                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8442                 val="$undef"
8443         else
8444                 echo 'You can have filenames longer than 14 characters.'>&4
8445                 val="$define"
8446         fi
8447 else
8448         $cat <<'EOM'
8449 You can't have filenames longer than 14 chars.
8450 You can't even think about them!
8451 EOM
8452         val="$undef"
8453 fi
8454 set d_flexfnam
8455 eval $setvar
8456 $rm -rf 123456789abcde*
8457
8458 : determine where library module manual pages go
8459 set man3dir man3dir none
8460 eval $prefixit
8461 $cat <<EOM
8462
8463 $spackage has manual pages for many of the library modules.
8464 EOM
8465
8466 case "$nroff" in
8467 nroff)
8468         $cat <<'EOM'
8469 However, you don't have nroff, so they're probably useless to you.
8470 EOM
8471         case "$man3dir" in
8472         '') man3dir="none";;
8473         esac;;
8474 esac
8475
8476 case "$d_flexfnam" in
8477 undef)
8478         $cat <<'EOM'
8479 However, your system can't handle the long file names like File::Basename.3.
8480 EOM
8481         case "$man3dir" in
8482         '') man3dir="none";;
8483         esac;;
8484 esac
8485
8486 echo "If you don't want the manual sources installed, answer 'none'."
8487 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8488 case "$man3dir" in
8489 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8490         if $test -d "$privlib/man/man3"; then
8491                 cat <<EOM >&4
8492
8493 WARNING:  Previous versions of perl installed man3 pages into
8494 $privlib/man/man3.  This version will suggest a
8495 new default of $dflt.
8496 EOM
8497                 tdflt=$dflt
8498                 dflt='n'
8499                 rp='Do you wish to preserve the old behavior?(y/n)'
8500                 . ./myread
8501                 case "$ans" in
8502                 y*) dflt="$privlib/man/man3" ;;
8503                 *)  dflt=$tdflt ;;
8504                 esac
8505     fi
8506         ;;
8507 *)      dflt="$man3dir" ;;
8508 esac
8509 case "$dflt" in
8510 ' ') dflt=none ;;
8511 esac
8512 echo " "
8513 fn=dn+~
8514 rp="Where do the $package library man pages (source) go?"
8515 . ./getfile
8516 prefixvar=man3dir
8517 . ./setprefixvar
8518
8519 case "$man3dir" in
8520 '')     man3dir=' '
8521         installman3dir='';;
8522 esac
8523
8524 : What suffix to use on installed man pages
8525 case "$man3dir" in
8526 ' ')
8527         man3ext='0'
8528         ;;
8529 *)
8530         rp="What suffix should be used for the $package library man pages?"
8531         case "$man3ext" in
8532         '')     case "$man3dir" in
8533                 *3)  dflt=3 ;;
8534                 *3p) dflt=3p ;;
8535                 *3pm) dflt=3pm ;;
8536                 *l) dflt=l;;
8537                 *n) dflt=n;;
8538                 *o) dflt=o;;
8539                 *p) dflt=p;;
8540                 *C) dflt=C;;
8541                 *L) dflt=L;;
8542                 *L3) dflt=L3;;
8543                 *) dflt=3;;
8544                 esac
8545                 ;;
8546         *)      dflt="$man3ext";;
8547         esac
8548         . ./myread
8549         man3ext="$ans"
8550         ;;
8551 esac
8552
8553 : see if we have to deal with yellow pages, now NIS.
8554 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8555         if $test -f /usr/etc/nibindd; then
8556                 echo " "
8557                 echo "I'm fairly confident you're on a NeXT."
8558                 echo " "
8559                 rp='Do you get the hosts file via NetInfo?'
8560                 dflt=y
8561                 case "$hostcat" in
8562                 nidump*) ;;
8563                 '') ;;
8564                 *) dflt=n;;
8565                 esac
8566                 . ./myread
8567                 case "$ans" in
8568                 y*) hostcat='nidump hosts .';;
8569                 *)      case "$hostcat" in
8570                         nidump*) hostcat='';;
8571                         esac
8572                         ;;
8573                 esac
8574         fi
8575         case "$hostcat" in
8576         nidump*) ;;
8577         *)
8578                 case "$hostcat" in
8579                 *ypcat*) dflt=y;;
8580                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8581                                 dflt=y
8582                         else
8583                                 dflt=n
8584                         fi;;
8585                 *) dflt=n;;
8586                 esac
8587                 echo " "
8588                 rp='Are you getting the hosts file via yellow pages?'
8589                 . ./myread
8590                 case "$ans" in
8591                 y*) hostcat='ypcat hosts';;
8592                 *) hostcat='cat /etc/hosts';;
8593                 esac
8594                 ;;
8595         esac
8596 fi
8597 case "$hostcat" in
8598 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8599 esac
8600 case "$groupcat" in
8601 '') test -f /etc/group && groupcat='cat /etc/group';;
8602 esac
8603 case "$passcat" in
8604 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8605 esac
8606
8607 : now get the host name
8608 echo " "
8609 echo "Figuring out host name..." >&4
8610 case "$myhostname" in
8611 '') cont=true
8612         echo 'Maybe "hostname" will work...'
8613         if tans=`sh -c hostname 2>&1` ; then
8614                 myhostname=$tans
8615                 phostname=hostname
8616                 cont=''
8617         fi
8618         ;;
8619 *) cont='';;
8620 esac
8621 if $test "$cont"; then
8622         if ./xenix; then
8623                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8624                 if tans=`cat /etc/systemid 2>&1` ; then
8625                         myhostname=$tans
8626                         phostname='cat /etc/systemid'
8627                         echo "Whadyaknow.  Xenix always was a bit strange..."
8628                         cont=''
8629                 fi
8630         elif $test -r /etc/systemid; then
8631                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8632         fi
8633 fi
8634 if $test "$cont"; then
8635         echo 'No, maybe "uuname -l" will work...'
8636         if tans=`sh -c 'uuname -l' 2>&1` ; then
8637                 myhostname=$tans
8638                 phostname='uuname -l'
8639         else
8640                 echo 'Strange.  Maybe "uname -n" will work...'
8641                 if tans=`sh -c 'uname -n' 2>&1` ; then
8642                         myhostname=$tans
8643                         phostname='uname -n'
8644                 else
8645                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8646                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8647                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8648                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8649                         else
8650                                 case "$myhostname" in
8651                                 '') echo "Does this machine have an identity crisis or something?"
8652                                         phostname='';;
8653                                 *)
8654                                         echo "Well, you said $myhostname before..."
8655                                         phostname='echo $myhostname';;
8656                                 esac
8657                         fi
8658                 fi
8659         fi
8660 fi
8661 case "$myhostname" in
8662 '') myhostname=noname ;;
8663 esac
8664 : you do not want to know about this
8665 set $myhostname
8666 myhostname=$1
8667
8668 : verify guess
8669 if $test "$myhostname" ; then
8670         dflt=y
8671         rp='Your host name appears to be "'$myhostname'".'" Right?"
8672         . ./myread
8673         case "$ans" in
8674         y*) ;;
8675         *) myhostname='';;
8676         esac
8677 fi
8678
8679 : bad guess or no guess
8680 while $test "X$myhostname" = X ; do
8681         dflt=''
8682         rp="Please type the (one word) name of your host:"
8683         . ./myread
8684         myhostname="$ans"
8685 done
8686
8687 : translate upper to lower if necessary
8688 case "$myhostname" in
8689 *[A-Z]*)
8690         echo "(Normalizing case in your host name)"
8691         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8692         ;;
8693 esac
8694
8695 case "$myhostname" in
8696 *.*)
8697         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8698         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8699         echo "(Trimming domain name from host name--host name is now $myhostname)"
8700         ;;
8701 *) case "$mydomain" in
8702         '')
8703                 {
8704                         test "X$hostcat" = "Xypcat hosts" &&
8705                         ypmatch "$myhostname" hosts 2>/dev/null |\
8706                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8707                         $test -s hosts
8708                 } || {
8709                         test "X$hostcat" != "X" &&
8710                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8711                                         /[       ]$myhostname[  . ]/p" > hosts
8712                 }
8713                 tmp_re="[       . ]"
8714                 if $test -f hosts; then
8715                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8716                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8717                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8718                                 hosts | $sort | $uniq | \
8719                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8720                         case `$echo X$dflt` in
8721                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8722                                 dflt=.
8723                                 ;;
8724                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8725                                 ;;
8726                         esac
8727                 else
8728                         echo "(I cannot locate a hosts database anywhere)"
8729                         dflt=.
8730                 fi
8731                 case "$dflt" in
8732                 .)
8733                         tans=`./loc resolv.conf X /etc /usr/etc`
8734                         if $test -f "$tans"; then
8735                                 echo "(Attempting domain name extraction from $tans)"
8736                                 dflt=.`$sed -n -e 's/   / /g' \
8737                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8738                                   -e 1q 2>/dev/null`
8739                                 case "$dflt" in
8740                                 .) dflt=.`$sed -n -e 's/        / /g' \
8741                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8742                                      -e 1q 2>/dev/null`
8743                                         ;;
8744                                 esac
8745                         fi
8746                         ;;
8747                 esac
8748                 case "$dflt" in
8749                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8750                         dflt=.`sh -c domainname 2>/dev/null`
8751                         case "$dflt" in
8752                         '') dflt='.';;
8753                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8754                         esac
8755                         ;;
8756                 esac
8757                 case "$dflt$osname" in
8758                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8759                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8760                         ;;
8761                 esac
8762                 case "$dflt" in
8763                 .) echo "(Lost all hope -- silly guess then)"
8764                         dflt='.nonet'
8765                         ;;
8766                 esac
8767                 $rm -f hosts
8768                 ;;
8769         *) dflt="$mydomain";;
8770         esac;;
8771 esac
8772 echo " "
8773 rp="What is your domain name?"
8774 . ./myread
8775 tans="$ans"
8776 case "$ans" in
8777 '') ;;
8778 .*) ;;
8779 *) tans=".$tans";;
8780 esac
8781 mydomain="$tans"
8782
8783 : translate upper to lower if necessary
8784 case "$mydomain" in
8785 *[A-Z]*)
8786         echo "(Normalizing case in your domain name)"
8787         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8788         ;;
8789 esac
8790
8791 : a little sanity check here
8792 case "$phostname" in
8793 '') ;;
8794 *)
8795         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8796         $myhostname$mydomain|$myhostname) ;;
8797         *)
8798                 case "$phostname" in
8799                 sed*)
8800                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8801                         ;;
8802                 *)
8803                         echo "(That doesn't agree with your $phostname command, by the way.)"
8804                         ;;
8805                 esac
8806         ;;
8807         esac
8808         ;;
8809 esac
8810
8811 : determine the e-mail address of the user who is running us
8812 $cat <<EOM
8813
8814 I need to get your e-mail address in Internet format if possible, i.e.
8815 something like user@host.domain. Please answer accurately since I have
8816 no easy means to double check it. The default value provided below
8817 is most probably close to reality but may not be valid from outside
8818 your organization...
8819
8820 EOM
8821 cont=x
8822 while test "$cont"; do
8823         case "$cf_email" in
8824         '') dflt="$cf_by@$myhostname$mydomain";;
8825         *) dflt="$cf_email";;
8826         esac
8827         rp='What is your e-mail address?'
8828         . ./myread
8829         cf_email="$ans"
8830         case "$cf_email" in
8831         *@*.*) cont='' ;;
8832         *)
8833                 rp='Address does not look like an Internet one.  Use it anyway?'
8834                 case "$fastread" in
8835                 yes) dflt=y ;;
8836                 *) dflt=n ;;
8837                 esac
8838                 . ./myread
8839                 case "$ans" in
8840                 y*) cont='' ;;
8841                 *) echo " " ;;
8842                 esac
8843                 ;;
8844         esac
8845 done
8846
8847 : Ask e-mail of administrator
8848 $cat <<EOM
8849
8850 If you or somebody else will be maintaining perl at your site, please
8851 fill in the correct e-mail address here so that they may be contacted
8852 if necessary. Currently, the "perlbug" program included with perl
8853 will send mail to this address in addition to perlbug@perl.org. You may
8854 enter "none" for no administrator.
8855
8856 EOM
8857 case "$perladmin" in
8858 '') dflt="$cf_email";;
8859 *) dflt="$perladmin";;
8860 esac
8861 rp='Perl administrator e-mail address'
8862 . ./myread
8863 perladmin="$ans"
8864
8865 : determine whether to only install version-specific parts.
8866 echo " "
8867 $cat <<EOM
8868 Do you want to install only the version-specific parts of the perl
8869 distribution?  Usually you do *not* want to do this.
8870 EOM
8871 case "$versiononly" in
8872 "$define"|[Yy]*|true) dflt='y' ;;
8873 *) dflt='n';
8874 esac
8875 rp="Do you want to install only the version-specific parts of perl?"
8876 . ./myread
8877 case "$ans" in
8878 [yY]*)  val="$define";;
8879 *)      val="$undef" ;;
8880 esac
8881 set versiononly
8882 eval $setvar
8883
8884 case "$versiononly" in
8885 "$define") inc_version_list=''
8886            inc_version_list_init=0
8887            ;;
8888 esac
8889
8890 : figure out how to guarantee perl startup
8891 : XXX Note that this currently takes advantage of the bug that binexp ignores
8892 :     the Configure -Dinstallprefix setting, which in turn means that under
8893 :     relocatable @INC, initialinstalllocation is what binexp started as.
8894 case "$startperl" in
8895 '')
8896         case "$sharpbang" in
8897         *!)
8898                 $cat <<EOH
8899
8900 I can use the #! construct to start perl on your system. This will
8901 make startup of perl scripts faster, but may cause problems if you
8902 want to share those scripts and perl is not in a standard place
8903 ($initialinstalllocation/perl) on all your platforms. The alternative
8904 is to force a shell by starting the script with a single ':' character.
8905
8906 EOH
8907                 case "$versiononly" in
8908                 "$define")      dflt="$initialinstalllocation/perl$version";;
8909                 *)              dflt="$initialinstalllocation/perl";;
8910                 esac
8911                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8912                 . ./myread
8913                 case "$ans" in
8914                 none)   startperl=": # use perl";;
8915                 *)      startperl="#!$ans"
8916                         if $test 30 -lt `echo "$ans" | wc -c`; then
8917                                 $cat >&4 <<EOM
8918
8919 WARNING:  Some systems limit the #! command to 32 characters.
8920 If you experience difficulty running Perl scripts with #!, try
8921 installing Perl in a directory with a shorter pathname.
8922
8923 EOM
8924                         fi ;;
8925                 esac
8926                 ;;
8927         *) startperl=": # use perl"
8928                 ;;
8929         esac
8930         ;;
8931 esac
8932 echo "I'll use $startperl to start perl scripts."
8933
8934 : figure best path for perl in scripts
8935 case "$perlpath" in
8936 '')
8937         case "$versiononly" in
8938         "$define")      perlpath="$initialinstalllocation/perl$version";;
8939         *)              perlpath="$initialinstalllocation/perl";;
8940         esac
8941         case "$startperl" in
8942         *!*) ;;
8943         *)
8944                 $cat <<EOH
8945
8946 I will use the "eval 'exec'" idiom to start Perl on your system.
8947 I can use the full path of your Perl binary for this purpose, but
8948 doing so may cause problems if you want to share those scripts and
8949 Perl is not always in a standard place ($initialinstalllocation/perl).
8950
8951 EOH
8952                 dflt="$initialinstalllocation/perl"
8953                 rp="What path shall I use in \"eval 'exec'\"?"
8954                 . ./myread
8955                 perlpath="$ans"
8956                 ;;
8957         esac
8958         ;;
8959 esac
8960 case "$startperl" in
8961 *!*)    ;;
8962 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8963 esac
8964
8965 : determine where public executable scripts go
8966 set scriptdir scriptdir
8967 eval $prefixit
8968 case "$scriptdir" in
8969 '')
8970         dflt="$bin"
8971         : guess some guesses
8972         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8973         $test -d /usr/share/bin     && dflt=/usr/share/bin
8974         $test -d /usr/local/script  && dflt=/usr/local/script
8975         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8976         $test -d $prefixexp/script  && dflt=$prefixexp/script
8977         set dflt
8978         eval $prefixup
8979         ;;
8980 *)  dflt="$scriptdir"
8981         ;;
8982 esac
8983 $cat <<EOM
8984
8985 Some installations have a separate directory just for executable scripts so
8986 that they can mount it across multiple architectures but keep the scripts in
8987 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8988 Or you might just lump your scripts in with all your other executables.
8989
8990 EOM
8991 fn=d~
8992 rp='Where do you keep publicly executable scripts?'
8993 . ./getfile
8994 if $test "X$ansexp" != "X$scriptdirexp"; then
8995         installscript=''
8996 fi
8997 installscriptdir=''
8998 prefixvar=scriptdir
8999 . ./setprefixvar
9000 : A little fix up for an irregularly named variable.
9001 installscript="$installscriptdir"
9002
9003 : determine where add-on public executables go
9004 case "$sitebin" in
9005 '')     dflt=$siteprefix/bin ;;
9006 *)      dflt=$sitebin ;;
9007 esac
9008 fn=d~
9009 rp='Pathname where the add-on public executables should be installed?'
9010 . ./getfile
9011 prefixvar=sitebin
9012 . ./setprefixvar
9013
9014 : determine where add-on html pages go
9015 : There is no standard location, so try to copy the previously-selected
9016 : directory structure for the core html pages.
9017 case "$sitehtml1dir" in
9018 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9019 *)     dflt=$sitehtml1dir ;;
9020 esac
9021 case "$dflt" in
9022 ''|' ') dflt=none ;;
9023 esac
9024 fn=dn+~
9025 rp='Pathname where the site-specific html pages should be installed?'
9026 . ./getfile
9027 prefixvar=sitehtml1dir
9028 . ./setprefixvar
9029
9030 : determine where add-on library html pages go
9031 : There is no standard location, so try to copy the previously-selected
9032 : directory structure for the core html pages.
9033 case "$sitehtml3dir" in
9034 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9035 *)     dflt=$sitehtml3dir ;;
9036 esac
9037 case "$dflt" in
9038 ''|' ') dflt=none ;;
9039 esac
9040 fn=dn+~
9041 rp='Pathname where the site-specific library html pages should be installed?'
9042 . ./getfile
9043 prefixvar=sitehtml3dir
9044 . ./setprefixvar
9045
9046 : determine where add-on manual pages go
9047 case "$siteman1dir" in
9048 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9049 *)      dflt=$siteman1dir ;;
9050 esac
9051 case "$dflt" in
9052 ''|' ') dflt=none ;;
9053 esac
9054 fn=dn+~
9055 rp='Pathname where the site-specific manual pages should be installed?'
9056 . ./getfile
9057 prefixvar=siteman1dir
9058 . ./setprefixvar
9059
9060 : determine where add-on library man pages go
9061 case "$siteman3dir" in
9062 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9063 *)      dflt=$siteman3dir ;;
9064 esac
9065 case "$dflt" in
9066 ''|' ') dflt=none ;;
9067 esac
9068 fn=dn+~
9069 rp='Pathname where the site-specific library manual pages should be installed?'
9070 . ./getfile
9071 prefixvar=siteman3dir
9072 . ./setprefixvar
9073
9074 : determine where add-on public executable scripts go
9075 case "$sitescript" in
9076 '')     dflt=$siteprefix/script
9077         $test -d $dflt || dflt=$sitebin ;;
9078 *)  dflt="$sitescript" ;;
9079 esac
9080 fn=d~+
9081 rp='Pathname where add-on public executable scripts should be installed?'
9082 . ./getfile
9083 prefixvar=sitescript
9084 . ./setprefixvar
9085
9086 : Check if faststdio is requested and available
9087 case "$usefaststdio" in
9088 $define|true|[yY]*|'')
9089         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9090         case "$xversion" in
9091         [68])   dflt='y' ;;
9092         *)      dflt='n' ;;
9093         esac
9094         ;;
9095 *) dflt='n';;
9096 esac
9097 cat <<EOM
9098
9099 Perl can be built to use 'fast stdio', which means using the stdio
9100 library but also directly manipulating the stdio buffers to enable
9101 faster I/O.  Using stdio is better for backward compatibility (especially
9102 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9103 interface has been preferred instead of stdio.
9104
9105 If this doesn't make any sense to you, just accept the default '$dflt'.
9106 EOM
9107 rp='Use the "fast stdio" if available?'
9108 . ./myread
9109 case "$ans" in
9110 y|Y)    val="$define" ;;
9111 *)      val="$undef" ;;
9112 esac
9113 set usefaststdio
9114 eval $setvar
9115
9116
9117 : define an is-a-typedef? function
9118 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9119 case "$inclist" in
9120 "") inclist="sys/types.h";;
9121 esac;
9122 eval "varval=\$$var";
9123 case "$varval" in
9124 "")
9125         $rm -f temp.c;
9126         for inc in $inclist; do
9127                 echo "#include <$inc>" >>temp.c;
9128         done;
9129         echo "#ifdef $type" >> temp.c;
9130         echo "printf(\"We have $type\");" >> temp.c;
9131         echo "#endif" >> temp.c;
9132         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9133         if $contains $type temp.E >/dev/null 2>&1; then
9134                 eval "$var=\$type";
9135         else
9136                 eval "$var=\$def";
9137         fi;
9138         $rm -f temp.?;;
9139 *) eval "$var=\$varval";;
9140 esac'
9141
9142 : define an is-a-typedef? function that prompts if the type is not available.
9143 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9144 case "$inclist" in
9145 "") inclist="sys/types.h";;
9146 esac;
9147 eval "varval=\$$var";
9148 case "$varval" in
9149 "")
9150         $rm -f temp.c;
9151         for inc in $inclist; do
9152                 echo "#include <$inc>" >>temp.c;
9153         done;
9154         echo "#ifdef $type" >> temp.c;
9155         echo "printf(\"We have $type\");" >> temp.c;
9156         echo "#endif" >> temp.c;
9157         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9158         echo " " ;
9159         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9160         if $contains $type temp.E >/dev/null 2>&1; then
9161                 echo "$type found." >&4;
9162                 eval "$var=\$type";
9163         else
9164                 echo "$type NOT found." >&4;
9165                 dflt="$def";
9166                 . ./myread ;
9167                 eval "$var=\$ans";
9168         fi;
9169         $rm -f temp.?;;
9170 *) eval "$var=\$varval";;
9171 esac'
9172
9173 : see what type lseek is declared as in the kernel
9174 rp="What is the type used for lseek's offset on this system?"
9175 set off_t lseektype long stdio.h sys/types.h
9176 eval $typedef_ask
9177
9178 echo " "
9179 echo "Checking to see how big your file offsets are..." >&4
9180 $cat >try.c <<EOCP
9181 #include <sys/types.h>
9182 #include <stdio.h>
9183 int main()
9184 {
9185     printf("%d\n", (int)sizeof($lseektype));
9186     return(0);
9187 }
9188 EOCP
9189 set try
9190 if eval $compile_ok; then
9191         lseeksize=`$run ./try`
9192         echo "Your file offsets are $lseeksize bytes long."
9193 else
9194         dflt=$longsize
9195         echo " "
9196         echo "(I can't seem to compile the test program.  Guessing...)"
9197         rp="What is the size of your file offsets (in bytes)?"
9198         . ./myread
9199         lseeksize="$ans"
9200 fi
9201 $rm_try
9202
9203 : see what type file positions are declared as in the library
9204 rp="What is the type for file position used by fsetpos()?"
9205 set fpos_t fpostype long stdio.h sys/types.h
9206 eval $typedef_ask
9207
9208 : Check size for Fpos_t
9209 echo " "
9210 case "$fpostype" in
9211 *_t) zzz="$fpostype"    ;;
9212 *)   zzz="fpos_t"       ;;
9213 esac
9214 echo "Checking the size of $zzz..." >&4
9215 cat > try.c <<EOCP
9216 #include <sys/types.h>
9217 #include <stdio.h>
9218 #$i_stdlib I_STDLIB
9219 #ifdef I_STDLIB
9220 #include <stdlib.h>
9221 #endif
9222 int main() {
9223     printf("%d\n", (int)sizeof($fpostype));
9224     exit(0);
9225 }
9226 EOCP
9227 set try
9228 if eval $compile_ok; then
9229         yyy=`$run ./try`
9230         case "$yyy" in
9231         '')     fpossize=4
9232                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9233                 ;;
9234         *)      fpossize=$yyy
9235                 echo "Your $zzz is $fpossize bytes long."
9236                 ;;
9237         esac
9238 else
9239         dflt="$longsize"
9240         echo " " >&4
9241         echo "(I can't compile the test program.  Guessing...)" >&4
9242         rp="What is the size of your file positions (in bytes)?"
9243         . ./myread
9244         fpossize="$ans"
9245 fi
9246
9247 : Check for large file support
9248 # Backward compatibility (uselfs is deprecated).
9249 case "$uselfs" in
9250 "$define"|true|[yY]*)
9251         cat <<EOM >&4
9252
9253 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9254 EOM
9255         uselargefiles="$define"
9256         ;;
9257 esac
9258
9259 case "$lseeksize:$fpossize" in
9260 8:8) cat <<EOM
9261
9262 You can have files larger than 2 gigabytes.
9263 EOM
9264    val="$define" ;;
9265 *)    case "$uselargefiles" in
9266    "$undef"|false|[nN]*) dflt='n' ;;
9267    *)   dflt='y' ;;
9268    esac
9269    cat <<EOM
9270
9271 Perl can be built to understand large files (files larger than 2 gigabytes)
9272 on some systems.  To do so, Configure can be run with -Duselargefiles.
9273
9274 If this doesn't make any sense to you, just accept the default '$dflt'.
9275 EOM
9276    rp='Try to understand large files, if available?'
9277    . ./myread
9278    case "$ans" in
9279    y|Y)         val="$define" ;;
9280    *)           val="$undef"  ;;
9281    esac
9282    ;;
9283 esac
9284 set uselargefiles
9285 eval $setvar
9286 : Look for a hint-file generated 'call-back-unit'.  If the
9287 : user has specified that a large files perl is to be built,
9288 : we may need to set or change some other defaults.
9289 if $test -f uselargefiles.cbu; then
9290         echo "Your platform has some specific hints regarding large file builds, using them..."
9291         . ./uselargefiles.cbu
9292 fi
9293 case "$uselargefiles" in
9294 "$define")
9295         if $test -f uselargefiles.cbu; then
9296                 echo " "
9297                 echo "Rechecking to see how big your file offsets are..." >&4
9298                 $cat >try.c <<EOCP
9299 #include <sys/types.h>
9300 #include <stdio.h>
9301 int main()
9302 {
9303     printf("%d\n", (int)sizeof($lseektype));
9304     return(0);
9305 }
9306 EOCP
9307                 set try
9308                 if eval $compile_ok; then
9309                         lseeksize=`$run ./try`
9310                         $echo "Your file offsets are now $lseeksize bytes long."
9311                 else
9312                         dflt="$lseeksize"
9313                         echo " "
9314                         echo "(I can't seem to compile the test program.  Guessing...)"
9315                         rp="What is the size of your file offsets (in bytes)?"
9316                         . ./myread
9317                         lseeksize="$ans"
9318                 fi
9319                 case "$fpostype" in
9320                 *_t) zzz="$fpostype"    ;;
9321                 *)   zzz="fpos_t"       ;;
9322                 esac
9323                 $echo $n "Rechecking the size of $zzz...$c" >&4
9324                 $cat > try.c <<EOCP
9325 #include <sys/types.h>
9326 #include <stdio.h>
9327 #$i_stdlib I_STDLIB
9328 #ifdef I_STDLIB
9329 #include <stdlib.h>
9330 #endif
9331 int main() {
9332     printf("%d\n", (int)sizeof($fpostype));
9333     return(0);
9334 }
9335 EOCP
9336                 set try
9337                 if eval $compile_ok; then
9338                         yyy=`$run ./try`
9339                         dflt="$lseeksize"
9340                         case "$yyy" in
9341                         '')     echo " "
9342                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9343                                 ;;
9344                         *)      fpossize=$yyy
9345                                 echo " $fpossize bytes." >&4
9346                                 ;;
9347                         esac
9348                 else
9349                         dflt="$fpossize"
9350                         echo " "
9351                         echo "(I can't compile the test program.  Guessing...)" >&4
9352                         rp="What is the size of your file positions (in bytes)?"
9353                         . ./myread
9354                         fpossize="$ans"
9355                 fi
9356                 $rm_try
9357         fi
9358         ;;
9359 esac
9360
9361 : Set the vendorbin variables
9362 case "$vendorprefix" in
9363 '')     d_vendorbin="$undef"
9364         vendorbin=''
9365         vendorbinexp=''
9366         ;;
9367 *)      d_vendorbin="$define"
9368         : determine where vendor-supplied executables go.
9369         case "$vendorbin" in
9370         '') dflt=$vendorprefix/bin ;;
9371         *)      dflt="$vendorbin" ;;
9372         esac
9373         fn=d~+
9374         rp='Pathname for the vendor-supplied executables directory?'
9375         . ./getfile
9376         vendorbin="$ans"
9377         vendorbinexp="$ansexp"
9378         ;;
9379 esac
9380 prefixvar=vendorbin
9381 . ./installprefix
9382
9383 : Set the vendorhtml1dir variables
9384 case "$vendorprefix" in
9385 '')     vendorhtml1dir=''
9386         vendorhtml1direxp=''
9387         ;;
9388 *)      : determine where vendor-supplied html pages go.
9389         : There is no standard location, so try to copy the previously-selected
9390         : directory structure for the core html pages.
9391         : XXX Better default suggestions would be welcome.
9392         case "$vendorhtml1dir" in
9393         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9394         *)      dflt=$vendorhtml1dir ;;
9395         esac
9396         case "$dflt" in
9397         ''|' ') dflt=none ;;
9398         esac
9399         fn=dn+~
9400         rp='Pathname for the vendor-supplied html pages?'
9401         . ./getfile
9402         vendorhtml1dir="$ans"
9403         vendorhtml1direxp="$ansexp"
9404         ;;
9405 esac
9406 : Use ' ' for none so value is preserved next time through Configure
9407 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9408 prefixvar=vendorhtml1dir
9409 . ./installprefix
9410
9411 : Set the vendorhtml3dir variables
9412 case "$vendorprefix" in
9413 '')     vendorhtml3dir=''
9414         vendorhtml3direxp=''
9415         ;;
9416 *)      : determine where vendor-supplied module html pages go.
9417         : There is no standard location, so try to copy the previously-selected
9418         : directory structure for the core html pages.
9419         : XXX Better default suggestions would be welcome.
9420         case "$vendorhtml3dir" in
9421         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9422         *)      dflt=$vendorhtml3dir ;;
9423         esac
9424         case "$dflt" in
9425         ''|' ') dflt=none ;;
9426         esac
9427         fn=dn+~
9428         rp='Pathname for the vendor-supplied html pages?'
9429         . ./getfile
9430         vendorhtml3dir="$ans"
9431         vendorhtml3direxp="$ansexp"
9432         ;;
9433 esac
9434 : Use ' ' for none so value is preserved next time through Configure
9435 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9436 prefixvar=vendorhtml3dir
9437 . ./installprefix
9438
9439 : Set the vendorman1dir variables
9440 case "$vendorprefix" in
9441 '')     vendorman1dir=''
9442         vendorman1direxp=''
9443         ;;
9444 *)      : determine where vendor-supplied manual pages go.
9445         case "$vendorman1dir" in
9446         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9447         *)      dflt=$vendorman1dir ;;
9448         esac
9449         case "$dflt" in
9450         ''|' ') dflt=none ;;
9451         esac
9452         fn=nd~+
9453         rp='Pathname for the vendor-supplied manual section 1 pages?'
9454         . ./getfile
9455         vendorman1dir="$ans"
9456         vendorman1direxp="$ansexp"
9457         ;;
9458 esac
9459 : Use ' ' for none so value is preserved next time through Configure
9460 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9461 prefixvar=vendorman1dir
9462 . ./installprefix
9463
9464 : Set the vendorman3dir variables
9465 case "$vendorprefix" in
9466 '')     vendorman3dir=''
9467         vendorman3direxp=''
9468         ;;
9469 *)      : determine where vendor-supplied module manual pages go.
9470         case "$vendorman3dir" in
9471         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9472         *)      dflt=$vendorman3dir ;;
9473         esac
9474         case "$dflt" in
9475         ''|' ') dflt=none ;;
9476         esac
9477         fn=nd~+
9478         rp='Pathname for the vendor-supplied manual section 3 pages?'
9479         . ./getfile
9480         vendorman3dir="$ans"
9481         vendorman3direxp="$ansexp"
9482         ;;
9483 esac
9484 : Use ' ' for none so value is preserved next time through Configure
9485 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9486 prefixvar=vendorman3dir
9487 . ./installprefix
9488
9489 : Set the vendorscript variables
9490 case "$vendorprefix" in
9491 '')     d_vendorscript="$undef"
9492         vendorscript=''
9493         vendorscriptexp=''
9494         ;;
9495 *)      d_vendorscript="$define"
9496         : determine where vendor-supplied scripts go.
9497         case "$vendorscript" in
9498         '')     dflt=$vendorprefix/script
9499                 $test -d $dflt || dflt=$vendorbin ;;
9500         *)  dflt="$vendorscript" ;;
9501         esac
9502         $cat <<EOM
9503
9504 The installation process will create a directory for
9505 vendor-supplied scripts.
9506
9507 EOM
9508         fn=d~+
9509         rp='Pathname for the vendor-supplied scripts directory?'
9510         . ./getfile
9511         vendorscript="$ans"
9512         vendorscriptexp="$ansexp"
9513         ;;
9514 esac
9515 prefixvar=vendorscript
9516 . ./installprefix
9517
9518 : script used to emit important warnings
9519 cat >warn <<EOS
9520 $startsh
9521 if test \$# -gt 0; then
9522         echo "\$@" >msg
9523 else
9524         cat >msg
9525 fi
9526 echo "*** WARNING:" >&4
9527 sed -e 's/^/*** /' <msg >&4
9528 echo "*** " >&4
9529 cat msg >>config.msg
9530 echo " " >>config.msg
9531 rm -f msg
9532 EOS
9533 chmod +x warn
9534 $eunicefix warn
9535
9536 : see which of string.h or strings.h is needed
9537 echo " "
9538 strings=`./findhdr string.h`
9539 if $test "$strings" && $test -r "$strings"; then
9540         echo "Using <string.h> instead of <strings.h>." >&4
9541         val="$define"
9542 else
9543         val="$undef"
9544         strings=`./findhdr strings.h`
9545         if $test "$strings" && $test -r "$strings"; then
9546                 echo "Using <strings.h> instead of <string.h>." >&4
9547         else
9548                 ./warn "No string header found -- You'll surely have problems."
9549         fi
9550 fi
9551 set i_string
9552 eval $setvar
9553 case "$i_string" in
9554 "$undef") strings=`./findhdr strings.h`;;
9555 *)        strings=`./findhdr string.h`;;
9556 esac
9557
9558 : see if qgcvt exists
9559 set qgcvt d_qgcvt
9560 eval $inlibc
9561
9562 : Check print/scan long double stuff
9563 echo " "
9564
9565 if $test X"$d_longdbl" = X"$define"; then
9566
9567 echo "Checking how to print long doubles..." >&4
9568
9569 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9570         $cat >try.c <<'EOCP'
9571 #include <sys/types.h>
9572 #include <stdio.h>
9573 int main() {
9574   double d = 123.456;
9575   printf("%.3f\n", d);
9576 }
9577 EOCP
9578         set try
9579         if eval $compile; then
9580                 yyy=`$run ./try`
9581                 case "$yyy" in
9582                 123.456)
9583                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9584                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9585                         echo "We will use %f."
9586                         ;;
9587                 esac
9588         fi
9589 fi
9590
9591 if $test X"$sPRIfldbl" = X; then
9592         $cat >try.c <<'EOCP'
9593 #include <sys/types.h>
9594 #include <stdio.h>
9595 int main() {
9596   long double d = 123.456;
9597   printf("%.3Lf\n", d);
9598 }
9599 EOCP
9600         set try
9601         if eval $compile; then
9602                 yyy=`$run ./try`
9603                 case "$yyy" in
9604                 123.456)
9605                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9606                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9607                         echo "We will use %Lf."
9608                         ;;
9609                 esac
9610         fi
9611 fi
9612
9613 if $test X"$sPRIfldbl" = X; then
9614         $cat >try.c <<'EOCP'
9615 #include <sys/types.h>
9616 #include <stdio.h>
9617 int main() {
9618   long double d = 123.456;
9619   printf("%.3llf\n", d);
9620 }
9621 EOCP
9622         set try
9623         if eval $compile; then
9624                 yyy=`$run ./try`
9625                 case "$yyy" in
9626                 123.456)
9627                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9628                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9629                         echo "We will use %llf."
9630                         ;;
9631                 esac
9632         fi
9633 fi
9634
9635 if $test X"$sPRIfldbl" = X; then
9636         $cat >try.c <<'EOCP'
9637 #include <sys/types.h>
9638 #include <stdio.h>
9639 int main() {
9640   long double d = 123.456;
9641   printf("%.3lf\n", d);
9642 }
9643 EOCP
9644         set try
9645         if eval $compile; then
9646                 yyy=`$run ./try`
9647                 case "$yyy" in
9648                 123.456)
9649                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9650                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9651                         echo "We will use %lf."
9652                         ;;
9653                 esac
9654         fi
9655 fi
9656
9657 if $test X"$sPRIfldbl" = X; then
9658         echo "Cannot figure out how to print long doubles." >&4
9659 else
9660         sSCNfldbl=$sPRIfldbl    # expect consistency
9661 fi
9662
9663 $rm_try
9664
9665 fi # d_longdbl
9666
9667 case "$sPRIfldbl" in
9668 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9669         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9670         d_SCNfldbl="$undef";
9671         ;;
9672 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9673         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9674         d_SCNfldbl="$define";
9675         ;;
9676 esac
9677
9678 : Check how to convert floats to strings.
9679
9680 if test "X$d_Gconvert" = X; then
9681
9682 echo " "
9683 echo "Checking for an efficient way to convert floats to strings."
9684 echo " " > try.c
9685 case "$uselongdouble" in
9686 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9687 esac
9688 case "$d_longdbl" in
9689 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9690 esac
9691 case "$d_PRIgldbl" in
9692 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9693 esac
9694 $cat >>try.c <<EOP
9695 #ifdef TRY_gconvert
9696 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9697 char *myname = "gconvert";
9698 #endif
9699 #ifdef TRY_gcvt
9700 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9701 char *myname = "gcvt";
9702 #endif
9703 #ifdef TRY_qgcvt
9704 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9705 char *myname = "qgcvt";
9706 #define DOUBLETYPE long double
9707 #endif
9708 #ifdef TRY_sprintf
9709 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9710 #ifdef HAS_PRIgldbl
9711 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9712 #else
9713 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9714 #endif
9715 #else
9716 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9717 #endif
9718 char *myname = "sprintf";
9719 #endif
9720
9721 #ifndef DOUBLETYPE
9722 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9723 #define DOUBLETYPE long double
9724 #else
9725 #define DOUBLETYPE double
9726 #endif
9727 #endif
9728
9729 #include <stdio.h>
9730
9731 #$i_stdlib I_STDLIB
9732 #ifdef I_STDLIB
9733 #include <stdlib.h>
9734 #endif
9735 #$i_string I_STRING
9736 #ifdef I_STRING
9737 #  include <string.h>
9738 #else
9739 #  include <strings.h>
9740 #endif
9741
9742 int checkit(char *expect, char *got)
9743 {
9744     if (strcmp(expect, got)) {
9745                 printf("%s oddity:  Expected %s, got %s\n",
9746                         myname, expect, got);
9747                 exit(1);
9748         }
9749 }
9750
9751 int main()
9752 {
9753         char buf[64];
9754         buf[63] = '\0';
9755
9756         /* This must be 1st test on (which?) platform */
9757         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9758         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9759         checkit("0.1", buf);
9760
9761         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9762         checkit("0.01", buf);
9763
9764         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9765         checkit("0.001", buf);
9766
9767         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9768         checkit("0.0001", buf);
9769
9770         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9771         if (strlen(buf) > 5)
9772             checkit("9e-005", buf); /* for Microsoft ?? */
9773         else
9774             checkit("9e-05", buf);
9775
9776         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9777         checkit("1", buf);
9778
9779         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9780         checkit("1.1", buf);
9781
9782         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9783         checkit("1.01", buf);
9784
9785         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9786         checkit("1.001", buf);
9787
9788         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9789         checkit("1.0001", buf);
9790
9791         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9792         checkit("1.00001", buf);
9793
9794         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9795         checkit("1.000001", buf);
9796
9797         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9798         checkit("0", buf);
9799
9800         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9801         checkit("-1", buf);
9802
9803         /* Some Linux gcvt's give 1.e+5 here. */
9804         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9805         checkit("100000", buf);
9806
9807         /* Some Linux gcvt's give -1.e+5 here. */
9808         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9809         checkit("-100000", buf);
9810
9811         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9812         checkit("123.456", buf);
9813
9814         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9815         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9816         /* 34 should be enough to scare even long double
9817          * places into using the e notation. */
9818         if (strlen(buf) > 5)
9819             checkit("1e+034", buf); /* for Microsoft */
9820         else
9821             checkit("1e+34", buf);
9822
9823         /* For Perl, if you add additional tests here, also add them to
9824          * t/base/num.t for benefit of platforms not using Configure or
9825          * overriding d_Gconvert */
9826
9827         exit(0);
9828 }
9829 EOP
9830 : first add preferred functions to our list
9831 xxx_list=""
9832 for xxx_convert in $gconvert_preference; do
9833     case $xxx_convert in
9834     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9835     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9836     esac
9837 done
9838 : then add any others
9839 for xxx_convert in gconvert gcvt sprintf; do
9840     case "$xxx_list" in
9841     *$xxx_convert*) ;;
9842     *) xxx_list="$xxx_list $xxx_convert" ;;
9843     esac
9844 done
9845
9846 case "$d_longdbl$uselongdouble" in
9847 "$define$define")
9848     : again, add prefered functions to our list first
9849     xxx_ld_list=""
9850     for xxx_convert in $gconvert_ld_preference; do
9851         case $xxx_convert in
9852         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9853         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9854         esac
9855     done
9856     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9857     for xxx_convert in qgcvt sprintf $xxx_list; do
9858         case "$xxx_ld_list" in
9859         $xxx_convert*|*" $xxx_convert"*) ;;
9860         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9861         esac
9862     done
9863     : if sprintf cannot do long doubles, move it to the end
9864     if test "$d_PRIgldbl" != "$define"; then
9865         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9866     fi
9867     : if no qgcvt, remove it
9868     if test "$d_qgcvt" != "$define"; then
9869         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9870     fi
9871     : use the ld_list
9872     xxx_list="$xxx_ld_list"
9873     ;;
9874 esac
9875
9876 for xxx_convert in $xxx_list; do
9877         echo "Trying $xxx_convert..."
9878         $rm -f try try$_o core
9879         set try -DTRY_$xxx_convert
9880         if eval $compile; then
9881                 echo "$xxx_convert() found." >&4
9882                 if $run ./try; then
9883                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9884                         break;
9885                 else
9886                         echo "...But $xxx_convert didn't work as I expected."
9887                         xxx_convert=''
9888                 fi
9889         else
9890                 echo "$xxx_convert NOT found." >&4
9891         fi
9892 done
9893
9894 if test X$xxx_convert = X; then
9895     echo "*** WHOA THERE!!! ***" >&4
9896     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9897     xxx_convert=sprintf
9898 fi
9899
9900 case "$xxx_convert" in
9901 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9902 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9903 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9904 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9905    "$define$define$define")
9906       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9907    "$define$define$undef")
9908       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9909    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9910    esac
9911    ;;
9912 esac
9913
9914 fi
9915 $rm_try
9916
9917 : see if _fwalk exists
9918 set fwalk d__fwalk
9919 eval $inlibc
9920
9921 : Initialize h_fcntl
9922 h_fcntl=false
9923
9924 : Initialize h_sysfile
9925 h_sysfile=false
9926
9927 : access call always available on UNIX
9928 set access d_access
9929 eval $inlibc
9930
9931 : locate the flags for 'access()'
9932 case "$d_access" in
9933 "$define")
9934         echo " "
9935         $cat >access.c <<EOCP
9936 #include <sys/types.h>
9937 #ifdef I_FCNTL
9938 #include <fcntl.h>
9939 #endif
9940 #ifdef I_SYS_FILE
9941 #include <sys/file.h>
9942 #endif
9943 #ifdef I_UNISTD
9944 #include <unistd.h>
9945 #endif
9946 #$i_stdlib I_STDLIB
9947 #ifdef I_STDLIB
9948 #include <stdlib.h>
9949 #endif
9950 int main() {
9951         exit(R_OK);
9952 }
9953 EOCP
9954         : check sys/file.h first, no particular reason here
9955         if $test `./findhdr sys/file.h` && \
9956                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9957                 h_sysfile=true;
9958                 echo "<sys/file.h> defines the *_OK access constants." >&4
9959         elif $test `./findhdr fcntl.h` && \
9960                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9961                 h_fcntl=true;
9962                 echo "<fcntl.h> defines the *_OK access constants." >&4
9963         elif $test `./findhdr unistd.h` && \
9964                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9965                 echo "<unistd.h> defines the *_OK access constants." >&4
9966         else
9967                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9968         fi
9969         ;;
9970 esac
9971 $rm -f access*
9972
9973 : see if accessx exists
9974 set accessx d_accessx
9975 eval $inlibc
9976
9977 : see if aintl exists
9978 set aintl d_aintl
9979 eval $inlibc
9980
9981 : see if alarm exists
9982 set alarm d_alarm
9983 eval $inlibc
9984
9985 : see if 64bit time functions exists
9986
9987 set ctime64 d_ctime64
9988 eval $inlibc
9989
9990 set localtime64 d_localtime64
9991 eval $inlibc
9992
9993 set gmtime64 d_gmtime64
9994 eval $inlibc
9995
9996 set mktime64 d_mktime64
9997 eval $inlibc
9998
9999 set difftime64 d_difftime64
10000 eval $inlibc
10001
10002 set asctime64 d_asctime64
10003 eval $inlibc
10004
10005 : see if POSIX threads are available
10006 set pthread.h i_pthread
10007 eval $inhdr
10008
10009 : define a fucntion to check prototypes
10010 $cat > protochk <<EOSH
10011 $startsh
10012 cc="$cc"
10013 optimize="$optimize"
10014 ccflags="$ccflags"
10015 prototype="$prototype"
10016 define="$define"
10017 rm_try="$rm_try"
10018 usethreads=$usethreads
10019 i_pthread=$i_pthread
10020 pthread_h_first=$pthread_h_first
10021 EOSH
10022
10023 $cat >> protochk <<'EOSH'
10024
10025 $rm_try
10026 foo="$1"
10027 shift
10028 while test $# -ge 2; do
10029         case "$1" in
10030                 $define) echo "#include <$2>" >> try.c ;;
10031                 literal) echo "$2" >> try.c ;;
10032         esac
10033     # Extra magic for the benefit of systems that need pthread.h
10034     # to be included early to correctly detect threadsafe functions.
10035     # Such functions must guarantee themselves, though, that the usethreads
10036     # and i_pthread have been defined, before calling protochk.
10037     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10038         echo "#include <pthread.h>" >> try.c
10039         pthread_h_done=yes
10040     fi
10041     shift 2
10042 done
10043 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10044 cat >> try.c <<'EOCP'
10045 #ifdef CAN_PROTOTYPE
10046 #define _(args) args
10047 #else
10048 #define _(args) ()
10049 #endif
10050 EOCP
10051 echo "$foo" >> try.c
10052 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10053 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10054 status=$?
10055 $rm_try
10056 exit $status
10057 EOSH
10058 chmod +x protochk
10059 $eunicefix protochk
10060
10061 : Define hasproto macro for Configure internal use
10062 hasproto='varname=$1; func=$2; shift; shift;
10063 while $test $# -ge 2; do
10064         case "$1" in
10065         $define) echo "#include <$2>";;
10066         esac ;
10067     shift 2;
10068 done > try.c;
10069 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10070 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10071         echo "$func() prototype found.";
10072         val="$define";
10073 else
10074         echo "$func() prototype NOT found.";
10075         val="$undef";
10076 fi;
10077 set $varname;
10078 eval $setvar;
10079 $rm_try tryout.c'
10080
10081 : see if sys/types.h has to be included
10082 set sys/types.h i_systypes
10083 eval $inhdr
10084
10085 : see if sys/select.h has to be included
10086 set sys/select.h i_sysselct
10087 eval $inhdr
10088
10089 : Define hasfield macro for Configure internal use
10090 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10091 while $test $# -ge 2; do
10092         case "$1" in
10093         $define) echo "#include <$2>";;
10094         esac ;
10095     shift 2;
10096 done > try.c;
10097 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10098 set try;
10099 if eval $compile; then
10100         val="$define";
10101 else
10102         val="$undef";
10103 fi;
10104 set $varname;
10105 eval $setvar;
10106 $rm_try'
10107
10108 : see if we should include time.h, sys/time.h, or both
10109 echo " "
10110 if test "X$timeincl" = X; then
10111         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10112         $echo $n "I'm now running the test program...$c"
10113         $cat >try.c <<EOCP
10114 #include <sys/types.h>
10115 #ifdef I_TIME
10116 #include <time.h>
10117 #endif
10118 #ifdef I_SYSTIME
10119 #ifdef SYSTIMEKERNEL
10120 #define KERNEL
10121 #endif
10122 #include <sys/time.h>
10123 #endif
10124 #ifdef I_SYSSELECT
10125 #include <sys/select.h>
10126 #endif
10127 #$i_stdlib I_STDLIB
10128 #ifdef I_STDLIB
10129 #include <stdlib.h>
10130 #endif
10131 int main()
10132 {
10133         struct tm foo;
10134 #ifdef S_TIMEVAL
10135         struct timeval bar;
10136 #endif
10137 #ifdef S_TIMEZONE
10138         struct timezone tzp;
10139 #endif
10140         if (foo.tm_sec == foo.tm_sec)
10141                 exit(0);
10142 #ifdef S_TIMEVAL
10143         if (bar.tv_sec == bar.tv_sec)
10144                 exit(0);
10145 #endif
10146         exit(1);
10147 }
10148 EOCP
10149         flags=''
10150         for s_timezone in '-DS_TIMEZONE' ''; do
10151         sysselect=''
10152         for s_timeval in '-DS_TIMEVAL' ''; do
10153         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10154         for i_time in '' '-DI_TIME'; do
10155         for i_systime in '-DI_SYSTIME' ''; do
10156                 case "$flags" in
10157                 '') $echo $n ".$c"
10158                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10159                         if eval $compile; then
10160                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10161                                 shift
10162                                 flags="$*"
10163                                 echo " "
10164                                 $echo $n "Succeeded with $flags$c"
10165                         fi
10166                         ;;
10167                 esac
10168         done
10169         done
10170         done
10171         done
10172         done
10173         timeincl=''
10174         echo " "
10175         case "$flags" in
10176         *SYSTIMEKERNEL*) i_systimek="$define"
10177                 timeincl=`./findhdr sys/time.h`
10178                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10179         *) i_systimek="$undef";;
10180         esac
10181         case "$flags" in
10182         *I_TIME*) i_time="$define"
10183                 timeincl=`./findhdr time.h`" $timeincl"
10184                 echo "We'll include <time.h>." >&4;;
10185         *) i_time="$undef";;
10186         esac
10187         case "$flags" in
10188         *I_SYSTIME*) i_systime="$define"
10189                 timeincl=`./findhdr sys/time.h`" $timeincl"
10190                 echo "We'll include <sys/time.h>." >&4;;
10191         *) i_systime="$undef";;
10192         esac
10193         $rm_try
10194 fi
10195 : see if struct tm knows about tm_zone
10196 case "$i_systime$i_time" in
10197 *$define*)
10198         echo " "
10199         echo "Checking to see if your struct tm has tm_zone field..." >&4
10200         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10201         eval $hasfield
10202         ;;
10203 *)      val="$undef"
10204         set d_tm_tm_zone
10205         eval $setvar
10206         ;;
10207 esac
10208 case "$d_tm_tm_zone" in
10209 "$define")      echo "Yes, it does."   ;;
10210 *)              echo "No, it doesn't." ;;
10211 esac
10212 : see if struct tm knows about tm_gmtoff
10213 case "$i_systime$i_time" in
10214 *$define*)
10215         echo " "
10216         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10217         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10218         eval $hasfield
10219         ;;
10220 *)      val="$undef"
10221         set d_tm_tm_gmtoff
10222         eval $setvar
10223         ;;
10224 esac
10225 case "$d_tm_tm_gmtoff" in
10226 "$define")      echo "Yes, it does."   ;;
10227 *)              echo "No, it doesn't." ;;
10228 esac
10229
10230 : see if asctime_r exists
10231 set asctime_r d_asctime_r
10232 eval $inlibc
10233 case "$d_asctime_r" in
10234 "$define")
10235         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10236         case "$d_asctime_r_proto:$usethreads" in
10237         ":define")      d_asctime_r_proto=define
10238                 set d_asctime_r_proto asctime_r $hdrs
10239                 eval $hasproto ;;
10240         *)      ;;
10241         esac
10242         case "$d_asctime_r_proto" in
10243         define)
10244         case "$asctime_r_proto" in
10245         ''|0) try='char* asctime_r(const struct tm*, char*);'
10246         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10247         esac
10248         case "$asctime_r_proto" in
10249         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10250         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10251         esac
10252         case "$asctime_r_proto" in
10253         ''|0) try='int asctime_r(const struct tm*, char*);'
10254         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10255         esac
10256         case "$asctime_r_proto" in
10257         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10258         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10259         esac
10260         case "$asctime_r_proto" in
10261         ''|0)   d_asctime_r=undef
10262                 asctime_r_proto=0
10263                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10264         * )     case "$asctime_r_proto" in
10265                 REENTRANT_PROTO*) ;;
10266                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10267                 esac
10268                 echo "Prototype: $try" ;;
10269         esac
10270         ;;
10271         *)      case "$usethreads" in
10272                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10273                 esac
10274                 d_asctime_r=undef
10275                 asctime_r_proto=0
10276                 ;;
10277         esac
10278         ;;
10279 *)      asctime_r_proto=0
10280         ;;
10281 esac
10282
10283 : see if atolf exists
10284 set atolf d_atolf
10285 eval $inlibc
10286
10287 : see if atoll exists
10288 set atoll d_atoll
10289 eval $inlibc
10290
10291 : Look for GCC-style attribute format
10292 case "$d_attribute_format" in
10293 '')
10294 echo " "
10295 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10296 $cat >attrib.c <<'EOCP'
10297 #include <stdio.h>
10298 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10299 EOCP
10300 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10301         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10302                 echo "Your C compiler doesn't support __attribute__((format))."
10303                 val="$undef"
10304         else
10305                 echo "Your C compiler supports __attribute__((format))."
10306                 val="$define"
10307         fi
10308 else
10309         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10310         val="$undef"
10311 fi
10312 ;;
10313 *) val="$d_attribute_format" ;;
10314 esac
10315 set d_attribute_format
10316 eval $setvar
10317 $rm -f attrib*
10318
10319 : Look for GCC-style attribute format with null format allowed
10320 case "$d_printf_format_null" in
10321 '') case "$d_attribute_format" in
10322     $define)
10323         echo " "
10324         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10325 $cat >attrib.c <<EOCP
10326 #include <stdio.h>
10327 #$i_stdlib I_STDLIB
10328 #ifdef I_STDLIB
10329 #include <stdlib.h>
10330 #endif
10331 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10332 int null_printf (char* pat,...) { return (int)pat; }
10333 int main () { exit(null_printf(NULL)); }
10334 EOCP
10335         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10336             : run the executable in case it produces a run-time warning
10337             if $run ./attrib >>attrib.out 2>&1; then
10338                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10339                     echo "Your C compiler doesn't allow __printf__ format to be null."
10340                     val="$undef"
10341                 else
10342                     echo "Your C compiler allows __printf__ format to be null."
10343                     val="$define"
10344                 fi
10345             else
10346             echo "Your C compiler executable failed with __printf__ format null."
10347             val="$undef"
10348         fi
10349     else
10350         echo "Your C compiler fails with __printf__ format null."
10351         val="$undef"
10352     fi
10353     ;;
10354     *)  val="$undef" ;;
10355     esac
10356 ;;
10357 *)  val="$d_printf_format_null" ;;
10358 esac
10359 set d_printf_format_null
10360 eval $setvar
10361 $rm -f attrib*
10362
10363 : Look for GCC-style attribute malloc
10364 case "$d_attribute_malloc" in
10365 '')
10366 echo " "
10367 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10368 $cat >attrib.c <<'EOCP'
10369 #include <stdio.h>
10370 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10371 EOCP
10372 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10373         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10374                 echo "Your C compiler doesn't support __attribute__((malloc))."
10375                 val="$undef"
10376         else
10377                 echo "Your C compiler supports __attribute__((malloc))."
10378                 val="$define"
10379         fi
10380 else
10381         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10382         val="$undef"
10383 fi
10384 ;;
10385 *) val="$d_attribute_malloc" ;;
10386 esac
10387 set d_attribute_malloc
10388 eval $setvar
10389 $rm -f attrib*
10390
10391 : Look for GCC-style attribute nonnull
10392 case "$d_attribute_nonnull" in
10393 '')
10394 echo " "
10395 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10396 $cat >attrib.c <<'EOCP'
10397 #include <stdio.h>
10398 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10399 EOCP
10400 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10401         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10402                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10403                 val="$undef"
10404         else
10405                 echo "Your C compiler supports __attribute__((nonnull))."
10406                 val="$define"
10407         fi
10408 else
10409         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10410         val="$undef"
10411 fi
10412 ;;
10413 *) val="$d_attribute_nonnull" ;;
10414 esac
10415 set d_attribute_nonnull
10416 eval $setvar
10417 $rm -f attrib*
10418
10419 : Look for GCC-style attribute noreturn
10420 case "$d_attribute_noreturn" in
10421 '')
10422 echo " "
10423 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10424 $cat >attrib.c <<'EOCP'
10425 #include <stdio.h>
10426 void fall_over_dead( void ) __attribute__((noreturn));
10427 EOCP
10428 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10429         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10430                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10431                 val="$undef"
10432         else
10433                 echo "Your C compiler supports __attribute__((noreturn))."
10434                 val="$define"
10435         fi
10436 else
10437         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10438         val="$undef"
10439 fi
10440 ;;
10441 *) val="$d_attribute_noreturn" ;;
10442 esac
10443 set d_attribute_noreturn
10444 eval $setvar
10445 $rm -f attrib*
10446
10447 : Look for GCC-style attribute pure
10448 case "$d_attribute_pure" in
10449 '')
10450 echo " "
10451 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10452 $cat >attrib.c <<'EOCP'
10453 #include <stdio.h>
10454 int square( int n ) __attribute__((pure));
10455 EOCP
10456 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10457         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10458                 echo "Your C compiler doesn't support __attribute__((pure))."
10459                 val="$undef"
10460         else
10461                 echo "Your C compiler supports __attribute__((pure))."
10462                 val="$define"
10463         fi
10464 else
10465         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10466         val="$undef"
10467 fi
10468 ;;
10469 *) val="$d_attribute_pure" ;;
10470 esac
10471 set d_attribute_pure
10472 eval $setvar
10473 $rm -f attrib*
10474
10475 : Look for GCC-style attribute unused
10476 case "$d_attribute_unused" in
10477 '')
10478 echo " "
10479 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10480 $cat >attrib.c <<'EOCP'
10481 #include <stdio.h>
10482 int do_something( int dummy __attribute__((unused)), int n );
10483 EOCP
10484 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10485         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10486                 echo "Your C compiler doesn't support __attribute__((unused))."
10487                 val="$undef"
10488         else
10489                 echo "Your C compiler supports __attribute__((unused))."
10490                 val="$define"
10491         fi
10492 else
10493         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10494         val="$undef"
10495 fi
10496 ;;
10497 *) val="$d_attribute_unused" ;;
10498 esac
10499 set d_attribute_unused
10500 eval $setvar
10501 $rm -f attrib*
10502
10503 : Look for GCC-style attribute warn_unused_result
10504 case "$d_attribute_warn_unused_result" in
10505 '')
10506 echo " "
10507 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10508 $cat >attrib.c <<'EOCP'
10509 #include <stdio.h>
10510 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10511 EOCP
10512 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10513         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10514                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10515                 val="$undef"
10516         else
10517                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10518                 val="$define"
10519         fi
10520 else
10521         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10522         val="$undef"
10523 fi
10524 ;;
10525 *) val="$d_attribute_warn_unused_result" ;;
10526 esac
10527 set d_attribute_warn_unused_result
10528 eval $setvar
10529 $rm -f attrib*
10530
10531 : see if bcmp exists
10532 set bcmp d_bcmp
10533 eval $inlibc
10534
10535 : see if bcopy exists
10536 set bcopy d_bcopy
10537 eval $inlibc
10538
10539 : see if getpgrp exists
10540 set getpgrp d_getpgrp
10541 eval $inlibc
10542
10543 case "$d_getpgrp" in
10544 "$define")
10545         echo " "
10546         echo "Checking to see which flavor of getpgrp is in use..."
10547         $cat >try.c <<EOP
10548 #$i_unistd I_UNISTD
10549 #include <sys/types.h>
10550 #ifdef I_UNISTD
10551 #  include <unistd.h>
10552 #endif
10553 #$i_stdlib I_STDLIB
10554 #ifdef I_STDLIB
10555 #include <stdlib.h>
10556 #endif
10557 int main()
10558 {
10559         if (getuid() == 0) {
10560                 printf("(I see you are running Configure as super-user...)\n");
10561                 setuid(1);
10562         }
10563 #ifdef TRY_BSD_PGRP
10564         if (getpgrp(1) == 0)
10565                 exit(0);
10566 #else
10567         if (getpgrp() > 0)
10568                 exit(0);
10569 #endif
10570         exit(1);
10571 }
10572 EOP
10573         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10574                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10575                 val="$define"
10576         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10577                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10578                 val="$undef"
10579         else
10580                 echo "I can't seem to compile and run the test program."
10581                 if ./usg; then
10582                         xxx="a USG one, i.e. you use getpgrp()."
10583                 else
10584                         # SVR4 systems can appear rather BSD-ish.
10585                         case "$i_unistd" in
10586                         $undef)
10587                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10588                                 val="$define"
10589                                 ;;
10590                         $define)
10591                                 xxx="probably a USG one, i.e. you use getpgrp()."
10592                                 val="$undef"
10593                                 ;;
10594                         esac
10595                 fi
10596                 echo "Assuming your getpgrp is $xxx" >&4
10597         fi
10598         ;;
10599 *) val="$undef";;
10600 esac
10601 set d_bsdgetpgrp
10602 eval $setvar
10603 $rm_try
10604
10605 : see if setpgrp exists
10606 set setpgrp d_setpgrp
10607 eval $inlibc
10608
10609 case "$d_setpgrp" in
10610 "$define")
10611         echo " "
10612         echo "Checking to see which flavor of setpgrp is in use..."
10613         $cat >try.c <<EOP
10614 #$i_unistd I_UNISTD
10615 #include <sys/types.h>
10616 #ifdef I_UNISTD
10617 #  include <unistd.h>
10618 #endif
10619 #$i_stdlib I_STDLIB
10620 #ifdef I_STDLIB
10621 #include <stdlib.h>
10622 #endif
10623 int main()
10624 {
10625         if (getuid() == 0) {
10626                 printf("(I see you are running Configure as super-user...)\n");
10627                 setuid(1);
10628         }
10629 #ifdef TRY_BSD_PGRP
10630         if (-1 == setpgrp(1, 1))
10631                 exit(0);
10632 #else
10633         if (setpgrp() != -1)
10634                 exit(0);
10635 #endif
10636         exit(1);
10637 }
10638 EOP
10639         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10640                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10641                 val="$define"
10642         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10643                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10644                 val="$undef"
10645         else
10646                 echo "(I can't seem to compile and run the test program.)"
10647                 if ./usg; then
10648                         xxx="a USG one, i.e. you use setpgrp()."
10649                 else
10650                         # SVR4 systems can appear rather BSD-ish.
10651                         case "$i_unistd" in
10652                         $undef)
10653                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10654                                 val="$define"
10655                                 ;;
10656                         $define)
10657                                 xxx="probably a USG one, i.e. you use setpgrp()."
10658                                 val="$undef"
10659                                 ;;
10660                         esac
10661                 fi
10662                 echo "Assuming your setpgrp is $xxx" >&4
10663         fi
10664         ;;
10665 *) val="$undef";;
10666 esac
10667 set d_bsdsetpgrp
10668 eval $setvar
10669 $rm_try
10670
10671 : Look for GCC-style __builtin_choose_expr
10672 case "$d_builtin_choose_expr" in
10673 '')
10674     echo " "
10675     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10676     $cat >try.c <<'EOCP'
10677 #include <assert.h>
10678 #include <stdlib.h>
10679 #include <stdio.h>
10680
10681 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10682
10683 int main(void) {
10684     assert( SYRINX(1) == 2112 );
10685     assert( SYRINX(1) != 5150 );
10686     assert( SYRINX(0) == 5150 );
10687     assert( SYRINX(0) != 2112 );
10688     puts( "All good!" );
10689     exit(0);
10690 }
10691
10692 EOCP
10693     set try
10694     if eval $compile && $run ./try; then
10695         echo "Your C compiler supports __builtin_choose_expr."
10696         val="$define"
10697     else
10698         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10699         val="$undef"
10700     fi
10701 ;;
10702 *) val="$d_builtin_choose_expr" ;;
10703 esac
10704
10705 set d_builtin_choose_expr
10706 eval $setvar
10707 $rm_try
10708
10709 : Look for GCC-style __builtin_expect
10710 case "$d_builtin_expect" in
10711 '')
10712     echo " "
10713     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10714     $cat >try.c <<'EOCP'
10715 int main(void) {
10716     int n = 50;
10717     if ( __builtin_expect(n, 0) ) n = 1;
10718     /* Remember shell exit code truth is 0, C truth is non-zero */
10719     return !(n == 1);
10720 }
10721 EOCP
10722     set try
10723     if eval $compile && $run ./try; then
10724         echo "Your C compiler supports __builtin_expect."
10725         val="$define"
10726     else
10727         echo "Your C compiler doesn't seem to understand __builtin_expect."
10728         val="$undef"
10729     fi
10730     ;;
10731 *) val="$d_builtin_expect" ;;
10732 esac
10733
10734 set d_builtin_expect
10735 eval $setvar
10736 $rm_try
10737
10738 : see if bzero exists
10739 set bzero d_bzero
10740 eval $inlibc
10741
10742 : see if stdarg is available
10743 echo " "
10744 if $test `./findhdr stdarg.h`; then
10745         echo "<stdarg.h> found." >&4
10746         valstd="$define"
10747 else
10748         echo "<stdarg.h> NOT found." >&4
10749         valstd="$undef"
10750 fi
10751
10752 : see if varags is available
10753 echo " "
10754 if $test `./findhdr varargs.h`; then
10755         echo "<varargs.h> found." >&4
10756 else
10757         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10758 fi
10759
10760 : set up the varargs testing programs
10761 $cat > varargs.c <<EOP
10762 #ifdef I_STDARG
10763 #include <stdarg.h>
10764 #endif
10765 #ifdef I_VARARGS
10766 #include <varargs.h>
10767 #endif
10768
10769 #ifdef I_STDARG
10770 int f(char *p, ...)
10771 #else
10772 int f(va_alist)
10773 va_dcl
10774 #endif
10775 {
10776         va_list ap;
10777 #ifndef I_STDARG
10778         char *p;
10779 #endif
10780 #ifdef I_STDARG
10781         va_start(ap,p);
10782 #else
10783         va_start(ap);
10784         p = va_arg(ap, char *);
10785 #endif
10786         va_end(ap);
10787         return 0;
10788 }
10789 EOP
10790 $cat > varargs <<EOP
10791 $startsh
10792 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10793         echo "true"
10794 else
10795         echo "false"
10796 fi
10797 $rm -f varargs$_o
10798 EOP
10799 chmod +x varargs
10800
10801 : now check which varargs header should be included
10802 echo " "
10803 i_varhdr=''
10804 case "$valstd" in
10805 "$define")
10806         if `./varargs I_STDARG`; then
10807                 val='stdarg.h'
10808         elif `./varargs I_VARARGS`; then
10809                 val='varargs.h'
10810         fi
10811         ;;
10812 *)
10813         if `./varargs I_VARARGS`; then
10814                 val='varargs.h'
10815         fi
10816         ;;
10817 esac
10818 case "$val" in
10819 '')
10820 echo "I could not find the definition for va_dcl... You have problems..." >&4
10821         val="$undef"; set i_stdarg; eval $setvar
10822         val="$undef"; set i_varargs; eval $setvar
10823         ;;
10824 *)
10825         set i_varhdr
10826         eval $setvar
10827         case "$i_varhdr" in
10828         stdarg.h)
10829                 val="$define"; set i_stdarg; eval $setvar
10830                 val="$undef"; set i_varargs; eval $setvar
10831                 ;;
10832         varargs.h)
10833                 val="$undef"; set i_stdarg; eval $setvar
10834                 val="$define"; set i_varargs; eval $setvar
10835                 ;;
10836         esac
10837         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10838 esac
10839 $rm -f varargs*
10840
10841 : see if the Compiler supports C99 variadic macros
10842 case "$i_stdarg$i_stdlib" in
10843     "$define$define")
10844     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10845     $cat >try.c <<EOCP
10846 #include <stdio.h>
10847 #include <stdarg.h>
10848
10849 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10850
10851 int main() {
10852   char buf[20];
10853   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10854   puts(buf);
10855   return 0;
10856 }
10857 EOCP
10858     set try
10859     if eval $compile && $run ./try 2>&1 >/dev/null; then
10860         case "`$run ./try`" in
10861             "123 456 789")
10862             echo "You have C99 variadic macros." >&4
10863             d_c99_variadic_macros="$define"
10864             ;;
10865             *)
10866             echo "You don't have functional C99 variadic macros." >&4
10867             d_c99_variadic_macros="$undef"
10868             ;;
10869         esac
10870     else
10871         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10872         d_c99_variadic_macros="$undef"
10873     fi
10874     $rm_try
10875     ;;
10876     *)
10877     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10878     d_c99_variadic_macros="$undef"
10879     ;;
10880 esac
10881
10882 : see if signal is declared as pointer to function returning int or void
10883 echo " "
10884 xxx=`./findhdr signal.h`
10885 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10886 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10887         echo "You have int (*signal())() instead of void." >&4
10888         val="$undef"
10889 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10890         echo "You have void (*signal())()." >&4
10891         val="$define"
10892 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10893         echo "You have int (*signal())() instead of void." >&4
10894         val="$undef"
10895 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10896         echo "You have void (*signal())()." >&4
10897         val="$define"
10898 else
10899         case "$d_voidsig" in
10900         '')
10901         echo "I can't determine whether signal handler returns void or int..." >&4
10902                 dflt=void
10903                 rp="What type does your signal handler return?"
10904                 . ./myread
10905                 case "$ans" in
10906                 v*) val="$define";;
10907                 *) val="$undef";;
10908                 esac;;
10909         "$define")
10910                 echo "As you already told me, signal handler returns void." >&4
10911                 val="$define"
10912                 ;;
10913         *)      echo "As you already told me, signal handler returns int." >&4
10914                 val="$undef"
10915                 ;;
10916         esac
10917 fi
10918 set d_voidsig
10919 eval $setvar
10920 case "$d_voidsig" in
10921 "$define") signal_t="void";;
10922 *) signal_t="int";;
10923 esac
10924 $rm -f $$.tmp
10925
10926 : check for ability to cast large floats to 32-bit ints.
10927 echo " "
10928 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10929 if $test "$intsize" -ge 4; then
10930         xxx=int
10931 else
10932         xxx=long
10933 fi
10934 $cat >try.c <<EOCP
10935 #include <stdio.h>
10936 #$i_stdlib I_STDLIB
10937 #ifdef I_STDLIB
10938 #include <stdlib.h>
10939 #endif
10940 #include <sys/types.h>
10941 #include <signal.h>
10942 $signal_t blech(int s) { exit(3); }
10943 int main()
10944 {
10945         $xxx i32;
10946         double f, g;
10947         int result = 0;
10948         char str[16];
10949         signal(SIGFPE, blech);
10950
10951         /* Don't let compiler optimize the test away.  Store the number
10952            in a writable string for gcc to pass to sscanf under HP/UX.
10953         */
10954         sprintf(str, "2147483647");
10955         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10956         g = 10 * f;
10957         i32  = ($xxx) g;
10958
10959         /* x86 processors will probably give 0x8000 0000, which is a
10960            sign change.  We don't want that.  We want to mimic SPARC
10961            behavior here, which is to preserve the sign and give
10962            back 0x7fff ffff.
10963         */
10964         if (i32 != ($xxx) f)
10965                 result |= 1;
10966         exit(result);
10967 }
10968 EOCP
10969 set try
10970 if eval $compile_ok; then
10971         $run ./try
10972         yyy=$?
10973 else
10974         echo "(I can't seem to compile the test program--assuming it can't)"
10975         yyy=1
10976 fi
10977 case "$yyy" in
10978 0)      val="$define"
10979         echo "Yup, it can."
10980         ;;
10981 *)      val="$undef"
10982         echo "Nope, it can't."
10983         ;;
10984 esac
10985 set d_casti32
10986 eval $setvar
10987 $rm_try
10988
10989 : check for ability to cast negative floats to unsigned
10990 echo " "
10991 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10992 $cat >try.c <<EOCP
10993 #include <stdio.h>
10994 #$i_stdlib I_STDLIB
10995 #ifdef I_STDLIB
10996 #include <stdlib.h>
10997 #endif
10998 #include <sys/types.h>
10999 #include <signal.h>
11000 $signal_t blech(int s) { exit(7); }
11001 $signal_t blech_in_list(int s) { exit(4); }
11002 unsigned long dummy_long(unsigned long p) { return p; }
11003 unsigned int dummy_int(unsigned int p) { return p; }
11004 unsigned short dummy_short(unsigned short p) { return p; }
11005 int main()
11006 {
11007         double f;
11008         unsigned long along;
11009         unsigned int aint;
11010         unsigned short ashort;
11011         int result = 0;
11012         char str[16];
11013
11014         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11015            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11016            optimized the whole file away
11017         */
11018         /* Store the number in a writable string for gcc to pass to
11019            sscanf under HP/UX.
11020         */
11021         sprintf(str, "-123");
11022         sscanf(str, "%lf", &f);  /* f = -123.; */
11023
11024         signal(SIGFPE, blech);
11025         along = (unsigned long)f;
11026         aint = (unsigned int)f;
11027         ashort = (unsigned short)f;
11028         if (along != (unsigned long)-123)
11029                 result |= 1;
11030         if (aint != (unsigned int)-123)
11031                 result |= 1;
11032         if (ashort != (unsigned short)-123)
11033                 result |= 1;
11034         sprintf(str, "1073741824.");
11035         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11036         f = f + f;
11037         along = 0;
11038         along = (unsigned long)f;
11039         if (along != 0x80000000)
11040                 result |= 2;
11041         f -= 1.;
11042         along = 0;
11043         along = (unsigned long)f;
11044         if (along != 0x7fffffff)
11045                 result |= 1;
11046         f += 2.;
11047         along = 0;
11048         along = (unsigned long)f;
11049         if (along != 0x80000001)
11050                 result |= 2;
11051         if (result)
11052                 exit(result);
11053         signal(SIGFPE, blech_in_list);
11054         sprintf(str, "123.");
11055         sscanf(str, "%lf", &f);  /* f = 123.; */
11056         along = dummy_long((unsigned long)f);
11057         aint = dummy_int((unsigned int)f);
11058         ashort = dummy_short((unsigned short)f);
11059         if (along != (unsigned long)123)
11060                 result |= 4;
11061         if (aint != (unsigned int)123)
11062                 result |= 4;
11063         if (ashort != (unsigned short)123)
11064                 result |= 4;
11065         exit(result);
11066
11067 }
11068 EOCP
11069 set try
11070 if eval $compile_ok; then
11071         $run ./try
11072         castflags=$?
11073 else
11074         echo "(I can't seem to compile the test program--assuming it can't)"
11075         castflags=7
11076 fi
11077 case "$castflags" in
11078 0)      val="$define"
11079         echo "Yup, it can."
11080         ;;
11081 *)      val="$undef"
11082         echo "Nope, it can't."
11083         ;;
11084 esac
11085 set d_castneg
11086 eval $setvar
11087 $rm_try
11088
11089 : see if vprintf exists
11090 echo " "
11091 if set vprintf val -f d_vprintf; eval $csym; $val; then
11092         echo 'vprintf() found.' >&4
11093         val="$define"
11094         $cat >try.c <<EOF
11095 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11096 #$i_varargs I_VARARGS
11097
11098 #$i_stdlib I_STDLIB
11099 #$i_unistd I_UNISTD
11100
11101 #ifdef I_STDARG
11102 #  include <stdarg.h>
11103 #else /* I_VARARGS */
11104 #  include <varargs.h>
11105 #endif
11106
11107 #ifdef I_UNISTD
11108 #  include <unistd.h>
11109 #endif
11110
11111 #ifdef I_STDLIB
11112 #  include <stdlib.h>
11113 #endif
11114
11115 #include <stdio.h> /* vsprintf prototype */
11116
11117 #ifdef I_STDARG
11118 void xxx(int n, ...)
11119 {
11120     va_list args;
11121     char buf[10];
11122     va_start(args, n);
11123     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11124 }
11125 int main() { xxx(1, "foo"); }
11126
11127 #else /* I_VARARGS */
11128
11129 xxx(va_alist)
11130 va_dcl
11131 {
11132     va_list args;
11133     char buf[10];
11134     va_start(args);
11135     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11136 }
11137 int main() { xxx("foo"); }
11138
11139 #endif
11140
11141 EOF
11142         set try
11143         if eval $compile_ok; then
11144                 if $run ./try; then
11145                         echo "Your vsprintf() returns (int)." >&4
11146                         val2="$undef"
11147                 else
11148                         echo "Your vsprintf() returns (char*)." >&4
11149                         val2="$define"
11150                 fi
11151         else
11152                 echo 'I am unable to compile the vsprintf() test program.' >&4
11153                 # We shouldn't get here.  If we do, assume the standard signature,
11154                 # not the old BSD one.
11155                 echo 'Guessing that vsprintf() returns (int).' >&4
11156                 val2="$undef"
11157         fi
11158 else
11159         echo 'vprintf() NOT found.' >&4
11160         val="$undef"
11161         val2="$undef"
11162 fi
11163 $rm_try
11164 set d_vprintf
11165 eval $setvar
11166 val=$val2
11167 set d_charvspr
11168 eval $setvar
11169
11170 : see if chown exists
11171 set chown d_chown
11172 eval $inlibc
11173
11174 : see if chroot exists
11175 set chroot d_chroot
11176 eval $inlibc
11177
11178 : see if chsize exists
11179 set chsize d_chsize
11180 eval $inlibc
11181
11182 : see if class exists
11183 set class d_class
11184 eval $inlibc
11185
11186 : see if clearenv exists
11187 set clearenv d_clearenv
11188 eval $inlibc
11189
11190 : Define hasstruct macro for Configure internal use
11191 hasstruct='varname=$1; struct=$2; shift; shift;
11192 while $test $# -ge 2; do
11193         case "$1" in
11194         $define) echo "#include <$2>";;
11195         esac ;
11196     shift 2;
11197 done > try.c;
11198 echo "int main () { struct $struct foo; }" >> try.c;
11199 set try;
11200 if eval $compile; then
11201         val="$define";
11202 else
11203         val="$undef";
11204 fi;
11205 set $varname;
11206 eval $setvar;
11207 $rm_try'
11208
11209 : see whether socket exists
11210 socketlib=''
11211 sockethdr=''
11212 echo " "
11213 $echo $n "Hmm... $c" >&4
11214 if set socket val -f d_socket; eval $csym; $val; then
11215         echo "Looks like you have Berkeley networking support." >&4
11216         d_socket="$define"
11217         if set setsockopt val -f; eval $csym; $val; then
11218                 d_oldsock="$undef"
11219         else
11220                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11221                 d_oldsock="$define"
11222         fi
11223 else
11224         if $contains socklib libc.list >/dev/null 2>&1; then
11225                 echo "Looks like you have Berkeley networking support." >&4
11226                 d_socket="$define"
11227                 : we will have to assume that it supports the 4.2 BSD interface
11228                 d_oldsock="$undef"
11229         else
11230                 echo "You don't have Berkeley networking in libc$_a..." >&4
11231                 if test "X$d_socket" = "X$define"; then
11232                    echo "...but you seem to believe that you have sockets." >&4
11233                 else
11234                         for net in net socket
11235                         do
11236                                 if test -f /usr/lib/lib$net$_a; then
11237                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11238                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11239                                         if $contains socket libc.list >/dev/null 2>&1; then
11240                                                 d_socket="$define"
11241                                                 socketlib="-l$net"
11242                                                 case "$net" in
11243                                                 net)
11244                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11245                                                         sockethdr="-I/usr/netinclude"
11246                                                         ;;
11247                                                 esac
11248                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11249                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11250                                                         d_oldsock="$undef"
11251                                                 else
11252                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11253                                                         d_oldsock="$define"
11254                                                 fi
11255                                                 break
11256                                         fi
11257                                 fi
11258                         done
11259                         if test "X$d_socket" != "X$define"; then
11260                            echo "or anywhere else I see." >&4
11261                            d_socket="$undef"
11262                            d_oldsock="$undef"
11263                         fi
11264                 fi
11265         fi
11266 fi
11267
11268 : see if socketpair exists
11269 set socketpair d_sockpair
11270 eval $inlibc
11271
11272
11273 echo " "
11274 echo "Checking the availability of certain socket constants..." >&4
11275 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11276         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11277         $cat >try.c <<EOF
11278 #include <sys/types.h>
11279 #include <sys/socket.h>
11280 int main() {
11281     int i = $ENUM;
11282 }
11283 EOF
11284         val="$undef"
11285         set try; if eval $compile; then
11286                 val="$define"
11287         fi
11288         set d_${enum}; eval $setvar
11289         $rm_try
11290 done
11291
11292 : see if this is a sys/uio.h system
11293 set sys/uio.h i_sysuio
11294 eval $inhdr
11295
11296 : Check for cmsghdr support
11297 echo " "
11298 echo "Checking to see if your system supports struct cmsghdr..." >&4
11299 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11300 eval $hasstruct
11301 case "$d_cmsghdr_s" in
11302 "$define")      echo "Yes, it does."   ;;
11303 *)              echo "No, it doesn't." ;;
11304 esac
11305
11306
11307 : check for const keyword
11308 echo " "
11309 echo 'Checking to see if your C compiler knows about "const"...' >&4
11310 $cat >const.c <<'EOCP'
11311 typedef struct spug { int drokk; } spug;
11312 int main()
11313 {
11314         const char *foo;
11315         const spug y = { 0 };
11316 }
11317 EOCP
11318 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11319         val="$define"
11320         echo "Yup, it does."
11321 else
11322         val="$undef"
11323         echo "Nope, it doesn't."
11324 fi
11325 set d_const
11326 eval $setvar
11327
11328 : see if copysignl exists
11329 set copysignl d_copysignl
11330 eval $inlibc
11331
11332 : see if crypt exists
11333 echo " "
11334 set crypt d_crypt
11335 eval $inlibc
11336 case "$d_crypt" in
11337 $define) cryptlib='' ;;
11338 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11339                 echo 'crypt() found.' >&4
11340                 val="$define"
11341                 cryptlib=''
11342         else
11343                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11344                 if $test -z "$cryptlib"; then
11345                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11346                 else
11347                         cryptlib=-lcrypt
11348                 fi
11349                 if $test -z "$cryptlib"; then
11350                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11351                 else
11352                         cryptlib=-lcrypt
11353                 fi
11354                 if $test -z "$cryptlib"; then
11355                         cryptlib=`./loc libcrypt$_a "" $libpth`
11356                 else
11357                         cryptlib=-lcrypt
11358                 fi
11359                 if $test -z "$cryptlib"; then
11360                         echo 'crypt() NOT found.' >&4
11361                         val="$undef"
11362                 else
11363                         val="$define"
11364                 fi
11365         fi
11366         set d_crypt
11367         eval $setvar
11368         ;;
11369 esac
11370
11371 : see if this is a crypt.h system
11372 set crypt.h i_crypt
11373 eval $inhdr
11374
11375 : see if crypt_r exists
11376 set crypt_r d_crypt_r
11377 eval $inlibc
11378 case "$d_crypt_r" in
11379 "$define")
11380         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11381         case "$d_crypt_r_proto:$usethreads" in
11382         ":define")      d_crypt_r_proto=define
11383                 set d_crypt_r_proto crypt_r $hdrs
11384                 eval $hasproto ;;
11385         *)      ;;
11386         esac
11387         case "$d_crypt_r_proto" in
11388         define)
11389         case "$crypt_r_proto" in
11390         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11391         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11392         esac
11393         case "$crypt_r_proto" in
11394         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11395         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11396         esac
11397         case "$crypt_r_proto" in
11398         ''|0)   d_crypt_r=undef
11399                 crypt_r_proto=0
11400                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11401         * )     case "$crypt_r_proto" in
11402                 REENTRANT_PROTO*) ;;
11403                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11404                 esac
11405                 echo "Prototype: $try" ;;
11406         esac
11407         ;;
11408         *)      case "$usethreads" in
11409                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11410                 esac
11411                 d_crypt_r=undef
11412                 crypt_r_proto=0
11413                 ;;
11414         esac
11415         ;;
11416 *)      crypt_r_proto=0
11417         ;;
11418 esac
11419
11420 : get csh whereabouts
11421 case "$csh" in
11422 'csh') val="$undef" ;;
11423 *) val="$define" ;;
11424 esac
11425 set d_csh
11426 eval $setvar
11427 : Respect a hint or command line value for full_csh.
11428 case "$full_csh" in
11429 '') full_csh=$csh ;;
11430 esac
11431
11432 : see if ctermid exists
11433 set ctermid d_ctermid
11434 eval $inlibc
11435
11436 : see if ctermid_r exists
11437 set ctermid_r d_ctermid_r
11438 eval $inlibc
11439 case "$d_ctermid_r" in
11440 "$define")
11441         hdrs="$i_systypes sys/types.h define stdio.h "
11442         case "$d_ctermid_r_proto:$usethreads" in
11443         ":define")      d_ctermid_r_proto=define
11444                 set d_ctermid_r_proto ctermid_r $hdrs
11445                 eval $hasproto ;;
11446         *)      ;;
11447         esac
11448         case "$d_ctermid_r_proto" in
11449         define)
11450         case "$ctermid_r_proto" in
11451         ''|0) try='char* ctermid_r(char*);'
11452         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11453         esac
11454         case "$ctermid_r_proto" in
11455         ''|0)   d_ctermid_r=undef
11456                 ctermid_r_proto=0
11457                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11458         * )     case "$ctermid_r_proto" in
11459                 REENTRANT_PROTO*) ;;
11460                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11461                 esac
11462                 echo "Prototype: $try" ;;
11463         esac
11464         ;;
11465         *)      case "$usethreads" in
11466                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11467                 esac
11468                 d_ctermid_r=undef
11469                 ctermid_r_proto=0
11470                 ;;
11471         esac
11472         ;;
11473 *)      ctermid_r_proto=0
11474         ;;
11475 esac
11476
11477 : see if ctime_r exists
11478 set ctime_r d_ctime_r
11479 eval $inlibc
11480 case "$d_ctime_r" in
11481 "$define")
11482         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11483         case "$d_ctime_r_proto:$usethreads" in
11484         ":define")      d_ctime_r_proto=define
11485                 set d_ctime_r_proto ctime_r $hdrs
11486                 eval $hasproto ;;
11487         *)      ;;
11488         esac
11489         case "$d_ctime_r_proto" in
11490         define)
11491         case "$ctime_r_proto" in
11492         ''|0) try='char* ctime_r(const time_t*, char*);'
11493         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11494         esac
11495         case "$ctime_r_proto" in
11496         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11497         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11498         esac
11499         case "$ctime_r_proto" in
11500         ''|0) try='int ctime_r(const time_t*, char*);'
11501         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11502         esac
11503         case "$ctime_r_proto" in
11504         ''|0) try='int ctime_r(const time_t*, char*, int);'
11505         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11506         esac
11507         case "$ctime_r_proto" in
11508         ''|0)   d_ctime_r=undef
11509                 ctime_r_proto=0
11510                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11511         * )     case "$ctime_r_proto" in
11512                 REENTRANT_PROTO*) ;;
11513                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11514                 esac
11515                 echo "Prototype: $try" ;;
11516         esac
11517         ;;
11518         *)      case "$usethreads" in
11519                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11520                 esac
11521                 d_ctime_r=undef
11522                 ctime_r_proto=0
11523                 ;;
11524         esac
11525         ;;
11526 *)      ctime_r_proto=0
11527         ;;
11528 esac
11529
11530 : see if cuserid exists
11531 set cuserid d_cuserid
11532 eval $inlibc
11533
11534 : see if this is a limits.h system
11535 set limits.h i_limits
11536 eval $inhdr
11537
11538 : see if this is a float.h system
11539 set float.h i_float
11540 eval $inhdr
11541
11542 : See if number of significant digits in a double precision number is known
11543 echo " "
11544 $cat >dbl_dig.c <<EOM
11545 #$i_limits I_LIMITS
11546 #$i_float I_FLOAT
11547 #ifdef I_LIMITS
11548 #include <limits.h>
11549 #endif
11550 #ifdef I_FLOAT
11551 #include <float.h>
11552 #endif
11553 #ifdef DBL_DIG
11554 printf("Contains DBL_DIG");
11555 #endif
11556 EOM
11557 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11558 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11559         echo "DBL_DIG found." >&4
11560         val="$define"
11561 else
11562         echo "DBL_DIG NOT found." >&4
11563         val="$undef"
11564 fi
11565 $rm -f dbl_dig.?
11566 set d_dbl_dig
11567 eval $setvar
11568
11569 : see if dbm.h is available
11570 : see if dbmclose exists
11571 set dbmclose d_dbmclose
11572 eval $inlibc
11573
11574 case "$d_dbmclose" in
11575 $define)
11576         set dbm.h i_dbm
11577         eval $inhdr
11578         case "$i_dbm" in
11579         $define)
11580                 val="$undef"
11581                 set i_rpcsvcdbm
11582                 eval $setvar
11583                 ;;
11584         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11585                 eval $inhdr
11586                 ;;
11587         esac
11588         ;;
11589 *)      echo "We won't be including <dbm.h>"
11590         val="$undef"
11591         set i_dbm
11592         eval $setvar
11593         val="$undef"
11594         set i_rpcsvcdbm
11595         eval $setvar
11596         ;;
11597 esac
11598
11599 : see if prototype for dbminit is available
11600 echo " "
11601 set d_dbminitproto dbminit $i_dbm dbm.h
11602 eval $hasproto
11603
11604 : see if difftime exists
11605 set difftime d_difftime
11606 eval $inlibc
11607
11608 : see if this is a dirent system
11609 echo " "
11610 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11611         val="$define"
11612         echo "<dirent.h> found." >&4
11613 else
11614         val="$undef"
11615         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11616                 echo "<sys/dir.h> found." >&4
11617                 echo " "
11618         else
11619                 xinc=`./findhdr sys/ndir.h`
11620         fi
11621         echo "<dirent.h> NOT found." >&4
11622 fi
11623 set i_dirent
11624 eval $setvar
11625
11626 : Look for type of directory structure.
11627 echo " "
11628 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11629
11630 case "$direntrytype" in
11631 ''|' ')
11632         case "$i_dirent" in
11633         $define) guess1='struct dirent' ;;
11634         *) guess1='struct direct'  ;;
11635         esac
11636         ;;
11637 *)      guess1="$direntrytype"
11638         ;;
11639 esac
11640
11641 case "$guess1" in
11642 'struct dirent') guess2='struct direct' ;;
11643 *) guess2='struct dirent' ;;
11644 esac
11645
11646 if $contains "$guess1" try.c >/dev/null 2>&1; then
11647         direntrytype="$guess1"
11648         echo "Your directory entries are $direntrytype." >&4
11649 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11650         direntrytype="$guess2"
11651         echo "Your directory entries seem to be $direntrytype." >&4
11652 else
11653         echo "I don't recognize your system's directory entries." >&4
11654         rp="What type is used for directory entries on this system?"
11655         dflt="$guess1"
11656         . ./myread
11657         direntrytype="$ans"
11658 fi
11659 $rm_try
11660
11661 : see if the directory entry stores field length
11662 echo " "
11663 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11664 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11665         echo "Good, your directory entry keeps length information in d_namlen." >&4
11666         val="$define"
11667 else
11668         echo "Your directory entry does not know about the d_namlen field." >&4
11669         val="$undef"
11670 fi
11671 set d_dirnamlen
11672 eval $setvar
11673 $rm_try
11674
11675 : Look for DIR.dd_fd
11676 case "$i_dirent" in
11677 "$define")
11678     echo "Checking to see if DIR has a dd_fd member variable" >&4
11679     $cat >try.c <<EOCP
11680 #$i_stdlib I_STDLIB
11681 #ifdef I_STDLIB
11682 #include <stdlib.h>
11683 #endif
11684 #include <dirent.h>
11685
11686 int main() {
11687     DIR dir;
11688     dir.dd_fd = 1;
11689     return 0;
11690 }
11691 EOCP
11692     val=$undef
11693     set try
11694     if eval $compile; then
11695         echo "Yes, it does."
11696         val="$define"
11697     else
11698         echo "No, it does not."
11699         val="$undef"
11700     fi
11701     ;;
11702 *)
11703     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11704     val="$undef"
11705     ;;
11706 esac
11707 set d_dir_dd_fd
11708 eval $setvar
11709 $rm_try
11710
11711 : see if this is an sysdir system
11712 set sys/dir.h i_sysdir
11713 eval $inhdr
11714
11715 : see if this is an sysndir system
11716 set sys/ndir.h i_sysndir
11717 eval $inhdr
11718
11719 : Look for dirfd
11720 echo " "
11721 $cat >dirfd.c <<EOM
11722 #include <stdio.h>
11723 #$i_stdlib I_STDLIB
11724 #ifdef I_STDLIB
11725 #include <stdlib.h>
11726 #endif
11727 #$i_dirent I_DIRENT             /**/
11728 #$i_sysdir I_SYS_DIR            /**/
11729 #$i_sysndir I_SYS_NDIR          /**/
11730 #$i_systypes I_SYS_TYPES        /**/
11731 #if defined(I_SYS_TYPES)
11732 #include <sys/types.h>
11733 #endif
11734 #if defined(I_DIRENT)
11735 #include <dirent.h>
11736 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11737 #include <sys/dir.h>
11738 #endif
11739 #else
11740 #ifdef I_SYS_NDIR
11741 #include <sys/ndir.h>
11742 #else
11743 #ifdef I_SYS_DIR
11744 #ifdef hp9000s500
11745 #include <ndir.h>       /* may be wrong in the future */
11746 #else
11747 #include <sys/dir.h>
11748 #endif
11749 #endif
11750 #endif
11751 #endif 
11752 int main() {
11753         DIR *dirp = opendir(".");
11754         if (dirfd(dirp) >= 0)
11755                 exit(0);
11756         else
11757                 exit(1);
11758 }
11759 EOM
11760 val=$undef
11761 set dirfd
11762 if eval $compile; then
11763         val="$define"
11764 fi
11765 case "$val" in
11766 $define)        echo "dirfd() found." >&4       ;;
11767 *)              echo "dirfd() NOT found." >&4   ;;
11768 esac
11769 set d_dirfd
11770 eval $setvar
11771 $rm -f dirfd*
11772
11773 : see if dlerror exists
11774 xxx_runnm="$runnm"
11775 runnm=false
11776 set dlerror d_dlerror
11777 eval $inlibc
11778 runnm="$xxx_runnm"
11779
11780 : see if dlfcn is available
11781 set dlfcn.h i_dlfcn
11782 eval $inhdr
11783
11784 : Check what extension to use for shared libs
11785 case "$usedl" in
11786 $define|y|true)
11787         $cat << EOM
11788
11789 On a few systems, the dynamically loaded modules that perl generates and uses
11790 will need a different extension than shared libs. The default will probably
11791 be appropriate.
11792
11793 EOM
11794         case "$dlext" in
11795         '')     dflt="$so" ;;
11796         *)      dflt="$dlext" ;;
11797         esac
11798         rp='What is the extension of dynamically loaded modules'
11799         . ./myread
11800         dlext="$ans"
11801         ;;
11802 *)
11803         dlext="none"
11804         ;;
11805 esac
11806
11807 : Check if dlsym need a leading underscore
11808 echo " "
11809 val="$undef"
11810
11811 case "$dlsrc" in
11812 dl_dlopen.xs)
11813         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11814         $cat >dyna.c <<'EOM'
11815 fred () { }
11816 EOM
11817
11818 $cat >fred.c<<EOM
11819
11820 #include <stdio.h>
11821 #$i_stdlib I_STDLIB
11822 #ifdef I_STDLIB
11823 #include <stdlib.h>
11824 #endif
11825 #$i_dlfcn I_DLFCN
11826 #ifdef I_DLFCN
11827 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11828 #else
11829 #include <sys/types.h>
11830 #include <nlist.h>
11831 #include <link.h>
11832 #endif
11833
11834 extern int fred() ;
11835
11836 int main()
11837 {
11838     void * handle ;
11839     void * symbol ;
11840 #ifndef RTLD_LAZY
11841     int mode = 1 ;
11842 #else
11843     int mode = RTLD_LAZY ;
11844 #endif
11845     handle = dlopen("./dyna.$dlext", mode) ;
11846     if (handle == NULL) {
11847         printf ("1\n") ;
11848         fflush (stdout) ;
11849         exit(0);
11850     }
11851     symbol = dlsym(handle, "fred") ;
11852     if (symbol == NULL) {
11853         /* try putting a leading underscore */
11854         symbol = dlsym(handle, "_fred") ;
11855         if (symbol == NULL) {
11856             printf ("2\n") ;
11857             fflush (stdout) ;
11858             exit(0);
11859         }
11860         printf ("3\n") ;
11861     }
11862     else
11863         printf ("4\n") ;
11864     fflush (stdout) ;
11865     exit(0);
11866 }
11867 EOM
11868         : Call the object file tmp-dyna.o in case dlext=o.
11869         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11870                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11871                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11872                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11873                 xxx=`$run ./fred`
11874                 case $xxx in
11875                 1)      echo "Test program failed using dlopen." >&4
11876                         echo "Perhaps you should not use dynamic loading." >&4;;
11877                 2)      echo "Test program failed using dlsym." >&4
11878                         echo "Perhaps you should not use dynamic loading." >&4;;
11879                 3)      echo "dlsym needs a leading underscore" >&4
11880                         val="$define" ;;
11881                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11882                 esac
11883         else
11884                 echo "I can't compile and run the test program." >&4
11885                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11886         fi
11887         ;;
11888 esac
11889
11890 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11891
11892 set d_dlsymun
11893 eval $setvar
11894
11895 : see if drand48_r exists
11896 set drand48_r d_drand48_r
11897 eval $inlibc
11898 case "$d_drand48_r" in
11899 "$define")
11900         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11901         case "$d_drand48_r_proto:$usethreads" in
11902         ":define")      d_drand48_r_proto=define
11903                 set d_drand48_r_proto drand48_r $hdrs
11904                 eval $hasproto ;;
11905         *)      ;;
11906         esac
11907         case "$d_drand48_r_proto" in
11908         define)
11909         case "$drand48_r_proto" in
11910         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11911         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
11912         esac
11913         case "$drand48_r_proto" in
11914         ''|0)   d_drand48_r=undef
11915                 drand48_r_proto=0
11916                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11917         * )     case "$drand48_r_proto" in
11918                 REENTRANT_PROTO*) ;;
11919                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11920                 esac
11921                 echo "Prototype: $try" ;;
11922         esac
11923         ;;
11924         *)      case "$usethreads" in
11925                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11926                 esac
11927                 d_drand48_r=undef
11928                 drand48_r_proto=0
11929                 ;;
11930         esac
11931         ;;
11932 *)      drand48_r_proto=0
11933         ;;
11934 esac
11935
11936 : see if prototype for drand48 is available
11937 echo " "
11938 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11939 eval $hasproto
11940
11941 : see if dup2 exists
11942 set dup2 d_dup2
11943 eval $inlibc
11944
11945 : see if eaccess exists
11946 set eaccess d_eaccess
11947 eval $inlibc
11948
11949 : see if endgrent exists
11950 set endgrent d_endgrent
11951 eval $inlibc
11952
11953 : see if this is an grp system
11954 set grp.h i_grp
11955 eval $inhdr
11956
11957 case "$i_grp" in
11958 $define)
11959         xxx=`./findhdr grp.h`
11960         $cppstdin $cppflags $cppminus < $xxx >$$.h
11961
11962         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11963                 val="$define"
11964         else
11965                 val="$undef"
11966         fi
11967         set d_grpasswd
11968         eval $setvar
11969
11970         $rm -f $$.h
11971         ;;
11972 *)
11973         val="$undef";
11974         set d_grpasswd; eval $setvar
11975         ;;
11976 esac
11977
11978 : see if endgrent_r exists
11979 set endgrent_r d_endgrent_r
11980 eval $inlibc
11981 case "$d_endgrent_r" in
11982 "$define")
11983         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11984         case "$d_endgrent_r_proto:$usethreads" in
11985         ":define")      d_endgrent_r_proto=define
11986                 set d_endgrent_r_proto endgrent_r $hdrs
11987                 eval $hasproto ;;
11988         *)      ;;
11989         esac
11990         case "$d_endgrent_r_proto" in
11991         define)
11992         case "$endgrent_r_proto" in
11993         ''|0) try='int endgrent_r(FILE**);'
11994         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
11995         esac
11996         case "$endgrent_r_proto" in
11997         ''|0) try='void endgrent_r(FILE**);'
11998         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
11999         esac
12000         case "$endgrent_r_proto" in
12001         ''|0)   d_endgrent_r=undef
12002                 endgrent_r_proto=0
12003                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12004         * )     case "$endgrent_r_proto" in
12005                 REENTRANT_PROTO*) ;;
12006                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12007                 esac
12008                 echo "Prototype: $try" ;;
12009         esac
12010         ;;
12011         *)      case "$usethreads" in
12012                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12013                 esac
12014                 d_endgrent_r=undef
12015                 endgrent_r_proto=0
12016                 ;;
12017         esac
12018         ;;
12019 *)      endgrent_r_proto=0
12020         ;;
12021 esac
12022
12023 : see if endhostent exists
12024 set endhostent d_endhent
12025 eval $inlibc
12026
12027 : see if this is a netdb.h system
12028 set netdb.h i_netdb
12029 eval $inhdr
12030
12031 : see if endhostent_r exists
12032 set endhostent_r d_endhostent_r
12033 eval $inlibc
12034 case "$d_endhostent_r" in
12035 "$define")
12036         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12037         case "$d_endhostent_r_proto:$usethreads" in
12038         ":define")      d_endhostent_r_proto=define
12039                 set d_endhostent_r_proto endhostent_r $hdrs
12040                 eval $hasproto ;;
12041         *)      ;;
12042         esac
12043         case "$d_endhostent_r_proto" in
12044         define)
12045         case "$endhostent_r_proto" in
12046         ''|0) try='int endhostent_r(struct hostent_data*);'
12047         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12048         esac
12049         case "$endhostent_r_proto" in
12050         ''|0) try='void endhostent_r(struct hostent_data*);'
12051         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12052         esac
12053         case "$endhostent_r_proto" in
12054         ''|0)   d_endhostent_r=undef
12055                 endhostent_r_proto=0
12056                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12057         * )     case "$endhostent_r_proto" in
12058                 REENTRANT_PROTO*) ;;
12059                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12060                 esac
12061                 echo "Prototype: $try" ;;
12062         esac
12063         ;;
12064         *)      case "$usethreads" in
12065                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12066                 esac
12067                 d_endhostent_r=undef
12068                 endhostent_r_proto=0
12069                 ;;
12070         esac
12071         ;;
12072 *)      endhostent_r_proto=0
12073         ;;
12074 esac
12075
12076 : see if endnetent exists
12077 set endnetent d_endnent
12078 eval $inlibc
12079
12080 : see if endnetent_r exists
12081 set endnetent_r d_endnetent_r
12082 eval $inlibc
12083 case "$d_endnetent_r" in
12084 "$define")
12085         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12086         case "$d_endnetent_r_proto:$usethreads" in
12087         ":define")      d_endnetent_r_proto=define
12088                 set d_endnetent_r_proto endnetent_r $hdrs
12089                 eval $hasproto ;;
12090         *)      ;;
12091         esac
12092         case "$d_endnetent_r_proto" in
12093         define)
12094         case "$endnetent_r_proto" in
12095         ''|0) try='int endnetent_r(struct netent_data*);'
12096         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12097         esac
12098         case "$endnetent_r_proto" in
12099         ''|0) try='void endnetent_r(struct netent_data*);'
12100         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12101         esac
12102         case "$endnetent_r_proto" in
12103         ''|0)   d_endnetent_r=undef
12104                 endnetent_r_proto=0
12105                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12106         * )     case "$endnetent_r_proto" in
12107                 REENTRANT_PROTO*) ;;
12108                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12109                 esac
12110                 echo "Prototype: $try" ;;
12111         esac
12112         ;;
12113         *)      case "$usethreads" in
12114                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12115                 esac
12116                 d_endnetent_r=undef
12117                 endnetent_r_proto=0
12118                 ;;
12119         esac
12120         ;;
12121 *)      endnetent_r_proto=0
12122         ;;
12123 esac
12124
12125 : see if endprotoent exists
12126 set endprotoent d_endpent
12127 eval $inlibc
12128
12129 : see if endprotoent_r exists
12130 set endprotoent_r d_endprotoent_r
12131 eval $inlibc
12132 case "$d_endprotoent_r" in
12133 "$define")
12134         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12135         case "$d_endprotoent_r_proto:$usethreads" in
12136         ":define")      d_endprotoent_r_proto=define
12137                 set d_endprotoent_r_proto endprotoent_r $hdrs
12138                 eval $hasproto ;;
12139         *)      ;;
12140         esac
12141         case "$d_endprotoent_r_proto" in
12142         define)
12143         case "$endprotoent_r_proto" in
12144         ''|0) try='int endprotoent_r(struct protoent_data*);'
12145         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12146         esac
12147         case "$endprotoent_r_proto" in
12148         ''|0) try='void endprotoent_r(struct protoent_data*);'
12149         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12150         esac
12151         case "$endprotoent_r_proto" in
12152         ''|0)   d_endprotoent_r=undef
12153                 endprotoent_r_proto=0
12154                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12155         * )     case "$endprotoent_r_proto" in
12156                 REENTRANT_PROTO*) ;;
12157                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12158                 esac
12159                 echo "Prototype: $try" ;;
12160         esac
12161         ;;
12162         *)      case "$usethreads" in
12163                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12164                 esac
12165                 d_endprotoent_r=undef
12166                 endprotoent_r_proto=0
12167                 ;;
12168         esac
12169         ;;
12170 *)      endprotoent_r_proto=0
12171         ;;
12172 esac
12173
12174 : see if endpwent exists
12175 set endpwent d_endpwent
12176 eval $inlibc
12177
12178 : see if this is a pwd.h system
12179 set pwd.h i_pwd
12180 eval $inhdr
12181
12182 case "$i_pwd" in
12183 $define)
12184         xxx=`./findhdr pwd.h`
12185         $cppstdin $cppflags $cppminus < $xxx >$$.h
12186
12187         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12188                 val="$define"
12189         else
12190                 val="$undef"
12191         fi
12192         set d_pwquota
12193         eval $setvar
12194
12195         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12196                 val="$define"
12197         else
12198                 val="$undef"
12199         fi
12200         set d_pwage
12201         eval $setvar
12202
12203         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12204                 val="$define"
12205         else
12206                 val="$undef"
12207         fi
12208         set d_pwchange
12209         eval $setvar
12210
12211         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12212                 val="$define"
12213         else
12214                 val="$undef"
12215         fi
12216         set d_pwclass
12217         eval $setvar
12218
12219         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12220                 val="$define"
12221         else
12222                 val="$undef"
12223         fi
12224         set d_pwexpire
12225         eval $setvar
12226
12227         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12228                 val="$define"
12229         else
12230                 val="$undef"
12231         fi
12232         set d_pwcomment
12233         eval $setvar
12234
12235         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12236                 val="$define"
12237         else
12238                 val="$undef"
12239         fi
12240         set d_pwgecos
12241         eval $setvar
12242
12243         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12244                 val="$define"
12245         else
12246                 val="$undef"
12247         fi
12248         set d_pwpasswd
12249         eval $setvar
12250
12251         $rm -f $$.h
12252         ;;
12253 *)
12254         val="$undef"; 
12255         set d_pwquota; eval $setvar
12256         set d_pwage; eval $setvar
12257         set d_pwchange; eval $setvar
12258         set d_pwclass; eval $setvar
12259         set d_pwexpire; eval $setvar
12260         set d_pwcomment; eval $setvar
12261         set d_pwgecos; eval $setvar
12262         set d_pwpasswd; eval $setvar
12263         ;;
12264 esac
12265
12266 : see if endpwent_r exists
12267 set endpwent_r d_endpwent_r
12268 eval $inlibc
12269 case "$d_endpwent_r" in
12270 "$define")
12271         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12272         case "$d_endpwent_r_proto:$usethreads" in
12273         ":define")      d_endpwent_r_proto=define
12274                 set d_endpwent_r_proto endpwent_r $hdrs
12275                 eval $hasproto ;;
12276         *)      ;;
12277         esac
12278         case "$d_endpwent_r_proto" in
12279         define)
12280         case "$endpwent_r_proto" in
12281         ''|0) try='int endpwent_r(FILE**);'
12282         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12283         esac
12284         case "$endpwent_r_proto" in
12285         ''|0) try='void endpwent_r(FILE**);'
12286         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12287         esac
12288         case "$endpwent_r_proto" in
12289         ''|0)   d_endpwent_r=undef
12290                 endpwent_r_proto=0
12291                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12292         * )     case "$endpwent_r_proto" in
12293                 REENTRANT_PROTO*) ;;
12294                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12295                 esac
12296                 echo "Prototype: $try" ;;
12297         esac
12298         ;;
12299         *)      case "$usethreads" in
12300                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12301                 esac
12302                 d_endpwent_r=undef
12303                 endpwent_r_proto=0
12304                 ;;
12305         esac
12306         ;;
12307 *)      endpwent_r_proto=0
12308         ;;
12309 esac
12310
12311 : see if endservent exists
12312 set endservent d_endsent
12313 eval $inlibc
12314
12315 : see if endservent_r exists
12316 set endservent_r d_endservent_r
12317 eval $inlibc
12318 case "$d_endservent_r" in
12319 "$define")
12320         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12321         case "$d_endservent_r_proto:$usethreads" in
12322         ":define")      d_endservent_r_proto=define
12323                 set d_endservent_r_proto endservent_r $hdrs
12324                 eval $hasproto ;;
12325         *)      ;;
12326         esac
12327         case "$d_endservent_r_proto" in
12328         define)
12329         case "$endservent_r_proto" in
12330         ''|0) try='int endservent_r(struct servent_data*);'
12331         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12332         esac
12333         case "$endservent_r_proto" in
12334         ''|0) try='void endservent_r(struct servent_data*);'
12335         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12336         esac
12337         case "$endservent_r_proto" in
12338         ''|0)   d_endservent_r=undef
12339                 endservent_r_proto=0
12340                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12341         * )     case "$endservent_r_proto" in
12342                 REENTRANT_PROTO*) ;;
12343                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12344                 esac
12345                 echo "Prototype: $try" ;;
12346         esac
12347         ;;
12348         *)      case "$usethreads" in
12349                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12350                 esac
12351                 d_endservent_r=undef
12352                 endservent_r_proto=0
12353                 ;;
12354         esac
12355         ;;
12356 *)      endservent_r_proto=0
12357         ;;
12358 esac
12359
12360 : Locate the flags for 'open()'
12361 echo " "
12362 $cat >try.c <<EOCP
12363 #include <sys/types.h>
12364 #ifdef I_FCNTL
12365 #include <fcntl.h>
12366 #endif
12367 #ifdef I_SYS_FILE
12368 #include <sys/file.h>
12369 #endif
12370 #$i_stdlib I_STDLIB
12371 #ifdef I_STDLIB
12372 #include <stdlib.h>
12373 #endif
12374 int main() {
12375         if(O_RDONLY);
12376 #ifdef O_TRUNC
12377         exit(0);
12378 #else
12379         exit(1);
12380 #endif
12381 }
12382 EOCP
12383 : check sys/file.h first to get FREAD on Sun
12384 if $test `./findhdr sys/file.h` && \
12385                 set try -DI_SYS_FILE && eval $compile; then
12386         h_sysfile=true;
12387         echo "<sys/file.h> defines the O_* constants..." >&4
12388         if $run ./try; then
12389                 echo "and you have the 3 argument form of open()." >&4
12390                 val="$define"
12391         else
12392                 echo "but not the 3 argument form of open().  Oh, well." >&4
12393                 val="$undef"
12394         fi
12395 elif $test `./findhdr fcntl.h` && \
12396                 set try -DI_FCNTL && eval $compile; then
12397         h_fcntl=true;
12398         echo "<fcntl.h> defines the O_* constants..." >&4
12399         if $run ./try; then
12400                 echo "and you have the 3 argument form of open()." >&4
12401                 val="$define"
12402         else
12403                 echo "but not the 3 argument form of open().  Oh, well." >&4
12404                 val="$undef"
12405         fi
12406 else
12407         val="$undef"
12408         echo "I can't find the O_* constant definitions!  You got problems." >&4
12409 fi
12410 set d_open3
12411 eval $setvar
12412 $rm_try
12413
12414 : see if this is a sys/file.h system
12415 val=''
12416 set sys/file.h val
12417 eval $inhdr
12418
12419 : do we need to include sys/file.h ?
12420 case "$val" in
12421 "$define")
12422         echo " "
12423         if $h_sysfile; then
12424                 val="$define"
12425                 echo "We'll be including <sys/file.h>." >&4
12426         else
12427                 val="$undef"
12428                 echo "We won't be including <sys/file.h>." >&4
12429         fi
12430         ;;
12431 *)
12432         h_sysfile=false
12433         ;;
12434 esac
12435 set i_sysfile
12436 eval $setvar
12437
12438 : see if fcntl.h is there
12439 val=''
12440 set fcntl.h val
12441 eval $inhdr
12442
12443 : see if we can include fcntl.h
12444 case "$val" in
12445 "$define")
12446         echo " "
12447         if $h_fcntl; then
12448                 val="$define"
12449                 echo "We'll be including <fcntl.h>." >&4
12450         else
12451                 val="$undef"
12452                 if $h_sysfile; then
12453         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12454                 else
12455                         echo "We won't be including <fcntl.h>." >&4
12456                 fi
12457         fi
12458         ;;
12459 *)
12460         h_fcntl=false
12461         val="$undef"
12462         ;;
12463 esac
12464 set i_fcntl
12465 eval $setvar
12466
12467 : see if fork exists
12468 set fork d_fork
12469 eval $inlibc
12470
12471 : see if pipe exists
12472 set pipe d_pipe
12473 eval $inlibc
12474
12475 : check for non-blocking I/O stuff
12476 case "$h_sysfile" in
12477 true) echo "#include <sys/file.h>" > head.c;;
12478 *)
12479        case "$h_fcntl" in
12480        true) echo "#include <fcntl.h>" > head.c;;
12481        *) echo "#include <sys/fcntl.h>" > head.c;;
12482        esac
12483        ;;
12484 esac
12485 echo " "
12486 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12487 case "$o_nonblock" in
12488 '')
12489         $cat head.c > try.c
12490         $cat >>try.c <<EOCP
12491 #include <stdio.h>
12492 #$i_stdlib I_STDLIB
12493 #ifdef I_STDLIB
12494 #include <stdlib.h>
12495 #endif
12496 #$i_fcntl I_FCNTL
12497 #ifdef I_FCNTL
12498 #include <fcntl.h>
12499 #endif
12500 int main() {
12501 #ifdef O_NONBLOCK
12502         printf("O_NONBLOCK\n");
12503         exit(0);
12504 #endif
12505 #ifdef O_NDELAY
12506         printf("O_NDELAY\n");
12507         exit(0);
12508 #endif
12509 #ifdef FNDELAY
12510         printf("FNDELAY\n");
12511         exit(0);
12512 #endif
12513         exit(0);
12514 }
12515 EOCP
12516         set try
12517         if eval $compile_ok; then
12518                 o_nonblock=`$run ./try`
12519                 case "$o_nonblock" in
12520                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12521                 *) echo "Seems like we can use $o_nonblock.";;
12522                 esac
12523         else
12524                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12525         fi
12526         ;;
12527 *) echo "Using $hint value $o_nonblock.";;
12528 esac
12529 $rm_try
12530
12531 echo " "
12532 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12533 case "$eagain" in
12534 '')
12535         case "$d_fork:$d_pipe" in
12536         define:define)
12537         $cat head.c > try.c
12538         $cat >>try.c <<EOCP
12539 #include <errno.h>
12540 #include <sys/types.h>
12541 #include <signal.h>
12542 #include <stdio.h>
12543 #$i_stdlib I_STDLIB
12544 #ifdef I_STDLIB
12545 #include <stdlib.h>
12546 #endif
12547 #$i_fcntl I_FCNTL
12548 #ifdef I_FCNTL
12549 #include <fcntl.h>
12550 #endif
12551 #define MY_O_NONBLOCK $o_nonblock
12552 #ifndef errno  /* XXX need better Configure test */
12553 extern int errno;
12554 #endif
12555 #$i_unistd I_UNISTD
12556 #ifdef I_UNISTD
12557 #include <unistd.h>
12558 #endif
12559 #$i_string I_STRING
12560 #ifdef I_STRING
12561 #include <string.h>
12562 #else
12563 #include <strings.h>
12564 #endif
12565 $signal_t blech(int x) { exit(3); }
12566 EOCP
12567         $cat >> try.c <<'EOCP'
12568 int main()
12569 {
12570         int pd[2];
12571         int pu[2];
12572         char buf[1];
12573         char string[100];
12574
12575         pipe(pd);       /* Down: child -> parent */
12576         pipe(pu);       /* Up: parent -> child */
12577         if (0 != fork()) {
12578                 int ret;
12579                 close(pd[1]);   /* Parent reads from pd[0] */
12580                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12581 #ifdef F_SETFL
12582                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12583                         exit(1);
12584 #else
12585                 exit(4);
12586 #endif
12587                 signal(SIGALRM, blech);
12588                 alarm(5);
12589                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12590                         exit(2);
12591                 sprintf(string, "%d\n", ret);
12592                 write(2, string, strlen(string));
12593                 alarm(0);
12594 #ifdef EAGAIN
12595                 if (errno == EAGAIN) {
12596                         printf("EAGAIN\n");
12597                         goto ok;
12598                 }
12599 #endif
12600 #ifdef EWOULDBLOCK
12601                 if (errno == EWOULDBLOCK)
12602                         printf("EWOULDBLOCK\n");
12603 #endif
12604         ok:
12605                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12606                 sleep(2);                               /* Give it time to close our pipe */
12607                 alarm(5);
12608                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12609                 alarm(0);
12610                 sprintf(string, "%d\n", ret);
12611                 write(4, string, strlen(string));
12612                 exit(0);
12613         }
12614
12615         close(pd[0]);                   /* We write to pd[1] */
12616         close(pu[1]);                   /* We read from pu[0] */
12617         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12618         close(pd[1]);                   /* Pipe pd is now fully closed! */
12619         exit(0);                                /* Bye bye, thank you for playing! */
12620 }
12621 EOCP
12622         set try
12623         if eval $compile_ok; then
12624                 echo "$startsh" >mtry
12625                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12626                 chmod +x mtry
12627                 ./mtry >/dev/null 2>&1
12628                 case $? in
12629                 0) eagain=`$cat try.out`;;
12630                 1) echo "Could not perform non-blocking setting!";;
12631                 2) echo "I did a successful read() for something that was not there!";;
12632                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12633                 4) echo "Could not find F_SETFL!";;
12634                 *) echo "Something terribly wrong happened during testing.";;
12635                 esac
12636                 rd_nodata=`$cat try.ret`
12637                 echo "A read() system call with no data present returns $rd_nodata."
12638                 case "$rd_nodata" in
12639                 0|-1) ;;
12640                 *)
12641                         echo "(That's peculiar, fixing that to be -1.)"
12642                         rd_nodata=-1
12643                         ;;
12644                 esac
12645                 case "$eagain" in
12646                 '')
12647                         echo "Forcing errno EAGAIN on read() with no data available."
12648                         eagain=EAGAIN
12649                         ;;
12650                 *)
12651                         echo "Your read() sets errno to $eagain when no data is available."
12652                         ;;
12653                 esac
12654                 status=`$cat try.err`
12655                 case "$status" in
12656                 0) echo "And it correctly returns 0 to signal EOF.";;
12657                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12658                 *) echo "However, your read() returns '$status' on EOF??";;
12659                 esac
12660                 val="$define"
12661                 if test "$status" = "$rd_nodata"; then
12662                         echo "WARNING: you can't distinguish between EOF and no data!"
12663                         val="$undef"
12664                 fi
12665         else
12666                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12667                 eagain=EAGAIN
12668         fi
12669         ;;
12670         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12671                 eagain=EAGAIN
12672                 val="$define"
12673                 ;;
12674         esac
12675         set d_eofnblk
12676         eval $setvar
12677         ;;
12678 *)
12679         echo "Using $hint value $eagain."
12680         echo "Your read() returns $rd_nodata when no data is present."
12681         case "$d_eofnblk" in
12682         "$define") echo "And you can see EOF because read() returns 0.";;
12683         "$undef") echo "But you can't see EOF status from read() returned value.";;
12684         *)
12685                 echo "(Assuming you can't see EOF status from read anyway.)"
12686                 d_eofnblk=$undef
12687                 ;;
12688         esac
12689         ;;
12690 esac
12691 $rm_try head.c mtry
12692
12693 : see if _ptr and _cnt from stdio act std
12694 echo " "
12695
12696 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12697         echo "(Looks like you have stdio.h from BSD.)"
12698         case "$stdio_ptr" in
12699         '') stdio_ptr='((fp)->_p)'
12700                 ptr_lval=$define
12701                 ;;
12702         *)      ptr_lval=$d_stdio_ptr_lval;;
12703         esac
12704         case "$stdio_cnt" in
12705         '') stdio_cnt='((fp)->_r)'
12706                 cnt_lval=$define
12707                 ;;
12708         *)      cnt_lval=$d_stdio_cnt_lval;;
12709         esac
12710         case "$stdio_base" in
12711         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12712         esac
12713         case "$stdio_bufsiz" in
12714         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12715         esac
12716 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12717         echo "(Looks like you have stdio.h from Linux.)"
12718         case "$stdio_ptr" in
12719         '') stdio_ptr='((fp)->_IO_read_ptr)'
12720                 ptr_lval=$define
12721                 ;;
12722         *)      ptr_lval=$d_stdio_ptr_lval;;
12723         esac
12724         case "$stdio_cnt" in
12725         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12726                 cnt_lval=$undef
12727                 ;;
12728         *)      cnt_lval=$d_stdio_cnt_lval;;
12729         esac
12730         case "$stdio_base" in
12731         '') stdio_base='((fp)->_IO_read_base)';;
12732         esac
12733         case "$stdio_bufsiz" in
12734         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12735         esac
12736 else
12737         case "$stdio_ptr" in
12738         '') stdio_ptr='((fp)->_ptr)'
12739                 ptr_lval=$define
12740                 ;;
12741         *)      ptr_lval=$d_stdio_ptr_lval;;
12742         esac
12743         case "$stdio_cnt" in
12744         '') stdio_cnt='((fp)->_cnt)'
12745                 cnt_lval=$define
12746                 ;;
12747         *)      cnt_lval=$d_stdio_cnt_lval;;
12748         esac
12749         case "$stdio_base" in
12750         '') stdio_base='((fp)->_base)';;
12751         esac
12752         case "$stdio_bufsiz" in
12753         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12754         esac
12755 fi
12756
12757 : test whether _ptr and _cnt really work
12758 echo "Checking how std your stdio is..." >&4
12759 $cat >try.c <<EOP
12760 #include <stdio.h>
12761 #$i_stdlib I_STDLIB
12762 #ifdef I_STDLIB
12763 #include <stdlib.h>
12764 #endif
12765 #define FILE_ptr(fp)    $stdio_ptr
12766 #define FILE_cnt(fp)    $stdio_cnt
12767 int main() {
12768         FILE *fp = fopen("try.c", "r");
12769         char c = getc(fp);
12770         if (
12771                 18 <= FILE_cnt(fp) &&
12772                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12773         )
12774                 exit(0);
12775         exit(1);
12776 }
12777 EOP
12778 val="$undef"
12779 set try
12780 if eval $compile && $to try.c; then
12781         if $run ./try; then
12782                 echo "Your stdio acts pretty std."
12783                 val="$define"
12784         else
12785                 echo "Your stdio isn't very std."
12786         fi
12787 else
12788         echo "Your stdio doesn't appear very std."
12789 fi
12790 $rm_try
12791
12792 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12793 # direct buffer manipulation no longer works.  The Configure tests
12794 # should be changed to correctly detect this, but until then,
12795 # the following check should at least let perl compile and run.
12796 # (This quick fix should be updated before 5.8.1.)
12797 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12798 # A. Dougherty, June 3, 2002.
12799 case "$d_gnulibc" in
12800 $define)
12801         case "$gnulibc_version" in
12802         2.[01]*)  ;;
12803         2.2) ;;
12804         2.2.[0-9]) ;;
12805         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12806                 val="$undef"
12807                 ;;
12808         esac
12809         ;;
12810 esac
12811 set d_stdstdio
12812 eval $setvar
12813
12814 : Can _ptr be used as an lvalue?
12815 case "$d_stdstdio$ptr_lval" in
12816 $define$define) val=$define ;;
12817 *) val=$undef ;;
12818 esac
12819 set d_stdio_ptr_lval
12820 eval $setvar
12821
12822 : Can _cnt be used as an lvalue?
12823 case "$d_stdstdio$cnt_lval" in
12824 $define$define) val=$define ;;
12825 *) val=$undef ;;
12826 esac
12827 set d_stdio_cnt_lval
12828 eval $setvar
12829
12830
12831 : test whether setting _ptr sets _cnt as a side effect
12832 d_stdio_ptr_lval_sets_cnt="$undef"
12833 d_stdio_ptr_lval_nochange_cnt="$undef"
12834 case "$d_stdio_ptr_lval$d_stdstdio" in
12835 $define$define)
12836         echo "Checking to see what happens if we set the stdio ptr..." >&4
12837 $cat >try.c <<EOP
12838 #include <stdio.h>
12839 /* Can we scream? */
12840 /* Eat dust sed :-) */
12841 /* In the buffer space, no one can hear you scream. */
12842 #$i_stdlib I_STDLIB
12843 #ifdef I_STDLIB
12844 #include <stdlib.h>
12845 #endif
12846 #define FILE_ptr(fp)    $stdio_ptr
12847 #define FILE_cnt(fp)    $stdio_cnt
12848 #include <sys/types.h>
12849 int main() {
12850         FILE *fp = fopen("try.c", "r");
12851         int c;
12852         char *ptr;
12853         size_t cnt;
12854         if (!fp) {
12855             puts("Fail even to read");
12856             exit(1);
12857         }
12858         c = getc(fp); /* Read away the first # */
12859         if (c == EOF) {
12860             puts("Fail even to read");
12861             exit(1);
12862         }
12863         if (!(
12864                 18 <= FILE_cnt(fp) &&
12865                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12866         )) {
12867                 puts("Fail even to read");
12868                 exit (1);
12869         }
12870         ptr = (char*) FILE_ptr(fp);
12871         cnt = (size_t)FILE_cnt(fp);
12872
12873         FILE_ptr(fp) += 42;
12874
12875         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12876                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12877                 exit (1);
12878         }
12879         if (FILE_cnt(fp) <= 20) {
12880                 printf ("Fail (<20 chars to test)");
12881                 exit (1);
12882         }
12883         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12884                 puts("Fail compare");
12885                 exit (1);
12886         }
12887         if (cnt == FILE_cnt(fp)) {
12888                 puts("Pass_unchanged");
12889                 exit (0);
12890         }
12891         if (FILE_cnt(fp) == (cnt - 42)) {
12892                 puts("Pass_changed");
12893                 exit (0);
12894         }
12895         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12896         return 1;
12897
12898 }
12899 EOP
12900         set try
12901         if eval $compile && $to try.c; then
12902                 case `$run ./try` in
12903                 Pass_changed)
12904                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12905                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12906                 Pass_unchanged)
12907                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12908                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12909                 Fail*)
12910                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12911                 *)
12912                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12913         esac
12914         else
12915                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12916         fi
12917         $rm_try
12918         ;;
12919 esac
12920
12921 : see if _base is also standard
12922 val="$undef"
12923 case "$d_stdstdio" in
12924 $define)
12925         $cat >try.c <<EOP
12926 #include <stdio.h>
12927 #$i_stdlib I_STDLIB
12928 #ifdef I_STDLIB
12929 #include <stdlib.h>
12930 #endif
12931 #define FILE_base(fp)   $stdio_base
12932 #define FILE_bufsiz(fp) $stdio_bufsiz
12933 int main() {
12934         FILE *fp = fopen("try.c", "r");
12935         char c = getc(fp);
12936         if (
12937                 19 <= FILE_bufsiz(fp) &&
12938                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12939         )
12940                 exit(0);
12941         exit(1);
12942 }
12943 EOP
12944         set try
12945         if eval $compile && $to try.c; then
12946                 if $run ./try; then
12947                         echo "And its _base field acts std."
12948                         val="$define"
12949                 else
12950                         echo "But its _base field isn't std."
12951                 fi
12952         else
12953                 echo "However, it seems to be lacking the _base field."
12954         fi
12955         $rm_try
12956         ;;
12957 esac
12958 set d_stdiobase
12959 eval $setvar
12960
12961 : see if fast_stdio exists
12962 val="$undef"
12963 case "$d_stdstdio:$d_stdio_ptr_lval" in
12964 "$define:$define")
12965         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12966         *$define*)
12967                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12968                 val="$define"
12969                 ;;
12970         esac
12971         ;;
12972 esac
12973 set d_faststdio
12974 eval $setvar
12975
12976
12977
12978 : see if fchdir exists
12979 set fchdir d_fchdir
12980 eval $inlibc
12981
12982 : see if fchmod exists
12983 set fchmod d_fchmod
12984 eval $inlibc
12985
12986 : see if fchown exists
12987 set fchown d_fchown
12988 eval $inlibc
12989
12990 : see if this is an fcntl system
12991 set fcntl d_fcntl
12992 eval $inlibc
12993
12994 : See if fcntl-based locking works.
12995 echo " "
12996 $cat >try.c <<EOCP
12997 #$i_stdlib I_STDLIB
12998 #ifdef I_STDLIB
12999 #include <stdlib.h>
13000 #endif
13001 #include <unistd.h>
13002 #include <fcntl.h>
13003 #include <signal.h>
13004 $signal_t blech(int x) { exit(3); }
13005 int main() {
13006 #if defined(F_SETLK) && defined(F_SETLKW)
13007      struct flock flock;
13008      int retval, fd;
13009      fd = open("try.c", O_RDONLY);
13010      flock.l_type = F_RDLCK;
13011      flock.l_whence = SEEK_SET;
13012      flock.l_start = flock.l_len = 0;
13013      signal(SIGALRM, blech);
13014      alarm(10);
13015      retval = fcntl(fd, F_SETLK, &flock);
13016      close(fd);
13017      (retval < 0 ? exit(2) : exit(0));
13018 #else
13019      exit(2);
13020 #endif
13021 }
13022 EOCP
13023 echo "Checking if fcntl-based file locking works... "
13024 case "$d_fcntl" in
13025 "$define")
13026         set try
13027         if eval $compile_ok; then
13028                 if $run ./try; then
13029                         echo "Yes, it seems to work."
13030                         val="$define"
13031                 else
13032                         echo "Nope, it didn't work."
13033                         val="$undef"
13034                         case "$?" in
13035                         3) $cat >&4 <<EOM
13036 ***
13037 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13038 *** This is (almost) impossible.
13039 *** If your NFS lock daemons are not feeling well, something like
13040 *** this may happen, please investigate.  Cannot continue, aborting.
13041 ***
13042 EOM
13043                                 exit 1
13044                                 ;;
13045                         esac
13046                 fi
13047         else
13048                 echo "I'm unable to compile the test program, so I'll assume not."
13049                 val="$undef"
13050         fi
13051         ;;
13052 *) val="$undef";
13053         echo "Nope, since you don't even have fcntl()."
13054         ;;
13055 esac
13056 set d_fcntl_can_lock
13057 eval $setvar
13058 $rm_try
13059
13060 : check for fd_set items
13061 $cat <<EOM
13062
13063 Checking to see how well your C compiler handles fd_set and friends ...
13064 EOM
13065 $cat >try.c <<EOCP
13066 #$i_stdlib I_STDLIB
13067 #ifdef I_STDLIB
13068 #include <stdlib.h>
13069 #endif
13070 #$i_systime I_SYS_TIME
13071 #$i_sysselct I_SYS_SELECT
13072 #$d_socket HAS_SOCKET
13073 #include <sys/types.h>
13074 #ifdef HAS_SOCKET
13075 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13076 #endif
13077 #ifdef I_SYS_TIME
13078 #include <sys/time.h>
13079 #endif
13080 #ifdef I_SYS_SELECT
13081 #include <sys/select.h>
13082 #endif
13083 int main() {
13084         fd_set fds;
13085
13086 #ifdef TRYBITS
13087         if(fds.fds_bits);
13088 #endif
13089
13090 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13091         exit(0);
13092 #else
13093         exit(1);
13094 #endif
13095 }
13096 EOCP
13097 set try -DTRYBITS
13098 if eval $compile; then
13099         d_fds_bits="$define"
13100         d_fd_set="$define"
13101         echo "Well, your system knows about the normal fd_set typedef..." >&4
13102         if $run ./try; then
13103                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13104                 d_fd_macros="$define"
13105         else
13106                 $cat >&4 <<'EOM'
13107 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13108 EOM
13109                 d_fd_macros="$undef"
13110         fi
13111 else
13112         $cat <<'EOM'
13113 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13114 EOM
13115         set try
13116         if eval $compile; then
13117                 d_fds_bits="$undef"
13118                 d_fd_set="$define"
13119                 echo "Well, your system has some sort of fd_set available..." >&4
13120                 if $run ./try; then
13121                         echo "and you have the normal fd_set macros." >&4
13122                         d_fd_macros="$define"
13123                 else
13124                         $cat <<'EOM'
13125 but not the normal fd_set macros!  Gross!  More work for me...
13126 EOM
13127                         d_fd_macros="$undef"
13128                 fi
13129         else
13130         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13131                 d_fd_set="$undef"
13132                 d_fds_bits="$undef"
13133                 d_fd_macros="$undef"
13134         fi
13135 fi
13136 $rm_try
13137
13138 : see if fgetpos exists
13139 set fgetpos d_fgetpos
13140 eval $inlibc
13141
13142 : see if finite exists
13143 set finite d_finite
13144 eval $inlibc
13145
13146 : see if finitel exists
13147 set finitel d_finitel
13148 eval $inlibc
13149
13150 : see if flock exists
13151 set flock d_flock
13152 eval $inlibc
13153
13154 : see if prototype for flock is available
13155 echo " "
13156 set d_flockproto flock $i_sysfile sys/file.h
13157 eval $hasproto
13158
13159 : see if fp_class exists
13160 set fp_class d_fp_class
13161 eval $inlibc
13162
13163 : see if pathconf exists
13164 set pathconf d_pathconf
13165 eval $inlibc
13166
13167 : see if fpathconf exists
13168 set fpathconf d_fpathconf
13169 eval $inlibc
13170
13171 : see if fpclass exists
13172 set fpclass d_fpclass
13173 eval $inlibc
13174
13175 : see if fpclassify exists
13176 set fpclassify d_fpclassify
13177 eval $inlibc
13178
13179 : see if fpclassl exists
13180 set fpclassl d_fpclassl
13181 eval $inlibc
13182
13183 : check for fpos64_t
13184 echo " "
13185 echo "Checking to see if you have fpos64_t..." >&4
13186 $cat >try.c <<EOCP
13187 #include <stdio.h>
13188 int main() { fpos64_t x = 7; }
13189 EOCP
13190 set try
13191 if eval $compile; then
13192         val="$define"
13193         echo "You have fpos64_t."
13194 else
13195         val="$undef"
13196         echo "You do not have fpos64_t."
13197         case "$fpossize" in
13198         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13199         esac
13200 fi
13201 $rm_try
13202 set d_fpos64_t
13203 eval $setvar
13204
13205 : see if frexpl exists
13206 set frexpl d_frexpl
13207 eval $inlibc
13208
13209 : see if this is a sys/param system
13210 set sys/param.h i_sysparam
13211 eval $inhdr
13212
13213 : see if this is a sys/mount.h system
13214 set sys/mount.h i_sysmount
13215 eval $inhdr
13216
13217 : Check for fs_data_s
13218 echo " "
13219 echo "Checking to see if your system supports struct fs_data..." >&4
13220 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13221 eval $hasstruct
13222 case "$d_fs_data_s" in
13223 "$define")      echo "Yes, it does."   ;;
13224 *)              echo "No, it doesn't." ;;
13225 esac
13226
13227 : see if fseeko exists
13228 set fseeko d_fseeko
13229 eval $inlibc
13230 case "$longsize" in
13231 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13232 esac
13233
13234 : see if fsetpos exists
13235 set fsetpos d_fsetpos
13236 eval $inlibc
13237
13238 : see if fstatfs exists
13239 set fstatfs d_fstatfs
13240 eval $inlibc
13241
13242 : see if statvfs exists
13243 set statvfs d_statvfs
13244 eval $inlibc
13245
13246 : see if fstatvfs exists
13247 set fstatvfs d_fstatvfs
13248 eval $inlibc
13249
13250
13251 : see if fsync exists
13252 set fsync d_fsync
13253 eval $inlibc
13254
13255 : see if ftello exists
13256 set ftello d_ftello
13257 eval $inlibc
13258 case "$longsize" in
13259 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13260 esac
13261
13262 : check for a working futimes
13263 d_futimes="$undef"
13264 echo " "
13265 echo "Checking if you have a working futimes()" >&4
13266 $cat >try.c <<EOCP
13267 #include <stdio.h>
13268 #include <sys/time.h>
13269 #include <errno.h>
13270 #include <fcntl.h>
13271
13272 int main ()
13273 {
13274     int fd, rv;
13275     fd = open ("try.c", O_RDWR);
13276     if (-1 == fd) exit (1);
13277     rv = futimes (fd, NULL);
13278     exit (rv == -1 ? errno : 0);
13279 }
13280 EOCP
13281 set try
13282 if eval $compile; then
13283     `$run ./try`
13284     rc=$?
13285     case "$rc" in
13286         0)  echo "Yes, you have" >&4
13287             d_futimes="$define"
13288             ;;
13289         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13290             ;;
13291     esac
13292 else
13293     echo "No, it does not (probably harmless)" >&4
13294 fi
13295 $rm_try
13296
13297 : see if ndbm.h is available
13298 set ndbm.h i_ndbm
13299 eval $inhdr
13300 : Compatibility location for RedHat 7.1
13301 set gdbm/ndbm.h i_gdbmndbm
13302 eval $inhdr
13303 : Compatibility location for Debian 4.0
13304 set gdbm-ndbm.h i_gdbm_ndbm
13305 eval $inhdr
13306
13307 val="$undef"
13308 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13309         : see if dbm_open exists
13310         set dbm_open d_dbm_open
13311         eval $inlibc
13312         case "$d_dbm_open" in
13313         $undef)
13314                 i_ndbm="$undef"
13315                 i_gdbmndbm="$undef"
13316                 i_gdbm_ndbm="$undef"
13317                 echo "We won't be including <ndbm.h>"
13318                 val="$undef"
13319                 ;;
13320         *) val="$define"
13321            ;;
13322         esac
13323 fi
13324 set d_ndbm
13325 eval $setvar
13326
13327 ndbm_hdr_protochk='name=$1; hdr=$2;
13328 eval "ihdr=\$""i_$name";
13329 val="$undef";
13330 if $test "$ihdr" = "$define"; then
13331         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13332         case "$d_cplusplus" in
13333         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13334         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13335         esac;
13336         case "$val" in
13337         $define) $echo "Your <$hdr> seems to have prototypes";;
13338         *) $echo "Your <$hdr> does not seem to have prototypes";;
13339         esac;
13340 fi;
13341 set "d_${name}_h_uses_prototypes";
13342 eval $setvar'
13343
13344 set ndbm ndbm.h
13345 eval $ndbm_hdr_protochk
13346 set gdbmndbm gdbm/ndbm.h
13347 eval $ndbm_hdr_protochk
13348 set gdbm_ndbm gdbm-ndbm.h
13349 eval $ndbm_hdr_protochk
13350
13351 : see if getcwd exists
13352 set getcwd d_getcwd
13353 eval $inlibc
13354
13355 : see if getespwnam exists
13356 set getespwnam d_getespwnam
13357 eval $inlibc
13358
13359 : see if getfsstat exists
13360 set getfsstat d_getfsstat
13361 eval $inlibc
13362
13363 : see if getgrent exists
13364 set getgrent d_getgrent
13365 eval $inlibc
13366
13367 : see if getgrent_r exists
13368 set getgrent_r d_getgrent_r
13369 eval $inlibc
13370 case "$d_getgrent_r" in
13371 "$define")
13372         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13373         case "$d_getgrent_r_proto:$usethreads" in
13374         ":define")      d_getgrent_r_proto=define
13375                 set d_getgrent_r_proto getgrent_r $hdrs
13376                 eval $hasproto ;;
13377         *)      ;;
13378         esac
13379         case "$d_getgrent_r_proto" in
13380         define)
13381         case "$getgrent_r_proto" in
13382         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13383         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13384         esac
13385         case "$getgrent_r_proto" in
13386         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13387         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13388         esac
13389         case "$getgrent_r_proto" in
13390         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13391         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13392         esac
13393         case "$getgrent_r_proto" in
13394         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13395         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13396         esac
13397         case "$getgrent_r_proto" in
13398         ''|0) try='int getgrent_r(struct group*, char*, int);'
13399         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13400         esac
13401         case "$getgrent_r_proto" in
13402         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13403         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13404         esac
13405         case "$getgrent_r_proto" in
13406         ''|0)   d_getgrent_r=undef
13407                 getgrent_r_proto=0
13408                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13409         * )     case "$getgrent_r_proto" in
13410                 REENTRANT_PROTO*) ;;
13411                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13412                 esac
13413                 echo "Prototype: $try" ;;
13414         esac
13415         ;;
13416         *)      case "$usethreads" in
13417                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13418                 esac
13419                 d_getgrent_r=undef
13420                 getgrent_r_proto=0
13421                 ;;
13422         esac
13423         ;;
13424 *)      getgrent_r_proto=0
13425         ;;
13426 esac
13427
13428 : see if getgrgid_r exists
13429 set getgrgid_r d_getgrgid_r
13430 eval $inlibc
13431 case "$d_getgrgid_r" in
13432 "$define")
13433         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13434         case "$d_getgrgid_r_proto:$usethreads" in
13435         ":define")      d_getgrgid_r_proto=define
13436                 set d_getgrgid_r_proto getgrgid_r $hdrs
13437                 eval $hasproto ;;
13438         *)      ;;
13439         esac
13440         case "$d_getgrgid_r_proto" in
13441         define)
13442         case "$getgrgid_r_proto" in
13443         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13444         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13445         esac
13446         case "$getgrgid_r_proto" in
13447         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13448         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13449         esac
13450         case "$getgrgid_r_proto" in
13451         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13452         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13453         esac
13454         case "$getgrgid_r_proto" in
13455         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13456         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13457         esac
13458         case "$getgrgid_r_proto" in
13459         ''|0)   d_getgrgid_r=undef
13460                 getgrgid_r_proto=0
13461                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13462         * )     case "$getgrgid_r_proto" in
13463                 REENTRANT_PROTO*) ;;
13464                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13465                 esac
13466                 echo "Prototype: $try" ;;
13467         esac
13468         ;;
13469         *)      case "$usethreads" in
13470                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13471                 esac
13472                 d_getgrgid_r=undef
13473                 getgrgid_r_proto=0
13474                 ;;
13475         esac
13476         ;;
13477 *)      getgrgid_r_proto=0
13478         ;;
13479 esac
13480
13481 : see if getgrnam_r exists
13482 set getgrnam_r d_getgrnam_r
13483 eval $inlibc
13484 case "$d_getgrnam_r" in
13485 "$define")
13486         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13487         case "$d_getgrnam_r_proto:$usethreads" in
13488         ":define")      d_getgrnam_r_proto=define
13489                 set d_getgrnam_r_proto getgrnam_r $hdrs
13490                 eval $hasproto ;;
13491         *)      ;;
13492         esac
13493         case "$d_getgrnam_r_proto" in
13494         define)
13495         case "$getgrnam_r_proto" in
13496         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13497         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13498         esac
13499         case "$getgrnam_r_proto" in
13500         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13501         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13502         esac
13503         case "$getgrnam_r_proto" in
13504         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13505         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13506         esac
13507         case "$getgrnam_r_proto" in
13508         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13509         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13510         esac
13511         case "$getgrnam_r_proto" in
13512         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13513         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13514         esac
13515         case "$getgrnam_r_proto" in
13516         ''|0)   d_getgrnam_r=undef
13517                 getgrnam_r_proto=0
13518                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13519         * )     case "$getgrnam_r_proto" in
13520                 REENTRANT_PROTO*) ;;
13521                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13522                 esac
13523                 echo "Prototype: $try" ;;
13524         esac
13525         ;;
13526         *)      case "$usethreads" in
13527                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13528                 esac
13529                 d_getgrnam_r=undef
13530                 getgrnam_r_proto=0
13531                 ;;
13532         esac
13533         ;;
13534 *)      getgrnam_r_proto=0
13535         ;;
13536 esac
13537
13538 : see if gethostbyaddr exists
13539 set gethostbyaddr d_gethbyaddr
13540 eval $inlibc
13541
13542 : see if gethostbyname exists
13543 set gethostbyname d_gethbyname
13544 eval $inlibc
13545
13546 : see if gethostent exists
13547 set gethostent d_gethent
13548 eval $inlibc
13549
13550 : see how we will look up host name
13551 echo " "
13552 call=''
13553 if set gethostname val -f d_gethname; eval $csym; $val; then
13554         echo 'gethostname() found.' >&4
13555         d_gethname="$define"
13556         call=gethostname
13557 fi
13558 if set uname val -f d_uname; eval $csym; $val; then
13559         if ./xenix; then
13560                 $cat <<'EOM'
13561 uname() was found, but you're running xenix, and older versions of xenix
13562 have a broken uname(). If you don't really know whether your xenix is old
13563 enough to have a broken system call, use the default answer.
13564
13565 EOM
13566                 dflt=y
13567                 case "$d_uname" in
13568                 "$define") dflt=n;;
13569                 esac
13570                 rp='Is your uname() broken?'
13571                 . ./myread
13572                 case "$ans" in
13573                 n*) d_uname="$define"; call=uname;;
13574                 esac
13575         else
13576                 echo 'uname() found.' >&4
13577                 d_uname="$define"
13578                 case "$call" in
13579                 '') call=uname ;;
13580                 esac
13581         fi
13582 fi
13583 case "$d_gethname" in
13584 '') d_gethname="$undef";;
13585 esac
13586 case "$d_uname" in
13587 '') d_uname="$undef";;
13588 esac
13589 case "$d_uname$d_gethname" in
13590 *define*)
13591         dflt=n
13592         cat <<EOM
13593
13594 Every now and then someone has a $call() that lies about the hostname
13595 but can't be fixed for political or economic reasons.  If you wish, I can
13596 pretend $call() isn't there and maybe compute hostname at run-time
13597 thanks to the '$phostname' command.
13598
13599 EOM
13600         rp="Shall I ignore $call() from now on?"
13601         . ./myread
13602         case "$ans" in
13603         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13604         esac;;
13605 esac
13606 case "$phostname" in
13607 '') aphostname='';;
13608 *) case "$aphostname" in
13609         /*) ;;
13610         *) set X $phostname
13611                 shift
13612                 file=$1
13613                 shift
13614                 file=`./loc $file $file $pth`
13615                 aphostname=`echo $file $*`
13616                 ;;
13617         esac
13618         ;;
13619 esac
13620 case "$d_uname$d_gethname" in
13621 *define*) ;;
13622 *)
13623         case "$phostname" in
13624         '')
13625                 echo "There will be no way for $package to get your hostname." >&4;;
13626         *)
13627         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13628                 ;;
13629         esac;;
13630 esac
13631 case "$d_phostname" in
13632 '') d_phostname="$undef";;
13633 esac
13634
13635 : see if gethostbyaddr_r exists
13636 set gethostbyaddr_r d_gethostbyaddr_r
13637 eval $inlibc
13638 case "$d_gethostbyaddr_r" in
13639 "$define")
13640         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13641         case "$d_gethostbyaddr_r_proto:$usethreads" in
13642         ":define")      d_gethostbyaddr_r_proto=define
13643                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13644                 eval $hasproto ;;
13645         *)      ;;
13646         esac
13647         case "$d_gethostbyaddr_r_proto" in
13648         define)
13649         case "$gethostbyaddr_r_proto" in
13650         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13651         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13652         esac
13653         case "$gethostbyaddr_r_proto" in
13654         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13655         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13656         esac
13657         case "$gethostbyaddr_r_proto" in
13658         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13659         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13660         esac
13661         case "$gethostbyaddr_r_proto" in
13662         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13663         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13664         esac
13665         case "$gethostbyaddr_r_proto" in
13666         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13667         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13668         esac
13669         case "$gethostbyaddr_r_proto" in
13670         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13671         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13672         esac
13673         case "$gethostbyaddr_r_proto" in
13674         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13675         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13676         esac
13677         case "$gethostbyaddr_r_proto" in
13678         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13679         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13680         esac
13681         case "$gethostbyaddr_r_proto" in
13682         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13683         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13684         esac
13685         case "$gethostbyaddr_r_proto" in
13686         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13687         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13688         esac
13689         case "$gethostbyaddr_r_proto" in
13690         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13691         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13692         esac
13693         case "$gethostbyaddr_r_proto" in
13694         ''|0)   d_gethostbyaddr_r=undef
13695                 gethostbyaddr_r_proto=0
13696                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13697         * )     case "$gethostbyaddr_r_proto" in
13698                 REENTRANT_PROTO*) ;;
13699                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13700                 esac
13701                 echo "Prototype: $try" ;;
13702         esac
13703         ;;
13704         *)      case "$usethreads" in
13705                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13706                 esac
13707                 d_gethostbyaddr_r=undef
13708                 gethostbyaddr_r_proto=0
13709                 ;;
13710         esac
13711         ;;
13712 *)      gethostbyaddr_r_proto=0
13713         ;;
13714 esac
13715
13716 : see if gethostbyname_r exists
13717 set gethostbyname_r d_gethostbyname_r
13718 eval $inlibc
13719 case "$d_gethostbyname_r" in
13720 "$define")
13721         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13722         case "$d_gethostbyname_r_proto:$usethreads" in
13723         ":define")      d_gethostbyname_r_proto=define
13724                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13725                 eval $hasproto ;;
13726         *)      ;;
13727         esac
13728         case "$d_gethostbyname_r_proto" in
13729         define)
13730         case "$gethostbyname_r_proto" in
13731         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13732         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13733         esac
13734         case "$gethostbyname_r_proto" in
13735         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13736         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13737         esac
13738         case "$gethostbyname_r_proto" in
13739         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13740         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13741         esac
13742         case "$gethostbyname_r_proto" in
13743         ''|0)   d_gethostbyname_r=undef
13744                 gethostbyname_r_proto=0
13745                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13746         * )     case "$gethostbyname_r_proto" in
13747                 REENTRANT_PROTO*) ;;
13748                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13749                 esac
13750                 echo "Prototype: $try" ;;
13751         esac
13752         ;;
13753         *)      case "$usethreads" in
13754                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13755                 esac
13756                 d_gethostbyname_r=undef
13757                 gethostbyname_r_proto=0
13758                 ;;
13759         esac
13760         ;;
13761 *)      gethostbyname_r_proto=0
13762         ;;
13763 esac
13764
13765 : see if gethostent_r exists
13766 set gethostent_r d_gethostent_r
13767 eval $inlibc
13768 case "$d_gethostent_r" in
13769 "$define")
13770         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13771         case "$d_gethostent_r_proto:$usethreads" in
13772         ":define")      d_gethostent_r_proto=define
13773                 set d_gethostent_r_proto gethostent_r $hdrs
13774                 eval $hasproto ;;
13775         *)      ;;
13776         esac
13777         case "$d_gethostent_r_proto" in
13778         define)
13779         case "$gethostent_r_proto" in
13780         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13781         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13782         esac
13783         case "$gethostent_r_proto" in
13784         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13785         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13786         esac
13787         case "$gethostent_r_proto" in
13788         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13789         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13790         esac
13791         case "$gethostent_r_proto" in
13792         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13793         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13794         esac
13795         case "$gethostent_r_proto" in
13796         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13797         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13798         esac
13799         case "$gethostent_r_proto" in
13800         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13801         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13802         esac
13803         case "$gethostent_r_proto" in
13804         ''|0)   d_gethostent_r=undef
13805                 gethostent_r_proto=0
13806                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13807         * )     case "$gethostent_r_proto" in
13808                 REENTRANT_PROTO*) ;;
13809                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13810                 esac
13811                 echo "Prototype: $try" ;;
13812         esac
13813         ;;
13814         *)      case "$usethreads" in
13815                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13816                 esac
13817                 d_gethostent_r=undef
13818                 gethostent_r_proto=0
13819                 ;;
13820         esac
13821         ;;
13822 *)      gethostent_r_proto=0
13823         ;;
13824 esac
13825
13826 : see if prototypes for various gethostxxx netdb.h functions are available
13827 echo " "
13828 set d_gethostprotos gethostent $i_netdb netdb.h
13829 eval $hasproto
13830
13831 : see if getitimer exists
13832 set getitimer d_getitimer
13833 eval $inlibc
13834
13835 : see if getlogin exists
13836 set getlogin d_getlogin
13837 eval $inlibc
13838
13839 : see if getlogin_r exists
13840 set getlogin_r d_getlogin_r
13841 eval $inlibc
13842 case "$d_getlogin_r" in
13843 "$define")
13844         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13845         case "$d_getlogin_r_proto:$usethreads" in
13846         ":define")      d_getlogin_r_proto=define
13847                 set d_getlogin_r_proto getlogin_r $hdrs
13848                 eval $hasproto ;;
13849         *)      ;;
13850         esac
13851         case "$d_getlogin_r_proto" in
13852         define)
13853         case "$getlogin_r_proto" in
13854         ''|0) try='int getlogin_r(char*, size_t);'
13855         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13856         esac
13857         case "$getlogin_r_proto" in
13858         ''|0) try='int getlogin_r(char*, int);'
13859         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13860         esac
13861         case "$getlogin_r_proto" in
13862         ''|0) try='char* getlogin_r(char*, size_t);'
13863         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13864         esac
13865         case "$getlogin_r_proto" in
13866         ''|0) try='char* getlogin_r(char*, int);'
13867         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
13868         esac
13869         case "$getlogin_r_proto" in
13870         ''|0)   d_getlogin_r=undef
13871                 getlogin_r_proto=0
13872                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13873         * )     case "$getlogin_r_proto" in
13874                 REENTRANT_PROTO*) ;;
13875                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13876                 esac
13877                 echo "Prototype: $try" ;;
13878         esac
13879         ;;
13880         *)      case "$usethreads" in
13881                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13882                 esac
13883                 d_getlogin_r=undef
13884                 getlogin_r_proto=0
13885                 ;;
13886         esac
13887         ;;
13888 *)      getlogin_r_proto=0
13889         ;;
13890 esac
13891
13892 : see if getmnt exists
13893 set getmnt d_getmnt
13894 eval $inlibc
13895
13896 : see if getmntent exists
13897 set getmntent d_getmntent
13898 eval $inlibc
13899
13900 : see if getnetbyaddr exists
13901 set getnetbyaddr d_getnbyaddr
13902 eval $inlibc
13903
13904 : see if getnetbyname exists
13905 set getnetbyname d_getnbyname
13906 eval $inlibc
13907
13908 : see if getnetent exists
13909 set getnetent d_getnent
13910 eval $inlibc
13911
13912 : see if getnetbyaddr_r exists
13913 set getnetbyaddr_r d_getnetbyaddr_r
13914 eval $inlibc
13915 case "$d_getnetbyaddr_r" in
13916 "$define")
13917         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13918         case "$d_getnetbyaddr_r_proto:$usethreads" in
13919         ":define")      d_getnetbyaddr_r_proto=define
13920                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13921                 eval $hasproto ;;
13922         *)      ;;
13923         esac
13924         case "$d_getnetbyaddr_r_proto" in
13925         define)
13926         case "$getnetbyaddr_r_proto" in
13927         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13928         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13929         esac
13930         case "$getnetbyaddr_r_proto" in
13931         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13932         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13933         esac
13934         case "$getnetbyaddr_r_proto" in
13935         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13936         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13937         esac
13938         case "$getnetbyaddr_r_proto" in
13939         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13940         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13941         esac
13942         case "$getnetbyaddr_r_proto" in
13943         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13944         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13945         esac
13946         case "$getnetbyaddr_r_proto" in
13947         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13948         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13949         esac
13950         case "$getnetbyaddr_r_proto" in
13951         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13952         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13953         esac
13954         case "$getnetbyaddr_r_proto" in
13955         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13956         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13957         esac
13958         case "$getnetbyaddr_r_proto" in
13959         ''|0)   d_getnetbyaddr_r=undef
13960                 getnetbyaddr_r_proto=0
13961                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13962         * )     case "$getnetbyaddr_r_proto" in
13963                 REENTRANT_PROTO*) ;;
13964                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13965                 esac
13966                 echo "Prototype: $try" ;;
13967         esac
13968         ;;
13969         *)      case "$usethreads" in
13970                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13971                 esac
13972                 d_getnetbyaddr_r=undef
13973                 getnetbyaddr_r_proto=0
13974                 ;;
13975         esac
13976         ;;
13977 *)      getnetbyaddr_r_proto=0
13978         ;;
13979 esac
13980
13981 : see if getnetbyname_r exists
13982 set getnetbyname_r d_getnetbyname_r
13983 eval $inlibc
13984 case "$d_getnetbyname_r" in
13985 "$define")
13986         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13987         case "$d_getnetbyname_r_proto:$usethreads" in
13988         ":define")      d_getnetbyname_r_proto=define
13989                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13990                 eval $hasproto ;;
13991         *)      ;;
13992         esac
13993         case "$d_getnetbyname_r_proto" in
13994         define)
13995         case "$getnetbyname_r_proto" in
13996         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13997         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13998         esac
13999         case "$getnetbyname_r_proto" in
14000         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14001         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14002         esac
14003         case "$getnetbyname_r_proto" in
14004         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14005         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14006         esac
14007         case "$getnetbyname_r_proto" in
14008         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14009         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14010         esac
14011         case "$getnetbyname_r_proto" in
14012         ''|0)   d_getnetbyname_r=undef
14013                 getnetbyname_r_proto=0
14014                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14015         * )     case "$getnetbyname_r_proto" in
14016                 REENTRANT_PROTO*) ;;
14017                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14018                 esac
14019                 echo "Prototype: $try" ;;
14020         esac
14021         ;;
14022         *)      case "$usethreads" in
14023                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14024                 esac
14025                 d_getnetbyname_r=undef
14026                 getnetbyname_r_proto=0
14027                 ;;
14028         esac
14029         ;;
14030 *)      getnetbyname_r_proto=0
14031         ;;
14032 esac
14033
14034 : see if getnetent_r exists
14035 set getnetent_r d_getnetent_r
14036 eval $inlibc
14037 case "$d_getnetent_r" in
14038 "$define")
14039         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14040         case "$d_getnetent_r_proto:$usethreads" in
14041         ":define")      d_getnetent_r_proto=define
14042                 set d_getnetent_r_proto getnetent_r $hdrs
14043                 eval $hasproto ;;
14044         *)      ;;
14045         esac
14046         case "$d_getnetent_r_proto" in
14047         define)
14048         case "$getnetent_r_proto" in
14049         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14050         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14051         esac
14052         case "$getnetent_r_proto" in
14053         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14054         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14055         esac
14056         case "$getnetent_r_proto" in
14057         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14058         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14059         esac
14060         case "$getnetent_r_proto" in
14061         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14062         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14063         esac
14064         case "$getnetent_r_proto" in
14065         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14066         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14067         esac
14068         case "$getnetent_r_proto" in
14069         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14070         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14071         esac
14072         case "$getnetent_r_proto" in
14073         ''|0)   d_getnetent_r=undef
14074                 getnetent_r_proto=0
14075                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14076         * )     case "$getnetent_r_proto" in
14077                 REENTRANT_PROTO*) ;;
14078                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14079                 esac
14080                 echo "Prototype: $try" ;;
14081         esac
14082         ;;
14083         *)      case "$usethreads" in
14084                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14085                 esac
14086                 d_getnetent_r=undef
14087                 getnetent_r_proto=0
14088                 ;;
14089         esac
14090         ;;
14091 *)      getnetent_r_proto=0
14092         ;;
14093 esac
14094
14095 : see if prototypes for various getnetxxx netdb.h functions are available
14096 echo " "
14097 set d_getnetprotos getnetent $i_netdb netdb.h
14098 eval $hasproto
14099
14100 : see if getpagesize exists
14101 set getpagesize d_getpagsz
14102 eval $inlibc
14103
14104 : Optional checks for getprotobyname and getprotobynumber
14105
14106 : see if getprotobyname exists
14107 set getprotobyname d_getpbyname
14108 eval $inlibc
14109
14110 : see if getprotobynumber exists
14111 set getprotobynumber d_getpbynumber
14112 eval $inlibc
14113
14114 : see if getprotoent exists
14115 set getprotoent d_getpent
14116 eval $inlibc
14117
14118 : see if getpgid exists
14119 set getpgid d_getpgid
14120 eval $inlibc
14121
14122 : see if getpgrp2 exists
14123 set getpgrp2 d_getpgrp2
14124 eval $inlibc
14125
14126 : see if getppid exists
14127 set getppid d_getppid
14128 eval $inlibc
14129
14130 : see if getpriority exists
14131 set getpriority d_getprior
14132 eval $inlibc
14133
14134 : see if getprotobyname_r exists
14135 set getprotobyname_r d_getprotobyname_r
14136 eval $inlibc
14137 case "$d_getprotobyname_r" in
14138 "$define")
14139         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14140         case "$d_getprotobyname_r_proto:$usethreads" in
14141         ":define")      d_getprotobyname_r_proto=define
14142                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14143                 eval $hasproto ;;
14144         *)      ;;
14145         esac
14146         case "$d_getprotobyname_r_proto" in
14147         define)
14148         case "$getprotobyname_r_proto" in
14149         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14150         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14151         esac
14152         case "$getprotobyname_r_proto" in
14153         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14154         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14155         esac
14156         case "$getprotobyname_r_proto" in
14157         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14158         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14159         esac
14160         case "$getprotobyname_r_proto" in
14161         ''|0)   d_getprotobyname_r=undef
14162                 getprotobyname_r_proto=0
14163                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14164         * )     case "$getprotobyname_r_proto" in
14165                 REENTRANT_PROTO*) ;;
14166                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14167                 esac
14168                 echo "Prototype: $try" ;;
14169         esac
14170         ;;
14171         *)      case "$usethreads" in
14172                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14173                 esac
14174                 d_getprotobyname_r=undef
14175                 getprotobyname_r_proto=0
14176                 ;;
14177         esac
14178         ;;
14179 *)      getprotobyname_r_proto=0
14180         ;;
14181 esac
14182
14183 : see if getprotobynumber_r exists
14184 set getprotobynumber_r d_getprotobynumber_r
14185 eval $inlibc
14186 case "$d_getprotobynumber_r" in
14187 "$define")
14188         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14189         case "$d_getprotobynumber_r_proto:$usethreads" in
14190         ":define")      d_getprotobynumber_r_proto=define
14191                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14192                 eval $hasproto ;;
14193         *)      ;;
14194         esac
14195         case "$d_getprotobynumber_r_proto" in
14196         define)
14197         case "$getprotobynumber_r_proto" in
14198         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14199         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14200         esac
14201         case "$getprotobynumber_r_proto" in
14202         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14203         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14204         esac
14205         case "$getprotobynumber_r_proto" in
14206         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14207         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14208         esac
14209         case "$getprotobynumber_r_proto" in
14210         ''|0)   d_getprotobynumber_r=undef
14211                 getprotobynumber_r_proto=0
14212                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14213         * )     case "$getprotobynumber_r_proto" in
14214                 REENTRANT_PROTO*) ;;
14215                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14216                 esac
14217                 echo "Prototype: $try" ;;
14218         esac
14219         ;;
14220         *)      case "$usethreads" in
14221                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14222                 esac
14223                 d_getprotobynumber_r=undef
14224                 getprotobynumber_r_proto=0
14225                 ;;
14226         esac
14227         ;;
14228 *)      getprotobynumber_r_proto=0
14229         ;;
14230 esac
14231
14232 : see if getprotoent_r exists
14233 set getprotoent_r d_getprotoent_r
14234 eval $inlibc
14235 case "$d_getprotoent_r" in
14236 "$define")
14237         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14238         case "$d_getprotoent_r_proto:$usethreads" in
14239         ":define")      d_getprotoent_r_proto=define
14240                 set d_getprotoent_r_proto getprotoent_r $hdrs
14241                 eval $hasproto ;;
14242         *)      ;;
14243         esac
14244         case "$d_getprotoent_r_proto" in
14245         define)
14246         case "$getprotoent_r_proto" in
14247         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14248         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14249         esac
14250         case "$getprotoent_r_proto" in
14251         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14252         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14253         esac
14254         case "$getprotoent_r_proto" in
14255         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14256         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14257         esac
14258         case "$getprotoent_r_proto" in
14259         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14260         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14261         esac
14262         case "$getprotoent_r_proto" in
14263         ''|0)   d_getprotoent_r=undef
14264                 getprotoent_r_proto=0
14265                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14266         * )     case "$getprotoent_r_proto" in
14267                 REENTRANT_PROTO*) ;;
14268                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14269                 esac
14270                 echo "Prototype: $try" ;;
14271         esac
14272         ;;
14273         *)      case "$usethreads" in
14274                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14275                 esac
14276                 d_getprotoent_r=undef
14277                 getprotoent_r_proto=0
14278                 ;;
14279         esac
14280         ;;
14281 *)      getprotoent_r_proto=0
14282         ;;
14283 esac
14284
14285 : see if prototypes for various getprotoxxx netdb.h functions are available
14286 echo " "
14287 set d_getprotoprotos getprotoent $i_netdb netdb.h
14288 eval $hasproto
14289
14290 : see if getprpwnam exists
14291 set getprpwnam d_getprpwnam
14292 eval $inlibc
14293
14294 : see if getpwent exists
14295 set getpwent d_getpwent
14296 eval $inlibc
14297
14298 : see if getpwent_r exists
14299 set getpwent_r d_getpwent_r
14300 eval $inlibc
14301 case "$d_getpwent_r" in
14302 "$define")
14303         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14304         case "$d_getpwent_r_proto:$usethreads" in
14305         ":define")      d_getpwent_r_proto=define
14306                 set d_getpwent_r_proto getpwent_r $hdrs
14307                 eval $hasproto ;;
14308         *)      ;;
14309         esac
14310         case "$d_getpwent_r_proto" in
14311         define)
14312         case "$getpwent_r_proto" in
14313         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14314         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14315         esac
14316         case "$getpwent_r_proto" in
14317         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14318         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14319         esac
14320         case "$getpwent_r_proto" in
14321         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14322         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14323         esac
14324         case "$getpwent_r_proto" in
14325         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14326         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14327         esac
14328         case "$getpwent_r_proto" in
14329         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14330         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14331         esac
14332         case "$getpwent_r_proto" in
14333         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14334         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14335         esac
14336         case "$getpwent_r_proto" in
14337         ''|0)   d_getpwent_r=undef
14338                 getpwent_r_proto=0
14339                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14340         * )     case "$getpwent_r_proto" in
14341                 REENTRANT_PROTO*) ;;
14342                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14343                 esac
14344                 echo "Prototype: $try" ;;
14345         esac
14346         ;;
14347         *)      case "$usethreads" in
14348                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14349                 esac
14350                 d_getpwent_r=undef
14351                 getpwent_r_proto=0
14352                 ;;
14353         esac
14354         ;;
14355 *)      getpwent_r_proto=0
14356         ;;
14357 esac
14358
14359 : see if getpwnam_r exists
14360 set getpwnam_r d_getpwnam_r
14361 eval $inlibc
14362 case "$d_getpwnam_r" in
14363 "$define")
14364         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14365         case "$d_getpwnam_r_proto:$usethreads" in
14366         ":define")      d_getpwnam_r_proto=define
14367                 set d_getpwnam_r_proto getpwnam_r $hdrs
14368                 eval $hasproto ;;
14369         *)      ;;
14370         esac
14371         case "$d_getpwnam_r_proto" in
14372         define)
14373         case "$getpwnam_r_proto" in
14374         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14375         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14376         esac
14377         case "$getpwnam_r_proto" in
14378         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14379         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14380         esac
14381         case "$getpwnam_r_proto" in
14382         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14383         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14384         esac
14385         case "$getpwnam_r_proto" in
14386         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14387         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14388         esac
14389         case "$getpwnam_r_proto" in
14390         ''|0)   d_getpwnam_r=undef
14391                 getpwnam_r_proto=0
14392                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14393         * )     case "$getpwnam_r_proto" in
14394                 REENTRANT_PROTO*) ;;
14395                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14396                 esac
14397                 echo "Prototype: $try" ;;
14398         esac
14399         ;;
14400         *)      case "$usethreads" in
14401                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14402                 esac
14403                 d_getpwnam_r=undef
14404                 getpwnam_r_proto=0
14405                 ;;
14406         esac
14407         ;;
14408 *)      getpwnam_r_proto=0
14409         ;;
14410 esac
14411
14412 : see if getpwuid_r exists
14413 set getpwuid_r d_getpwuid_r
14414 eval $inlibc
14415 case "$d_getpwuid_r" in
14416 "$define")
14417         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14418         case "$d_getpwuid_r_proto:$usethreads" in
14419         ":define")      d_getpwuid_r_proto=define
14420                 set d_getpwuid_r_proto getpwuid_r $hdrs
14421                 eval $hasproto ;;
14422         *)      ;;
14423         esac
14424         case "$d_getpwuid_r_proto" in
14425         define)
14426         case "$getpwuid_r_proto" in
14427         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14428         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14429         esac
14430         case "$getpwuid_r_proto" in
14431         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14432         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14433         esac
14434         case "$getpwuid_r_proto" in
14435         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14436         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14437         esac
14438         case "$getpwuid_r_proto" in
14439         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14440         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14441         esac
14442         case "$getpwuid_r_proto" in
14443         ''|0)   d_getpwuid_r=undef
14444                 getpwuid_r_proto=0
14445                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14446         * )     case "$getpwuid_r_proto" in
14447                 REENTRANT_PROTO*) ;;
14448                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14449                 esac
14450                 echo "Prototype: $try" ;;
14451         esac
14452         ;;
14453         *)      case "$usethreads" in
14454                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14455                 esac
14456                 d_getpwuid_r=undef
14457                 getpwuid_r_proto=0
14458                 ;;
14459         esac
14460         ;;
14461 *)      getpwuid_r_proto=0
14462         ;;
14463 esac
14464
14465 : Optional checks for getsbyname and getsbyport
14466
14467 : see if getservbyname exists
14468 set getservbyname d_getsbyname
14469 eval $inlibc
14470
14471 : see if getservbyport exists
14472 set getservbyport d_getsbyport
14473 eval $inlibc
14474
14475 : see if getservent exists
14476 set getservent d_getsent
14477 eval $inlibc
14478
14479 : see if getservbyname_r exists
14480 set getservbyname_r d_getservbyname_r
14481 eval $inlibc
14482 case "$d_getservbyname_r" in
14483 "$define")
14484         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14485         case "$d_getservbyname_r_proto:$usethreads" in
14486         ":define")      d_getservbyname_r_proto=define
14487                 set d_getservbyname_r_proto getservbyname_r $hdrs
14488                 eval $hasproto ;;
14489         *)      ;;
14490         esac
14491         case "$d_getservbyname_r_proto" in
14492         define)
14493         case "$getservbyname_r_proto" in
14494         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14495         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14496         esac
14497         case "$getservbyname_r_proto" in
14498         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14499         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14500         esac
14501         case "$getservbyname_r_proto" in
14502         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14503         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14504         esac
14505         case "$getservbyname_r_proto" in
14506         ''|0)   d_getservbyname_r=undef
14507                 getservbyname_r_proto=0
14508                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14509         * )     case "$getservbyname_r_proto" in
14510                 REENTRANT_PROTO*) ;;
14511                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14512                 esac
14513                 echo "Prototype: $try" ;;
14514         esac
14515         ;;
14516         *)      case "$usethreads" in
14517                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14518                 esac
14519                 d_getservbyname_r=undef
14520                 getservbyname_r_proto=0
14521                 ;;
14522         esac
14523         ;;
14524 *)      getservbyname_r_proto=0
14525         ;;
14526 esac
14527
14528 : see if getservbyport_r exists
14529 set getservbyport_r d_getservbyport_r
14530 eval $inlibc
14531 case "$d_getservbyport_r" in
14532 "$define")
14533         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14534         case "$d_getservbyport_r_proto:$usethreads" in
14535         ":define")      d_getservbyport_r_proto=define
14536                 set d_getservbyport_r_proto getservbyport_r $hdrs
14537                 eval $hasproto ;;
14538         *)      ;;
14539         esac
14540         case "$d_getservbyport_r_proto" in
14541         define)
14542         case "$getservbyport_r_proto" in
14543         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14544         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14545         esac
14546         case "$getservbyport_r_proto" in
14547         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14548         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14549         esac
14550         case "$getservbyport_r_proto" in
14551         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14552         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14553         esac
14554         case "$getservbyport_r_proto" in
14555         ''|0)   d_getservbyport_r=undef
14556                 getservbyport_r_proto=0
14557                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14558         * )     case "$getservbyport_r_proto" in
14559                 REENTRANT_PROTO*) ;;
14560                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14561                 esac
14562                 echo "Prototype: $try" ;;
14563         esac
14564         ;;
14565         *)      case "$usethreads" in
14566                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14567                 esac
14568                 d_getservbyport_r=undef
14569                 getservbyport_r_proto=0
14570                 ;;
14571         esac
14572         ;;
14573 *)      getservbyport_r_proto=0
14574         ;;
14575 esac
14576
14577 : see if getservent_r exists
14578 set getservent_r d_getservent_r
14579 eval $inlibc
14580 case "$d_getservent_r" in
14581 "$define")
14582         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14583         case "$d_getservent_r_proto:$usethreads" in
14584         ":define")      d_getservent_r_proto=define
14585                 set d_getservent_r_proto getservent_r $hdrs
14586                 eval $hasproto ;;
14587         *)      ;;
14588         esac
14589         case "$d_getservent_r_proto" in
14590         define)
14591         case "$getservent_r_proto" in
14592         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14593         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14594         esac
14595         case "$getservent_r_proto" in
14596         ''|0) try='int getservent_r(struct servent*, char*, int);'
14597         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14598         esac
14599         case "$getservent_r_proto" in
14600         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14601         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14602         esac
14603         case "$getservent_r_proto" in
14604         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14605         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14606         esac
14607         case "$getservent_r_proto" in
14608         ''|0)   d_getservent_r=undef
14609                 getservent_r_proto=0
14610                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14611         * )     case "$getservent_r_proto" in
14612                 REENTRANT_PROTO*) ;;
14613                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14614                 esac
14615                 echo "Prototype: $try" ;;
14616         esac
14617         ;;
14618         *)      case "$usethreads" in
14619                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14620                 esac
14621                 d_getservent_r=undef
14622                 getservent_r_proto=0
14623                 ;;
14624         esac
14625         ;;
14626 *)      getservent_r_proto=0
14627         ;;
14628 esac
14629
14630 : see if prototypes for various getservxxx netdb.h functions are available
14631 echo " "
14632 set d_getservprotos getservent $i_netdb netdb.h
14633 eval $hasproto
14634
14635 : see if getspnam exists
14636 set getspnam d_getspnam
14637 eval $inlibc
14638
14639 : see if this is a shadow.h system
14640 set shadow.h i_shadow
14641 eval $inhdr
14642
14643 : see if getspnam_r exists
14644 set getspnam_r d_getspnam_r
14645 eval $inlibc
14646 case "$d_getspnam_r" in
14647 "$define")
14648         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14649         case "$d_getspnam_r_proto:$usethreads" in
14650         ":define")      d_getspnam_r_proto=define
14651                 set d_getspnam_r_proto getspnam_r $hdrs
14652                 eval $hasproto ;;
14653         *)      ;;
14654         esac
14655         case "$d_getspnam_r_proto" in
14656         define)
14657         case "$getspnam_r_proto" in
14658         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14659         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14660         esac
14661         case "$getspnam_r_proto" in
14662         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14663         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14664         esac
14665         case "$getspnam_r_proto" in
14666         ''|0)   d_getspnam_r=undef
14667                 getspnam_r_proto=0
14668                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14669         * )     case "$getspnam_r_proto" in
14670                 REENTRANT_PROTO*) ;;
14671                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14672                 esac
14673                 echo "Prototype: $try" ;;
14674         esac
14675         ;;
14676         *)      case "$usethreads" in
14677                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14678                 esac
14679                 d_getspnam_r=undef
14680                 getspnam_r_proto=0
14681                 ;;
14682         esac
14683         ;;
14684 *)      getspnam_r_proto=0
14685         ;;
14686 esac
14687
14688 : see if gettimeofday or ftime exists
14689 set gettimeofday d_gettimeod
14690 eval $inlibc
14691 case "$d_gettimeod" in
14692 "$undef")
14693         set ftime d_ftime 
14694         eval $inlibc
14695         ;;
14696 *)
14697         val="$undef"; set d_ftime; eval $setvar
14698         ;;
14699 esac
14700 case "$d_gettimeod$d_ftime" in
14701 "$undef$undef")
14702         echo " "
14703         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14704         ;;
14705 esac
14706
14707 : see if gmtime_r exists
14708 set gmtime_r d_gmtime_r
14709 eval $inlibc
14710 case "$d_gmtime_r" in
14711 "$define")
14712         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14713         case "$d_gmtime_r_proto:$usethreads" in
14714         ":define")      d_gmtime_r_proto=define
14715                 set d_gmtime_r_proto gmtime_r $hdrs
14716                 eval $hasproto ;;
14717         *)      ;;
14718         esac
14719         case "$d_gmtime_r_proto" in
14720         define)
14721         case "$gmtime_r_proto" in
14722         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14723         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14724         esac
14725         case "$gmtime_r_proto" in
14726         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14727         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14728         esac
14729         case "$gmtime_r_proto" in
14730         ''|0)   d_gmtime_r=undef
14731                 gmtime_r_proto=0
14732                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14733         * )     case "$gmtime_r_proto" in
14734                 REENTRANT_PROTO*) ;;
14735                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14736                 esac
14737                 echo "Prototype: $try" ;;
14738         esac
14739         ;;
14740         *)      case "$usethreads" in
14741                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14742                 esac
14743                 d_gmtime_r=undef
14744                 gmtime_r_proto=0
14745                 ;;
14746         esac
14747         ;;
14748 *)      gmtime_r_proto=0
14749         ;;
14750 esac
14751
14752 : see if hasmntopt exists
14753 set hasmntopt d_hasmntopt
14754 eval $inlibc
14755
14756 : see if this is a netinet/in.h or sys/in.h system
14757 set netinet/in.h i_niin sys/in.h i_sysin
14758 eval $inhdr
14759
14760 : see if arpa/inet.h has to be included
14761 set arpa/inet.h i_arpainet
14762 eval $inhdr
14763
14764 : see if htonl --and friends-- exists
14765 val=''
14766 set htonl val
14767 eval $inlibc
14768
14769 : Maybe they are macros.
14770 case "$val" in
14771 $undef)
14772         $cat >htonl.c <<EOM
14773 #include <stdio.h>
14774 #include <sys/types.h>
14775 #$i_niin I_NETINET_IN
14776 #$i_sysin I_SYS_IN
14777 #$i_arpainet I_ARPA_INET
14778 #ifdef I_NETINET_IN
14779 #include <netinet/in.h>
14780 #endif
14781 #ifdef I_SYS_IN
14782 #include <sys/in.h>
14783 #endif
14784 #ifdef I_ARPA_INET
14785 #include <arpa/inet.h>
14786 #endif
14787 #ifdef htonl
14788 printf("Defined as a macro.");
14789 #endif
14790 EOM
14791         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14792         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14793                 val="$define"
14794                 echo "But it seems to be defined as a macro." >&4
14795         fi
14796         $rm -f htonl.?
14797         ;;
14798 esac
14799 set d_htonl
14800 eval $setvar
14801
14802 : see if ilogbl exists
14803 set ilogbl d_ilogbl
14804 eval $inlibc
14805
14806 : index or strchr
14807 echo " "
14808 if set index val -f; eval $csym; $val; then
14809         if set strchr val -f d_strchr; eval $csym; $val; then
14810                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14811                         val="$define"
14812                         vali="$undef"
14813                         echo "strchr() found." >&4
14814                 else
14815                         val="$undef"
14816                         vali="$define"
14817                         echo "index() found." >&4
14818                 fi
14819         else
14820                 val="$undef"
14821                 vali="$define"
14822                 echo "index() found." >&4
14823         fi
14824 else
14825         if set strchr val -f d_strchr; eval $csym; $val; then
14826                 val="$define"
14827                 vali="$undef"
14828                 echo "strchr() found." >&4
14829         else
14830                 echo "No index() or strchr() found!" >&4
14831                 val="$undef"
14832                 vali="$undef"
14833         fi
14834 fi
14835 set d_strchr; eval $setvar
14836 val="$vali"
14837 set d_index; eval $setvar
14838
14839 : check whether inet_aton exists
14840 set inet_aton d_inetaton
14841 eval $inlibc
14842
14843 : Look for isascii
14844 echo " "
14845 $cat >isascii.c <<EOCP
14846 #include <stdio.h>
14847 #include <ctype.h>
14848 #$i_stdlib I_STDLIB
14849 #ifdef I_STDLIB
14850 #include <stdlib.h>
14851 #endif
14852 int main() {
14853         int c = 'A';
14854         if (isascii(c))
14855                 exit(0);
14856         else
14857                 exit(1);
14858 }
14859 EOCP
14860 set isascii
14861 if eval $compile; then
14862         echo "isascii() found." >&4
14863         val="$define"
14864 else
14865         echo "isascii() NOT found." >&4
14866         val="$undef"
14867 fi
14868 set d_isascii
14869 eval $setvar
14870 $rm -f isascii*
14871
14872 : see if isfinite exists
14873 set isfinite d_isfinite
14874 eval $inlibc
14875
14876 : see if isinf exists
14877 set isinf d_isinf
14878 eval $inlibc
14879
14880 : see if isnan exists
14881 set isnan d_isnan
14882 eval $inlibc
14883
14884 : see if isnanl exists
14885 set isnanl d_isnanl
14886 eval $inlibc
14887
14888 : see if killpg exists
14889 set killpg d_killpg
14890 eval $inlibc
14891
14892 : see if lchown exists
14893 echo " "
14894 $cat > try.c <<'EOCP'
14895 /* System header to define __stub macros and hopefully few prototypes,
14896     which can conflict with char lchown(); below.  */
14897 #include <assert.h>
14898 /* Override any gcc2 internal prototype to avoid an error.  */
14899 /* We use char because int might match the return type of a gcc2
14900    builtin and then its argument prototype would still apply.  */
14901 char lchown();
14902 int main() {
14903     /*  The GNU C library defines this for functions which it implements
14904         to always fail with ENOSYS.  Some functions are actually named
14905         something starting with __ and the normal name is an alias.  */
14906 #if defined (__stub_lchown) || defined (__stub___lchown)
14907 choke me
14908 #else
14909 lchown();
14910 #endif
14911 ; return 0; }
14912 EOCP
14913 set try
14914 if eval $compile; then
14915     $echo "lchown() found." >&4
14916     val="$define"
14917 else
14918     $echo "lchown() NOT found." >&4
14919     val="$undef"
14920 fi
14921 set d_lchown
14922 eval $setvar
14923
14924 : See if number of significant digits in a double precision number is known
14925 echo " "
14926 $cat >ldbl_dig.c <<EOM
14927 #$i_limits I_LIMITS
14928 #$i_float I_FLOAT
14929 #ifdef I_LIMITS
14930 #include <limits.h>
14931 #endif
14932 #ifdef I_FLOAT
14933 #include <float.h>
14934 #endif
14935 #ifdef LDBL_DIG
14936 printf("Contains LDBL_DIG");
14937 #endif
14938 EOM
14939 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14940 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14941         echo "LDBL_DIG found." >&4
14942         val="$define"
14943 else
14944         echo "LDBL_DIG NOT found." >&4
14945         val="$undef"
14946 fi
14947 $rm -f ldbl_dig.?
14948 set d_ldbl_dig
14949 eval $setvar
14950
14951 : see if this is a math.h system
14952 set math.h i_math
14953 eval $inhdr
14954
14955 : check to see if math.h defines _LIB_VERSION
14956 d_libm_lib_version="$undef"
14957 case $i_math in
14958     $define)
14959         echo " "
14960         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14961         $cat >try.c <<EOCP
14962 #include <unistd.h>
14963 #include <math.h>
14964 int main (int argc, char *argv[])
14965 {
14966     printf ("%d\n", _LIB_VERSION);
14967     return (0);
14968     } /* main */
14969 EOCP
14970         set try
14971         if eval $compile; then
14972             foo=`$run ./try`
14973             echo "Yes, it does ($foo)" >&4
14974             d_libm_lib_version="$define"
14975         else
14976             echo "No, it does not (probably harmless)" >&4
14977             fi
14978         $rm_try
14979         ;;
14980
14981     esac
14982
14983 : see if link exists
14984 set link d_link
14985 eval $inlibc
14986
14987 : see if localtime_r exists
14988 set localtime_r d_localtime_r
14989 eval $inlibc
14990 case "$d_localtime_r" in
14991 "$define")
14992         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14993         case "$d_localtime_r_proto:$usethreads" in
14994         ":define")      d_localtime_r_proto=define
14995                 set d_localtime_r_proto localtime_r $hdrs
14996                 eval $hasproto ;;
14997         *)      ;;
14998         esac
14999         case "$d_localtime_r_proto" in
15000         define)
15001         case "$localtime_r_proto" in
15002         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15003         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15004         esac
15005         case "$localtime_r_proto" in
15006         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15007         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15008         esac
15009         case "$localtime_r_proto" in
15010         ''|0)   d_localtime_r=undef
15011                 localtime_r_proto=0
15012                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15013         * )     case "$localtime_r_proto" in
15014                 REENTRANT_PROTO*) ;;
15015                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15016                 esac
15017                 echo "Prototype: $try" ;;
15018         esac
15019         ;;
15020         *)      case "$usethreads" in
15021                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15022                 esac
15023                 d_localtime_r=undef
15024                 localtime_r_proto=0
15025                 ;;
15026         esac
15027         ;;
15028 *)      localtime_r_proto=0
15029         ;;
15030 esac
15031
15032 : see if localtime_r calls tzset
15033 case "$localtime_r_proto" in
15034 REENTRANT_PROTO*)
15035         $cat >try.c <<EOCP
15036 /*  Does our libc's localtime_r call tzset ?
15037  *  return 0 if so, 1 otherwise.
15038  */
15039 #$i_systypes    I_SYS_TYPES
15040 #$i_unistd      I_UNISTD
15041 #$i_time        I_TIME
15042 #$i_stdlib      I_STDLIB
15043 #$i_string      I_STRING
15044 #$i_malloc      I_MALLOC
15045 #ifdef I_SYS_TYPES
15046 #  include <sys/types.h>
15047 #endif
15048 #ifdef I_UNISTD
15049 #  include <unistd.h>
15050 #endif
15051 #ifdef I_TIME
15052 #  include <time.h>
15053 #endif
15054 #ifdef I_STDLIB
15055 #include <stdlib.h>
15056 #endif
15057 #ifdef I_STRING
15058 #  include <string.h>
15059 #else
15060 #  include <strings.h>
15061 #endif
15062 #ifdef I_MALLOC
15063 #  include <malloc.h>
15064 #endif
15065 int main()
15066 {
15067     time_t t = time(0L);
15068     char w_tz[]="TZ" "=GMT+5",
15069          e_tz[]="TZ" "=GMT-5",
15070         *tz_e = (char*)malloc(16),
15071         *tz_w = (char*)malloc(16);
15072     struct tm tm_e, tm_w;
15073     memset(&tm_e,'\0',sizeof(struct tm));
15074     memset(&tm_w,'\0',sizeof(struct tm));
15075     strcpy(tz_e,e_tz);
15076     strcpy(tz_w,w_tz);
15077
15078     putenv(tz_e);
15079     localtime_r(&t, &tm_e);
15080
15081     putenv(tz_w);
15082     localtime_r(&t, &tm_w);
15083
15084     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15085         return 1;
15086     return 0;
15087 }
15088 EOCP
15089         set try
15090         if eval $compile; then
15091             if $run ./try; then
15092                 d_localtime_r_needs_tzset=undef;
15093             else
15094                 d_localtime_r_needs_tzset=define;
15095             fi;
15096         else
15097             d_localtime_r_needs_tzset=undef;
15098         fi;
15099      ;;
15100   *)
15101      d_localtime_r_needs_tzset=undef;
15102      ;;
15103 esac
15104 $rm_try
15105
15106 : see if localeconv exists
15107 set localeconv d_locconv
15108 eval $inlibc
15109
15110 : see if lockf exists
15111 set lockf d_lockf
15112 eval $inlibc
15113
15114 : see if prototype for lseek is available
15115 echo " "
15116 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15117 eval $hasproto
15118
15119 : see if lstat exists
15120 set lstat d_lstat
15121 eval $inlibc
15122
15123 : see if madvise exists
15124 set madvise d_madvise
15125 eval $inlibc
15126
15127 : see if malloc_size exists
15128 set malloc_size d_malloc_size
15129 eval $inlibc
15130
15131 : see if malloc_size_good exists
15132 set malloc_good_size d_malloc_good_size
15133 eval $inlibc
15134
15135 : see if mblen exists
15136 set mblen d_mblen
15137 eval $inlibc
15138
15139 : see if mbstowcs exists
15140 set mbstowcs d_mbstowcs
15141 eval $inlibc
15142
15143 : see if mbtowc exists
15144 set mbtowc d_mbtowc
15145 eval $inlibc
15146
15147 : see if memchr exists
15148 set memchr d_memchr
15149 eval $inlibc
15150
15151 : see if memcmp exists
15152 set memcmp d_memcmp
15153 eval $inlibc
15154
15155 : see if memcpy exists
15156 set memcpy d_memcpy
15157 eval $inlibc
15158
15159 : see if memmove exists
15160 set memmove d_memmove
15161 eval $inlibc
15162
15163 : see if memset exists
15164 set memset d_memset
15165 eval $inlibc
15166
15167 : see if mkdir exists
15168 set mkdir d_mkdir
15169 eval $inlibc
15170
15171 : see if mkdtemp exists
15172 set mkdtemp d_mkdtemp
15173 eval $inlibc
15174
15175 : see if mkfifo exists
15176 set mkfifo d_mkfifo
15177 eval $inlibc
15178
15179 : see if mkstemp exists
15180 set mkstemp d_mkstemp
15181 eval $inlibc
15182
15183 : see if mkstemps exists
15184 set mkstemps d_mkstemps
15185 eval $inlibc
15186
15187 : see if mktime exists
15188 set mktime d_mktime
15189 eval $inlibc
15190
15191 : see if this is a sys/mman.h system
15192 set sys/mman.h i_sysmman
15193 eval $inhdr
15194
15195 : see if mmap exists
15196 set mmap d_mmap
15197 eval $inlibc
15198 : see what shmat returns
15199 : default to something harmless
15200 mmaptype='void *'
15201 case "$i_sysmman$d_mmap" in
15202 "$define$define")
15203         $cat >mmap.c <<'END'
15204 #include <sys/mman.h>
15205 void *mmap();
15206 END
15207         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15208                 mmaptype='void *'
15209         else
15210                 mmaptype='caddr_t'
15211         fi
15212         echo "and it returns ($mmaptype)." >&4
15213         ;;
15214 esac
15215
15216
15217
15218 : see if sqrtl exists
15219 set sqrtl d_sqrtl
15220 eval $inlibc
15221
15222 : see if scalbnl exists
15223 set scalbnl d_scalbnl
15224 eval $inlibc
15225
15226 : see if modfl exists
15227 set modfl d_modfl
15228 eval $inlibc
15229
15230 : see if prototype for modfl is available
15231 echo " "
15232 set d_modflproto modfl $i_math math.h
15233 eval $hasproto
15234
15235 d_modfl_pow32_bug="$undef"
15236
15237 case "$d_longdbl$d_modfl" in
15238 $define$define)
15239         $cat <<EOM
15240 Checking to see whether your modfl() is okay for large values...
15241 EOM
15242 $cat >try.c <<EOCP
15243 #include <math.h>
15244 #include <stdio.h>
15245 EOCP
15246 if $test "X$d_modflproto" != "X$define"; then
15247         $cat >>try.c <<EOCP
15248 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15249 long double modfl (long double, long double *);
15250 EOCP
15251 fi
15252 $cat >>try.c <<EOCP
15253 int main() {
15254     long double nv = 4294967303.15;
15255     long double v, w;
15256     v = modfl(nv, &w);
15257 #ifdef __GLIBC__
15258     printf("glibc");
15259 #endif
15260     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15261     return 0;
15262 }
15263 EOCP
15264         case "$osname:$gccversion" in
15265         aix:)   saveccflags="$ccflags"
15266                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15267         esac
15268         set try
15269         if eval $compile; then
15270                 foo=`$run ./try`
15271                 case "$foo" in
15272                 *" 4294967303.150000 1.150000 4294967302.000000")
15273                         echo >&4 "Your modfl() is broken for large values."
15274                         d_modfl_pow32_bug="$define"
15275                         case "$foo" in
15276                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15277                         ;;
15278                         esac
15279                         ;;
15280                 *" 4294967303.150000 0.150000 4294967303.000000")
15281                         echo >&4 "Your modfl() seems okay for large values."
15282                         ;;
15283                 *)      echo >&4 "I don't understand your modfl() at all."
15284                         d_modfl="$undef"
15285                         ;;
15286                 esac
15287                 $rm_try
15288         else
15289                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15290                 d_modfl="$undef"
15291         fi
15292         case "$osname:$gccversion" in
15293         aix:)   ccflags="$saveccflags" ;; # restore
15294         esac
15295         ;;
15296 esac
15297
15298 if $test "$uselongdouble" = "$define"; then
15299     message=""
15300     if $test "$d_sqrtl" != "$define"; then
15301         message="$message sqrtl"
15302     fi
15303     if $test "$d_modfl" != "$define"; then
15304         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15305             echo "You have both aintl and copysignl, so I can emulate modfl."
15306         else
15307             message="$message modfl"
15308         fi
15309     fi
15310     if $test "$d_frexpl" != "$define"; then
15311         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15312             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15313         else
15314             message="$message frexpl"
15315         fi
15316     fi
15317
15318     if $test "$message" != ""; then
15319         $cat <<EOM >&4
15320
15321 *** You requested the use of long doubles but you do not seem to have
15322 *** the following mathematical functions needed for long double support:
15323 ***    $message
15324 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15325 *** Cannot continue, aborting.
15326
15327 EOM
15328
15329         exit 1
15330     fi
15331 fi
15332
15333 : see if mprotect exists
15334 set mprotect d_mprotect
15335 eval $inlibc
15336
15337 : see if msgctl exists
15338 set msgctl d_msgctl
15339 eval $inlibc
15340
15341 : see if msgget exists
15342 set msgget d_msgget
15343 eval $inlibc
15344
15345 : see if msgsnd exists
15346 set msgsnd d_msgsnd
15347 eval $inlibc
15348
15349 : see if msgrcv exists
15350 set msgrcv d_msgrcv
15351 eval $inlibc
15352
15353 : see how much of the 'msg*(2)' library is present.
15354 h_msg=true
15355 echo " "
15356 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15357 *"$undef"*) h_msg=false;;
15358 esac
15359 case "$osname" in
15360 freebsd)
15361     case "`ipcs 2>&1`" in
15362     "SVID messages"*"not configured"*)
15363         echo "Your $osname does not have the msg*(2) configured." >&4
15364         h_msg=false
15365         val="$undef"
15366         set msgctl d_msgctl
15367         eval $setvar
15368         set msgget d_msgget
15369         eval $setvar
15370         set msgsnd d_msgsnd
15371         eval $setvar
15372         set msgrcv d_msgrcv
15373         eval $setvar
15374         ;;
15375     esac
15376     ;;
15377 esac
15378 : we could also check for sys/ipc.h ...
15379 if $h_msg && $test `./findhdr sys/msg.h`; then
15380         echo "You have the full msg*(2) library." >&4
15381         val="$define"
15382 else
15383         echo "You don't have the full msg*(2) library." >&4
15384         val="$undef"
15385 fi
15386 set d_msg
15387 eval $setvar
15388
15389 : Check for msghdr_s
15390 echo " "
15391 echo "Checking to see if your system supports struct msghdr..." >&4
15392 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15393 eval $hasstruct
15394 case "$d_msghdr_s" in
15395 "$define")      echo "Yes, it does."   ;;
15396 *)              echo "No, it doesn't." ;;
15397 esac
15398
15399
15400 : see if msync exists
15401 set msync d_msync
15402 eval $inlibc
15403
15404 : see if munmap exists
15405 set munmap d_munmap
15406 eval $inlibc
15407
15408 : see if nice exists
15409 set nice d_nice
15410 eval $inlibc
15411
15412 : see if this is a langinfo.h system
15413 set langinfo.h i_langinfo
15414 eval $inhdr
15415
15416 : see if nl_langinfo exists
15417 set nl_langinfo d_nl_langinfo
15418 eval $inlibc
15419
15420 : check for volatile keyword
15421 echo " "
15422 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15423 $cat >try.c <<'EOCP'
15424 int main()
15425 {
15426         typedef struct _goo_struct goo_struct;
15427         goo_struct * volatile goo = ((goo_struct *)0);
15428         struct _goo_struct {
15429                 long long_int;
15430                 int reg_int;
15431                 char char_var;
15432         };
15433         typedef unsigned short foo_t;
15434         char *volatile foo;
15435         volatile int bar;
15436         volatile foo_t blech;
15437         foo = foo;
15438 }
15439 EOCP
15440 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15441         val="$define"
15442         echo "Yup, it does."
15443 else
15444         val="$undef"
15445         echo "Nope, it doesn't."
15446 fi
15447 set d_volatile
15448 eval $setvar
15449 $rm_try
15450
15451 : Check basic sizes
15452 echo " "
15453 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15454
15455 case "$use64bitint:$d_quad:$quadtype" in
15456 define:define:?*)
15457         ivtype="$quadtype"
15458         uvtype="$uquadtype"
15459         ivsize=8
15460         uvsize=8
15461         ;;
15462 *)      ivtype="long"
15463         uvtype="unsigned long"
15464         ivsize=$longsize
15465         uvsize=$longsize
15466         ;;
15467 esac
15468
15469 case "$uselongdouble:$d_longdbl" in
15470 define:define)
15471         nvtype="long double"
15472         nvsize=$longdblsize
15473         ;;
15474 *)      nvtype=double
15475         nvsize=$doublesize
15476         ;;
15477 esac
15478
15479 $echo "(IV will be "$ivtype", $ivsize bytes)"
15480 $echo "(UV will be "$uvtype", $uvsize bytes)"
15481 $echo "(NV will be "$nvtype", $nvsize bytes)"
15482
15483 $cat >try.c <<EOCP
15484 #$i_inttypes I_INTTYPES
15485 #ifdef I_INTTYPES
15486 #include <inttypes.h>
15487 #endif
15488 #include <stdio.h>
15489 int main() {
15490 #ifdef INT8
15491    int8_t i =  INT8_MAX;
15492   uint8_t u = UINT8_MAX;
15493   printf("int8_t\n");
15494 #endif
15495 #ifdef INT16
15496    int16_t i =  INT16_MAX;
15497   uint16_t i = UINT16_MAX;
15498   printf("int16_t\n");
15499 #endif
15500 #ifdef INT32
15501    int32_t i =  INT32_MAX;
15502   uint32_t u = UINT32_MAX;
15503   printf("int32_t\n");
15504 #endif
15505 }
15506 EOCP
15507
15508 i8type="signed char"
15509 u8type="unsigned char"
15510 i8size=1
15511 u8size=1
15512
15513 case "$i16type" in
15514 '')     case "$shortsize" in
15515         2)      i16type=short
15516                 u16type="unsigned short"
15517                 i16size=$shortsize
15518                 u16size=$shortsize
15519                 ;;
15520         esac
15521         ;;
15522 esac
15523 case "$i16type" in
15524 '')     set try -DINT16
15525         if eval $compile; then
15526                 case "`$run ./try`" in
15527                 int16_t)
15528                         i16type=int16_t
15529                         u16type=uint16_t
15530                         i16size=2
15531                         u16size=2
15532                         ;;
15533                 esac
15534         fi
15535         ;;
15536 esac
15537 case "$i16type" in
15538 '')     if $test $shortsize -ge 2; then
15539                 i16type=short
15540                 u16type="unsigned short"
15541                 i16size=$shortsize
15542                 u16size=$shortsize
15543         fi
15544         ;;
15545 esac
15546
15547 case "$i32type" in
15548 '')     case "$longsize" in
15549         4)      i32type=long
15550                 u32type="unsigned long"
15551                 i32size=$longsize
15552                 u32size=$longsize
15553                 ;;
15554         *)      case "$intsize" in
15555                 4)      i32type=int
15556                         u32type="unsigned int"
15557                         i32size=$intsize
15558                         u32size=$intsize
15559                         ;;
15560                 esac
15561                 ;;
15562         esac
15563         ;;
15564 esac
15565 case "$i32type" in
15566 '')     set try -DINT32
15567         if eval $compile; then
15568                 case "`$run ./try`" in
15569                 int32_t)
15570                         i32type=int32_t
15571                         u32type=uint32_t
15572                         i32size=4
15573                         u32size=4
15574                         ;;
15575                 esac
15576         fi
15577         ;;
15578 esac
15579 case "$i32type" in
15580 '')     if $test $intsize -ge 4; then
15581                 i32type=int
15582                 u32type="unsigned int"
15583                 i32size=$intsize
15584                 u32size=$intsize
15585         fi
15586         ;;
15587 esac
15588
15589 case "$i64type" in
15590 '')     case "$d_quad:$quadtype" in
15591         define:?*)
15592                 i64type="$quadtype"
15593                 u64type="$uquadtype"
15594                 i64size=8
15595                 u64size=8
15596                 ;;
15597         esac
15598         ;;
15599 esac
15600
15601 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15602 : volatile so that the compiler has to store it out to memory.
15603 if test X"$d_volatile" = X"$define"; then
15604         volatile=volatile
15605 fi
15606 $cat <<EOP >try.c
15607 #include <stdio.h>
15608 #$i_stdlib I_STDLIB
15609 #ifdef I_STDLIB
15610 #include <stdlib.h>
15611 #endif
15612 #include <sys/types.h>
15613 #include <signal.h>
15614 #ifdef SIGFPE
15615 $volatile int bletched = 0;
15616 $signal_t blech(int s) { bletched = 1; }
15617 #endif
15618 int main() {
15619     $uvtype u = 0;
15620     $nvtype d;
15621     int     n = 8 * $uvsize;
15622     int     i;
15623 #ifdef SIGFPE
15624     signal(SIGFPE, blech);
15625 #endif
15626
15627     for (i = 0; i < n; i++) {
15628       u = u << 1 | ($uvtype)1;
15629       d = ($nvtype)u;
15630       if (($uvtype)d != u)
15631         break;
15632       if (d <= 0)
15633         break;
15634       d = ($nvtype)(u - 1);
15635       if (($uvtype)d != (u - 1))
15636         break;
15637 #ifdef SIGFPE
15638       if (bletched)
15639         break;
15640 #endif
15641     }
15642     printf("%d\n", ((i == n) ? -n : i));
15643     exit(0);
15644 }
15645 EOP
15646 set try
15647
15648 d_nv_preserves_uv="$undef"
15649 if eval $compile; then
15650         nv_preserves_uv_bits="`$run ./try`"
15651 fi
15652 case "$nv_preserves_uv_bits" in
15653 \-[1-9]*)
15654         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15655         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15656         d_nv_preserves_uv="$define"
15657         ;;
15658 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15659         d_nv_preserves_uv="$undef" ;;
15660 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15661         nv_preserves_uv_bits="0" ;;
15662 esac
15663 $rm_try
15664
15665 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15666 : volatile so that the compiler has to store it out to memory.
15667 if test X"$d_volatile" = X"$define"; then
15668         volatile=volatile
15669 fi
15670 $cat <<EOP >try.c
15671 #include <stdio.h>
15672
15673 typedef $nvtype NV;
15674
15675 int
15676 main() {
15677   NV value = 2;
15678   int count = 1;
15679
15680   while(count < 256) {
15681     $volatile NV up = value + 1.0;
15682     $volatile NV negated = -value;
15683     $volatile NV down = negated - 1.0;
15684     $volatile NV got_up = up - value;
15685     int up_good = got_up == 1.0;
15686     int got_down = down - negated;
15687     int down_good = got_down == -1.0;
15688
15689     if (down_good != up_good) {
15690       fprintf(stderr,
15691               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15692               up_good, (double) got_up, down_good, (double) got_down,
15693               count, (double) value);
15694       return 1;
15695     }
15696     if (!up_good) {
15697       while (1) {
15698         if (count > 8) {
15699           count -= 8;
15700           fputs("256.0", stdout);
15701         } else {
15702           count--;
15703           fputs("2.0", stdout);
15704         }
15705         if (!count) {
15706           puts("");
15707           return 0;
15708         }
15709         fputs("*", stdout);
15710       }
15711     }
15712     value *= 2;
15713     ++count;
15714   }
15715   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15716           count, (double) value);
15717   return 1;
15718 }
15719 EOP
15720 set try
15721
15722 nv_overflows_integers_at='0'
15723 if eval $compile; then
15724     xxx="`$run ./try`"
15725     case "$?" in
15726         0)
15727             case "$xxx" in
15728                 2*)  cat >&4 <<EOM
15729 The largest integer your NVs can preserve is equal to $xxx
15730 EOM
15731                     nv_overflows_integers_at="$xxx"
15732                     ;;
15733                 *)  cat >&4 <<EOM
15734 Cannot determine the largest integer value your NVs can hold, unexpected output
15735 '$xxx'
15736 EOM
15737                     ;;
15738             esac
15739             ;;
15740         *)  cat >&4 <<EOM
15741 Cannot determine the largest integer value your NVs can hold
15742 EOM
15743             ;;
15744     esac
15745 fi
15746 $rm_try
15747
15748 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15749 : volatile so that the compiler has to store it out to memory.
15750 if test X"$d_volatile" = X"$define"; then
15751         volatile=volatile
15752 fi
15753 $cat <<EOP >try.c
15754 #include <stdio.h>
15755 #$i_stdlib I_STDLIB
15756 #ifdef I_STDLIB
15757 #include <stdlib.h>
15758 #endif
15759 #$i_string I_STRING
15760 #ifdef I_STRING
15761 #  include <string.h>
15762 #else
15763 #  include <strings.h>
15764 #endif
15765 #include <sys/types.h>
15766 #include <signal.h>
15767 #ifdef SIGFPE
15768 $volatile int bletched = 0;
15769 $signal_t blech(int s) { bletched = 1; }
15770 #endif
15771
15772 int checkit($nvtype d, char *where) {
15773     unsigned char *p = (char *)&d;
15774     unsigned char *end = p + sizeof(d);
15775     int fail = 0;
15776
15777     while (p < end)
15778         fail += *p++;
15779
15780     if (!fail)
15781         return 0;
15782
15783     p = (char *)&d;
15784     printf("No - %s: 0x", where);
15785     while (p < end)
15786         printf ("%02X", *p++);
15787     printf("\n");
15788     return 1;
15789 }
15790
15791 int main(int argc, char **argv) {
15792     $nvtype d = 0.0;
15793     int fail = 0;
15794     fail += checkit(d, "0.0");
15795
15796     /* The compiler shouldn't be assuming that bletched is 0  */
15797     d = bletched;
15798
15799     fail += checkit(d, "bleched");
15800
15801 #ifdef SIGFPE
15802     signal(SIGFPE, blech);
15803 #endif
15804
15805     /* Paranoia - the compiler should have no way of knowing that ANSI says
15806        that argv[argc] will always be NULL.  Actually, if it did assume this it
15807        would be buggy, as this is C and main() can be called from elsewhere in
15808        the program.  */
15809     d = argv[argc] ? 1 : 0;
15810
15811     if (d) {
15812         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15813     }
15814
15815     fail += checkit(d, "ternary");
15816
15817     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15818
15819     if (d != 0.0) {
15820         printf("No - memset doesn't give 0.0\n");
15821         /* This might just blow up:  */
15822         printf("(gives %g)\n", d);
15823         return 1;
15824     }
15825
15826 #ifdef SIGFPE
15827     if (bletched) {
15828         printf("No - something bleched\n");
15829         return 1;
15830     }
15831 #endif
15832     if (fail) {
15833       printf("No - %d fail(s)\n", fail);
15834       return 1;
15835     }
15836     printf("Yes\n");
15837     return 0;
15838 }
15839 EOP
15840 set try
15841
15842 d_nv_zero_is_allbits_zero="$undef"
15843 if eval $compile; then
15844     xxx="`$run ./try`"
15845     case "$?" in
15846         0)
15847             case "$xxx" in
15848                 Yes)  cat >&4 <<EOM
15849 0.0 is represented as all bits zero in memory
15850 EOM
15851                     d_nv_zero_is_allbits_zero="$define"
15852                     ;;
15853                 *)  cat >&4 <<EOM
15854 0.0 is not represented as all bits zero in memory
15855 EOM
15856                     d_nv_zero_is_allbits_zero="$undef"
15857                     ;;
15858             esac
15859             ;;
15860         *)  cat >&4 <<EOM
15861 0.0 is not represented as all bits zero in memory
15862 EOM
15863             d_nv_zero_is_allbits_zero="$undef"
15864             ;;
15865     esac
15866 fi
15867 $rm_try
15868
15869 : check for off64_t
15870 echo " "
15871 echo "Checking to see if you have off64_t..." >&4
15872 $cat >try.c <<EOCP
15873 #include <sys/types.h>
15874 #include <unistd.h>
15875 int main() { off64_t x = 7; }
15876 EOCP
15877 set try
15878 if eval $compile; then
15879         val="$define"
15880         echo "You have off64_t."
15881 else
15882         val="$undef"
15883         echo "You do not have off64_t."
15884         case "$lseeksize" in
15885         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15886         esac
15887 fi
15888 $rm_try
15889 set d_off64_t
15890 eval $setvar
15891
15892 : how to create joinable pthreads
15893 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15894         echo " "
15895         echo "Checking what constant to use for creating joinable pthreads..." >&4
15896         $cat >try.c <<'EOCP'
15897 #include <pthread.h>
15898 int main() {
15899     int detachstate = JOINABLE;
15900 }
15901 EOCP
15902         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15903         if eval $compile; then
15904                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15905                 val="$undef" # Yes, undef.
15906                 set d_old_pthread_create_joinable
15907                 eval $setvar
15908                 val=""
15909                 set old_pthread_create_joinable
15910                 eval $setvar
15911         else
15912                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15913                 if eval $compile; then
15914                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15915                         val="$define"
15916                         set d_old_pthread_create_joinable
15917                         eval $setvar
15918                         val=PTHREAD_CREATE_UNDETACHED
15919                         set old_pthread_create_joinable
15920                         eval $setvar
15921                 else
15922                         set try -DJOINABLE=__UNDETACHED
15923                         if eval $compile; then
15924                                 echo "You seem to use __UNDETACHED." >&4
15925                                 val="$define"
15926                                 set d_old_pthread_create_joinable
15927                                 eval $setvar
15928                                 val=__UNDETACHED
15929                                 set old_pthread_create_joinable
15930                                 eval $setvar
15931                         else
15932                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15933                                 val="$define"
15934                                 set d_old_pthread_create_joinable
15935                                 eval $setvar
15936                                 val=0
15937                                 set old_pthread_create_joinable
15938                                 eval $setvar
15939                         fi
15940                 fi
15941         fi
15942         $rm_try
15943 else
15944     d_old_pthread_create_joinable="$undef"
15945     old_pthread_create_joinable=""
15946 fi
15947
15948 : see if pause exists
15949 set pause d_pause
15950 eval $inlibc
15951
15952 : see if poll exists
15953 set poll d_poll
15954 eval $inlibc
15955
15956 : see if readlink exists
15957 set readlink d_readlink
15958 eval $inlibc
15959
15960 : Check if exe is symlink to abs path of executing program
15961 echo " "
15962 procselfexe=''
15963 val="$undef"
15964 case "$d_readlink" in
15965 "$define")
15966         if $issymlink /proc/self/exe ; then
15967                 $ls -l /proc/self/exe > reflect
15968                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15969                         echo "You have Linux-like /proc/self/exe."
15970                         procselfexe='"/proc/self/exe"'
15971                         val="$define"
15972                 fi
15973         fi
15974         if $issymlink /proc/curproc/file ; then
15975                 $ls -l /proc/curproc/file > reflect
15976                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15977                         echo "You have BSD-like /proc/curproc/file."
15978                         procselfexe='"/proc/curproc/file"'
15979                         val="$define"
15980                 fi
15981         fi
15982         ;;
15983 esac
15984 $rm -f reflect
15985 set d_procselfexe
15986 eval $setvar
15987
15988 : backward compatibility for d_hvfork
15989 if test X$d_hvfork != X; then
15990         d_vfork="$d_hvfork"
15991         d_hvfork=''
15992 fi
15993 : see if there is a vfork
15994 val=''
15995 set vfork val
15996 eval $inlibc
15997
15998 d_pseudofork=$undef
15999
16000 : Ok, but do we want to use it. vfork is reportedly unreliable in
16001 : perl on Solaris 2.x, and probably elsewhere.
16002 case "$val" in
16003 $define)
16004         echo " "
16005         case "$usevfork" in
16006         false) dflt='n';;
16007         *) dflt='y';;
16008         esac
16009         cat <<'EOM'
16010
16011 Perl can only use a vfork() that doesn't suffer from strict
16012 restrictions on calling functions or modifying global data in
16013 the child.  For example, glibc-2.1 contains such a vfork()
16014 that is unsuitable.  If your system provides a proper fork()
16015 call, chances are that you do NOT want perl to use vfork().
16016
16017 EOM
16018         rp="Do you still want to use vfork()?"
16019         . ./myread
16020         case "$ans" in
16021         y|Y) ;;
16022         *)
16023                 echo "Ok, we won't use vfork()."
16024                 val="$undef"
16025                 ;;
16026         esac
16027         ;;
16028 esac
16029 set d_vfork
16030 eval $setvar
16031 case "$d_vfork" in
16032 $define) usevfork='true';;
16033 *) usevfork='false';;
16034 esac
16035
16036 : see whether the pthread_atfork exists
16037 $cat >try.c <<EOP
16038 #include <pthread.h>
16039 #include <stdio.h>
16040 int main() {
16041 #ifdef  PTHREAD_ATFORK
16042         pthread_atfork(NULL,NULL,NULL);
16043 #endif
16044 }
16045 EOP
16046
16047 : see if pthread_atfork exists
16048 set try -DPTHREAD_ATFORK
16049 if eval $compile; then
16050     val="$define"
16051 else
16052     val="$undef"
16053 fi
16054 case "$usethreads" in
16055 $define)
16056         case "$val" in
16057         $define) echo 'pthread_atfork found.' >&4        ;;
16058         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16059         esac
16060 esac
16061 set d_pthread_atfork
16062 eval $setvar
16063
16064 : see if pthread_attr_setscope exists
16065 set pthread_attr_setscope d_pthread_attr_setscope
16066 eval $inlibc
16067
16068 : see whether the various POSIXish _yields exist
16069 $cat >try.c <<EOP
16070 #include <pthread.h>
16071 #include <stdio.h>
16072 int main() {
16073 #ifdef SCHED_YIELD
16074         sched_yield();
16075 #else
16076 #ifdef PTHREAD_YIELD
16077         pthread_yield();
16078 #else
16079 #ifdef PTHREAD_YIELD_NULL
16080         pthread_yield(NULL);
16081 #endif
16082 #endif
16083 #endif
16084 }
16085 EOP
16086 : see if sched_yield exists
16087 set try -DSCHED_YIELD
16088 if eval $compile; then
16089     val="$define"
16090     sched_yield='sched_yield()'
16091 else
16092     val="$undef"
16093 fi
16094 case "$usethreads" in
16095 $define)
16096         case "$val" in
16097         $define) echo 'sched_yield() found.' >&4        ;;
16098         *)       echo 'sched_yield() NOT found.' >&4    ;;
16099         esac
16100 esac
16101 set d_sched_yield
16102 eval $setvar
16103
16104 : see if pthread_yield exists
16105 set try -DPTHREAD_YIELD
16106 if eval $compile; then
16107     val="$define"
16108     case "$sched_yield" in
16109     '') sched_yield='pthread_yield()' ;;
16110     esac
16111 else
16112     set try -DPTHREAD_YIELD_NULL
16113     if eval $compile; then
16114         val="$define"
16115         case "$sched_yield" in
16116         '') sched_yield='pthread_yield(NULL)' ;;
16117         esac
16118     else
16119         val="$undef"
16120     fi
16121 fi
16122 case "$usethreads" in
16123 $define)
16124         case "$val" in
16125         $define) echo 'pthread_yield() found.' >&4      ;;
16126         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16127         esac
16128         ;;
16129 esac
16130 set d_pthread_yield
16131 eval $setvar
16132 case "$sched_yield" in
16133 '') sched_yield=undef ;;
16134 esac
16135 $rm_try
16136
16137 : see if random_r exists
16138 set random_r d_random_r
16139 eval $inlibc
16140 case "$d_random_r" in
16141 "$define")
16142         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16143         case "$d_random_r_proto:$usethreads" in
16144         ":define")      d_random_r_proto=define
16145                 set d_random_r_proto random_r $hdrs
16146                 eval $hasproto ;;
16147         *)      ;;
16148         esac
16149         case "$d_random_r_proto" in
16150         define)
16151         case "$random_r_proto" in
16152         ''|0) try='int random_r(int*, struct random_data*);'
16153         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16154         esac
16155         case "$random_r_proto" in
16156         ''|0) try='int random_r(long*, struct random_data*);'
16157         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16158         esac
16159         case "$random_r_proto" in
16160         ''|0) try='int random_r(struct random_data*, int32_t*);'
16161         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16162         esac
16163         case "$random_r_proto" in
16164         ''|0)   d_random_r=undef
16165                 random_r_proto=0
16166                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16167         * )     case "$random_r_proto" in
16168                 REENTRANT_PROTO*) ;;
16169                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16170                 esac
16171                 echo "Prototype: $try" ;;
16172         esac
16173         ;;
16174         *)      case "$usethreads" in
16175                 define) echo "random_r has no prototype, not using it." >&4 ;;
16176                 esac
16177                 d_random_r=undef
16178                 random_r_proto=0
16179                 ;;
16180         esac
16181         ;;
16182 *)      random_r_proto=0
16183         ;;
16184 esac
16185
16186 : see if readdir and friends exist
16187 set readdir d_readdir
16188 eval $inlibc
16189 set seekdir d_seekdir
16190 eval $inlibc
16191 set telldir d_telldir
16192 eval $inlibc
16193 set rewinddir d_rewinddir
16194 eval $inlibc
16195
16196 : see if readdir64_r exists
16197 set readdir64_r d_readdir64_r
16198 eval $inlibc
16199 case "$d_readdir64_r" in
16200 "$define")
16201         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16202         case "$d_readdir64_r_proto:$usethreads" in
16203         ":define")      d_readdir64_r_proto=define
16204                 set d_readdir64_r_proto readdir64_r $hdrs
16205                 eval $hasproto ;;
16206         *)      ;;
16207         esac
16208         case "$d_readdir64_r_proto" in
16209         define)
16210         case "$readdir64_r_proto" in
16211         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16212         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16213         esac
16214         case "$readdir64_r_proto" in
16215         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16216         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16217         esac
16218         case "$readdir64_r_proto" in
16219         ''|0)   d_readdir64_r=undef
16220                 readdir64_r_proto=0
16221                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16222         * )     case "$readdir64_r_proto" in
16223                 REENTRANT_PROTO*) ;;
16224                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16225                 esac
16226                 echo "Prototype: $try" ;;
16227         esac
16228         ;;
16229         *)      case "$usethreads" in
16230                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16231                 esac
16232                 d_readdir64_r=undef
16233                 readdir64_r_proto=0
16234                 ;;
16235         esac
16236         ;;
16237 *)      readdir64_r_proto=0
16238         ;;
16239 esac
16240
16241 : see if readdir_r exists
16242 set readdir_r d_readdir_r
16243 eval $inlibc
16244 case "$d_readdir_r" in
16245 "$define")
16246         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16247         case "$d_readdir_r_proto:$usethreads" in
16248         ":define")      d_readdir_r_proto=define
16249                 set d_readdir_r_proto readdir_r $hdrs
16250                 eval $hasproto ;;
16251         *)      ;;
16252         esac
16253         case "$d_readdir_r_proto" in
16254         define)
16255         case "$readdir_r_proto" in
16256         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16257         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16258         esac
16259         case "$readdir_r_proto" in
16260         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16261         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16262         esac
16263         case "$readdir_r_proto" in
16264         ''|0)   d_readdir_r=undef
16265                 readdir_r_proto=0
16266                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16267         * )     case "$readdir_r_proto" in
16268                 REENTRANT_PROTO*) ;;
16269                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16270                 esac
16271                 echo "Prototype: $try" ;;
16272         esac
16273         ;;
16274         *)      case "$usethreads" in
16275                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16276                 esac
16277                 d_readdir_r=undef
16278                 readdir_r_proto=0
16279                 ;;
16280         esac
16281         ;;
16282 *)      readdir_r_proto=0
16283         ;;
16284 esac
16285
16286 : see if readv exists
16287 set readv d_readv
16288 eval $inlibc
16289
16290 : see if recvmsg exists
16291 set recvmsg d_recvmsg
16292 eval $inlibc
16293
16294 : see if rename exists
16295 set rename d_rename
16296 eval $inlibc
16297
16298 : see if rmdir exists
16299 set rmdir d_rmdir
16300 eval $inlibc
16301
16302 : see if memory.h is available.
16303 val=''
16304 set memory.h val
16305 eval $inhdr
16306
16307 : See if it conflicts with string.h
16308 case "$val" in
16309 $define)
16310         case "$strings" in
16311         '') ;;
16312         *)
16313                 $cppstdin $cppflags $cppminus < $strings > mem.h
16314                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16315                         echo " "
16316                         echo "We won't be including <memory.h>."
16317                         val="$undef"
16318                 fi
16319                 $rm -f mem.h
16320                 ;;
16321         esac
16322 esac
16323 set i_memory
16324 eval $setvar
16325
16326 : can bcopy handle overlapping blocks?
16327 echo " "
16328 val="$undef"
16329 case "$d_memmove" in
16330 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16331 *)      case "$d_bcopy" in
16332         "$define")
16333                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16334                 $cat >try.c <<EOCP
16335 #$i_memory I_MEMORY
16336 #$i_stdlib I_STDLIB
16337 #$i_string I_STRING
16338 #$i_unistd I_UNISTD
16339 EOCP
16340         $cat >>try.c <<'EOCP'
16341 #include <stdio.h>
16342 #ifdef I_MEMORY
16343 #  include <memory.h>
16344 #endif
16345 #ifdef I_STDLIB
16346 #  include <stdlib.h>
16347 #endif
16348 #ifdef I_STRING
16349 #  include <string.h>
16350 #else
16351 #  include <strings.h>
16352 #endif
16353 #ifdef I_UNISTD
16354 #  include <unistd.h>  /* Needed for NetBSD */
16355 #endif
16356 int main()
16357 {
16358 char buf[128], abc[128];
16359 char *b;
16360 int len;
16361 int off;
16362 int align;
16363
16364 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16365    try to store the string in read-only memory. */
16366 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16367
16368 for (align = 7; align >= 0; align--) {
16369         for (len = 36; len; len--) {
16370                 b = buf+align;
16371                 bcopy(abc, b, len);
16372                 for (off = 1; off <= len; off++) {
16373                         bcopy(b, b+off, len);
16374                         bcopy(b+off, b, len);
16375                         if (bcmp(b, abc, len))
16376                                 exit(1);
16377                 }
16378         }
16379 }
16380 exit(0);
16381 }
16382 EOCP
16383                 set try
16384                 if eval $compile_ok; then
16385                         if $run ./try 2>/dev/null; then
16386                                 echo "Yes, it can."
16387                                 val="$define"
16388                         else
16389                                 echo "It can't, sorry."
16390                         fi
16391                 else
16392                         echo "(I can't compile the test program, so we'll assume not...)"
16393                 fi
16394                 ;;
16395         esac
16396         $rm_try
16397         ;;
16398 esac
16399 set d_safebcpy
16400 eval $setvar
16401
16402 : can memcpy handle overlapping blocks?
16403 echo " "
16404 val="$undef"
16405 case "$d_memmove" in
16406 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16407 *)      case "$d_memcpy" in
16408         "$define")
16409                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16410                 $cat >try.c <<EOCP
16411 #$i_memory I_MEMORY
16412 #$i_stdlib I_STDLIB
16413 #$i_string I_STRING
16414 #$i_unistd I_UNISTD
16415 EOCP
16416         $cat >>try.c <<'EOCP'
16417 #include <stdio.h>
16418 #ifdef I_MEMORY
16419 #  include <memory.h>
16420 #endif
16421 #ifdef I_STDLIB
16422 #  include <stdlib.h>
16423 #endif
16424 #ifdef I_STRING
16425 #  include <string.h>
16426 #else
16427 #  include <strings.h>
16428 #endif
16429 #ifdef I_UNISTD
16430 #  include <unistd.h>  /* Needed for NetBSD */
16431 #endif
16432 int main()
16433 {
16434 char buf[128], abc[128];
16435 char *b;
16436 int len;
16437 int off;
16438 int align;
16439
16440 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16441    try to store the string in read-only memory. */
16442 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16443
16444 for (align = 7; align >= 0; align--) {
16445         for (len = 36; len; len--) {
16446                 b = buf+align;
16447                 memcpy(b, abc, len);
16448                 for (off = 1; off <= len; off++) {
16449                         memcpy(b+off, b, len);
16450                         memcpy(b, b+off, len);
16451                         if (memcmp(b, abc, len))
16452                                 exit(1);
16453                 }
16454         }
16455 }
16456 exit(0);
16457 }
16458 EOCP
16459                 set try
16460                 if eval $compile_ok; then
16461                         if $run ./try 2>/dev/null; then
16462                                 echo "Yes, it can."
16463                                 val="$define"
16464                         else
16465                                 echo "It can't, sorry."
16466                         fi
16467                 else
16468                         echo "(I can't compile the test program, so we'll assume not...)"
16469                 fi
16470                 ;;
16471         esac
16472         $rm_try
16473         ;;
16474 esac
16475 set d_safemcpy
16476 eval $setvar
16477
16478 : can memcmp be trusted to compare relative magnitude?
16479 val="$undef"
16480 case "$d_memcmp" in
16481 "$define")
16482         echo " "
16483         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16484         $cat >try.c <<EOCP
16485 #$i_memory I_MEMORY
16486 #$i_stdlib I_STDLIB
16487 #$i_string I_STRING
16488 #$i_unistd I_UNISTD
16489 EOCP
16490         $cat >>try.c <<'EOCP'
16491 #include <stdio.h>
16492 #ifdef I_MEMORY
16493 #  include <memory.h>
16494 #endif
16495 #ifdef I_STDLIB
16496 #  include <stdlib.h>
16497 #endif
16498 #ifdef I_STRING
16499 #  include <string.h>
16500 #else
16501 #  include <strings.h>
16502 #endif
16503 #ifdef I_UNISTD
16504 #  include <unistd.h>  /* Needed for NetBSD */
16505 #endif
16506 int main()
16507 {
16508 char a = -1;
16509 char b = 0;
16510 if ((a < b) && memcmp(&a, &b, 1) < 0)
16511         exit(1);
16512 exit(0);
16513 }
16514 EOCP
16515         set try
16516         if eval $compile_ok; then
16517                 if $run ./try 2>/dev/null; then
16518                         echo "Yes, it can."
16519                         val="$define"
16520                 else
16521                         echo "No, it can't (it uses signed chars)."
16522                 fi
16523         else
16524                 echo "(I can't compile the test program, so we'll assume not...)"
16525         fi
16526         ;;
16527 esac
16528 $rm_try
16529 set d_sanemcmp
16530 eval $setvar
16531
16532 : see if prototype for sbrk is available
16533 echo " "
16534 set d_sbrkproto sbrk $i_unistd unistd.h
16535 eval $hasproto
16536
16537 : see if select exists
16538 set select d_select
16539 eval $inlibc
16540
16541 : see if semctl exists
16542 set semctl d_semctl
16543 eval $inlibc
16544
16545 : see if semget exists
16546 set semget d_semget
16547 eval $inlibc
16548
16549 : see if semop exists
16550 set semop d_semop
16551 eval $inlibc
16552
16553 : see how much of the 'sem*(2)' library is present.
16554 h_sem=true
16555 echo " "
16556 case "$d_semctl$d_semget$d_semop" in
16557 *"$undef"*) h_sem=false;;
16558 esac
16559 case "$osname" in
16560 freebsd)
16561     case "`ipcs 2>&1`" in
16562     "SVID messages"*"not configured"*)
16563         echo "Your $osname does not have the sem*(2) configured." >&4
16564         h_sem=false
16565         val="$undef"
16566         set semctl d_semctl
16567         eval $setvar
16568         set semget d_semget
16569         eval $setvar
16570         set semop d_semop
16571         eval $setvar
16572         ;;
16573     esac
16574     ;;
16575 esac
16576 : we could also check for sys/ipc.h ...
16577 if $h_sem && $test `./findhdr sys/sem.h`; then
16578         echo "You have the full sem*(2) library." >&4
16579         val="$define"
16580 else
16581         echo "You don't have the full sem*(2) library." >&4
16582         val="$undef"
16583 fi
16584 set d_sem
16585 eval $setvar
16586
16587 : see whether sys/sem.h defines union semun
16588 echo " "
16589 $cat > try.c <<'END'
16590 #include <sys/types.h>
16591 #include <sys/ipc.h>
16592 #include <sys/sem.h>
16593 int main () { union semun semun; semun.buf = 0; }
16594 END
16595 set try
16596 if eval $compile; then
16597     echo "You have union semun in <sys/sem.h>." >&4
16598     val="$define"
16599 else
16600     echo "You do not have union semun in <sys/sem.h>." >&4
16601     val="$undef"
16602 fi
16603 $rm_try
16604 set d_union_semun
16605 eval $setvar
16606
16607 : see how to do semctl IPC_STAT
16608 case "$d_sem" in
16609 $define)
16610     echo " "
16611     $cat > tryh.h <<END
16612 #ifndef S_IRUSR
16613 #   ifdef S_IREAD
16614 #       define S_IRUSR S_IREAD
16615 #       define S_IWUSR S_IWRITE
16616 #       define S_IXUSR S_IEXEC
16617 #   else
16618 #       define S_IRUSR 0400
16619 #       define S_IWUSR 0200
16620 #       define S_IXUSR 0100
16621 #   endif
16622 #   define S_IRGRP (S_IRUSR>>3)
16623 #   define S_IWGRP (S_IWUSR>>3)
16624 #   define S_IXGRP (S_IXUSR>>3)
16625 #   define S_IROTH (S_IRUSR>>6)
16626 #   define S_IWOTH (S_IWUSR>>6)
16627 #   define S_IXOTH (S_IXUSR>>6)
16628 #endif
16629 #ifndef S_IRWXU
16630 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16631 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16632 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16633 #endif
16634 END
16635     : see whether semctl IPC_STAT can use union semun
16636     case "$d_semctl_semun" in
16637     '')
16638       val="$undef"
16639       $cat > try.c <<END
16640 #include <sys/types.h>
16641 #include <sys/ipc.h>
16642 #include <sys/sem.h>
16643 #include <sys/stat.h>
16644 #include <stdio.h>
16645 #include <errno.h>
16646 #include "tryh.h"
16647 #ifndef errno
16648 extern int errno;
16649 #endif
16650 #$d_union_semun HAS_UNION_SEMUN
16651 int main() {
16652     union semun
16653 #ifndef HAS_UNION_SEMUN
16654     {
16655         int val;
16656         struct semid_ds *buf;
16657         unsigned short *array;
16658     }
16659 #endif
16660     arg;
16661     int sem, st;
16662
16663 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16664     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16665     if (sem > -1) {
16666         struct semid_ds argbuf;
16667         arg.buf = &argbuf;
16668 #       ifdef IPC_STAT
16669         st = semctl(sem, 0, IPC_STAT, arg);
16670         if (st == 0)
16671             printf("semun\n");
16672         else
16673 #       endif /* IPC_STAT */
16674             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16675 #       ifdef IPC_RMID
16676         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16677 #       endif /* IPC_RMID */
16678             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16679     } else
16680 #endif /* IPC_PRIVATE && ... */
16681         printf("semget failed: errno = %d\n", errno);
16682   return 0;
16683 }
16684 END
16685       set try
16686       if eval $compile; then
16687           xxx=`$run ./try`
16688           case "$xxx" in
16689           semun) val="$define" ;;
16690           esac
16691       fi
16692       $rm_try
16693       set d_semctl_semun
16694       eval $setvar
16695       ;;
16696     esac
16697     case "$d_semctl_semun" in
16698     $define)
16699         echo "You can use union semun for semctl IPC_STAT." >&4
16700         also='also'
16701         ;;
16702     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16703         also=''
16704         ;;
16705     esac
16706
16707     : see whether semctl IPC_STAT can use struct semid_ds pointer
16708     case "$d_semctl_semid_ds" in
16709     '')
16710       val="$undef"
16711       $cat > try.c <<'END'
16712 #include <sys/types.h>
16713 #include <sys/ipc.h>
16714 #include <sys/sem.h>
16715 #include <sys/stat.h>
16716 #include "tryh.h"
16717 #include <stdio.h>
16718 #include <errno.h>
16719 #ifndef errno
16720 extern int errno;
16721 #endif
16722 int main() {
16723     struct semid_ds arg;
16724     int sem, st;
16725
16726 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16727     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16728     if (sem > -1) {
16729 #       ifdef IPC_STAT
16730         st = semctl(sem, 0, IPC_STAT, &arg);
16731         if (st == 0)
16732             printf("semid_ds\n");
16733         else
16734 #       endif /* IPC_STAT */
16735             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16736 #       ifdef IPC_RMID
16737         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16738 #       endif /* IPC_RMID */
16739             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16740     } else
16741 #endif /* IPC_PRIVATE && ... */
16742         printf("semget failed: errno = %d\n", errno);
16743
16744     return 0;
16745 }
16746 END
16747       set try
16748       if eval $compile; then
16749           xxx=`$run ./try`
16750           case "$xxx" in
16751           semid_ds) val="$define" ;;
16752           esac
16753       fi
16754       $rm_try
16755       set d_semctl_semid_ds
16756       eval $setvar
16757       ;;
16758     esac
16759     case "$d_semctl_semid_ds" in
16760     $define)
16761         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16762         ;;
16763     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16764         ;;
16765     esac
16766     ;;
16767 *)  val="$undef"
16768
16769     # We do not have the full sem*(2) library, so assume we can not
16770     # use either.
16771
16772     set d_semctl_semun
16773     eval $setvar
16774
16775     set d_semctl_semid_ds
16776     eval $setvar
16777     ;;
16778 esac
16779 $rm_try tryh.h
16780
16781 : see if sendmsg exists
16782 set sendmsg d_sendmsg
16783 eval $inlibc
16784
16785 : see if setegid exists
16786 set setegid d_setegid
16787 eval $inlibc
16788
16789 : see if seteuid exists
16790 set seteuid d_seteuid
16791 eval $inlibc
16792
16793 : see if setgrent exists
16794 set setgrent d_setgrent
16795 eval $inlibc
16796
16797 : see if setgrent_r exists
16798 set setgrent_r d_setgrent_r
16799 eval $inlibc
16800 case "$d_setgrent_r" in
16801 "$define")
16802         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16803         case "$d_setgrent_r_proto:$usethreads" in
16804         ":define")      d_setgrent_r_proto=define
16805                 set d_setgrent_r_proto setgrent_r $hdrs
16806                 eval $hasproto ;;
16807         *)      ;;
16808         esac
16809         case "$d_setgrent_r_proto" in
16810         define)
16811         case "$setgrent_r_proto" in
16812         ''|0) try='int setgrent_r(FILE**);'
16813         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
16814         esac
16815         case "$setgrent_r_proto" in
16816         ''|0) try='void setgrent_r(FILE**);'
16817         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
16818         esac
16819         case "$setgrent_r_proto" in
16820         ''|0)   d_setgrent_r=undef
16821                 setgrent_r_proto=0
16822                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16823         * )     case "$setgrent_r_proto" in
16824                 REENTRANT_PROTO*) ;;
16825                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16826                 esac
16827                 echo "Prototype: $try" ;;
16828         esac
16829         ;;
16830         *)      case "$usethreads" in
16831                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16832                 esac
16833                 d_setgrent_r=undef
16834                 setgrent_r_proto=0
16835                 ;;
16836         esac
16837         ;;
16838 *)      setgrent_r_proto=0
16839         ;;
16840 esac
16841
16842 : see if sethostent exists
16843 set sethostent d_sethent
16844 eval $inlibc
16845
16846 : see if sethostent_r exists
16847 set sethostent_r d_sethostent_r
16848 eval $inlibc
16849 case "$d_sethostent_r" in
16850 "$define")
16851         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16852         case "$d_sethostent_r_proto:$usethreads" in
16853         ":define")      d_sethostent_r_proto=define
16854                 set d_sethostent_r_proto sethostent_r $hdrs
16855                 eval $hasproto ;;
16856         *)      ;;
16857         esac
16858         case "$d_sethostent_r_proto" in
16859         define)
16860         case "$sethostent_r_proto" in
16861         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16862         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
16863         esac
16864         case "$sethostent_r_proto" in
16865         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16866         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
16867         esac
16868         case "$sethostent_r_proto" in
16869         ''|0)   d_sethostent_r=undef
16870                 sethostent_r_proto=0
16871                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16872         * )     case "$sethostent_r_proto" in
16873                 REENTRANT_PROTO*) ;;
16874                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16875                 esac
16876                 echo "Prototype: $try" ;;
16877         esac
16878         ;;
16879         *)      case "$usethreads" in
16880                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16881                 esac
16882                 d_sethostent_r=undef
16883                 sethostent_r_proto=0
16884                 ;;
16885         esac
16886         ;;
16887 *)      sethostent_r_proto=0
16888         ;;
16889 esac
16890
16891 : see if setitimer exists
16892 set setitimer d_setitimer
16893 eval $inlibc
16894
16895 : see if setlinebuf exists
16896 set setlinebuf d_setlinebuf
16897 eval $inlibc
16898
16899 : see if setlocale exists
16900 set setlocale d_setlocale
16901 eval $inlibc
16902
16903 : see if locale.h is available
16904 set locale.h i_locale
16905 eval $inhdr
16906
16907 : see if setlocale_r exists
16908 set setlocale_r d_setlocale_r
16909 eval $inlibc
16910 case "$d_setlocale_r" in
16911 "$define")
16912         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16913         case "$d_setlocale_r_proto:$usethreads" in
16914         ":define")      d_setlocale_r_proto=define
16915                 set d_setlocale_r_proto setlocale_r $hdrs
16916                 eval $hasproto ;;
16917         *)      ;;
16918         esac
16919         case "$d_setlocale_r_proto" in
16920         define)
16921         case "$setlocale_r_proto" in
16922         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16923         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16924         esac
16925         case "$setlocale_r_proto" in
16926         ''|0)   d_setlocale_r=undef
16927                 setlocale_r_proto=0
16928                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16929         * )     case "$setlocale_r_proto" in
16930                 REENTRANT_PROTO*) ;;
16931                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16932                 esac
16933                 echo "Prototype: $try" ;;
16934         esac
16935         ;;
16936         *)      case "$usethreads" in
16937                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16938                 esac
16939                 d_setlocale_r=undef
16940                 setlocale_r_proto=0
16941                 ;;
16942         esac
16943         ;;
16944 *)      setlocale_r_proto=0
16945         ;;
16946 esac
16947
16948 : see if setnetent exists
16949 set setnetent d_setnent
16950 eval $inlibc
16951
16952 : see if setnetent_r exists
16953 set setnetent_r d_setnetent_r
16954 eval $inlibc
16955 case "$d_setnetent_r" in
16956 "$define")
16957         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16958         case "$d_setnetent_r_proto:$usethreads" in
16959         ":define")      d_setnetent_r_proto=define
16960                 set d_setnetent_r_proto setnetent_r $hdrs
16961                 eval $hasproto ;;
16962         *)      ;;
16963         esac
16964         case "$d_setnetent_r_proto" in
16965         define)
16966         case "$setnetent_r_proto" in
16967         ''|0) try='int setnetent_r(int, struct netent_data*);'
16968         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
16969         esac
16970         case "$setnetent_r_proto" in
16971         ''|0) try='void setnetent_r(int, struct netent_data*);'
16972         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
16973         esac
16974         case "$setnetent_r_proto" in
16975         ''|0)   d_setnetent_r=undef
16976                 setnetent_r_proto=0
16977                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16978         * )     case "$setnetent_r_proto" in
16979                 REENTRANT_PROTO*) ;;
16980                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16981                 esac
16982                 echo "Prototype: $try" ;;
16983         esac
16984         ;;
16985         *)      case "$usethreads" in
16986                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16987                 esac
16988                 d_setnetent_r=undef
16989                 setnetent_r_proto=0
16990                 ;;
16991         esac
16992         ;;
16993 *)      setnetent_r_proto=0
16994         ;;
16995 esac
16996
16997 : see if setprotoent exists
16998 set setprotoent d_setpent
16999 eval $inlibc
17000
17001 : see if setpgid exists
17002 set setpgid d_setpgid
17003 eval $inlibc
17004
17005 : see if setpgrp2 exists
17006 set setpgrp2 d_setpgrp2
17007 eval $inlibc
17008
17009 : see if setpriority exists
17010 set setpriority d_setprior
17011 eval $inlibc
17012
17013 : see if setproctitle exists
17014 set setproctitle d_setproctitle
17015 eval $inlibc
17016
17017 : see if setprotoent_r exists
17018 set setprotoent_r d_setprotoent_r
17019 eval $inlibc
17020 case "$d_setprotoent_r" in
17021 "$define")
17022         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17023         case "$d_setprotoent_r_proto:$usethreads" in
17024         ":define")      d_setprotoent_r_proto=define
17025                 set d_setprotoent_r_proto setprotoent_r $hdrs
17026                 eval $hasproto ;;
17027         *)      ;;
17028         esac
17029         case "$d_setprotoent_r_proto" in
17030         define)
17031         case "$setprotoent_r_proto" in
17032         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17033         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17034         esac
17035         case "$setprotoent_r_proto" in
17036         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17037         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17038         esac
17039         case "$setprotoent_r_proto" in
17040         ''|0)   d_setprotoent_r=undef
17041                 setprotoent_r_proto=0
17042                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17043         * )     case "$setprotoent_r_proto" in
17044                 REENTRANT_PROTO*) ;;
17045                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17046                 esac
17047                 echo "Prototype: $try" ;;
17048         esac
17049         ;;
17050         *)      case "$usethreads" in
17051                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17052                 esac
17053                 d_setprotoent_r=undef
17054                 setprotoent_r_proto=0
17055                 ;;
17056         esac
17057         ;;
17058 *)      setprotoent_r_proto=0
17059         ;;
17060 esac
17061
17062 : see if setpwent exists
17063 set setpwent d_setpwent
17064 eval $inlibc
17065
17066 : see if setpwent_r exists
17067 set setpwent_r d_setpwent_r
17068 eval $inlibc
17069 case "$d_setpwent_r" in
17070 "$define")
17071         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17072         case "$d_setpwent_r_proto:$usethreads" in
17073         ":define")      d_setpwent_r_proto=define
17074                 set d_setpwent_r_proto setpwent_r $hdrs
17075                 eval $hasproto ;;
17076         *)      ;;
17077         esac
17078         case "$d_setpwent_r_proto" in
17079         define)
17080         case "$setpwent_r_proto" in
17081         ''|0) try='int setpwent_r(FILE**);'
17082         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17083         esac
17084         case "$setpwent_r_proto" in
17085         ''|0) try='void setpwent_r(FILE**);'
17086         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17087         esac
17088         case "$setpwent_r_proto" in
17089         ''|0)   d_setpwent_r=undef
17090                 setpwent_r_proto=0
17091                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17092         * )     case "$setpwent_r_proto" in
17093                 REENTRANT_PROTO*) ;;
17094                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17095                 esac
17096                 echo "Prototype: $try" ;;
17097         esac
17098         ;;
17099         *)      case "$usethreads" in
17100                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17101                 esac
17102                 d_setpwent_r=undef
17103                 setpwent_r_proto=0
17104                 ;;
17105         esac
17106         ;;
17107 *)      setpwent_r_proto=0
17108         ;;
17109 esac
17110
17111 : see if setregid exists
17112 set setregid d_setregid
17113 eval $inlibc
17114 set setresgid d_setresgid
17115 eval $inlibc
17116
17117 : see if setreuid exists
17118 set setreuid d_setreuid
17119 eval $inlibc
17120 set setresuid d_setresuid
17121 eval $inlibc
17122
17123 : see if setrgid exists
17124 set setrgid d_setrgid
17125 eval $inlibc
17126
17127 : see if setruid exists
17128 set setruid d_setruid
17129 eval $inlibc
17130
17131 : see if setservent exists
17132 set setservent d_setsent
17133 eval $inlibc
17134
17135 : see if setservent_r exists
17136 set setservent_r d_setservent_r
17137 eval $inlibc
17138 case "$d_setservent_r" in
17139 "$define")
17140         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17141         case "$d_setservent_r_proto:$usethreads" in
17142         ":define")      d_setservent_r_proto=define
17143                 set d_setservent_r_proto setservent_r $hdrs
17144                 eval $hasproto ;;
17145         *)      ;;
17146         esac
17147         case "$d_setservent_r_proto" in
17148         define)
17149         case "$setservent_r_proto" in
17150         ''|0) try='int setservent_r(int, struct servent_data*);'
17151         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17152         esac
17153         case "$setservent_r_proto" in
17154         ''|0) try='void setservent_r(int, struct servent_data*);'
17155         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17156         esac
17157         case "$setservent_r_proto" in
17158         ''|0)   d_setservent_r=undef
17159                 setservent_r_proto=0
17160                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17161         * )     case "$setservent_r_proto" in
17162                 REENTRANT_PROTO*) ;;
17163                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17164                 esac
17165                 echo "Prototype: $try" ;;
17166         esac
17167         ;;
17168         *)      case "$usethreads" in
17169                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17170                 esac
17171                 d_setservent_r=undef
17172                 setservent_r_proto=0
17173                 ;;
17174         esac
17175         ;;
17176 *)      setservent_r_proto=0
17177         ;;
17178 esac
17179
17180 : see if setsid exists
17181 set setsid d_setsid
17182 eval $inlibc
17183
17184 : see if setvbuf exists
17185 set setvbuf d_setvbuf
17186 eval $inlibc
17187
17188 : see if sfio.h is available
17189 set sfio.h i_sfio
17190 eval $inhdr
17191
17192 : see if sfio library is available
17193 case "$i_sfio" in
17194 $define)
17195         val=''
17196         set sfreserve val
17197         eval $inlibc
17198         ;;
17199 *)
17200         val="$undef"
17201         ;;
17202 esac
17203 : Ok, but do we want to use it.
17204 case "$val" in
17205 $define)
17206         case "$usesfio" in
17207         true|$define|[yY]*) dflt='y';;
17208         *) dflt='n';;
17209         esac
17210         echo "$package can use the sfio library, but it is experimental."
17211         case "$useperlio" in
17212         "$undef")
17213             echo "For sfio also the PerlIO abstraction layer is needed."
17214             echo "Earlier you said you wouldn't want that."
17215             ;;
17216         esac
17217         rp="You seem to have sfio available, do you want to try using it?"
17218         . ./myread
17219         case "$ans" in
17220         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17221                 useperlio="$define"
17222                 val="$define"
17223                 ;;
17224         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17225                 val="$undef"
17226                 ;;
17227         esac
17228         ;;
17229 *)      case "$usesfio" in
17230         true|$define|[yY]*)
17231                 echo "Sorry, cannot find sfio on this machine." >&4
17232                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17233                 val="$undef"
17234                 ;;
17235         esac
17236         ;;
17237 esac
17238 set d_sfio
17239 eval $setvar
17240 case "$d_sfio" in
17241 $define) usesfio='true';;
17242 *) usesfio='false';;
17243 esac
17244 case "$d_sfio" in
17245 $define) ;;
17246 *)      : Remove sfio from list of libraries to use
17247         case "$libs" in
17248         *-lsfio*)
17249                 echo "Removing unneeded -lsfio from library list" >&4
17250                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17251                 shift
17252                 libs="$*"
17253                 echo "libs = $libs" >&4
17254                 ;;
17255         esac
17256 ;;
17257 esac
17258
17259
17260 : see if shmctl exists
17261 set shmctl d_shmctl
17262 eval $inlibc
17263
17264 : see if shmget exists
17265 set shmget d_shmget
17266 eval $inlibc
17267
17268 : see if shmat exists
17269 set shmat d_shmat
17270 eval $inlibc
17271 : see what shmat returns
17272 case "$d_shmat" in
17273 "$define")
17274         $cat >shmat.c <<'END'
17275 #include <sys/shm.h>
17276 void *shmat();
17277 END
17278         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17279                 shmattype='void *'
17280         else
17281                 shmattype='char *'
17282         fi
17283         echo "and it returns ($shmattype)." >&4
17284         : see if a prototype for shmat is available
17285         xxx=`./findhdr sys/shm.h`
17286         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17287         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17288                 val="$define"
17289         else
17290                 val="$undef"
17291         fi
17292         $rm -f shmat.[co]
17293         ;;
17294 *)
17295         val="$undef"
17296         ;;
17297 esac
17298 set d_shmatprototype
17299 eval $setvar
17300
17301 : see if shmdt exists
17302 set shmdt d_shmdt
17303 eval $inlibc
17304
17305 : see how much of the 'shm*(2)' library is present.
17306 h_shm=true
17307 echo " "
17308 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17309 *"$undef"*) h_shm=false;;
17310 esac
17311 case "$osname" in
17312 freebsd)
17313     case "`ipcs 2>&1`" in
17314     "SVID shared memory"*"not configured"*)
17315         echo "Your $osname does not have the shm*(2) configured." >&4
17316         h_shm=false
17317         val="$undef"
17318         set shmctl d_shmctl
17319         evat $setvar
17320         set shmget d_shmget
17321         evat $setvar
17322         set shmat d_shmat
17323         evat $setvar
17324         set shmdt d_shmdt
17325         evat $setvar
17326         ;;
17327     esac
17328     ;;
17329 esac
17330 : we could also check for sys/ipc.h ...
17331 if $h_shm && $test `./findhdr sys/shm.h`; then
17332         echo "You have the full shm*(2) library." >&4
17333         val="$define"
17334 else
17335         echo "You don't have the full shm*(2) library." >&4
17336         val="$undef"
17337 fi
17338 set d_shm
17339 eval $setvar
17340
17341 : see if we have sigaction
17342 echo " "
17343 if set sigaction val -f d_sigaction; eval $csym; $val; then
17344         echo 'sigaction() found.' >&4
17345         $cat > try.c <<EOP
17346 #include <stdio.h>
17347 #include <sys/types.h>
17348 #include <signal.h>
17349 #$i_stdlib I_STDLIB
17350 #ifdef I_STDLIB
17351 #include <stdlib.h>
17352 #endif
17353 int main()
17354 {
17355     struct sigaction act, oact;
17356     act.sa_flags = 0;
17357     oact.sa_handler = 0;
17358     /* so that act and oact are used */
17359     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17360 }
17361 EOP
17362         set try
17363         if eval $compile_ok; then
17364                 val="$define"
17365         else
17366                 echo "But you don't seem to have a useable struct sigaction." >&4
17367                 val="$undef"
17368         fi
17369 else
17370         echo 'sigaction NOT found.' >&4
17371         val="$undef"
17372 fi
17373 set d_sigaction; eval $setvar
17374 $rm_try
17375
17376 : see if this is a sunmath.h system
17377 set sunmath.h i_sunmath
17378 eval $inhdr
17379
17380 : see if signbit exists
17381 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17382 $cat >try.c <<EOCP
17383 #$i_math I_MATH
17384 #$i_sunmath I_SUNMATH
17385 #ifdef I_MATH
17386 #  include <math.h>
17387 #endif
17388 #ifdef I_SUNMATH  /* Solaris special math library */
17389 #  include <sunmath.h>
17390 #endif
17391 #define NV $nvtype
17392 int main(int argc, char **argv)
17393 {
17394     NV x = 0.0;
17395     NV y = -0.0;
17396     if ((signbit(x) == 0) && (signbit(y) != 0))
17397         return 0;
17398     else
17399         return 1;
17400 }
17401 EOCP
17402 val="$undef"
17403 set try
17404 if eval $compile; then
17405     if $run ./try; then
17406         $echo "Yes." >&4
17407         val="$define"
17408     else
17409         $echo "Signbit seems to be available, but doesn't work as I expected."
17410         $echo "I won't use it." >&4
17411         val="$undef"
17412     fi
17413 else
17414     $echo "Nope." >&4
17415     dflt="$undef"
17416 fi
17417 set d_signbit
17418 eval $setvar
17419 $rm_try
17420
17421 : see if sigprocmask exists
17422 set sigprocmask d_sigprocmask
17423 eval $inlibc
17424
17425 : see if sigsetjmp exists
17426 echo " "
17427 case "$d_sigsetjmp" in
17428 '')
17429         $cat >try.c <<EOP
17430 #include <setjmp.h>
17431 #$i_stdlib I_STDLIB
17432 #ifdef I_STDLIB
17433 #include <stdlib.h>
17434 #endif
17435 sigjmp_buf env;
17436 int set = 1;
17437 int main()
17438 {
17439         if (sigsetjmp(env,1))
17440                 exit(set);
17441         set = 0;
17442         siglongjmp(env, 1);
17443         exit(1);
17444 }
17445 EOP
17446         set try
17447         if eval $compile; then
17448                 if $run ./try >/dev/null 2>&1; then
17449                         echo "POSIX sigsetjmp found." >&4
17450                         val="$define"
17451                 else
17452                         $cat >&4 <<EOM
17453 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17454 I'll ignore them.
17455 EOM
17456                         val="$undef"
17457                 fi
17458         else
17459                 echo "sigsetjmp not found." >&4
17460                 val="$undef"
17461         fi
17462         ;;
17463 *) val="$d_sigsetjmp"
17464         case "$d_sigsetjmp" in
17465         $define) echo "POSIX sigsetjmp found." >&4;;
17466         $undef) echo "sigsetjmp not found." >&4;;
17467         esac
17468         ;;
17469 esac
17470 set d_sigsetjmp
17471 eval $setvar
17472 $rm_try
17473
17474 : see if snprintf exists
17475 set snprintf d_snprintf
17476 eval $inlibc
17477
17478 : see if vsnprintf exists
17479 set vsnprintf d_vsnprintf
17480 eval $inlibc
17481
17482 case "$d_snprintf-$d_vsnprintf" in
17483 "$define-$define")
17484     $cat <<EOM
17485 Checking whether your snprintf() and vsnprintf() work okay...
17486 EOM
17487     $cat >try.c <<'EOCP'
17488 /* v?snprintf testing logic courtesy of Russ Allbery.
17489  * According to C99:
17490  * - if the buffer is too short it still must be \0-terminated
17491  * - if the buffer is too short the potentially required length
17492  *   must be returned and not -1
17493  * - if the buffer is NULL the potentially required length
17494  *   must be returned and not -1 or core dump
17495  */
17496 #include <stdio.h>
17497 #include <stdarg.h>
17498
17499 char buf[2];
17500
17501 int test (char *format, ...)
17502 {
17503     va_list args;
17504     int count;
17505
17506     va_start (args, format);
17507     count = vsnprintf (buf, sizeof buf, format, args);
17508     va_end (args);
17509     return count;
17510 }
17511
17512 int main ()
17513 {
17514     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17515              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17516 }
17517 EOCP
17518     set try
17519     if eval $compile; then
17520         `$run ./try`
17521         case "$?" in
17522         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17523         *) cat <<EOM >&4
17524 Your snprintf() and snprintf() don't seem to be working okay.
17525 EOM
17526            d_snprintf="$undef"
17527            d_vsnprintf="$undef"
17528            ;;
17529         esac
17530     else
17531         echo "(I can't seem to compile the test program--assuming they don't)"
17532         d_snprintf="$undef"
17533         d_vsnprintf="$undef"
17534     fi
17535     $rm_try
17536     ;;
17537 esac
17538
17539 : see if sockatmark exists
17540 set sockatmark d_sockatmark
17541 eval $inlibc
17542
17543 : see if prototype for sockatmark is available
17544 echo " "
17545 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17546 eval $hasproto
17547
17548 : see if socks5_init exists
17549 set socks5_init d_socks5_init
17550 eval $inlibc
17551
17552 : see if sprintf returns the length of the string in the buffer as per ANSI
17553 $echo "Checking whether sprintf returns the length of the string..." >&4
17554 $cat <<EOP >try.c
17555 #include <stdio.h>
17556 #$i_stdlib I_STDLIB
17557 #ifdef I_STDLIB
17558 #include <stdlib.h>
17559 #endif
17560 #$i_string I_STRING
17561 #ifdef I_STRING
17562 #  include <string.h>
17563 #else
17564 #  include <strings.h>
17565 #endif
17566 #$i_math I_MATH
17567 #ifdef I_MATH
17568 #include <math.h>
17569 #endif
17570
17571 char buffer[256];
17572
17573 int check (size_t expect, int test) {
17574   size_t got = strlen(buffer);
17575   if (expect == got)
17576     return 0;
17577
17578   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17579        test, buffer);
17580   exit (test);
17581 }
17582
17583 int main(int argc, char **argv) {
17584   int test = 0;
17585
17586   check(sprintf(buffer, ""), ++test);
17587   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17588   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17589
17590   return 0;
17591 }
17592 EOP
17593 set try
17594
17595 if eval $compile; then
17596     xxx="`$run ./try`"
17597     case "$?" in
17598         0) cat >&4 <<EOM
17599 sprintf returns the length of the string (as ANSI says it should)
17600 EOM
17601         d_sprintf_returns_strlen="$define"
17602         ;;
17603         *) cat >&4 <<EOM
17604 sprintf does not return the length of the string (how old is this system?)
17605 EOM
17606         d_sprintf_returns_strlen="$undef"
17607         ;;
17608     esac
17609 else
17610     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17611     d_sprintf_returns_strlen="$undef"
17612 fi
17613 $rm_try
17614
17615 : see if srand48_r exists
17616 set srand48_r d_srand48_r
17617 eval $inlibc
17618 case "$d_srand48_r" in
17619 "$define")
17620         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17621         case "$d_srand48_r_proto:$usethreads" in
17622         ":define")      d_srand48_r_proto=define
17623                 set d_srand48_r_proto srand48_r $hdrs
17624                 eval $hasproto ;;
17625         *)      ;;
17626         esac
17627         case "$d_srand48_r_proto" in
17628         define)
17629         case "$srand48_r_proto" in
17630         ''|0) try='int srand48_r(long, struct drand48_data*);'
17631         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17632         esac
17633         case "$srand48_r_proto" in
17634         ''|0)   d_srand48_r=undef
17635                 srand48_r_proto=0
17636                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17637         * )     case "$srand48_r_proto" in
17638                 REENTRANT_PROTO*) ;;
17639                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17640                 esac
17641                 echo "Prototype: $try" ;;
17642         esac
17643         ;;
17644         *)      case "$usethreads" in
17645                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17646                 esac
17647                 d_srand48_r=undef
17648                 srand48_r_proto=0
17649                 ;;
17650         esac
17651         ;;
17652 *)      srand48_r_proto=0
17653         ;;
17654 esac
17655
17656 : see if srandom_r exists
17657 set srandom_r d_srandom_r
17658 eval $inlibc
17659 case "$d_srandom_r" in
17660 "$define")
17661         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17662         case "$d_srandom_r_proto:$usethreads" in
17663         ":define")      d_srandom_r_proto=define
17664                 set d_srandom_r_proto srandom_r $hdrs
17665                 eval $hasproto ;;
17666         *)      ;;
17667         esac
17668         case "$d_srandom_r_proto" in
17669         define)
17670         case "$srandom_r_proto" in
17671         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17672         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17673         esac
17674         case "$srandom_r_proto" in
17675         ''|0)   d_srandom_r=undef
17676                 srandom_r_proto=0
17677                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17678         * )     case "$srandom_r_proto" in
17679                 REENTRANT_PROTO*) ;;
17680                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17681                 esac
17682                 echo "Prototype: $try" ;;
17683         esac
17684         ;;
17685         *)      case "$usethreads" in
17686                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17687                 esac
17688                 d_srandom_r=undef
17689                 srandom_r_proto=0
17690                 ;;
17691         esac
17692         ;;
17693 *)      srandom_r_proto=0
17694         ;;
17695 esac
17696
17697 : see if prototype for setresgid is available
17698 echo " "
17699 set d_sresgproto setresgid $i_unistd unistd.h
17700 eval $hasproto
17701
17702 : see if prototype for setresuid is available
17703 echo " "
17704 set d_sresuproto setresuid $i_unistd unistd.h
17705 eval $hasproto
17706
17707 : see if sys/stat.h is available
17708 set sys/stat.h i_sysstat
17709 eval $inhdr
17710
17711 : see if stat knows about block sizes
17712 echo " "
17713 echo "Checking to see if your struct stat has st_blocks field..." >&4
17714 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17715 eval $hasfield
17716
17717 : see if this is a sys/vfs.h system
17718 set sys/vfs.h i_sysvfs
17719 eval $inhdr
17720
17721 : see if this is a sys/statfs.h system
17722 set sys/statfs.h i_sysstatfs
17723 eval $inhdr
17724
17725 : Check for statfs_s
17726 echo " "
17727 echo "Checking to see if your system supports struct statfs..." >&4
17728 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
17729 eval $hasstruct
17730 case "$d_statfs_s" in
17731 "$define")      echo "Yes, it does."   ;;
17732 *)              echo "No, it doesn't." ;;
17733 esac
17734
17735
17736 : see if struct statfs knows about f_flags
17737 case "$d_statfs_s" in
17738 define)
17739         echo " "
17740         echo "Checking to see if your struct statfs has f_flags field..." >&4
17741         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
17742         eval $hasfield
17743         ;;
17744 *)      val="$undef"
17745         set d_statfs_f_flags
17746         eval $setvar
17747         ;;
17748 esac
17749 case "$d_statfs_f_flags" in
17750 "$define")      echo "Yes, it does."   ;;
17751 *)              echo "No, it doesn't." ;;
17752 esac
17753
17754 : Check stream access
17755 $cat >&4 <<EOM
17756 Checking how to access stdio streams by file descriptor number...
17757 EOM
17758 case "$stdio_stream_array" in
17759 '')     $cat >try.c <<EOCP
17760 #include <stdio.h>
17761 int main() {
17762   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17763     printf("yes\n");
17764 }
17765 EOCP
17766         for s in _iob __iob __sF
17767         do
17768                 set try -DSTDIO_STREAM_ARRAY=$s
17769                 if eval $compile; then
17770                         case "`$run ./try`" in
17771                         yes)    stdio_stream_array=$s; break ;;
17772                         esac
17773                 fi
17774         done
17775         $rm_try
17776 esac
17777 case "$stdio_stream_array" in
17778 '')     $cat >&4 <<EOM
17779 I can't figure out how to access stdio streams by file descriptor number.
17780 EOM
17781         d_stdio_stream_array="$undef"
17782         ;;
17783 *)      $cat >&4 <<EOM
17784 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17785 EOM
17786         d_stdio_stream_array="$define"
17787         ;;
17788 esac
17789
17790 : see if strcoll exists
17791 set strcoll d_strcoll
17792 eval $inlibc
17793
17794 : check for structure copying
17795 echo " "
17796 echo "Checking to see if your C compiler can copy structs..." >&4
17797 $cat >try.c <<'EOCP'
17798 int main()
17799 {
17800         struct blurfl {
17801                 int dyick;
17802         } foo, bar;
17803
17804         foo = bar;
17805 }
17806 EOCP
17807 if $cc -c try.c >/dev/null 2>&1 ; then
17808         val="$define"
17809         echo "Yup, it can."
17810 else
17811         val="$undef"
17812         echo "Nope, it can't."
17813 fi
17814 set d_strctcpy
17815 eval $setvar
17816 $rm_try
17817
17818 : see if strerror and/or sys_errlist[] exist
17819 echo " "
17820 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17821     if set strerror val -f d_strerror; eval $csym; $val; then
17822                 echo 'strerror() found.' >&4
17823                 d_strerror="$define"
17824                 d_strerrm='strerror(e)'
17825                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17826                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17827                         d_syserrlst="$define"
17828                 else
17829                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17830                         d_syserrlst="$undef"
17831                 fi
17832     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17833                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17834                 echo 'strerror() found in string header.' >&4
17835                 d_strerror="$define"
17836                 d_strerrm='strerror(e)'
17837                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17838                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17839                                 d_syserrlst="$define"
17840                 else
17841                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17842                         d_syserrlst="$undef"
17843                 fi
17844     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17845                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17846                 d_strerror="$undef"
17847                 d_syserrlst="$define"
17848                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17849     else
17850                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17851                 d_strerror="$undef"
17852                 d_syserrlst="$undef"
17853                 d_strerrm='"unknown"'
17854     fi
17855 fi
17856
17857 : see if strerror_r exists
17858 set strerror_r d_strerror_r
17859 eval $inlibc
17860 case "$d_strerror_r" in
17861 "$define")
17862         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17863         case "$d_strerror_r_proto:$usethreads" in
17864         ":define")      d_strerror_r_proto=define
17865                 set d_strerror_r_proto strerror_r $hdrs
17866                 eval $hasproto ;;
17867         *)      ;;
17868         esac
17869         case "$d_strerror_r_proto" in
17870         define)
17871         case "$strerror_r_proto" in
17872         ''|0) try='int strerror_r(int, char*, size_t);'
17873         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
17874         esac
17875         case "$strerror_r_proto" in
17876         ''|0) try='int strerror_r(int, char*, int);'
17877         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
17878         esac
17879         case "$strerror_r_proto" in
17880         ''|0) try='char* strerror_r(int, char*, size_t);'
17881         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
17882         esac
17883         case "$strerror_r_proto" in
17884         ''|0)   d_strerror_r=undef
17885                 strerror_r_proto=0
17886                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17887         * )     case "$strerror_r_proto" in
17888                 REENTRANT_PROTO*) ;;
17889                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17890                 esac
17891                 echo "Prototype: $try" ;;
17892         esac
17893         ;;
17894         *)      case "$usethreads" in
17895                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17896                 esac
17897                 d_strerror_r=undef
17898                 strerror_r_proto=0
17899                 ;;
17900         esac
17901         ;;
17902 *)      strerror_r_proto=0
17903         ;;
17904 esac
17905
17906 : see if strftime exists
17907 set strftime d_strftime
17908 eval $inlibc
17909
17910 : see if strlcat exists
17911 set strlcat d_strlcat
17912 eval $inlibc
17913
17914 : see if strlcpy exists
17915 set strlcpy d_strlcpy
17916 eval $inlibc
17917
17918 : see if strtod exists
17919 set strtod d_strtod
17920 eval $inlibc
17921
17922 : see if strtol exists
17923 set strtol d_strtol
17924 eval $inlibc
17925
17926 : see if strtold exists
17927 set strtold d_strtold
17928 eval $inlibc
17929
17930 : see if strtoll exists
17931 set strtoll d_strtoll
17932 eval $inlibc
17933
17934 case "$d_longlong-$d_strtoll" in
17935 "$define-$define")
17936         $cat <<EOM
17937 Checking whether your strtoll() works okay...
17938 EOM
17939         $cat >try.c <<'EOCP'
17940 #include <errno.h>
17941 #ifdef __hpux
17942 #define strtoll __strtoll
17943 #endif
17944 #ifdef __EMX__
17945 #define strtoll _strtoll
17946 #endif
17947 #include <stdio.h>
17948 extern long long int strtoll(char *s, char **, int);
17949 static int bad = 0;
17950 int check(char *s, long long ell, int een) {
17951         long long gll;
17952         errno = 0;
17953         gll = strtoll(s, 0, 10);
17954         if (!((gll == ell) && (errno == een)))
17955                 bad++;
17956 }
17957 int main() {
17958         check(" 1",                                      1LL, 0);
17959         check(" 0",                                      0LL, 0);
17960         check("-1",                                     -1LL, 0);
17961         check("-9223372036854775808", -9223372036854775808LL, 0);
17962         check("-9223372036854775808", -9223372036854775808LL, 0);
17963         check(" 9223372036854775807",  9223372036854775807LL, 0);
17964         check("-9223372036854775808", -9223372036854775808LL, 0);
17965         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17966         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17967         if (!bad)
17968                 printf("ok\n");
17969 }
17970 EOCP
17971         set try
17972         if eval $compile; then
17973                 yyy=`$run ./try`
17974                 case "$yyy" in
17975                 ok) echo "Your strtoll() seems to be working okay." ;;
17976                 *) cat <<EOM >&4
17977 Your strtoll() doesn't seem to be working okay.
17978 EOM
17979                    d_strtoll="$undef"
17980                    ;;
17981                 esac
17982         else
17983                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17984                 d_strtoll="$undef"
17985         fi
17986         ;;
17987 esac
17988
17989 : see if strtoq exists
17990 set strtoq d_strtoq
17991 eval $inlibc
17992
17993 : see if strtoul exists
17994 set strtoul d_strtoul
17995 eval $inlibc
17996
17997 case "$d_strtoul" in
17998 "$define")
17999         $cat <<EOM
18000 Checking whether your strtoul() works okay...
18001 EOM
18002         $cat >try.c <<'EOCP'
18003 #include <errno.h>
18004 #include <stdio.h>
18005 extern unsigned long int strtoul(char *s, char **, int);
18006 static int bad = 0;
18007 void check(char *s, unsigned long eul, int een) {
18008         unsigned long gul;
18009         errno = 0;
18010         gul = strtoul(s, 0, 10);
18011         if (!((gul == eul) && (errno == een)))
18012                 bad++;
18013 }
18014 int main() {
18015         check(" 1", 1L, 0);
18016         check(" 0", 0L, 0);
18017 EOCP
18018         case "$longsize" in
18019         8)
18020             $cat >>try.c <<'EOCP'
18021         check("18446744073709551615", 18446744073709551615UL, 0);
18022         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18023 #if 0 /* strtoul() for /^-/ strings is undefined. */
18024         check("-1", 18446744073709551615UL, 0);
18025         check("-18446744073709551614", 2, 0);
18026         check("-18446744073709551615", 1, 0);
18027         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18028         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18029 #endif
18030 EOCP
18031                 ;;
18032         4)
18033                     $cat >>try.c <<'EOCP'
18034         check("4294967295", 4294967295UL, 0);
18035         check("4294967296", 4294967295UL, ERANGE);
18036 #if 0 /* strtoul() for /^-/ strings is undefined. */
18037         check("-1", 4294967295UL, 0);
18038         check("-4294967294", 2, 0);
18039         check("-4294967295", 1, 0);
18040         check("-4294967296", 4294967295UL, ERANGE);
18041         check("-4294967297", 4294967295UL, ERANGE);
18042 #endif
18043 EOCP
18044                 ;;
18045         *)
18046 : Should we write these tests to be more portable by sprintf-ing
18047 : ~0 and then manipulating that char string as input for strtol?
18048                 ;;
18049         esac
18050         $cat >>try.c <<'EOCP'
18051         if (!bad)
18052                 printf("ok\n");
18053         return 0;
18054 }
18055 EOCP
18056         set try
18057         if eval $compile; then
18058                 case "`$run ./try`" in
18059                 ok) echo "Your strtoul() seems to be working okay." ;;
18060                 *) cat <<EOM >&4
18061 Your strtoul() doesn't seem to be working okay.
18062 EOM
18063                    d_strtoul="$undef"
18064                    ;;
18065                 esac
18066         else
18067                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18068                 d_strtoul="$undef"
18069         fi
18070         ;;
18071 esac
18072
18073 : see if strtoull exists
18074 set strtoull d_strtoull
18075 eval $inlibc
18076
18077 case "$d_longlong-$d_strtoull" in
18078 "$define-$define")
18079         $cat <<EOM
18080 Checking whether your strtoull() works okay...
18081 EOM
18082         $cat >try.c <<'EOCP'
18083 #include <errno.h>
18084 #ifdef __hpux
18085 #define strtoull __strtoull
18086 #endif
18087 #include <stdio.h>
18088 extern unsigned long long int strtoull(char *s, char **, int);
18089 static int bad = 0;
18090 int check(char *s, long long eull, int een) {
18091         long long gull;
18092         errno = 0;
18093         gull = strtoull(s, 0, 10);
18094         if (!((gull == eull) && (errno == een)))
18095                 bad++;
18096 }
18097 int main() {
18098         check(" 1",                                        1LL, 0);
18099         check(" 0",                                        0LL, 0);
18100         check("18446744073709551615",  18446744073709551615ULL, 0);
18101         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18102 #if 0 /* strtoull() for /^-/ strings is undefined. */
18103         check("-1",                    18446744073709551615ULL, 0);
18104         check("-18446744073709551614",                     2LL, 0);
18105         check("-18446744073709551615",                     1LL, 0);
18106         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18107         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18108 #endif
18109         if (!bad)
18110                 printf("ok\n");
18111 }
18112 EOCP
18113         set try
18114         if eval $compile; then
18115                 case "`$run ./try`" in
18116                 ok) echo "Your strtoull() seems to be working okay." ;;
18117                 *) cat <<EOM >&4
18118 Your strtoull() doesn't seem to be working okay.
18119 EOM
18120                    d_strtoull="$undef"
18121                    ;;
18122                 esac
18123         else
18124                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18125                 d_strtoull="$undef"
18126         fi
18127         ;;
18128 esac
18129
18130 : see if strtouq exists
18131 set strtouq d_strtouq
18132 eval $inlibc
18133
18134 case "$d_strtouq" in
18135 "$define")
18136         $cat <<EOM
18137 Checking whether your strtouq() works okay...
18138 EOM
18139         $cat >try.c <<'EOCP'
18140 #include <errno.h>
18141 #include <stdio.h>
18142 extern unsigned long long int strtouq(char *s, char **, int);
18143 static int bad = 0;
18144 void check(char *s, unsigned long long eull, int een) {
18145         unsigned long long gull;
18146         errno = 0;
18147         gull = strtouq(s, 0, 10);
18148         if (!((gull == eull) && (errno == een)))
18149                 bad++;
18150 }
18151 int main() {
18152         check(" 1",                                        1LL, 0);
18153         check(" 0",                                        0LL, 0);
18154         check("18446744073709551615",  18446744073709551615ULL, 0);
18155         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18156 #if 0 /* strtouq() for /^-/ strings is undefined. */
18157         check("-1",                    18446744073709551615ULL, 0);
18158         check("-18446744073709551614",                     2LL, 0);
18159         check("-18446744073709551615",                     1LL, 0);
18160         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18161         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18162 #endif
18163         if (!bad)
18164                 printf("ok\n");
18165         return 0;
18166 }
18167 EOCP
18168         set try
18169         if eval $compile; then
18170                 case "`$run ./try`" in
18171                 ok) echo "Your strtouq() seems to be working okay." ;;
18172                 *) cat <<EOM >&4
18173 Your strtouq() doesn't seem to be working okay.
18174 EOM
18175                    d_strtouq="$undef"
18176                    ;;
18177                 esac
18178         else
18179                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18180                 d_strtouq="$undef"
18181         fi
18182         ;;
18183 esac
18184
18185 : see if strxfrm exists
18186 set strxfrm d_strxfrm
18187 eval $inlibc
18188
18189 : see if symlink exists
18190 set symlink d_symlink
18191 eval $inlibc
18192
18193 : see if syscall exists
18194 set syscall d_syscall
18195 eval $inlibc
18196
18197 : see if prototype for syscall is available
18198 echo " "
18199 set d_syscallproto syscall $i_unistd unistd.h
18200 eval $hasproto
18201
18202 : see if sysconf exists
18203 set sysconf d_sysconf
18204 eval $inlibc
18205
18206 : see if system exists
18207 set system d_system
18208 eval $inlibc
18209
18210 : see if tcgetpgrp exists
18211 set tcgetpgrp d_tcgetpgrp
18212 eval $inlibc
18213
18214 : see if tcsetpgrp exists
18215 set tcsetpgrp d_tcsetpgrp
18216 eval $inlibc
18217
18218 : see if prototype for telldir is available
18219 echo " "
18220 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18221 eval $hasproto
18222
18223 : see if time exists
18224 echo " "
18225 if test "X$d_time" = X -o X"$timetype" = X; then
18226     if set time val -f d_time; eval $csym; $val; then
18227                 echo 'time() found.' >&4
18228                 val="$define"
18229                 rp="What is the type returned by time() on this system?"
18230                 set time_t timetype long stdio.h sys/types.h
18231                 eval $typedef_ask
18232     else
18233                 echo 'time() not found, hope that will do.' >&4
18234                 val="$undef"
18235                 timetype='int';
18236     fi
18237     set d_time
18238     eval $setvar
18239 fi
18240
18241 : see if timegm exists
18242 set timegm d_timegm
18243 eval $inlibc
18244
18245 : see if this is a sys/times.h system
18246 set sys/times.h i_systimes
18247 eval $inhdr
18248
18249 : see if times exists
18250 echo " "
18251 if set times val -f d_times; eval $csym; $val; then
18252         echo 'times() found.' >&4
18253         d_times="$define"
18254         inc=''
18255         case "$i_systimes" in
18256         "$define") inc='sys/times.h';;
18257         esac
18258         rp="What is the type returned by times() on this system?"
18259         set clock_t clocktype long stdio.h sys/types.h $inc
18260         eval $typedef_ask
18261 else
18262         echo 'times() NOT found, hope that will do.' >&4
18263         d_times="$undef"
18264         clocktype='int'
18265 fi
18266
18267 : see if tmpnam_r exists
18268 set tmpnam_r d_tmpnam_r
18269 eval $inlibc
18270 case "$d_tmpnam_r" in
18271 "$define")
18272         hdrs="$i_systypes sys/types.h define stdio.h "
18273         case "$d_tmpnam_r_proto:$usethreads" in
18274         ":define")      d_tmpnam_r_proto=define
18275                 set d_tmpnam_r_proto tmpnam_r $hdrs
18276                 eval $hasproto ;;
18277         *)      ;;
18278         esac
18279         case "$d_tmpnam_r_proto" in
18280         define)
18281         case "$tmpnam_r_proto" in
18282         ''|0) try='char* tmpnam_r(char*);'
18283         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18284         esac
18285         case "$tmpnam_r_proto" in
18286         ''|0)   d_tmpnam_r=undef
18287                 tmpnam_r_proto=0
18288                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18289         * )     case "$tmpnam_r_proto" in
18290                 REENTRANT_PROTO*) ;;
18291                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18292                 esac
18293                 echo "Prototype: $try" ;;
18294         esac
18295         ;;
18296         *)      case "$usethreads" in
18297                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18298                 esac
18299                 d_tmpnam_r=undef
18300                 tmpnam_r_proto=0
18301                 ;;
18302         esac
18303         ;;
18304 *)      tmpnam_r_proto=0
18305         ;;
18306 esac
18307
18308 : see if truncate exists
18309 set truncate d_truncate
18310 eval $inlibc
18311
18312 : see if ttyname_r exists
18313 set ttyname_r d_ttyname_r
18314 eval $inlibc
18315 case "$d_ttyname_r" in
18316 "$define")
18317         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18318         case "$d_ttyname_r_proto:$usethreads" in
18319         ":define")      d_ttyname_r_proto=define
18320                 set d_ttyname_r_proto ttyname_r $hdrs
18321                 eval $hasproto ;;
18322         *)      ;;
18323         esac
18324         case "$d_ttyname_r_proto" in
18325         define)
18326         case "$ttyname_r_proto" in
18327         ''|0) try='int ttyname_r(int, char*, size_t);'
18328         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18329         esac
18330         case "$ttyname_r_proto" in
18331         ''|0) try='int ttyname_r(int, char*, int);'
18332         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18333         esac
18334         case "$ttyname_r_proto" in
18335         ''|0) try='char* ttyname_r(int, char*, int);'
18336         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18337         esac
18338         case "$ttyname_r_proto" in
18339         ''|0)   d_ttyname_r=undef
18340                 ttyname_r_proto=0
18341                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18342         * )     case "$ttyname_r_proto" in
18343                 REENTRANT_PROTO*) ;;
18344                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18345                 esac
18346                 echo "Prototype: $try" ;;
18347         esac
18348         ;;
18349         *)      case "$usethreads" in
18350                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18351                 esac
18352                 d_ttyname_r=undef
18353                 ttyname_r_proto=0
18354                 ;;
18355         esac
18356         ;;
18357 *)      ttyname_r_proto=0
18358         ;;
18359 esac
18360
18361 : see if tzname[] exists
18362 echo " "
18363 if set tzname val -a d_tzname; eval $csym; $val; then
18364         val="$define"
18365         echo 'tzname[] found.' >&4
18366 else
18367         val="$undef"
18368         echo 'tzname[] NOT found.' >&4
18369 fi
18370 set d_tzname
18371 eval $setvar
18372
18373 : Check if is a multiplatform env
18374 case "$osname" in
18375 next|rhapsody|darwin) multiarch="$define" ;;
18376 esac
18377 case "$multiarch" in
18378 ''|[nN]*) multiarch="$undef" ;;
18379 esac
18380
18381 : check for ordering of bytes in a UV
18382 echo " "
18383 case "$usecrosscompile$multiarch" in
18384 *$define*)
18385         $cat <<EOM
18386 You seem to be either cross-compiling or doing a multiarchitecture build,
18387 skipping the byteorder check.
18388
18389 EOM
18390         byteorder='ffff'
18391         ;;
18392 *)
18393         case "$byteorder" in
18394         '')
18395                 $cat <<'EOM'
18396 In the following, larger digits indicate more significance.  A big-endian
18397 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18398 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18399 machines may have weird orders like 3412.  A Cray will report 87654321,
18400 an Alpha will report 12345678. If the test program works the default is
18401 probably right.
18402 I'm now running the test program...
18403 EOM
18404                 $cat >try.c <<EOCP
18405 #include <stdio.h>
18406 #$i_stdlib I_STDLIB
18407 #ifdef I_STDLIB
18408 #include <stdlib.h>
18409 #endif
18410 #include <sys/types.h>
18411 typedef $uvtype UV;
18412 int main()
18413 {
18414         int i;
18415         union {
18416                 UV l;
18417                 char c[$uvsize];
18418         } u;
18419
18420         if ($uvsize > 4)
18421                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18422         else
18423                 u.l = (UV)0x04030201;
18424         for (i = 0; i < $uvsize; i++)
18425                 printf("%c", u.c[i]+'0');
18426         printf("\n");
18427         exit(0);
18428 }
18429 EOCP
18430                 xxx_prompt=y
18431                 set try
18432                 if eval $compile && $run ./try > /dev/null; then
18433                         dflt=`$run ./try`
18434                         case "$dflt" in
18435                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18436                                 echo "(The test program ran ok.)"
18437                                 echo "byteorder=$dflt"
18438                                 xxx_prompt=n
18439                         ;;
18440                         ????|????????) echo "(The test program ran ok.)" ;;
18441                         *) echo "(The test program didn't run right for some reason.)" ;;
18442                         esac
18443                 else
18444                         dflt='4321'
18445                         cat <<'EOM'
18446 (I can't seem to compile the test program.  Guessing big-endian...)
18447 EOM
18448                 fi
18449                 case "$xxx_prompt" in
18450                 y)
18451                         rp="What is the order of bytes in $uvtype?"
18452                         . ./myread
18453                         byteorder="$ans"
18454                         ;;
18455                 *)      byteorder=$dflt
18456                         ;;
18457                 esac
18458                 ;;
18459         esac
18460         $rm_try
18461         ;;
18462 esac
18463
18464 : Checking 32bit aligndness
18465 $cat <<EOM
18466
18467 Checking to see whether you can access character data unalignedly...
18468 EOM
18469 case "$d_u32align" in
18470 '')   $cat >try.c <<EOCP
18471 #include <stdio.h>
18472 #$i_stdlib I_STDLIB
18473 #ifdef I_STDLIB
18474 #include <stdlib.h>
18475 #endif
18476 #define U32 $u32type
18477 #define BYTEORDER 0x$byteorder
18478 #define U8 $u8type
18479 #include <signal.h>
18480 #ifdef SIGBUS
18481 $signal_t bletch(int s) { exit(4); }
18482 #endif
18483 int main() {
18484 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18485     U8 buf[8];
18486     U32 *up;
18487     int i;
18488
18489     if (sizeof(U32) != 4) {
18490         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18491         exit(1);
18492     }
18493
18494     fflush(stdout);
18495
18496 #ifdef SIGBUS
18497     signal(SIGBUS, bletch);
18498 #endif
18499
18500     buf[0] = 0;
18501     buf[1] = 0;
18502     buf[2] = 0;
18503     buf[3] = 1;
18504     buf[4] = 0;
18505     buf[5] = 0;
18506     buf[6] = 0;
18507     buf[7] = 1;
18508
18509     for (i = 0; i < 4; i++) {
18510         up = (U32*)(buf + i);
18511         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18512                (*up == 1 << (8*(3-i)))  /* little-endian */
18513               )
18514            )
18515         {
18516             printf("read failed (%x)\n", *up);
18517             exit(2);
18518         }
18519     }
18520
18521     /* write test */
18522     for (i = 0; i < 4; i++) {
18523         up = (U32*)(buf + i);
18524         *up = 0xBeef;
18525         if (*up != 0xBeef) {
18526             printf("write failed (%x)\n", *up);
18527             exit(3);
18528         }
18529     }
18530
18531     exit(0);
18532 #else
18533     printf("1\n");
18534     exit(1);
18535 #endif
18536     return 0;
18537 }
18538 EOCP
18539 set try
18540 if eval $compile_ok; then
18541         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18542         $run ./try 2>&1 >/dev/null
18543         case "$?" in
18544         0)      cat >&4 <<EOM
18545 You can access character data pretty unalignedly.
18546 EOM
18547                 d_u32align="$undef"
18548                 ;;
18549         *)      cat >&4 <<EOM
18550 It seems that you must access character data in an aligned manner.
18551 EOM
18552                 d_u32align="$define"
18553                 ;;
18554         esac
18555 else
18556         rp='Can you access character data at unaligned addresses?'
18557         dflt='n'
18558         . ./myread
18559         case "$ans" in
18560         [yY]*)  d_u32align="$undef"  ;;
18561         *)      d_u32align="$define" ;;
18562         esac
18563 fi
18564 $rm_try
18565 ;;
18566 esac
18567
18568 : see if ualarm exists
18569 set ualarm d_ualarm
18570 eval $inlibc
18571
18572 : see if umask exists
18573 set umask d_umask
18574 eval $inlibc
18575
18576 : see if unordered exists
18577 set unordered d_unordered
18578 eval $inlibc
18579
18580 : see if unsetenv exists
18581 set unsetenv d_unsetenv
18582 eval $inlibc
18583
18584 : see if usleep exists
18585 set usleep d_usleep
18586 eval $inlibc
18587
18588 : see if prototype for usleep is available
18589 echo " "
18590 set d_usleepproto usleep $i_unistd unistd.h
18591 eval $hasproto
18592
18593 : see if ustat exists
18594 set ustat d_ustat
18595 eval $inlibc
18596
18597 : see if closedir exists
18598 set closedir d_closedir
18599 eval $inlibc
18600
18601 case "$d_closedir" in
18602 "$define")
18603         echo " "
18604         echo "Checking whether closedir() returns a status..." >&4
18605         cat > try.c <<EOM
18606 #$i_dirent I_DIRENT             /**/
18607 #$i_sysdir I_SYS_DIR            /**/
18608 #$i_sysndir I_SYS_NDIR          /**/
18609 #$i_systypes I_SYS_TYPES        /**/
18610
18611 #if defined(I_SYS_TYPES)
18612 #include <sys/types.h>
18613 #endif
18614 #if defined(I_DIRENT)
18615 #include <dirent.h>
18616 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18617 #include <sys/dir.h>
18618 #endif
18619 #else
18620 #ifdef I_SYS_NDIR
18621 #include <sys/ndir.h>
18622 #else
18623 #ifdef I_SYS_DIR
18624 #ifdef hp9000s500
18625 #include <ndir.h>       /* may be wrong in the future */
18626 #else
18627 #include <sys/dir.h>
18628 #endif
18629 #endif
18630 #endif
18631 #endif
18632 int main() { return closedir(opendir(".")); }
18633 EOM
18634         set try
18635         if eval $compile_ok; then
18636                 if $run ./try > /dev/null 2>&1 ; then
18637                         echo "Yes, it does."
18638                         val="$undef"
18639                 else
18640                         echo "No, it doesn't."
18641                         val="$define"
18642                 fi
18643         else
18644                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18645                 val="$define"
18646         fi
18647         ;;
18648 *)
18649         val="$undef";
18650         ;;
18651 esac
18652 set d_void_closedir
18653 eval $setvar
18654 $rm_try
18655
18656 : see if there is a wait4
18657 set wait4 d_wait4
18658 eval $inlibc
18659
18660 : see if waitpid exists
18661 set waitpid d_waitpid
18662 eval $inlibc
18663
18664 : see if wcstombs exists
18665 set wcstombs d_wcstombs
18666 eval $inlibc
18667
18668 : see if wctomb exists
18669 set wctomb d_wctomb
18670 eval $inlibc
18671
18672 : see if writev exists
18673 set writev d_writev
18674 eval $inlibc
18675
18676 : preserve RCS keywords in files with variable substitution, grrr
18677 Date='$Date'
18678 Id='$Id'
18679 Log='$Log'
18680 RCSfile='$RCSfile'
18681 Revision='$Revision'
18682
18683 : check for alignment requirements
18684 echo " "
18685 case "$usecrosscompile$multiarch" in
18686 *$define*)
18687         $cat <<EOM
18688 You seem to be either cross-compiling or doing a multiarchitecture build,
18689 skipping the memory alignment check.
18690
18691 EOM
18692         case "$alignbytes" in
18693         '') alignbytes=8 ;;
18694         esac
18695         ;;
18696 *)
18697         case "$alignbytes" in
18698         '') echo "Checking alignment constraints..." >&4
18699                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18700                         $cat >try.c <<'EOCP'
18701 typedef long double NV;
18702 EOCP
18703                 else
18704                         $cat >try.c <<'EOCP'
18705 typedef double NV;
18706 EOCP
18707                 fi
18708                 $cat >>try.c <<'EOCP'
18709 #include <stdio.h>
18710 struct foobar {
18711         char foo;
18712         NV bar;
18713 } try_algn;
18714 int main()
18715 {
18716     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18717     return(0);
18718 }
18719 EOCP
18720                 set try
18721                 if eval $compile_ok; then
18722                         dflt=`$run ./try`
18723                 else
18724                         dflt='8'
18725                         echo "(I can't seem to compile the test program...)"
18726                 fi
18727                 ;;
18728         *) dflt="$alignbytes"
18729                 ;;
18730         esac
18731         rp="Doubles must be aligned on a how-many-byte boundary?"
18732         . ./myread
18733         alignbytes="$ans"
18734         $rm_try
18735         ;;
18736 esac
18737
18738
18739 : set the base revision
18740 baserev=5.0
18741
18742 : how do we concatenate cpp tokens here?
18743 echo " "
18744 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18745 $cat >cpp_stuff.c <<'EOCP'
18746 #define RCAT(a,b)a/**/b
18747 #define ACAT(a,b)a ## b
18748 RCAT(Rei,ser)
18749 ACAT(Cir,cus)
18750 EOCP
18751 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18752 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18753         echo "Oh!  Smells like ANSI's been here." >&4
18754         echo "We can catify or stringify, separately or together!"
18755         cpp_stuff=42
18756 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18757         echo "Ah, yes!  The good old days!" >&4
18758         echo "However, in the good old days we don't know how to stringify and"
18759         echo "catify at the same time."
18760         cpp_stuff=1
18761 else
18762         $cat >&4 <<EOM
18763 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18764 You're going to have to edit the values of CAT[2-5] in config.h...
18765 EOM
18766         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18767 fi
18768 $rm -f cpp_stuff.*
18769
18770 : see if this is a db.h system
18771 set db.h i_db
18772 eval $inhdr
18773
18774 case "$i_db" in
18775 $define)
18776         : Check db version.
18777         echo " "
18778         echo "Checking Berkeley DB version ..." >&4
18779         $cat >try.c <<EOCP
18780 #$d_const HASCONST
18781 #ifndef HASCONST
18782 #define const
18783 #endif
18784 #include <sys/types.h>
18785 #include <stdio.h>
18786 #$i_stdlib I_STDLIB
18787 #ifdef I_STDLIB
18788 #include <stdlib.h>
18789 #endif
18790 #include <db.h>
18791 int main(int argc, char *argv[])
18792 {
18793 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18794     int Major, Minor, Patch ;
18795     unsigned long Version ;
18796     (void)db_version(&Major, &Minor, &Patch) ;
18797     if (argc == 2) {
18798         printf("%d %d %d %d %d %d\n",
18799                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18800                Major, Minor, Patch);
18801         exit(0);
18802     }
18803     printf("You have Berkeley DB Version 2 or greater.\n");
18804
18805     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18806                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18807     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18808                 Major, Minor, Patch) ;
18809
18810     /* check that db.h & libdb are compatible */
18811     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18812         printf("db.h and libdb are incompatible.\n") ;
18813         exit(3);
18814     }
18815
18816     printf("db.h and libdb are compatible.\n") ;
18817
18818     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18819                 + DB_VERSION_PATCH ;
18820
18821     /* needs to be >= 2.3.4 */
18822     if (Version < 2003004) {
18823     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18824         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18825         exit(2);
18826     }
18827
18828     exit(0);
18829 #else
18830 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18831     if (argc == 2) {
18832         printf("1 0 0\n");
18833         exit(0);
18834     }
18835     printf("You have Berkeley DB Version 1.\n");
18836     exit(0);    /* DB version < 2: the coast is clear. */
18837 #else
18838     exit(1);    /* <db.h> not Berkeley DB? */
18839 #endif
18840 #endif
18841 }
18842 EOCP
18843         set try
18844         if eval $compile_ok && $run ./try; then
18845                 echo 'Looks OK.' >&4
18846                 set `$run ./try 1`
18847                 db_version_major=$1
18848                 db_version_minor=$2
18849                 db_version_patch=$3
18850         else
18851                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18852                 i_db=$undef
18853                 case " $libs " in
18854                 *"-ldb "*)
18855                         : Remove db from list of libraries to use
18856                         echo "Removing unusable -ldb from library list" >&4
18857                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18858                         shift
18859                         libs="$*"
18860                         echo "libs = $libs" >&4
18861                         ;;
18862                 esac
18863         fi
18864         $rm_try
18865         ;;
18866 esac
18867
18868 case "$i_db" in
18869 define)
18870         : Check the return type needed for hash
18871         echo " "
18872         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18873         $cat >try.c <<EOCP
18874 #$d_const HASCONST
18875 #ifndef HASCONST
18876 #define const
18877 #endif
18878 #include <sys/types.h>
18879 #include <db.h>
18880
18881 #ifndef DB_VERSION_MAJOR
18882 u_int32_t hash_cb (ptr, size)
18883 const void *ptr;
18884 size_t size;
18885 {
18886 }
18887 HASHINFO info;
18888 int main()
18889 {
18890         info.hash = hash_cb;
18891 }
18892 #endif
18893 EOCP
18894         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18895                 if $contains warning try.out >>/dev/null 2>&1 ; then
18896                         db_hashtype='int'
18897                 else
18898                         db_hashtype='u_int32_t'
18899                 fi
18900         else
18901                 : XXX Maybe we should just give up here.
18902                 db_hashtype=u_int32_t
18903                 $cat try.out >&4
18904                 echo "Help:  I can't seem to compile the db test program." >&4
18905                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18906         fi
18907         $rm_try
18908         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18909         ;;
18910 *)      db_hashtype=u_int32_t
18911         ;;
18912 esac
18913 case "$i_db" in
18914 define)
18915         : Check the return type needed for prefix
18916         echo " "
18917         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18918         cat >try.c <<EOCP
18919 #$d_const HASCONST
18920 #ifndef HASCONST
18921 #define const
18922 #endif
18923 #include <sys/types.h>
18924 #include <db.h>
18925
18926 #ifndef DB_VERSION_MAJOR
18927 size_t prefix_cb (key1, key2)
18928 const DBT *key1;
18929 const DBT *key2;
18930 {
18931 }
18932 BTREEINFO info;
18933 int main()
18934 {
18935         info.prefix = prefix_cb;
18936 }
18937 #endif
18938 EOCP
18939         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18940                 if $contains warning try.out >>/dev/null 2>&1 ; then
18941                         db_prefixtype='int'
18942                 else
18943                         db_prefixtype='size_t'
18944                 fi
18945         else
18946                 db_prefixtype='size_t'
18947                 : XXX Maybe we should just give up here.
18948                 $cat try.out >&4
18949                 echo "Help:  I can't seem to compile the db test program." >&4
18950                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18951         fi
18952         $rm_try
18953         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18954         ;;
18955 *)      db_prefixtype='size_t'
18956         ;;
18957 esac
18958
18959 : How can we generate normalized random numbers ?
18960 echo " "
18961 echo "Looking for a random number function..." >&4
18962 case "$randfunc" in
18963 '')
18964         if set drand48 val -f; eval $csym; $val; then
18965                 dflt="drand48"
18966                 echo "Good, found drand48()." >&4
18967         elif set random val -f; eval $csym; $val; then
18968                 dflt="random"
18969                 echo "OK, found random()." >&4
18970         else
18971                 dflt="rand"
18972                 echo "Yick, looks like I have to use rand()." >&4
18973         fi
18974         echo " "
18975         ;;
18976 *)
18977         dflt="$randfunc"
18978         ;;
18979 esac
18980 cont=true
18981
18982 case "$ccflags" in
18983 *-Dmy_rand=*|*-Dmy_srand=*)
18984         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18985         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18986         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18987         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18988         ;;
18989 esac
18990
18991 while $test "$cont"; do
18992         rp="Use which function to generate random numbers?"
18993         . ./myread
18994         if $test "$ans" = "$dflt"; then
18995                 : null
18996         else
18997                 randbits=''
18998         fi
18999         randfunc="$ans"
19000         if set $ans val -f; eval $csym; $val; then
19001                 cont=''
19002         else
19003                 dflt=y
19004                 rp="I cannot find function $ans. Use that name anyway?"
19005                 . ./myread
19006                 dflt=rand
19007                 case "$ans" in
19008                         [yY]*) cont='';;
19009                 esac
19010         fi
19011         case "$cont" in
19012         '')
19013                 case "$randfunc" in
19014                 drand48)
19015                         drand01="drand48()"
19016                         seedfunc="srand48"
19017                         randbits=48
19018                         randseedtype=long
19019                         ;;
19020                 rand|random)
19021                         case "$randbits" in
19022                         '')
19023 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19024                                 $cat >try.c <<EOCP
19025 #$i_unistd I_UNISTD
19026 #$i_stdlib I_STDLIB
19027 #include <stdio.h>
19028 #ifdef I_UNISTD
19029 #  include <unistd.h>
19030 #endif
19031 #ifdef I_STDLIB
19032 #  include <stdlib.h>
19033 #endif
19034 int main()
19035 {
19036         register int i;
19037         register unsigned long tmp;
19038         register unsigned long max = 0L;
19039
19040         for (i = 1000; i; i--) {
19041                 tmp = (unsigned long) $randfunc();
19042                 if (tmp > max) max = tmp;
19043         }
19044         for (i = 0; max; i++)
19045                 max /= 2;
19046         printf("%d\n",i);
19047 }
19048 EOCP
19049                                 set try
19050                                 if eval $compile_ok; then
19051                                         dflt=`try`
19052                                 else
19053                                         dflt='?'
19054                                         echo "(I can't seem to compile the test program...)"
19055                                 fi
19056                                 ;;
19057                         *)
19058                                 dflt="$randbits"
19059                                 ;;
19060                         esac
19061                         rp="How many bits does your $randfunc() function produce?"
19062                         . ./myread
19063                         randbits="$ans"
19064                         $rm_try
19065                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19066                         seedfunc="s$randfunc"
19067                         randseedtype=unsigned
19068                         ;;
19069                 *)
19070                         dflt="31"
19071                         rp="How many bits does your $randfunc() function produce?"
19072                         . ./myread
19073                         randbits="$ans"
19074                         seedfunc="s$randfunc"
19075                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19076                         if set $seedfunc val -f; eval $csym; $val; then
19077                                 echo "(Using $seedfunc() to seed random generator)"
19078                         else
19079                                 echo "(Warning: no $seedfunc() to seed random generator)"
19080                                 seedfunc=rand
19081                         fi
19082                         randseedtype=unsigned
19083                         ;;
19084                 esac
19085                 ;;
19086         esac
19087 done
19088
19089 : Determine if this is an EBCDIC system
19090 echo " "
19091 echo "Determining whether or not we are on an EBCDIC system..." >&4
19092 $cat >try.c <<'EOM'
19093 int main()
19094 {
19095   if ('M'==0xd4) return 0;
19096   return 1;
19097 }
19098 EOM
19099
19100 val=$undef
19101 set try
19102 if eval $compile_ok; then
19103         if $run ./try; then
19104                 echo "You seem to speak EBCDIC." >&4
19105                 val="$define"
19106         else
19107                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19108         fi
19109 else
19110         echo "I'm unable to compile the test program." >&4
19111         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19112 fi
19113 $rm_try
19114 set ebcdic
19115 eval $setvar
19116
19117 : Check how to flush
19118 echo " "
19119 $cat >&4 <<EOM
19120 Checking how to flush all pending stdio output...
19121 EOM
19122 # I only know how to find the first 32 possibly open files on SunOS.
19123 # See also hints/sunos_4_1.sh and util.c  --AD
19124 case "$osname" in
19125 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19126 esac
19127 $cat >>try.c <<EOCP
19128 #include <stdio.h>
19129 #$i_stdlib I_STDLIB
19130 #ifdef I_STDLIB
19131 #include <stdlib.h>
19132 #endif
19133 #$i_unistd I_UNISTD
19134 #ifdef I_UNISTD
19135 # include <unistd.h>
19136 #endif
19137 #$d_sysconf HAS_SYSCONF
19138 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19139 #ifdef HAS_STDIO_STREAM_ARRAY
19140 # define STDIO_STREAM_ARRAY $stdio_stream_array
19141 #endif
19142 int main() {
19143   FILE* p;
19144   unlink("try.out");
19145   p = fopen("try.out", "w");
19146 #ifdef TRY_FPUTC
19147   fputc('x', p);
19148 #else
19149 # ifdef TRY_FPRINTF
19150   fprintf(p, "x");
19151 # endif
19152 #endif
19153 #ifdef TRY_FFLUSH_NULL
19154   fflush(NULL);
19155 #endif
19156 #ifdef TRY_FFLUSH_ALL
19157   {
19158     long open_max = -1;
19159 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19160     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19161 # else
19162 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19163     open_max = sysconf(_SC_OPEN_MAX);
19164 #  else
19165 #   ifdef FOPEN_MAX
19166     open_max = FOPEN_MAX;
19167 #   else
19168 #    ifdef OPEN_MAX
19169     open_max = OPEN_MAX;
19170 #    else
19171 #     ifdef _NFILE
19172     open_max = _NFILE;
19173 #     endif
19174 #    endif
19175 #   endif
19176 #  endif
19177 # endif
19178 # ifdef HAS_STDIO_STREAM_ARRAY
19179     if (open_max > 0) {
19180       long i;
19181       for (i = 0; i < open_max; i++)
19182             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19183                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19184                 STDIO_STREAM_ARRAY[i]._flag)
19185                 fflush(&STDIO_STREAM_ARRAY[i]);
19186     }
19187   }
19188 # endif
19189 #endif
19190   _exit(42);
19191 }
19192 EOCP
19193 : first we have to find out how _not_ to flush
19194 $to try.c
19195 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19196     output=''
19197     set try -DTRY_FPUTC
19198     if eval $compile; then
19199             $run ./try 2>/dev/null
19200             code="$?"
19201             $from try.out
19202             if $test ! -s try.out -a "X$code" = X42; then
19203                 output=-DTRY_FPUTC
19204             fi
19205     fi
19206     case "$output" in
19207     '')
19208             set try -DTRY_FPRINTF
19209             if eval $compile; then
19210                     $run ./try 2>/dev/null
19211                     code="$?"
19212                     $from try.out
19213                     if $test ! -s try.out -a "X$code" = X42; then
19214                         output=-DTRY_FPRINTF
19215                     fi
19216             fi
19217         ;;
19218     esac
19219 fi
19220 : check for fflush NULL behaviour
19221 case "$fflushNULL" in
19222 '')     set try -DTRY_FFLUSH_NULL $output
19223         if eval $compile; then
19224                 $run ./try 2>/dev/null
19225                 code="$?"
19226                 $from try.out
19227                 if $test -s try.out -a "X$code" = X42; then
19228                         fflushNULL="`$cat try.out`"
19229                 else
19230                         if $test "X$code" != X42; then
19231                                 $cat >&4 <<EOM
19232 (If this test failed, don't worry, we'll try another method shortly.)
19233 EOM
19234                         fi
19235                 fi
19236         fi
19237         $rm -f core try.core core.try.*
19238         case "$fflushNULL" in
19239         x)      $cat >&4 <<EOM
19240 Your fflush(NULL) works okay for output streams.
19241 Let's see if it clobbers input pipes...
19242 EOM
19243 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19244 # bug that improperly flushes the input end of pipes.  So we avoid the
19245 # autoflush on fork/system/exec support for now. :-(
19246 $cat >tryp.c <<EOCP
19247 #include <stdio.h>
19248 int
19249 main(int argc, char **argv)
19250 {
19251     char buf[1024];
19252     int i;
19253     char *bp = buf;
19254     while (1) {
19255         while ((i = getc(stdin)) != -1
19256                && (*bp++ = i) != '\n'
19257                && bp < &buf[1024])
19258         /* DO NOTHING */ ;
19259         *bp = '\0';
19260         fprintf(stdout, "%s", buf);
19261         fflush(NULL);
19262         if (i == -1)
19263             return 0;
19264         bp = buf;
19265     }
19266 }
19267 EOCP
19268                 fflushNULL="$define"
19269                 set tryp
19270                 if eval $compile; then
19271                     $rm -f tryp.out
19272                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19273                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19274                        $cat >&4 <<EOM
19275 fflush(NULL) seems to behave okay with input streams.
19276 EOM
19277                         fflushNULL="$define"
19278                     else
19279                         $cat >&4 <<EOM
19280 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19281 EOM
19282                         fflushNULL="$undef"
19283                     fi
19284                 fi
19285                 $rm -f core tryp.c tryp.core core.tryp.*
19286                 ;;
19287         '')     $cat >&4 <<EOM
19288 Your fflush(NULL) isn't working (contrary to ANSI C).
19289 EOM
19290                 fflushNULL="$undef"
19291                 ;;
19292         *)      $cat >&4 <<EOM
19293 Cannot figure out whether your fflush(NULL) works or not.
19294 I'm assuming it doesn't (contrary to ANSI C).
19295 EOM
19296                 fflushNULL="$undef"
19297                 ;;
19298         esac
19299         ;;
19300 $define|true|[yY]*)
19301         fflushNULL="$define"
19302         ;;
19303 *)
19304         fflushNULL="$undef"
19305         ;;
19306 esac
19307 : check explicit looping only if NULL did not work, and if the pipe
19308 : bug does not show up on an explicit flush too
19309 case "$fflushNULL" in
19310 "$undef")
19311         $cat >tryp.c <<EOCP
19312 #include <stdio.h>
19313 int
19314 main(int argc, char **argv)
19315 {
19316     char buf[1024];
19317     int i;
19318     char *bp = buf;
19319     while (1) {
19320         while ((i = getc(stdin)) != -1
19321                && (*bp++ = i) != '\n'
19322                && bp < &buf[1024])
19323         /* DO NOTHING */ ;
19324         *bp = '\0';
19325         fprintf(stdout, "%s", buf);
19326         fflush(stdin);
19327         if (i == -1)
19328             return 0;
19329         bp = buf;
19330     }
19331 }
19332 EOCP
19333         set tryp
19334         if eval $compile; then
19335             $rm -f tryp.out
19336             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19337             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19338                $cat >&4 <<EOM
19339 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19340 EOM
19341                 : now check for fflushall behaviour
19342                 case "$fflushall" in
19343                 '')     set try -DTRY_FFLUSH_ALL $output
19344                         if eval $compile; then
19345                                 $cat >&4 <<EOM
19346 (Now testing the other method--but note that this also may fail.)
19347 EOM
19348                                 $run ./try 2>/dev/null
19349                                 code=$?
19350                                 $from try.out
19351                                 if $test -s try.out -a "X$code" = X42; then
19352                                         fflushall="`$cat try.out`"
19353                                 fi
19354                         fi
19355                         $rm_try
19356                         case "$fflushall" in
19357                         x)      $cat >&4 <<EOM
19358 Whew. Flushing explicitly all the stdio streams works.
19359 EOM
19360                                 fflushall="$define"
19361                                 ;;
19362                         '')     $cat >&4 <<EOM
19363 Sigh. Flushing explicitly all the stdio streams doesn't work.
19364 EOM
19365                                 fflushall="$undef"
19366                                 ;;
19367                         *)      $cat >&4 <<EOM
19368 Cannot figure out whether flushing stdio streams explicitly works or not.
19369 I'm assuming it doesn't.
19370 EOM
19371                                 fflushall="$undef"
19372                                 ;;
19373                         esac
19374                         ;;
19375                 "$define"|true|[yY]*)
19376                         fflushall="$define"
19377                         ;;
19378                 *)
19379                         fflushall="$undef"
19380                         ;;
19381                 esac
19382             else
19383                 $cat >&4 <<EOM
19384 All is futile.  Even fflush(stdin) clobbers input pipes!
19385 EOM
19386                 fflushall="$undef"
19387             fi
19388         else
19389             fflushall="$undef"
19390         fi
19391         $rm -f core tryp.c tryp.core core.tryp.*
19392         ;;
19393 *)      fflushall="$undef"
19394         ;;
19395 esac
19396
19397 case "$fflushNULL$fflushall" in
19398 undefundef)
19399         $cat <<EOM
19400 OK, I give up.  I cannot figure out how to flush pending stdio output.
19401 We won't be flushing handles at all before fork/exec/popen.
19402 EOM
19403         ;;
19404 esac
19405 $rm_try tryp
19406
19407 : Store the full pathname to the ar program for use in the C program
19408 : Respect a hint or command line value for full_ar.
19409 case "$full_ar" in
19410 '') full_ar=$ar ;;
19411 esac
19412
19413 : Store the full pathname to the sed program for use in the C program
19414 full_sed=$sed
19415
19416 : see what type gids are declared as in the kernel
19417 echo " "
19418 echo "Looking for the type for group ids returned by getgid()."
19419 set gid_t gidtype xxx stdio.h sys/types.h
19420 eval $typedef
19421 case "$gidtype" in
19422 xxx)
19423         xxx=`./findhdr sys/user.h`
19424         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19425         case $1 in
19426         unsigned) dflt="$1 $2" ;;
19427         *) dflt="$1" ;;
19428         esac
19429         ;;
19430 *) dflt="$gidtype";;
19431 esac
19432 case "$gidtype" in
19433 gid_t) echo "gid_t found." ;;
19434 *)      rp="What is the type for group ids returned by getgid()?"
19435         . ./myread
19436         gidtype="$ans"
19437         ;;
19438 esac
19439
19440 : Check the size of GID
19441 echo " "
19442 case "$gidtype" in
19443 *_t) zzz="$gidtype"     ;;
19444 *)   zzz="gid"          ;;
19445 esac
19446 echo "Checking the size of $zzz..." >&4
19447 cat > try.c <<EOCP
19448 #include <sys/types.h>
19449 #include <stdio.h>
19450 #$i_stdlib I_STDLIB
19451 #ifdef I_STDLIB
19452 #include <stdlib.h>
19453 #endif
19454 int main() {
19455     printf("%d\n", (int)sizeof($gidtype));
19456     exit(0);
19457 }
19458 EOCP
19459 set try
19460 if eval $compile_ok; then
19461         yyy=`$run ./try`
19462         case "$yyy" in
19463         '')     gidsize=4
19464                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19465                 ;;
19466         *)      gidsize=$yyy
19467                 echo "Your $zzz is $gidsize bytes long."
19468                 ;;
19469         esac
19470 else
19471         gidsize=4
19472         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19473 fi
19474
19475
19476 : Check if GID is signed
19477 echo " "
19478 case "$gidtype" in
19479 *_t) zzz="$gidtype"     ;;
19480 *)   zzz="gid"          ;;
19481 esac
19482 echo "Checking the sign of $zzz..." >&4
19483 cat > try.c <<EOCP
19484 #include <sys/types.h>
19485 #include <stdio.h>
19486 int main() {
19487         $gidtype foo = -1;
19488         if (foo < 0)
19489                 printf("-1\n");
19490         else
19491                 printf("1\n");
19492 }
19493 EOCP
19494 set try
19495 if eval $compile; then
19496         yyy=`$run ./try`
19497         case "$yyy" in
19498         '')     gidsign=1
19499                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19500                 ;;
19501         *)      gidsign=$yyy
19502                 case "$gidsign" in
19503                  1) echo "Your $zzz is unsigned." ;;
19504                 -1) echo "Your $zzz is signed."   ;;
19505                 esac
19506                 ;;
19507         esac
19508 else
19509         gidsign=1
19510         echo "(I can't compile the test program--guessing unsigned.)" >&4
19511 fi
19512
19513
19514 : Check 64bit sizes
19515 echo " "
19516
19517 if $test X"$quadtype" != X; then
19518
19519 echo "Checking how to print 64-bit integers..." >&4
19520
19521 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19522         $cat >try.c <<'EOCP'
19523 #include <sys/types.h>
19524 #include <stdio.h>
19525 int main() {
19526   int q = 12345678901;
19527   printf("%ld\n", q);
19528 }
19529 EOCP
19530         set try
19531         if eval $compile; then
19532                 yyy=`$run ./try`
19533                 case "$yyy" in
19534                 12345678901)
19535                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19536                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19537                         echo "We will use %d."
19538                         ;;
19539                 esac
19540         fi
19541 fi
19542
19543 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19544         $cat >try.c <<'EOCP'
19545 #include <sys/types.h>
19546 #include <stdio.h>
19547 int main() {
19548   long q = 12345678901;
19549   printf("%ld\n", q);
19550 }
19551 EOCP
19552         set try
19553         if eval $compile; then
19554                 yyy=`$run ./try`
19555                 case "$yyy" in
19556                 12345678901)
19557                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19558                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19559                         echo "We will use %ld."
19560                         ;;
19561                 esac
19562         fi
19563 fi
19564
19565 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19566         $cat >try.c <<'EOCP'
19567 #include <sys/types.h>
19568 #include <inttypes.h>
19569 #include <stdio.h>
19570 int main() {
19571   int64_t q = 12345678901;
19572   printf("%" PRId64 "\n", q);
19573 }
19574 EOCP
19575         set try
19576         if eval $compile; then
19577                 yyy=`$run ./try`
19578                 case "$yyy" in
19579                 12345678901)
19580                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19581                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19582                         echo "We will use the C9X style."
19583                         ;;
19584                 esac
19585         fi
19586 fi
19587
19588 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19589         $cat >try.c <<EOCP
19590 #include <sys/types.h>
19591 #include <stdio.h>
19592 int main() {
19593   $quadtype q = 12345678901;
19594   printf("%Ld\n", q);
19595 }
19596 EOCP
19597         set try
19598         if eval $compile; then
19599                 yyy=`$run ./try`
19600                 case "$yyy" in
19601                 12345678901)
19602                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19603                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19604                         echo "We will use %Ld."
19605                         ;;
19606                 esac
19607         fi
19608 fi
19609
19610 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19611         $cat >try.c <<'EOCP'
19612 #include <sys/types.h>
19613 #include <stdio.h>
19614 int main() {
19615   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19616   printf("%lld\n", q);
19617 }
19618 EOCP
19619         set try
19620         if eval $compile; then
19621                 yyy=`$run ./try`
19622                 case "$yyy" in
19623                 12345678901)
19624                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19625                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19626                         echo "We will use the %lld style."
19627                         ;;
19628                 esac
19629         fi
19630 fi
19631
19632 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19633         $cat >try.c <<EOCP
19634 #include <sys/types.h>
19635 #include <stdio.h>
19636 int main() {
19637   $quadtype q = 12345678901;
19638   printf("%qd\n", q);
19639 }
19640 EOCP
19641         set try
19642         if eval $compile; then
19643                 yyy=`$run ./try`
19644                 case "$yyy" in
19645                 12345678901)
19646                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19647                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19648                         echo "We will use %qd."
19649                         ;;
19650                 esac
19651         fi
19652 fi
19653
19654 if $test X"$sPRId64" = X; then
19655         echo "Cannot figure out how to print 64-bit integers." >&4
19656 fi
19657 $rm_try
19658
19659 fi
19660
19661 case "$sPRId64" in
19662 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19663         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19664         ;;
19665 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19666         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19667         ;;
19668 esac
19669
19670 : Check format strings for internal types
19671 echo " "
19672 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19673
19674 if $test X"$ivsize" = X8; then
19675         ivdformat="$sPRId64"
19676         uvuformat="$sPRIu64"
19677         uvoformat="$sPRIo64"
19678         uvxformat="$sPRIx64"
19679         uvXUformat="$sPRIXU64"
19680 else
19681         if $test X"$ivsize" = X"$longsize"; then
19682                 ivdformat='"ld"'
19683                 uvuformat='"lu"'
19684                 uvoformat='"lo"'
19685                 uvxformat='"lx"'
19686                 uvXUformat='"lX"'
19687         else
19688                 if $test X"$ivsize" = X"$intsize"; then
19689                         ivdformat='"d"'
19690                         uvuformat='"u"'
19691                         uvoformat='"o"'
19692                         uvxformat='"x"'
19693                         uvXUformat='"X"'
19694                 else
19695                         : far out
19696                         if $test X"$ivsize" = X"$shortsize"; then
19697                                 ivdformat='"hd"'
19698                                 uvuformat='"hu"'
19699                                 uvoformat='"ho"'
19700                                 uvxformat='"hx"'
19701                                 uvXUformat='"hX"'
19702                         fi
19703                 fi
19704         fi
19705 fi
19706
19707 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19708         nveformat="$sPRIeldbl"
19709         nvfformat="$sPRIfldbl"
19710         nvgformat="$sPRIgldbl"
19711         nvEUformat="$sPRIEUldbl"
19712         nvFUformat="$sPRIFUldbl"
19713         nvGUformat="$sPRIGUldbl"
19714 else
19715         nveformat='"e"'
19716         nvfformat='"f"'
19717         nvgformat='"g"'
19718         nvEUformat='"E"'
19719         nvFUformat='"F"'
19720         nvGUformat='"G"'
19721 fi
19722
19723 case "$ivdformat" in
19724 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19725     exit 1
19726     ;;
19727 esac
19728
19729 : Check format string for GID
19730
19731 echo " "
19732 $echo "Checking the format string to be used for gids..." >&4
19733
19734 case "$gidsign" in
19735 -1)     if $test X"$gidsize" = X"$ivsize"; then
19736                 gidformat="$ivdformat"
19737         else
19738                 if $test X"$gidsize" = X"$longsize"; then
19739                         gidformat='"ld"'
19740                 else
19741                         if $test X"$gidsize" = X"$intsize"; then
19742                                 gidformat='"d"'
19743                         else
19744                                 if $test X"$gidsize" = X"$shortsize"; then
19745                                         gidformat='"hd"'
19746                                 fi
19747                         fi
19748                 fi
19749         fi
19750         ;;
19751 *)      if $test X"$gidsize" = X"$uvsize"; then
19752                 gidformat="$uvuformat"
19753         else
19754                 if $test X"$gidsize" = X"$longsize"; then
19755                         gidformat='"lu"'
19756                 else
19757                         if $test X"$gidsize" = X"$intsize"; then
19758                                 gidformat='"u"'
19759                         else
19760                                 if $test X"$gidsize" = X"$shortsize"; then
19761                                         gidformat='"hu"'
19762                                 fi
19763                         fi
19764                 fi
19765         fi
19766         ;;
19767 esac
19768
19769 : see if getgroups exists
19770 set getgroups d_getgrps
19771 eval $inlibc
19772
19773 : see if setgroups exists
19774 set setgroups d_setgrps
19775 eval $inlibc
19776
19777 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19778 echo " "
19779 case "$d_getgrps$d_setgrps" in
19780 *define*)
19781         case "$groupstype" in
19782         '') dflt="$gidtype" ;;
19783         *)  dflt="$groupstype" ;;
19784         esac
19785         $cat <<EOM
19786 What type of pointer is the second argument to getgroups() and setgroups()?
19787 Usually this is the same as group ids, $gidtype, but not always.
19788
19789 EOM
19790         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19791         . ./myread
19792         groupstype="$ans"
19793         ;;
19794 *)  groupstype="$gidtype";;
19795 esac
19796
19797 : MAD = Misc Attribute Definition
19798
19799 if $test $patchlevel -lt 9; then
19800 : MAD is not available in 5.8.x or earlier.
19801     ans=n;
19802 else
19803     case "$mad" in
19804     $define|true|[yY]*) dflt='y' ;;
19805     *)                  dflt='n' ;;
19806     esac
19807     cat <<EOM
19808
19809 Would you like to build with Misc Attribute Decoration? This is development
19810 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19811 overhead on the interpreter.
19812
19813 If this doesn't make any sense to you, just accept the default '$dflt'.
19814 EOM
19815     rp='Build Perl with MAD?'
19816     . ./myread
19817 fi
19818 case "$ans" in
19819 y|Y)    val="$define"
19820         madlyh='madly.h madly.act madly.tab'
19821         madlysrc='madly.c'
19822         madlyobj="madly$_o" ;;
19823 *)      val="$undef"
19824         madlyh=''
19825         madlysrc=''
19826         madlyobj='' ;;
19827 esac
19828 set mad
19829 eval $setvar
19830
19831 : check whether make sets MAKE
19832 echo " "
19833 echo "Checking if your $make program sets \$(MAKE)..." >&4
19834 case "$make_set_make" in
19835 '')
19836         $sed 's/^X //' > testmake.mak << 'EOF'
19837 Xall:
19838 X       @echo 'maketemp="$(MAKE)"'
19839 EOF
19840         case "`$make -f testmake.mak 2>/dev/null`" in
19841         *maketemp=*) make_set_make='#' ;;
19842         *)      make_set_make="MAKE=$make" ;;
19843         esac
19844         $rm -f testmake.mak
19845         ;;
19846 esac
19847 case "$make_set_make" in
19848 '#') echo "Yup, it does.";;
19849 *) echo "Nope, it doesn't.";;
19850 esac
19851
19852 : see what type is used for mode_t
19853 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19854 set mode_t modetype int stdio.h sys/types.h
19855 eval $typedef_ask
19856
19857 : see if we need va_copy
19858 echo " "
19859 case "$i_stdarg" in
19860 "$define")
19861         $cat >try.c <<EOCP
19862 #include <stdarg.h>
19863 #include <stdio.h>
19864 #$i_stdlib I_STDLIB
19865 #ifdef I_STDLIB
19866 #include <stdlib.h>
19867 #endif
19868 #include <signal.h>
19869
19870 int
19871 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19872 {
19873   return vfprintf(f, fmt, *valp);
19874 }
19875
19876 int
19877 myvfprintf(FILE *f, const  char *fmt, va_list val)
19878 {
19879   return ivfprintf(f, fmt, &val);
19880 }
19881
19882 int
19883 myprintf(char *fmt, ...)
19884 {
19885   va_list val;
19886   va_start(val, fmt);
19887   return myvfprintf(stdout, fmt, val);
19888 }
19889
19890 int
19891 main(int ac, char **av)
19892 {
19893   signal(SIGSEGV, exit);
19894
19895   myprintf("%s%cs all right, then\n", "that", '\'');
19896   exit(0);
19897 }
19898 EOCP
19899         set try
19900         if eval $compile && $run ./try 2>&1 >/dev/null; then
19901                 case "`$run ./try`" in
19902                 "that's all right, then")
19903                         okay=yes
19904                         ;;
19905                 esac
19906         fi
19907         case "$okay" in
19908         yes)    echo "It seems that you don't need va_copy()." >&4
19909                 need_va_copy="$undef"
19910                 ;;
19911         *)      echo "It seems that va_copy() or similar will be needed." >&4
19912                 need_va_copy="$define"
19913                 ;;
19914         esac
19915         $rm_try
19916         ;;
19917 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19918         ;;
19919 esac
19920
19921 : see what type is used for size_t
19922 rp="What is the type used for the length parameter for string functions?"
19923 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19924 eval $typedef_ask
19925
19926 : check for type of arguments to gethostbyaddr. 
19927 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19928         case "$d_gethbyaddr" in
19929         $define)
19930                 $cat <<EOM
19931
19932 Checking to see what type of arguments are accepted by gethostbyaddr().
19933 EOM
19934                 hdrs="$define sys/types.h
19935                         $d_socket sys/socket.h 
19936                         $i_niin netinet/in.h 
19937                         $i_netdb netdb.h
19938                         $i_unistd unistd.h"
19939                 : The first arg can 'char *' or 'void *'
19940                 : The second arg is some of integral type
19941                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19942                         for yyy in size_t long int; do
19943                                 case "$netdb_host_type" in
19944                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
19945                                         if ./protochk "$try" $hdrs; then
19946                                                 echo "Your system accepts $xxx for the first arg."
19947                                                 echo "...and $yyy for the second arg."
19948                                                 netdb_host_type="$xxx"
19949                                                 netdb_hlen_type="$yyy"
19950                                         fi
19951                                         ;;
19952                                 esac
19953                         done
19954                 done
19955                 : In case none of those worked, prompt the user.
19956                 case "$netdb_host_type" in
19957                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19958                         dflt='char *'
19959                         . ./myread
19960                         netdb_host_type=$ans
19961                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19962                         dflt="$sizetype"
19963                         . ./myread
19964                         netdb_hlen_type=$ans
19965                         ;;
19966                 esac
19967                 ;;
19968         *)      : no gethostbyaddr, so pick harmless defaults
19969                 netdb_host_type='char *'
19970                 netdb_hlen_type="$sizetype"
19971                 ;;
19972         esac
19973         # Remove the "const" if needed. -- but then we'll have a 
19974         # prototype clash!
19975         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19976 fi
19977
19978 : check for type of argument to gethostbyname. 
19979 if test "X$netdb_name_type" = X ; then
19980         case "$d_gethbyname" in
19981         $define)
19982                 $cat <<EOM
19983
19984 Checking to see what type of argument is accepted by gethostbyname().
19985 EOM
19986                 hdrs="$define sys/types.h
19987                         $d_socket sys/socket.h 
19988                         $i_niin netinet/in.h 
19989                         $i_netdb netdb.h
19990                         $i_unistd unistd.h"
19991                 for xxx in "const char *" "char *"; do
19992                         case "$netdb_name_type" in
19993                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
19994                                 if ./protochk "$try" $hdrs; then
19995                                         echo "Your system accepts $xxx."
19996                                         netdb_name_type="$xxx"
19997                                 fi
19998                                 ;;
19999                         esac
20000                 done
20001                 : In case none of those worked, prompt the user.
20002                 case "$netdb_name_type" in
20003                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20004                         dflt='char *'
20005                         . ./myread
20006                         netdb_name_type=$ans
20007                         ;;
20008                 esac
20009                 ;;
20010         *)      : no gethostbyname, so pick harmless default
20011                 netdb_name_type='char *'
20012                 ;;
20013         esac
20014 fi
20015
20016 : check for type of 1st argument to getnetbyaddr. 
20017 if test "X$netdb_net_type" = X ; then
20018         case "$d_getnbyaddr" in
20019         $define)
20020                 $cat <<EOM
20021
20022 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20023 EOM
20024                 hdrs="$define sys/types.h
20025                         $d_socket sys/socket.h 
20026                         $i_niin netinet/in.h 
20027                         $i_netdb netdb.h
20028                         $i_unistd unistd.h"
20029                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20030                         case "$netdb_net_type" in
20031                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20032                                 if ./protochk "$try" $hdrs; then
20033                                         echo "Your system accepts $xxx."
20034                                         netdb_net_type="$xxx"
20035                                 fi
20036                                 ;;
20037                         esac
20038                 done
20039                 : In case none of those worked, prompt the user.
20040                 case "$netdb_net_type" in
20041                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20042                         dflt='long'
20043                         . ./myread
20044                         netdb_net_type=$ans
20045                         ;;
20046                 esac
20047                 ;;
20048         *)      : no getnetbyaddr, so pick harmless default
20049                 netdb_net_type='long'
20050                 ;;
20051         esac
20052 fi
20053 : locate the preferred pager for this system
20054 fn=f/
20055 case "$pager" in
20056 '')
20057         dflt=''
20058         case "$pg" in
20059         /*) dflt=$pg;;
20060         [a-zA-Z]:/*) dflt=$pg;;
20061         esac
20062         case "$more" in
20063         /*) dflt=$more;;
20064         [a-zA-Z]:/*) dflt=$more;;
20065         esac
20066         case "$less" in
20067         /*) dflt=$less;;
20068         [a-zA-Z]:/*) dflt=$less;;
20069         esac
20070         case "$dflt" in
20071         '') dflt=/usr/ucb/more;;
20072         esac
20073         ;;
20074 *)      dflt="$pager"
20075         fn="f/($pager)"
20076         ;;
20077 esac
20078 echo " "
20079 rp='What pager is used on your system?'
20080 . ./getfile
20081 pager="$ans"
20082
20083 : see what type pids are declared as in the kernel
20084 rp="What is the type of process ids on this system?"
20085 set pid_t pidtype int stdio.h sys/types.h
20086 eval $typedef_ask
20087
20088 : see if ar generates random libraries by itself
20089 echo " "
20090 echo "Checking how to generate random libraries on your machine..." >&4
20091 echo 'int bar1() { return bar2(); }' > bar1.c
20092 echo 'int bar2() { return 2; }' > bar2.c
20093 $cat > foo.c <<EOP
20094 #$i_stdlib I_STDLIB
20095 #ifdef I_STDLIB
20096 #include <stdlib.h>
20097 #endif
20098 int main() { printf("%d\n", bar1()); exit(0); }
20099 EOP
20100 $cc $ccflags -c bar1.c >/dev/null 2>&1
20101 $cc $ccflags -c bar2.c >/dev/null 2>&1
20102 $cc $ccflags -c foo.c >/dev/null 2>&1
20103 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20104 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20105         $run ./foobar >/dev/null 2>&1; then
20106         echo "$ar appears to generate random libraries itself."
20107         orderlib=false
20108         if [ "X$ranlib" = "X" ]; then
20109             ranlib=":"
20110         fi
20111 elif $ar s bar$_a >/dev/null 2>&1 &&
20112         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20113         $run ./foobar >/dev/null 2>&1; then
20114                 echo "a table of contents needs to be added with '$ar s'."
20115                 orderlib=false
20116                 ranlib="$ar s"
20117 elif $ar ts bar$_a >/dev/null 2>&1 &&
20118         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20119         $run ./foobar >/dev/null 2>&1; then
20120                 echo "a table of contents needs to be added with '$ar ts'."
20121                 orderlib=false
20122                 ranlib="$ar ts"
20123 else
20124         case "$ranlib" in
20125         :) ranlib='';;
20126         '')
20127                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20128                 $test -f $ranlib || ranlib=''
20129                 ;;
20130         esac
20131         if $test -n "$ranlib"; then
20132                 echo "your system has '$ranlib'; we'll use that."
20133                 orderlib=false
20134         else
20135                 echo "your system doesn't seem to support random libraries"
20136                 echo "so we'll use lorder and tsort to order the libraries."
20137                 orderlib=true
20138                 ranlib=":"
20139         fi
20140 fi
20141 $rm -f foo* bar*
20142
20143 : see if this is a values.h system
20144 set values.h i_values
20145 eval $inhdr
20146
20147 : Check the max offset that gmtime and localtime accept
20148 echo "Checking max offsets that gmtime () accepts"
20149
20150 case $i_values in
20151     define) yyy="#include <values.h>" ;;
20152     *)      yyy="" ;;
20153     esac
20154
20155 case "$sGMTIME_min/$sGMTIME_max" in
20156     0/0|/)
20157         $cat >try.c <<EOCP
20158 #include <sys/types.h>
20159 #include <stdio.h>
20160 #include <time.h>
20161 $yyy
20162
20163 int i;
20164 struct tm *tmp;
20165 time_t pt;
20166
20167 void gm_check (time_t t, int min_year, int max_year)
20168 {
20169     tmp = gmtime (&t);
20170     if ( tmp == NULL ||
20171         /* Check tm_year overflow */
20172          tmp->tm_year < min_year || tmp->tm_year > max_year)
20173         tmp = NULL;
20174     else
20175         pt = t;
20176     } /* gm_check */
20177
20178 int check_max ()
20179 {
20180     tmp = NULL;
20181     pt  = 0;
20182 #ifdef MAXLONG
20183     gm_check (MAXLONG, 69, 0x7fffffff);
20184 #endif
20185     if (tmp == NULL || tmp->tm_year < 0) {
20186         for (i = 63; i >= 0; i--) {
20187             time_t x = pt | ((time_t)1 << i);
20188             if (x < 0 || x < pt) continue;
20189             gm_check (x, 69, 0x7fffffff);
20190             }
20191         }
20192     printf ("sGMTIME_max=%ld\n", pt);
20193     return (0);
20194     } /* check_max */
20195
20196 int check_min ()
20197 {
20198     tmp = NULL;
20199     pt  = 0;
20200 #ifdef MINLONG
20201     gm_check (MINLONG, -1900, 70);
20202 #endif
20203     if (tmp == NULL) {
20204         for (i = 36; i >= 0; i--) {
20205             time_t x = pt - ((time_t)1 << i);
20206             if (x > 0) continue;
20207             gm_check (x, -1900, 70);
20208             }
20209         }
20210     printf ("sGMTIME_min=%ld\n", pt);
20211     return (0);
20212     } /* check_min */
20213
20214 int main (int argc, char *argv[])
20215 {
20216     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20217     check_max ();
20218     check_min ();
20219     return (0);
20220     } /* main */
20221 EOCP
20222         set try
20223         if eval $compile; then
20224             eval `$run ./try`
20225         else
20226             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20227             fi
20228         $rm_try
20229         ;;
20230     esac
20231
20232 echo "Checking max offsets that localtime () accepts"
20233
20234 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20235     0/0|/)
20236         $cat >try.c <<EOCP
20237 #include <sys/types.h>
20238 #include <stdio.h>
20239 #include <time.h>
20240 $yyy
20241
20242 int i;
20243 struct tm *tmp;
20244 time_t pt;
20245
20246 void local_check (time_t t, int min_year, int max_year)
20247 {
20248     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20249         tmp = NULL;
20250     else
20251         tmp = localtime (&t);
20252     if ( tmp == NULL ||
20253         /* Check tm_year overflow */
20254          tmp->tm_year < min_year || tmp->tm_year > max_year)
20255         tmp = NULL;
20256     else
20257         pt = t;
20258     } /* local_check */
20259
20260 int check_max ()
20261 {
20262     tmp = NULL;
20263     pt  = 0;
20264 #ifdef MAXLONG
20265     local_check (MAXLONG, 69, 0x7fffffff);
20266 #endif
20267     if (tmp == NULL || tmp->tm_year < 0) {
20268         for (i = 63; i >= 0; i--) {
20269             time_t x = pt | ((time_t)1 << i);
20270             if (x < 0 || x < pt) continue;
20271             local_check (x, 69, 0x7fffffff);
20272             }
20273         }
20274     printf ("sLOCALTIME_max=%ld\n", pt);
20275     return (0);
20276    } /* check_max */
20277
20278 int check_min ()
20279 {
20280     tmp = NULL;
20281     pt  = 0;
20282 #ifdef MINLONG
20283     local_check (MINLONG, -1900, 70);
20284 #endif
20285     if (tmp == NULL) {
20286         for (i = 36; i >= 0; i--) {
20287             time_t x = pt - ((time_t)1 << i);
20288             if (x > 0) continue;
20289             local_check (x, -1900, 70);
20290             }
20291         }
20292     printf ("sLOCALTIME_min=%ld\n", pt);
20293     return (0);
20294     } /* check_min */
20295
20296 int main (int argc, char *argv[])
20297 {
20298     check_max ();
20299     check_min ();
20300     return (0);
20301     } /* main */
20302 EOCP
20303         set try
20304         if eval $compile; then
20305             eval `$run ./try`
20306         else
20307             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20308             fi
20309         $rm_try
20310         ;;
20311     esac
20312
20313 : check for type of arguments to select.
20314 case "$selecttype" in
20315 '') case "$d_select" in
20316         $define)
20317                 echo " "
20318                 $cat <<EOM
20319 Checking to see what type of arguments are accepted by select().
20320 EOM
20321                 hdrs="$define sys/types.h
20322                         $i_systime sys/time.h
20323                         $i_sysselct sys/select.h
20324                         $d_socket sys/socket.h"
20325                 : The first arg can be int, unsigned, or size_t
20326                 : The last arg may or may not be 'const'
20327                 val=''
20328                 : void pointer has been seen but using that
20329                 : breaks the selectminbits test
20330                 for xxx in 'fd_set *' 'int *'; do
20331                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20332                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20333                                         case "$val" in
20334                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20335                                                 if ./protochk "$try" $hdrs; then
20336                                                         echo "Your system accepts $xxx."
20337                                                         val="$xxx"
20338                                                 fi
20339                                                 ;;
20340                                         esac
20341                                 done
20342                         done
20343                 done
20344                 case "$val" in
20345                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20346                         case "$d_fd_set" in
20347                                 $define) dflt="fd_set *" ;;
20348                                 *)              dflt="int *" ;;
20349                         esac
20350                         . ./myread
20351                         val=$ans
20352                         ;;
20353                 esac
20354                 selecttype="$val"
20355                 ;;
20356         *)      : no select, so pick a harmless default
20357                 selecttype='int *'
20358                 ;;
20359         esac
20360         ;;
20361 esac
20362
20363 : check for the select 'width'
20364 case "$selectminbits" in
20365 '') safebits=`expr $ptrsize \* 8`
20366     case "$d_select" in
20367         $define)
20368                 $cat <<EOM
20369
20370 Checking to see on how many bits at a time your select() operates...
20371 EOM
20372                 $cat >try.c <<EOCP
20373 #include <sys/types.h>
20374 #$i_time I_TIME
20375 #$i_systime I_SYS_TIME
20376 #$i_systimek I_SYS_TIME_KERNEL
20377 #ifdef I_TIME
20378 #   include <time.h>
20379 #endif
20380 #ifdef I_SYS_TIME
20381 #   ifdef I_SYS_TIME_KERNEL
20382 #       define KERNEL
20383 #   endif
20384 #   include <sys/time.h>
20385 #   ifdef I_SYS_TIME_KERNEL
20386 #       undef KERNEL
20387 #   endif
20388 #endif
20389 #$i_sysselct I_SYS_SELECT
20390 #ifdef I_SYS_SELECT
20391 #include <sys/select.h>
20392 #endif
20393 #$d_socket HAS_SOCKET
20394 #ifdef HAS_SOCKET
20395 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20396 #endif
20397 #include <stdio.h>
20398 #$i_stdlib I_STDLIB
20399 #ifdef I_STDLIB
20400 #include <stdlib.h>
20401 #endif
20402 $selecttype b;
20403 #define S sizeof(*(b))
20404 #define MINBITS 64
20405 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20406 #define NBITS  (NBYTES * 8)
20407 int main() {
20408     char *s = (char *)malloc(NBYTES);
20409     struct timeval t;
20410     int i;
20411     FILE* fp;
20412     int fd;
20413
20414     if (!s)
20415         exit(1);
20416     fclose(stdin);
20417     fp = fopen("try.c", "r");
20418     if (fp == 0)
20419       exit(2);
20420     fd = fileno(fp);
20421     if (fd < 0)
20422       exit(3);
20423     b = ($selecttype)s;
20424     for (i = 0; i < NBITS; i++)
20425         FD_SET(i, b);
20426     t.tv_sec  = 0;
20427     t.tv_usec = 0;
20428     select(fd + 1, b, 0, 0, &t);
20429     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20430     free(s);
20431     printf("%d\n", i + 1);
20432     return 0;
20433 }
20434 EOCP
20435                 set try
20436                 if eval $compile_ok; then
20437                         selectminbits=`$run ./try`
20438                         case "$selectminbits" in
20439                         '')     cat >&4 <<EOM
20440 Cannot figure out on how many bits at a time your select() operates.
20441 I'll play safe and guess it is $safebits bits.
20442 EOM
20443                                 selectminbits=$safebits
20444                                 bits="$safebits bits"
20445                                 ;;
20446                         1)      bits="1 bit" ;;
20447                         *)      bits="$selectminbits bits" ;;
20448                         esac
20449                         echo "Your select() operates on $bits at a time." >&4
20450                 else
20451                         rp='What is the minimum number of bits your select() operates on?'
20452                         case "$byteorder" in
20453                         12345678)       dflt=64 ;;
20454                         1234)           dflt=32 ;;
20455                         *)              dflt=1  ;;
20456                         esac
20457                         . ./myread
20458                         val=$ans
20459                         selectminbits="$val"
20460                 fi
20461                 $rm_try
20462                 ;;
20463         *)      : no select, so pick a harmless default
20464                 selectminbits=$safebits
20465                 ;;
20466         esac
20467         ;;
20468 esac
20469
20470 : Trace out the files included by signal.h, then look for SIGxxx names.
20471 if [ "X$fieldn" = X ]; then
20472         : Just make some guesses.  We check them later.
20473         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20474 else
20475         xxx=`echo '#include <signal.h>' |
20476         $cppstdin $cppminus $cppflags 2>/dev/null |
20477         $grep '^[       ]*#.*include' |
20478         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20479                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20480 fi
20481 xxxfiles=''
20482 for xx in $xxx /dev/null ; do
20483         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20484 done
20485 case "$xxxfiles" in
20486 '')     xxxfiles=`./findhdr signal.h` ;;
20487 esac
20488 xxx=`awk '
20489 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20490         print substr($2, 4, 20)
20491 }
20492 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20493         print substr($3, 4, 20)
20494 }' $xxxfiles`
20495 : Append some common names just in case the awk scan failed.
20496 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20497 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20498 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20499 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20500 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20501
20502 : generate a few handy files for later
20503 $cat > signal.c <<EOCP
20504 #include <sys/types.h>
20505 #include <signal.h>
20506 #$i_stdlib I_STDLIB
20507 #ifdef I_STDLIB
20508 #include <stdlib.h>
20509 #endif
20510 #include <stdio.h>
20511 int main() {
20512
20513 /* Strange style to avoid deeply-nested #if/#else/#endif */
20514 #ifndef NSIG
20515 #  ifdef _NSIG
20516 #    define NSIG (_NSIG)
20517 #  endif
20518 #endif
20519
20520 #ifndef NSIG
20521 #  ifdef SIGMAX
20522 #    define NSIG (SIGMAX+1)
20523 #  endif
20524 #endif
20525
20526 #ifndef NSIG
20527 #  ifdef SIG_MAX
20528 #    define NSIG (SIG_MAX+1)
20529 #  endif
20530 #endif
20531
20532 #ifndef NSIG
20533 #  ifdef _SIG_MAX
20534 #    define NSIG (_SIG_MAX+1)
20535 #  endif
20536 #endif
20537
20538 #ifndef NSIG
20539 #  ifdef MAXSIG
20540 #    define NSIG (MAXSIG+1)
20541 #  endif
20542 #endif
20543
20544 #ifndef NSIG
20545 #  ifdef MAX_SIG
20546 #    define NSIG (MAX_SIG+1)
20547 #  endif
20548 #endif
20549
20550 #ifndef NSIG
20551 #  ifdef SIGARRAYSIZE
20552 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20553 #  endif
20554 #endif
20555
20556 #ifndef NSIG
20557 #  ifdef _sys_nsig
20558 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20559 #  endif
20560 #endif
20561
20562 /* Default to some arbitrary number that's big enough to get most
20563    of the common signals.
20564 */
20565 #ifndef NSIG
20566 #    define NSIG 50
20567 #endif
20568
20569 printf("NSIG %d\n", NSIG);
20570
20571 #ifndef JUST_NSIG
20572
20573 EOCP
20574
20575 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20576 {
20577         printf "#ifdef SIG"; printf $1; printf "\n"
20578         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20579         printf $1; printf ");\n"
20580         printf "#endif\n"
20581 }
20582 END {
20583         printf "#endif /* JUST_NSIG */\n";
20584         printf "exit(0);\n}\n";
20585 }
20586 ' >>signal.c
20587 $cat >signal.awk <<'EOP'
20588 BEGIN { ndups = 0 }
20589 $1 ~ /^NSIG$/ { nsig = $2 }
20590 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20591     if ($2 > maxsig) { maxsig = $2 }
20592     if (sig_name[$2]) {
20593         dup_name[ndups] = $1
20594         dup_num[ndups] = $2
20595         ndups++
20596     }
20597     else {
20598         sig_name[$2] = $1
20599         sig_num[$2] = $2
20600     }
20601 }
20602 END {
20603     if (nsig == 0) {
20604         nsig = maxsig + 1
20605     }
20606     printf("NSIG %d\n", nsig);
20607     for (n = 1; n < nsig; n++) {
20608         if (sig_name[n]) {
20609             printf("%s %d\n", sig_name[n], sig_num[n])
20610         }
20611         else {
20612             printf("NUM%d %d\n", n, n)
20613         }
20614     }
20615     for (n = 0; n < ndups; n++) {
20616         printf("%s %d\n", dup_name[n], dup_num[n])
20617     }
20618 }
20619 EOP
20620 $cat >signal_cmd <<EOS
20621 $startsh
20622 if $test -s signal.lst; then
20623     echo "Using your existing signal.lst file"
20624         exit 0
20625 fi
20626 xxx="$xxx"
20627 EOS
20628 $cat >>signal_cmd <<'EOS'
20629
20630 set signal
20631 if eval $compile_ok; then
20632         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20633                 $uniq | $awk -f signal.awk >signal.lst
20634 else
20635         echo "(I can't seem be able to compile the whole test program)" >&4
20636         echo "(I'll try it in little pieces.)" >&4
20637         set signal -DJUST_NSIG
20638         if eval $compile_ok; then
20639                 $run ./signal$_exe > signal.nsg
20640                 $cat signal.nsg
20641         else
20642                 echo "I can't seem to figure out how many signals you have." >&4
20643                 echo "Guessing 50." >&4
20644                 echo 'NSIG 50' > signal.nsg
20645         fi
20646         : Now look at all the signal names, one at a time.
20647         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20648                 $cat > signal.c <<EOCP
20649 #include <sys/types.h>
20650 #include <signal.h>
20651 #include <stdio.h>
20652 int main() {
20653 printf("$xx %d\n", SIG${xx});
20654 return 0;
20655 }
20656 EOCP
20657                 set signal
20658                 if eval $compile; then
20659                         echo "SIG${xx} found."
20660                         $run ./signal$_exe  >> signal.ls1
20661                 else
20662                         echo "SIG${xx} NOT found."
20663                 fi
20664         done
20665         if $test -s signal.ls1; then
20666                 $cat signal.nsg signal.ls1 |
20667                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20668         fi
20669
20670 fi
20671 if $test -s signal.lst; then
20672         :
20673 else
20674         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20675         echo 'kill -l' >signal
20676         set X `csh -f <signal`
20677         $rm -f signal
20678         shift
20679         case $# in
20680         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20681         esac
20682         echo $@ | $tr ' ' $trnl | \
20683             $awk '{ printf "%s %d\n", $1, ++s; }
20684                   END { printf "NSIG %d\n", ++s }' >signal.lst
20685 fi
20686 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20687 EOS
20688 chmod a+x signal_cmd
20689 $eunicefix signal_cmd
20690
20691 : generate list of signal names
20692 echo " "
20693 case "$sig_name_init" in
20694 '') doinit=yes ;;
20695 *)  case "$sig_num_init" in
20696     ''|*,*) doinit=yes ;;
20697     esac ;;
20698 esac
20699 case "$doinit" in
20700 yes)
20701         echo "Generating a list of signal names and numbers..." >&4
20702         . ./signal_cmd
20703         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20704         sig_name=`$awk 'BEGIN { printf "ZERO " }
20705                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20706         sig_num=`$awk  'BEGIN { printf "0 " }
20707                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20708         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20709                              !/^NSIG/   { printf "\"%s\", ", $1 }
20710                              END        { printf "0\n" }' signal.lst`
20711         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20712                              !/^NSIG/   { printf "%d, ", $2}
20713                              END        { printf "0\n"}' signal.lst`
20714         ;;
20715 esac
20716 echo "The following $sig_count signals are available:"
20717 echo " "
20718 echo $sig_name | $awk \
20719 'BEGIN { linelen = 0 }
20720 {
20721         for (i = 1; i <= NF; i++) {
20722                 name = "SIG" $i " "
20723                 linelen = linelen + length(name)
20724                 if (linelen > 70) {
20725                         printf "\n"
20726                         linelen = length(name)
20727                 }
20728                 printf "%s", name
20729         }
20730         printf "\n"
20731 }'
20732 sig_size=`echo $sig_name | awk '{print NF}'`
20733 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20734
20735 : Check size of size
20736 echo " "
20737 case "$sizetype" in
20738 *_t) zzz="$sizetype"    ;;
20739 *)   zzz="filesize"     ;;
20740 esac
20741 echo "Checking the size of $zzz..." >&4
20742 cat > try.c <<EOCP
20743 #include <sys/types.h>
20744 #include <stdio.h>
20745 #$i_stdlib I_STDLIB
20746 #ifdef I_STDLIB
20747 #include <stdlib.h>
20748 #endif
20749 int main() {
20750     printf("%d\n", (int)sizeof($sizetype));
20751     exit(0);
20752 }
20753 EOCP
20754 set try
20755 if eval $compile_ok; then
20756         yyy=`$run ./try`
20757         case "$yyy" in
20758         '')     sizesize=4
20759                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20760                 ;;
20761         *)      sizesize=$yyy
20762                 echo "Your $zzz size is $sizesize bytes."
20763                 ;;
20764         esac
20765 else
20766         sizesize=4
20767         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20768 fi
20769
20770
20771 : check for socklen_t
20772 echo " "
20773 echo "Checking to see if you have socklen_t..." >&4
20774 $cat >try.c <<EOCP
20775 #include <sys/types.h>
20776 #$d_socket HAS_SOCKET
20777 #ifdef HAS_SOCKET
20778 #include <sys/socket.h>
20779 #endif
20780 int main() { socklen_t x = 16; }
20781 EOCP
20782 set try
20783 if eval $compile; then
20784         val="$define"
20785         echo "You have socklen_t."
20786 else
20787         val="$undef"
20788         echo "You do not have socklen_t."
20789         case "$sizetype" in
20790         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20791         esac
20792 fi
20793 $rm_try
20794 set d_socklen_t
20795 eval $setvar
20796
20797 : see if this is a socks.h system
20798 set socks.h i_socks
20799 eval $inhdr
20800
20801 : check for type of the size argument to socket calls
20802 case "$d_socket" in
20803 "$define")
20804         $cat <<EOM
20805
20806 Checking to see what type is the last argument of accept().
20807 EOM
20808         yyy=''
20809         case "$d_socklen_t" in
20810         "$define") yyy="$yyy socklen_t"
20811         esac
20812         yyy="$yyy $sizetype int long unsigned"
20813         for xxx in $yyy; do
20814                 case "$socksizetype" in
20815                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
20816                         case "$usesocks" in
20817                         "$define")
20818                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20819                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20820                                         socksizetype="$xxx"
20821                                 fi
20822                                 ;;
20823                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20824                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20825                                         socksizetype="$xxx"
20826                                 fi
20827                                 ;;
20828                         esac
20829                         ;;
20830                 esac
20831         done
20832 : In case none of those worked, prompt the user.
20833         case "$socksizetype" in
20834         '')     rp='What is the type for socket address structure sizes?'
20835                 dflt='int'
20836                 . ./myread
20837                 socksizetype=$ans
20838                 ;;
20839         esac
20840         ;;
20841 *)      : no sockets, so pick relatively harmless default
20842         socksizetype='int'
20843         ;;
20844 esac
20845
20846 : see what type is used for signed size_t
20847 set ssize_t ssizetype int stdio.h sys/types.h
20848 eval $typedef
20849 dflt="$ssizetype"
20850 $cat > try.c <<EOM
20851 #include <stdio.h>
20852 #$i_stdlib I_STDLIB
20853 #ifdef I_STDLIB
20854 #include <stdlib.h>
20855 #endif
20856 #include <sys/types.h>
20857 #define Size_t $sizetype
20858 #define SSize_t $dflt
20859 int main()
20860 {
20861         if (sizeof(Size_t) == sizeof(SSize_t))
20862                 printf("$dflt\n");
20863         else if (sizeof(Size_t) == sizeof(int))
20864                 printf("int\n");
20865         else
20866                 printf("long\n");
20867         exit(0);
20868 }
20869 EOM
20870 echo " "
20871 set try
20872 if eval $compile_ok && $run ./try > /dev/null; then
20873         ssizetype=`$run ./try`
20874         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20875 else
20876         $cat >&4 <<EOM
20877 Help! I can't compile and run the ssize_t test program: please enlighten me!
20878 (This is probably a misconfiguration in your system or libraries, and
20879 you really ought to fix it.  Still, I'll try anyway.)
20880
20881 I need a type that is the same size as $sizetype, but is guaranteed to
20882 be signed.  Common values are ssize_t, int and long.
20883
20884 EOM
20885         rp="What signed type is the same size as $sizetype?"
20886         . ./myread
20887         ssizetype="$ans"
20888 fi
20889 $rm_try
20890
20891 : see what type of char stdio uses.
20892 echo " "
20893 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
20894 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20895         echo "Your stdio uses unsigned chars." >&4
20896         stdchar="unsigned char"
20897 else
20898         echo "Your stdio uses signed chars." >&4
20899         stdchar="char"
20900 fi
20901 $rm -f stdioh
20902
20903 : see what type uids are declared as in the kernel
20904 echo " "
20905 echo "Looking for the type for user ids returned by getuid()."
20906 set uid_t uidtype xxx stdio.h sys/types.h
20907 eval $typedef
20908 case "$uidtype" in
20909 xxx)
20910         xxx=`./findhdr sys/user.h`
20911         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20912         case $1 in
20913         unsigned) dflt="$1 $2" ;;
20914         *) dflt="$1" ;;
20915         esac
20916         ;;
20917 *) dflt="$uidtype";;
20918 esac
20919 case "$uidtype" in
20920 uid_t)  echo "uid_t found." ;;
20921 *)      rp="What is the type for user ids returned by getuid()?"
20922         . ./myread
20923         uidtype="$ans"
20924         ;;
20925 esac
20926
20927 : Check size of UID
20928 echo " "
20929 case "$uidtype" in
20930 *_t) zzz="$uidtype"     ;;
20931 *)   zzz="uid"          ;;
20932 esac
20933 echo "Checking the size of $zzz..." >&4
20934 cat > try.c <<EOCP
20935 #include <sys/types.h>
20936 #include <stdio.h>
20937 #$i_stdlib I_STDLIB
20938 #ifdef I_STDLIB
20939 #include <stdlib.h>
20940 #endif
20941 int main() {
20942     printf("%d\n", (int)sizeof($uidtype));
20943     exit(0);
20944 }
20945 EOCP
20946 set try
20947 if eval $compile_ok; then
20948         yyy=`$run ./try`
20949         case "$yyy" in
20950         '')     uidsize=4
20951                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20952                 ;;
20953         *)      uidsize=$yyy
20954                 echo "Your $zzz is $uidsize bytes long."
20955                 ;;
20956         esac
20957 else
20958         uidsize=4
20959         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20960 fi
20961
20962 : Check if UID is signed
20963 echo " "
20964 case "$uidtype" in
20965 *_t) zzz="$uidtype"     ;;
20966 *)   zzz="uid"          ;;
20967 esac
20968 echo "Checking the sign of $zzz..." >&4
20969 cat > try.c <<EOCP
20970 #include <sys/types.h>
20971 #include <stdio.h>
20972 int main() {
20973         $uidtype foo = -1;
20974         if (foo < 0)
20975                 printf("-1\n");
20976         else
20977                 printf("1\n");
20978 }
20979 EOCP
20980 set try
20981 if eval $compile; then
20982         yyy=`$run ./try`
20983         case "$yyy" in
20984         '')     uidsign=1
20985                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20986                 ;;
20987         *)      uidsign=$yyy
20988                 case "$uidsign" in
20989                  1) echo "Your $zzz is unsigned." ;;
20990                 -1) echo "Your $zzz is signed."   ;;
20991                 esac
20992                 ;;
20993         esac
20994 else
20995         uidsign=1
20996         echo "(I can't compile the test program--guessing unsigned.)" >&4
20997 fi
20998
20999
21000 : Check format string for UID
21001 echo " "
21002 $echo "Checking the format string to be used for uids..." >&4
21003
21004 case "$uidsign" in
21005 -1)     if $test X"$uidsize" = X"$ivsize"; then
21006                 uidformat="$ivdformat"
21007         else
21008                 if $test X"$uidsize" = X"$longsize"; then
21009                         uidformat='"ld"'
21010                 else
21011                         if $test X"$uidsize" = X"$intsize"; then
21012                                 uidformat='"d"'
21013                         else
21014                                 if $test X"$uidsize" = X"$shortsize"; then
21015                                         uidformat='"hd"'
21016                                 fi
21017                         fi
21018                 fi
21019         fi
21020         ;;
21021 *)      if $test X"$uidsize" = X"$uvsize"; then
21022                 uidformat="$uvuformat"
21023         else
21024                 if $test X"$uidsize" = X"$longsize"; then
21025                         uidformat='"lu"'
21026                 else
21027                         if $test X"$uidsize" = X"$intsize"; then
21028                                 uidformat='"u"'
21029                         else
21030                                 if $test X"$uidsize" = X"$shortsize"; then
21031                                         uidformat='"hu"'
21032                                 fi
21033                         fi
21034                 fi
21035         fi
21036         ;;
21037 esac
21038
21039 : Check if site customization support was requested
21040 case "$usesitecustomize" in
21041     $define|true|[Yy]*)
21042         usesitecustomize="$define"
21043         ;;
21044     *)
21045         usesitecustomize="$undef"
21046         ;;
21047     esac
21048
21049 : determine compiler compiler
21050 case "$yacc" in
21051 '')
21052         dflt=yacc;;
21053 *)
21054         dflt="$yacc";;
21055 esac
21056 echo " "
21057 comp='yacc'
21058 if $test -f "$byacc$_exe"; then
21059         dflt="$byacc"
21060         comp="byacc or $comp"
21061 fi
21062 if $test -f "$bison$_exe"; then
21063         comp="$comp or bison -y"
21064 fi
21065 rp="Which compiler compiler ($comp) shall I use?"
21066 . ./myread
21067 yacc="$ans"
21068 case "$yacc" in
21069 *bis*)
21070         case "$yacc" in
21071         *-y*) ;;
21072         *)
21073                 yacc="$yacc -y"
21074                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21075                 ;;
21076         esac
21077         ;;
21078 esac
21079
21080 : see if this is a assert.h system
21081 set assert.h i_assert
21082 eval $inhdr
21083
21084 : see if this is a fp.h system
21085 set fp.h i_fp
21086 eval $inhdr
21087
21088 : see if this is a fp_class.h system
21089 set fp_class.h i_fp_class
21090 eval $inhdr
21091
21092 : see if gdbm.h is available
21093 set gdbm.h t_gdbm
21094 eval $inhdr
21095 case "$t_gdbm" in
21096 $define)
21097         : see if gdbm_open exists
21098         set gdbm_open d_gdbm_open
21099         eval $inlibc
21100         case "$d_gdbm_open" in
21101         $undef)
21102                 t_gdbm="$undef"
21103                 echo "We won't be including <gdbm.h>"
21104                 ;;
21105         esac
21106         ;;
21107 esac
21108 val="$t_gdbm"
21109 set i_gdbm
21110 eval $setvar
21111
21112 : see if this is a ieeefp.h system
21113 case "$i_ieeefp" in
21114 '' ) set ieeefp.h i_ieeefp
21115      eval $inhdr
21116      ;;
21117 esac
21118
21119 : see if this is a libutil.h system
21120 set libutil.h i_libutil
21121 eval $inhdr
21122
21123 : see if mach cthreads are available
21124 if test "X$usethreads" = "X$define"; then
21125         set mach/cthreads.h i_machcthr
21126         eval $inhdr
21127 else
21128         i_machcthr="$undef"
21129 fi
21130
21131 : see if this is a mntent.h system
21132 set mntent.h i_mntent
21133 eval $inhdr
21134
21135 : see if net/errno.h is available
21136 val=''
21137 set net/errno.h val
21138 eval $inhdr
21139
21140 : Unfortunately, it causes problems on some systems.  Arrgh.
21141 case "$val" in
21142 $define)
21143         cat > try.c <<'EOM'
21144 #include <stdio.h>
21145 #include <errno.h>
21146 #include <net/errno.h>
21147 int func()
21148 {
21149         return ENOTSOCK;
21150 }
21151 EOM
21152         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21153                 echo "We'll be including <net/errno.h>." >&4
21154         else
21155                 echo "We won't be including <net/errno.h>." >&4
21156                 val="$undef"
21157         fi
21158         $rm_try
21159         ;;
21160 esac
21161 set i_neterrno
21162 eval $setvar
21163
21164 : see if netinet/tcp.h is available
21165 set netinet/tcp.h i_netinettcp
21166 eval $inhdr
21167
21168 : see if this is a poll.h system
21169 set poll.h i_poll
21170 eval $inhdr
21171
21172 : see if this is a prot.h system
21173 set prot.h i_prot
21174 eval $inhdr
21175
21176 : Preprocessor symbols
21177 echo " "
21178 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21179 $cat <<'EOSH' > Cppsym.know
21180 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21181 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21182 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21183 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21184 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21185 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21186 bull c cadmus clipper CMU COFF COMPILER_VERSION
21187 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21188 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21189 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21190 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21191 GLIBC GLIBC_MINOR
21192 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21193 H3050R H3050RX hbullx20 hcx host_mips
21194 hp200 hp300 hp700 HP700 hp800 hp9000
21195 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21196 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21197 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21198 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21199 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21200 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21201 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21202 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21203 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21204 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21205 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21206 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21207 MATH_HAS_NO_SIDE_EFFECTS
21208 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21209 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21210 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21211 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21212 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21213 NetBSD news1500 news1700 news1800 news1900 news3700
21214 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21215 ns32016 ns32332 ns32k nsc32000
21216 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21217 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21218 pc532 pdp11 PGC PIC plexus PORTAR posix
21219 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21220 POSIX_C_SOURCE POSIX_SOURCE POWER
21221 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21222 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21223 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21224 sony sony_news sonyrisc sparc sparclite spectrum
21225 stardent stdc STDC_EXT stratos sun sun3 sun386
21226 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21227 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21228 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21229 sysV68 sysV88 Tek4132 Tek4300 titan
21230 TM3200 TM5400 TM5600
21231 tower tower32 tower32_200 tower32_600 tower32_700
21232 tower32_800 tower32_850 tss
21233 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21234 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21235 unix UNIX95 UNIX99 unixpc unos
21236 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21237 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21238 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21239 USGr4 USGr4_2
21240 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21241 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21242 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21243 z8000
21244 EOSH
21245 # Maybe put other stuff here too.
21246 cat <<EOSH >>Cppsym.know
21247 $osname
21248 EOSH
21249 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21250 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21251 $cat Cppsym.know > Cppsym.c
21252 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21253 $rm -f Cppsym.a Cppsym.b Cppsym.c
21254 cat <<EOSH > Cppsym
21255 $startsh
21256 if $test \$# -gt 0; then
21257     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21258     if $test -s Cppsym.got; then
21259         $rm -f Cppsym.got
21260         exit 0
21261     fi
21262     $rm -f Cppsym.got
21263     exit 1
21264 else
21265     $tr " " "$trnl" | ./Cppsym.try
21266     exit 0
21267 fi
21268 EOSH
21269 chmod +x Cppsym
21270 $eunicefix Cppsym
21271 cat <<EOSH > Cppsym.try
21272 $startsh
21273 cat <<'EOCP' > try.c
21274 #include <stdio.h>
21275 #if cpp_stuff == 1
21276 #define STRINGIFY(a)    "a"
21277 #endif
21278 #if cpp_stuff == 42
21279 #define StGiFy(a)  #a
21280 #define STRINGIFY(a)    StGiFy(a)
21281 #endif
21282 #if $cpp_stuff != 1 && $cpp_stuff != 42
21283 #   include "Bletch: How does this C preprocessor stringify macros?"
21284 #endif
21285 int main() {
21286 EOCP
21287 $awk \\
21288 EOSH
21289 cat <<'EOSH' >> Cppsym.try
21290 'length($1) > 0 {
21291     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21292     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21293     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21294     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21295 }'       >> try.c
21296 echo 'return 0;}' >> try.c
21297 EOSH
21298 cat <<EOSH >> Cppsym.try
21299 ccflags="$ccflags"
21300 case "$osname-$gccversion" in
21301 irix-) ccflags="\$ccflags -woff 1178" ;;
21302 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21303 esac
21304 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21305 EOSH
21306 chmod +x Cppsym.try
21307 $eunicefix Cppsym.try
21308 ./Cppsym < Cppsym.know > Cppsym.true
21309 : Add in any linux cpp "predefined macros":
21310 case "$osname::$gccversion" in
21311   *linux*::*.*)
21312     tHdrH=_tmpHdr
21313     rm -f $tHdrH'.h' $tHdrH
21314     touch $tHdrH'.h'
21315     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21316        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21317        if [ -s $tHdrH'_cppsym.real' ]; then
21318           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21319        fi
21320     fi
21321     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21322   ;;
21323 esac
21324 : now check the C compiler for additional symbols
21325 postprocess_cc_v=''
21326 case "$osname" in
21327 aix) postprocess_cc_v="|$tr , ' '" ;;
21328 esac
21329 $cat >ccsym <<EOS
21330 $startsh
21331 $cat >tmp.c <<EOF
21332 extern int foo;
21333 EOF
21334 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21335 do
21336         case "\$i" in
21337         -D*) echo "\$i" | $sed 's/^-D//';;
21338         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21339         esac
21340 done
21341 $rm_try
21342 EOS
21343 postprocess_cc_v=''
21344 chmod +x ccsym
21345 $eunicefix ccsym
21346 ./ccsym > ccsym1.raw
21347 if $test -s ccsym1.raw; then
21348        $sort ccsym1.raw | $uniq >ccsym.raw
21349 else
21350        mv ccsym1.raw ccsym.raw
21351 fi
21352
21353 $awk '/\=/ { print $0; next }
21354         { print $0"=1" }' ccsym.raw >ccsym.list
21355 $comm -13 Cppsym.true ccsym.list >ccsym.own
21356 $comm -12 Cppsym.true ccsym.list >ccsym.com
21357 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21358 also=''
21359 if $test -z ccsym.raw; then
21360         echo "Your C compiler doesn't seem to define any symbols!" >&4
21361         echo " "
21362         echo "However, your C preprocessor defines the following symbols:"
21363         $cat Cppsym.true
21364         ccsymbols=''
21365         cppsymbols=`$cat Cppsym.true`
21366         cppsymbols=`echo $cppsymbols`
21367         cppccsymbols="$cppsymbols"
21368 else
21369         if $test -s ccsym.com; then
21370                 echo "Your C compiler and pre-processor define these symbols:"
21371                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21372                 also='also '
21373                 symbols='ones'
21374                 cppccsymbols=`$cat ccsym.com`
21375                 cppccsymbols=`echo $cppccsymbols`
21376                 $test "$silent" || sleep 1
21377         fi
21378         if $test -s ccsym.cpp; then
21379                 $test "$also" && echo " "
21380                 echo "Your C pre-processor ${also}defines the following symbols:"
21381                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21382                 also='further '
21383                 cppsymbols=`$cat ccsym.cpp`
21384                 cppsymbols=`echo $cppsymbols`
21385                 $test "$silent" || sleep 1
21386         fi
21387         if $test -s ccsym.own; then
21388                 $test "$also" && echo " "
21389                 echo "Your C compiler ${also}defines the following cpp symbols:"
21390                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21391                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21392                 ccsymbols=`$cat ccsym.own`
21393                 ccsymbols=`echo $ccsymbols`
21394                 $test "$silent" || sleep 1
21395         fi
21396 fi
21397
21398 : see if this is a termio system
21399 val="$undef"
21400 val2="$undef"
21401 val3="$undef"
21402 if $test `./findhdr termios.h`; then
21403         set tcsetattr i_termios
21404         eval $inlibc
21405         val3="$i_termios"
21406 fi
21407 echo " "
21408 case "$val3" in
21409 "$define") echo "You have POSIX termios.h... good!" >&4;;
21410 *) if ./Cppsym pyr; then
21411                 case "`/bin/universe`" in
21412                 ucb) if $test `./findhdr sgtty.h`; then
21413                                 val2="$define"
21414                                 echo "<sgtty.h> found." >&4
21415                         else
21416                                 echo "System is pyramid with BSD universe."
21417                                 ./warn "<sgtty.h> not found--you could have problems."
21418                         fi;;
21419                 *) if $test `./findhdr termio.h`; then
21420                                 val="$define"
21421                                 echo "<termio.h> found." >&4
21422                         else
21423                                 echo "System is pyramid with USG universe."
21424                                 ./warn "<termio.h> not found--you could have problems."
21425                         fi;;
21426                 esac
21427         elif ./usg; then
21428                 if $test `./findhdr termio.h`; then
21429                         echo "<termio.h> found." >&4
21430                         val="$define"
21431                 elif $test `./findhdr sgtty.h`; then
21432                         echo "<sgtty.h> found." >&4
21433                         val2="$define"
21434                 else
21435                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21436                 fi
21437         else
21438                 if $test `./findhdr sgtty.h`; then
21439                         echo "<sgtty.h> found." >&4
21440                         val2="$define"
21441                 elif $test `./findhdr termio.h`; then
21442                         echo "<termio.h> found." >&4
21443                         val="$define"
21444                 else
21445                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21446                 fi
21447         fi;;
21448 esac
21449 set i_termio; eval $setvar
21450 val=$val2; set i_sgtty; eval $setvar
21451 val=$val3; set i_termios; eval $setvar
21452
21453 : see if stddef is available
21454 set stddef.h i_stddef
21455 eval $inhdr
21456
21457 : see if sys/access.h is available
21458 set sys/access.h i_sysaccess
21459 eval $inhdr
21460
21461 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21462 set sys/filio.h i_sysfilio
21463 eval $inhdr
21464 echo " "
21465 if $test `./findhdr sys/ioctl.h`; then
21466         val="$define"
21467         echo '<sys/ioctl.h> found.' >&4
21468 else
21469         val="$undef"
21470         if $test $i_sysfilio = "$define"; then
21471             echo '<sys/ioctl.h> NOT found.' >&4
21472         else
21473                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21474                 $test $i_termio = "$define" && xxx="termio.h"
21475                 $test $i_termios = "$define" && xxx="termios.h"
21476 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21477         fi
21478 fi
21479 set i_sysioctl
21480 eval $setvar
21481
21482 : see if socket ioctl defs are in sys/sockio.h
21483 echo " "
21484 xxx=`./findhdr sys/sockio.h`
21485 if $test "$xxx"; then
21486         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21487                 val="$define"
21488                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21489         else
21490                 val="$undef"
21491                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21492         fi
21493 else
21494         val="$undef"
21495         $cat <<EOM
21496 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21497 EOM
21498 fi
21499 set i_syssockio
21500 eval $setvar
21501
21502 : see if this is a syslog.h system
21503 set syslog.h i_syslog
21504 eval $inhdr
21505
21506 : see if this is a sys/mode.h system
21507 set sys/mode.h i_sysmode
21508 eval $inhdr
21509
21510 : see if there is a sys/poll.h file
21511 set sys/poll.h i_syspoll
21512 eval $inhdr
21513
21514 : see if sys/resource.h has to be included
21515 set sys/resource.h i_sysresrc
21516 eval $inhdr
21517
21518 : see if sys/security.h is available
21519 set sys/security.h i_syssecrt
21520 eval $inhdr
21521
21522 : see if this is a sys/statvfs.h system
21523 set sys/statvfs.h i_sysstatvfs
21524 eval $inhdr
21525
21526 : see if this is a sys/un.h system
21527 set sys/un.h i_sysun
21528 eval $inhdr
21529
21530 : see if this is a sys/utsname.h system
21531 set sys/utsname.h i_sysutsname
21532 eval $inhdr
21533
21534 : see if this is a syswait system
21535 set sys/wait.h i_syswait
21536 eval $inhdr
21537
21538 : see if this is a ustat.h system
21539 set ustat.h i_ustat
21540 eval $inhdr
21541
21542 : see if this is an utime system
21543 set utime.h i_utime
21544 eval $inhdr
21545
21546 : see if this is a vfork system
21547 case "$d_vfork" in
21548 "$define")
21549         set vfork.h i_vfork
21550         eval $inhdr
21551         ;;
21552 *)
21553         i_vfork="$undef"
21554         ;;
21555 esac
21556
21557 : Check extensions
21558 echo " "
21559 echo "Looking for extensions..." >&4
21560 : If we are using the old config.sh, known_extensions may contain
21561 : old or inaccurate or duplicate values.
21562 known_extensions=''
21563 nonxs_extensions=''
21564 : We do not use find because it might not be available.
21565 : We do not just use MANIFEST because the user may have dropped
21566 : some additional extensions into the source tree and expect them
21567 : to be built.
21568
21569 : Function to recursively find available extensions, ignoring DynaLoader
21570 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21571 find_extensions='
21572     for xxx in *; do
21573         case "$xxx" in
21574             DynaLoader|dynaload) ;;
21575             *)
21576             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21577                 known_extensions="$known_extensions $1$xxx";
21578             elif $test -f $xxx/Makefile.PL; then
21579                 nonxs_extensions="$nonxs_extensions $1$xxx";
21580             else
21581                 if $test -d $xxx -a $# -lt 10; then
21582                     set $1$xxx/ $*;
21583                     cd "$xxx";
21584                     eval $find_extensions;
21585                     cd ..;
21586                     shift;
21587                 fi;
21588             fi
21589             ;;
21590         esac;
21591     done'
21592 tdir=`pwd`
21593 cd "$rsrc/ext"
21594 set X
21595 shift
21596 eval $find_extensions
21597 # Special case:  Add in modules that nest beyond the first level.
21598 # Currently threads/shared and Hash/Util/FieldHash, since they are
21599 # not picked up by the recursive find above (and adding in general
21600 # recursive finding breaks SDBM_File/sdbm).
21601 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21602 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21603 set X $known_extensions
21604 shift
21605 known_extensions="$*"
21606 set X $nonxs_extensions
21607 shift
21608 nonxs_extensions="$*"
21609 cd "$tdir"
21610
21611 : Now see which are supported on this system.
21612 avail_ext=''
21613 for xxx in $known_extensions ; do
21614         case "$xxx" in
21615         DB_File|db_file)
21616                 case "$i_db" in
21617                 $define) avail_ext="$avail_ext $xxx" ;;
21618                 esac
21619                 ;;
21620         GDBM_File|gdbm_fil)
21621                 case "$i_gdbm" in
21622                 $define) avail_ext="$avail_ext $xxx" ;;
21623                 esac
21624                 ;;
21625         I18N/Langinfo|i18n_lan)
21626                 case "$i_langinfo$d_nl_langinfo" in
21627                 $define$define) avail_ext="$avail_ext $xxx" ;;
21628                 esac
21629                 ;;
21630         IPC/SysV|ipc/sysv)
21631                 : XXX Do we need a useipcsysv variable here
21632                 case "${d_msg}${d_sem}${d_shm}" in
21633                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21634                 esac
21635                 ;;
21636         NDBM_File|ndbm_fil)
21637                 case "$i_ndbm" in
21638                 $define)
21639                     case "$osname-$use64bitint" in
21640                     hpux-define)
21641                         case "$libs" in
21642                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21643                         esac
21644                         ;;
21645                     *) avail_ext="$avail_ext $xxx" ;;
21646                     esac
21647                     ;;
21648                 esac
21649                 ;;
21650         ODBM_File|odbm_fil)
21651                 case "${i_dbm}${i_rpcsvcdbm}" in
21652                 *"${define}"*)
21653                     case "$d_cplusplus" in
21654                     define) ;; # delete as a function name will not work
21655                     *)  case "$osname-$use64bitint" in
21656                         hpux-define)
21657                             case "$libs" in
21658                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21659                             esac
21660                             ;;
21661                         *) avail_ext="$avail_ext $xxx" ;;
21662                         esac
21663                         ;;
21664                     esac
21665                     ;;
21666                 esac
21667                 ;;
21668         Opcode|opcode)
21669                 case "$useopcode" in
21670                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21671                 esac
21672                 ;;
21673         POSIX|posix)
21674                 case "$useposix" in
21675                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21676                 esac
21677                 ;;
21678         Socket|socket)
21679                 case "$d_socket" in
21680                 true|$define|y)
21681                     case "$osname" in
21682                     beos) ;; # not unless BONE
21683                     *) avail_ext="$avail_ext $xxx" ;;
21684                     esac
21685                     ;;
21686                 esac
21687                 ;;
21688         Sys/Syslog|sys/syslog)
21689                 : XXX syslog requires socket
21690                 case "$d_socket" in
21691                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21692                 esac
21693                 ;;
21694         Thread|thread)
21695                 case "$usethreads" in
21696                 true|$define|y)
21697                         case "$use5005threads" in
21698                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21699                         esac
21700                 esac
21701                 ;;
21702         threads|threads/shared)
21703                 # threads and threads::shared are special cases.
21704                 # To stop people from asking "Perl 5.8.0 was supposed
21705                 # to have this new fancy threads implementation but my
21706                 # perl doesn't have it" and from people trying to
21707                 # (re)install the threads module using CPAN.pm and
21708                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21709                 # the threads.pm and threads/shared.pm will always be
21710                 # there, croaking informatively ("you need to rebuild
21711                 # all of Perl with threads, sorry") when threads haven't
21712                 # been compiled in.
21713                 # --jhi
21714                 avail_ext="$avail_ext $xxx"
21715                 ;;
21716         Win32*)
21717                 case "$osname" in
21718                 cygwin) avail_ext="$avail_ext $xxx" ;;
21719                 esac
21720                 ;;
21721         XS/APItest|xs/apitest)
21722                 # This is just for testing.  Skip it unless we have dynamic loading.
21723
21724                 case "$usedl" in
21725                 $define) avail_ext="$avail_ext $xxx" ;;
21726                 esac
21727                 ;;
21728         XS/Typemap|xs/typemap)
21729                 # This is just for testing.  Skip it unless we have dynamic loading.
21730                 case "$usedl" in
21731                 $define) avail_ext="$avail_ext $xxx" ;;
21732                 esac
21733                 ;;
21734         *)      avail_ext="$avail_ext $xxx"
21735                 ;;
21736         esac
21737 done
21738
21739 set X $avail_ext
21740 shift
21741 avail_ext="$*"
21742
21743 case "$onlyextensions" in
21744 '') ;;
21745 *)  keepextensions=''
21746     echo "You have requested that only certains extensions be included..." >&4
21747     for i in $onlyextensions; do
21748         case " $avail_ext " in
21749         *" $i "*)
21750             echo "Keeping extension $i."
21751             keepextensions="$keepextensions $i"
21752             ;;
21753         *) echo "Ignoring extension $i." ;;
21754         esac
21755     done
21756     avail_ext="$keepextensions"
21757     ;;
21758 esac
21759
21760 case "$noextensions" in
21761 '') ;;
21762 *)  keepextensions=''
21763     echo "You have requested that certain extensions be ignored..." >&4
21764     for i in $avail_ext; do
21765         case " $noextensions " in
21766         *" $i "*) echo "Ignoring extension $i." ;;
21767         *) echo "Keeping extension $i.";
21768            keepextensions="$keepextensions $i"
21769            ;;
21770         esac
21771     done
21772     avail_ext="$keepextensions"
21773     ;;
21774 esac
21775
21776 : Now see which nonxs extensions are supported on this system.
21777 : For now assume all are.
21778 nonxs_ext=''
21779 for xxx in $nonxs_extensions ; do
21780         case "$xxx" in
21781         *)      nonxs_ext="$nonxs_ext $xxx"
21782                 ;;
21783         esac
21784 done
21785
21786 set X $nonxs_ext
21787 shift
21788 nonxs_ext="$*"
21789
21790 case $usedl in
21791 $define)
21792         $cat <<EOM
21793 A number of extensions are supplied with $package.  You may choose to
21794 compile these extensions for dynamic loading (the default), compile
21795 them into the $package executable (static loading), or not include
21796 them at all.  Answer "none" to include no extensions.
21797 Note that DynaLoader is always built and need not be mentioned here.
21798
21799 EOM
21800         case "$dynamic_ext" in
21801         '')
21802                 : Exclude those listed in static_ext
21803                 dflt=''
21804                 for xxx in $avail_ext; do
21805                         case " $static_ext " in
21806                         *" $xxx "*) ;;
21807                         *) dflt="$dflt $xxx" ;;
21808                         esac
21809                 done
21810                 set X $dflt
21811                 shift
21812                 dflt="$*"
21813                 ;;
21814         *)      dflt="$dynamic_ext"
21815                 # Perhaps we are reusing an old out-of-date config.sh.
21816                 case "$hint" in
21817                 previous)
21818                         if test X"$dynamic_ext" != X"$avail_ext"; then
21819                                 $cat <<EOM
21820 NOTICE:  Your previous config.sh list may be incorrect.
21821 The extensions now available to you are
21822         ${avail_ext}
21823 but the default list from your previous config.sh is
21824         ${dynamic_ext}
21825
21826 EOM
21827                         fi
21828                         ;;
21829                 esac
21830                 ;;
21831         esac
21832         case "$dflt" in
21833         '')     dflt=none;;
21834         esac
21835         rp="What extensions do you wish to load dynamically?"
21836         . ./myread
21837         case "$ans" in
21838         none) dynamic_ext=' ' ;;
21839         *) dynamic_ext="$ans" ;;
21840         esac
21841
21842         case "$static_ext" in
21843         '')
21844                 : Exclude those already listed in dynamic linking
21845                 dflt=''
21846                 for xxx in $avail_ext; do
21847                         case " $dynamic_ext " in
21848                         *" $xxx "*) ;;
21849                         *) dflt="$dflt $xxx" ;;
21850                         esac
21851                 done
21852                 set X $dflt
21853                 shift
21854                 dflt="$*"
21855                 ;;
21856         *)  dflt="$static_ext"
21857                 ;;
21858         esac
21859
21860         case "$dflt" in
21861         '')     dflt=none;;
21862         esac
21863         rp="What extensions do you wish to load statically?"
21864         . ./myread
21865         case "$ans" in
21866         none) static_ext=' ' ;;
21867         *) static_ext="$ans" ;;
21868         esac
21869         ;;
21870 *)
21871         $cat <<EOM
21872 A number of extensions are supplied with $package.  Answer "none"
21873 to include no extensions.
21874 Note that DynaLoader is always built and need not be mentioned here.
21875
21876 EOM
21877         case "$static_ext" in
21878         '') dflt="$avail_ext" ;;
21879         *)      dflt="$static_ext"
21880                 # Perhaps we are reusing an old out-of-date config.sh.
21881                 case "$hint" in
21882                 previous)
21883                         if test X"$static_ext" != X"$avail_ext"; then
21884                                 $cat <<EOM
21885 NOTICE:  Your previous config.sh list may be incorrect.
21886 The extensions now available to you are
21887         ${avail_ext}
21888 but the default list from your previous config.sh is
21889         ${static_ext}
21890
21891 EOM
21892                         fi
21893                         ;;
21894                 esac
21895                 ;;
21896         esac
21897         : Exclude those that are not xs extensions
21898         case "$dflt" in
21899         '')     dflt=none;;
21900         esac
21901         rp="What extensions do you wish to include?"
21902         . ./myread
21903         case "$ans" in
21904         none) static_ext=' ' ;;
21905         *) static_ext="$ans" ;;
21906         esac
21907         ;;
21908 esac
21909 #
21910 # Encode is a special case.  If we are building Encode as a static
21911 # extension, we need to explicitly list its subextensions as well.
21912 # For other nested extensions, this is handled automatically by
21913 # the appropriate Makefile.PL.
21914 case " $static_ext " in
21915         *" Encode "*) # Add the subextensions of Encode
21916         cd "$rsrc/ext"
21917         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21918                 static_ext="$static_ext Encode/$xxx"
21919         done
21920         cd "$tdir"
21921         ;;
21922 esac
21923
21924 set X $dynamic_ext $static_ext $nonxs_ext
21925 shift
21926 extensions="$*"
21927
21928 # Sanity check:  We require an extension suitable for use with
21929 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21930 # should show up as failures in the test suite, but it's helpful to
21931 # catch them now.) The 'extensions' list is normally sorted
21932 # alphabetically, so we need to accept either
21933 #    DB_File ... Fcntl ... IO  ....
21934 # or something like
21935 #    Fcntl ... NDBM_File ... IO  ....
21936 case " $extensions"  in
21937 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21938 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21939 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21940 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21941    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21942    ;;
21943 esac
21944
21945 : Remove libraries needed only for extensions
21946 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21947 : The exception is SunOS 4.x, which needs them.
21948 case "${osname}X${osvers}" in
21949 sunos*X4*)
21950     perllibs="$libs"
21951     ;;
21952 *) case "$usedl" in
21953     $define|true|[yY]*)
21954             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21955             shift
21956             perllibs="$*"
21957             ;;
21958     *)  perllibs="$libs"
21959             ;;
21960     esac
21961     ;;
21962 esac
21963
21964 : Remove build directory name from cppstdin so it can be used from
21965 : either the present location or the final installed location.
21966 echo " "
21967 : Get out of the UU directory to get correct path name.
21968 cd ..
21969 case "$cppstdin" in
21970 `pwd`/cppstdin)
21971         echo "Stripping down cppstdin path name"
21972         cppstdin=cppstdin
21973         ;;
21974 esac
21975 cd UU
21976
21977 : end of configuration questions
21978 echo " "
21979 echo "End of configuration questions."
21980 echo " "
21981
21982 : back to where it started
21983 if test -d ../UU; then
21984         cd ..
21985 fi
21986
21987 : configuration may be unconditionally patched via a 'config.arch' file
21988 if $test -f config.arch; then
21989         echo "I see a config.arch file, loading it." >&4
21990         . ./config.arch
21991 fi
21992
21993 : configuration may be patched via a 'config.over' file
21994 if $test -f config.over; then
21995         echo " "
21996         dflt=y
21997         rp='I see a config.over file.  Do you wish to load it?'
21998         . UU/myread
21999         case "$ans" in
22000         n*) echo "OK, I'll ignore it.";;
22001         *)      . ./config.over
22002                 echo "Configuration override changes have been loaded."
22003                 ;;
22004         esac
22005 fi
22006
22007 : in case they want portability, strip down executable paths
22008 case "$d_portable" in
22009 "$define")
22010         echo " "
22011         echo "Stripping down executable paths..." >&4
22012         for file in $loclist $trylist; do
22013                 eval temp=\$$file
22014                 eval $file=`basename $temp`
22015         done
22016         ;;
22017 esac
22018
22019 : create config.sh file
22020 echo " "
22021 echo "Creating config.sh..." >&4
22022 $spitshell <<EOT >config.sh
22023 $startsh
22024 #
22025 # This file was produced by running the Configure script. It holds all the
22026 # definitions figured out by Configure. Should you modify one of these values,
22027 # do not forget to propagate your changes by running "Configure -der". You may
22028 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22029 #
22030
22031 # Package name      : $package
22032 # Source directory  : $src
22033 # Configuration time: $cf_time
22034 # Configured by     : $cf_by
22035 # Target system     : $myuname
22036
22037 EOT
22038 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22039 $spitshell <<EOT >>config.sh
22040
22041 Author='$Author'
22042 Date='$Date'
22043 Header='$Header'
22044 Id='$Id'
22045 Locker='$Locker'
22046 Log='$Log'
22047 RCSfile='$RCSfile'
22048 Revision='$Revision'
22049 Source='$Source'
22050 State='$State'
22051 _a='$_a'
22052 _exe='$_exe'
22053 _o='$_o'
22054 afs='$afs'
22055 afsroot='$afsroot'
22056 alignbytes='$alignbytes'
22057 ansi2knr='$ansi2knr'
22058 aphostname='$aphostname'
22059 api_revision='$api_revision'
22060 api_subversion='$api_subversion'
22061 api_version='$api_version'
22062 api_versionstring='$api_versionstring'
22063 ar='$ar'
22064 archlib='$archlib'
22065 archlibexp='$archlibexp'
22066 archname64='$archname64'
22067 archname='$archname'
22068 archobjs='$archobjs'
22069 asctime_r_proto='$asctime_r_proto'
22070 awk='$awk'
22071 baserev='$baserev'
22072 bash='$bash'
22073 bin='$bin'
22074 binexp='$binexp'
22075 bison='$bison'
22076 byacc='$byacc'
22077 byteorder='$byteorder'
22078 c='$c'
22079 castflags='$castflags'
22080 cat='$cat'
22081 cc='$cc'
22082 cccdlflags='$cccdlflags'
22083 ccdlflags='$ccdlflags'
22084 ccflags='$ccflags'
22085 ccflags_uselargefiles='$ccflags_uselargefiles'
22086 ccname='$ccname'
22087 ccsymbols='$ccsymbols'
22088 ccversion='$ccversion'
22089 cf_by='$cf_by'
22090 cf_email='$cf_email'
22091 cf_time='$cf_time'
22092 chgrp='$chgrp'
22093 chmod='$chmod'
22094 chown='$chown'
22095 clocktype='$clocktype'
22096 comm='$comm'
22097 compress='$compress'
22098 contains='$contains'
22099 cp='$cp'
22100 cpio='$cpio'
22101 cpp='$cpp'
22102 cpp_stuff='$cpp_stuff'
22103 cppccsymbols='$cppccsymbols'
22104 cppflags='$cppflags'
22105 cpplast='$cpplast'
22106 cppminus='$cppminus'
22107 cpprun='$cpprun'
22108 cppstdin='$cppstdin'
22109 cppsymbols='$cppsymbols'
22110 crypt_r_proto='$crypt_r_proto'
22111 cryptlib='$cryptlib'
22112 csh='$csh'
22113 ctermid_r_proto='$ctermid_r_proto'
22114 ctime_r_proto='$ctime_r_proto'
22115 d_Gconvert='$d_Gconvert'
22116 d_PRIEUldbl='$d_PRIEUldbl'
22117 d_PRIFUldbl='$d_PRIFUldbl'
22118 d_PRIGUldbl='$d_PRIGUldbl'
22119 d_PRIXU64='$d_PRIXU64'
22120 d_PRId64='$d_PRId64'
22121 d_PRIeldbl='$d_PRIeldbl'
22122 d_PRIfldbl='$d_PRIfldbl'
22123 d_PRIgldbl='$d_PRIgldbl'
22124 d_PRIi64='$d_PRIi64'
22125 d_PRIo64='$d_PRIo64'
22126 d_PRIu64='$d_PRIu64'
22127 d_PRIx64='$d_PRIx64'
22128 d_SCNfldbl='$d_SCNfldbl'
22129 d__fwalk='$d__fwalk'
22130 d_access='$d_access'
22131 d_accessx='$d_accessx'
22132 d_aintl='$d_aintl'
22133 d_alarm='$d_alarm'
22134 d_archlib='$d_archlib'
22135 d_asctime64='$d_asctime64'
22136 d_asctime_r='$d_asctime_r'
22137 d_atolf='$d_atolf'
22138 d_atoll='$d_atoll'
22139 d_attribute_format='$d_attribute_format'
22140 d_attribute_malloc='$d_attribute_malloc'
22141 d_attribute_nonnull='$d_attribute_nonnull'
22142 d_attribute_noreturn='$d_attribute_noreturn'
22143 d_attribute_pure='$d_attribute_pure'
22144 d_attribute_unused='$d_attribute_unused'
22145 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22146 d_bcmp='$d_bcmp'
22147 d_bcopy='$d_bcopy'
22148 d_bsd='$d_bsd'
22149 d_bsdgetpgrp='$d_bsdgetpgrp'
22150 d_bsdsetpgrp='$d_bsdsetpgrp'
22151 d_builtin_choose_expr='$d_builtin_choose_expr'
22152 d_builtin_expect='$d_builtin_expect'
22153 d_bzero='$d_bzero'
22154 d_c99_variadic_macros='$d_c99_variadic_macros'
22155 d_casti32='$d_casti32'
22156 d_castneg='$d_castneg'
22157 d_charvspr='$d_charvspr'
22158 d_chown='$d_chown'
22159 d_chroot='$d_chroot'
22160 d_chsize='$d_chsize'
22161 d_class='$d_class'
22162 d_clearenv='$d_clearenv'
22163 d_closedir='$d_closedir'
22164 d_cmsghdr_s='$d_cmsghdr_s'
22165 d_const='$d_const'
22166 d_copysignl='$d_copysignl'
22167 d_cplusplus='$d_cplusplus'
22168 d_crypt='$d_crypt'
22169 d_crypt_r='$d_crypt_r'
22170 d_csh='$d_csh'
22171 d_ctermid='$d_ctermid'
22172 d_ctermid_r='$d_ctermid_r'
22173 d_ctime64='$d_ctime64'
22174 d_ctime_r='$d_ctime_r'
22175 d_cuserid='$d_cuserid'
22176 d_dbl_dig='$d_dbl_dig'
22177 d_dbminitproto='$d_dbminitproto'
22178 d_difftime64='$d_difftime64'
22179 d_difftime='$d_difftime'
22180 d_dir_dd_fd='$d_dir_dd_fd'
22181 d_dirfd='$d_dirfd'
22182 d_dirnamlen='$d_dirnamlen'
22183 d_dlerror='$d_dlerror'
22184 d_dlopen='$d_dlopen'
22185 d_dlsymun='$d_dlsymun'
22186 d_dosuid='$d_dosuid'
22187 d_drand48_r='$d_drand48_r'
22188 d_drand48proto='$d_drand48proto'
22189 d_dup2='$d_dup2'
22190 d_eaccess='$d_eaccess'
22191 d_endgrent='$d_endgrent'
22192 d_endgrent_r='$d_endgrent_r'
22193 d_endhent='$d_endhent'
22194 d_endhostent_r='$d_endhostent_r'
22195 d_endnent='$d_endnent'
22196 d_endnetent_r='$d_endnetent_r'
22197 d_endpent='$d_endpent'
22198 d_endprotoent_r='$d_endprotoent_r'
22199 d_endpwent='$d_endpwent'
22200 d_endpwent_r='$d_endpwent_r'
22201 d_endsent='$d_endsent'
22202 d_endservent_r='$d_endservent_r'
22203 d_eofnblk='$d_eofnblk'
22204 d_eunice='$d_eunice'
22205 d_faststdio='$d_faststdio'
22206 d_fchdir='$d_fchdir'
22207 d_fchmod='$d_fchmod'
22208 d_fchown='$d_fchown'
22209 d_fcntl='$d_fcntl'
22210 d_fcntl_can_lock='$d_fcntl_can_lock'
22211 d_fd_macros='$d_fd_macros'
22212 d_fd_set='$d_fd_set'
22213 d_fds_bits='$d_fds_bits'
22214 d_fgetpos='$d_fgetpos'
22215 d_finite='$d_finite'
22216 d_finitel='$d_finitel'
22217 d_flexfnam='$d_flexfnam'
22218 d_flock='$d_flock'
22219 d_flockproto='$d_flockproto'
22220 d_fork='$d_fork'
22221 d_fp_class='$d_fp_class'
22222 d_fpathconf='$d_fpathconf'
22223 d_fpclass='$d_fpclass'
22224 d_fpclassify='$d_fpclassify'
22225 d_fpclassl='$d_fpclassl'
22226 d_fpos64_t='$d_fpos64_t'
22227 d_frexpl='$d_frexpl'
22228 d_fs_data_s='$d_fs_data_s'
22229 d_fseeko='$d_fseeko'
22230 d_fsetpos='$d_fsetpos'
22231 d_fstatfs='$d_fstatfs'
22232 d_fstatvfs='$d_fstatvfs'
22233 d_fsync='$d_fsync'
22234 d_ftello='$d_ftello'
22235 d_ftime='$d_ftime'
22236 d_futimes='$d_futimes'
22237 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22238 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22239 d_getcwd='$d_getcwd'
22240 d_getespwnam='$d_getespwnam'
22241 d_getfsstat='$d_getfsstat'
22242 d_getgrent='$d_getgrent'
22243 d_getgrent_r='$d_getgrent_r'
22244 d_getgrgid_r='$d_getgrgid_r'
22245 d_getgrnam_r='$d_getgrnam_r'
22246 d_getgrps='$d_getgrps'
22247 d_gethbyaddr='$d_gethbyaddr'
22248 d_gethbyname='$d_gethbyname'
22249 d_gethent='$d_gethent'
22250 d_gethname='$d_gethname'
22251 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22252 d_gethostbyname_r='$d_gethostbyname_r'
22253 d_gethostent_r='$d_gethostent_r'
22254 d_gethostprotos='$d_gethostprotos'
22255 d_getitimer='$d_getitimer'
22256 d_getlogin='$d_getlogin'
22257 d_getlogin_r='$d_getlogin_r'
22258 d_getmnt='$d_getmnt'
22259 d_getmntent='$d_getmntent'
22260 d_getnbyaddr='$d_getnbyaddr'
22261 d_getnbyname='$d_getnbyname'
22262 d_getnent='$d_getnent'
22263 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22264 d_getnetbyname_r='$d_getnetbyname_r'
22265 d_getnetent_r='$d_getnetent_r'
22266 d_getnetprotos='$d_getnetprotos'
22267 d_getpagsz='$d_getpagsz'
22268 d_getpbyname='$d_getpbyname'
22269 d_getpbynumber='$d_getpbynumber'
22270 d_getpent='$d_getpent'
22271 d_getpgid='$d_getpgid'
22272 d_getpgrp2='$d_getpgrp2'
22273 d_getpgrp='$d_getpgrp'
22274 d_getppid='$d_getppid'
22275 d_getprior='$d_getprior'
22276 d_getprotobyname_r='$d_getprotobyname_r'
22277 d_getprotobynumber_r='$d_getprotobynumber_r'
22278 d_getprotoent_r='$d_getprotoent_r'
22279 d_getprotoprotos='$d_getprotoprotos'
22280 d_getprpwnam='$d_getprpwnam'
22281 d_getpwent='$d_getpwent'
22282 d_getpwent_r='$d_getpwent_r'
22283 d_getpwnam_r='$d_getpwnam_r'
22284 d_getpwuid_r='$d_getpwuid_r'
22285 d_getsbyname='$d_getsbyname'
22286 d_getsbyport='$d_getsbyport'
22287 d_getsent='$d_getsent'
22288 d_getservbyname_r='$d_getservbyname_r'
22289 d_getservbyport_r='$d_getservbyport_r'
22290 d_getservent_r='$d_getservent_r'
22291 d_getservprotos='$d_getservprotos'
22292 d_getspnam='$d_getspnam'
22293 d_getspnam_r='$d_getspnam_r'
22294 d_gettimeod='$d_gettimeod'
22295 d_gmtime64='$d_gmtime64'
22296 d_gmtime_r='$d_gmtime_r'
22297 d_gnulibc='$d_gnulibc'
22298 d_grpasswd='$d_grpasswd'
22299 d_hasmntopt='$d_hasmntopt'
22300 d_htonl='$d_htonl'
22301 d_ilogbl='$d_ilogbl'
22302 d_inc_version_list='$d_inc_version_list'
22303 d_index='$d_index'
22304 d_inetaton='$d_inetaton'
22305 d_int64_t='$d_int64_t'
22306 d_isascii='$d_isascii'
22307 d_isfinite='$d_isfinite'
22308 d_isinf='$d_isinf'
22309 d_isnan='$d_isnan'
22310 d_isnanl='$d_isnanl'
22311 d_killpg='$d_killpg'
22312 d_lchown='$d_lchown'
22313 d_ldbl_dig='$d_ldbl_dig'
22314 d_libm_lib_version='$d_libm_lib_version'
22315 d_link='$d_link'
22316 d_localtime64='$d_localtime64'
22317 d_localtime_r='$d_localtime_r'
22318 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22319 d_locconv='$d_locconv'
22320 d_lockf='$d_lockf'
22321 d_longdbl='$d_longdbl'
22322 d_longlong='$d_longlong'
22323 d_lseekproto='$d_lseekproto'
22324 d_lstat='$d_lstat'
22325 d_madvise='$d_madvise'
22326 d_malloc_good_size='$d_malloc_good_size'
22327 d_malloc_size='$d_malloc_size'
22328 d_mblen='$d_mblen'
22329 d_mbstowcs='$d_mbstowcs'
22330 d_mbtowc='$d_mbtowc'
22331 d_memchr='$d_memchr'
22332 d_memcmp='$d_memcmp'
22333 d_memcpy='$d_memcpy'
22334 d_memmove='$d_memmove'
22335 d_memset='$d_memset'
22336 d_mkdir='$d_mkdir'
22337 d_mkdtemp='$d_mkdtemp'
22338 d_mkfifo='$d_mkfifo'
22339 d_mkstemp='$d_mkstemp'
22340 d_mkstemps='$d_mkstemps'
22341 d_mktime64='$d_mktime64'
22342 d_mktime='$d_mktime'
22343 d_mmap='$d_mmap'
22344 d_modfl='$d_modfl'
22345 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22346 d_modflproto='$d_modflproto'
22347 d_mprotect='$d_mprotect'
22348 d_msg='$d_msg'
22349 d_msg_ctrunc='$d_msg_ctrunc'
22350 d_msg_dontroute='$d_msg_dontroute'
22351 d_msg_oob='$d_msg_oob'
22352 d_msg_peek='$d_msg_peek'
22353 d_msg_proxy='$d_msg_proxy'
22354 d_msgctl='$d_msgctl'
22355 d_msgget='$d_msgget'
22356 d_msghdr_s='$d_msghdr_s'
22357 d_msgrcv='$d_msgrcv'
22358 d_msgsnd='$d_msgsnd'
22359 d_msync='$d_msync'
22360 d_munmap='$d_munmap'
22361 d_mymalloc='$d_mymalloc'
22362 d_ndbm='$d_ndbm'
22363 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
22364 d_nice='$d_nice'
22365 d_nl_langinfo='$d_nl_langinfo'
22366 d_nv_preserves_uv='$d_nv_preserves_uv'
22367 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22368 d_off64_t='$d_off64_t'
22369 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22370 d_oldpthreads='$d_oldpthreads'
22371 d_oldsock='$d_oldsock'
22372 d_open3='$d_open3'
22373 d_pathconf='$d_pathconf'
22374 d_pause='$d_pause'
22375 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22376 d_phostname='$d_phostname'
22377 d_pipe='$d_pipe'
22378 d_poll='$d_poll'
22379 d_portable='$d_portable'
22380 d_printf_format_null='$d_printf_format_null'
22381 d_procselfexe='$d_procselfexe'
22382 d_pseudofork='$d_pseudofork'
22383 d_pthread_atfork='$d_pthread_atfork'
22384 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22385 d_pthread_yield='$d_pthread_yield'
22386 d_pwage='$d_pwage'
22387 d_pwchange='$d_pwchange'
22388 d_pwclass='$d_pwclass'
22389 d_pwcomment='$d_pwcomment'
22390 d_pwexpire='$d_pwexpire'
22391 d_pwgecos='$d_pwgecos'
22392 d_pwpasswd='$d_pwpasswd'
22393 d_pwquota='$d_pwquota'
22394 d_qgcvt='$d_qgcvt'
22395 d_quad='$d_quad'
22396 d_random_r='$d_random_r'
22397 d_readdir64_r='$d_readdir64_r'
22398 d_readdir='$d_readdir'
22399 d_readdir_r='$d_readdir_r'
22400 d_readlink='$d_readlink'
22401 d_readv='$d_readv'
22402 d_recvmsg='$d_recvmsg'
22403 d_rename='$d_rename'
22404 d_rewinddir='$d_rewinddir'
22405 d_rmdir='$d_rmdir'
22406 d_safebcpy='$d_safebcpy'
22407 d_safemcpy='$d_safemcpy'
22408 d_sanemcmp='$d_sanemcmp'
22409 d_sbrkproto='$d_sbrkproto'
22410 d_scalbnl='$d_scalbnl'
22411 d_sched_yield='$d_sched_yield'
22412 d_scm_rights='$d_scm_rights'
22413 d_seekdir='$d_seekdir'
22414 d_select='$d_select'
22415 d_sem='$d_sem'
22416 d_semctl='$d_semctl'
22417 d_semctl_semid_ds='$d_semctl_semid_ds'
22418 d_semctl_semun='$d_semctl_semun'
22419 d_semget='$d_semget'
22420 d_semop='$d_semop'
22421 d_sendmsg='$d_sendmsg'
22422 d_setegid='$d_setegid'
22423 d_seteuid='$d_seteuid'
22424 d_setgrent='$d_setgrent'
22425 d_setgrent_r='$d_setgrent_r'
22426 d_setgrps='$d_setgrps'
22427 d_sethent='$d_sethent'
22428 d_sethostent_r='$d_sethostent_r'
22429 d_setitimer='$d_setitimer'
22430 d_setlinebuf='$d_setlinebuf'
22431 d_setlocale='$d_setlocale'
22432 d_setlocale_r='$d_setlocale_r'
22433 d_setnent='$d_setnent'
22434 d_setnetent_r='$d_setnetent_r'
22435 d_setpent='$d_setpent'
22436 d_setpgid='$d_setpgid'
22437 d_setpgrp2='$d_setpgrp2'
22438 d_setpgrp='$d_setpgrp'
22439 d_setprior='$d_setprior'
22440 d_setproctitle='$d_setproctitle'
22441 d_setprotoent_r='$d_setprotoent_r'
22442 d_setpwent='$d_setpwent'
22443 d_setpwent_r='$d_setpwent_r'
22444 d_setregid='$d_setregid'
22445 d_setresgid='$d_setresgid'
22446 d_setresuid='$d_setresuid'
22447 d_setreuid='$d_setreuid'
22448 d_setrgid='$d_setrgid'
22449 d_setruid='$d_setruid'
22450 d_setsent='$d_setsent'
22451 d_setservent_r='$d_setservent_r'
22452 d_setsid='$d_setsid'
22453 d_setvbuf='$d_setvbuf'
22454 d_sfio='$d_sfio'
22455 d_shm='$d_shm'
22456 d_shmat='$d_shmat'
22457 d_shmatprototype='$d_shmatprototype'
22458 d_shmctl='$d_shmctl'
22459 d_shmdt='$d_shmdt'
22460 d_shmget='$d_shmget'
22461 d_sigaction='$d_sigaction'
22462 d_signbit='$d_signbit'
22463 d_sigprocmask='$d_sigprocmask'
22464 d_sigsetjmp='$d_sigsetjmp'
22465 d_sitearch='$d_sitearch'
22466 d_snprintf='$d_snprintf'
22467 d_sockatmark='$d_sockatmark'
22468 d_sockatmarkproto='$d_sockatmarkproto'
22469 d_socket='$d_socket'
22470 d_socklen_t='$d_socklen_t'
22471 d_sockpair='$d_sockpair'
22472 d_socks5_init='$d_socks5_init'
22473 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22474 d_sqrtl='$d_sqrtl'
22475 d_srand48_r='$d_srand48_r'
22476 d_srandom_r='$d_srandom_r'
22477 d_sresgproto='$d_sresgproto'
22478 d_sresuproto='$d_sresuproto'
22479 d_statblks='$d_statblks'
22480 d_statfs_f_flags='$d_statfs_f_flags'
22481 d_statfs_s='$d_statfs_s'
22482 d_statvfs='$d_statvfs'
22483 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22484 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22485 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22486 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22487 d_stdio_stream_array='$d_stdio_stream_array'
22488 d_stdiobase='$d_stdiobase'
22489 d_stdstdio='$d_stdstdio'
22490 d_strchr='$d_strchr'
22491 d_strcoll='$d_strcoll'
22492 d_strctcpy='$d_strctcpy'
22493 d_strerrm='$d_strerrm'
22494 d_strerror='$d_strerror'
22495 d_strerror_r='$d_strerror_r'
22496 d_strftime='$d_strftime'
22497 d_strlcat='$d_strlcat'
22498 d_strlcpy='$d_strlcpy'
22499 d_strtod='$d_strtod'
22500 d_strtol='$d_strtol'
22501 d_strtold='$d_strtold'
22502 d_strtoll='$d_strtoll'
22503 d_strtoq='$d_strtoq'
22504 d_strtoul='$d_strtoul'
22505 d_strtoull='$d_strtoull'
22506 d_strtouq='$d_strtouq'
22507 d_strxfrm='$d_strxfrm'
22508 d_suidsafe='$d_suidsafe'
22509 d_symlink='$d_symlink'
22510 d_syscall='$d_syscall'
22511 d_syscallproto='$d_syscallproto'
22512 d_sysconf='$d_sysconf'
22513 d_sysernlst='$d_sysernlst'
22514 d_syserrlst='$d_syserrlst'
22515 d_system='$d_system'
22516 d_tcgetpgrp='$d_tcgetpgrp'
22517 d_tcsetpgrp='$d_tcsetpgrp'
22518 d_telldir='$d_telldir'
22519 d_telldirproto='$d_telldirproto'
22520 d_time='$d_time'
22521 d_timegm='$d_timegm'
22522 d_times='$d_times'
22523 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22524 d_tm_tm_zone='$d_tm_tm_zone'
22525 d_tmpnam_r='$d_tmpnam_r'
22526 d_truncate='$d_truncate'
22527 d_ttyname_r='$d_ttyname_r'
22528 d_tzname='$d_tzname'
22529 d_u32align='$d_u32align'
22530 d_ualarm='$d_ualarm'
22531 d_umask='$d_umask'
22532 d_uname='$d_uname'
22533 d_union_semun='$d_union_semun'
22534 d_unordered='$d_unordered'
22535 d_unsetenv='$d_unsetenv'
22536 d_usleep='$d_usleep'
22537 d_usleepproto='$d_usleepproto'
22538 d_ustat='$d_ustat'
22539 d_vendorarch='$d_vendorarch'
22540 d_vendorbin='$d_vendorbin'
22541 d_vendorlib='$d_vendorlib'
22542 d_vendorscript='$d_vendorscript'
22543 d_vfork='$d_vfork'
22544 d_void_closedir='$d_void_closedir'
22545 d_voidsig='$d_voidsig'
22546 d_voidtty='$d_voidtty'
22547 d_volatile='$d_volatile'
22548 d_vprintf='$d_vprintf'
22549 d_vsnprintf='$d_vsnprintf'
22550 d_wait4='$d_wait4'
22551 d_waitpid='$d_waitpid'
22552 d_wcstombs='$d_wcstombs'
22553 d_wctomb='$d_wctomb'
22554 d_writev='$d_writev'
22555 d_xenix='$d_xenix'
22556 date='$date'
22557 db_hashtype='$db_hashtype'
22558 db_prefixtype='$db_prefixtype'
22559 db_version_major='$db_version_major'
22560 db_version_minor='$db_version_minor'
22561 db_version_patch='$db_version_patch'
22562 defvoidused='$defvoidused'
22563 direntrytype='$direntrytype'
22564 dlext='$dlext'
22565 dlsrc='$dlsrc'
22566 doublesize='$doublesize'
22567 drand01='$drand01'
22568 drand48_r_proto='$drand48_r_proto'
22569 dtrace='$dtrace'
22570 dynamic_ext='$dynamic_ext'
22571 eagain='$eagain'
22572 ebcdic='$ebcdic'
22573 echo='$echo'
22574 egrep='$egrep'
22575 emacs='$emacs'
22576 endgrent_r_proto='$endgrent_r_proto'
22577 endhostent_r_proto='$endhostent_r_proto'
22578 endnetent_r_proto='$endnetent_r_proto'
22579 endprotoent_r_proto='$endprotoent_r_proto'
22580 endpwent_r_proto='$endpwent_r_proto'
22581 endservent_r_proto='$endservent_r_proto'
22582 eunicefix='$eunicefix'
22583 exe_ext='$exe_ext'
22584 expr='$expr'
22585 extensions='$extensions'
22586 extern_C='$extern_C'
22587 extras='$extras'
22588 fflushNULL='$fflushNULL'
22589 fflushall='$fflushall'
22590 find='$find'
22591 firstmakefile='$firstmakefile'
22592 flex='$flex'
22593 fpossize='$fpossize'
22594 fpostype='$fpostype'
22595 freetype='$freetype'
22596 from='$from'
22597 full_ar='$full_ar'
22598 full_csh='$full_csh'
22599 full_sed='$full_sed'
22600 gccansipedantic='$gccansipedantic'
22601 gccosandvers='$gccosandvers'
22602 gccversion='$gccversion'
22603 getgrent_r_proto='$getgrent_r_proto'
22604 getgrgid_r_proto='$getgrgid_r_proto'
22605 getgrnam_r_proto='$getgrnam_r_proto'
22606 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22607 gethostbyname_r_proto='$gethostbyname_r_proto'
22608 gethostent_r_proto='$gethostent_r_proto'
22609 getlogin_r_proto='$getlogin_r_proto'
22610 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22611 getnetbyname_r_proto='$getnetbyname_r_proto'
22612 getnetent_r_proto='$getnetent_r_proto'
22613 getprotobyname_r_proto='$getprotobyname_r_proto'
22614 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22615 getprotoent_r_proto='$getprotoent_r_proto'
22616 getpwent_r_proto='$getpwent_r_proto'
22617 getpwnam_r_proto='$getpwnam_r_proto'
22618 getpwuid_r_proto='$getpwuid_r_proto'
22619 getservbyname_r_proto='$getservbyname_r_proto'
22620 getservbyport_r_proto='$getservbyport_r_proto'
22621 getservent_r_proto='$getservent_r_proto'
22622 getspnam_r_proto='$getspnam_r_proto'
22623 gidformat='$gidformat'
22624 gidsign='$gidsign'
22625 gidsize='$gidsize'
22626 gidtype='$gidtype'
22627 glibpth='$glibpth'
22628 gmake='$gmake'
22629 gmtime_r_proto='$gmtime_r_proto'
22630 gnulibc_version='$gnulibc_version'
22631 grep='$grep'
22632 groupcat='$groupcat'
22633 groupstype='$groupstype'
22634 gzip='$gzip'
22635 h_fcntl='$h_fcntl'
22636 h_sysfile='$h_sysfile'
22637 hint='$hint'
22638 hostcat='$hostcat'
22639 html1dir='$html1dir'
22640 html1direxp='$html1direxp'
22641 html3dir='$html3dir'
22642 html3direxp='$html3direxp'
22643 i16size='$i16size'
22644 i16type='$i16type'
22645 i32size='$i32size'
22646 i32type='$i32type'
22647 i64size='$i64size'
22648 i64type='$i64type'
22649 i8size='$i8size'
22650 i8type='$i8type'
22651 i_arpainet='$i_arpainet'
22652 i_assert='$i_assert'
22653 i_bsdioctl='$i_bsdioctl'
22654 i_crypt='$i_crypt'
22655 i_db='$i_db'
22656 i_dbm='$i_dbm'
22657 i_dirent='$i_dirent'
22658 i_dld='$i_dld'
22659 i_dlfcn='$i_dlfcn'
22660 i_fcntl='$i_fcntl'
22661 i_float='$i_float'
22662 i_fp='$i_fp'
22663 i_fp_class='$i_fp_class'
22664 i_gdbm='$i_gdbm'
22665 i_gdbm_ndbm='$i_gdbm_ndbm'
22666 i_gdbmndbm='$i_gdbmndbm'
22667 i_grp='$i_grp'
22668 i_ieeefp='$i_ieeefp'
22669 i_inttypes='$i_inttypes'
22670 i_langinfo='$i_langinfo'
22671 i_libutil='$i_libutil'
22672 i_limits='$i_limits'
22673 i_locale='$i_locale'
22674 i_machcthr='$i_machcthr'
22675 i_malloc='$i_malloc'
22676 i_mallocmalloc='$i_mallocmalloc'
22677 i_math='$i_math'
22678 i_memory='$i_memory'
22679 i_mntent='$i_mntent'
22680 i_ndbm='$i_ndbm'
22681 i_netdb='$i_netdb'
22682 i_neterrno='$i_neterrno'
22683 i_netinettcp='$i_netinettcp'
22684 i_niin='$i_niin'
22685 i_poll='$i_poll'
22686 i_prot='$i_prot'
22687 i_pthread='$i_pthread'
22688 i_pwd='$i_pwd'
22689 i_rpcsvcdbm='$i_rpcsvcdbm'
22690 i_sfio='$i_sfio'
22691 i_sgtty='$i_sgtty'
22692 i_shadow='$i_shadow'
22693 i_socks='$i_socks'
22694 i_stdarg='$i_stdarg'
22695 i_stddef='$i_stddef'
22696 i_stdlib='$i_stdlib'
22697 i_string='$i_string'
22698 i_sunmath='$i_sunmath'
22699 i_sysaccess='$i_sysaccess'
22700 i_sysdir='$i_sysdir'
22701 i_sysfile='$i_sysfile'
22702 i_sysfilio='$i_sysfilio'
22703 i_sysin='$i_sysin'
22704 i_sysioctl='$i_sysioctl'
22705 i_syslog='$i_syslog'
22706 i_sysmman='$i_sysmman'
22707 i_sysmode='$i_sysmode'
22708 i_sysmount='$i_sysmount'
22709 i_sysndir='$i_sysndir'
22710 i_sysparam='$i_sysparam'
22711 i_syspoll='$i_syspoll'
22712 i_sysresrc='$i_sysresrc'
22713 i_syssecrt='$i_syssecrt'
22714 i_sysselct='$i_sysselct'
22715 i_syssockio='$i_syssockio'
22716 i_sysstat='$i_sysstat'
22717 i_sysstatfs='$i_sysstatfs'
22718 i_sysstatvfs='$i_sysstatvfs'
22719 i_systime='$i_systime'
22720 i_systimek='$i_systimek'
22721 i_systimes='$i_systimes'
22722 i_systypes='$i_systypes'
22723 i_sysuio='$i_sysuio'
22724 i_sysun='$i_sysun'
22725 i_sysutsname='$i_sysutsname'
22726 i_sysvfs='$i_sysvfs'
22727 i_syswait='$i_syswait'
22728 i_termio='$i_termio'
22729 i_termios='$i_termios'
22730 i_time='$i_time'
22731 i_unistd='$i_unistd'
22732 i_ustat='$i_ustat'
22733 i_utime='$i_utime'
22734 i_values='$i_values'
22735 i_varargs='$i_varargs'
22736 i_varhdr='$i_varhdr'
22737 i_vfork='$i_vfork'
22738 ignore_versioned_solibs='$ignore_versioned_solibs'
22739 inc_version_list='$inc_version_list'
22740 inc_version_list_init='$inc_version_list_init'
22741 incpath='$incpath'
22742 inews='$inews'
22743 initialinstalllocation='$initialinstalllocation'
22744 installarchlib='$installarchlib'
22745 installbin='$installbin'
22746 installhtml1dir='$installhtml1dir'
22747 installhtml3dir='$installhtml3dir'
22748 installman1dir='$installman1dir'
22749 installman3dir='$installman3dir'
22750 installprefix='$installprefix'
22751 installprefixexp='$installprefixexp'
22752 installprivlib='$installprivlib'
22753 installscript='$installscript'
22754 installsitearch='$installsitearch'
22755 installsitebin='$installsitebin'
22756 installsitehtml1dir='$installsitehtml1dir'
22757 installsitehtml3dir='$installsitehtml3dir'
22758 installsitelib='$installsitelib'
22759 installsiteman1dir='$installsiteman1dir'
22760 installsiteman3dir='$installsiteman3dir'
22761 installsitescript='$installsitescript'
22762 installstyle='$installstyle'
22763 installusrbinperl='$installusrbinperl'
22764 installvendorarch='$installvendorarch'
22765 installvendorbin='$installvendorbin'
22766 installvendorhtml1dir='$installvendorhtml1dir'
22767 installvendorhtml3dir='$installvendorhtml3dir'
22768 installvendorlib='$installvendorlib'
22769 installvendorman1dir='$installvendorman1dir'
22770 installvendorman3dir='$installvendorman3dir'
22771 installvendorscript='$installvendorscript'
22772 intsize='$intsize'
22773 issymlink='$issymlink'
22774 ivdformat='$ivdformat'
22775 ivsize='$ivsize'
22776 ivtype='$ivtype'
22777 known_extensions='$known_extensions'
22778 ksh='$ksh'
22779 ld='$ld'
22780 lddlflags='$lddlflags'
22781 ldflags='$ldflags'
22782 ldflags_uselargefiles='$ldflags_uselargefiles'
22783 ldlibpthname='$ldlibpthname'
22784 less='$less'
22785 lib_ext='$lib_ext'
22786 libc='$libc'
22787 libperl='$libperl'
22788 libpth='$libpth'
22789 libs='$libs'
22790 libsdirs='$libsdirs'
22791 libsfiles='$libsfiles'
22792 libsfound='$libsfound'
22793 libspath='$libspath'
22794 libswanted='$libswanted'
22795 libswanted_uselargefiles='$libswanted_uselargefiles'
22796 line='$line'
22797 lint='$lint'
22798 lkflags='$lkflags'
22799 ln='$ln'
22800 lns='$lns'
22801 localtime_r_proto='$localtime_r_proto'
22802 locincpth='$locincpth'
22803 loclibpth='$loclibpth'
22804 longdblsize='$longdblsize'
22805 longlongsize='$longlongsize'
22806 longsize='$longsize'
22807 lp='$lp'
22808 lpr='$lpr'
22809 ls='$ls'
22810 lseeksize='$lseeksize'
22811 lseektype='$lseektype'
22812 mad='$mad'
22813 madlyh='$madlyh'
22814 madlyobj='$madlyobj'
22815 madlysrc='$madlysrc'
22816 mail='$mail'
22817 mailx='$mailx'
22818 make='$make'
22819 make_set_make='$make_set_make'
22820 mallocobj='$mallocobj'
22821 mallocsrc='$mallocsrc'
22822 malloctype='$malloctype'
22823 man1dir='$man1dir'
22824 man1direxp='$man1direxp'
22825 man1ext='$man1ext'
22826 man3dir='$man3dir'
22827 man3direxp='$man3direxp'
22828 man3ext='$man3ext'
22829 mips_type='$mips_type'
22830 mistrustnm='$mistrustnm'
22831 mkdir='$mkdir'
22832 mmaptype='$mmaptype'
22833 modetype='$modetype'
22834 more='$more'
22835 multiarch='$multiarch'
22836 mv='$mv'
22837 myarchname='$myarchname'
22838 mydomain='$mydomain'
22839 myhostname='$myhostname'
22840 myuname='$myuname'
22841 n='$n'
22842 need_va_copy='$need_va_copy'
22843 netdb_hlen_type='$netdb_hlen_type'
22844 netdb_host_type='$netdb_host_type'
22845 netdb_name_type='$netdb_name_type'
22846 netdb_net_type='$netdb_net_type'
22847 nm='$nm'
22848 nm_opt='$nm_opt'
22849 nm_so_opt='$nm_so_opt'
22850 nonxs_ext='$nonxs_ext'
22851 nroff='$nroff'
22852 nvEUformat='$nvEUformat'
22853 nvFUformat='$nvFUformat'
22854 nvGUformat='$nvGUformat'
22855 nv_overflows_integers_at='$nv_overflows_integers_at'
22856 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22857 nveformat='$nveformat'
22858 nvfformat='$nvfformat'
22859 nvgformat='$nvgformat'
22860 nvsize='$nvsize'
22861 nvtype='$nvtype'
22862 o_nonblock='$o_nonblock'
22863 obj_ext='$obj_ext'
22864 old_pthread_create_joinable='$old_pthread_create_joinable'
22865 optimize='$optimize'
22866 orderlib='$orderlib'
22867 osname='$osname'
22868 osvers='$osvers'
22869 otherlibdirs='$otherlibdirs'
22870 package='$package'
22871 pager='$pager'
22872 passcat='$passcat'
22873 patchlevel='$patchlevel'
22874 path_sep='$path_sep'
22875 perl5='$perl5'
22876 perl='$perl'
22877 perl_patchlevel='$perl_patchlevel'
22878 perladmin='$perladmin'
22879 perllibs='$perllibs'
22880 perlpath='$perlpath'
22881 pg='$pg'
22882 phostname='$phostname'
22883 pidtype='$pidtype'
22884 plibpth='$plibpth'
22885 pmake='$pmake'
22886 pr='$pr'
22887 prefix='$prefix'
22888 prefixexp='$prefixexp'
22889 privlib='$privlib'
22890 privlibexp='$privlibexp'
22891 procselfexe='$procselfexe'
22892 prototype='$prototype'
22893 ptrsize='$ptrsize'
22894 quadkind='$quadkind'
22895 quadtype='$quadtype'
22896 randbits='$randbits'
22897 randfunc='$randfunc'
22898 random_r_proto='$random_r_proto'
22899 randseedtype='$randseedtype'
22900 ranlib='$ranlib'
22901 rd_nodata='$rd_nodata'
22902 readdir64_r_proto='$readdir64_r_proto'
22903 readdir_r_proto='$readdir_r_proto'
22904 revision='$revision'
22905 rm='$rm'
22906 rm_try='$rm_try'
22907 rmail='$rmail'
22908 run='$run'
22909 runnm='$runnm'
22910 sGMTIME_max='$sGMTIME_max'
22911 sGMTIME_min='$sGMTIME_min'
22912 sLOCALTIME_max='$sLOCALTIME_max'
22913 sLOCALTIME_min='$sLOCALTIME_min'
22914 sPRIEUldbl='$sPRIEUldbl'
22915 sPRIFUldbl='$sPRIFUldbl'
22916 sPRIGUldbl='$sPRIGUldbl'
22917 sPRIXU64='$sPRIXU64'
22918 sPRId64='$sPRId64'
22919 sPRIeldbl='$sPRIeldbl'
22920 sPRIfldbl='$sPRIfldbl'
22921 sPRIgldbl='$sPRIgldbl'
22922 sPRIi64='$sPRIi64'
22923 sPRIo64='$sPRIo64'
22924 sPRIu64='$sPRIu64'
22925 sPRIx64='$sPRIx64'
22926 sSCNfldbl='$sSCNfldbl'
22927 sched_yield='$sched_yield'
22928 scriptdir='$scriptdir'
22929 scriptdirexp='$scriptdirexp'
22930 sed='$sed'
22931 seedfunc='$seedfunc'
22932 selectminbits='$selectminbits'
22933 selecttype='$selecttype'
22934 sendmail='$sendmail'
22935 setgrent_r_proto='$setgrent_r_proto'
22936 sethostent_r_proto='$sethostent_r_proto'
22937 setlocale_r_proto='$setlocale_r_proto'
22938 setnetent_r_proto='$setnetent_r_proto'
22939 setprotoent_r_proto='$setprotoent_r_proto'
22940 setpwent_r_proto='$setpwent_r_proto'
22941 setservent_r_proto='$setservent_r_proto'
22942 sh='$sh'
22943 shar='$shar'
22944 sharpbang='$sharpbang'
22945 shmattype='$shmattype'
22946 shortsize='$shortsize'
22947 shrpenv='$shrpenv'
22948 shsharp='$shsharp'
22949 sig_count='$sig_count'
22950 sig_name='$sig_name'
22951 sig_name_init='$sig_name_init'
22952 sig_num='$sig_num'
22953 sig_num_init='$sig_num_init'
22954 sig_size='$sig_size'
22955 signal_t='$signal_t'
22956 sitearch='$sitearch'
22957 sitearchexp='$sitearchexp'
22958 sitebin='$sitebin'
22959 sitebinexp='$sitebinexp'
22960 sitehtml1dir='$sitehtml1dir'
22961 sitehtml1direxp='$sitehtml1direxp'
22962 sitehtml3dir='$sitehtml3dir'
22963 sitehtml3direxp='$sitehtml3direxp'
22964 sitelib='$sitelib'
22965 sitelib_stem='$sitelib_stem'
22966 sitelibexp='$sitelibexp'
22967 siteman1dir='$siteman1dir'
22968 siteman1direxp='$siteman1direxp'
22969 siteman3dir='$siteman3dir'
22970 siteman3direxp='$siteman3direxp'
22971 siteprefix='$siteprefix'
22972 siteprefixexp='$siteprefixexp'
22973 sitescript='$sitescript'
22974 sitescriptexp='$sitescriptexp'
22975 sizesize='$sizesize'
22976 sizetype='$sizetype'
22977 sleep='$sleep'
22978 smail='$smail'
22979 so='$so'
22980 sockethdr='$sockethdr'
22981 socketlib='$socketlib'
22982 socksizetype='$socksizetype'
22983 sort='$sort'
22984 spackage='$spackage'
22985 spitshell='$spitshell'
22986 srand48_r_proto='$srand48_r_proto'
22987 srandom_r_proto='$srandom_r_proto'
22988 src='$src'
22989 ssizetype='$ssizetype'
22990 startperl='$startperl'
22991 startsh='$startsh'
22992 static_ext='$static_ext'
22993 stdchar='$stdchar'
22994 stdio_base='$stdio_base'
22995 stdio_bufsiz='$stdio_bufsiz'
22996 stdio_cnt='$stdio_cnt'
22997 stdio_filbuf='$stdio_filbuf'
22998 stdio_ptr='$stdio_ptr'
22999 stdio_stream_array='$stdio_stream_array'
23000 strerror_r_proto='$strerror_r_proto'
23001 strings='$strings'
23002 submit='$submit'
23003 subversion='$subversion'
23004 sysman='$sysman'
23005 tail='$tail'
23006 tar='$tar'
23007 targetarch='$targetarch'
23008 tbl='$tbl'
23009 tee='$tee'
23010 test='$test'
23011 timeincl='$timeincl'
23012 timetype='$timetype'
23013 tmpnam_r_proto='$tmpnam_r_proto'
23014 to='$to'
23015 touch='$touch'
23016 tr='$tr'
23017 trnl='$trnl'
23018 troff='$troff'
23019 ttyname_r_proto='$ttyname_r_proto'
23020 u16size='$u16size'
23021 u16type='$u16type'
23022 u32size='$u32size'
23023 u32type='$u32type'
23024 u64size='$u64size'
23025 u64type='$u64type'
23026 u8size='$u8size'
23027 u8type='$u8type'
23028 uidformat='$uidformat'
23029 uidsign='$uidsign'
23030 uidsize='$uidsize'
23031 uidtype='$uidtype'
23032 uname='$uname'
23033 uniq='$uniq'
23034 uquadtype='$uquadtype'
23035 use5005threads='$use5005threads'
23036 use64bitall='$use64bitall'
23037 use64bitint='$use64bitint'
23038 usecrosscompile='$usecrosscompile'
23039 usedevel='$usedevel'
23040 usedl='$usedl'
23041 usedtrace='$usedtrace'
23042 usefaststdio='$usefaststdio'
23043 useithreads='$useithreads'
23044 uselargefiles='$uselargefiles'
23045 uselongdouble='$uselongdouble'
23046 usemallocwrap='$usemallocwrap'
23047 usemorebits='$usemorebits'
23048 usemultiplicity='$usemultiplicity'
23049 usemymalloc='$usemymalloc'
23050 usenm='$usenm'
23051 useopcode='$useopcode'
23052 useperlio='$useperlio'
23053 useposix='$useposix'
23054 usereentrant='$usereentrant'
23055 userelocatableinc='$userelocatableinc'
23056 usesfio='$usesfio'
23057 useshrplib='$useshrplib'
23058 usesitecustomize='$usesitecustomize'
23059 usesocks='$usesocks'
23060 usethreads='$usethreads'
23061 usevendorprefix='$usevendorprefix'
23062 usevfork='$usevfork'
23063 usrinc='$usrinc'
23064 uuname='$uuname'
23065 uvXUformat='$uvXUformat'
23066 uvoformat='$uvoformat'
23067 uvsize='$uvsize'
23068 uvtype='$uvtype'
23069 uvuformat='$uvuformat'
23070 uvxformat='$uvxformat'
23071 vendorarch='$vendorarch'
23072 vendorarchexp='$vendorarchexp'
23073 vendorbin='$vendorbin'
23074 vendorbinexp='$vendorbinexp'
23075 vendorhtml1dir='$vendorhtml1dir'
23076 vendorhtml1direxp='$vendorhtml1direxp'
23077 vendorhtml3dir='$vendorhtml3dir'
23078 vendorhtml3direxp='$vendorhtml3direxp'
23079 vendorlib='$vendorlib'
23080 vendorlib_stem='$vendorlib_stem'
23081 vendorlibexp='$vendorlibexp'
23082 vendorman1dir='$vendorman1dir'
23083 vendorman1direxp='$vendorman1direxp'
23084 vendorman3dir='$vendorman3dir'
23085 vendorman3direxp='$vendorman3direxp'
23086 vendorprefix='$vendorprefix'
23087 vendorprefixexp='$vendorprefixexp'
23088 vendorscript='$vendorscript'
23089 vendorscriptexp='$vendorscriptexp'
23090 version='$version'
23091 version_patchlevel_string='$version_patchlevel_string'
23092 versiononly='$versiononly'
23093 vi='$vi'
23094 voidflags='$voidflags'
23095 xlibpth='$xlibpth'
23096 yacc='$yacc'
23097 yaccflags='$yaccflags'
23098 zcat='$zcat'
23099 zip='$zip'
23100 EOT
23101
23102 : Add in command line options if available
23103 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23104
23105 : add special variables
23106 $test -f $src/patchlevel.h && \
23107 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23108 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
23109 echo "PERL_CONFIG_SH=true" >>config.sh
23110
23111 : propagate old symbols
23112 if $test -f UU/config.sh; then
23113         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23114         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23115                 config.sh config.sh UU/oldconfig.sh |\
23116                 $sort | $uniq -u >UU/oldsyms
23117         set X `cat UU/oldsyms`
23118         shift
23119         case $# in
23120         0) ;;
23121         *)
23122                 cat <<EOM
23123 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23124 EOM
23125                 echo ": Variables propagated from previous config.sh file." >>config.sh
23126                 for sym in `cat UU/oldsyms`; do
23127                         echo "    Propagating $hint variable "'$'"$sym..."
23128                         eval 'tmp="$'"${sym}"'"'
23129                         echo "$tmp" | \
23130                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23131                 done
23132                 ;;
23133         esac
23134 fi
23135
23136 : Finish up by extracting the .SH files
23137 case "$alldone" in
23138 exit)
23139         $rm -rf UU
23140         echo "Extraction done."
23141         exit 0
23142         ;;
23143 cont)
23144         ;;
23145 '')
23146         dflt=''
23147         nostick=true
23148         $cat <<EOM
23149
23150 If you'd like to make any changes to the config.sh file before I begin
23151 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23152
23153 EOM
23154         rp="Press return or use a shell escape to edit config.sh:"
23155         . UU/myread
23156         nostick=''
23157         case "$ans" in
23158         '') ;;
23159         *) : in case they cannot read
23160                 sh 1>&4 -c "$ans";;
23161         esac
23162         ;;
23163 esac
23164
23165 : if this fails, just run all the .SH files by hand
23166 . ./config.sh
23167
23168 echo " "
23169 exec 1>&4
23170 pwd=`pwd`
23171 . ./UU/extract
23172 cd "$pwd"
23173
23174 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23175         dflt=y
23176         case "$silent" in
23177         true) ;;
23178         *)
23179                 $cat <<EOM
23180
23181 Now you need to generate make dependencies by running "$make depend".
23182 You might prefer to run it in background: "$make depend > makedepend.out &"
23183 It can take a while, so you might not want to run it right now.
23184
23185 EOM
23186                 ;;
23187         esac
23188         rp="Run $make depend now?"
23189         . UU/myread
23190         case "$ans" in
23191         y*)
23192                 $make depend && echo "Now you must run '$make'."
23193                 ;;
23194         *)
23195                 echo "You must run '$make depend' then '$make'."
23196                 ;;
23197         esac
23198 elif test -f [Mm]akefile; then
23199         echo " "
23200         echo "Now you must run a $make."
23201 else
23202         echo "Configure done."
23203 fi
23204
23205 if $test -f Policy.sh; then
23206     $cat <<EOM
23207
23208 If you compile $package on a different machine or from a different object
23209 directory, copy the Policy.sh file from this object directory to the
23210 new one before you run Configure -- this will help you with most of
23211 the policy defaults.
23212
23213 EOM
23214 fi
23215 if $test -f config.msg; then
23216     echo "Hmm.  I also noted the following information while running:"
23217     echo " "
23218     $cat config.msg >&4
23219     $rm -f config.msg
23220 fi
23221 $rm -f kit*isdone ark*isdone
23222 $rm -rf UU
23223
23224 : End of Configure
23225