installperl patchlet
[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 Tue Oct 28 18:51:20 CET 2008 [metaconfig 3.5 PL0]
29 # (with additional metaconfig patches by perlbug@perl.org)
30
31 cat >c1$$ <<EOF
32 ARGGGHHHH!!!!!
33
34 SCO csh still thinks true is false.  Write to SCO today and tell them that next
35 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
36
37 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
38 we'd have to do is go in and swap the && and || tokens, wherever they are.)
39
40 [End of diatribe. We now return you to your regularly scheduled programming...]
41 EOF
42 cat >c2$$ <<EOF
43
44 OOPS!  You naughty creature!  You didn't run Configure with sh!
45 I will attempt to remedy the situation by running sh for you...
46 EOF
47
48 true || cat c1$$ c2$$
49 true || exec sh $0 $argv:q
50
51 (exit $?0) || cat c2$$
52 (exit $?0) || exec sh $0 $argv:q
53 rm -f c1$$ c2$$
54
55 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
56         cat >&4 <<EOF
57 ***
58 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
59 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
60 *** Please read the README.plan9 for further instructions.
61 *** Cannot continue, aborting.
62 ***
63 EOF
64         exit 1
65 fi
66
67 if test ! -c /dev/null ; then
68         cat >&4 <<EOF
69 ***
70 *** I'm sorry, but /dev/null appears to be a file rather than a device.
71 *** Please consult your operating sytem's notes for making a device
72 *** in /dev.
73 *** Cannot continue, aborting.
74 ***
75 EOF
76         exit 1
77 fi
78
79 : compute my invocation name
80 me=$0
81 case "$0" in
82 */*)
83         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
84         test "$me" || me=$0
85         ;;
86 esac
87
88 : Proper separator for the PATH environment variable
89 p_=:
90 : On OS/2 this directory should exist if this is not floppy only system ":-]"
91 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
92         if test -n "$OS2_SHELL"; then
93                 p_=\;
94                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
95                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
96                 is_os2=yes
97         elif test -n "$DJGPP"; then
98                 case "X${MACHTYPE:-nonesuchmach}" in
99                 *cygwin) ;;
100                 *) p_=\; ;;
101                 esac
102         fi
103 fi
104
105 : Proper PATH setting
106 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
107 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
108 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
109 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
110 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
111 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
112 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
113 paths="$paths /sbin /usr/sbin /usr/libexec"
114 paths="$paths /system/gnu_library/bin"
115
116 for p in $paths
117 do
118         case "$p_$PATH$p_" in
119         *$p_$p$p_*) ;;
120         *) test -d $p && PATH=$PATH$p_$p ;;
121         esac
122 done
123
124 PATH=.$p_$PATH
125 export PATH
126
127 : shall we be using ksh?
128 inksh=''
129 needksh=''
130 avoidksh=''
131 newsh=/bin/ksh
132 changesh=''
133 if (PATH=.; alias -x) >/dev/null 2>&1; then
134                 inksh=true
135 fi
136 if test -f /hp-ux -a -f /bin/ksh; then
137         needksh='to avoid sh bug in "here document" expansion'
138 fi
139 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
140         if test X`/usr/bin/uname -v` = X4; then
141                 avoidksh="to avoid AIX 4's /bin/sh"
142                 newsh=/usr/bin/bsh
143         fi
144 fi
145 if test -f /osf_boot -a -f /usr/sbin/setld; then
146         if test X`/usr/bin/uname -s` = XOSF1; then
147                 avoidksh="to avoid Digital UNIX' ksh"
148                 newsh=/bin/sh
149                 unset BIN_SH
150         fi
151 fi
152 case "$inksh/$needksh" in
153 /[a-z]*)
154                 ENV=''
155                 changesh=true
156                 reason="$needksh"
157         ;;
158 esac
159 case "$inksh/$avoidksh" in
160 true/[a-z]*)
161         changesh=true
162         reason="$avoidksh"
163         ;;
164 esac
165 case "$inksh/$needksh-$avoidksh-" in
166 true/--)
167                 cat <<EOM
168 (I see you are using the Korn shell.  Some ksh's blow up on $me,
169 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
170 EOM
171         ;;
172 esac
173 case "$changesh" in
174 true)
175         export newsh
176         echo "(Feeding myself to $newsh $reason.)"
177         case "$0" in
178         Configure|*/Configure) exec $newsh $0 "$@";;
179         *) exec $newsh Configure "$@";;
180         esac
181         ;;
182 esac
183 test -x "${newsh}" || unset newsh
184
185 : if needed, set CDPATH to a harmless value that is not chatty
186 : avoid bash 2.02 problems with empty CDPATH.
187 case "$CDPATH" in
188 '')     ;;
189 *)      case "$SHELL" in
190         *bash*) CDPATH='.' ;;
191         *) CDPATH='' ;;
192         esac
193         ;;
194 esac
195
196 : Configure runs within the UU subdirectory
197 test -d UU || mkdir UU
198 cd UU && rm -f ./*
199
200 ccname=''
201 ccversion=''
202 ccsymbols=''
203 cppccsymbols=''
204 cppsymbols=''
205 from=''
206 run=''
207 targetarch=''
208 to=''
209 usecrosscompile=''
210 extern_C=''
211 mistrustnm=''
212 perllibs=''
213 dynamic_ext=''
214 extensions=''
215 known_extensions=''
216 nonxs_ext=''
217 static_ext=''
218 useopcode=''
219 useposix=''
220 extras=''
221 d_bsd=''
222 d_eunice=''
223 d_xenix=''
224 eunicefix=''
225 ar=''
226 awk=''
227 bash=''
228 bison=''
229 byacc=''
230 cat=''
231 chgrp=''
232 chmod=''
233 chown=''
234 comm=''
235 compress=''
236 cp=''
237 cpio=''
238 cpp=''
239 csh=''
240 date=''
241 echo=''
242 egrep=''
243 emacs=''
244 expr=''
245 find=''
246 flex=''
247 gmake=''
248 grep=''
249 gzip=''
250 inews=''
251 ksh=''
252 less=''
253 line=''
254 lint=''
255 ln=''
256 lp=''
257 lpr=''
258 ls=''
259 mail=''
260 mailx=''
261 make=''
262 mkdir=''
263 more=''
264 mv=''
265 nm=''
266 nroff=''
267 perl=''
268 pg=''
269 pmake=''
270 pr=''
271 rm=''
272 rmail=''
273 sed=''
274 sendmail=''
275 shar=''
276 sleep=''
277 smail=''
278 sort=''
279 submit=''
280 tail=''
281 tar=''
282 tbl=''
283 tee=''
284 test=''
285 touch=''
286 tr=''
287 troff=''
288 uname=''
289 uniq=''
290 uuname=''
291 vi=''
292 zcat=''
293 zip=''
294 full_ar=''
295 full_sed=''
296 libswanted=''
297 hint=''
298 myuname=''
299 osname=''
300 osvers=''
301 Author=''
302 Date=''
303 Header=''
304 Id=''
305 Locker=''
306 Log=''
307 RCSfile=''
308 Revision=''
309 Source=''
310 State=''
311 _a=''
312 _exe=''
313 _o=''
314 archobjs=''
315 exe_ext=''
316 firstmakefile=''
317 lib_ext=''
318 obj_ext=''
319 path_sep=''
320 rm_try=''
321 afs=''
322 afsroot=''
323 alignbytes=''
324 ansi2knr=''
325 archlib=''
326 archlibexp=''
327 d_archlib=''
328 installarchlib=''
329 archname=''
330 myarchname=''
331 d_atolf=''
332 d_atoll=''
333 baserev=''
334 bin=''
335 binexp=''
336 initialinstalllocation=''
337 installbin=''
338 userelocatableinc=''
339 byteorder=''
340 cc=''
341 ccflags=''
342 cppflags=''
343 ldflags=''
344 lkflags=''
345 locincpth=''
346 optimize=''
347 cf_email=''
348 cf_by=''
349 cf_time=''
350 contains=''
351 cpp_stuff=''
352 cpplast=''
353 cppminus=''
354 cpprun=''
355 cppstdin=''
356 d__fwalk=''
357 d_access=''
358 d_accessx=''
359 d_aintl=''
360 d_alarm=''
361 asctime_r_proto=''
362 d_asctime_r=''
363 d_attribute_format=''
364 d_attribute_malloc=''
365 d_attribute_nonnull=''
366 d_attribute_noreturn=''
367 d_attribute_pure=''
368 d_attribute_unused=''
369 d_attribute_warn_unused_result=''
370 d_printf_format_null=''
371 d_bcmp=''
372 d_bcopy=''
373 d_builtin_choose_expr=''
374 d_builtin_expect=''
375 d_bzero=''
376 d_c99_variadic_macros=''
377 d_casti32=''
378 castflags=''
379 d_castneg=''
380 d_chown=''
381 d_chroot=''
382 d_chsize=''
383 d_class=''
384 d_clearenv=''
385 d_closedir=''
386 d_void_closedir=''
387 d_cmsghdr_s=''
388 d_const=''
389 d_copysignl=''
390 d_cplusplus=''
391 cryptlib=''
392 d_crypt=''
393 crypt_r_proto=''
394 d_crypt_r=''
395 d_csh=''
396 full_csh=''
397 d_ctermid=''
398 ctermid_r_proto=''
399 d_ctermid_r=''
400 ctime_r_proto=''
401 d_ctime_r=''
402 d_cuserid=''
403 d_dbl_dig=''
404 d_dbminitproto=''
405 d_difftime=''
406 d_dir_dd_fd=''
407 d_dirfd=''
408 d_dlerror=''
409 d_dlopen=''
410 d_dlsymun=''
411 d_dosuid=''
412 d_suidsafe=''
413 d_drand48_r=''
414 drand48_r_proto=''
415 d_drand48proto=''
416 d_dup2=''
417 d_eaccess=''
418 d_endgrent=''
419 d_endgrent_r=''
420 endgrent_r_proto=''
421 d_endhent=''
422 d_endhostent_r=''
423 endhostent_r_proto=''
424 d_endnent=''
425 d_endnetent_r=''
426 endnetent_r_proto=''
427 d_endpent=''
428 d_endprotoent_r=''
429 endprotoent_r_proto=''
430 d_endpwent=''
431 d_endpwent_r=''
432 endpwent_r_proto=''
433 d_endsent=''
434 d_endservent_r=''
435 endservent_r_proto=''
436 d_faststdio=''
437 d_fchdir=''
438 d_fchmod=''
439 d_fchown=''
440 d_fcntl=''
441 d_fcntl_can_lock=''
442 d_fd_macros=''
443 d_fd_set=''
444 d_fds_bits=''
445 d_fgetpos=''
446 d_finite=''
447 d_finitel=''
448 d_flexfnam=''
449 d_flock=''
450 d_flockproto=''
451 d_fork=''
452 d_fp_class=''
453 d_fpclass=''
454 d_fpclassify=''
455 d_fpclassl=''
456 d_fpos64_t=''
457 d_frexpl=''
458 d_fs_data_s=''
459 d_fseeko=''
460 d_fsetpos=''
461 d_fstatfs=''
462 d_fsync=''
463 d_ftello=''
464 d_ftime=''
465 d_gettimeod=''
466 d_futimes=''
467 d_Gconvert=''
468 d_getcwd=''
469 d_getespwnam=''
470 d_getfsstat=''
471 d_getgrent=''
472 d_getgrent_r=''
473 getgrent_r_proto=''
474 d_getgrgid_r=''
475 getgrgid_r_proto=''
476 d_getgrnam_r=''
477 getgrnam_r_proto=''
478 d_getgrps=''
479 d_gethbyaddr=''
480 d_gethbyname=''
481 d_gethent=''
482 aphostname=''
483 d_gethname=''
484 d_phostname=''
485 d_uname=''
486 d_gethostbyaddr_r=''
487 gethostbyaddr_r_proto=''
488 d_gethostbyname_r=''
489 gethostbyname_r_proto=''
490 d_gethostent_r=''
491 gethostent_r_proto=''
492 d_gethostprotos=''
493 d_getitimer=''
494 d_getlogin=''
495 d_getlogin_r=''
496 getlogin_r_proto=''
497 d_getmnt=''
498 d_getmntent=''
499 d_getnbyaddr=''
500 d_getnbyname=''
501 d_getnent=''
502 d_getnetbyaddr_r=''
503 getnetbyaddr_r_proto=''
504 d_getnetbyname_r=''
505 getnetbyname_r_proto=''
506 d_getnetent_r=''
507 getnetent_r_proto=''
508 d_getnetprotos=''
509 d_getpagsz=''
510 d_getpent=''
511 d_getpgid=''
512 d_getpgrp2=''
513 d_bsdgetpgrp=''
514 d_getpgrp=''
515 d_getppid=''
516 d_getprior=''
517 d_getpbyname=''
518 d_getpbynumber=''
519 d_getprotobyname_r=''
520 getprotobyname_r_proto=''
521 d_getprotobynumber_r=''
522 getprotobynumber_r_proto=''
523 d_getprotoent_r=''
524 getprotoent_r_proto=''
525 d_getprotoprotos=''
526 d_getprpwnam=''
527 d_getpwent=''
528 d_getpwent_r=''
529 getpwent_r_proto=''
530 d_getpwnam_r=''
531 getpwnam_r_proto=''
532 d_getpwuid_r=''
533 getpwuid_r_proto=''
534 d_getsent=''
535 d_getservbyname_r=''
536 getservbyname_r_proto=''
537 d_getservbyport_r=''
538 getservbyport_r_proto=''
539 d_getservent_r=''
540 getservent_r_proto=''
541 d_getservprotos=''
542 d_getspnam=''
543 d_getspnam_r=''
544 getspnam_r_proto=''
545 d_getsbyname=''
546 d_getsbyport=''
547 d_gmtime_r=''
548 gmtime_r_proto=''
549 d_gnulibc=''
550 gnulibc_version=''
551 d_hasmntopt=''
552 d_htonl=''
553 d_ilogbl=''
554 d_inetaton=''
555 d_int64_t=''
556 d_isascii=''
557 d_isfinite=''
558 d_isinf=''
559 d_isnan=''
560 d_isnanl=''
561 d_killpg=''
562 d_lchown=''
563 d_ldbl_dig=''
564 d_libm_lib_version=''
565 d_link=''
566 d_localtime_r=''
567 d_localtime_r_needs_tzset=''
568 localtime_r_proto=''
569 d_locconv=''
570 d_lockf=''
571 d_longdbl=''
572 longdblsize=''
573 d_longlong=''
574 longlongsize=''
575 d_lseekproto=''
576 d_lstat=''
577 d_madvise=''
578 d_malloc_good_size=''
579 d_malloc_size=''
580 d_mblen=''
581 d_mbstowcs=''
582 d_mbtowc=''
583 d_memchr=''
584 d_memcmp=''
585 d_memcpy=''
586 d_memmove=''
587 d_memset=''
588 d_mkdir=''
589 d_mkdtemp=''
590 d_mkfifo=''
591 d_mkstemp=''
592 d_mkstemps=''
593 d_mktime=''
594 d_mmap=''
595 mmaptype=''
596 d_modfl=''
597 d_modfl_pow32_bug=''
598 d_modflproto=''
599 d_mprotect=''
600 d_msg=''
601 d_msgctl=''
602 d_msgget=''
603 d_msghdr_s=''
604 d_msgrcv=''
605 d_msgsnd=''
606 d_msync=''
607 d_munmap=''
608 d_nice=''
609 d_nl_langinfo=''
610 d_off64_t=''
611 d_open3=''
612 d_fpathconf=''
613 d_pathconf=''
614 d_pause=''
615 d_pipe=''
616 d_poll=''
617 d_portable=''
618 d_procselfexe=''
619 procselfexe=''
620 d_old_pthread_create_joinable=''
621 old_pthread_create_joinable=''
622 d_pthread_atfork=''
623 d_pthread_attr_setscope=''
624 d_pthread_yield=''
625 d_sched_yield=''
626 sched_yield=''
627 d_qgcvt=''
628 d_random_r=''
629 random_r_proto=''
630 d_readdir64_r=''
631 readdir64_r_proto=''
632 d_readdir=''
633 d_rewinddir=''
634 d_seekdir=''
635 d_telldir=''
636 d_readdir_r=''
637 readdir_r_proto=''
638 d_readlink=''
639 d_readv=''
640 d_recvmsg=''
641 d_rename=''
642 d_rmdir=''
643 d_safebcpy=''
644 d_safemcpy=''
645 d_sanemcmp=''
646 d_sbrkproto=''
647 d_scalbnl=''
648 d_select=''
649 d_sem=''
650 d_semctl=''
651 d_semget=''
652 d_semop=''
653 d_sendmsg=''
654 d_setegid=''
655 d_seteuid=''
656 d_setgrent=''
657 d_setgrent_r=''
658 setgrent_r_proto=''
659 d_setgrps=''
660 d_sethent=''
661 d_sethostent_r=''
662 sethostent_r_proto=''
663 d_setitimer=''
664 d_setlinebuf=''
665 d_setlocale=''
666 d_setlocale_r=''
667 setlocale_r_proto=''
668 d_setnent=''
669 d_setnetent_r=''
670 setnetent_r_proto=''
671 d_setpent=''
672 d_setpgid=''
673 d_setpgrp2=''
674 d_bsdsetpgrp=''
675 d_setpgrp=''
676 d_setprior=''
677 d_setproctitle=''
678 d_setprotoent_r=''
679 setprotoent_r_proto=''
680 d_setpwent=''
681 d_setpwent_r=''
682 setpwent_r_proto=''
683 d_setregid=''
684 d_setresgid=''
685 d_setresuid=''
686 d_setreuid=''
687 d_setrgid=''
688 d_setruid=''
689 d_setsent=''
690 d_setservent_r=''
691 setservent_r_proto=''
692 d_setsid=''
693 d_setvbuf=''
694 d_sfio=''
695 usesfio=''
696 d_shm=''
697 d_shmat=''
698 d_shmatprototype=''
699 shmattype=''
700 d_shmctl=''
701 d_shmdt=''
702 d_shmget=''
703 d_sigaction=''
704 d_signbit=''
705 d_sigprocmask=''
706 d_sigsetjmp=''
707 usesitecustomize=''
708 d_snprintf=''
709 d_vsnprintf=''
710 d_sockatmark=''
711 d_sockatmarkproto=''
712 d_msg_ctrunc=''
713 d_msg_dontroute=''
714 d_msg_oob=''
715 d_msg_peek=''
716 d_msg_proxy=''
717 d_oldsock=''
718 d_scm_rights=''
719 d_socket=''
720 d_sockpair=''
721 sockethdr=''
722 socketlib=''
723 d_socklen_t=''
724 d_socks5_init=''
725 d_sprintf_returns_strlen=''
726 d_sqrtl=''
727 d_srand48_r=''
728 srand48_r_proto=''
729 d_srandom_r=''
730 srandom_r_proto=''
731 d_sresgproto=''
732 d_sresuproto=''
733 d_statblks=''
734 d_statfs_f_flags=''
735 d_statfs_s=''
736 d_fstatvfs=''
737 d_statvfs=''
738 d_stdio_cnt_lval=''
739 d_stdio_ptr_lval=''
740 d_stdio_ptr_lval_nochange_cnt=''
741 d_stdio_ptr_lval_sets_cnt=''
742 d_stdiobase=''
743 d_stdstdio=''
744 stdio_base=''
745 stdio_bufsiz=''
746 stdio_cnt=''
747 stdio_filbuf=''
748 stdio_ptr=''
749 d_index=''
750 d_strchr=''
751 d_strcoll=''
752 d_strctcpy=''
753 d_strerrm=''
754 d_strerror=''
755 d_sysernlst=''
756 d_syserrlst=''
757 d_strerror_r=''
758 strerror_r_proto=''
759 d_strftime=''
760 d_strlcat=''
761 d_strlcpy=''
762 d_strtod=''
763 d_strtol=''
764 d_strtold=''
765 d_strtoll=''
766 d_strtoq=''
767 d_strtoul=''
768 d_strtoull=''
769 d_strtouq=''
770 d_strxfrm=''
771 d_symlink=''
772 d_syscall=''
773 d_syscallproto=''
774 d_sysconf=''
775 d_system=''
776 d_tcgetpgrp=''
777 d_tcsetpgrp=''
778 d_telldirproto=''
779 d_time=''
780 timetype=''
781 d_asctime64=''
782 d_ctime64=''
783 d_difftime64=''
784 d_gmtime64=''
785 d_localtime64=''
786 d_mktime64=''
787 d_timegm=''
788 clocktype=''
789 d_times=''
790 d_tmpnam_r=''
791 tmpnam_r_proto=''
792 d_truncate=''
793 d_ttyname_r=''
794 ttyname_r_proto=''
795 d_tzname=''
796 d_u32align=''
797 d_ualarm=''
798 d_umask=''
799 d_semctl_semid_ds=''
800 d_semctl_semun=''
801 d_union_semun=''
802 d_unordered=''
803 d_unsetenv=''
804 d_usleep=''
805 d_usleepproto=''
806 d_ustat=''
807 d_pseudofork=''
808 d_vfork=''
809 usevfork=''
810 d_voidsig=''
811 signal_t=''
812 d_volatile=''
813 d_charvspr=''
814 d_vprintf=''
815 d_wait4=''
816 d_waitpid=''
817 d_wcstombs=''
818 d_wctomb=''
819 d_writev=''
820 dlext=''
821 cccdlflags=''
822 ccdlflags=''
823 dlsrc=''
824 ld=''
825 lddlflags=''
826 usedl=''
827 doublesize=''
828 ebcdic=''
829 fflushNULL=''
830 fflushall=''
831 fpossize=''
832 fpostype=''
833 gccansipedantic=''
834 gccosandvers=''
835 gccversion=''
836 gidformat=''
837 gidsign=''
838 gidsize=''
839 gidtype=''
840 groupstype=''
841 h_fcntl=''
842 h_sysfile=''
843 html1dir=''
844 html1direxp=''
845 installhtml1dir=''
846 html3dir=''
847 html3direxp=''
848 installhtml3dir=''
849 i_arpainet=''
850 i_assert=''
851 i_crypt=''
852 db_hashtype=''
853 db_prefixtype=''
854 db_version_major=''
855 db_version_minor=''
856 db_version_patch=''
857 i_db=''
858 i_dbm=''
859 i_rpcsvcdbm=''
860 d_dirnamlen=''
861 direntrytype=''
862 i_dirent=''
863 i_dld=''
864 i_dlfcn=''
865 i_fcntl=''
866 i_float=''
867 i_fp=''
868 i_fp_class=''
869 i_gdbm=''
870 d_grpasswd=''
871 i_grp=''
872 i_ieeefp=''
873 i_inttypes=''
874 i_langinfo=''
875 i_libutil=''
876 i_limits=''
877 i_locale=''
878 i_machcthr=''
879 i_malloc=''
880 i_mallocmalloc=''
881 i_math=''
882 i_memory=''
883 i_mntent=''
884 d_ndbm=''
885 i_gdbm_ndbm=''
886 i_gdbmndbm=''
887 i_ndbm=''
888 i_netdb=''
889 i_neterrno=''
890 i_netinettcp=''
891 i_niin=''
892 i_sysin=''
893 i_poll=''
894 i_prot=''
895 i_pthread=''
896 d_pwage=''
897 d_pwchange=''
898 d_pwclass=''
899 d_pwcomment=''
900 d_pwexpire=''
901 d_pwgecos=''
902 d_pwpasswd=''
903 d_pwquota=''
904 i_pwd=''
905 i_sfio=''
906 i_shadow=''
907 i_socks=''
908 i_stddef=''
909 i_stdlib=''
910 i_string=''
911 strings=''
912 i_sunmath=''
913 i_sysaccess=''
914 i_sysdir=''
915 i_sysfile=''
916 d_voidtty=''
917 i_bsdioctl=''
918 i_sysfilio=''
919 i_sysioctl=''
920 i_syssockio=''
921 i_syslog=''
922 i_sysmman=''
923 i_sysmode=''
924 i_sysmount=''
925 i_sysndir=''
926 i_sysparam=''
927 i_syspoll=''
928 i_sysresrc=''
929 i_syssecrt=''
930 i_sysselct=''
931 i_sysstat=''
932 i_sysstatfs=''
933 i_sysstatvfs=''
934 i_systimes=''
935 i_systypes=''
936 i_sysuio=''
937 i_sysun=''
938 i_sysutsname=''
939 i_sysvfs=''
940 i_syswait=''
941 i_sgtty=''
942 i_termio=''
943 i_termios=''
944 d_tm_tm_gmtoff=''
945 d_tm_tm_zone=''
946 i_systime=''
947 i_systimek=''
948 i_time=''
949 timeincl=''
950 i_unistd=''
951 i_ustat=''
952 i_utime=''
953 i_values=''
954 i_stdarg=''
955 i_varargs=''
956 i_varhdr=''
957 i_vfork=''
958 d_inc_version_list=''
959 inc_version_list=''
960 inc_version_list_init=''
961 installprefix=''
962 installprefixexp=''
963 installstyle=''
964 installusrbinperl=''
965 intsize=''
966 longsize=''
967 shortsize=''
968 issymlink=''
969 libc=''
970 ldlibpthname=''
971 libperl=''
972 shrpenv=''
973 useshrplib=''
974 glibpth=''
975 libpth=''
976 loclibpth=''
977 plibpth=''
978 xlibpth=''
979 ignore_versioned_solibs=''
980 libs=''
981 libsdirs=''
982 libsfiles=''
983 libsfound=''
984 libspath=''
985 lns=''
986 d_PRIEUldbl=''
987 d_PRIFUldbl=''
988 d_PRIGUldbl=''
989 d_PRIeldbl=''
990 d_PRIfldbl=''
991 d_PRIgldbl=''
992 d_SCNfldbl=''
993 sPRIEUldbl=''
994 sPRIFUldbl=''
995 sPRIGUldbl=''
996 sPRIeldbl=''
997 sPRIfldbl=''
998 sPRIgldbl=''
999 sSCNfldbl=''
1000 lseeksize=''
1001 lseektype=''
1002 mad=''
1003 madlyh=''
1004 madlyobj=''
1005 madlysrc=''
1006 make_set_make=''
1007 d_mymalloc=''
1008 freetype=''
1009 mallocobj=''
1010 mallocsrc=''
1011 malloctype=''
1012 usemallocwrap=''
1013 usemymalloc=''
1014 installman1dir=''
1015 man1dir=''
1016 man1direxp=''
1017 man1ext=''
1018 installman3dir=''
1019 man3dir=''
1020 man3direxp=''
1021 man3ext=''
1022 modetype=''
1023 multiarch=''
1024 mydomain=''
1025 myhostname=''
1026 phostname=''
1027 c=''
1028 n=''
1029 d_eofnblk=''
1030 eagain=''
1031 o_nonblock=''
1032 rd_nodata=''
1033 need_va_copy=''
1034 netdb_hlen_type=''
1035 netdb_host_type=''
1036 netdb_name_type=''
1037 netdb_net_type=''
1038 groupcat=''
1039 hostcat=''
1040 passcat=''
1041 orderlib=''
1042 ranlib=''
1043 d_perl_otherlibdirs=''
1044 otherlibdirs=''
1045 package=''
1046 spackage=''
1047 pager=''
1048 api_revision=''
1049 api_subversion=''
1050 api_version=''
1051 api_versionstring=''
1052 patchlevel=''
1053 perl_patchlevel=''
1054 revision=''
1055 subversion=''
1056 version=''
1057 version_patchlevel_string=''
1058 perl5=''
1059 perladmin=''
1060 perlpath=''
1061 d_nv_preserves_uv=''
1062 d_nv_zero_is_allbits_zero=''
1063 i16size=''
1064 i16type=''
1065 i32size=''
1066 i32type=''
1067 i64size=''
1068 i64type=''
1069 i8size=''
1070 i8type=''
1071 ivsize=''
1072 ivtype=''
1073 nv_overflows_integers_at=''
1074 nv_preserves_uv_bits=''
1075 nvsize=''
1076 nvtype=''
1077 u16size=''
1078 u16type=''
1079 u32size=''
1080 u32type=''
1081 u64size=''
1082 u64type=''
1083 u8size=''
1084 u8type=''
1085 uvsize=''
1086 uvtype=''
1087 ivdformat=''
1088 nvEUformat=''
1089 nvFUformat=''
1090 nvGUformat=''
1091 nveformat=''
1092 nvfformat=''
1093 nvgformat=''
1094 uvXUformat=''
1095 uvoformat=''
1096 uvuformat=''
1097 uvxformat=''
1098 pidtype=''
1099 prefix=''
1100 prefixexp=''
1101 installprivlib=''
1102 privlib=''
1103 privlibexp=''
1104 prototype=''
1105 ptrsize=''
1106 d_PRIXU64=''
1107 d_PRId64=''
1108 d_PRIi64=''
1109 d_PRIo64=''
1110 d_PRIu64=''
1111 d_PRIx64=''
1112 sPRIXU64=''
1113 sPRId64=''
1114 sPRIi64=''
1115 sPRIo64=''
1116 sPRIu64=''
1117 sPRIx64=''
1118 d_quad=''
1119 quadkind=''
1120 quadtype=''
1121 uquadtype=''
1122 drand01=''
1123 randbits=''
1124 randfunc=''
1125 randseedtype=''
1126 seedfunc=''
1127 installscript=''
1128 scriptdir=''
1129 scriptdirexp=''
1130 selectminbits=''
1131 selecttype=''
1132 sh=''
1133 sig_count=''
1134 sig_name=''
1135 sig_name_init=''
1136 sig_num=''
1137 sig_num_init=''
1138 sig_size=''
1139 d_sitearch=''
1140 installsitearch=''
1141 sitearch=''
1142 sitearchexp=''
1143 installsitebin=''
1144 sitebin=''
1145 sitebinexp=''
1146 installsitehtml1dir=''
1147 sitehtml1dir=''
1148 sitehtml1direxp=''
1149 installsitehtml3dir=''
1150 sitehtml3dir=''
1151 sitehtml3direxp=''
1152 installsitelib=''
1153 sitelib=''
1154 sitelib_stem=''
1155 sitelibexp=''
1156 installsiteman1dir=''
1157 siteman1dir=''
1158 siteman1direxp=''
1159 installsiteman3dir=''
1160 siteman3dir=''
1161 siteman3direxp=''
1162 siteprefix=''
1163 siteprefixexp=''
1164 installsitescript=''
1165 sitescript=''
1166 sitescriptexp=''
1167 sizesize=''
1168 sizetype=''
1169 so=''
1170 socksizetype=''
1171 sharpbang=''
1172 shsharp=''
1173 spitshell=''
1174 src=''
1175 ssizetype=''
1176 startperl=''
1177 startsh=''
1178 stdchar=''
1179 d_stdio_stream_array=''
1180 stdio_stream_array=''
1181 sysman=''
1182 sGMTIME_max=''
1183 sGMTIME_min=''
1184 sLOCALTIME_max=''
1185 sLOCALTIME_min=''
1186 trnl=''
1187 uidformat=''
1188 uidsign=''
1189 uidsize=''
1190 uidtype=''
1191 archname64=''
1192 use64bitall=''
1193 use64bitint=''
1194 dtrace=''
1195 usedtrace=''
1196 usefaststdio=''
1197 ccflags_uselargefiles=''
1198 ldflags_uselargefiles=''
1199 libswanted_uselargefiles=''
1200 uselargefiles=''
1201 uselongdouble=''
1202 usemorebits=''
1203 usemultiplicity=''
1204 nm_opt=''
1205 nm_so_opt=''
1206 runnm=''
1207 usenm=''
1208 useperlio=''
1209 usesocks=''
1210 d_oldpthreads=''
1211 use5005threads=''
1212 useithreads=''
1213 usereentrant=''
1214 usethreads=''
1215 incpath=''
1216 mips_type=''
1217 usrinc=''
1218 d_vendorarch=''
1219 installvendorarch=''
1220 vendorarch=''
1221 vendorarchexp=''
1222 d_vendorbin=''
1223 installvendorbin=''
1224 vendorbin=''
1225 vendorbinexp=''
1226 installvendorhtml1dir=''
1227 vendorhtml1dir=''
1228 vendorhtml1direxp=''
1229 installvendorhtml3dir=''
1230 vendorhtml3dir=''
1231 vendorhtml3direxp=''
1232 d_vendorlib=''
1233 installvendorlib=''
1234 vendorlib=''
1235 vendorlib_stem=''
1236 vendorlibexp=''
1237 installvendorman1dir=''
1238 vendorman1dir=''
1239 vendorman1direxp=''
1240 installvendorman3dir=''
1241 vendorman3dir=''
1242 vendorman3direxp=''
1243 usevendorprefix=''
1244 vendorprefix=''
1245 vendorprefixexp=''
1246 d_vendorscript=''
1247 installvendorscript=''
1248 vendorscript=''
1249 vendorscriptexp=''
1250 versiononly=''
1251 defvoidused=''
1252 voidflags=''
1253 yacc=''
1254 yaccflags=''
1255 CONFIG=''
1256
1257 : Detect odd OSs
1258 define='define'
1259 undef='undef'
1260 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1261 rmlist=''
1262
1263 : We must find out about Eunice early
1264 eunicefix=':'
1265 if test -f /etc/unixtovms; then
1266         eunicefix=/etc/unixtovms
1267 fi
1268 if test -f /etc/unixtovms.exe; then
1269         eunicefix=/etc/unixtovms.exe
1270 fi
1271
1272 : Set executable suffix now -- needed before hints available
1273 if test -f "/libs/version.library"; then
1274 : Amiga OS
1275     _exe=""
1276 elif test -f "/system/gnu_library/bin/ar.pm"; then
1277 : Stratus VOS
1278     _exe=".pm"
1279 elif test -n "$DJGPP"; then
1280 : DOS DJGPP
1281     _exe=".exe"
1282 elif test -d c:/. -o -n "$is_os2" ; then
1283 : OS/2 or cygwin
1284     _exe=".exe"
1285 fi
1286
1287 groupstype=''
1288 i_whoami=''
1289 : Trailing extension.  Override this in a hint file, if needed.
1290 : Extra object files, if any, needed on this platform.
1291 archobjs=''
1292 archname=''
1293 libnames=''
1294 : change the next line if compiling for Xenix/286 on Xenix/386
1295 xlibpth='/usr/lib/386 /lib/386'
1296 : Possible local library directories to search.
1297 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1298 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1299
1300 : general looking path for locating libraries
1301 glibpth="/lib /usr/lib $xlibpth"
1302 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1303 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1304 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1305 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1306
1307 : Private path used by Configure to find libraries.  Its value
1308 : is prepended to libpth. This variable takes care of special
1309 : machines, like the mips.  Usually, it should be empty.
1310 plibpth=''
1311
1312 : default library list
1313 libswanted=''
1314 : some systems want to use only the non-versioned libso:s
1315 ignore_versioned_solibs=''
1316 : set usethreads on the Configure command line to enable threads.
1317 usereentrant='undef'
1318 : full support for void wanted by default
1319 defvoidused=15
1320
1321 : Possible local include directories to search.
1322 : Set locincpth to "" in a hint file to defeat local include searches.
1323 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1324 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1325 :
1326 : no include file wanted by default
1327 inclwanted=''
1328
1329 : Enable -DEBUGGING and -DDEBUGGING from the command line
1330 EBUGGING=''
1331 DEBUGGING=old
1332
1333 ccname=''
1334 ccversion=''
1335 perllibs=''
1336 : set useposix=false in your hint file to disable the POSIX extension.
1337 useposix=true
1338 : set useopcode=false in your hint file to disable the Opcode extension.
1339 useopcode=true
1340 archname64=''
1341 ccflags_uselargefiles=''
1342 ldflags_uselargefiles=''
1343 libswanted_uselargefiles=''
1344 : set usemultiplicity on the Configure command line to enable multiplicity.
1345 : set usesocks on the Configure command line to enable socks.
1346 : List of libraries we want.
1347 : If anyone needs extra -lxxx, put those in a hint file.
1348 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1349 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1350 : We probably want to search /usr/shlib before most other libraries.
1351 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1352 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1353 glibpth="/usr/shlib $glibpth"
1354 : Do not use vfork unless overridden by a hint file.
1355 usevfork=false
1356
1357 : Find the basic shell for Bourne shell scripts
1358 case "$sh" in
1359 '')
1360         case "$SYSTYPE" in
1361         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1362         *) xxx='/bin/sh';;
1363         esac
1364         if test -f "$xxx"; then
1365                 sh="$xxx"
1366         else
1367                 : Build up a list and do a single loop so we can 'break' out.
1368                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1369                 for xxx in sh bash ksh pdksh ash; do
1370                         for p in $pth; do
1371                                 try="$try ${p}/${xxx}"
1372                         done
1373                 done
1374                 for xxx in $try; do
1375                         if test -f "$xxx"; then
1376                                 sh="$xxx";
1377                                 break
1378                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1379                                 sh="$xxx";
1380                                 break
1381                         elif test -f "$xxx.exe"; then
1382                                 sh="$xxx";
1383                                 break
1384                         fi
1385                 done
1386         fi
1387         ;;
1388 esac
1389
1390 case "$sh" in
1391 '')     cat >&2 <<EOM
1392 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1393
1394 Usually it's in /bin/sh.  How did you even get this far?
1395 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1396 we'll try to straighten this all out.
1397 EOM
1398         exit 1
1399         ;;
1400 esac
1401
1402 : see if sh knows # comments
1403 if `$sh -c '#' >/dev/null 2>&1`; then
1404         shsharp=true
1405         spitshell=cat
1406         xcat=/bin/cat
1407         test -f $xcat$_exe || xcat=/usr/bin/cat
1408         if test ! -f $xcat$_exe; then
1409                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1410                         if test -f $p/cat$_exe; then
1411                                 xcat=$p/cat
1412                                 break
1413                         fi
1414                 done
1415                 if test ! -f $xcat$_exe; then
1416                         echo "Can't find cat anywhere!"
1417                         exit 1
1418                 fi
1419         fi
1420         echo "#!$xcat" >sharp
1421         $eunicefix sharp
1422         chmod +x sharp
1423         ./sharp > today 2>/dev/null
1424         if test -s today; then
1425                 sharpbang='#!'
1426         else
1427                 echo "#! $xcat" > sharp
1428                 $eunicefix sharp
1429                 chmod +x sharp
1430                 ./sharp > today 2>/dev/null
1431                 if test -s today; then
1432                         sharpbang='#! '
1433                 else
1434                         sharpbang=': use '
1435                 fi
1436         fi
1437 else
1438         echo " "
1439         echo "Your $sh doesn't grok # comments--I will strip them later on."
1440         shsharp=false
1441         cd ..
1442         echo "exec grep -v '^[  ]*#'" >spitshell
1443         chmod +x spitshell
1444         $eunicefix spitshell
1445         spitshell=`pwd`/spitshell
1446         cd UU
1447         echo "I presume that if # doesn't work, #! won't work either!"
1448         sharpbang=': use '
1449 fi
1450 rm -f sharp today
1451
1452 : figure out how to guarantee sh startup
1453 case "$startsh" in
1454 '') startsh=${sharpbang}${sh} ;;
1455 *)
1456 esac
1457 cat >sharp <<EOSS
1458 $startsh
1459 set abc
1460 test "$?abc" != 1
1461 EOSS
1462
1463 chmod +x sharp
1464 $eunicefix sharp
1465 if ./sharp; then
1466         : echo "Yup, it does."
1467 else
1468         echo "Hmm... '$startsh' does not guarantee sh startup..."
1469         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1470 fi
1471 rm -f sharp
1472
1473 : Save command line options in file UU/cmdline.opt for later use in
1474 : generating config.sh.
1475 cat > cmdline.opt <<EOSH
1476 : Configure command line arguments.
1477 config_arg0='$0'
1478 config_args='$*'
1479 config_argc=$#
1480 EOSH
1481 argn=1
1482 args_exp=''
1483 args_sep=''
1484 for arg in "$@"; do
1485         cat >>cmdline.opt <<EOSH
1486 config_arg$argn='$arg'
1487 EOSH
1488         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1489 $arg
1490 EOC
1491         arg_exp=`cat cmdl.opt`
1492         args_exp="$args_exp$args_sep'$arg_exp'"
1493         argn=`expr $argn + 1`
1494         args_sep=' '
1495 done
1496 rm -f cmdl.opt
1497
1498 : produce awk script to parse command line options
1499 cat >options.awk <<'EOF'
1500 BEGIN {
1501         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1502
1503         len = length(optstr);
1504         for (i = 1; i <= len; i++) {
1505                 c = substr(optstr, i, 1);
1506                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1507                 if (a == ":") {
1508                         arg[c] = 1;
1509                         i++;
1510                 }
1511                 opt[c] = 1;
1512         }
1513 }
1514 {
1515         expect = 0;
1516         str = $0;
1517         if (substr(str, 1, 1) != "-") {
1518                 printf("'%s'\n", str);
1519                 next;
1520         }
1521         len = length($0);
1522         for (i = 2; i <= len; i++) {
1523                 c = substr(str, i, 1);
1524                 if (!opt[c]) {
1525                         printf("-%s\n", substr(str, i));
1526                         next;
1527                 }
1528                 printf("-%s\n", c);
1529                 if (arg[c]) {
1530                         if (i < len)
1531                                 printf("'%s'\n", substr(str, i + 1));
1532                         else
1533                                 expect = 1;
1534                         next;
1535                 }
1536         }
1537 }
1538 END {
1539         if (expect)
1540                 print "?";
1541 }
1542 EOF
1543
1544 : process the command line options
1545 set X `for arg in "$@"; do echo "X$arg"; done |
1546         sed -e s/X// | awk -f options.awk`
1547 eval "set $*"
1548 shift
1549 rm -f options.awk
1550
1551 : set up default values
1552 fastread=''
1553 reuseval=false
1554 config_sh=''
1555 alldone=''
1556 error=''
1557 silent=''
1558 extractsh=''
1559 override=''
1560 knowitall=''
1561 rm -f optdef.sh posthint.sh
1562 cat >optdef.sh <<EOS
1563 $startsh
1564 EOS
1565
1566
1567 : option parsing
1568 while test $# -gt 0; do
1569         case "$1" in
1570         -d) shift; fastread=yes;;
1571         -e) shift; alldone=cont;;
1572         -f)
1573                 shift
1574                 cd ..
1575                 if test -r "$1"; then
1576                         config_sh="$1"
1577                 else
1578                         echo "$me: cannot read config file $1." >&2
1579                         error=true
1580                 fi
1581                 cd UU
1582                 shift;;
1583         --help|\
1584         -h) shift; error=true;;
1585         -r) shift; reuseval=true;;
1586         -s) shift; silent=true; realsilent=true;;
1587         -E) shift; alldone=exit;;
1588         -K) shift; knowitall=true;;
1589         -O) shift; override=true;;
1590         -S) shift; silent=true; extractsh=true;;
1591         -D)
1592                 shift
1593                 case "$1" in
1594                 *=)
1595                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1596                         echo "$me: ignoring -D $1" >&2
1597                         ;;
1598                 *=*) echo "$1" | \
1599                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1600                 *) echo "$1='define'" >> optdef.sh;;
1601                 esac
1602                 shift
1603                 ;;
1604         -U)
1605                 shift
1606                 case "$1" in
1607                 *=) echo "$1" >> optdef.sh;;
1608                 *=*)
1609                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1610                         echo "$me: ignoring -U $1" >&2
1611                         ;;
1612                 *) echo "$1='undef'" >> optdef.sh;;
1613                 esac
1614                 shift
1615                 ;;
1616         -A)
1617             shift
1618             xxx=''
1619             yyy="$1"
1620             zzz=''
1621             uuu=undef
1622             case "$yyy" in
1623             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1624                  case "$zzz" in
1625                  *:*) zzz='' ;;
1626                  *)   xxx=append
1627                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1628                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1629                  esac
1630                  ;;
1631             esac
1632             case "$xxx" in
1633             '')  case "$yyy" in
1634                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1635                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1636                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1637                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1638                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1639                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1640                  esac
1641                  ;;
1642             esac
1643             case "$xxx" in
1644             append)
1645                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1646             clear)
1647                 echo "$yyy=''"                  >> posthint.sh ;;
1648             define)
1649                 case "$zzz" in
1650                 '') zzz=define ;;
1651                 esac
1652                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1653             eval)
1654                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1655             prepend)
1656                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1657             undef)
1658                 case "$zzz" in
1659                 '') zzz="$uuu" ;;
1660                 esac
1661                 echo "$yyy=$zzz"                >> posthint.sh ;;
1662             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1663             esac
1664             shift
1665             ;;
1666         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1667             exit 0;;
1668         --) break;;
1669         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1670         *) break;;
1671         esac
1672 done
1673
1674 case "$error" in
1675 true)
1676         cat >&2 <<EOM
1677 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1678                  [-U symbol] [-U symbol=] [-A command:symbol...]
1679   -d : use defaults for all answers.
1680   -e : go on without questioning past the production of config.sh.
1681   -f : specify an alternate default configuration file.
1682   -h : print this help message and exit (with an error status).
1683   -r : reuse C symbols value if possible (skips costly nm extraction).
1684   -s : silent mode, only echoes questions and essential information.
1685   -D : define symbol to have some value:
1686          -D symbol         symbol gets the value 'define'
1687          -D symbol=value   symbol gets the value 'value'
1688        common used examples (see INSTALL for more info):
1689          -Duse64bitint            use 64bit integers
1690          -Duse64bitall            use 64bit integers and pointers
1691          -Dusethreads             use thread support
1692          -Dinc_version_list=none  do not include older perl trees in @INC
1693          -DEBUGGING=none          DEBUGGING options
1694          -Dcc=gcc                 choose your compiler
1695          -Dprefix=/opt/perl5      choose your destination
1696   -E : stop at the end of questions, after having produced config.sh.
1697   -K : do not use unless you know what you are doing.
1698   -O : let -D and -U override definitions from loaded configuration file.
1699   -S : perform variable substitutions on all .SH files (can mix with -f)
1700   -U : undefine symbol:
1701          -U symbol    symbol gets the value 'undef'
1702          -U symbol=   symbol gets completely empty
1703        e.g.:  -Uversiononly
1704   -A : manipulate symbol after the platform specific hints have been applied:
1705          -A append:symbol=value   append value to symbol
1706          -A symbol=value          like append:, but with a separating space
1707          -A define:symbol=value   define symbol to have value
1708          -A clear:symbol          define symbol to be ''
1709          -A define:symbol         define symbol to be 'define'
1710          -A eval:symbol=value     define symbol to be eval of value
1711          -A prepend:symbol=value  prepend value to symbol
1712          -A undef:symbol          define symbol to be 'undef'
1713          -A undef:symbol=         define symbol to be ''
1714        e.g.:  -A prepend:libswanted='cl pthread '
1715               -A ccflags=-DSOME_MACRO
1716   -V : print version number and exit (with a zero status).
1717 EOM
1718         exit 1
1719         ;;
1720 esac
1721
1722 : Sanity checks
1723 case "$fastread$alldone" in
1724 yescont|yesexit) ;;
1725 *)
1726         case "$extractsh" in
1727         true) ;;
1728         *)
1729                 if test ! -t 0; then
1730                         echo "Say 'sh Configure', not 'sh <Configure'"
1731                         exit 1
1732                 fi
1733                 ;;
1734         esac
1735         ;;
1736 esac
1737
1738 exec 4>&1
1739 case "$silent" in
1740 true) exec 1>/dev/null;;
1741 esac
1742
1743 : run the defines and the undefines, if any, but leave the file out there...
1744 touch optdef.sh
1745 . ./optdef.sh
1746 : create the posthint manipulation script and leave the file out there...
1747 touch posthint.sh
1748
1749 : set package name
1750 package='perl5'
1751 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1752 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1753 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1754 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1755 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1756 esac
1757
1758 : Some greps do not return status, grrr.
1759 echo "grimblepritz" >grimble
1760 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1761         contains=contains
1762 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1763         contains=grep
1764 else
1765         contains=contains
1766 fi
1767 rm -f grimble
1768 : the following should work in any shell
1769 case "$contains" in
1770 contains*)
1771         echo " "
1772         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1773         cat >contains <<'EOSS'
1774 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1775 EOSS
1776 chmod +x contains
1777 esac
1778
1779 : Find the path to the source tree
1780 case "$src" in
1781 '') case "$0" in
1782     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1783          case "$src" in
1784          /*)    ;;
1785          .)     ;;
1786          *)     src=`cd ../$src && pwd` ;;
1787          esac
1788          ;;
1789     *)   src='.';;
1790     esac;;
1791 esac
1792 case "$src" in
1793 '')     src=/
1794         rsrc=/
1795         ;;
1796 /*)     rsrc="$src";;
1797 *)      rsrc="../$src";;
1798 esac
1799 if test -f $rsrc/Configure && \
1800         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1801 then
1802    : found it, so we are ok.
1803 else
1804         rsrc=''
1805         for src in . .. ../.. ../../.. ../../../..; do
1806                 if test -f ../$src/Configure && \
1807                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1808                 then
1809                         rsrc=../$src
1810                         break
1811                 fi
1812         done
1813 fi
1814 case "$rsrc" in
1815 '')
1816         cat <<EOM >&4
1817
1818 Sorry, I can't seem to locate the source dir for $package.  Please start
1819 Configure with an explicit path -- i.e. /some/path/Configure.
1820
1821 EOM
1822         exit 1
1823         ;;
1824 ../.)   rsrc='..';;
1825 *)
1826         echo " "
1827         echo "Sources for $package found in \"$src\"." >&4
1828         ;;
1829 esac
1830
1831 : script used to extract .SH files with variable substitutions
1832 cat >extract <<'EOS'
1833 PERL_CONFIG_SH=true
1834 echo "Doing variable substitutions on .SH files..."
1835 if test -f MANIFEST; then
1836         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1837 else
1838         echo "(Looking for .SH files under the source directory.)"
1839         set x `(cd "$src"; find . -name "*.SH" -print)`
1840 fi
1841 shift
1842 case $# in
1843 0) set x `(cd "$src"; echo *.SH)`; shift;;
1844 esac
1845 if test ! -f "$src/$1"; then
1846         shift
1847 fi
1848 mkdir_p='
1849 name=$1;
1850 create="";
1851 while test $name; do
1852         if test ! -d "$name"; then
1853                 create="$name $create";
1854                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1855                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1856         else
1857                 name="";
1858         fi;
1859 done;
1860 for file in $create; do
1861         mkdir $file;
1862 done
1863 '
1864 for file in $*; do
1865         case "$src" in
1866         ".")
1867                 case "$file" in
1868                 */*)
1869                         dir=`expr X$file : 'X\(.*\)/'`
1870                         file=`expr X$file : 'X.*/\(.*\)'`
1871                         (cd "$dir" && . ./$file)
1872                         ;;
1873                 *)
1874                         . ./$file
1875                         ;;
1876                 esac
1877                 ;;
1878         *)
1879                 case "$file" in
1880                 */*)
1881                         dir=`expr X$file : 'X\(.*\)/'`
1882                         file=`expr X$file : 'X.*/\(.*\)'`
1883                         (set x $dir; shift; eval $mkdir_p)
1884                         sh <"$src/$dir/$file"
1885                         ;;
1886                 *)
1887                         sh <"$src/$file"
1888                         ;;
1889                 esac
1890                 ;;
1891         esac
1892 done
1893 if test -f "$src/config_h.SH"; then
1894         if test ! -f config.h; then
1895         : oops, they left it out of MANIFEST, probably, so do it anyway.
1896         . "$src/config_h.SH"
1897         fi
1898 fi
1899 EOS
1900
1901 : extract files and exit if asked to do so
1902 case "$extractsh" in
1903 true)
1904         case "$realsilent" in
1905         true) ;;
1906         *) exec 1>&4;;
1907         esac
1908         case "$config_sh" in
1909         '') config_sh='config.sh';;
1910         esac
1911         echo " "
1912         echo "Fetching answers from $config_sh..."
1913         cd ..
1914         . $config_sh
1915         test "$override" && . ./optdef.sh
1916         echo " "
1917         . UU/extract
1918         rm -rf UU
1919         echo "Extraction done."
1920         exit 0
1921         ;;
1922 esac
1923
1924 : Eunice requires " " instead of "", can you believe it
1925 echo " "
1926 : Here we go...
1927 echo "Beginning of configuration questions for $package."
1928
1929 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1930
1931 : first determine how to suppress newline on echo command
1932 echo " "
1933 echo "Checking echo to see how to suppress newlines..."
1934 (echo "hi there\c" ; echo " ") >.echotmp
1935 if $contains c .echotmp >/dev/null 2>&1 ; then
1936         echo "...using -n."
1937         n='-n'
1938         c=''
1939 else
1940         cat <<'EOM'
1941 ...using \c
1942 EOM
1943         n=''
1944         c='\c'
1945 fi
1946 echo $n "The star should be here-->$c"
1947 echo '*'
1948 rm -f .echotmp
1949
1950 : Now test for existence of everything in MANIFEST
1951 echo " "
1952 if test -f "$rsrc/MANIFEST"; then
1953         echo "First let's make sure your kit is complete.  Checking..." >&4
1954         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1955                 (split -l 50 2>/dev/null || split -50)
1956         rm -f missing
1957         tmppwd=`pwd`
1958         for filelist in x??; do
1959                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1960                         >/dev/null 2>>"$tmppwd/missing")
1961         done
1962         if test -s missing; then
1963                 cat missing >&4
1964                 cat >&4 <<'EOM'
1965
1966 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1967
1968 You have the option of continuing the configuration process, despite the
1969 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1970 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1971 and contact the author (perlbug@perl.org).
1972
1973 EOM
1974                 echo $n "Continue? [n] $c" >&4
1975                 read ans
1976                 case "$ans" in
1977                 y*)
1978                         echo "Continuing..." >&4
1979                         rm -f missing
1980                         ;;
1981                 *)
1982                         echo "ABORTING..." >&4
1983                         kill $$
1984                         ;;
1985                 esac
1986         else
1987                 echo "Looks good..."
1988         fi
1989 else
1990         echo "There is no MANIFEST file.  I hope your kit is complete !"
1991 fi
1992 rm -f missing x??
1993
1994 : Find the appropriate value for a newline for tr
1995 echo " "
1996 if test -n "$DJGPP"; then
1997        trnl='\012'
1998 fi
1999 if test X"$trnl" = X; then
2000         case "`echo foo|tr '\n' x 2>/dev/null`" in
2001         foox) trnl='\n' ;;
2002         esac
2003 fi
2004 if test X"$trnl" = X; then
2005         case "`echo foo|tr '\012' x 2>/dev/null`" in
2006         foox) trnl='\012' ;;
2007         esac
2008 fi
2009 if test X"$trnl" = X; then
2010        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2011        fooxy) trnl='\n\r' ;;
2012        esac
2013 fi
2014 if test X"$trnl" = X; then
2015         cat <<EOM >&2
2016
2017 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2018
2019 EOM
2020         exit 1
2021 fi
2022
2023 : compute the number of columns on the terminal for proper question formatting
2024 case "$COLUMNS" in
2025 '') COLUMNS='80';;
2026 esac
2027
2028 : set up the echo used in my read
2029 myecho="case \"\$xxxm\" in
2030 '') echo $n \"\$rp $c\" >&4;;
2031 *) case \"\$rp\" in
2032         '') echo $n \"[\$xxxm] $c\";;
2033         *)
2034                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2035                         echo \"\$rp\" >&4
2036                         echo $n \"[\$xxxm] $c\" >&4
2037                 else
2038                         echo $n \"\$rp [\$xxxm] $c\" >&4
2039                 fi
2040                 ;;
2041         esac;;
2042 esac"
2043
2044 : now set up to do reads with possible shell escape and default assignment
2045 cat <<EOSC >myread
2046 $startsh
2047 xxxm=\$dflt
2048 $myecho
2049 ans='!'
2050 case "\$fastread" in
2051 yes) case "\$dflt" in
2052         '') ;;
2053         *) ans='';
2054                 case "\$silent-\$rp" in
2055                 true-) ;;
2056                 *) echo " " >&4;;
2057                 esac;;
2058         esac;;
2059 *) case "\$silent" in
2060         true) case "\$rp" in
2061                 '') ans='';;
2062                 esac;;
2063         esac;;
2064 esac
2065 while expr "X\$ans" : "X!" >/dev/null; do
2066         read answ
2067         set x \$xxxm
2068         shift
2069         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2070         case  "\$answ" in
2071         "!")
2072                 sh 1>&4
2073                 echo " "
2074                 $myecho
2075                 ;;
2076         !*)
2077                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2078                 shift
2079                 sh 1>&4 -c "\$*"
2080                 echo " "
2081                 $myecho
2082                 ;;
2083         "\$ans")
2084                 case "\$ans" in
2085                 \\&*)
2086                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2087                         shift
2088                         case "\$1" in
2089                         -d)
2090                                 fastread=yes
2091                                 echo "(OK, I'll run with -d after this question.)" >&4
2092                                 ;;
2093                         -*)
2094                                 echo "*** Sorry, \$1 not supported yet." >&4
2095                                 ;;
2096                         esac
2097                         $myecho
2098                         ans=!
2099                         ;;
2100                 esac;;
2101         *)
2102                 case "\$aok" in
2103                 y)
2104                         echo "*** Substitution done -- please confirm."
2105                         xxxm="\$ans"
2106                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2107                         xxxm="\$ans"
2108                         ans=!
2109                         ;;
2110                 *)
2111                         echo "*** Error -- try again."
2112                         ans=!
2113                         ;;
2114                 esac
2115                 $myecho
2116                 ;;
2117         esac
2118         case "\$ans\$xxxm\$nostick" in
2119         '')
2120                 ans=!
2121                 $myecho
2122                 ;;
2123         esac
2124 done
2125 case "\$ans" in
2126 '') ans="\$xxxm";;
2127 esac
2128 EOSC
2129
2130 : create .config dir to save info across Configure sessions
2131 test -d ../.config || mkdir ../.config
2132 cat >../.config/README <<EOF
2133 This directory created by Configure to save information that should
2134 persist across sessions for $package.
2135
2136 You may safely delete it if you wish.
2137 EOF
2138
2139 : See if we are using a devel version and want that
2140 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2141 case "$usedevel" in
2142 $define|true|[yY]*) ;;
2143 *) case "$xversion" in
2144    *[13579])
2145         cat >&4 <<EOH
2146 *** WHOA THERE!!! ***
2147
2148     This is an UNSTABLE DEVELOPMENT release.
2149     The version of this $package distribution is $xversion, that is, odd,
2150     (as opposed to even) and that signifies a development release.
2151     If you want a maintenance release, you want an even-numbered version.
2152
2153     Do ***NOT*** install this into production use.
2154     Data corruption and crashes are possible.
2155
2156     It is most seriously suggested that you do not continue any further
2157     unless you want to help in developing and debugging Perl.
2158
2159     If you *still* want to build perl, you can answer 'y' now,
2160     or pass -Dusedevel to Configure.
2161
2162 EOH
2163         rp='Do you really want to continue?'
2164         dflt='n'
2165         . ./myread
2166         case "$ans" in
2167         [yY]) echo >&4 "Okay, continuing."
2168               usedevel="$define" ;;
2169         *) echo >&4 "Okay, bye."
2170            exit 1
2171            ;;
2172         esac
2173         ;;
2174     esac
2175     ;;
2176 esac
2177 case "$usedevel" in
2178 $define|true|[yY]*)
2179         case "$versiononly" in
2180         '') versiononly="$define" ;;
2181         esac
2182         case "$installusrbinperl" in
2183         '') installusrbinperl="$undef" ;;
2184         esac
2185         ;;
2186 esac
2187
2188 : general instructions
2189 needman=true
2190 firsttime=true
2191 user=`(logname) 2>/dev/null`
2192 case "$user" in
2193 '') user=`whoami 2>&1`;;
2194 esac
2195 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2196         firsttime=false
2197         echo " "
2198         rp='Would you like to see the instructions?'
2199         dflt=n
2200         . ./myread
2201         case "$ans" in
2202         [yY]*) ;;
2203         *) needman=false;;
2204         esac
2205 fi
2206 if $needman; then
2207         cat <<EOH
2208
2209 This installation shell script will examine your system and ask you questions
2210 to determine how the perl5 package should be installed. If you get
2211 stuck on a question, you may use a ! shell escape to start a subshell or
2212 execute a command.  Many of the questions will have default answers in square
2213 brackets; typing carriage return will give you the default.
2214
2215 On some of the questions which ask for file or directory names you are allowed
2216 to use the ~name construct to specify the login directory belonging to "name",
2217 even if you don't have a shell which knows about that.  Questions where this is
2218 allowed will be marked "(~name ok)".
2219
2220 EOH
2221         rp=''
2222         dflt='Type carriage return to continue'
2223         . ./myread
2224         cat <<'EOH'
2225
2226 The prompter used in this script allows you to use shell variables and
2227 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2228 in the default answer, as if the default line was a set of arguments given to a
2229 script shell.  This means you may also use $* to repeat the whole default line,
2230 so you do not have to re-type everything to add something to the default.
2231
2232 Everytime there is a substitution, you will have to confirm.  If there is an
2233 error (e.g. an unmatched backtick), the default answer will remain unchanged
2234 and you will be prompted again.
2235
2236 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2237 the questions and use the computed defaults (or the previous answers if there
2238 was already a config.sh file). Type 'Configure -h' for a list of options.
2239 You may also start interactively and then answer '& -d' at any prompt to turn
2240 on the non-interactive behaviour for the remainder of the execution.
2241
2242 EOH
2243         . ./myread
2244         cat <<EOH
2245
2246 Much effort has been expended to ensure that this shell script will run on any
2247 Unix system.  If despite that it blows up on yours, your best bet is to edit
2248 Configure and run it again.  If you can't run Configure for some reason,
2249 you'll have to generate a config.sh file by hand.  Whatever problems you
2250 have, let me (perlbug@perl.org) know how I blew it.
2251
2252 This installation script affects things in two ways:
2253
2254 1) it may do direct variable substitutions on some of the files included
2255    in this kit.
2256 2) it builds a config.h file for inclusion in C programs.  You may edit
2257    any of these files as the need arises after running this script.
2258
2259 If you make a mistake on a question, there is no easy way to back up to it
2260 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2261 files.  Configure will offer to let you do this before it runs the SH files.
2262
2263 EOH
2264         dflt='Type carriage return to continue'
2265         . ./myread
2266         case "$firsttime" in
2267         true) echo $user >>../.config/instruct;;
2268         esac
2269 fi
2270
2271 : find out where common programs are
2272 echo " "
2273 echo "Locating common programs..." >&4
2274 cat <<EOSC >loc
2275 $startsh
2276 case \$# in
2277 0) exit 1;;
2278 esac
2279 thing=\$1
2280 shift
2281 dflt=\$1
2282 shift
2283 for dir in \$*; do
2284         case "\$thing" in
2285         .)
2286         if test -d \$dir/\$thing; then
2287                 echo \$dir
2288                 exit 0
2289         fi
2290         ;;
2291         *)
2292         for thisthing in \$dir/\$thing; do
2293                 : just loop through to pick last item
2294         done
2295         if test -f \$thisthing; then
2296                 echo \$thisthing
2297                 exit 0
2298         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2299                 echo \$thisthing
2300                 exit 0
2301         elif test -f \$dir/\$thing.exe; then
2302                 if test -n "$DJGPP"; then
2303                         echo \$dir/\$thing.exe
2304                 elif test "$eunicefix" != ":"; then
2305                         : on Eunice apparently
2306                         echo \$dir/\$thing
2307                 fi
2308                 exit 0
2309         fi
2310         ;;
2311         esac
2312 done
2313 echo \$dflt
2314 exit 1
2315 EOSC
2316 chmod +x loc
2317 $eunicefix loc
2318 loclist="
2319 awk
2320 cat
2321 chmod
2322 comm
2323 cp
2324 echo
2325 expr
2326 grep
2327 ls
2328 mkdir
2329 rm
2330 sed
2331 sort
2332 touch
2333 tr
2334 uniq
2335 "
2336 trylist="
2337 ar
2338 bison
2339 byacc
2340 cpp
2341 csh
2342 date
2343 egrep
2344 gmake
2345 gzip
2346 less
2347 ln
2348 make
2349 more
2350 nm
2351 nroff
2352 pg
2353 test
2354 uname
2355 zip
2356 "
2357 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2358 pth="$pth /lib /usr/lib"
2359 for file in $loclist; do
2360         eval xxx=\$$file
2361         case "$xxx" in
2362         /*|?:[\\/]*)
2363                 if test -f "$xxx"; then
2364                         : ok
2365                 else
2366                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2367                         xxx=`./loc $file $file $pth`
2368                 fi
2369                 ;;
2370         '') xxx=`./loc $file $file $pth`;;
2371         *) xxx=`./loc $xxx $xxx $pth`;;
2372         esac
2373         eval $file=$xxx$_exe
2374         eval _$file=$xxx
2375         case "$xxx" in
2376         /*)
2377                 echo $file is in $xxx.
2378                 ;;
2379         ?:[\\/]*)
2380                 echo $file is in $xxx.
2381                 ;;
2382         *)
2383                 echo "I don't know where '$file' is, and my life depends on it." >&4
2384                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2385                 exit 1
2386                 ;;
2387         esac
2388 done
2389 echo " "
2390 echo "Don't worry if any of the following aren't found..."
2391 say=offhand
2392 for file in $trylist; do
2393         eval xxx=\$$file
2394         case "$xxx" in
2395         /*|?:[\\/]*)
2396                 if test -f "$xxx"; then
2397                         : ok
2398                 else
2399                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2400                         xxx=`./loc $file $file $pth`
2401                 fi
2402                 ;;
2403         '') xxx=`./loc $file $file $pth`;;
2404         *) xxx=`./loc $xxx $xxx $pth`;;
2405         esac
2406         eval $file=$xxx$_exe
2407         eval _$file=$xxx
2408         case "$xxx" in
2409         /*)
2410                 echo $file is in $xxx.
2411                 ;;
2412         ?:[\\/]*)
2413                 echo $file is in $xxx.
2414                 ;;
2415         *)
2416                 echo "I don't see $file out there, $say."
2417                 say=either
2418                 ;;
2419         esac
2420 done
2421 case "$egrep" in
2422 egrep)
2423         echo "Substituting grep for egrep."
2424         egrep=$grep
2425         _egrep=$grep
2426         ;;
2427 esac
2428 case "$ln" in
2429 ln)
2430         echo "Substituting cp for ln."
2431         ln=$cp
2432         _ln=$cp
2433         ;;
2434 esac
2435 case "$make" in
2436 make)
2437         case "$gmake" in
2438         gmake)
2439         echo "I can't find make or gmake, and my life depends on it." >&4
2440         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2441         exit 1
2442         ;;
2443         esac
2444         ;;
2445 esac
2446 case "$gmake" in
2447 gmake)  ;;
2448 *)      # We can't have osname yet.
2449         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2450                 # Assume that gmake, if found, is definitely GNU make
2451                 # and prefer it over the system make.
2452                 echo "Substituting gmake for make."
2453                 make=$gmake
2454                 _make=$gmake
2455         fi
2456         ;;
2457 esac
2458 case "$test" in
2459 test)
2460         echo "Hopefully test is built into your sh."
2461         ;;
2462 *)
2463         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2464                 echo "Using the test built into your sh."
2465                 test=test
2466                 _test=test
2467         fi
2468         ;;
2469 esac
2470 case "$echo" in
2471 echo)
2472         echo "Hopefully echo is built into your sh."
2473         ;;
2474 '') ;;
2475 *)
2476         echo " "
2477 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2478         $echo $n "hi there$c" >foo1
2479         echo $n "hi there$c" >foo2
2480         if cmp foo1 foo2 >/dev/null 2>&1; then
2481                 echo "They are compatible.  In fact, they may be identical."
2482         else
2483                 case "$n" in
2484                 '-n') n='' c='\c';;
2485                 *) n='-n' c='';;
2486                 esac
2487                 cat <<FOO
2488 They are not compatible!  You are probably running ksh on a non-USG system.
2489 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2490 have echo built in and we may have to run some Bourne shell scripts.  That
2491 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2492
2493 FOO
2494                 $echo $n "The star should be here-->$c"
2495                 $echo "*"
2496         fi
2497         $rm -f foo1 foo2
2498         ;;
2499 esac
2500
2501 # This question was auctioned at YAPC::Europe-2007 in Vienna
2502 # I never promised you could answer it. I only auctioned the question.
2503 cat <<FOO
2504 The following message is sponsored by
2505
2506   Dresden.pm<--The stars should be here.
2507
2508 Dear Perl user, system administrator or package
2509 maintainer, the Perl community sends greetings to
2510 you. Do you (emblematical) greet back [Y/n]? n
2511
2512 FOO
2513
2514 : Check what type of C compiler we use
2515 cat <<EOS >trygcc
2516 $startsh
2517 EOS
2518 cat <<'EOSC' >>trygcc
2519 case "$cc" in
2520 '') ;;
2521 *)  $rm -f try try.*
2522     $cat >try.c <<EOM
2523 int main(int argc, char *argv[]) {
2524   return 0;
2525 }
2526 EOM
2527     if $cc -o try $ccflags $ldflags try.c; then
2528        :
2529     else
2530         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2531         despair=yes
2532         trygcc=yes
2533         case "$cc" in
2534         *gcc*) trygcc=no ;;
2535         esac
2536         # Skip this test because it gives a false match on output like:
2537         #    ./trygcc: line 23: cc: command not found
2538         # case "`$cc -v -c try.c 2>&1`" in
2539         # *gcc*) trygcc=no ;;
2540         # esac
2541         if $test X"$trygcc" = Xyes; then
2542             if gcc -o try -c try.c; then
2543                 echo " "
2544                 echo "You seem to have a working gcc, though." >&4
2545                 # Switching compilers may undo the work of hints files.
2546                 # The most common problem is -D_REENTRANT for threads.
2547                 # This heuristic catches that case, but gets false positives
2548                 # if -Dusethreads was not actually specified.  Better to
2549                 # bail out here with a useful message than fail 
2550                 # mysteriously later. Should we perhaps just try to
2551                 # re-invoke Configure -Dcc=gcc config_args ?
2552                 if $test -f usethreads.cbu; then
2553                         $cat >&4 <<EOM 
2554
2555 *** However, any setting of the C compiler flags (e.g. for thread support)
2556 *** will be lost.  It may be necessary for you to restart Configure and
2557 *** add -Dcc=gcc to your Configure command line.
2558
2559 EOM
2560                         rp="Would you like to go ahead and try gcc anyway?"
2561                         dflt=n
2562                 else
2563                         rp="Would you like to use it?"
2564                         dflt=y
2565                 fi
2566                 if $test -f myread; then
2567                     . ./myread
2568                 else
2569                     if $test -f UU/myread; then
2570                         . ./UU/myread
2571                     else
2572                         echo "Cannot find myread, sorry.  Aborting." >&2
2573                         exit 1
2574                     fi
2575                 fi  
2576                 case "$ans" in
2577                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2578                 esac
2579             fi
2580         fi
2581     fi
2582     $rm -f try try.*
2583     ;;
2584 esac
2585 EOSC
2586
2587 cat <<EOS >checkcc
2588 $startsh
2589 EOS
2590 cat <<'EOSC' >>checkcc
2591 case "$cc" in        
2592 '') ;;
2593 *)  $rm -f try try.*              
2594     $cat >try.c <<EOM
2595 int main(int argc, char *argv[]) {
2596   return 0;
2597 }
2598 EOM
2599     if $cc -o try $ccflags $ldflags try.c; then
2600        :
2601     else
2602         if $test X"$despair" = Xyes; then
2603            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2604         fi
2605         $cat >&4 <<EOM         
2606 You need to find a working C compiler.
2607 Either (purchase and) install the C compiler supplied by your OS vendor,
2608 or for a free C compiler try http://gcc.gnu.org/
2609 I cannot continue any further, aborting.
2610 EOM
2611         exit 1
2612     fi
2613     $rm -f try try.*
2614     ;;
2615 esac
2616 EOSC
2617
2618 : determine whether symbolic links are supported
2619 echo " "
2620 $touch blurfl
2621 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2622         echo "Symbolic links are supported." >&4
2623         lns="$ln -s"
2624 else
2625         echo "Symbolic links are NOT supported." >&4
2626         lns="$ln"
2627 fi
2628 $rm -f blurfl sym
2629
2630 : determine whether symbolic links are supported
2631 echo " "
2632 case "$lns" in
2633 *"ln"*" -s")
2634         echo "Checking how to test for symbolic links..." >&4
2635         $lns blurfl sym
2636         if $test "X$issymlink" = X; then
2637                 case "$newsh" in
2638                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2639                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2640                 esac
2641                 if test $? = 0; then
2642                         issymlink="test -h"
2643                 else
2644                         echo "Your builtin 'test -h' may be broken." >&4
2645                         case "$test" in
2646                         /*)     ;;
2647                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2648                                 for p in $pth
2649                                 do
2650                                         if test -f "$p/$test"; then
2651                                                 test="$p/$test"
2652                                                 break
2653                                         fi
2654                                 done
2655                                 ;;
2656                         esac
2657                         case "$test" in
2658                         /*)
2659                                 echo "Trying external '$test -h'." >&4
2660                                 issymlink="$test -h"
2661                                 if $test ! -h sym >/dev/null 2>&1; then
2662                                         echo "External '$test -h' is broken, too." >&4
2663                                         issymlink=''
2664                                 fi
2665                                 ;;
2666                         *)      issymlink='' ;;
2667                         esac
2668                 fi              
2669         fi
2670         if $test "X$issymlink" = X; then
2671                 if $test -L sym 2>/dev/null; then
2672                         issymlink="$test -L"
2673                         echo "The builtin '$test -L' worked." >&4
2674                 fi
2675         fi
2676         if $test "X$issymlink" != X; then
2677                 echo "You can test for symbolic links with '$issymlink'." >&4
2678         else
2679                 echo "I do not know how you can test for symbolic links." >&4
2680         fi
2681         $rm -f blurfl sym
2682         ;;
2683 *)      echo "No symbolic links, so not testing for their testing..." >&4
2684         ;;
2685 esac
2686 echo " "
2687
2688 : Make symlinks util
2689 case "$mksymlinks" in
2690 $define|true|[yY]*)
2691         case "$src" in
2692         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2693                 exit 1
2694                 ;;
2695         *)      case "$lns:$issymlink" in
2696                 *"ln"*" -s:"*"test -"?)
2697                         echo "Creating the symbolic links..." >&4
2698                         echo "(First creating the subdirectories...)" >&4
2699                         cd ..
2700                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2701                                 read directory
2702                                 test -z "$directory" && break
2703                                 mkdir -p $directory
2704                         done
2705                         # Sanity check 1.
2706                         if test ! -d t/base; then
2707                                 echo "Failed to create the subdirectories.  Aborting." >&4
2708                                 exit 1
2709                         fi
2710                         echo "(Then creating the symlinks...)" >&4
2711                         awk '{print $1}' $src/MANIFEST | while true; do
2712                                 read filename
2713                                 test -z "$filename" && break
2714                                 if test -f $filename; then
2715                                         if $issymlink $filename; then
2716                                                 rm -f $filename
2717                                         fi
2718                                 fi
2719                                 if test -f $filename; then
2720                                         echo "$filename already exists, not symlinking."
2721                                 else
2722                                         ln -s $src/$filename $filename
2723                                 fi
2724                         done
2725                         # Sanity check 2.
2726                         if test ! -f t/base/lex.t; then
2727                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2728                                 exit 1
2729                         fi
2730                         cd UU
2731                         ;;
2732                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2733                         ;;
2734                 esac
2735                 ;;
2736         esac
2737         ;;
2738 esac
2739
2740 : Check for Cross-Compilation
2741 case "$usecrosscompile" in
2742 $define|true|[yY]*)
2743         $echo "Cross-compiling..."
2744         croak=''
2745         case "$cc" in
2746         *-*-gcc) # A cross-compiling gcc, probably.
2747             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2748             ar=$targetarch-ar
2749             # leave out ld, choosing it is more complex
2750             nm=$targetarch-nm
2751             ranlib=$targetarch-ranlib
2752             $echo 'extern int foo;' > try.c
2753             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2754             shift
2755             if $test $# -gt 0; then
2756                 incpth="$incpth $*"
2757                 incpth="`$echo $incpth|$sed 's/^ //'`"
2758                 echo "Guessing incpth '$incpth'." >&4
2759                 for i in $*; do
2760                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2761                     if $test -d $j; then
2762                         libpth="$libpth $j"
2763                     fi
2764                 done   
2765                 libpth="`$echo $libpth|$sed 's/^ //'`"
2766                 echo "Guessing libpth '$libpth'." >&4
2767             fi
2768             $rm -f try.c
2769             ;;
2770         esac
2771         case "$targetarch" in
2772         '') echo "Targetarch not defined." >&4; croak=y ;;
2773         *)  echo "Using targetarch $targetarch." >&4 ;;
2774         esac
2775         case "$incpth" in
2776         '') echo "Incpth not defined." >&4; croak=y ;;
2777         *)  echo "Using incpth '$incpth'." >&4 ;;
2778         esac
2779         case "$libpth" in
2780         '') echo "Libpth not defined." >&4; croak=y ;;
2781         *)  echo "Using libpth '$libpth'." >&4 ;;
2782         esac
2783         case "$usrinc" in
2784         '') for i in $incpth; do
2785                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2786                     usrinc=$i
2787                     echo "Guessing usrinc $usrinc." >&4
2788                     break
2789                 fi
2790             done
2791             case "$usrinc" in
2792             '') echo "Usrinc not defined." >&4; croak=y ;;
2793             esac
2794             ;;
2795         *)  echo "Using usrinc $usrinc." >&4 ;;
2796         esac
2797         case "$targethost" in
2798         '') echo "Targethost not defined." >&4; croak=y ;;
2799         *)  echo "Using targethost $targethost." >&4
2800         esac
2801         locincpth=' '
2802         loclibpth=' '
2803         case "$croak" in
2804         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2805         esac
2806         case "$src" in
2807         /*) run=$src/Cross/run
2808             targetmkdir=$src/Cross/mkdir
2809             to=$src/Cross/to
2810             from=$src/Cross/from
2811             ;;
2812         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2813             run=$pwd/Cross/run
2814             targetmkdir=$pwd/Cross/mkdir
2815             to=$pwd/Cross/to
2816             from=$pwd/Cross/from
2817             ;;
2818         esac
2819         case "$targetrun" in
2820         '') targetrun=ssh ;;
2821         esac
2822         case "$targetto" in
2823         '') targetto=scp ;;
2824         esac
2825         case "$targetfrom" in
2826         '') targetfrom=scp ;;
2827         esac
2828         run=$run-$targetrun
2829         to=$to-$targetto
2830         from=$from-$targetfrom
2831         case "$targetdir" in
2832         '')  targetdir=/tmp
2833              echo "Guessing targetdir $targetdir." >&4
2834              ;;
2835         esac
2836         case "$targetuser" in
2837         '')  targetuser=root
2838              echo "Guessing targetuser $targetuser." >&4
2839              ;;
2840         esac
2841         case "$targetfrom" in
2842         scp)    q=-q ;;
2843         *)      q='' ;;
2844         esac
2845         case "$targetrun" in
2846         ssh|rsh)
2847             cat >$run <<EOF
2848 #!/bin/sh
2849 case "\$1" in
2850 -cwd)
2851   shift
2852   cwd=\$1
2853   shift
2854   ;;
2855 esac
2856 case "\$cwd" in
2857 '') cwd=$targetdir ;;
2858 esac
2859 exe=\$1
2860 shift
2861 if $test ! -f \$exe.xok; then
2862   $to \$exe
2863   $touch \$exe.xok
2864 fi
2865 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2866 EOF
2867             ;;
2868         *)  echo "Unknown targetrun '$targetrun'" >&4
2869             exit 1
2870             ;;
2871         esac
2872         case "$targetmkdir" in
2873         */Cross/mkdir)
2874             cat >$targetmkdir <<EOF
2875 #!/bin/sh
2876 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2877 EOF
2878             $chmod a+rx $targetmkdir
2879             ;;
2880         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2881             exit 1
2882             ;;
2883         esac
2884         case "$targetto" in
2885         scp|rcp)
2886             cat >$to <<EOF
2887 #!/bin/sh
2888 for f in \$@
2889 do
2890   case "\$f" in
2891   /*)
2892     $targetmkdir \`dirname \$f\`
2893     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2894     ;;
2895   *)
2896     $targetmkdir $targetdir/\`dirname \$f\`
2897     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2898     ;;
2899   esac
2900 done
2901 exit 0
2902 EOF
2903             ;;
2904         cp) cat >$to <<EOF
2905 #!/bin/sh
2906 for f in \$@
2907 do
2908   case "\$f" in
2909   /*)
2910     $mkdir -p $targetdir/\`dirname \$f\`
2911     $cp \$f $targetdir/\$f || exit 1
2912     ;;
2913   *)
2914     $targetmkdir $targetdir/\`dirname \$f\`
2915     $cp \$f $targetdir/\$f || exit 1
2916     ;;
2917   esac
2918 done
2919 exit 0
2920 EOF
2921             ;;
2922         *)  echo "Unknown targetto '$targetto'" >&4
2923             exit 1
2924             ;;
2925         esac
2926         case "$targetfrom" in
2927         scp|rcp)
2928           cat >$from <<EOF
2929 #!/bin/sh
2930 for f in \$@
2931 do
2932   $rm -f \$f
2933   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2934 done
2935 exit 0
2936 EOF
2937             ;;
2938         cp) cat >$from <<EOF
2939 #!/bin/sh
2940 for f in \$@
2941 do
2942   $rm -f \$f
2943   cp $targetdir/\$f . || exit 1
2944 done
2945 exit 0
2946 EOF
2947             ;;
2948         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2949             exit 1
2950             ;;
2951         esac
2952         if $test ! -f $run; then
2953             echo "Target 'run' script '$run' not found." >&4
2954         else
2955             $chmod a+rx $run
2956         fi
2957         if $test ! -f $to; then
2958             echo "Target 'to' script '$to' not found." >&4
2959         else
2960             $chmod a+rx $to
2961         fi
2962         if $test ! -f $from; then
2963             echo "Target 'from' script '$from' not found." >&4
2964         else
2965             $chmod a+rx $from
2966         fi
2967         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2968             exit 1
2969         fi
2970         cat >&4 <<EOF
2971 Using '$run' for remote execution,
2972 and '$from' and '$to'
2973 for remote file transfer.
2974 EOF
2975         ;;
2976 *)      run=''
2977         to=:
2978         from=:
2979         usecrosscompile='undef'
2980         targetarch=''
2981         ;;
2982 esac
2983
2984 : see whether [:lower:] and [:upper:] are supported character classes
2985 echo " "
2986 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2987 ABYZ)
2988         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2989         up='[:upper:]'
2990         low='[:lower:]'
2991         ;;
2992 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2993         # (0xd9 and 0xe2), therefore that is a nice testing point.
2994         if test "X$up" = X -o "X$low" = X; then
2995             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2996             rs) up='[A-Z]'
2997                 low='[a-z]'
2998                 ;;
2999             esac
3000         fi
3001         if test "X$up" = X -o "X$low" = X; then
3002             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3003             rs) up='A-Z'
3004                 low='a-z'
3005                 ;;
3006             esac
3007         fi
3008         if test "X$up" = X -o "X$low" = X; then
3009             case "`echo RS | od -x 2>/dev/null`" in
3010             *D9E2*|*d9e2*)
3011                 echo "Hey, this might be EBCDIC." >&4
3012                 if test "X$up" = X -o "X$low" = X; then
3013                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3014                     rs) up='[A-IJ-RS-Z]'
3015                         low='[a-ij-rs-z]'
3016                         ;;
3017                     esac
3018                 fi
3019                 if test "X$up" = X -o "X$low" = X; then
3020                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3021                     rs) up='A-IJ-RS-Z'
3022                         low='a-ij-rs-z'
3023                         ;;
3024                     esac
3025                 fi
3026                 ;;
3027             esac
3028         fi
3029 esac
3030 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3031 rs)
3032     echo "Using $up and $low to convert case." >&4
3033     ;;
3034 *)
3035     echo "I don't know how to translate letters from upper to lower case." >&4
3036     echo "Your tr is not acting any way I know of." >&4
3037     exit 1
3038     ;;
3039 esac
3040 : set up the translation script tr, must be called with ./tr of course
3041 cat >tr <<EOSC
3042 $startsh
3043 case "\$1\$2" in
3044 '[A-Z][a-z]') exec $tr '$up' '$low';;
3045 '[a-z][A-Z]') exec $tr '$low' '$up';;
3046 esac
3047 exec $tr "\$@"
3048 EOSC
3049 chmod +x tr
3050 $eunicefix tr
3051
3052 : Try to determine whether config.sh was made on this system
3053 case "$config_sh" in
3054 '')
3055 myuname=`$uname -a 2>/dev/null`
3056 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3057 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3058 # because the A-Z/a-z are not consecutive.
3059 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3060         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3061 newmyuname="$myuname"
3062 dflt=n
3063 case "$knowitall" in
3064 '')
3065         if test -f ../config.sh; then
3066                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3067                         eval "`grep myuname= ../config.sh`"
3068                 fi
3069                 if test "X$myuname" = "X$newmyuname"; then
3070                         dflt=y
3071                 fi
3072         fi
3073         ;;
3074 *) dflt=y;;
3075 esac
3076
3077 : Get old answers from old config file if Configure was run on the
3078 : same system, otherwise use the hints.
3079 hint=default
3080 cd ..
3081 if test -f config.sh; then
3082         echo " "
3083         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3084         . UU/myread
3085         case "$ans" in
3086         n*|N*) echo "OK, I'll ignore it."
3087                 mv config.sh config.sh.old
3088                 myuname="$newmyuname"
3089                 ;;
3090         *)  echo "Fetching default answers from your old config.sh file..." >&4
3091                 tmp_n="$n"
3092                 tmp_c="$c"
3093                 tmp_sh="$sh"
3094                 . ./config.sh
3095                 cp config.sh UU
3096                 n="$tmp_n"
3097                 c="$tmp_c"
3098                 : Older versions did not always set $sh.  Catch re-use of such
3099                 : an old config.sh.
3100                 case "$sh" in
3101                 '') sh="$tmp_sh" ;;
3102                 esac
3103                 hint=previous
3104                 ;;
3105         esac
3106 fi
3107 . ./UU/checkcc
3108 if test ! -f config.sh; then
3109         $cat <<EOM
3110
3111 First time through, eh?  I have some defaults handy for some systems
3112 that need some extra help getting the Configure answers right:
3113
3114 EOM
3115         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3116         dflt=''
3117         : Half the following guesses are probably wrong... If you have better
3118         : tests or hints, please send them to perlbug@perl.org
3119         : The metaconfig authors would also appreciate a copy...
3120         $test -f /irix && osname=irix
3121         $test -f /xenix && osname=sco_xenix
3122         $test -f /dynix && osname=dynix
3123         $test -f /dnix && osname=dnix
3124         $test -f /lynx.os && osname=lynxos
3125         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3126         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3127         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3128         $test -f /bin/mips && /bin/mips && osname=mips
3129         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3130                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3131         $test -d /usr/apollo/bin && osname=apollo
3132         $test -f /etc/saf/_sactab && osname=svr4
3133         $test -d /usr/include/minix && osname=minix
3134         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3135         if $test -d /MachTen -o -d /MachTen_Folder; then
3136                 osname=machten
3137                 if $test -x /sbin/version; then
3138                         osvers=`/sbin/version | $awk '{print $2}' |
3139                         $sed -e 's/[A-Za-z]$//'`
3140                 elif $test -x /usr/etc/version; then
3141                         osvers=`/usr/etc/version | $awk '{print $2}' |
3142                         $sed -e 's/[A-Za-z]$//'`
3143                 else
3144                         osvers="$2.$3"
3145                 fi
3146         fi
3147
3148         $test -f /sys/posix.dll &&
3149                 $test -f /usr/bin/what &&
3150                 set X `/usr/bin/what /sys/posix.dll` &&
3151                 $test "$3" = UWIN &&
3152                 osname=uwin &&
3153                 osvers="$5"
3154
3155         if $test -f $uname; then
3156                 set X $myuname
3157                 shift
3158
3159                 case "$5" in
3160                 fps*) osname=fps ;;
3161                 mips*)
3162                         case "$4" in
3163                         umips) osname=umips ;;
3164                         *) osname=mips ;;
3165                         esac;;
3166                 [23]100) osname=mips ;;
3167                 next*) osname=next ;;
3168                 i386*)
3169                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3170                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3171                                 osname='sco'
3172                                 osvers=$tmp
3173                         elif $test -f /etc/kconfig; then
3174                                 osname=isc
3175                                 if test "$lns" = "$ln -s"; then
3176                                         osvers=4
3177                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3178                                         osvers=3
3179                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3180                                         osvers=2
3181                                 fi
3182                         fi
3183                         tmp=''
3184                         ;;
3185                 pc*)
3186                         if test -n "$DJGPP"; then
3187                                 osname=dos
3188                                 osvers=djgpp
3189                         fi
3190                         ;;
3191                 esac
3192
3193                 case "$1" in
3194                 aix) osname=aix
3195                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3196                         case "$tmp" in
3197                         # oslevel can fail with:
3198                         # oslevel: Unable to acquire lock.
3199                         *not\ found) osvers="$4"."$3" ;;
3200                         '<3240'|'<>3240') osvers=3.2.0 ;;
3201                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3202                         '=3250'|'>3250') osvers=3.2.5 ;;
3203                         *) osvers=$tmp;;
3204                         esac
3205                         ;;
3206                 bsd386) osname=bsd386
3207                         osvers=`$uname -r`
3208                         ;;
3209                 cygwin*) osname=cygwin
3210                         osvers="$3"
3211                         ;;
3212                 *dc.osx) osname=dcosx
3213                         osvers="$3"
3214                         ;;
3215                 dnix) osname=dnix
3216                         osvers="$3"
3217                         ;;
3218                 domainos) osname=apollo
3219                         osvers="$3"
3220                         ;;
3221                 dgux)   osname=dgux
3222                         osvers="$3"
3223                         ;;
3224                 dragonfly) osname=dragonfly
3225                         osvers="$3"
3226                         ;;
3227                 dynixptx*) osname=dynixptx
3228                         osvers=`echo "$4"|sed 's/^v//'`
3229                         ;;
3230                 freebsd) osname=freebsd
3231                         osvers="$3" ;;
3232                 genix)  osname=genix ;;
3233                 gnu)    osname=gnu
3234                         osvers="$3" ;;
3235                 hp*)    osname=hpux
3236                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3237                         ;;
3238                 irix*)  osname=irix
3239                         case "$3" in
3240                         4*) osvers=4 ;;
3241                         5*) osvers=5 ;;
3242                         *)      osvers="$3" ;;
3243                         esac
3244                         ;;
3245                 linux)  osname=linux
3246                         case "$3" in
3247                         *)      osvers="$3" ;;
3248                         esac
3249                         ;;
3250                 MiNT)   osname=mint
3251                         ;;
3252                 netbsd*) osname=netbsd
3253                         osvers="$3"
3254                         ;;
3255                 news-os) osvers="$3"
3256                         case "$3" in
3257                         4*) osname=newsos4 ;;
3258                         *) osname=newsos ;;
3259                         esac
3260                         ;;
3261                 next*) osname=next ;;
3262                 nonstop-ux) osname=nonstopux ;;
3263                 openbsd) osname=openbsd
3264                         osvers="$3"
3265                         ;;
3266                 os2)    osname=os2
3267                         osvers="$4"
3268                         ;;
3269                 POSIX-BC | posix-bc ) osname=posix-bc
3270                         osvers="$3"
3271                         ;;
3272                 powerux | power_ux | powermax_os | powermaxos | \
3273                 powerunix | power_unix) osname=powerux
3274                         osvers="$3"
3275                         ;;
3276                 qnx) osname=qnx
3277                         osvers="$4"
3278                         ;;
3279                 solaris) osname=solaris
3280                         case "$3" in
3281                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3282                         *)      osvers="$3" ;;
3283                         esac
3284                         ;;
3285                 sunos) osname=sunos
3286                         case "$3" in
3287                         5*) osname=solaris
3288                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3289                         *)      osvers="$3" ;;
3290                         esac
3291                         ;;
3292                 titanos) osname=titanos
3293                         case "$3" in
3294                         1*) osvers=1 ;;
3295                         2*) osvers=2 ;;
3296                         3*) osvers=3 ;;
3297                         4*) osvers=4 ;;
3298                         *)      osvers="$3" ;;
3299                         esac
3300                         ;;
3301                 ultrix) osname=ultrix
3302                         osvers="$3"
3303                         ;;
3304                 osf1|mls+)      case "$5" in
3305                                 alpha)
3306                                         osname=dec_osf
3307                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3308                                         case "$osvers" in
3309                                         [1-9].[0-9]*) ;;
3310                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3311                                         esac
3312                                         ;;
3313                         hp*)    osname=hp_osf1  ;;
3314                         mips)   osname=mips_osf1 ;;
3315                         esac
3316                         ;;
3317                 # UnixWare 7.1.2 is known as Open UNIX 8
3318                 openunix|unixware) osname=svr5
3319                         osvers="$4"
3320                         ;;
3321                 uts)    osname=uts
3322                         osvers="$3"
3323                         ;;
3324                 vos) osvers="$3"
3325                         ;;
3326                 $2) case "$osname" in
3327                         *isc*) ;;
3328                         *freebsd*) ;;
3329                         svr*)
3330                                 : svr4.x or possibly later
3331                                 case "svr$3" in
3332                                 ${osname}*)
3333                                         osname=svr$3
3334                                         osvers=$4
3335                                         ;;
3336                                 esac
3337                                 case "$osname" in
3338                                 svr4.0)
3339                                         : Check for ESIX
3340                                         if test -f /stand/boot ; then
3341                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3342                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3343                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3344                                                         if test -n "$isesix"; then
3345                                                                 osname=esix4
3346                                                         fi
3347                                                 fi
3348                                         fi
3349                                         ;;
3350                                 esac
3351                                 ;;
3352                         *)      if test -f /etc/systemid; then
3353                                         osname=sco
3354                                         set `echo $3 | $sed 's/\./ /g'` $4
3355                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3356                                                 osvers=$1.$2.$3
3357                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3358                                                 osvers=$1.$2
3359                                         elif $test -f $src/hints/sco_$1.sh; then
3360                                                 osvers=$1
3361                                         fi
3362                                 else
3363                                         case "$osname" in
3364                                         '') : Still unknown.  Probably a generic Sys V.
3365                                                 osname="sysv"
3366                                                 osvers="$3"
3367                                                 ;;
3368                                         esac
3369                                 fi
3370                                 ;;
3371                         esac
3372                         ;;
3373                 *)      case "$osname" in
3374                         '') : Still unknown.  Probably a generic BSD.
3375                                 osname="$1"
3376                                 osvers="$3"
3377                                 ;;
3378                         esac
3379                         ;;
3380                 esac
3381         else
3382                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3383                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3384                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3385                                 osname=news_os
3386                         fi
3387                         $rm -f UU/kernel.what
3388                 elif test -d c:/. -o -n "$is_os2" ; then
3389                         set X $myuname
3390                         osname=os2
3391                         osvers="$5"
3392                 fi
3393         fi
3394
3395         case "$targetarch" in
3396         '') ;;
3397         *)  hostarch=$osname
3398             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3399             osvers=''
3400             ;;
3401         esac
3402
3403         : Now look for a hint file osname_osvers, unless one has been
3404         : specified already.
3405         case "$hintfile" in
3406         ''|' ')
3407                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3408                 : Also try without trailing minor version numbers.
3409                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3410                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3411                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3412                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3413                 case "$file" in
3414                 '') dflt=none ;;
3415                 *)  case "$osvers" in
3416                         '') dflt=$file
3417                                 ;;
3418                         *)  if $test -f $src/hints/$file.sh ; then
3419                                         dflt=$file
3420                                 elif $test -f $src/hints/$xfile.sh ; then
3421                                         dflt=$xfile
3422                                 elif $test -f $src/hints/$xxfile.sh ; then
3423                                         dflt=$xxfile
3424                                 elif $test -f $src/hints/$xxxfile.sh ; then
3425                                         dflt=$xxxfile
3426                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3427                                         dflt=$xxxxfile
3428                                 elif $test -f "$src/hints/${osname}.sh" ; then
3429                                         dflt="${osname}"
3430                                 else
3431                                         dflt=none
3432                                 fi
3433                                 ;;
3434                         esac
3435                         ;;
3436                 esac
3437                 if $test -f Policy.sh ; then
3438                         case "$dflt" in
3439                         *Policy*) ;;
3440                         none) dflt="Policy" ;;
3441                         *) dflt="Policy $dflt" ;;
3442                         esac
3443                 fi
3444                 ;;
3445         *)
3446                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3447                 ;;
3448         esac
3449
3450         if $test -f Policy.sh ; then
3451                 $cat <<EOM
3452
3453 There's also a Policy hint file available, which should make the
3454 site-specific (policy) questions easier to answer.
3455 EOM
3456
3457         fi
3458
3459         $cat <<EOM
3460
3461 You may give one or more space-separated answers, or "none" if appropriate.
3462 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3463 previous run of Configure, you may specify it as well as or instead of
3464 OS-specific hints.  If hints are provided for your OS, you should use them:
3465 although Perl can probably be built without hints on many platforms, using
3466 hints often improve performance and may enable features that Configure can't
3467 set up on its own. If there are no hints that match your OS, specify "none";
3468 DO NOT give a wrong version or a wrong OS.
3469
3470 EOM
3471
3472         rp="Which of these apply, if any?"
3473         . UU/myread
3474         tans=$ans
3475         for file in $tans; do
3476                 if $test X$file = XPolicy -a -f Policy.sh; then
3477                         . Policy.sh
3478                         $cat Policy.sh >> UU/config.sh
3479                 elif $test -f $src/hints/$file.sh; then
3480                         . $src/hints/$file.sh
3481                         $cat $src/hints/$file.sh >> UU/config.sh
3482                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3483                         : nothing
3484                 else
3485                         : Give one chance to correct a possible typo.
3486                         echo "$file.sh does not exist"
3487                         dflt=$file
3488                         rp="hint to use instead?"
3489                         . UU/myread
3490                         for file in $ans; do
3491                                 if $test -f "$src/hints/$file.sh"; then
3492                                         . $src/hints/$file.sh
3493                                         $cat $src/hints/$file.sh >> UU/config.sh
3494                                 elif $test X$ans = X -o X$ans = Xnone ; then
3495                                         : nothing
3496                                 else
3497                                         echo "$file.sh does not exist -- ignored."
3498                                 fi
3499                         done
3500                 fi
3501         done
3502
3503         hint=recommended
3504         : Remember our hint file for later.
3505         if $test -f "$src/hints/$file.sh" ; then
3506                 hintfile="$file"
3507         else
3508                 hintfile=''
3509         fi
3510 fi
3511 cd UU
3512 ;;
3513 *)
3514         echo " "
3515         echo "Fetching default answers from $config_sh..." >&4
3516         tmp_n="$n"
3517         tmp_c="$c"
3518         cd ..
3519         cp $config_sh config.sh 2>/dev/null
3520         chmod +w config.sh
3521         . ./config.sh
3522         cd UU
3523         cp ../config.sh .
3524         n="$tmp_n"
3525         c="$tmp_c"
3526         hint=previous
3527         ;;
3528 esac
3529 test "$override" && . ./optdef.sh
3530
3531 : Restore computed paths
3532 for file in $loclist $trylist; do
3533         eval $file="\$_$file"
3534 done
3535
3536 cat << EOM
3537
3538 Configure uses the operating system name and version to set some defaults.
3539 The default value is probably right if the name rings a bell. Otherwise,
3540 since spelling matters for me, either accept the default or answer "none"
3541 to leave it blank.
3542
3543 EOM
3544 case "$osname" in
3545         ''|' ')
3546                 case "$hintfile" in
3547                 ''|' '|none) dflt=none ;;
3548                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3549                 esac
3550                 ;;
3551         *) dflt="$osname" ;;
3552 esac
3553 rp="Operating system name?"
3554 . ./myread
3555 case "$ans" in
3556 none)  osname='' ;;
3557 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3558 esac
3559 echo " "
3560 case "$osvers" in
3561         ''|' ')
3562                 case "$hintfile" in
3563                 ''|' '|none) dflt=none ;;
3564                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3565                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3566                         case "$dflt" in
3567                         ''|' ') dflt=none ;;
3568                         esac
3569                         ;;
3570                 esac
3571                 ;;
3572         *) dflt="$osvers" ;;
3573 esac
3574 rp="Operating system version?"
3575 . ./myread
3576 case "$ans" in
3577 none)  osvers='' ;;
3578 *) osvers="$ans" ;;
3579 esac
3580
3581
3582 . ./posthint.sh
3583
3584 : who configured the system
3585 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3586 case "$cf_by" in
3587 "")
3588         cf_by=`(logname) 2>/dev/null`
3589         case "$cf_by" in
3590         "")
3591                 cf_by=`(whoami) 2>/dev/null`
3592                 case "$cf_by" in
3593                 "") cf_by=unknown ;;
3594                 esac ;;
3595         esac ;;
3596 esac
3597
3598 : decide how portable to be.  Allow command line overrides.
3599 case "$d_portable" in
3600 "$undef") ;;
3601 *)      d_portable="$define" ;;
3602 esac
3603
3604 : set up shell script to do ~ expansion
3605 cat >filexp <<EOSS
3606 $startsh
3607 : expand filename
3608 case "\$1" in
3609  \~/*|\~)
3610         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3611         ;;
3612  \~*)
3613         if $test -f /bin/csh; then
3614                 /bin/csh -f -c "glob \$1"
3615                 failed=\$?
3616                 echo ""
3617                 exit \$failed
3618         else
3619                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3620                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3621                 if $test ! -d "\$dir"; then
3622                         me=\`basename \$0\`
3623                         echo "\$me: can't locate home directory for: \$name" >&2
3624                         exit 1
3625                 fi
3626                 case "\$1" in
3627                 */*)
3628                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3629                         ;;
3630                 *)
3631                         echo \$dir
3632                         ;;
3633                 esac
3634         fi
3635         ;;
3636 *)
3637         echo \$1
3638         ;;
3639 esac
3640 EOSS
3641 chmod +x filexp
3642 $eunicefix filexp
3643
3644 : now set up to get a file name
3645 cat <<EOS >getfile
3646 $startsh
3647 EOS
3648 cat <<'EOSC' >>getfile
3649 tilde=''
3650 fullpath=''
3651 already=''
3652 skip=''
3653 none_ok=''
3654 exp_file=''
3655 nopath_ok=''
3656 orig_rp="$rp"
3657 orig_dflt="$dflt"
3658 case "$gfpth" in
3659 '') gfpth='.' ;;
3660 esac
3661
3662 case "$fn" in
3663 *\(*)
3664         : getfile will accept an answer from the comma-separated list
3665         : enclosed in parentheses even if it does not meet other criteria.
3666         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3667         fn=`echo $fn | sed 's/(.*)//'`
3668         ;;
3669 esac
3670
3671 case "$fn" in
3672 *:*)
3673         loc_file=`expr $fn : '.*:\(.*\)'`
3674         fn=`expr $fn : '\(.*\):.*'`
3675         ;;
3676 esac
3677
3678 case "$fn" in
3679 *~*) tilde=true;;
3680 esac
3681 case "$fn" in
3682 */*) fullpath=true;;
3683 esac
3684 case "$fn" in
3685 *+*) skip=true;;
3686 esac
3687 case "$fn" in
3688 *n*) none_ok=true;;
3689 esac
3690 case "$fn" in
3691 *e*) exp_file=true;;
3692 esac
3693 case "$fn" in
3694 *p*) nopath_ok=true;;
3695 esac
3696
3697 case "$fn" in
3698 *f*) type='File';;
3699 *d*) type='Directory';;
3700 *l*) type='Locate';;
3701 esac
3702
3703 what="$type"
3704 case "$what" in
3705 Locate) what='File';;
3706 esac
3707
3708 case "$exp_file" in
3709 '')
3710         case "$d_portable" in
3711         "$define") ;;
3712         *) exp_file=true;;
3713         esac
3714         ;;
3715 esac
3716
3717 cd ..
3718 while test "$type"; do
3719         redo=''
3720         rp="$orig_rp"
3721         dflt="$orig_dflt"
3722         case "$tilde" in
3723         true) rp="$rp (~name ok)";;
3724         esac
3725         . UU/myread
3726         if test -f UU/getfile.ok && \
3727                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3728         then
3729                 value="$ans"
3730                 ansexp="$ans"
3731                 break
3732         fi
3733         case "$ans" in
3734         none)
3735                 value=''
3736                 ansexp=''
3737                 case "$none_ok" in
3738                 true) type='';;
3739                 esac
3740                 ;;
3741         *)
3742                 case "$tilde" in
3743                 '') value="$ans"
3744                         ansexp="$ans";;
3745                 *)
3746                         value=`UU/filexp $ans`
3747                         case $? in
3748                         0)
3749                                 if test "$ans" != "$value"; then
3750                                         echo "(That expands to $value on this system.)"
3751                                 fi
3752                                 ;;
3753                         *) value="$ans";;
3754                         esac
3755                         ansexp="$value"
3756                         case "$exp_file" in
3757                         '') value="$ans";;
3758                         esac
3759                         ;;
3760                 esac
3761                 case "$fullpath" in
3762                 true)
3763                         case "$ansexp" in
3764                         /*) value="$ansexp" ;;
3765                         [a-zA-Z]:/*) value="$ansexp" ;;
3766                         *)
3767                                 redo=true
3768                                 case "$already" in
3769                                 true)
3770                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3771                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3772                                         ;;
3773                                 *)
3774                                 echo "Please give a full path name, starting with slash." >&4
3775                                         case "$tilde" in
3776                                         true)
3777                                 echo "Note that using ~name is ok provided it expands well." >&4
3778                                                 already=true
3779                                                 ;;
3780                                         esac
3781                                 esac
3782                                 ;;
3783                         esac
3784                         ;;
3785                 esac
3786                 case "$redo" in
3787                 '')
3788                         case "$type" in
3789                         File)
3790                                 for fp in $gfpth; do
3791                                         if test "X$fp" = X.; then
3792                                             pf="$ansexp"
3793                                         else    
3794                                             pf="$fp/$ansexp"
3795                                         fi
3796                                         if test -f "$pf"; then
3797                                                 type=''
3798                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3799                                         then
3800                                                 echo "($value is not a plain file, but that's ok.)"
3801                                                 type=''
3802                                         fi
3803                                         if test X"$type" = X; then
3804                                             value="$pf"
3805                                             break
3806                                         fi
3807                                 done
3808                                 ;;
3809                         Directory)
3810                                 for fp in $gfpth; do
3811                                         if test "X$fp" = X.; then
3812                                             dir="$ans"
3813                                             direxp="$ansexp"
3814                                         else    
3815                                             dir="$fp/$ansexp"
3816                                             direxp="$fp/$ansexp"
3817                                         fi
3818                                         if test -d "$direxp"; then
3819                                                 type=''
3820                                                 value="$dir"
3821                                                 break
3822                                         fi
3823                                 done
3824                                 ;;
3825                         Locate)
3826                                 if test -d "$ansexp"; then
3827                                         echo "(Looking for $loc_file in directory $value.)"
3828                                         value="$value/$loc_file"
3829                                         ansexp="$ansexp/$loc_file"
3830                                 fi
3831                                 if test -f "$ansexp"; then
3832                                         type=''
3833                                 fi
3834                                 case "$nopath_ok" in
3835                                 true)   case "$value" in
3836                                         */*) ;;
3837                                         *)      echo "Assuming $value will be in people's path."
3838                                                 type=''
3839                                                 ;;
3840                                         esac
3841                                         ;;
3842                                 esac
3843                                 ;;
3844                         esac
3845
3846                         case "$skip" in
3847                         true) type='';
3848                         esac
3849
3850                         case "$type" in
3851                         '') ;;
3852                         *)
3853                                 if test "$fastread" = yes; then
3854                                         dflt=y
3855                                 else
3856                                         dflt=n
3857                                 fi
3858                                 rp="$what $value doesn't exist.  Use that name anyway?"
3859                                 . UU/myread
3860                                 dflt=''
3861                                 case "$ans" in
3862                                 y*) type='';;
3863                                 *) echo " ";;
3864                                 esac
3865                                 ;;
3866                         esac
3867                         ;;
3868                 esac
3869                 ;;
3870         esac
3871 done
3872 cd UU
3873 ans="$value"
3874 rp="$orig_rp"
3875 dflt="$orig_dflt"
3876 rm -f getfile.ok
3877 test "X$gfpthkeep" != Xy && gfpth=""
3878 EOSC
3879
3880 : determine root of directory hierarchy where package will be installed.
3881 case "$prefix" in
3882 '')
3883         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3884         ;;
3885 *?/)
3886         dflt=`echo "$prefix" | sed 's/.$//'`
3887         ;;
3888 *)
3889         dflt="$prefix"
3890         ;;
3891 esac
3892 $cat <<EOM
3893
3894 By default, $package will be installed in $dflt/bin, manual pages
3895 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3896 installation directories. Typically this is something like /usr/local.
3897 If you wish to have binaries under /usr/bin but other parts of the
3898 installation under /usr/local, that's ok: you will be prompted
3899 separately for each of the installation directories, the prefix being
3900 only used to set the defaults.
3901
3902 EOM
3903 fn=d~
3904 rp='Installation prefix to use?'
3905 . ./getfile
3906 oldprefix=''
3907 case "$prefix" in
3908 '') ;;
3909 *)
3910         case "$ans" in
3911         "$prefix") ;;
3912         *) oldprefix="$prefix";;
3913         esac
3914         ;;
3915 esac
3916 prefix="$ans"
3917 prefixexp="$ansexp"
3918
3919 : allow them to override the AFS root
3920 case "$afsroot" in
3921 '')     afsroot=/afs ;;
3922 *)      afsroot=$afsroot ;;
3923 esac
3924
3925 : is AFS running?
3926 echo " "
3927 case "$afs" in
3928 $define|true)   afs=true ;;
3929 $undef|false)   afs=false ;;
3930 *)      if $test -d $afsroot; then
3931                 afs=true
3932         else
3933                 afs=false
3934         fi
3935         ;;
3936 esac
3937 if $afs; then
3938         echo "AFS may be running... I'll be extra cautious then..." >&4
3939 else
3940         echo "AFS does not seem to be running..." >&4
3941 fi
3942
3943 : determine installation prefix for where package is to be installed.
3944 if $afs; then 
3945 $cat <<EOM
3946
3947 Since you are running AFS, I need to distinguish the directory in which
3948 files will reside from the directory in which they are installed (and from
3949 which they are presumably copied to the former directory by occult means).
3950
3951 EOM
3952         case "$installprefix" in
3953         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3954         *) dflt="$installprefix";;
3955         esac
3956 else
3957 $cat <<EOM
3958
3959 In some special cases, particularly when building $package for distribution,
3960 it is convenient to distinguish the directory in which files should be
3961 installed from the directory ($prefix) in which they will
3962 eventually reside.  For most users, these two directories are the same.
3963
3964 EOM
3965         case "$installprefix" in
3966         '') dflt=$prefix ;;
3967         *) dflt=$installprefix;;
3968         esac
3969 fi
3970 fn=d~
3971 rp='What installation prefix should I use for installing files?'
3972 . ./getfile
3973 installprefix="$ans"
3974 installprefixexp="$ansexp"
3975
3976 : Perform the prefixexp/installprefixexp correction if necessary
3977 cat <<EOS >installprefix
3978 $startsh
3979 EOS
3980 cat <<'EOSC' >>installprefix
3981 : Change installation prefix, if necessary.
3982 if $test X"$prefix" != X"$installprefix"; then
3983     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3984 else
3985     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3986 fi
3987 EOSC
3988 chmod +x installprefix
3989 $eunicefix installprefix
3990
3991 : Set variables such as privlib and privlibexp from the output of ./getfile
3992 : performing the prefixexp/installprefixexp correction if necessary.
3993 cat <<EOS >setprefixvar
3994 $startsh
3995 EOS
3996 cat <<'EOSC' >>setprefixvar
3997 eval "${prefixvar}=\"\$ans\""
3998 eval "${prefixvar}exp=\"\$ansexp\""
3999 . ./installprefix
4000 EOSC
4001 chmod +x setprefixvar
4002 $eunicefix setprefixvar
4003
4004 : set up the script used to warn in case of inconsistency
4005 cat <<EOS >whoa
4006 $startsh
4007 EOS
4008 cat <<'EOSC' >>whoa
4009 dflt=y
4010 case "$hint" in
4011     recommended)
4012         case "$hintfile" in
4013         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4014                 ;;
4015         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4016                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4017                 ;;
4018         esac
4019         ;;
4020     *)  echo " "
4021         echo "*** WHOA THERE!!! ***" >&4
4022         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4023         ;;
4024 esac
4025 rp="    Keep the $hint value?"
4026 . ./myread
4027 case "$ans" in
4028 y) td=$was; tu=$was;;
4029 esac
4030 EOSC
4031
4032 : function used to set '$1' to '$val'
4033 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4034 case "$val$was" in
4035 $define$undef) . ./whoa; eval "$var=\$td";;
4036 $undef$define) . ./whoa; eval "$var=\$tu";;
4037 *) eval "$var=$val";;
4038 esac'
4039
4040 : Check is we will use socks
4041 case "$usesocks" in
4042 $define|true|[yY]*)     dflt='y';;
4043 *) dflt='n';;
4044 esac
4045 cat <<EOM
4046
4047 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4048 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4049 to use the PerlIO abstraction layer, this will be implicitly selected.
4050
4051 If this doesn't make any sense to you, just accept the default '$dflt'.
4052 EOM
4053 rp='Build Perl for SOCKS?'
4054 . ./myread
4055 case "$ans" in
4056 y|Y)    val="$define" ;;
4057 *)      val="$undef" ;;
4058 esac
4059 set usesocks
4060 eval $setvar
4061
4062 case "$usesocks" in
4063 $define|true|[yY]*) useperlio="$define";;
4064 esac
4065
4066 : Check if we want perlio
4067 case "$useperlio" in
4068 $define|true|[yY]*|'')  dflt='y';;
4069 *) dflt='n';;
4070 esac
4071 cat <<EOM
4072
4073 Previous version of $package used the standard IO mechanisms as
4074 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4075 alternate IO mechanisms via the PerlIO abstraction layer, but the
4076 stdio mechanism is still available if needed.  The abstraction layer
4077 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4078 Using PerlIO with sfio may cause problems with some extension modules.
4079
4080 If this doesn't make any sense to you, just accept the default '$dflt'.
4081 EOM
4082 rp='Use the PerlIO abstraction layer?'
4083 . ./myread
4084 case "$ans" in
4085 y|Y)
4086         val="$define"
4087         ;;
4088 *)
4089         echo "Ok, doing things the stdio way."
4090         val="$undef"
4091         ;;
4092 esac
4093 set useperlio
4094 eval $setvar
4095
4096 case "$usesocks" in
4097 $define|true|[yY]*)
4098         case "$useperlio" in
4099         $define|true|[yY]*) ;;
4100         *)      cat >&4 <<EOM
4101
4102 You are using the SOCKS proxy protocol library which means that you
4103 should also use the PerlIO layer.  You may be headed for trouble.
4104
4105 EOM
4106                 ;;
4107         esac
4108         ;;
4109 esac
4110
4111 : get the patchlevel
4112 echo " "
4113 echo "Getting the current patchlevel..." >&4
4114 if $test -r $rsrc/patchlevel.h;then
4115         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4116         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4117         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4118         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4119         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4120         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4121         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4122 else
4123         revision=0
4124         patchlevel=0
4125         subversion=0
4126         api_revision=0
4127         api_version=0
4128         api_subversion=0
4129         perl_patchlevel=0
4130         $echo "(You do not have patchlevel.h.  Eek.)"
4131 fi
4132 if $test -r $rsrc/.patch ; then
4133         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4134                 perl_patchlevel=`cat $rsrc/.patch`
4135         fi
4136 fi
4137 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4138 version_patchlevel_string="version $patchlevel subversion $subversion"
4139 case "$perl_patchlevel" in
4140 0|'') ;;
4141 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4142 esac
4143
4144 $echo "(You have $package $version_patchlevel_string.)"
4145
4146 case "$osname" in
4147 dos|vms)
4148         : XXX Should be a Configure test for double-dots in filenames.
4149         version=`echo $revision $patchlevel $subversion | \
4150                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4151         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4152                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4153         ;;
4154 *)
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 esac
4161 : Special case the 5.005_xx maintenance series, which used 5.005
4162 : without any subversion label as a subdirectory in $sitelib
4163 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4164         api_versionstring='5.005'
4165 fi
4166
4167 : Do we want threads support and if so, what type
4168 case "$usethreads" in
4169 $define|true|[yY]*)     dflt='y';;
4170 *)     # Catch case where user specified ithreads or 5005threads but
4171        # forgot -Dusethreads (A.D. 4/2002)
4172        case "$useithreads$use5005threads" in
4173        *$define*)
4174                 case "$useperlio" in
4175                 "$define")      dflt='y' ;;
4176                 *)              dflt='n' ;;
4177                 esac
4178                 ;;
4179        *)       dflt='n';;
4180        esac
4181        ;;
4182 esac
4183 cat <<EOM
4184
4185 Perl can be built to take advantage of threads on some systems.
4186 To do so, Configure can be run with -Dusethreads.
4187
4188 Note that Perl built with threading support runs slightly slower
4189 and uses more memory than plain Perl. The current implementation
4190 is believed to be stable, but it is fairly new, and so should be
4191 treated with caution.
4192
4193 If this doesn't make any sense to you, just accept the default '$dflt'.
4194 EOM
4195 rp='Build a threading Perl?'
4196 . ./myread
4197 case "$ans" in
4198 y|Y)    val="$define" ;;
4199 *)      val="$undef" ;;
4200 esac
4201 set usethreads
4202 eval $setvar
4203
4204 if $test $patchlevel -lt 9; then
4205     case "$usethreads" in
4206     $define)
4207         $cat <<EOM
4208
4209 Since release 5.6, Perl has had two different threading implementations,
4210 the newer interpreter-based version (ithreads) with one interpreter per
4211 thread, and the older 5.005 version (5005threads).
4212 The 5005threads version is effectively unmaintained and will probably be
4213 removed in Perl 5.10, so there should be no need to build a Perl using it
4214 unless needed for backwards compatibility with some existing 5.005threads
4215 code.
4216
4217 EOM
4218         : Default to ithreads unless overridden on command line or with
4219         : old config.sh
4220         dflt='y'
4221         case "$use5005threads" in
4222                 $define|true|[yY]*) dflt='n';;
4223         esac
4224         case "$useithreads" in
4225                 $undef|false|[nN]*) dflt='n';;
4226         esac
4227         rp='Use the newer interpreter-based ithreads?'
4228         . ./myread
4229         case "$ans" in
4230         y|Y)    val="$define" ;;
4231         *)      val="$undef" ;;
4232         esac
4233         set useithreads
4234         eval $setvar
4235         : Now set use5005threads to the opposite value.
4236         case "$useithreads" in
4237         $define) val="$undef" ;;
4238         *) val="$define" ;;
4239         esac
4240         set use5005threads
4241         eval $setvar
4242         ;;
4243     *)
4244         useithreads="$undef"
4245         use5005threads="$undef"
4246         ;;
4247     esac
4248
4249     case "$useithreads$use5005threads" in
4250     "$define$define")
4251         $cat >&4 <<EOM
4252
4253 You cannot have both the ithreads and the 5.005 threads enabled
4254 at the same time.  Disabling the 5.005 threads since they are
4255 much less stable than the ithreads.
4256
4257 EOM
4258         use5005threads="$undef"
4259         ;;
4260     esac
4261
4262 else
4263 : perl-5.9.x and later
4264
4265     if test X"$usethreads" = "X$define"; then
4266         case "$use5005threads" in
4267             $define|true|[yY]*)
4268                 $cat >&4 <<EOM
4269
4270 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4271
4272 EOM
4273             ;;
4274         esac
4275     fi
4276
4277     use5005threads="$undef"
4278     useithreads="$usethreads"
4279 fi
4280
4281 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4282         cat >&4 <<EOF
4283 ***
4284 *** To build with ithreads you must also use the PerlIO layer.
4285 *** Cannot continue, aborting.
4286 ***
4287 EOF
4288         exit 1
4289 fi
4290
4291 case "$d_oldpthreads" in
4292 '')     : Configure tests would be welcome here.  For now, assume undef.
4293         val="$undef" ;;
4294 *)      val="$d_oldpthreads" ;;
4295 esac
4296 set d_oldpthreads
4297 eval $setvar
4298
4299
4300 : Look for a hint-file generated 'call-back-unit'.  If the
4301 : user has specified that a threading perl is to be built,
4302 : we may need to set or change some other defaults.
4303 if $test -f usethreads.cbu; then
4304     echo "Your platform has some specific hints regarding threaded builds, using them..."
4305     . ./usethreads.cbu
4306 else
4307     case "$usethreads" in
4308         "$define"|true|[yY]*)
4309                 $cat <<EOM
4310 (Your platform does not have any specific hints for threaded builds.
4311  Assuming POSIX threads, then.)
4312 EOM
4313         ;;
4314     esac
4315 fi
4316
4317 : Check if multiplicity is required
4318 cat <<EOM
4319
4320 Perl can be built so that multiple Perl interpreters can coexist
4321 within the same Perl executable.
4322 EOM
4323
4324 case "$useithreads" in
4325 $define)
4326         cat <<EOM
4327 This multiple interpreter support is required for interpreter-based threads.
4328 EOM
4329         val="$define"
4330         ;;
4331 *)      case "$usemultiplicity" in
4332         $define|true|[yY]*)     dflt='y';;
4333         *) dflt='n';;
4334         esac
4335         echo " "
4336         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4337         rp='Build Perl for multiplicity?'
4338         . ./myread
4339         case "$ans" in
4340         y|Y)    val="$define" ;;
4341         *)      val="$undef" ;;
4342         esac
4343         ;;
4344 esac
4345 set usemultiplicity
4346 eval $setvar
4347
4348 : Check if morebits is requested
4349 case "$usemorebits" in
4350 "$define"|true|[yY]*)
4351         use64bitint="$define"
4352         uselongdouble="$define"
4353         usemorebits="$define"
4354         ;;
4355 *)      usemorebits="$undef"
4356         ;;
4357 esac
4358
4359 : Determine the C compiler to be used
4360 echo " "
4361 case "$cc" in
4362 '') dflt=cc;;
4363 *) dflt="$cc";;
4364 esac
4365 rp="Use which C compiler?"
4366 . ./myread
4367 cc="$ans"
4368
4369 : See whether they have no cc but they do have gcc
4370 . ./trygcc
4371 if $test -f cc.cbu; then
4372     . ./cc.cbu
4373 fi
4374 . ./checkcc
4375
4376 : make some quick guesses about what we are up against
4377 echo " "
4378 $echo $n "Hmm...  $c"
4379 echo exit 1 >bsd
4380 echo exit 1 >usg
4381 echo exit 1 >v7
4382 echo exit 1 >osf1
4383 echo exit 1 >eunice
4384 echo exit 1 >xenix
4385 echo exit 1 >venix
4386 echo exit 1 >os2
4387 d_bsd="$undef"
4388 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4389 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4390 then
4391         echo "Looks kind of like an OSF/1 system, but we'll see..."
4392         echo exit 0 >osf1
4393 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4394         xxx=`./loc addbib blurfl $pth`
4395         if $test -f $xxx; then
4396         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4397                 echo exit 0 >bsd
4398                 echo exit 0 >usg
4399         else
4400                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4401                         echo "Looks kind of like an extended USG system, but we'll see..."
4402                 else
4403                         echo "Looks kind of like a USG system, but we'll see..."
4404                 fi
4405                 echo exit 0 >usg
4406         fi
4407 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4408         echo "Looks kind of like a BSD system, but we'll see..."
4409         d_bsd="$define"
4410         echo exit 0 >bsd
4411 else
4412         echo "Looks kind of like a Version 7 system, but we'll see..."
4413         echo exit 0 >v7
4414 fi
4415 case "$eunicefix" in
4416 *unixtovms*)
4417         $cat <<'EOI'
4418 There is, however, a strange, musty smell in the air that reminds me of
4419 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4420 EOI
4421         echo exit 0 >eunice
4422         d_eunice="$define"
4423 : it so happens the Eunice I know will not run shell scripts in Unix format
4424         ;;
4425 *)
4426         echo " "
4427         echo "Congratulations.  You aren't running Eunice."
4428         d_eunice="$undef"
4429         ;;
4430 esac
4431 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4432 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4433 : semicolon as a patch separator
4434 case "$p_" in
4435 :) ;;
4436 *)
4437         $cat <<'EOI'
4438 I have the feeling something is not exactly right, however...don't tell me...
4439 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4440 (Or you may be running DOS with DJGPP.)
4441 EOI
4442         echo exit 0 >os2
4443         ;;
4444 esac
4445 if test -f /xenix; then
4446         echo "Actually, this looks more like a XENIX system..."
4447         echo exit 0 >xenix
4448         d_xenix="$define"
4449 else
4450         echo " "
4451         echo "It's not Xenix..."
4452         d_xenix="$undef"
4453 fi
4454 chmod +x xenix
4455 $eunicefix xenix
4456 if test -f /venix; then
4457         echo "Actually, this looks more like a VENIX system..."
4458         echo exit 0 >venix
4459 else
4460         echo " "
4461         if ./xenix; then
4462                 : null
4463         else
4464                 echo "Nor is it Venix..."
4465         fi
4466 fi
4467 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4468 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4469 $rm -f foo
4470
4471 : Check if we are using GNU gcc and what its version is
4472 echo " "
4473 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4474 $cat >try.c <<EOM
4475 #include <stdio.h>
4476 int main() {
4477 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4478 #ifdef __VERSION__
4479         printf("%s\n", __VERSION__);
4480 #else
4481         printf("%s\n", "1");
4482 #endif
4483 #endif
4484         return(0);
4485 }
4486 EOM
4487 if $cc -o try $ccflags $ldflags try.c; then
4488         gccversion=`$run ./try`
4489         case "$gccversion" in
4490         '') echo "You are not using GNU cc." ;;
4491         *)  echo "You are using GNU cc $gccversion."
4492             ccname=gcc
4493             ;;
4494         esac
4495 else
4496         echo " "
4497         echo "*** WHOA THERE!!! ***" >&4
4498         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4499         case "$knowitall" in
4500         '')
4501         echo "    You'd better start hunting for one and let me know about it." >&4
4502                 exit 1
4503                 ;;
4504         esac
4505 fi
4506 $rm -f try try.*
4507 case "$gccversion" in
4508 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4509 esac
4510 case "$gccversion" in
4511 '') gccosandvers='' ;;
4512 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4513    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4514    gccshortvers=''
4515    case "$gccosandvers" in
4516    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4517    $osname$osvers) ;; # looking good
4518    $osname*) cat <<EOM >&4
4519
4520 *** WHOA THERE!!! ***
4521
4522     Your gcc has not been compiled for the exact release of
4523     your operating system ($gccosandvers versus $osname$osvers).
4524
4525     In general it is a good idea to keep gcc synchronized with
4526     the operating system because otherwise serious problems
4527     may ensue when trying to compile software, like Perl.
4528
4529     I'm trying to be optimistic here, though, and will continue.
4530     If later during the configuration and build icky compilation
4531     problems appear (headerfile conflicts being the most common
4532     manifestation), I suggest reinstalling the gcc to match
4533     your operating system release.
4534
4535 EOM
4536       ;;
4537    *) gccosandvers='' ;; # failed to parse, better be silent
4538    esac
4539    ;;
4540 esac
4541 case "$ccname" in
4542 '') ccname="$cc" ;;
4543 esac
4544
4545 # gcc 3.* complain about adding -Idirectories that they already know about,
4546 # so we will take those off from locincpth.
4547 case "$gccversion" in
4548 3*)
4549     echo "main(){}">try.c
4550     for incdir in $locincpth; do
4551        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4552              grep '^c[cp]p*[01]: warning: changing search order '`
4553        if test "X$warn" != X; then
4554            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4555        fi
4556     done
4557     $rm -f try try.*
4558 esac
4559
4560 : What should the include directory be ?
4561 echo " "
4562 $echo $n "Hmm...  $c"
4563 dflt='/usr/include'
4564 incpath=''
4565 mips_type=''
4566 if $test -f /bin/mips && /bin/mips; then
4567         echo "Looks like a MIPS system..."
4568         $cat >usr.c <<'EOCP'
4569 #ifdef SYSTYPE_BSD43
4570 /bsd43
4571 #endif
4572 EOCP
4573         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4574                 dflt='/bsd43/usr/include'
4575                 incpath='/bsd43'
4576                 mips_type='BSD 4.3'
4577         else
4578                 mips_type='System V'
4579         fi
4580         $rm -f usr.c usr.out
4581         echo "and you're compiling with the $mips_type compiler and libraries."
4582         xxx_prompt=y
4583         echo "exit 0" >mips
4584 else
4585         echo "Doesn't look like a MIPS system."
4586         xxx_prompt=n
4587         echo "exit 1" >mips
4588 fi
4589 chmod +x mips
4590 $eunicefix mips
4591 case "$usrinc" in
4592 '') ;;
4593 *) dflt="$usrinc";;
4594 esac
4595 case "$xxx_prompt" in
4596 y)      fn=d/
4597         echo " "
4598         rp='Where are the include files you want to use?'
4599         . ./getfile
4600         usrinc="$ans"
4601         ;;
4602 *)      usrinc="$dflt"
4603         ;;
4604 esac
4605
4606 : see how we invoke the C preprocessor
4607 echo " "
4608 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4609 cat <<'EOT' >testcpp.c
4610 #define ABC abc
4611 #define XYZ xyz
4612 ABC.XYZ
4613 EOT
4614 cd ..
4615 if test ! -f cppstdin; then
4616         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4617                 # AIX cc -E doesn't show the absolute headerfile
4618                 # locations but we'll cheat by using the -M flag.
4619                 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
4620         else
4621                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4622         fi
4623 else
4624         echo "Keeping your $hint cppstdin wrapper."
4625 fi
4626 chmod 755 cppstdin
4627 wrapper=`pwd`/cppstdin
4628 ok='false'
4629 cd UU
4630
4631 if $test "X$cppstdin" != "X" && \
4632         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4633         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4634 then
4635         echo "You used to use $cppstdin $cppminus so we'll use that again."
4636         case "$cpprun" in
4637         '') echo "But let's see if we can live without a wrapper..." ;;
4638         *)
4639                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4640                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4641                 then
4642                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4643                         ok='true'
4644                 else
4645                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4646                 fi
4647                 ;;
4648         esac
4649 else
4650         case "$cppstdin" in
4651         '') ;;
4652         *)
4653                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4654                 ;;
4655         esac
4656 fi
4657
4658 if $ok; then
4659         : nothing
4660 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4661         $cc -E <testcpp.c >testcpp.out 2>&1; \
4662         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4663         echo "Yup, it does."
4664         x_cpp="$cc -E"
4665         x_minus='';
4666 elif echo 'Nope...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"' -P" will work...'; \
4673         $cc -P <testcpp.c >testcpp.out 2>&1; \
4674         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4675         echo "Yipee, that works!"
4676         x_cpp="$cc -P"
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 "At long last!"
4682         x_cpp="$cc -P"
4683         x_minus='-';
4684 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4685         $cpp <testcpp.c >testcpp.out 2>&1; \
4686         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4687         echo "It works!"
4688         x_cpp="$cpp"
4689         x_minus='';
4690 elif echo 'Nixed again...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 "Hooray, it works!  I was beginning to wonder."
4694         x_cpp="$cpp"
4695         x_minus='-';
4696 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4697         $wrapper <testcpp.c >testcpp.out 2>&1; \
4698         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4699         x_cpp="$wrapper"
4700         x_minus=''
4701         echo "Eureka!"
4702 else
4703         dflt=''
4704         rp="No dice.  I can't find a C preprocessor.  Name one:"
4705         . ./myread
4706         x_cpp="$ans"
4707         x_minus=''
4708         $x_cpp <testcpp.c >testcpp.out 2>&1
4709         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4710                 echo "OK, that will do." >&4
4711         else
4712 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4713                 exit 1
4714         fi
4715 fi
4716
4717 case "$ok" in
4718 false)
4719         cppstdin="$x_cpp"
4720         cppminus="$x_minus"
4721         cpprun="$x_cpp"
4722         cpplast="$x_minus"
4723         set X $x_cpp
4724         shift
4725         case "$1" in
4726         "$cpp")
4727                 echo "Perhaps can we force $cc -E using a wrapper..."
4728                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4729                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4730                 then
4731                         echo "Yup, we can."
4732                         cppstdin="$wrapper"
4733                         cppminus='';
4734                 else
4735                         echo "Nope, we'll have to live without it..."
4736                 fi
4737                 ;;
4738         esac
4739         case "$cpprun" in
4740         "$wrapper")
4741                 cpprun=''
4742                 cpplast=''
4743                 ;;
4744         esac
4745         ;;
4746 esac
4747
4748 case "$cppstdin" in
4749 "$wrapper"|'cppstdin') ;;
4750 *) $rm -f $wrapper;;
4751 esac
4752 $rm -f testcpp.c testcpp.out
4753
4754 : Set private lib path
4755 case "$plibpth" in
4756 '') if ./mips; then
4757                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4758         fi;;
4759 esac
4760 case "$libpth" in
4761 ' ') dlist='';;
4762 '') dlist="$loclibpth $plibpth $glibpth";;
4763 *) dlist="$libpth";;
4764 esac
4765
4766 : Now check and see which directories actually exist, avoiding duplicates
4767 libpth=''
4768 for xxx in $dlist
4769 do
4770     if $test -d $xxx; then
4771                 case " $libpth " in
4772                 *" $xxx "*) ;;
4773                 *) libpth="$libpth $xxx";;
4774                 esac
4775     fi
4776 done
4777 $cat <<'EOM'
4778
4779 Some systems have incompatible or broken versions of libraries.  Among
4780 the directories listed in the question below, please remove any you
4781 know not to be holding relevant libraries, and add any that are needed.
4782 Say "none" for none.
4783
4784 EOM
4785 case "$libpth" in
4786 '') dflt='none';;
4787 *)
4788         set X $libpth
4789         shift
4790         dflt=${1+"$@"}
4791         ;;
4792 esac
4793 rp="Directories to use for library searches?"
4794 . ./myread
4795 case "$ans" in
4796 none) libpth=' ';;
4797 *) libpth="$ans";;
4798 esac
4799
4800 : compute shared library extension
4801 case "$so" in
4802 '')
4803         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4804                 dflt='sl'
4805         else
4806                 dflt='so'
4807         fi
4808         ;;
4809 *) dflt="$so";;
4810 esac
4811 $cat <<EOM
4812
4813 On some systems, shared libraries may be available.  Answer 'none' if
4814 you want to suppress searching of shared libraries for the remainder
4815 of this configuration.
4816
4817 EOM
4818 rp='What is the file extension used for shared libraries?'
4819 . ./myread
4820 so="$ans"
4821
4822 : Define several unixisms.
4823 : Hints files or command line option can be used to override them.
4824 : The convoluted testing is in case hints files set either the old
4825 : or the new name.
4826 case "$_exe" in
4827 '')     case "$exe_ext" in
4828         '')     ;;
4829         *)      _exe="$exe_ext" ;;
4830         esac
4831         ;;
4832 esac
4833 case "$_a" in
4834 '')     case "$lib_ext" in
4835     '') _a='.a';;
4836         *)      _a="$lib_ext" ;;
4837         esac
4838         ;;
4839 esac
4840 case "$_o" in
4841 '') case "$obj_ext" in
4842         '')     _o='.o';;
4843         *)      _o="$obj_ext";;
4844         esac
4845         ;;
4846 esac
4847 case "$p_" in
4848 '') case "$path_sep" in
4849         '')     p_=':';;
4850         *)      p_="$path_sep";;
4851         esac
4852         ;;
4853 esac
4854 exe_ext=$_exe
4855 lib_ext=$_a
4856 obj_ext=$_o
4857 path_sep=$p_
4858
4859 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4860
4861 : Which makefile gets called first.  This is used by make depend.
4862 case "$firstmakefile" in
4863 '') firstmakefile='makefile';;
4864 esac
4865
4866 : Check for uselongdouble support
4867 case "$ccflags" in
4868 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4869 esac
4870
4871 case "$uselongdouble" in
4872 $define|true|[yY]*)     dflt='y';;
4873 *) dflt='n';;
4874 esac
4875 cat <<EOM
4876
4877 Perl can be built to take advantage of long doubles which
4878 (if available) may give more accuracy and range for floating point numbers.
4879
4880 If this doesn't make any sense to you, just accept the default '$dflt'.
4881 EOM
4882 rp='Try to use long doubles if available?'
4883 . ./myread
4884 case "$ans" in
4885 y|Y)    val="$define"   ;;
4886 *)      val="$undef"    ;;
4887 esac
4888 set uselongdouble
4889 eval $setvar
4890
4891 case "$uselongdouble" in
4892 true|[yY]*) uselongdouble="$define" ;;
4893 esac
4894
4895 : Look for a hint-file generated 'call-back-unit'.  If the
4896 : user has specified that long doubles should be used,
4897 : we may need to set or change some other defaults.
4898 if $test -f uselongdouble.cbu; then
4899     echo "Your platform has some specific hints regarding long doubles, using them..."
4900     . ./uselongdouble.cbu
4901 else
4902     case "$uselongdouble" in
4903         $define)
4904                 $cat <<EOM
4905 (Your platform does not have any specific hints for long doubles.)
4906 EOM
4907         ;;
4908     esac
4909 fi
4910
4911 : Looking for optional libraries
4912 echo " "
4913 echo "Checking for optional libraries..." >&4
4914 case "$libs" in
4915 ' '|'') dflt='';;
4916 *) dflt="$libs";;
4917 esac
4918 case "$libswanted" in
4919 '') libswanted='c_s';;
4920 esac
4921 case "$usesocks" in
4922 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4923 esac
4924 libsfound=''
4925 libsfiles=''
4926 libsdirs=''
4927 libspath=''
4928 for thisdir in $libpth $xlibpth; do
4929   test -d $thisdir && libspath="$libspath $thisdir"
4930 done
4931 for thislib in $libswanted; do
4932         for thisdir in $libspath; do
4933             xxx=''
4934             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4935                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4936                 $test -f "$xxx" && eval $libscheck
4937                 $test -f "$xxx" && libstyle=shared
4938             fi
4939             if test ! -f "$xxx"; then
4940                 xxx=$thisdir/lib$thislib.$so
4941                 $test -f "$xxx" && eval $libscheck
4942                 $test -f "$xxx" && libstyle=shared
4943             fi
4944             if test ! -f "$xxx"; then
4945                 xxx=$thisdir/lib$thislib$_a
4946                 $test -f "$xxx" && eval $libscheck
4947                 $test -f "$xxx" && libstyle=static
4948             fi
4949             if test ! -f "$xxx"; then
4950                 xxx=$thisdir/$thislib$_a
4951                 $test -f "$xxx" && eval $libscheck
4952                 $test -f "$xxx" && libstyle=static
4953             fi
4954             if test ! -f "$xxx"; then
4955                 xxx=$thisdir/lib${thislib}_s$_a
4956                 $test -f "$xxx" && eval $libscheck
4957                 $test -f "$xxx" && libstyle=static
4958                 $test -f "$xxx" && thislib=${thislib}_s
4959             fi
4960             if test ! -f "$xxx"; then
4961                 xxx=$thisdir/Slib$thislib$_a
4962                 $test -f "$xxx" && eval $libscheck
4963                 $test -f "$xxx" && libstyle=static
4964             fi
4965             if $test -f "$xxx"; then
4966                 case "$libstyle" in
4967                 shared) echo "Found -l$thislib (shared)." ;;
4968                 static) echo "Found -l$thislib." ;;
4969                 *)      echo "Found -l$thislib ($libstyle)." ;;
4970                 esac
4971                 case " $dflt " in
4972                 *"-l$thislib "*);;
4973                 *) dflt="$dflt -l$thislib"
4974                    libsfound="$libsfound $xxx"
4975                    yyy=`basename $xxx`
4976                    libsfiles="$libsfiles $yyy"
4977                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4978                    case " $libsdirs " in
4979                    *" $yyy "*) ;;
4980                    *) libsdirs="$libsdirs $yyy" ;;
4981                    esac
4982                    ;;
4983                 esac
4984                 break
4985             fi
4986         done
4987         if $test ! -f "$xxx"; then
4988             echo "No -l$thislib."
4989         fi
4990 done
4991 set X $dflt
4992 shift
4993 dflt="$*"
4994 case "$libs" in
4995 '') dflt="$dflt";;
4996 *) dflt="$libs";;
4997 esac
4998 case "$dflt" in
4999 ' '|'') dflt='none';;
5000 esac
5001
5002 $cat <<EOM
5003
5004 In order to compile $package on your machine, a number of libraries
5005 are usually needed.  Include any other special libraries here as well.
5006 Say "none" for none.  The default list is almost always right.
5007 EOM
5008
5009 echo " "
5010 rp="What libraries to use?"
5011 . ./myread
5012 case "$ans" in
5013 none) libs=' ';;
5014 *) libs="$ans";;
5015 esac
5016
5017 : determine optimization, if desired, or use for debug flag also
5018 case "$optimize" in
5019 ' '|$undef) dflt='none';;
5020 '') dflt='-O';;
5021 *) dflt="$optimize";;
5022 esac
5023 $cat <<EOH
5024
5025 By default, $package compiles with the -O flag to use the optimizer.
5026 Alternately, you might want to use the symbolic debugger, which uses
5027 the -g flag (on traditional Unix systems).  Either flag can be
5028 specified here.  To use neither flag, specify the word "none".
5029
5030 EOH
5031 rp="What optimizer/debugger flag should be used?"
5032 . ./myread
5033 optimize="$ans"
5034 case "$optimize" in
5035 'none') optimize=" ";;
5036 esac
5037
5038 : Check what DEBUGGING is required from the command line
5039 : -DEBUGGING      or -DDEBUGGING or
5040 : -DEBUGGING=both                       = -g + -DDEBUGGING
5041 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5042 : -DEBUGGING=none or -UDEBUGGING        =
5043 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5044 case "$EBUGGING" in
5045 '')     ;;
5046 *)      DEBUGGING=$EBUGGING ;;
5047 esac
5048
5049 case "$DEBUGGING" in
5050 -g|both|$define)
5051     case "$optimize" in
5052         *-g*) ;;
5053         *)    optimize="$optimize -g" ;;
5054     esac ;;
5055 none|$undef)
5056     case "$optimize" in
5057         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5058                 shift
5059                 optimize="$*"
5060                 ;;
5061     esac ;;
5062 esac
5063
5064 dflt=''
5065 case "$DEBUGGING" in
5066 both|$define) dflt='-DDEBUGGING'
5067 esac
5068
5069 : argument order is deliberate, as the flag will start with - which set could
5070 : think is an option
5071 checkccflag='check=$1; flag=$2; callback=$3;
5072 echo " ";
5073 echo "Checking if your compiler accepts $flag" 2>&1;
5074 echo "int main(void) { return 0; }" > gcctest.c;
5075 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5076     echo "Yes, it does." 2>&1;
5077     if $test -s gcctest.out ; then
5078         echo "But your platform does not like it:";
5079         cat gcctest.out;
5080     else
5081         case "$ccflags" in
5082         *$check*)
5083             echo "Leaving current flags $ccflags alone." 2>&1
5084             ;;
5085         *) dflt="$dflt $flag";
5086             eval $callback
5087             ;;
5088         esac
5089     fi
5090 else
5091     echo "Nope, it does not, but that is ok." 2>&1;
5092 fi
5093 '
5094
5095 : We will not override a previous value, but we might want to
5096 : augment a hint file
5097 case "$hint" in
5098 default|recommended)
5099         case "$gccversion" in
5100         1*) dflt="$dflt -fpcc-struct-return" ;;
5101         esac
5102         case "$optimize:$DEBUGGING" in
5103         *-g*:old) dflt="$dflt -DDEBUGGING";;
5104         esac
5105         case "$gccversion" in
5106         2*) if $test -d /etc/conf/kconfig.d &&
5107                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5108                 then
5109                         # Interactive Systems (ISC) POSIX mode.
5110                         dflt="$dflt -posix"
5111                 fi
5112                 ;;
5113         esac
5114         case "$gccversion" in
5115         1*) ;;
5116         2.[0-8]*) ;;
5117         ?*)     set strict-aliasing -fno-strict-aliasing
5118                 eval $checkccflag
5119                 ;;
5120         esac
5121         # For gcc, adding -pipe speeds up compilations for some, but apparently
5122         # some assemblers can't read from stdin.  (It also slows down compilations
5123         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5124         case "$gccversion" in
5125         ?*)     set pipe -pipe
5126                 eval $checkccflag
5127                 ;;
5128         esac
5129
5130         # on x86_64 (at least) we require an extra library (libssp) in the
5131         # link command line. This library is not named, so I infer that it is
5132         # an implementation detail that may change. Hence the safest approach
5133         # is to add the flag to the flags passed to the compiler at link time,
5134         # as that way the compiler can do the right implementation dependant
5135         # thing. (NWC)
5136         case "$gccversion" in
5137         ?*)     set stack-protector -fstack-protector
5138                 eval $checkccflag
5139                 ;;
5140         esac
5141         ;;
5142 esac
5143
5144 case "$mips_type" in
5145 *BSD*|'') inclwanted="$locincpth $usrinc";;
5146 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5147 esac
5148 for thisincl in $inclwanted; do
5149         if $test -d $thisincl; then
5150                 if $test x$thisincl != x$usrinc; then
5151                         case "$dflt" in
5152                         *" -I$thisincl "*);;
5153                         *) dflt="$dflt -I$thisincl ";;
5154                         esac
5155                 fi
5156         fi
5157 done
5158
5159 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5160         xxx=true;
5161 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5162         xxx=true;
5163 else
5164         xxx=false;
5165 fi;
5166 if $xxx; then
5167         case "$dflt" in
5168         *$2*);;
5169         *) dflt="$dflt -D$2";;
5170         esac;
5171 fi'
5172
5173 set signal.h LANGUAGE_C; eval $inctest
5174
5175 case "$usesocks" in
5176 $define)
5177         ccflags="$ccflags -DSOCKS"
5178         ;;
5179 esac
5180
5181 case "$hint" in
5182 default|recommended) dflt="$ccflags $dflt" ;;
5183 *) dflt="$ccflags";;
5184 esac
5185
5186 case "$dflt" in
5187 ''|' ') dflt=none;;
5188 esac
5189
5190 $cat <<EOH
5191
5192 Your C compiler may want other flags.  For this question you should include
5193 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5194 but you should NOT include libraries or ld flags like -lwhatever.  If you
5195 want $package to honor its debug switch, you should include -DDEBUGGING here.
5196 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5197
5198 To use no flags, specify the word "none".
5199
5200 EOH
5201 set X $dflt
5202 shift
5203 dflt=${1+"$@"}
5204 rp="Any additional cc flags?"
5205 . ./myread
5206 case "$ans" in
5207 none) ccflags='';;
5208 *) ccflags="$ans";;
5209 esac
5210
5211 : the following weeds options from ccflags that are of no interest to cpp
5212 case "$cppflags" in
5213 '') cppflags="$ccflags" ;;
5214 *)  cppflags="$cppflags $ccflags" ;;
5215 esac
5216 case "$gccversion" in
5217 1*) cppflags="$cppflags -D__GNUC__"
5218 esac
5219 case "$mips_type" in
5220 '');;
5221 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5222 esac
5223 case "$cppflags" in
5224 '');;
5225 *)
5226         echo " "
5227         echo "Let me guess what the preprocessor flags are..." >&4
5228         set X $cppflags
5229         shift
5230         cppflags=''
5231         $cat >cpp.c <<'EOM'
5232 #define BLURFL foo
5233
5234 BLURFL xx LFRULB
5235 EOM
5236         previous=''
5237         for flag in $*
5238         do
5239                 case "$flag" in
5240                 -*) ftry="$flag";;
5241                 *) ftry="$previous $flag";;
5242                 esac
5243                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5244                         >cpp1.out 2>/dev/null && \
5245                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5246                         >cpp2.out 2>/dev/null && \
5247                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5248                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5249                 then
5250                         cppflags="$cppflags $ftry"
5251                         previous=''
5252                 else
5253                         previous="$flag"
5254                 fi
5255         done
5256         set X $cppflags
5257         shift
5258         cppflags=${1+"$@"}
5259         case "$cppflags" in
5260         *-*)  echo "They appear to be: $cppflags";;
5261         esac
5262         $rm -f cpp.c cpp?.out
5263         ;;
5264 esac
5265
5266 : flags used in final linking phase
5267 case "$ldflags" in
5268 '') if ./venix; then
5269                 dflt='-i -z'
5270         else
5271                 dflt=''
5272         fi
5273         case "$ccflags" in
5274         *-posix*) dflt="$dflt -posix" ;;
5275         esac
5276         ;;
5277 *) dflt="$ldflags";;
5278 esac
5279 # See note above about -fstack-protector
5280 case "$ccflags" in
5281 *-fstack-protector*) 
5282         case "$dflt" in
5283         *-fstack-protector*) ;; # Don't add it again
5284         *) dflt="$dflt -fstack-protector" ;; 
5285         esac
5286         ;;
5287 esac
5288
5289 : Try to guess additional flags to pick up local libraries.
5290 for thislibdir in $libpth; do
5291         case " $loclibpth " in
5292         *" $thislibdir "*)
5293                 case "$dflt " in
5294                 *"-L$thislibdir "*) ;;
5295                 *)  dflt="$dflt -L$thislibdir" ;;
5296                 esac
5297                 ;;
5298         esac
5299 done
5300
5301 case "$dflt" in
5302 '') dflt='none' ;;
5303 esac
5304
5305 $cat <<EOH
5306
5307 Your C linker may need flags.  For this question you should
5308 include -L/whatever and any other flags used by the C linker, but you
5309 should NOT include libraries like -lwhatever.
5310
5311 Make sure you include the appropriate -L/path flags if your C linker
5312 does not normally search all of the directories you specified above,
5313 namely
5314         $libpth
5315 To use no flags, specify the word "none".
5316
5317 EOH
5318
5319 rp="Any additional ld flags (NOT including libraries)?"
5320 . ./myread
5321 case "$ans" in
5322 none) ldflags='';;
5323 *) ldflags="$ans";;
5324 esac
5325 rmlist="$rmlist pdp11"
5326
5327 : coherency check
5328 echo " "
5329 echo "Checking your choice of C compiler and flags for coherency..." >&4
5330 $cat > try.c <<'EOF'
5331 #include <stdio.h>
5332 int main() { printf("Ok\n"); return(0); }
5333 EOF
5334 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5335 shift
5336 $cat >try.msg <<'EOM'
5337 I've tried to compile and run the following simple program:
5338
5339 EOM
5340 $cat try.c >> try.msg
5341
5342 $cat >> try.msg <<EOM
5343
5344 I used the command:
5345
5346         $*
5347         $run ./try
5348
5349 and I got the following output:
5350
5351 EOM
5352 dflt=y
5353 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5354         if $sh -c "$run ./try " >>try.msg 2>&1; then
5355                 xxx=`$run ./try`
5356                 case "$xxx" in
5357                 "Ok") dflt=n ;;
5358                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5359                         case " $libs " in
5360                         *" -lsfio "*)
5361                                 cat >> try.msg <<'EOQS'
5362 If $libs contains -lsfio, and sfio is mis-configured, then it
5363 sometimes (apparently) runs and exits with a 0 status, but with no
5364 output!  It may have to do with sfio's use of _exit vs. exit.
5365
5366 EOQS
5367                                 rp="You have a big problem.  Shall I abort Configure"
5368                                 dflt=y
5369                                 ;;
5370                         esac
5371                         ;;
5372                 esac
5373         else
5374                 echo "The program compiled OK, but exited with status $?." >>try.msg
5375                 rp="You have a problem.  Shall I abort Configure"
5376                 dflt=y
5377         fi
5378 else
5379         echo "I can't compile the test program." >>try.msg
5380         rp="You have a BIG problem.  Shall I abort Configure"
5381         dflt=y
5382 fi
5383 case "$dflt" in
5384 y)
5385         $cat try.msg >&4
5386         case "$knowitall" in
5387         '')
5388                 echo "(The supplied flags or libraries might be incorrect.)"
5389                 ;;
5390         *) dflt=n;;
5391         esac
5392         echo " "
5393         . ./myread
5394         case "$ans" in
5395         n*|N*) ;;
5396         *)      echo "Ok.  Stopping Configure." >&4
5397                 exit 1
5398                 ;;
5399         esac
5400         ;;
5401 n) echo "OK, that should do.";;
5402 esac
5403 $rm_try gcctest gcctest.out
5404
5405 : define a shorthand compile call
5406 compile='
5407 mc_file=$1;
5408 shift;
5409 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5410 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5411 exit 1;
5412 fi;
5413 esac;
5414 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5415 : define a shorthand compile call for compilations that should be ok.
5416 compile_ok='
5417 mc_file=$1;
5418 shift;
5419 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5420
5421 : determine filename position in cpp output
5422 echo " "
5423 echo "Computing filename position in cpp output for #include directives..." >&4
5424 case "$osname" in
5425 vos) testaccess=-e ;;
5426 *)   testaccess=-r ;;
5427 esac
5428 echo '#include <stdio.h>' > foo.c
5429 $cat >fieldn <<EOF
5430 $startsh
5431 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5432 $grep '^[       ]*#.*stdio\.h' | \
5433 while read cline; do
5434         pos=1
5435         set \$cline
5436         while $test \$# -gt 0; do
5437                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5438                         echo "\$pos"
5439                         exit 0
5440                 fi
5441                 shift
5442                 pos=\`expr \$pos + 1\`
5443         done
5444 done
5445 EOF
5446 chmod +x fieldn
5447 fieldn=`./fieldn`
5448 $rm -f foo.c fieldn
5449 case $fieldn in
5450 '') pos='???';;
5451 1) pos=first;;
5452 2) pos=second;;
5453 3) pos=third;;
5454 *) pos="${fieldn}th";;
5455 esac
5456 echo "Your cpp writes the filename in the $pos field of the line."
5457
5458 case "$osname" in
5459 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5460 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5461 *)   cppfilter='' ;;
5462 esac
5463 : locate header file
5464 $cat >findhdr <<EOF
5465 $startsh
5466 wanted=\$1
5467 name=''
5468 for usrincdir in $usrinc
5469 do
5470         if test -f \$usrincdir/\$wanted; then
5471                 echo "\$usrincdir/\$wanted"
5472                 exit 0
5473         fi
5474 done
5475 awkprg='{ print \$$fieldn }'
5476 echo "#include <\$wanted>" > foo\$\$.c
5477 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5478 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5479 while read cline; do
5480         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5481         case "\$name" in
5482         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5483         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5484         *) exit 2;;
5485         esac;
5486 done;
5487 #
5488 # status = 0: grep returned 0 lines, case statement not executed
5489 # status = 1: headerfile found
5490 # status = 2: while loop executed, no headerfile found
5491 #
5492 status=\$?
5493 $rm -f foo\$\$.c;
5494 if test \$status -eq 1; then
5495         exit 0;
5496 fi
5497 exit 1
5498 EOF
5499 chmod +x findhdr
5500
5501 : define an alternate in-header-list? function
5502 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5503 cont=true; xxf="echo \"<\$1> found.\" >&4";
5504 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5505 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5506 esac;
5507 case $# in 4) instead=instead;; *) instead="at last";; esac;
5508 while $test "$cont"; do
5509         xxx=`./findhdr $1`
5510         var=$2; eval "was=\$$2";
5511         if $test "$xxx" && $test -r "$xxx";
5512         then eval $xxf;
5513         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5514                 cont="";
5515         else eval $xxnf;
5516         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5517         set $yyy; shift; shift; yyy=$@;
5518         case $# in 0) cont="";;
5519         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5520                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5521         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5522                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5523         esac;
5524 done;
5525 while $test "$yyy";
5526 do set $yyy; var=$2; eval "was=\$$2";
5527         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5528         set $yyy; shift; shift; yyy=$@;
5529 done'
5530
5531 : see if stdlib is available
5532 set stdlib.h i_stdlib
5533 eval $inhdr
5534
5535 : check for lengths of integral types
5536 echo " "
5537 case "$intsize" in
5538 '')
5539         echo "Checking to see how big your integers are..." >&4
5540         $cat >try.c <<EOCP
5541 #include <stdio.h>
5542 #$i_stdlib I_STDLIB
5543 #ifdef I_STDLIB
5544 #include <stdlib.h>
5545 #endif
5546 int main()
5547 {
5548         printf("intsize=%d;\n", (int)sizeof(int));
5549         printf("longsize=%d;\n", (int)sizeof(long));
5550         printf("shortsize=%d;\n", (int)sizeof(short));
5551         exit(0);
5552 }
5553 EOCP
5554         set try
5555         if eval $compile_ok && $run ./try > /dev/null; then
5556                 eval `$run ./try`
5557                 echo "Your integers are $intsize bytes long."
5558                 echo "Your long integers are $longsize bytes long."
5559                 echo "Your short integers are $shortsize bytes long."
5560         else
5561                 $cat >&4 <<EOM
5562 !
5563 Help! I can't compile and run the intsize test program: please enlighten me!
5564 (This is probably a misconfiguration in your system or libraries, and
5565 you really ought to fix it.  Still, I'll try anyway.)
5566 !
5567 EOM
5568                 dflt=4
5569                 rp="What is the size of an integer (in bytes)?"
5570                 . ./myread
5571                 intsize="$ans"
5572                 dflt=$intsize
5573                 rp="What is the size of a long integer (in bytes)?"
5574                 . ./myread
5575                 longsize="$ans"
5576                 dflt=2
5577                 rp="What is the size of a short integer (in bytes)?"
5578                 . ./myread
5579                 shortsize="$ans"
5580         fi
5581         ;;
5582 esac
5583 $rm_try
5584
5585 : check for long long
5586 echo " "
5587 echo "Checking to see if you have long long..." >&4
5588 echo 'int main() { long long x = 7; return 0; }' > try.c
5589 set try
5590 if eval $compile; then
5591         val="$define"
5592         echo "You have long long."
5593 else
5594         val="$undef"
5595         echo "You do not have long long."
5596 fi
5597 $rm_try
5598 set d_longlong
5599 eval $setvar
5600
5601 : check for length of long long
5602 case "${d_longlong}${longlongsize}" in
5603 $define)
5604         echo " "
5605         echo "Checking to see how big your long longs are..." >&4
5606         $cat >try.c <<'EOCP'
5607 #include <stdio.h>
5608 int main()
5609 {
5610     printf("%d\n", (int)sizeof(long long));
5611     return(0);
5612 }
5613 EOCP
5614         set try
5615         if eval $compile_ok; then
5616                 longlongsize=`$run ./try`
5617                 echo "Your long longs are $longlongsize bytes long."
5618         else
5619                 dflt='8'
5620                 echo " "
5621                 echo "(I can't seem to compile the test program.  Guessing...)"
5622                 rp="What is the size of a long long (in bytes)?"
5623                 . ./myread
5624                 longlongsize="$ans"
5625         fi
5626         if $test "X$longsize" = "X$longlongsize"; then
5627                 echo "(That isn't any different from an ordinary long.)"
5628         fi
5629         ;;
5630 esac
5631 $rm_try
5632
5633 : see if inttypes.h is available
5634 : we want a real compile instead of Inhdr because some systems
5635 : have an inttypes.h which includes non-existent headers
5636 echo " "
5637 $cat >try.c <<EOCP
5638 #include <inttypes.h>
5639 int main() {
5640         static int32_t foo32 = 0x12345678;
5641 }
5642 EOCP
5643 set try
5644 if eval $compile; then
5645         echo "<inttypes.h> found." >&4
5646         val="$define"
5647 else
5648         echo "<inttypes.h> NOT found." >&4
5649         val="$undef"
5650 fi
5651 $rm_try
5652 set i_inttypes
5653 eval $setvar
5654
5655 : check for int64_t
5656 echo " "
5657 echo "Checking to see if you have int64_t..." >&4
5658 $cat >try.c <<EOCP
5659 #include <sys/types.h>
5660 #$i_inttypes I_INTTYPES
5661 #ifdef I_INTTYPES
5662 #include <inttypes.h>
5663 #endif
5664 int main() { int64_t x = 7; }
5665 EOCP
5666 set try
5667 if eval $compile; then
5668         val="$define"
5669         echo "You have int64_t."
5670 else
5671         val="$undef"
5672         echo "You do not have int64_t."
5673 fi
5674 $rm_try
5675 set d_int64_t
5676 eval $setvar
5677
5678 : Check if 64bit ints have a quad type
5679 echo " "
5680 echo "Checking which 64-bit integer type we could use..." >&4
5681
5682 case "$intsize" in
5683 8) val=int
5684    set quadtype
5685    eval $setvar
5686    val='"unsigned int"'
5687    set uquadtype
5688    eval $setvar
5689    quadkind=1
5690    ;;
5691 *) case "$longsize" in
5692    8) val=long
5693       set quadtype
5694       eval $setvar
5695       val='"unsigned long"'
5696       set uquadtype
5697       eval $setvar
5698       quadkind=2
5699       ;;
5700    *) case "$d_longlong:$longlongsize" in
5701       define:8)
5702         val='"long long"'
5703         set quadtype
5704         eval $setvar
5705         val='"unsigned long long"'
5706         set uquadtype
5707         eval $setvar
5708         quadkind=3
5709         ;;
5710       *) case "$d_int64_t" in
5711          define)
5712            val=int64_t
5713            set quadtype
5714            eval $setvar
5715            val=uint64_t
5716            set uquadtype
5717            eval $setvar
5718            quadkind=4
5719            ;;
5720          esac
5721          ;;
5722       esac
5723       ;;
5724    esac
5725    ;;
5726 esac
5727
5728 case "$quadtype" in
5729 '')     echo "Alas, no 64-bit integer types in sight." >&4
5730         d_quad="$undef"
5731         ;;
5732 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5733         d_quad="$define"
5734         ;;
5735 esac
5736
5737 : Do we want 64bit support
5738 case "$uselonglong" in
5739 "$define"|true|[yY]*)
5740         cat <<EOM >&4
5741
5742 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5743 EOM
5744         use64bitint="$define"
5745         ;;
5746 esac
5747 case "$use64bits" in
5748 "$define"|true|[yY]*)
5749         cat <<EOM >&4
5750
5751 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5752 EOM
5753         use64bitint="$define"
5754         ;;
5755 esac
5756 case "$use64bitints" in
5757 "$define"|true|[yY]*)
5758         cat <<EOM >&4
5759
5760 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5761 EOM
5762         use64bitint="$define"
5763         ;;
5764 esac
5765 case "$use64bitsint" in
5766 "$define"|true|[yY]*)
5767         cat <<EOM >&4
5768
5769 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5770 EOM
5771         use64bitint="$define"
5772         ;;
5773 esac
5774 case "$uselonglongs" in
5775 "$define"|true|[yY]*)
5776         cat <<EOM >&4
5777
5778 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5779 EOM
5780         use64bitint="$define"
5781         ;;
5782 esac
5783 case "$use64bitsall" in
5784 "$define"|true|[yY]*)
5785         cat <<EOM >&4
5786
5787 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5788 EOM
5789         use64bitall="$define"
5790         ;;
5791 esac
5792
5793 case "$ccflags" in
5794 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5795 esac
5796 case "$use64bitall" in
5797 "$define"|true|[yY]*) use64bitint="$define" ;;
5798 esac
5799
5800 case "$longsize" in
5801 8) cat <<EOM
5802
5803 You have natively 64-bit long integers.
5804 EOM
5805    val="$define"
5806    ;;
5807 *) case "$use64bitint" in
5808    "$define"|true|[yY]*) dflt='y';;
5809    *) dflt='n';;
5810    esac
5811    case "$d_quad" in
5812    "$define") ;;
5813    *) dflt='n' ;;
5814    esac
5815    cat <<EOM
5816
5817 Perl can be built to take advantage of 64-bit integer types
5818 on some systems.  To do so, Configure can be run with -Duse64bitint.
5819 Choosing this option will most probably introduce binary incompatibilities.
5820
5821 If this doesn't make any sense to you, just accept the default '$dflt'.
5822 (The default has been chosen based on your configuration.)
5823 EOM
5824    rp='Try to use 64-bit integers, if available?'
5825    . ./myread
5826    case "$ans" in
5827    [yY]*) val="$define" ;;
5828    *)     val="$undef"  ;;
5829    esac
5830    ;;
5831 esac
5832 set use64bitint
5833 eval $setvar
5834
5835 case "$use64bitall" in
5836 "$define"|true|[yY]*) dflt='y' ;;
5837 *) case "$longsize" in
5838    8) dflt='y' ;;
5839    *) dflt='n' ;;
5840    esac
5841    ;;
5842 esac
5843 cat <<EOM
5844
5845 You may also choose to try maximal 64-bitness.  It means using as much
5846 64-bitness as possible on the platform.  This in turn means even more
5847 binary incompatibilities.  On the other hand, your platform may not
5848 have any more 64-bitness available than what you already have chosen.
5849
5850 If this doesn't make any sense to you, just accept the default '$dflt'.
5851 (The default has been chosen based on your configuration.)
5852 EOM
5853 rp='Try to use maximal 64-bit support, if available?'
5854 . ./myread
5855 case "$ans" in
5856 [yY]*) val="$define" ;;
5857 *)     val="$undef"  ;;
5858 esac
5859 set use64bitall
5860 eval $setvar
5861 case "$use64bitall" in
5862 "$define")
5863         case "$use64bitint" in
5864         "$undef")
5865                 cat <<EOM
5866
5867 Since you have chosen a maximally 64-bit build, I'm also turning on
5868 the use of 64-bit integers.
5869 EOM
5870                 use64bitint="$define" ;;
5871         esac
5872         ;;
5873 esac
5874
5875 : Look for a hint-file generated 'call-back-unit'.  If the
5876 : user has specified that a 64-bit perl is to be built,
5877 : we may need to set or change some other defaults.
5878 if $test -f use64bitint.cbu; then
5879         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5880         . ./use64bitint.cbu
5881 fi
5882 case "$use64bitint" in
5883 "$define"|true|[yY]*)
5884         case "$longsize" in
5885         4) case "$archname64" in
5886            '') archname64=64int ;;
5887            esac
5888            ;;
5889         esac
5890         ;;
5891 esac
5892
5893 : Look for a hint-file generated 'call-back-unit'.  If the
5894 : user has specified that a maximally 64-bit perl is to be built,
5895 : we may need to set or change some other defaults.
5896 if $test -f use64bitall.cbu; then
5897         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5898         . ./use64bitall.cbu
5899 fi
5900 case "$use64bitall" in
5901 "$define"|true|[yY]*)
5902         case "$longsize" in
5903         4) case "$archname64" in
5904            ''|64int) archname64=64all ;;
5905            esac
5906            ;;
5907         esac
5908         ;;
5909 esac
5910
5911 case "$d_quad:$use64bitint" in
5912 $undef:$define)
5913         cat >&4 <<EOF
5914
5915 *** You have chosen to use 64-bit integers,
5916 *** but none can be found.
5917 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5918 *** Cannot continue, aborting.
5919
5920 EOF
5921         exit 1
5922         ;;
5923 esac
5924
5925 : check for length of double
5926 echo " "
5927 case "$doublesize" in
5928 '')
5929         echo "Checking to see how big your double precision numbers are..." >&4
5930         $cat >try.c <<EOCP
5931 #include <stdio.h>
5932 #$i_stdlib I_STDLIB
5933 #ifdef I_STDLIB
5934 #include <stdlib.h>
5935 #endif
5936 int main()
5937 {
5938     printf("%d\n", (int)sizeof(double));
5939     exit(0);
5940 }
5941 EOCP
5942         set try
5943         if eval $compile_ok; then
5944                 doublesize=`$run ./try`
5945                 echo "Your double is $doublesize bytes long."
5946         else
5947                 dflt='8'
5948                 echo "(I can't seem to compile the test program.  Guessing...)"
5949                 rp="What is the size of a double precision number (in bytes)?"
5950                 . ./myread
5951                 doublesize="$ans"
5952         fi
5953         ;;
5954 esac
5955 $rm_try
5956
5957 : check for long doubles
5958 echo " "
5959 echo "Checking to see if you have long double..." >&4
5960 echo 'int main() { long double x = 7.0; }' > try.c
5961 set try
5962 if eval $compile; then
5963         val="$define"
5964         echo "You have long double."
5965 else
5966         val="$undef"
5967         echo "You do not have long double."
5968 fi
5969 $rm_try
5970 set d_longdbl
5971 eval $setvar
5972
5973 : check for length of long double
5974 case "${d_longdbl}${longdblsize}" in
5975 $define)
5976         echo " "
5977         echo "Checking to see how big your long doubles are..." >&4
5978         $cat >try.c <<'EOCP'
5979 #include <stdio.h>
5980 int main()
5981 {
5982         printf("%d\n", sizeof(long double));
5983 }
5984 EOCP
5985         set try
5986         set try
5987         if eval $compile; then
5988                 longdblsize=`$run ./try`
5989                 echo "Your long doubles are $longdblsize bytes long."
5990         else
5991                 dflt='8'
5992                 echo " "
5993                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5994                 rp="What is the size of a long double (in bytes)?"
5995                 . ./myread
5996                 longdblsize="$ans"
5997         fi
5998         if $test "X$doublesize" = "X$longdblsize"; then
5999                 echo "That isn't any different from an ordinary double."
6000                 echo "I'll keep your setting anyway, but you may see some"
6001                 echo "harmless compilation warnings."
6002         fi
6003         ;;
6004 esac
6005 $rm_try
6006
6007 : determine the architecture name
6008 echo " "
6009 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6010         tarch=`arch`"-$osname"
6011 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6012         if uname -m > tmparch 2>&1 ; then
6013                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6014                         -e 's/$/'"-$osname/" tmparch`
6015         else
6016                 tarch="$osname"
6017         fi
6018         $rm -f tmparch
6019 else
6020         tarch="$osname"
6021 fi
6022 case "$myarchname" in
6023 ''|"$tarch") ;;
6024 *)
6025         echo "(Your architecture name used to be $myarchname.)"
6026         archname=''
6027         ;;
6028 esac
6029 case "$targetarch" in
6030 '') ;;
6031 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6032 esac
6033 myarchname="$tarch"
6034 case "$archname" in
6035 '') dflt="$tarch";;
6036 *) dflt="$archname";;
6037 esac
6038 rp='What is your architecture name'
6039 . ./myread
6040 archname="$ans"
6041 case "$usethreads" in
6042 $define)
6043         echo "Threads selected." >&4
6044         case "$archname" in
6045         *-thread*) echo "...and architecture name already has -thread." >&4
6046                 ;;
6047         *)      archname="$archname-thread"
6048                 echo "...setting architecture name to $archname." >&4
6049                 ;;
6050         esac
6051         ;;
6052 esac
6053 case "$usemultiplicity" in
6054 $define)
6055         echo "Multiplicity selected." >&4
6056         case "$archname" in
6057         *-multi*) echo "...and architecture name already has -multi." >&4
6058                 ;;
6059         *)      archname="$archname-multi"
6060                 echo "...setting architecture name to $archname." >&4
6061                 ;;
6062         esac
6063         ;;
6064 esac
6065 case "$use64bitint$use64bitall" in
6066 *"$define"*)
6067         case "$archname64" in
6068         '')
6069                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6070                 ;;
6071         *)
6072                 case "$use64bitint" in
6073                 "$define") echo "64 bit integers selected." >&4 ;;
6074                 esac
6075                 case "$use64bitall" in
6076                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6077                 esac
6078                 case "$archname" in
6079                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6080                         ;;
6081                 *)      archname="$archname-$archname64"
6082                         echo "...setting architecture name to $archname." >&4
6083                         ;;
6084                 esac
6085                 ;;
6086         esac
6087 esac
6088 case "$uselongdouble" in
6089 $define)
6090         echo "Long doubles selected." >&4
6091         case "$longdblsize" in
6092         $doublesize)
6093                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6094                 ;;
6095         *)
6096                 case "$archname" in
6097                 *-ld*) echo "...and architecture name already has -ld." >&4
6098                         ;;
6099                 *)      archname="$archname-ld"
6100                         echo "...setting architecture name to $archname." >&4
6101                         ;;
6102                 esac
6103                 ;;
6104         esac
6105         ;;
6106 esac
6107 case "$useperlio" in
6108 $define)
6109         echo "Perlio selected." >&4
6110         ;;
6111 *)
6112         echo "Perlio not selected, using stdio." >&4
6113         case "$archname" in
6114         *-stdio*) echo "...and architecture name already has -stdio." >&4
6115                 ;;
6116         *)      archname="$archname-stdio"
6117                 echo "...setting architecture name to $archname." >&4
6118                 ;;
6119         esac
6120         ;;
6121 esac
6122 if $test -f archname.cbu; then
6123         echo "Your platform has some specific hints for architecture name, using them..."
6124         . ./archname.cbu
6125 fi
6126
6127 : set the prefixit variable, to compute a suitable default value
6128 prefixit='case "$3" in
6129 ""|none)
6130         case "$oldprefix" in
6131         "") eval "$1=\"\$$2\"";;
6132         *)
6133                 case "$3" in
6134                 "") eval "$1=";;
6135                 none)
6136                         eval "tp=\"\$$2\"";
6137                         case "$tp" in
6138                         ""|" ") eval "$1=\"\$$2\"";;
6139                         *) eval "$1=";;
6140                         esac;;
6141                 esac;;
6142         esac;;
6143 *)
6144         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6145         case "$tp" in
6146         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6147         /*-$oldprefix/*|\~*-$oldprefix/*)
6148                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6149         *) eval "$1=\"\$$2\"";;
6150         esac;;
6151 esac'
6152
6153 : determine installation style
6154 : For now, try to deduce it from prefix unless it is already set.
6155 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6156 case "$installstyle" in
6157 '')     case "$prefix" in
6158                 *perl*) dflt='lib';;
6159                 *) dflt='lib/perl5' ;;
6160         esac
6161         ;;
6162 *)      dflt="$installstyle" ;;
6163 esac
6164 : Probably not worth prompting for this since we prompt for all
6165 : the directories individually, and the prompt would be too long and
6166 : confusing anyway.
6167 installstyle=$dflt
6168
6169 : determine where public executables go
6170 echo " "
6171 set dflt bin bin
6172 eval $prefixit
6173 fn=d~
6174 rp='Pathname where the public executables will reside?'
6175 . ./getfile
6176 if $test "X$ansexp" != "X$binexp"; then
6177         installbin=''
6178 fi
6179 prefixvar=bin
6180 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6181 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6182 :     this via initialinstalllocation
6183 . ./setprefixvar
6184
6185 case "$userelocatableinc" in
6186 $define|true|[yY]*)     dflt='y' ;;
6187 *)                      dflt='n' ;;
6188 esac
6189 cat <<EOM
6190
6191 Would you like to build Perl so that the installation is relocatable, so that
6192 library paths in @INC are determined relative to the path of the perl binary?
6193 This is not advised for system Perl installs, or if you need to run setid
6194 scripts or scripts under taint mode.
6195
6196 If this doesn't make any sense to you, just accept the default '$dflt'.
6197 EOM
6198 rp='Use relocatable @INC?'
6199 . ./myread
6200 case "$ans" in
6201 y|Y)    val="$define" ;;
6202 *)      val="$undef"  ;;
6203 esac
6204 set userelocatableinc
6205 eval $setvar
6206
6207 initialinstalllocation="$binexp"
6208 : Default prefix is now "up one level from where the binaries are"
6209 case "$userelocatableinc" in
6210 $define|true|[yY]*)
6211     bin=".../"
6212     binexp=".../"
6213     prefix=".../.."
6214     prefixexp=".../.."
6215     installprefixexp=".../.."
6216     ;;
6217 esac
6218
6219 : determine where private library files go
6220 : Usual default is /usr/local/lib/perl5/$version.
6221 : Also allow things like /opt/perl/lib/$version, since
6222 : /opt/perl/lib/perl5... would be redundant.
6223 : The default "style" setting is made in installstyle.U
6224 case "$installstyle" in
6225 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6226 *)       set dflt privlib lib/$version ;;
6227 esac
6228 eval $prefixit
6229 $cat <<EOM
6230
6231 There are some auxiliary files for $package that need to be put into a
6232 private library directory that is accessible by everyone.
6233
6234 EOM
6235 fn=$binexp
6236 fn=d~+
6237 rp='Pathname where the private library files will reside?'
6238 . ./getfile
6239 prefixvar=privlib
6240 . ./setprefixvar
6241
6242 : set the prefixup variable, to restore leading tilda escape
6243 prefixup='case "$prefixexp" in
6244 "$prefix") ;;
6245 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6246 esac'
6247
6248 : determine where public architecture dependent libraries go
6249 set archlib archlib
6250 eval $prefixit
6251 : privlib default is /usr/local/lib/$package/$version
6252 : archlib default is /usr/local/lib/$package/$version/$archname
6253 : privlib may have an optional trailing /share.
6254 tdflt=`echo $privlib | $sed 's,/share$,,'`
6255 tdflt=$tdflt/$archname
6256 case "$archlib" in
6257 '')     dflt=$tdflt
6258         ;;
6259 *)      dflt="$archlib"
6260     ;;
6261 esac
6262 $cat <<EOM
6263
6264 $spackage contains architecture-dependent library files.  If you are
6265 sharing libraries in a heterogeneous environment, you might store
6266 these files in a separate location.  Otherwise, you can just include
6267 them with the rest of the public library files.
6268
6269 EOM
6270 fn=$binexp
6271 fn=d+~
6272 rp='Where do you want to put the public architecture-dependent libraries?'
6273 . ./getfile
6274 prefixvar=archlib
6275 . ./setprefixvar
6276 if $test X"$archlib" = X"$privlib"; then
6277         d_archlib="$undef"
6278 else
6279         d_archlib="$define"
6280 fi
6281
6282 : see if setuid scripts can be secure
6283 $cat <<EOM
6284
6285 Some kernels have a bug that prevents setuid #! scripts from being
6286 secure.  Some sites have disabled setuid #! scripts because of this.
6287
6288 First let's decide if your kernel supports secure setuid #! scripts.
6289 (If setuid #! scripts would be secure but have been disabled anyway,
6290 don't say that they are secure if asked.)
6291
6292 EOM
6293
6294 val="$undef"
6295 if $test -d /dev/fd; then
6296         echo "#!$ls" >reflect
6297         chmod +x,u+s reflect
6298         ./reflect >flect 2>&1
6299         if $contains "/dev/fd" flect >/dev/null; then
6300                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6301                 val="$define"
6302         else
6303                 $cat <<EOM
6304 If you are not sure if they are secure, I can check but I'll need a
6305 username and password different from the one you are using right now.
6306 If you don't have such a username or don't want me to test, simply
6307 enter 'none'.
6308
6309 EOM
6310                 rp='Other username to test security of setuid scripts with?'
6311                 dflt='none'
6312                 . ./myread
6313                 case "$ans" in
6314                 n|none)
6315                         case "$d_suidsafe" in
6316                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6317                                 dflt=n;;
6318                         "$undef")
6319                                 echo "Well, the $hint value is *not* secure." >&4
6320                                 dflt=n;;
6321                         *)      echo "Well, the $hint value *is* secure." >&4
6322                                 dflt=y;;
6323                         esac
6324                         ;;
6325                 *)
6326                         $rm -f reflect flect
6327                         echo "#!$ls" >reflect
6328                         chmod +x,u+s reflect
6329                         echo >flect
6330                         chmod a+w flect
6331                         echo '"su" will (probably) prompt you for '"$ans's password."
6332                         su $ans -c './reflect >flect'
6333                         if $contains "/dev/fd" flect >/dev/null; then
6334                                 echo "Okay, it looks like setuid scripts are secure." >&4
6335                                 dflt=y
6336                         else
6337                                 echo "I don't think setuid scripts are secure." >&4
6338                                 dflt=n
6339                         fi
6340                         ;;
6341                 esac
6342                 rp='Does your kernel have *secure* setuid scripts?'
6343                 . ./myread
6344                 case "$ans" in
6345                 [yY]*)  val="$define";;
6346                 *)      val="$undef";;
6347                 esac
6348         fi
6349 else
6350         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6351         echo "(That's for file descriptors, not floppy disks.)"
6352         val="$undef"
6353 fi
6354 set d_suidsafe
6355 eval $setvar
6356
6357 $rm -f reflect flect
6358
6359 : now see if they want to do setuid emulation
6360 echo " "
6361 val="$undef"
6362 case "$d_suidsafe" in
6363 "$define")
6364         val="$undef"
6365         echo "No need to emulate SUID scripts since they are secure here." >&4
6366         ;;
6367 *)
6368         $cat <<EOM
6369 Some systems have disabled setuid scripts, especially systems where
6370 setuid scripts cannot be secure.  On systems where setuid scripts have
6371 been disabled, the setuid/setgid bits on scripts are currently
6372 useless.  It is possible for $package to detect those bits and emulate
6373 setuid/setgid in a secure fashion.  This emulation will only work if
6374 setuid scripts have been disabled in your kernel.
6375
6376 EOM
6377         case "$d_dosuid" in
6378         "$define") dflt=y ;;
6379         *) dflt=n ;;
6380         esac
6381         rp="Do you want to do setuid/setgid emulation?"
6382         . ./myread
6383         case "$ans" in
6384         [yY]*)  val="$define";;
6385         *)      val="$undef";;
6386         esac
6387         ;;
6388 esac
6389 set d_dosuid
6390 eval $setvar
6391
6392 : Find perl5.005 or later.
6393 echo "Looking for a previously installed perl5.005 or later... "
6394 case "$perl5" in
6395 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6396                 : Check if this perl is recent and can load a simple module
6397                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6398                         perl5=$tdir/perl
6399                         break;
6400                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6401                         perl5=$tdir/perl5
6402                         break;
6403                 fi
6404         done
6405         ;;
6406 *)      perl5="$perl5"
6407         ;;
6408 esac
6409 case "$perl5" in
6410 '')     echo "None found.  That's ok.";;
6411 *)      echo "Using $perl5." ;;
6412 esac
6413
6414 : Set the siteprefix variables
6415 $cat <<EOM
6416
6417 After $package is installed, you may wish to install various
6418 add-on modules and utilities.  Typically, these add-ons will
6419 be installed under $prefix with the rest
6420 of this package.  However, you may wish to install such add-ons
6421 elsewhere under a different prefix.
6422
6423 If you do not wish to put everything under a single prefix, that's
6424 ok.  You will be prompted for the individual locations; this siteprefix
6425 is only used to suggest the defaults.
6426
6427 The default should be fine for most people.
6428
6429 EOM
6430 fn=d~+
6431 rp='Installation prefix to use for add-on modules and utilities?'
6432 : XXX Here might be another good place for an installstyle setting.
6433 case "$siteprefix" in
6434 '') dflt=$prefix ;;
6435 *)  dflt=$siteprefix ;;
6436 esac
6437 . ./getfile
6438 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6439 oldsiteprefix=''
6440 case "$siteprefix" in
6441 '') ;;
6442 *)      case "$ans" in
6443         "$prefix") ;;
6444         *) oldsiteprefix="$prefix";;
6445         esac
6446         ;;
6447 esac
6448 siteprefix="$ans"
6449 siteprefixexp="$ansexp"
6450
6451 : determine where site specific libraries go.
6452 : Usual default is /usr/local/lib/perl5/site_perl/$version
6453 : The default "style" setting is made in installstyle.U
6454 : XXX No longer works with Prefixit stuff.
6455 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6456 case "$sitelib" in
6457 '') case "$installstyle" in
6458         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6459         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6460         esac
6461         ;;
6462 *)      dflt="$sitelib"
6463         ;;
6464 esac
6465 $cat <<EOM
6466
6467 The installation process will create a directory for
6468 site-specific extensions and modules.  Most users find it convenient
6469 to place all site-specific files in this directory rather than in the
6470 main distribution directory.
6471
6472 EOM
6473 fn=d~+
6474 rp='Pathname for the site-specific library files?'
6475 . ./getfile
6476 prefixvar=sitelib
6477 . ./setprefixvar
6478 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6479
6480 : Determine list of previous versions to include in @INC
6481 $cat > getverlist <<EOPL
6482 #!$perl5 -w
6483 use File::Basename;
6484 \$api_versionstring = "$api_versionstring";
6485 \$version = "$version";
6486 \$stem = "$sitelib_stem";
6487 \$archname = "$archname";
6488 EOPL
6489         $cat >> getverlist <<'EOPL'
6490 # The list found is store twice for each entry: the original name, and
6491 # the binary broken down version as pack "sss", so sorting is easy and
6492 # unambiguous. This will work for all versions that have a maximum of
6493 # three digit groups, separate by '.'s or '_'s. Names are extended with
6494 # ".0.0" to ensure at least three elements for the pack.
6495 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6496
6497 # Can't have leading @ because metaconfig interprets it as a command!
6498 ;@inc_version_list=();
6499 # XXX Redo to do opendir/readdir?
6500 if (-d $stem) {
6501     chdir($stem);
6502     ;@candidates = map {
6503         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6504 }
6505 else {
6506     ;@candidates = ();
6507 }
6508
6509 ($pversion, $aversion, $vsn5005) = map {
6510     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6511 foreach $d (@candidates) {
6512     if ($d->[1] lt $pversion) {
6513         if ($d->[1] ge $aversion) {
6514             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6515         }
6516         elsif ($d->[1] ge $vsn5005) {
6517             unshift(@inc_version_list, grep { -d } $d->[0]);
6518         }
6519     }
6520     else {
6521         # Skip newer version.  I.e. don't look in
6522         # 5.7.0 if we're installing 5.6.1.
6523     }
6524 }
6525
6526 if (@inc_version_list) {
6527     print join(' ', @inc_version_list);
6528 }
6529 else {
6530     # Blank space to preserve value for next Configure run.
6531     print " ";
6532 }
6533 EOPL
6534 chmod +x getverlist
6535 case "$inc_version_list" in
6536 '')     if test -x "$perl5$exe_ext"; then
6537                 dflt=`$perl5 getverlist`
6538         else
6539                 dflt='none'
6540         fi
6541         ;;
6542 $undef) dflt='none' ;;
6543 *)  eval dflt=\"$inc_version_list\" ;;
6544 esac
6545 case "$dflt" in
6546 ''|' ') dflt=none ;;
6547 esac
6548 case "$dflt" in
6549 5.005) dflt=none ;;
6550 esac
6551 $cat <<EOM
6552
6553 In order to ease the process of upgrading, this version of perl
6554 can be configured to use modules built and installed with earlier
6555 versions of perl that were installed under $prefix.  Specify here
6556 the list of earlier versions that this version of perl should check.
6557 If Configure detected no earlier versions of perl installed under
6558 $prefix, then the list will be empty.  Answer 'none' to tell perl
6559 to not search earlier versions.
6560
6561 The default should almost always be sensible, so if you're not sure,
6562 just accept the default.
6563 EOM
6564
6565 rp='List of earlier versions to include in @INC?'
6566 . ./myread
6567 case "$ans" in
6568 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6569 *) inc_version_list="$ans" ;;
6570 esac
6571 case "$inc_version_list" in
6572 ''|' ')
6573         inc_version_list_init='0'
6574         d_inc_version_list="$undef"
6575         ;;
6576 *)      inc_version_list_init=`echo $inc_version_list |
6577                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6578         d_inc_version_list="$define"
6579         ;;
6580 esac
6581 $rm -f getverlist
6582
6583 : see if malloc/malloc.h has to be included
6584 set malloc/malloc.h i_mallocmalloc
6585 eval $inhdr
6586
6587 : see if this is a malloc.h system
6588 : we want a real compile instead of Inhdr because some systems have a
6589 : malloc.h that just gives a compile error saying to use stdlib.h instead
6590 echo " "
6591 $cat >try.c <<EOCP
6592 #include <stdlib.h>
6593 #include <malloc.h>
6594 #$i_mallocmalloc I_MALLOCMALLOC
6595 #ifdef I_MALLOCMALLOC
6596 # include <malloc/malloc.h>
6597 #endif
6598
6599 int main () { return 0; }
6600 EOCP
6601 set try
6602 if eval $compile; then
6603     echo "<malloc.h> found." >&4
6604     val="$define"
6605 else
6606     echo "<malloc.h> NOT found." >&4
6607     val="$undef"
6608 fi
6609 $rm_try
6610 set i_malloc
6611 eval $setvar
6612
6613 : check for void type
6614 echo " "
6615 echo "Checking to see how well your C compiler groks the void type..." >&4
6616 case "$voidflags" in
6617 '')
6618         $cat >try.c <<EOCP
6619 #$i_stdlib I_STDLIB
6620 #ifdef I_STDLIB
6621 #include <stdlib.h>
6622 #endif
6623 #if TRY & 1
6624 void sub() {
6625 #else
6626 sub() {
6627 #endif
6628         extern void moo();      /* function returning void */
6629         void (*goo)();          /* ptr to func returning void */
6630 #if TRY & 8
6631         void *hue;              /* generic ptr */
6632 #endif
6633 #if TRY & 2
6634         void (*foo[10])();
6635 #endif
6636
6637 #if TRY & 4
6638         if(goo == moo) {
6639                 exit(0);
6640         }
6641 #endif
6642         exit(0);
6643 }
6644 int main() { sub(); }
6645 EOCP
6646         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6647                 voidflags=$defvoidused
6648         echo "Good.  It appears to support void to the level $package wants.">&4
6649                 if $contains warning .out >/dev/null 2>&1; then
6650                         echo "However, you might get some warnings that look like this:"
6651                         $cat .out
6652                 fi
6653         else
6654 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6655                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6656                         echo "It supports 1..."
6657                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6658                                 echo "It also supports 2..."
6659                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6660                                         voidflags=7
6661                                         echo "And it supports 4 but not 8 definitely."
6662                                 else
6663                                         echo "It doesn't support 4..."
6664                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6665                                                 voidflags=11
6666                                                 echo "But it supports 8."
6667                                         else
6668                                                 voidflags=3
6669                                                 echo "Neither does it support 8."
6670                                         fi
6671                                 fi
6672                         else
6673                                 echo "It does not support 2..."
6674                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6675                                         voidflags=13
6676                                         echo "But it supports 4 and 8."
6677                                 else
6678                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6679                                                 voidflags=5
6680                                                 echo "And it supports 4 but has not heard about 8."
6681                                         else
6682                                                 echo "However it supports 8 but not 4."
6683                                         fi
6684                                 fi
6685                         fi
6686                 else
6687                         echo "There is no support at all for void."
6688                         voidflags=0
6689                 fi
6690         fi
6691 esac
6692 case "$voidflags" in
6693 "$defvoidused") ;;
6694 *)      $cat >&4 <<'EOM'
6695   Support flag bits are:
6696     1: basic void declarations.
6697     2: arrays of pointers to functions returning void.
6698     4: operations between pointers to and addresses of void functions.
6699     8: generic void pointers.
6700 EOM
6701         dflt="$voidflags";
6702         rp="Your void support flags add up to what?"
6703         . ./myread
6704         voidflags="$ans"
6705         ;;
6706 esac
6707 $rm_try
6708
6709 : check for length of pointer
6710 echo " "
6711 case "$ptrsize" in
6712 '')
6713         echo "Checking to see how big your pointers are..." >&4
6714         if test "$voidflags" -gt 7; then
6715                 echo '#define VOID_PTR char *' > try.c
6716         else
6717                 echo '#define VOID_PTR void *' > try.c
6718         fi
6719         $cat >>try.c <<EOCP
6720 #include <stdio.h>
6721 #$i_stdlib I_STDLIB
6722 #ifdef I_STDLIB
6723 #include <stdlib.h>
6724 #endif
6725 int main()
6726 {
6727     printf("%d\n", (int)sizeof(VOID_PTR));
6728     exit(0);
6729 }
6730 EOCP
6731         set try
6732         if eval $compile_ok; then
6733                 ptrsize=`$run ./try`
6734                 echo "Your pointers are $ptrsize bytes long."
6735         else
6736                 dflt='4'
6737                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6738                 rp="What is the size of a pointer (in bytes)?"
6739                 . ./myread
6740                 ptrsize="$ans"
6741         fi
6742         ;;
6743 esac
6744 $rm_try
6745 case "$use64bitall" in
6746 "$define"|true|[yY]*)
6747         case "$ptrsize" in
6748         4)      cat <<EOM >&4
6749
6750 *** You have chosen a maximally 64-bit build,
6751 *** but your pointers are only 4 bytes wide.
6752 *** Please rerun Configure without -Duse64bitall.
6753 EOM
6754                 case "$d_quad" in
6755                 define)
6756                         cat <<EOM >&4
6757 *** Since you have quads, you could possibly try with -Duse64bitint.
6758 EOM
6759                         ;;
6760                 esac
6761                 cat <<EOM >&4
6762 *** Cannot continue, aborting.
6763
6764 EOM
6765
6766                 exit 1
6767                 ;;
6768         esac
6769         ;;
6770 esac
6771
6772
6773 : determine whether to use malloc wrapping
6774 echo " "
6775 case "$usemallocwrap" in
6776 [yY]*|true|$define)     dflt='y' ;;
6777 [nN]*|false|$undef)     dflt='n' ;;
6778 *)      case "$usedevel" in
6779         [yY]*|true|$define)     dflt='y' ;;
6780         *) dflt='n' ;;
6781         esac
6782         ;;
6783 esac
6784 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6785 . ./myread
6786 usemallocwrap="$ans"
6787 case "$ans" in
6788 y*|true)
6789         usemallocwrap="$define" ;;
6790 *)
6791         usemallocwrap="$undef" ;;
6792 esac
6793
6794 : determine which malloc to compile in
6795 echo " "
6796 case "$usemymalloc" in
6797 [yY]*|true|$define)     dflt='y' ;;
6798 [nN]*|false|$undef)     dflt='n' ;;
6799 *)      case "$ptrsize" in
6800         4) dflt='y' ;;
6801         *) dflt='n' ;;
6802         esac
6803         ;;
6804 esac
6805 rp="Do you wish to attempt to use the malloc that comes with $package?"
6806 . ./myread
6807 usemymalloc="$ans"
6808 case "$ans" in
6809 y*|true)
6810         usemymalloc='y'
6811         mallocsrc='malloc.c'
6812         mallocobj="malloc$_o"
6813         d_mymalloc="$define"
6814         case "$libs" in
6815         *-lmalloc*)
6816                 : Remove malloc from list of libraries to use
6817                 echo "Removing unneeded -lmalloc from library list" >&4
6818                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6819                 shift
6820                 libs="$*"
6821                 echo "libs = $libs" >&4
6822                 ;;
6823         esac
6824         ;;
6825 *)
6826         usemymalloc='n'
6827         mallocsrc=''
6828         mallocobj=''
6829         d_mymalloc="$undef"
6830         ;;
6831 esac
6832
6833 : compute the return types of malloc and free
6834 echo " "
6835 $cat >malloc.c <<END
6836 #$i_malloc I_MALLOC
6837 #$i_stdlib I_STDLIB
6838 #include <stdio.h>
6839 #include <sys/types.h>
6840 #ifdef I_MALLOC
6841 #include <malloc.h>
6842 #endif
6843 #ifdef I_STDLIB
6844 #include <stdlib.h>
6845 #endif
6846 #ifdef TRY_MALLOC
6847 void *malloc();
6848 #endif
6849 #ifdef TRY_FREE
6850 void free();
6851 #endif
6852 END
6853 case "$malloctype" in
6854 '')
6855         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6856                 malloctype='void *'
6857         else
6858                 malloctype='char *'
6859         fi
6860         ;;
6861 esac
6862 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6863
6864 case "$freetype" in
6865 '')
6866         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6867                 freetype='void'
6868         else
6869                 freetype='int'
6870         fi
6871         ;;
6872 esac
6873 echo "Your system uses $freetype free(), it would seem." >&4
6874 $rm -f malloc.[co]
6875 : determine where site specific architecture-dependent libraries go.
6876 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6877 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6878 : sitelib may have an optional trailing /share.
6879 case "$sitearch" in
6880 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6881         dflt="$dflt/$archname"
6882         ;;
6883 *)      dflt="$sitearch"
6884         ;;
6885 esac
6886 set sitearch sitearch none
6887 eval $prefixit
6888 $cat <<EOM
6889
6890 The installation process will also create a directory for
6891 architecture-dependent site-specific extensions and modules.
6892
6893 EOM
6894 fn=d~+
6895 rp='Pathname for the site-specific architecture-dependent library files?'
6896 . ./getfile
6897 prefixvar=sitearch
6898 . ./setprefixvar
6899 if $test X"$sitearch" = X"$sitelib"; then
6900         d_sitearch="$undef"
6901 else
6902         d_sitearch="$define"
6903 fi
6904
6905 : Set the vendorprefix variables
6906 $cat <<EOM
6907
6908 The installation process will also create a directory for
6909 vendor-supplied add-ons.  Vendors who supply perl with their system
6910 may find it convenient to place all vendor-supplied files in this
6911 directory rather than in the main distribution directory.  This will
6912 ease upgrades between binary-compatible maintenance versions of perl.
6913
6914 Of course you may also use these directories in whatever way you see
6915 fit.  For example, you might use them to access modules shared over a
6916 company-wide network.
6917
6918 The default answer should be fine for most people.
6919 This causes further questions about vendor add-ons to be skipped
6920 and no vendor-specific directories will be configured for perl.
6921
6922 EOM
6923 rp='Do you want to configure vendor-specific add-on directories?'
6924 case "$usevendorprefix" in
6925 define|true|[yY]*) dflt=y ;;
6926 *)      : User may have set vendorprefix directly on Configure command line.
6927         case "$vendorprefix" in
6928         ''|' ') dflt=n ;;
6929         *)      dflt=y ;;
6930         esac
6931         ;;
6932 esac
6933 . ./myread
6934 case "$ans" in
6935 [yY]*)  fn=d~+
6936         rp='Installation prefix to use for vendor-supplied add-ons?'
6937         case "$vendorprefix" in
6938         '') dflt='' ;;
6939         *)  dflt=$vendorprefix ;;
6940         esac
6941         . ./getfile
6942         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6943         oldvendorprefix=''
6944         case "$vendorprefix" in
6945         '') ;;
6946         *)      case "$ans" in
6947                 "$prefix") ;;
6948                 *) oldvendorprefix="$prefix";;
6949                 esac
6950                 ;;
6951         esac
6952         usevendorprefix="$define"
6953         vendorprefix="$ans"
6954         vendorprefixexp="$ansexp"
6955         ;;
6956 *)      usevendorprefix="$undef"
6957         vendorprefix=''
6958         vendorprefixexp=''
6959         ;;
6960 esac
6961
6962 : Set the vendorlib variables
6963 case "$vendorprefix" in
6964 '')     d_vendorlib="$undef"
6965         vendorlib=''
6966         vendorlibexp=''
6967         ;;
6968 *)      d_vendorlib="$define"
6969         : determine where vendor-supplied modules go.
6970         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6971         case "$vendorlib" in
6972         '')
6973                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6974                 case "$installstyle" in
6975                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6976                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6977                 esac
6978                 ;;
6979         *)      dflt="$vendorlib"
6980                 ;;
6981         esac
6982         fn=d~+
6983         rp='Pathname for the vendor-supplied library files?'
6984         . ./getfile
6985         vendorlib="$ans"
6986         vendorlibexp="$ansexp"
6987         ;;
6988 esac
6989 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6990 prefixvar=vendorlib
6991 . ./installprefix
6992
6993 : Set the vendorarch variables
6994 case "$vendorprefix" in
6995 '')     d_vendorarch="$undef"
6996         vendorarch=''
6997         vendorarchexp=''
6998         ;;
6999 *)      d_vendorarch="$define"
7000         : determine where vendor-supplied architecture-dependent libraries go.
7001         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7002         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7003         : vendorlib may have an optional trailing /share.
7004         case "$vendorarch" in
7005         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7006                 dflt="$dflt/$archname"
7007                 ;;
7008         *)      dflt="$vendorarch" ;;
7009         esac
7010         fn=d~+
7011         rp='Pathname for vendor-supplied architecture-dependent files?'
7012         . ./getfile
7013         vendorarch="$ans"
7014         vendorarchexp="$ansexp"
7015         ;;
7016 esac
7017 prefixvar=vendorarch
7018 . ./installprefix
7019
7020 : Final catch-all directories to search
7021 $cat <<EOM
7022
7023 Lastly, you can have perl look in other directories for extensions and
7024 modules in addition to those already specified.
7025 These directories will be searched after 
7026         $sitearch 
7027         $sitelib 
7028 EOM
7029 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7030 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7031 echo ' '
7032 case "$otherlibdirs" in
7033 ''|' ') dflt='none' ;;
7034 *)      dflt="$otherlibdirs" ;;
7035 esac
7036 $cat <<EOM
7037 Enter a colon-separated set of extra paths to include in perl's @INC
7038 search path, or enter 'none' for no extra paths.
7039
7040 EOM
7041
7042 rp='Colon-separated list of additional directories for perl to search?'
7043 . ./myread
7044 case "$ans" in
7045 ' '|''|none)    otherlibdirs=' ' ;;     
7046 *)      otherlibdirs="$ans" ;;
7047 esac
7048 case "$otherlibdirs" in
7049 ' ') val=$undef ;;
7050 *)      val=$define ;;
7051 esac
7052 set d_perl_otherlibdirs
7053 eval $setvar
7054
7055 : Cruising for prototypes
7056 echo " "
7057 echo "Checking out function prototypes..." >&4
7058 $cat >prototype.c <<EOCP
7059 #$i_stdlib I_STDLIB
7060 #ifdef I_STDLIB
7061 #include <stdlib.h>
7062 #endif
7063 int main(int argc, char *argv[]) {
7064         exit(0);}
7065 EOCP
7066 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7067         echo "Your C compiler appears to support function prototypes."
7068         val="$define"
7069 else
7070         echo "Your C compiler doesn't seem to understand function prototypes."
7071         val="$undef"
7072 fi
7073 set prototype
7074 eval $setvar
7075 $rm -f prototype*
7076
7077 : Check if ansi2knr is required
7078 case "$prototype" in
7079 "$define") ;;
7080 *)      ansi2knr='ansi2knr'
7081         echo " "
7082         cat <<EOM >&4
7083
7084 $me:  FATAL ERROR:
7085 This version of $package can only be compiled by a compiler that 
7086 understands function prototypes.  Unfortunately, your C compiler 
7087         $cc $ccflags
7088 doesn't seem to understand them.  Sorry about that.
7089
7090 If GNU cc is available for your system, perhaps you could try that instead.  
7091
7092 Eventually, we hope to support building Perl with pre-ANSI compilers.
7093 If you would like to help in that effort, please contact <perlbug@perl.org>.
7094
7095 Aborting Configure now.
7096 EOM
7097         exit 2
7098         ;;
7099 esac
7100
7101 : DTrace support
7102 dflt_dtrace='/usr/sbin/dtrace'
7103 cat <<EOM
7104
7105 Perl can be built to support DTrace on platforms that support it.
7106 DTrace is a diagnosis and performance analysis tool from Sun.
7107
7108 If this doesn't make any sense to you, just accept the default '$dflt'.
7109 EOM
7110
7111 while $test 1 ; do
7112         case "$usedtrace" in
7113         $define|true|[yY]*)
7114                 dflt='y'
7115                 ;;
7116         ?*)
7117                 dflt='y'
7118                 dflt_dtrace=$usedtrace
7119                 ;;
7120         *)
7121                 dflt='n'
7122                 ;;
7123         esac
7124
7125         rp='Support DTrace if available?'
7126         . ./myread
7127         case "$ans" in
7128         y|Y)    val="$define" ;;
7129         *)      val="$undef" ;;
7130         esac
7131         set usedtrace
7132         eval $setvar
7133
7134         test "X$usedtrace" != "X$define" && break
7135
7136         echo " "
7137         rp='Where is the dtrace executable?'
7138         dflt=$dflt_dtrace
7139         . ./getfile
7140         val="$ans"
7141         set dtrace
7142         eval $setvar
7143
7144         if $test -f $dtrace
7145         then
7146                 if $dtrace -h -s ../perldtrace.d \
7147                         -o perldtrace.tmp >/dev/null 2>&1 \
7148                         && rm -f perldtrace.tmp
7149                 then
7150                         echo " "
7151                         echo "Good: your $dtrace knows about the -h flag."
7152                 else
7153                         cat >&2 <<EOM
7154
7155 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7156 ***
7157 *** Your installed dtrace doesn't support the -h switch to compile a D
7158 *** program into a C header. Can't continue.
7159
7160 EOM
7161                         exit 1
7162                 fi
7163                 break;
7164         fi
7165
7166         case "$fastread" in
7167         yes)
7168                 cat >&2 <<EOM
7169
7170 *** $me:  Fatal Error:  $dtrace not found.
7171 *** Can't continue.
7172
7173 EOM
7174                 exit 1
7175                 ;;
7176         *)
7177                 echo "*** $dtrace was not found."
7178                 echo " "
7179                 ;;
7180         esac
7181 done
7182
7183 : See if we want extra modules installed
7184 echo " "
7185 case "$extras" in
7186 '') dflt='n';;
7187 *) dflt='y';;
7188 esac
7189 cat <<EOM
7190 Perl can be built with extra modules or bundles of modules which
7191 will be fetched from the CPAN and installed alongside Perl.
7192
7193 Notice that you will need access to the CPAN; either via the Internet,
7194 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7195 be asked later to configure the CPAN.pm module which will in turn do
7196 the installation of the rest of the extra modules or bundles.)
7197
7198 Notice also that if the modules require any external software such as
7199 libraries and headers (the libz library and the zlib.h header for the
7200 Compress::Zlib module, for example) you MUST have any such software
7201 already installed, this configuration process will NOT install such
7202 things for you.
7203
7204 If this doesn't make any sense to you, just accept the default '$dflt'.
7205 EOM
7206 rp='Install any extra modules (y or n)?'
7207 . ./myread
7208 case "$ans" in
7209 y|Y)
7210         cat <<EOM
7211
7212 Please list any extra modules or bundles to be installed from CPAN,
7213 with spaces between the names.  The names can be in any format the
7214 'install' command of CPAN.pm will understand.  (Answer 'none',
7215 without the quotes, to install no extra modules or bundles.)
7216 EOM
7217         rp='Extras?'
7218         dflt="$extras"
7219         . ./myread
7220         extras="$ans"
7221 esac
7222 case "$extras" in
7223 ''|'none')
7224         val=''
7225         $rm -f ../extras.lst
7226         ;;
7227 *)      echo "(Saving the list of extras for later...)"
7228         echo "$extras" > ../extras.lst
7229         val="'$extras'"
7230         ;;
7231 esac
7232 set extras
7233 eval $setvar
7234 echo " "
7235
7236 : determine where html pages for programs go
7237 set html1dir html1dir none
7238 eval $prefixit
7239 $cat <<EOM
7240
7241 If you wish to install html files for programs in $spackage, indicate
7242 the appropriate directory here.  To skip installing html files,
7243 answer "none".
7244 EOM
7245 case "$html1dir" in
7246 ''|none|$undef|' ') dflt=none ;;
7247 *) dflt=$html1dir ;;
7248 esac
7249 fn=dn+~
7250 rp="Directory for the main $spackage html pages?"
7251 . ./getfile
7252 prefixvar=html1dir
7253 . ./setprefixvar
7254 : Use ' ' for none so value is preserved next time through Configure
7255 $test X"$html1dir" = "X" && html1dir=' '
7256
7257 : determine where html pages for libraries and modules go
7258 set html3dir html3dir none
7259 eval $prefixit
7260 $cat <<EOM
7261
7262 If you wish to install html files for modules associated with $spackage,
7263 indicate the appropriate directory here.  To skip installing html files,
7264 answer "none".
7265 EOM
7266 : There is no obvious default.  If they have specified html1dir, then
7267 : try to key off that, possibly changing .../html1 into .../html3.
7268 case "$html3dir" in
7269 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7270 *) dflt=$html3dir ;;
7271 esac
7272 fn=dn+~
7273 rp="Directory for the $spackage module html pages?"
7274 . ./getfile
7275 prefixvar=html3dir
7276 . ./setprefixvar
7277 : Use ' ' for none so value is preserved next time through Configure
7278 $test X"$html3dir" = "X" && html3dir=' '
7279
7280 : determine whether to install perl also as /usr/bin/perl
7281
7282 echo " "
7283 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7284         $cat <<EOM
7285 Many scripts expect perl to be installed as /usr/bin/perl.
7286
7287 If you want to, I can install the perl you are about to compile
7288 as /usr/bin/perl (in addition to $bin/perl).
7289 EOM
7290         if test -f /usr/bin/perl; then
7291             $cat <<EOM
7292
7293 However, please note that because you already have a /usr/bin/perl,
7294 overwriting that with a new Perl would very probably cause problems.
7295 Therefore I'm assuming you don't want to do that (unless you insist).
7296
7297 EOM
7298             case "$installusrbinperl" in
7299             "$define"|[yY]*)    dflt='y';;
7300             *)                  dflt='n';;
7301             esac
7302         else
7303             $cat <<EOM
7304
7305 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7306
7307 EOM
7308             case "$installusrbinperl" in
7309             "$undef"|[nN]*)     dflt='n';;
7310             *)                  dflt='y';;
7311             esac
7312         fi
7313         rp="Do you want to install perl as /usr/bin/perl?"
7314         . ./myread
7315         case "$ans" in
7316         [yY]*)  val="$define";;
7317         *)      val="$undef" ;;
7318         esac
7319 else
7320         val="$undef"
7321 fi
7322 set installusrbinperl
7323 eval $setvar
7324
7325 : Check if we are using the GNU C library
7326 echo " "
7327 echo "Checking for GNU C Library..." >&4
7328 cat >try.c <<'EOCP'
7329 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7330    alone are insufficient to distinguish different versions, such as
7331    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7332    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7333 */
7334 #include <stdio.h>
7335 int main(void)
7336 {
7337 #ifdef __GLIBC__
7338 #   ifdef __GLIBC_MINOR__
7339 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7340 #           include <gnu/libc-version.h>
7341             printf("%s\n",  gnu_get_libc_version());
7342 #       else
7343             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7344 #       endif
7345 #   else
7346         printf("%d\n",  __GLIBC__);
7347 #   endif
7348     return 0;
7349 #else
7350     return 1;
7351 #endif
7352 }
7353 EOCP
7354 set try
7355 if eval $compile_ok && $run ./try > glibc.ver; then
7356         val="$define"
7357         gnulibc_version=`$cat glibc.ver`
7358         echo "You are using the GNU C Library version $gnulibc_version"
7359 else
7360         val="$undef"
7361         gnulibc_version=''
7362         echo "You are not using the GNU C Library"
7363 fi
7364 $rm_try glibc.ver
7365 set d_gnulibc
7366 eval $setvar
7367
7368 : see if nm is to be used to determine whether a symbol is defined or not
7369 case "$usenm" in
7370 '')
7371         dflt=''
7372         case "$d_gnulibc" in
7373         "$define")
7374                 echo " "
7375                 echo "nm probably won't work on the GNU C Library." >&4
7376                 dflt=n
7377                 ;;
7378         esac
7379         case "$dflt" in
7380         '') 
7381                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7382                         echo " "
7383                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7384                         echo "'nm' won't be sufficient on this sytem." >&4
7385                         dflt=n
7386                 fi
7387                 ;;
7388         esac
7389         case "$dflt" in
7390         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7391                 if $test $dflt -gt 20; then
7392                         dflt=y
7393                 else
7394                         dflt=n
7395                 fi
7396                 ;;
7397         esac
7398         ;;
7399 *)
7400         case "$usenm" in
7401         true|$define) dflt=y;;
7402         *) dflt=n;;
7403         esac
7404         ;;
7405 esac
7406 $cat <<EOM
7407
7408 I can use $nm to extract the symbols from your C libraries. This
7409 is a time consuming task which may generate huge output on the disk (up
7410 to 3 megabytes) but that should make the symbols extraction faster. The
7411 alternative is to skip the 'nm' extraction part and to compile a small
7412 test program instead to determine whether each symbol is present. If
7413 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7414 this may be the best solution.
7415
7416 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7417
7418 EOM
7419 rp="Shall I use $nm to extract C symbols from the libraries?"
7420 . ./myread
7421 case "$ans" in
7422 [Nn]*) usenm=false;;
7423 *) usenm=true;;
7424 esac
7425
7426 runnm=$usenm
7427 case "$reuseval" in
7428 true) runnm=false;;
7429 esac
7430
7431 : nm options which may be necessary
7432 case "$nm_opt" in
7433 '') if $test -f /mach_boot; then
7434                 nm_opt=''       # Mach
7435         elif $test -d /usr/ccs/lib; then
7436                 nm_opt='-p'     # Solaris (and SunOS?)
7437         elif $test -f /dgux; then
7438                 nm_opt='-p'     # DG-UX
7439         elif $test -f /lib64/rld; then
7440                 nm_opt='-p'     # 64-bit Irix
7441         else
7442                 nm_opt=''
7443         fi;;
7444 esac
7445
7446 : nm options which may be necessary for shared libraries but illegal
7447 : for archive libraries.  Thank you, Linux.
7448 case "$nm_so_opt" in
7449 '')     case "$myuname" in
7450         *linux*|gnu*)
7451                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7452                         nm_so_opt='--dynamic'
7453                 fi
7454                 ;;
7455         esac
7456         ;;
7457 esac
7458
7459 : Figure out where the libc is located
7460 case "$runnm" in
7461 true)
7462 : get list of predefined functions in a handy place
7463 echo " "
7464 case "$libc" in
7465 '') libc=unknown
7466         case "$libs" in
7467         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7468         esac
7469         ;;
7470 esac
7471 case "$libs" in
7472 '') ;;
7473 *)  for thislib in $libs; do
7474         case "$thislib" in
7475         -lc|-lc_s)
7476                 : Handle C library specially below.
7477                 ;;
7478         -l*)
7479                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7480                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7481                         :
7482                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7483                         :
7484                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7485                         :
7486                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7487                         :
7488                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7489                         :
7490                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7491                         :
7492                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7493                         :
7494                 else
7495                         try=''
7496                 fi
7497                 libnames="$libnames $try"
7498                 ;;
7499         *) libnames="$libnames $thislib" ;;
7500         esac
7501         done
7502         ;;
7503 esac
7504 xxx=normal
7505 case "$libc" in
7506 unknown)
7507         set /lib/libc.$so
7508         for xxx in $libpth; do
7509                 $test -r $1 || set $xxx/libc.$so
7510                 : The messy sed command sorts on library version numbers.
7511                 $test -r $1 || \
7512                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7513                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7514                                 h
7515                                 s/[0-9][0-9]*/0000&/g
7516                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7517                                 G
7518                                 s/\n/ /' | \
7519                          $sort | $sed -e 's/^.* //'`
7520                 eval set \$$#
7521         done
7522         $test -r $1 || set /usr/ccs/lib/libc.$so
7523         $test -r $1 || set /lib/libsys_s$_a
7524         ;;
7525 *)
7526         set blurfl
7527         ;;
7528 esac
7529 if $test -r "$1"; then
7530         echo "Your (shared) C library seems to be in $1."
7531         libc="$1"
7532 elif $test -r /lib/libc && $test -r /lib/clib; then
7533         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7534         xxx=apollo
7535         libc='/lib/clib /lib/libc'
7536         if $test -r /lib/syslib; then
7537                 echo "(Your math library is in /lib/syslib.)"
7538                 libc="$libc /lib/syslib"
7539         fi
7540 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7541         echo "Your C library seems to be in $libc, as you said before."
7542 elif $test -r $incpath/usr/lib/libc$_a; then
7543         libc=$incpath/usr/lib/libc$_a;
7544         echo "Your C library seems to be in $libc.  That's fine."
7545 elif $test -r /lib/libc$_a; then
7546         libc=/lib/libc$_a;
7547         echo "Your C library seems to be in $libc.  You're normal."
7548 else
7549         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7550                 :
7551         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7552                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7553         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7554                 :
7555         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7556                 :
7557         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7558                 :
7559         else
7560                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7561         fi
7562         if $test -r "$tans"; then
7563                 echo "Your C library seems to be in $tans, of all places."
7564                 libc=$tans
7565         else
7566                 libc='blurfl'
7567         fi
7568 fi
7569 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7570         dflt="$libc"
7571         cat <<EOM
7572
7573 If the guess above is wrong (which it might be if you're using a strange
7574 compiler, or your machine supports multiple models), you can override it here.
7575
7576 EOM
7577 else
7578         dflt=''
7579         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7580         cat >&4 <<EOM
7581 I can't seem to find your C library.  I've looked in the following places:
7582
7583 EOM
7584         $sed 's/^/      /' libpath
7585         cat <<EOM
7586
7587 None of these seems to contain your C library. I need to get its name...
7588
7589 EOM
7590 fi
7591 fn=f
7592 rp='Where is your C library?'
7593 . ./getfile
7594 libc="$ans"
7595
7596 echo " "
7597 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7598 set X `cat libnames`
7599 shift
7600 xxx=files
7601 case $# in 1) xxx=file; esac
7602 echo "Extracting names from the following $xxx for later perusal:" >&4
7603 echo " "
7604 $sed 's/^/      /' libnames >&4
7605 echo " "
7606 $echo $n "This may take a while...$c" >&4
7607
7608 for file in $*; do
7609         case $file in
7610         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7611         *) $nm $nm_opt $file 2>/dev/null;;
7612         esac
7613 done >libc.tmp
7614
7615 $echo $n ".$c"
7616 $grep fprintf libc.tmp > libc.ptf
7617 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7618 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7619 xxx='[ADTSIW]'
7620 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7621         eval $xscan;\
7622         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7623                 eval $xrun
7624 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7625         eval $xscan;\
7626         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7627                 eval $xrun
7628 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7629         eval $xscan;\
7630         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7631                 eval $xrun
7632 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7633         eval $xscan;\
7634         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7635                 eval $xrun
7636 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7637         eval $xscan;\
7638         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7639                 eval $xrun
7640 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7641         eval $xscan;\
7642         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7643                 eval $xrun
7644 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7645                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7646         eval $xscan;\
7647         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7648                 eval $xrun
7649 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7650         eval $xscan;\
7651         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7652                 eval $xrun
7653 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7654         eval $xscan;\
7655         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7656                 eval $xrun
7657 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7658         eval $xscan;\
7659         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7660                 eval $xrun
7661 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7662         eval $xscan;\
7663         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7664                 eval $xrun
7665 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7666         eval $xscan;\
7667         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7668                 eval $xrun
7669 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7670         eval $xscan;\
7671         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7672                 eval $xrun
7673 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7674         eval $xscan;\
7675         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7676                 eval $xrun
7677 else
7678         $nm -p $* 2>/dev/null >libc.tmp
7679         $grep fprintf libc.tmp > libc.ptf
7680         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7681                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7682         then
7683                 nm_opt='-p'
7684                 eval $xrun
7685         else
7686                 echo " "
7687                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7688                 com=''
7689                 if $ar t $libc > libc.tmp && \
7690                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7691                 then
7692                         for thisname in $libnames $libc; do
7693                                 $ar t $thisname >>libc.tmp
7694                         done
7695                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7696                         echo "Ok." >&4
7697                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7698                         for thisname in $libnames $libc; do
7699                                 $ar tv $thisname >>libc.tmp
7700                                 emximp -o tmp.imp $thisname \
7701                                     2>/dev/null && \
7702                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7703                                     < tmp.imp >>libc.tmp
7704                                 $rm -f tmp.imp
7705                         done
7706                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7707                         echo "Ok." >&4
7708                 else
7709                         echo "$ar didn't seem to work right." >&4
7710                         echo "Maybe this is a Cray...trying bld instead..." >&4
7711                         if  bld t $libc | \
7712                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7713                                 $test -s libc.list
7714                         then
7715                                 for thisname in $libnames; do
7716                                         bld t $libnames | \
7717                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7718                                         $ar t $thisname >>libc.tmp
7719                                 done
7720                                 echo "Ok." >&4
7721                         else
7722                                 echo "That didn't work either.  Giving up." >&4
7723                                 exit 1
7724                         fi
7725                 fi
7726         fi
7727 fi
7728 nm_extract="$com"
7729 case "$PASE" in
7730 define)
7731     echo " "
7732     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7733     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7734     ;;
7735 *)  if $test -f /lib/syscalls.exp; then
7736         echo " "
7737         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7738         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7739                 /lib/syscalls.exp >>libc.list
7740     fi
7741     ;;
7742 esac
7743 ;;
7744 esac
7745 $rm -f libnames libpath
7746
7747 : see if dld is available
7748 set dld.h i_dld
7749 eval $inhdr
7750
7751 : Check if we are using C++
7752 echo " "
7753 echo "Checking for C++..." >&4
7754 $cat >try.c <<'EOCP'
7755 #include <stdio.h>
7756 int main(void)
7757 {
7758 #ifdef __cplusplus
7759     return 0;
7760 #else
7761     return 1;
7762 #endif
7763 }
7764 EOCP
7765 set try
7766 if eval $compile_ok && $run ./try; then
7767         val="$define"
7768         echo "You are using a C++ compiler."
7769 else
7770         val="$undef"
7771         echo "You are not using a C++ compiler."
7772 fi
7773 $rm_try cplusplus$$
7774 set d_cplusplus
7775 eval $setvar
7776
7777 : is a C symbol defined?
7778 csym='tlook=$1;
7779 case "$3" in
7780 -v) tf=libc.tmp; tdc="";;
7781 -a) tf=libc.tmp; tdc="[]";;
7782 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7783 esac;
7784 case "$d_cplusplus" in
7785     $define)    extern_C="extern \"C\"" ;;
7786     *)          extern_C="extern"       ;;
7787 esac;
7788 tx=yes;
7789 case "$reuseval-$4" in
7790 true-) ;;
7791 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7792 esac;
7793 case "$tx" in
7794 yes)
7795         tval=false;
7796         if $test "$runnm" = true; then
7797                 if $contains $tlook $tf >/dev/null 2>&1; then
7798                         tval=true;
7799                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7800                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7801                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7802                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7803                         $rm_try;
7804                 fi;
7805         else
7806                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7807                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7808                 $rm_try;
7809         fi;
7810         ;;
7811 *)
7812         case "$tval" in
7813         $define) tval=true;;
7814         *) tval=false;;
7815         esac;
7816         ;;
7817 esac;
7818 eval "$2=$tval"'
7819
7820 : define an is-in-libc? function
7821 inlibc='echo " "; td=$define; tu=$undef;
7822 sym=$1; var=$2; eval "was=\$$2";
7823 tx=yes;
7824 case "$reuseval$was" in
7825 true) ;;
7826 true*) tx=no;;
7827 esac;
7828 case "$tx" in
7829 yes)
7830         set $sym tres -f;
7831         eval $csym;
7832         case "$tres" in
7833         true)
7834                 echo "$sym() found." >&4;
7835                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7836         *)
7837                 echo "$sym() NOT found." >&4;
7838                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7839         esac;;
7840 *)
7841         case "$was" in
7842         $define) echo "$sym() found." >&4;;
7843         *) echo "$sym() NOT found." >&4;;
7844         esac;;
7845 esac'
7846
7847 : see if dlopen exists
7848 xxx_runnm="$runnm"
7849 xxx_ccflags="$ccflags"
7850 runnm=false
7851 : with g++ one needs -shared to get is-in-libc to work for dlopen
7852 case "$gccversion" in
7853 '')     ;;
7854 *)      case "$d_cplusplus" in
7855         "$define") ccflags="$ccflags -shared" ;;
7856         esac
7857         ;;
7858 esac
7859 set dlopen d_dlopen
7860 eval $inlibc
7861 runnm="$xxx_runnm"
7862 ccflags="$xxx_ccflags"
7863
7864 : see if this is a unistd.h system
7865 set unistd.h i_unistd
7866 eval $inhdr
7867
7868 : determine which dynamic loading, if any, to compile in
7869 echo " "
7870 dldir="ext/DynaLoader"
7871 case "$usedl" in
7872 $define|y|true)
7873         dflt='y'
7874         usedl="$define"
7875         ;;
7876 $undef|n|false)
7877         dflt='n'
7878         usedl="$undef"
7879         ;;
7880 *)
7881         dflt='n'
7882         case "$d_dlopen" in
7883             $define) dflt='y' ;;
7884         esac
7885         case "$i_dld" in
7886             $define) dflt='y' ;;
7887         esac
7888         : Does a dl_xxx.xs file exist for this operating system
7889         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7890         ;;
7891 esac
7892 rp="Do you wish to use dynamic loading?"
7893 . ./myread
7894 usedl="$ans"
7895 case "$ans" in
7896 y*) usedl="$define"
7897         case "$dlsrc" in
7898         '')
7899                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7900                         dflt="$dldir/dl_${osname}.xs"
7901                 elif $test "$d_dlopen" = "$define" ; then
7902                         dflt="$dldir/dl_dlopen.xs"
7903                 elif $test "$i_dld" = "$define" ; then
7904                         dflt="$dldir/dl_dld.xs"
7905                 else
7906                         dflt=''
7907                 fi
7908                 ;;
7909         *)      dflt="$dldir/$dlsrc"
7910                 ;;
7911         esac
7912     echo "The following dynamic loading files are available:"
7913         : Can not go over to $dldir because getfile has path hard-coded in.
7914         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7915         rp="Source file to use for dynamic loading"
7916         fn="fne"
7917         gfpth="$src"
7918         . ./getfile
7919         usedl="$define"
7920         : emulate basename
7921         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7922
7923         $cat << EOM
7924
7925 Some systems may require passing special flags to $cc -c to
7926 compile modules that will be used to create a shared library.
7927 To use no flags, say "none".
7928
7929 EOM
7930     case "$cccdlflags" in
7931     '') case "$gccversion" in
7932                 '') case "$osname" in
7933                         hpux)   dflt='+z' ;;
7934                         next)   dflt='none' ;;
7935                         irix*)  dflt='-KPIC' ;;
7936                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7937                         sunos)  dflt='-pic' ;;
7938                         *)      dflt='none' ;;
7939                     esac
7940                         ;;
7941                 *)  case "$osname" in
7942                         darwin) dflt='none' ;;
7943                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7944                         *)      dflt='-fpic' ;;
7945                     esac ;;
7946             esac ;;
7947         ' ') dflt='none' ;;
7948     *)  dflt="$cccdlflags" ;;
7949     esac
7950     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7951     . ./myread
7952     case "$ans" in
7953     none) cccdlflags=' ' ;;
7954     *) cccdlflags="$ans" ;;
7955     esac
7956
7957     cat << EOM
7958
7959 Some systems use ld to create libraries that can be dynamically loaded,
7960 while other systems (such as those using ELF) use $cc.
7961
7962 EOM
7963         case "$ld" in
7964         '')     $cat >try.c <<EOM
7965 /* Test for whether ELF binaries are produced */
7966 #include <fcntl.h>
7967 #$i_stdlib I_STDLIB
7968 #ifdef I_STDLIB
7969 #include <stdlib.h>
7970 #endif
7971 #$i_unistd I_UNISTD
7972 #ifdef I_UNISTD
7973 #include <unistd.h>
7974 #endif
7975 int main() {
7976         char b[4];
7977         int i = open("a.out",O_RDONLY);
7978         if(i == -1)
7979                 exit(1); /* fail */
7980         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7981                 exit(0); /* succeed (yes, it's ELF) */
7982         else
7983                 exit(1); /* fail */
7984 }
7985 EOM
7986                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7987                         cat <<EOM
7988 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7989 EOM
7990                         dflt="$cc"
7991                 else
7992                         echo "I'll use ld to build dynamic libraries."
7993                         dflt='ld'
7994                 fi
7995                 $rm_try
7996                 ;;
7997         *)      dflt="$ld"
7998                 ;;
7999         esac
8000
8001     rp="What command should be used to create dynamic libraries?"
8002     . ./myread
8003         ld="$ans"
8004
8005     cat << EOM
8006
8007 Some systems may require passing special flags to $ld to create a
8008 library that can be dynamically loaded.  If your ld flags include
8009 -L/other/path options to locate libraries outside your loader's normal
8010 search path, you may need to specify those -L options here as well.  To
8011 use no flags, say "none".
8012
8013 EOM
8014     case "$lddlflags" in
8015     '') case "$osname" in
8016                         beos) dflt='-nostart' ;;
8017                         hpux) dflt='-b';
8018                               case "$gccversion" in
8019                               '') dflt="$dflt +vnocompatwarnings" ;;
8020                               esac
8021                               ;;
8022                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8023                         next)  dflt='none' ;;
8024                         solaris) dflt='-G' ;;
8025                         sunos) dflt='-assert nodefinitions' ;;
8026                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8027                 *)     dflt='none' ;;
8028                         esac
8029                         ;;
8030     *) dflt="$lddlflags" ;;
8031     esac
8032
8033         : Try to guess additional flags to pick up local libraries.
8034         : Be careful not to append to a plain 'none'
8035         case "$dflt" in
8036         none) dflt='' ;;
8037         esac
8038         for thisflag in $ldflags; do
8039                 case "$thisflag" in
8040                 -L*|-R*|-Wl,-R*)
8041                         case " $dflt " in
8042                         *" $thisflag "*) ;;
8043                         *) dflt="$dflt $thisflag" ;;
8044                         esac
8045                         ;;
8046                 esac
8047         done
8048
8049         case "$dflt" in
8050         ''|' ') dflt='none' ;;
8051         esac
8052
8053         case "$ldflags" in
8054         *-fstack-protector*)
8055             case "$dflt" in
8056                         *-fstack-protector*) ;; # Don't add it again
8057                         *) dflt="$dflt -fstack-protector" ;; 
8058                 esac
8059                 ;;
8060         esac
8061
8062
8063     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8064     . ./myread
8065     case "$ans" in
8066     none) lddlflags=' ' ;;
8067     *) lddlflags="$ans" ;;
8068     esac
8069
8070         cat <<EOM
8071
8072 Some systems may require passing special flags to $cc to indicate that
8073 the resulting executable will use dynamic linking.  To use no flags,
8074 say "none".
8075
8076 EOM
8077     case "$ccdlflags" in
8078     '') case "$osname" in
8079             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8080             next|sunos) dflt='none' ;;
8081             *)          dflt='none' ;;
8082             esac ;;
8083     ' ')  dflt='none' ;;
8084     *)  dflt="$ccdlflags" ;;
8085     esac
8086     rp="Any special flags to pass to $cc to use dynamic linking?"
8087     . ./myread
8088     case "$ans" in
8089     none) ccdlflags=' ' ;;
8090     *) ccdlflags="$ans" ;;
8091     esac
8092     ;;
8093 *)  usedl="$undef"
8094         ld='ld'
8095     dlsrc='dl_none.xs'
8096     lddlflags=''
8097     ccdlflags=''
8098     ;;
8099 esac
8100
8101 : Do we want a shared libperl?
8102 also=''
8103 case "$usedl" in
8104 $undef)
8105         # No dynamic loading being used, so don't bother even to prompt.
8106         useshrplib='false'
8107         ;;
8108 *)      case "$useshrplib" in
8109         '')     case "$osname" in
8110                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
8111                         dflt=y
8112                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8113                         ;;
8114                 next*)
8115                         case "$osvers" in
8116                         4*)     dflt=y
8117                                 also='Building a shared libperl is needed for MAB support.'
8118                                 ;;
8119                         *)      dflt=n
8120                                 ;;
8121                         esac
8122                         ;;
8123                 *)      dflt=n
8124                         ;;
8125                 esac
8126                 ;;
8127         $define|true|[Yy]*)
8128                 dflt=y
8129                 ;;
8130         *)      dflt=n
8131                 ;;
8132         esac
8133         $cat << EOM
8134
8135 The perl executable is normally obtained by linking perlmain.c with
8136 libperl${_a}, any static extensions (usually just DynaLoader), and
8137 any other libraries needed on this system (such as -lm, etc.).  Since
8138 your system supports dynamic loading, it is probably possible to build
8139 a shared libperl.$so.  If you will have more than one executable linked
8140 to libperl.$so, this will significantly reduce the size of each
8141 executable, but it may have a noticeable effect on performance.  The
8142 default is probably sensible for your system.
8143 $also
8144
8145 EOM
8146         rp="Build a shared libperl.$so (y/n)"
8147         . ./myread
8148         case "$ans" in
8149         true|$define|[Yy]*)
8150                 useshrplib='true'  ;;
8151         *)      useshrplib='false' ;;
8152         esac
8153         ;;
8154 esac
8155
8156 case "$useshrplib" in
8157 true)
8158         case "$libperl" in
8159         '')
8160                 # Figure out a good name for libperl.so.  Since it gets stored in
8161                 # a version-specific architecture-dependent library, the version
8162                 # number isn't really that important, except for making cc/ld happy.
8163                 #
8164                 # A name such as libperl.so.10.1
8165                 majmin="libperl.$so.$patchlevel.$subversion"
8166                 # A name such as libperl.so.100
8167                 majonly=`echo $patchlevel $subversion |
8168                         $awk '{printf "%d%02d", $1, $2}'`
8169                 majonly=libperl.$so.$majonly
8170                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8171                 # rely on figuring it out from the naming of libc.
8172                 case "${osname}${osvers}" in
8173                 next4*)
8174                         dflt=libperl.5.$so
8175                         # XXX How handle the --version stuff for MAB?
8176                         ;;
8177                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8178                         dflt=libperl.$so
8179                         ;;
8180                 cygwin*) # ld links now against the dll directly
8181                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8182                         majonly=`echo $patchlevel $subversion |
8183                                 $awk '{printf "%03d%03d", $1, $2}'`
8184                         majonly=cygperl5.$majonly.$so
8185                         dflt=$majmin
8186                         ;;
8187                 *)      # Try to guess based on whether libc has major.minor.
8188                         case "$libc" in
8189                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8190                         *libc.$so.[0-9]*) dflt=$majonly ;;
8191                         *)      dflt=libperl.$so ;;
8192                         esac
8193                         ;;
8194                 esac
8195                 ;;
8196         *)      dflt=$libperl
8197                 ;;
8198         esac
8199         cat << EOM
8200
8201 I need to select a good name for the shared libperl.  If your system uses
8202 library names with major and minor numbers, then you might want something
8203 like $majmin.  Alternatively, if your system uses a single version
8204 number for shared libraries, then you might want to use $majonly.
8205 Or, your system might be quite happy with a simple libperl.$so.
8206
8207 Since the shared libperl will get installed into a version-specific
8208 architecture-dependent directory, the version number of the shared perl
8209 library probably isn't important, so the default should be o.k.
8210
8211 EOM
8212         rp='What name do you want to give to the shared libperl?'
8213         . ./myread
8214         libperl=$ans
8215         echo "Ok, I'll use $libperl"
8216         ;;
8217 *)
8218         libperl="libperl${_a}"
8219         ;;
8220 esac
8221
8222 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8223 case "$shrpdir" in
8224 '') ;;
8225 *)      $cat >&4 <<EOM
8226 WARNING:  Use of the shrpdir variable for the installation location of
8227 the shared $libperl is not supported.  It was never documented and
8228 will not work in this version.  Let me (perlbug@perl.org)
8229 know of any problems this may cause.
8230
8231 EOM
8232         case "$shrpdir" in
8233         "$archlibexp/CORE")
8234                 $cat >&4 <<EOM
8235 But your current setting of $shrpdir is
8236 the default anyway, so it's harmless.
8237 EOM
8238                 ;;
8239         *)
8240                 $cat >&4 <<EOM
8241 Further, your current attempted setting of $shrpdir
8242 conflicts with the value of $archlibexp/CORE
8243 that installperl will use.
8244 EOM
8245                 ;;
8246         esac
8247         ;;
8248 esac
8249
8250 # How will the perl executable find the installed shared $libperl?
8251 # Add $xxx to ccdlflags.
8252 # If we can't figure out a command-line option, use $shrpenv to
8253 # set env LD_RUN_PATH.  The main perl makefile uses this.
8254 shrpdir=$archlibexp/CORE
8255 xxx=''
8256 tmp_shrpenv=''
8257 if "$useshrplib"; then
8258     case "$osname" in
8259         aix)
8260                 # We'll set it in Makefile.SH...
8261                 ;;
8262         solaris)
8263                 xxx="-R $shrpdir"
8264                 ;;
8265         freebsd|netbsd|openbsd|interix|dragonfly)
8266                 xxx="-Wl,-R$shrpdir"
8267                 ;;
8268         bsdos|linux|irix*|dec_osf|gnu*)
8269                 xxx="-Wl,-rpath,$shrpdir"
8270                 ;;
8271         next)
8272                 # next doesn't like the default...
8273                 ;;
8274         beos)
8275                 # beos doesn't like the default, either.
8276                 ;;
8277         hpux*)
8278                 # hpux doesn't like the default, either.
8279                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8280                 ;;
8281         cygwin)
8282                 # cygwin needs only ldlibpth
8283                 ;;
8284         *)
8285                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8286                 ;;
8287         esac
8288         case "$xxx" in
8289         '') ;;
8290         *)
8291                 # Only add $xxx if it isn't already in ccdlflags.
8292                 case " $ccdlflags " in
8293                 *" $xxx "*)     ;;
8294                 *)      ccdlflags="$ccdlflags $xxx"
8295                         cat <<EOM >&4
8296
8297 Adding $xxx to the flags
8298 passed to $ld so that the perl executable will find the
8299 installed shared $libperl.
8300
8301 EOM
8302                         ;;
8303                 esac
8304                 ;;
8305         esac
8306 fi
8307 # Fix ccdlflags in AIX for building external extensions.
8308 # (For building Perl itself bare -bE:perl.exp is needed,
8309 #  Makefile.SH takes care of this.)
8310 case "$osname" in
8311 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8312 esac
8313 # Respect a hint or command-line value.
8314 case "$shrpenv" in
8315 '') shrpenv="$tmp_shrpenv" ;;
8316 esac
8317 case "$ldlibpthname" in
8318 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8319 none)   ldlibpthname='' ;;
8320 esac
8321
8322 : determine where manual pages are on this system
8323 echo " "
8324 case "$sysman" in
8325 '') 
8326         syspath='/usr/share/man/man1 /usr/man/man1'
8327         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8328         syspath="$syspath /usr/man/u_man/man1"
8329         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8330         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8331         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8332         sysman=`./loc . /usr/man/man1 $syspath`
8333         ;;
8334 esac
8335 if $test -d "$sysman"; then
8336         echo "System manual is in $sysman." >&4
8337 else
8338         echo "Could not find manual pages in source form." >&4
8339 fi
8340
8341 : determine where manual pages go
8342 set man1dir man1dir none
8343 eval $prefixit
8344 $cat <<EOM
8345
8346 $spackage has manual pages available in source form.
8347 EOM
8348 case "$nroff" in
8349 nroff)
8350         echo "However, you don't have nroff, so they're probably useless to you."
8351         case "$man1dir" in
8352         '') man1dir="none";;
8353         esac;;
8354 esac
8355 echo "If you don't want the manual sources installed, answer 'none'."
8356 case "$man1dir" in
8357 ' ') dflt=none
8358         ;;
8359 '')
8360         lookpath="$prefixexp/share/man/man1"
8361         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8362         lookpath="$lookpath $prefixexp/man/p_man/man1"
8363         lookpath="$lookpath $prefixexp/man/u_man/man1"
8364         lookpath="$lookpath $prefixexp/man/man.1"
8365         case "$sysman" in
8366         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8367         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8368         esac
8369         set dflt
8370         eval $prefixup
8371         ;;
8372 *)  dflt="$man1dir"
8373         ;;
8374 esac
8375 echo " "
8376 fn=dn+~
8377 rp="Where do the main $spackage manual pages (source) go?"
8378 . ./getfile
8379 if $test "X$man1direxp" != "X$ansexp"; then
8380         installman1dir=''
8381 fi
8382 prefixvar=man1dir
8383 . ./setprefixvar
8384
8385 case "$man1dir" in
8386 '')     man1dir=' '
8387         installman1dir='';;
8388 esac
8389
8390 : What suffix to use on installed man pages
8391
8392 case "$man1dir" in
8393 ' ')
8394         man1ext='0'
8395         ;;
8396 *)
8397         rp="What suffix should be used for the main $spackage man pages?"
8398         case "$man1ext" in
8399         '')     case "$man1dir" in
8400                 *1)  dflt=1 ;;
8401                 *1p) dflt=1p ;;
8402                 *1pm) dflt=1pm ;;
8403                 *l) dflt=l;;
8404                 *n) dflt=n;;
8405                 *o) dflt=o;;
8406                 *p) dflt=p;;
8407                 *C) dflt=C;;
8408                 *L) dflt=L;;
8409                 *L1) dflt=L1;;
8410                 *) dflt=1;;
8411                 esac
8412                 ;;
8413         *)      dflt="$man1ext";;
8414         esac
8415         . ./myread
8416         man1ext="$ans"
8417         ;;
8418 esac
8419
8420 : see if we can have long filenames
8421 echo " "
8422 first=123456789abcdef
8423 $rm -f $first
8424 if (echo hi >$first) 2>/dev/null; then
8425         if $test -f 123456789abcde; then
8426                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8427                 val="$undef"
8428         else
8429                 echo 'You can have filenames longer than 14 characters.'>&4
8430                 val="$define"
8431         fi
8432 else
8433         $cat <<'EOM'
8434 You can't have filenames longer than 14 chars.
8435 You can't even think about them!
8436 EOM
8437         val="$undef"
8438 fi
8439 set d_flexfnam
8440 eval $setvar
8441 $rm -rf 123456789abcde*
8442
8443 : determine where library module manual pages go
8444 set man3dir man3dir none
8445 eval $prefixit
8446 $cat <<EOM
8447
8448 $spackage has manual pages for many of the library modules.
8449 EOM
8450
8451 case "$nroff" in
8452 nroff)
8453         $cat <<'EOM'
8454 However, you don't have nroff, so they're probably useless to you.
8455 EOM
8456         case "$man3dir" in
8457         '') man3dir="none";;
8458         esac;;
8459 esac
8460
8461 case "$d_flexfnam" in
8462 undef)
8463         $cat <<'EOM'
8464 However, your system can't handle the long file names like File::Basename.3.
8465 EOM
8466         case "$man3dir" in
8467         '') man3dir="none";;
8468         esac;;
8469 esac
8470
8471 echo "If you don't want the manual sources installed, answer 'none'."
8472 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8473 case "$man3dir" in
8474 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8475         if $test -d "$privlib/man/man3"; then
8476                 cat <<EOM >&4
8477
8478 WARNING:  Previous versions of perl installed man3 pages into
8479 $privlib/man/man3.  This version will suggest a
8480 new default of $dflt.
8481 EOM
8482                 tdflt=$dflt
8483                 dflt='n'
8484                 rp='Do you wish to preserve the old behavior?(y/n)'
8485                 . ./myread
8486                 case "$ans" in
8487                 y*) dflt="$privlib/man/man3" ;;
8488                 *)  dflt=$tdflt ;;
8489                 esac
8490     fi
8491         ;;
8492 *)      dflt="$man3dir" ;;
8493 esac
8494 case "$dflt" in
8495 ' ') dflt=none ;;
8496 esac
8497 echo " "
8498 fn=dn+~
8499 rp="Where do the $package library man pages (source) go?"
8500 . ./getfile
8501 prefixvar=man3dir
8502 . ./setprefixvar
8503
8504 case "$man3dir" in
8505 '')     man3dir=' '
8506         installman3dir='';;
8507 esac
8508
8509 : What suffix to use on installed man pages
8510 case "$man3dir" in
8511 ' ')
8512         man3ext='0'
8513         ;;
8514 *)
8515         rp="What suffix should be used for the $package library man pages?"
8516         case "$man3ext" in
8517         '')     case "$man3dir" in
8518                 *3)  dflt=3 ;;
8519                 *3p) dflt=3p ;;
8520                 *3pm) dflt=3pm ;;
8521                 *l) dflt=l;;
8522                 *n) dflt=n;;
8523                 *o) dflt=o;;
8524                 *p) dflt=p;;
8525                 *C) dflt=C;;
8526                 *L) dflt=L;;
8527                 *L3) dflt=L3;;
8528                 *) dflt=3;;
8529                 esac
8530                 ;;
8531         *)      dflt="$man3ext";;
8532         esac
8533         . ./myread
8534         man3ext="$ans"
8535         ;;
8536 esac
8537
8538 : see if we have to deal with yellow pages, now NIS.
8539 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8540         if $test -f /usr/etc/nibindd; then
8541                 echo " "
8542                 echo "I'm fairly confident you're on a NeXT."
8543                 echo " "
8544                 rp='Do you get the hosts file via NetInfo?'
8545                 dflt=y
8546                 case "$hostcat" in
8547                 nidump*) ;;
8548                 '') ;;
8549                 *) dflt=n;;
8550                 esac
8551                 . ./myread
8552                 case "$ans" in
8553                 y*) hostcat='nidump hosts .';;
8554                 *)      case "$hostcat" in
8555                         nidump*) hostcat='';;
8556                         esac
8557                         ;;
8558                 esac
8559         fi
8560         case "$hostcat" in
8561         nidump*) ;;
8562         *)
8563                 case "$hostcat" in
8564                 *ypcat*) dflt=y;;
8565                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8566                                 dflt=y
8567                         else
8568                                 dflt=n
8569                         fi;;
8570                 *) dflt=n;;
8571                 esac
8572                 echo " "
8573                 rp='Are you getting the hosts file via yellow pages?'
8574                 . ./myread
8575                 case "$ans" in
8576                 y*) hostcat='ypcat hosts';;
8577                 *) hostcat='cat /etc/hosts';;
8578                 esac
8579                 ;;
8580         esac
8581 fi
8582 case "$hostcat" in
8583 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8584 esac
8585 case "$groupcat" in
8586 '') test -f /etc/group && groupcat='cat /etc/group';;
8587 esac
8588 case "$passcat" in
8589 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8590 esac
8591
8592 : now get the host name
8593 echo " "
8594 echo "Figuring out host name..." >&4
8595 case "$myhostname" in
8596 '') cont=true
8597         echo 'Maybe "hostname" will work...'
8598         if tans=`sh -c hostname 2>&1` ; then
8599                 myhostname=$tans
8600                 phostname=hostname
8601                 cont=''
8602         fi
8603         ;;
8604 *) cont='';;
8605 esac
8606 if $test "$cont"; then
8607         if ./xenix; then
8608                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8609                 if tans=`cat /etc/systemid 2>&1` ; then
8610                         myhostname=$tans
8611                         phostname='cat /etc/systemid'
8612                         echo "Whadyaknow.  Xenix always was a bit strange..."
8613                         cont=''
8614                 fi
8615         elif $test -r /etc/systemid; then
8616                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8617         fi
8618 fi
8619 if $test "$cont"; then
8620         echo 'No, maybe "uuname -l" will work...'
8621         if tans=`sh -c 'uuname -l' 2>&1` ; then
8622                 myhostname=$tans
8623                 phostname='uuname -l'
8624         else
8625                 echo 'Strange.  Maybe "uname -n" will work...'
8626                 if tans=`sh -c 'uname -n' 2>&1` ; then
8627                         myhostname=$tans
8628                         phostname='uname -n'
8629                 else
8630                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8631                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8632                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8633                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8634                         else
8635                                 case "$myhostname" in
8636                                 '') echo "Does this machine have an identity crisis or something?"
8637                                         phostname='';;
8638                                 *)
8639                                         echo "Well, you said $myhostname before..."
8640                                         phostname='echo $myhostname';;
8641                                 esac
8642                         fi
8643                 fi
8644         fi
8645 fi
8646 case "$myhostname" in
8647 '') myhostname=noname ;;
8648 esac
8649 : you do not want to know about this
8650 set $myhostname
8651 myhostname=$1
8652
8653 : verify guess
8654 if $test "$myhostname" ; then
8655         dflt=y
8656         rp='Your host name appears to be "'$myhostname'".'" Right?"
8657         . ./myread
8658         case "$ans" in
8659         y*) ;;
8660         *) myhostname='';;
8661         esac
8662 fi
8663
8664 : bad guess or no guess
8665 while $test "X$myhostname" = X ; do
8666         dflt=''
8667         rp="Please type the (one word) name of your host:"
8668         . ./myread
8669         myhostname="$ans"
8670 done
8671
8672 : translate upper to lower if necessary
8673 case "$myhostname" in
8674 *[A-Z]*)
8675         echo "(Normalizing case in your host name)"
8676         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8677         ;;
8678 esac
8679
8680 case "$myhostname" in
8681 *.*)
8682         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8683         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8684         echo "(Trimming domain name from host name--host name is now $myhostname)"
8685         ;;
8686 *) case "$mydomain" in
8687         '')
8688                 {
8689                         test "X$hostcat" = "Xypcat hosts" &&
8690                         ypmatch "$myhostname" hosts 2>/dev/null |\
8691                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8692                         $test -s hosts
8693                 } || {
8694                         test "X$hostcat" != "X" &&
8695                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8696                                         /[       ]$myhostname[  . ]/p" > hosts
8697                 }
8698                 tmp_re="[       . ]"
8699                 if $test -f hosts; then
8700                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8701                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8702                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8703                                 hosts | $sort | $uniq | \
8704                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8705                         case `$echo X$dflt` in
8706                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8707                                 dflt=.
8708                                 ;;
8709                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8710                                 ;;
8711                         esac
8712                 else
8713                         echo "(I cannot locate a hosts database anywhere)"
8714                         dflt=.
8715                 fi
8716                 case "$dflt" in
8717                 .)
8718                         tans=`./loc resolv.conf X /etc /usr/etc`
8719                         if $test -f "$tans"; then
8720                                 echo "(Attempting domain name extraction from $tans)"
8721                                 dflt=.`$sed -n -e 's/   / /g' \
8722                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8723                                   -e 1q 2>/dev/null`
8724                                 case "$dflt" in
8725                                 .) dflt=.`$sed -n -e 's/        / /g' \
8726                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8727                                      -e 1q 2>/dev/null`
8728                                         ;;
8729                                 esac
8730                         fi
8731                         ;;
8732                 esac
8733                 case "$dflt" in
8734                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8735                         dflt=.`sh -c domainname 2>/dev/null`
8736                         case "$dflt" in
8737                         '') dflt='.';;
8738                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8739                         esac
8740                         ;;
8741                 esac
8742                 case "$dflt$osname" in
8743                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8744                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8745                         ;;
8746                 esac
8747                 case "$dflt" in
8748                 .) echo "(Lost all hope -- silly guess then)"
8749                         dflt='.nonet'
8750                         ;;
8751                 esac
8752                 $rm -f hosts
8753                 ;;
8754         *) dflt="$mydomain";;
8755         esac;;
8756 esac
8757 echo " "
8758 rp="What is your domain name?"
8759 . ./myread
8760 tans="$ans"
8761 case "$ans" in
8762 '') ;;
8763 .*) ;;
8764 *) tans=".$tans";;
8765 esac
8766 mydomain="$tans"
8767
8768 : translate upper to lower if necessary
8769 case "$mydomain" in
8770 *[A-Z]*)
8771         echo "(Normalizing case in your domain name)"
8772         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8773         ;;
8774 esac
8775
8776 : a little sanity check here
8777 case "$phostname" in
8778 '') ;;
8779 *)
8780         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8781         $myhostname$mydomain|$myhostname) ;;
8782         *)
8783                 case "$phostname" in
8784                 sed*)
8785                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8786                         ;;
8787                 *)
8788                         echo "(That doesn't agree with your $phostname command, by the way.)"
8789                         ;;
8790                 esac
8791         ;;
8792         esac
8793         ;;
8794 esac
8795
8796 : determine the e-mail address of the user who is running us
8797 $cat <<EOM
8798
8799 I need to get your e-mail address in Internet format if possible, i.e.
8800 something like user@host.domain. Please answer accurately since I have
8801 no easy means to double check it. The default value provided below
8802 is most probably close to reality but may not be valid from outside
8803 your organization...
8804
8805 EOM
8806 cont=x
8807 while test "$cont"; do
8808         case "$cf_email" in
8809         '') dflt="$cf_by@$myhostname$mydomain";;
8810         *) dflt="$cf_email";;
8811         esac
8812         rp='What is your e-mail address?'
8813         . ./myread
8814         cf_email="$ans"
8815         case "$cf_email" in
8816         *@*.*) cont='' ;;
8817         *)
8818                 rp='Address does not look like an Internet one.  Use it anyway?'
8819                 case "$fastread" in
8820                 yes) dflt=y ;;
8821                 *) dflt=n ;;
8822                 esac
8823                 . ./myread
8824                 case "$ans" in
8825                 y*) cont='' ;;
8826                 *) echo " " ;;
8827                 esac
8828                 ;;
8829         esac
8830 done
8831
8832 : Ask e-mail of administrator
8833 $cat <<EOM
8834
8835 If you or somebody else will be maintaining perl at your site, please
8836 fill in the correct e-mail address here so that they may be contacted
8837 if necessary. Currently, the "perlbug" program included with perl
8838 will send mail to this address in addition to perlbug@perl.org. You may
8839 enter "none" for no administrator.
8840
8841 EOM
8842 case "$perladmin" in
8843 '') dflt="$cf_email";;
8844 *) dflt="$perladmin";;
8845 esac
8846 rp='Perl administrator e-mail address'
8847 . ./myread
8848 perladmin="$ans"
8849
8850 : determine whether to only install version-specific parts.
8851 echo " "
8852 $cat <<EOM
8853 Do you want to install only the version-specific parts of the perl
8854 distribution?  Usually you do *not* want to do this.
8855 EOM
8856 case "$versiononly" in
8857 "$define"|[Yy]*|true) dflt='y' ;;
8858 *) dflt='n';
8859 esac
8860 rp="Do you want to install only the version-specific parts of perl?"
8861 . ./myread
8862 case "$ans" in
8863 [yY]*)  val="$define";;
8864 *)      val="$undef" ;;
8865 esac
8866 set versiononly
8867 eval $setvar
8868
8869 case "$versiononly" in
8870 "$define") inc_version_list=''
8871            inc_version_list_init=0
8872            ;;
8873 esac
8874
8875 : figure out how to guarantee perl startup
8876 : XXX Note that this currently takes advantage of the bug that binexp ignores
8877 :     the Configure -Dinstallprefix setting, which in turn means that under
8878 :     relocatable @INC, initialinstalllocation is what binexp started as.
8879 case "$startperl" in
8880 '')
8881         case "$sharpbang" in
8882         *!)
8883                 $cat <<EOH
8884
8885 I can use the #! construct to start perl on your system. This will
8886 make startup of perl scripts faster, but may cause problems if you
8887 want to share those scripts and perl is not in a standard place
8888 ($initialinstalllocation/perl) on all your platforms. The alternative
8889 is to force a shell by starting the script with a single ':' character.
8890
8891 EOH
8892                 case "$versiononly" in
8893                 "$define")      dflt="$initialinstalllocation/perl$version";;
8894                 *)              dflt="$initialinstalllocation/perl";;
8895                 esac
8896                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8897                 . ./myread
8898                 case "$ans" in
8899                 none)   startperl=": # use perl";;
8900                 *)      startperl="#!$ans"
8901                         if $test 30 -lt `echo "$ans" | wc -c`; then
8902                                 $cat >&4 <<EOM
8903
8904 WARNING:  Some systems limit the #! command to 32 characters.
8905 If you experience difficulty running Perl scripts with #!, try
8906 installing Perl in a directory with a shorter pathname.
8907
8908 EOM
8909                         fi ;;
8910                 esac
8911                 ;;
8912         *) startperl=": # use perl"
8913                 ;;
8914         esac
8915         ;;
8916 esac
8917 echo "I'll use $startperl to start perl scripts."
8918
8919 : figure best path for perl in scripts
8920 case "$perlpath" in
8921 '')
8922         case "$versiononly" in
8923         "$define")      perlpath="$initialinstalllocation/perl$version";;
8924         *)              perlpath="$initialinstalllocation/perl";;
8925         esac
8926         case "$startperl" in
8927         *!*) ;;
8928         *)
8929                 $cat <<EOH
8930
8931 I will use the "eval 'exec'" idiom to start Perl on your system.
8932 I can use the full path of your Perl binary for this purpose, but
8933 doing so may cause problems if you want to share those scripts and
8934 Perl is not always in a standard place ($initialinstalllocation/perl).
8935
8936 EOH
8937                 dflt="$initialinstalllocation/perl"
8938                 rp="What path shall I use in \"eval 'exec'\"?"
8939                 . ./myread
8940                 perlpath="$ans"
8941                 ;;
8942         esac
8943         ;;
8944 esac
8945 case "$startperl" in
8946 *!*)    ;;
8947 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8948 esac
8949
8950 : determine where public executable scripts go
8951 set scriptdir scriptdir
8952 eval $prefixit
8953 case "$scriptdir" in
8954 '')
8955         dflt="$bin"
8956         : guess some guesses
8957         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8958         $test -d /usr/share/bin     && dflt=/usr/share/bin
8959         $test -d /usr/local/script  && dflt=/usr/local/script
8960         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8961         $test -d $prefixexp/script  && dflt=$prefixexp/script
8962         set dflt
8963         eval $prefixup
8964         ;;
8965 *)  dflt="$scriptdir"
8966         ;;
8967 esac
8968 $cat <<EOM
8969
8970 Some installations have a separate directory just for executable scripts so
8971 that they can mount it across multiple architectures but keep the scripts in
8972 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8973 Or you might just lump your scripts in with all your other executables.
8974
8975 EOM
8976 fn=d~
8977 rp='Where do you keep publicly executable scripts?'
8978 . ./getfile
8979 if $test "X$ansexp" != "X$scriptdirexp"; then
8980         installscript=''
8981 fi
8982 installscriptdir=''
8983 prefixvar=scriptdir
8984 . ./setprefixvar
8985 : A little fix up for an irregularly named variable.
8986 installscript="$installscriptdir"
8987
8988 : determine where add-on public executables go
8989 case "$sitebin" in
8990 '')     dflt=$siteprefix/bin ;;
8991 *)      dflt=$sitebin ;;
8992 esac
8993 fn=d~
8994 rp='Pathname where the add-on public executables should be installed?'
8995 . ./getfile
8996 prefixvar=sitebin
8997 . ./setprefixvar
8998
8999 : determine where add-on html pages go
9000 : There is no standard location, so try to copy the previously-selected
9001 : directory structure for the core html pages.
9002 case "$sitehtml1dir" in
9003 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9004 *)     dflt=$sitehtml1dir ;;
9005 esac
9006 case "$dflt" in
9007 ''|' ') dflt=none ;;
9008 esac
9009 fn=dn+~
9010 rp='Pathname where the site-specific html pages should be installed?'
9011 . ./getfile
9012 prefixvar=sitehtml1dir
9013 . ./setprefixvar
9014
9015 : determine where add-on library html pages go
9016 : There is no standard location, so try to copy the previously-selected
9017 : directory structure for the core html pages.
9018 case "$sitehtml3dir" in
9019 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9020 *)     dflt=$sitehtml3dir ;;
9021 esac
9022 case "$dflt" in
9023 ''|' ') dflt=none ;;
9024 esac
9025 fn=dn+~
9026 rp='Pathname where the site-specific library html pages should be installed?'
9027 . ./getfile
9028 prefixvar=sitehtml3dir
9029 . ./setprefixvar
9030
9031 : determine where add-on manual pages go
9032 case "$siteman1dir" in
9033 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9034 *)      dflt=$siteman1dir ;;
9035 esac
9036 case "$dflt" in
9037 ''|' ') dflt=none ;;
9038 esac
9039 fn=dn+~
9040 rp='Pathname where the site-specific manual pages should be installed?'
9041 . ./getfile
9042 prefixvar=siteman1dir
9043 . ./setprefixvar
9044
9045 : determine where add-on library man pages go
9046 case "$siteman3dir" in
9047 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9048 *)      dflt=$siteman3dir ;;
9049 esac
9050 case "$dflt" in
9051 ''|' ') dflt=none ;;
9052 esac
9053 fn=dn+~
9054 rp='Pathname where the site-specific library manual pages should be installed?'
9055 . ./getfile
9056 prefixvar=siteman3dir
9057 . ./setprefixvar
9058
9059 : determine where add-on public executable scripts go
9060 case "$sitescript" in
9061 '')     dflt=$siteprefix/script
9062         $test -d $dflt || dflt=$sitebin ;;
9063 *)  dflt="$sitescript" ;;
9064 esac
9065 fn=d~+
9066 rp='Pathname where add-on public executable scripts should be installed?'
9067 . ./getfile
9068 prefixvar=sitescript
9069 . ./setprefixvar
9070
9071 : Check if faststdio is requested and available
9072 case "$usefaststdio" in
9073 $define|true|[yY]*|'')
9074         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9075         case "$xversion" in
9076         [68])   dflt='y' ;;
9077         *)      dflt='n' ;;
9078         esac
9079         ;;
9080 *) dflt='n';;
9081 esac
9082 cat <<EOM
9083
9084 Perl can be built to use 'fast stdio', which means using the stdio
9085 library but also directly manipulating the stdio buffers to enable
9086 faster I/O.  Using stdio is better for backward compatibility (especially
9087 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9088 interface has been preferred instead of stdio.
9089
9090 If this doesn't make any sense to you, just accept the default '$dflt'.
9091 EOM
9092 rp='Use the "fast stdio" if available?'
9093 . ./myread
9094 case "$ans" in
9095 y|Y)    val="$define" ;;
9096 *)      val="$undef" ;;
9097 esac
9098 set usefaststdio
9099 eval $setvar
9100
9101
9102 : define an is-a-typedef? function
9103 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9104 case "$inclist" in
9105 "") inclist="sys/types.h";;
9106 esac;
9107 eval "varval=\$$var";
9108 case "$varval" in
9109 "")
9110         $rm -f temp.c;
9111         for inc in $inclist; do
9112                 echo "#include <$inc>" >>temp.c;
9113         done;
9114         echo "#ifdef $type" >> temp.c;
9115         echo "printf(\"We have $type\");" >> temp.c;
9116         echo "#endif" >> temp.c;
9117         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9118         if $contains $type temp.E >/dev/null 2>&1; then
9119                 eval "$var=\$type";
9120         else
9121                 eval "$var=\$def";
9122         fi;
9123         $rm -f temp.?;;
9124 *) eval "$var=\$varval";;
9125 esac'
9126
9127 : define an is-a-typedef? function that prompts if the type is not available.
9128 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9129 case "$inclist" in
9130 "") inclist="sys/types.h";;
9131 esac;
9132 eval "varval=\$$var";
9133 case "$varval" in
9134 "")
9135         $rm -f temp.c;
9136         for inc in $inclist; do
9137                 echo "#include <$inc>" >>temp.c;
9138         done;
9139         echo "#ifdef $type" >> temp.c;
9140         echo "printf(\"We have $type\");" >> temp.c;
9141         echo "#endif" >> temp.c;
9142         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9143         echo " " ;
9144         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9145         if $contains $type temp.E >/dev/null 2>&1; then
9146                 echo "$type found." >&4;
9147                 eval "$var=\$type";
9148         else
9149                 echo "$type NOT found." >&4;
9150                 dflt="$def";
9151                 . ./myread ;
9152                 eval "$var=\$ans";
9153         fi;
9154         $rm -f temp.?;;
9155 *) eval "$var=\$varval";;
9156 esac'
9157
9158 : see what type lseek is declared as in the kernel
9159 rp="What is the type used for lseek's offset on this system?"
9160 set off_t lseektype long stdio.h sys/types.h
9161 eval $typedef_ask
9162
9163 echo " "
9164 echo "Checking to see how big your file offsets are..." >&4
9165 $cat >try.c <<EOCP
9166 #include <sys/types.h>
9167 #include <stdio.h>
9168 int main()
9169 {
9170     printf("%d\n", (int)sizeof($lseektype));
9171     return(0);
9172 }
9173 EOCP
9174 set try
9175 if eval $compile_ok; then
9176         lseeksize=`$run ./try`
9177         echo "Your file offsets are $lseeksize bytes long."
9178 else
9179         dflt=$longsize
9180         echo " "
9181         echo "(I can't seem to compile the test program.  Guessing...)"
9182         rp="What is the size of your file offsets (in bytes)?"
9183         . ./myread
9184         lseeksize="$ans"
9185 fi
9186 $rm_try
9187
9188 : see what type file positions are declared as in the library
9189 rp="What is the type for file position used by fsetpos()?"
9190 set fpos_t fpostype long stdio.h sys/types.h
9191 eval $typedef_ask
9192
9193 : Check size for Fpos_t
9194 echo " "
9195 case "$fpostype" in
9196 *_t) zzz="$fpostype"    ;;
9197 *)   zzz="fpos_t"       ;;
9198 esac
9199 echo "Checking the size of $zzz..." >&4
9200 cat > try.c <<EOCP
9201 #include <sys/types.h>
9202 #include <stdio.h>
9203 #$i_stdlib I_STDLIB
9204 #ifdef I_STDLIB
9205 #include <stdlib.h>
9206 #endif
9207 int main() {
9208     printf("%d\n", (int)sizeof($fpostype));
9209     exit(0);
9210 }
9211 EOCP
9212 set try
9213 if eval $compile_ok; then
9214         yyy=`$run ./try`
9215         case "$yyy" in
9216         '')     fpossize=4
9217                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9218                 ;;
9219         *)      fpossize=$yyy
9220                 echo "Your $zzz is $fpossize bytes long."
9221                 ;;
9222         esac
9223 else
9224         dflt="$longsize"
9225         echo " " >&4
9226         echo "(I can't compile the test program.  Guessing...)" >&4
9227         rp="What is the size of your file positions (in bytes)?"
9228         . ./myread
9229         fpossize="$ans"
9230 fi
9231
9232 : Check for large file support
9233 # Backward compatibility (uselfs is deprecated).
9234 case "$uselfs" in
9235 "$define"|true|[yY]*)
9236         cat <<EOM >&4
9237
9238 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9239 EOM
9240         uselargefiles="$define"
9241         ;;
9242 esac
9243
9244 case "$lseeksize:$fpossize" in
9245 8:8) cat <<EOM
9246
9247 You can have files larger than 2 gigabytes.
9248 EOM
9249    val="$define" ;;
9250 *)    case "$uselargefiles" in
9251    "$undef"|false|[nN]*) dflt='n' ;;
9252    *)   dflt='y' ;;
9253    esac
9254    cat <<EOM
9255
9256 Perl can be built to understand large files (files larger than 2 gigabytes)
9257 on some systems.  To do so, Configure can be run with -Duselargefiles.
9258
9259 If this doesn't make any sense to you, just accept the default '$dflt'.
9260 EOM
9261    rp='Try to understand large files, if available?'
9262    . ./myread
9263    case "$ans" in
9264    y|Y)         val="$define" ;;
9265    *)           val="$undef"  ;;
9266    esac
9267    ;;
9268 esac
9269 set uselargefiles
9270 eval $setvar
9271 : Look for a hint-file generated 'call-back-unit'.  If the
9272 : user has specified that a large files perl is to be built,
9273 : we may need to set or change some other defaults.
9274 if $test -f uselargefiles.cbu; then
9275         echo "Your platform has some specific hints regarding large file builds, using them..."
9276         . ./uselargefiles.cbu
9277 fi
9278 case "$uselargefiles" in
9279 "$define")
9280         if $test -f uselargefiles.cbu; then
9281                 echo " "
9282                 echo "Rechecking to see how big your file offsets are..." >&4
9283                 $cat >try.c <<EOCP
9284 #include <sys/types.h>
9285 #include <stdio.h>
9286 int main()
9287 {
9288     printf("%d\n", (int)sizeof($lseektype));
9289     return(0);
9290 }
9291 EOCP
9292                 set try
9293                 if eval $compile_ok; then
9294                         lseeksize=`$run ./try`
9295                         $echo "Your file offsets are now $lseeksize bytes long."
9296                 else
9297                         dflt="$lseeksize"
9298                         echo " "
9299                         echo "(I can't seem to compile the test program.  Guessing...)"
9300                         rp="What is the size of your file offsets (in bytes)?"
9301                         . ./myread
9302                         lseeksize="$ans"
9303                 fi
9304                 case "$fpostype" in
9305                 *_t) zzz="$fpostype"    ;;
9306                 *)   zzz="fpos_t"       ;;
9307                 esac
9308                 $echo $n "Rechecking the size of $zzz...$c" >&4
9309                 $cat > try.c <<EOCP
9310 #include <sys/types.h>
9311 #include <stdio.h>
9312 #$i_stdlib I_STDLIB
9313 #ifdef I_STDLIB
9314 #include <stdlib.h>
9315 #endif
9316 int main() {
9317     printf("%d\n", (int)sizeof($fpostype));
9318     return(0);
9319 }
9320 EOCP
9321                 set try
9322                 if eval $compile_ok; then
9323                         yyy=`$run ./try`
9324                         dflt="$lseeksize"
9325                         case "$yyy" in
9326                         '')     echo " "
9327                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9328                                 ;;
9329                         *)      fpossize=$yyy
9330                                 echo " $fpossize bytes." >&4
9331                                 ;;
9332                         esac
9333                 else
9334                         dflt="$fpossize"
9335                         echo " "
9336                         echo "(I can't compile the test program.  Guessing...)" >&4
9337                         rp="What is the size of your file positions (in bytes)?"
9338                         . ./myread
9339                         fpossize="$ans"
9340                 fi
9341                 $rm_try
9342         fi
9343         ;;
9344 esac
9345
9346 : Set the vendorbin variables
9347 case "$vendorprefix" in
9348 '')     d_vendorbin="$undef"
9349         vendorbin=''
9350         vendorbinexp=''
9351         ;;
9352 *)      d_vendorbin="$define"
9353         : determine where vendor-supplied executables go.
9354         case "$vendorbin" in
9355         '') dflt=$vendorprefix/bin ;;
9356         *)      dflt="$vendorbin" ;;
9357         esac
9358         fn=d~+
9359         rp='Pathname for the vendor-supplied executables directory?'
9360         . ./getfile
9361         vendorbin="$ans"
9362         vendorbinexp="$ansexp"
9363         ;;
9364 esac
9365 prefixvar=vendorbin
9366 . ./installprefix
9367
9368 : Set the vendorhtml1dir variables
9369 case "$vendorprefix" in
9370 '')     vendorhtml1dir=''
9371         vendorhtml1direxp=''
9372         ;;
9373 *)      : determine where vendor-supplied html pages go.
9374         : There is no standard location, so try to copy the previously-selected
9375         : directory structure for the core html pages.
9376         : XXX Better default suggestions would be welcome.
9377         case "$vendorhtml1dir" in
9378         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9379         *)      dflt=$vendorhtml1dir ;;
9380         esac
9381         case "$dflt" in
9382         ''|' ') dflt=none ;;
9383         esac
9384         fn=dn+~
9385         rp='Pathname for the vendor-supplied html pages?'
9386         . ./getfile
9387         vendorhtml1dir="$ans"
9388         vendorhtml1direxp="$ansexp"
9389         ;;
9390 esac
9391 : Use ' ' for none so value is preserved next time through Configure
9392 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9393 prefixvar=vendorhtml1dir
9394 . ./installprefix
9395
9396 : Set the vendorhtml3dir variables
9397 case "$vendorprefix" in
9398 '')     vendorhtml3dir=''
9399         vendorhtml3direxp=''
9400         ;;
9401 *)      : determine where vendor-supplied module html pages go.
9402         : There is no standard location, so try to copy the previously-selected
9403         : directory structure for the core html pages.
9404         : XXX Better default suggestions would be welcome.
9405         case "$vendorhtml3dir" in
9406         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9407         *)      dflt=$vendorhtml3dir ;;
9408         esac
9409         case "$dflt" in
9410         ''|' ') dflt=none ;;
9411         esac
9412         fn=dn+~
9413         rp='Pathname for the vendor-supplied html pages?'
9414         . ./getfile
9415         vendorhtml3dir="$ans"
9416         vendorhtml3direxp="$ansexp"
9417         ;;
9418 esac
9419 : Use ' ' for none so value is preserved next time through Configure
9420 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9421 prefixvar=vendorhtml3dir
9422 . ./installprefix
9423
9424 : Set the vendorman1dir variables
9425 case "$vendorprefix" in
9426 '')     vendorman1dir=''
9427         vendorman1direxp=''
9428         ;;
9429 *)      : determine where vendor-supplied manual pages go.
9430         case "$vendorman1dir" in
9431         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9432         *)      dflt=$vendorman1dir ;;
9433         esac
9434         case "$dflt" in
9435         ''|' ') dflt=none ;;
9436         esac
9437         fn=nd~+
9438         rp='Pathname for the vendor-supplied manual section 1 pages?'
9439         . ./getfile
9440         vendorman1dir="$ans"
9441         vendorman1direxp="$ansexp"
9442         ;;
9443 esac
9444 : Use ' ' for none so value is preserved next time through Configure
9445 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9446 prefixvar=vendorman1dir
9447 . ./installprefix
9448
9449 : Set the vendorman3dir variables
9450 case "$vendorprefix" in
9451 '')     vendorman3dir=''
9452         vendorman3direxp=''
9453         ;;
9454 *)      : determine where vendor-supplied module manual pages go.
9455         case "$vendorman3dir" in
9456         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9457         *)      dflt=$vendorman3dir ;;
9458         esac
9459         case "$dflt" in
9460         ''|' ') dflt=none ;;
9461         esac
9462         fn=nd~+
9463         rp='Pathname for the vendor-supplied manual section 3 pages?'
9464         . ./getfile
9465         vendorman3dir="$ans"
9466         vendorman3direxp="$ansexp"
9467         ;;
9468 esac
9469 : Use ' ' for none so value is preserved next time through Configure
9470 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9471 prefixvar=vendorman3dir
9472 . ./installprefix
9473
9474 : Set the vendorscript variables
9475 case "$vendorprefix" in
9476 '')     d_vendorscript="$undef"
9477         vendorscript=''
9478         vendorscriptexp=''
9479         ;;
9480 *)      d_vendorscript="$define"
9481         : determine where vendor-supplied scripts go.
9482         case "$vendorscript" in
9483         '')     dflt=$vendorprefix/script
9484                 $test -d $dflt || dflt=$vendorbin ;;
9485         *)  dflt="$vendorscript" ;;
9486         esac
9487         $cat <<EOM
9488
9489 The installation process will create a directory for
9490 vendor-supplied scripts.
9491
9492 EOM
9493         fn=d~+
9494         rp='Pathname for the vendor-supplied scripts directory?'
9495         . ./getfile
9496         vendorscript="$ans"
9497         vendorscriptexp="$ansexp"
9498         ;;
9499 esac
9500 prefixvar=vendorscript
9501 . ./installprefix
9502
9503 : script used to emit important warnings
9504 cat >warn <<EOS
9505 $startsh
9506 if test \$# -gt 0; then
9507         echo "\$@" >msg
9508 else
9509         cat >msg
9510 fi
9511 echo "*** WARNING:" >&4
9512 sed -e 's/^/*** /' <msg >&4
9513 echo "*** " >&4
9514 cat msg >>config.msg
9515 echo " " >>config.msg
9516 rm -f msg
9517 EOS
9518 chmod +x warn
9519 $eunicefix warn
9520
9521 : see which of string.h or strings.h is needed
9522 echo " "
9523 strings=`./findhdr string.h`
9524 if $test "$strings" && $test -r "$strings"; then
9525         echo "Using <string.h> instead of <strings.h>." >&4
9526         val="$define"
9527 else
9528         val="$undef"
9529         strings=`./findhdr strings.h`
9530         if $test "$strings" && $test -r "$strings"; then
9531                 echo "Using <strings.h> instead of <string.h>." >&4
9532         else
9533                 ./warn "No string header found -- You'll surely have problems."
9534         fi
9535 fi
9536 set i_string
9537 eval $setvar
9538 case "$i_string" in
9539 "$undef") strings=`./findhdr strings.h`;;
9540 *)        strings=`./findhdr string.h`;;
9541 esac
9542
9543 : see if qgcvt exists
9544 set qgcvt d_qgcvt
9545 eval $inlibc
9546
9547 : Check print/scan long double stuff
9548 echo " "
9549
9550 if $test X"$d_longdbl" = X"$define"; then
9551
9552 echo "Checking how to print long doubles..." >&4
9553
9554 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9555         $cat >try.c <<'EOCP'
9556 #include <sys/types.h>
9557 #include <stdio.h>
9558 int main() {
9559   double d = 123.456;
9560   printf("%.3f\n", d);
9561 }
9562 EOCP
9563         set try
9564         if eval $compile; then
9565                 yyy=`$run ./try`
9566                 case "$yyy" in
9567                 123.456)
9568                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9569                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9570                         echo "We will use %f."
9571                         ;;
9572                 esac
9573         fi
9574 fi
9575
9576 if $test X"$sPRIfldbl" = X; then
9577         $cat >try.c <<'EOCP'
9578 #include <sys/types.h>
9579 #include <stdio.h>
9580 int main() {
9581   long double d = 123.456;
9582   printf("%.3Lf\n", d);
9583 }
9584 EOCP
9585         set try
9586         if eval $compile; then
9587                 yyy=`$run ./try`
9588                 case "$yyy" in
9589                 123.456)
9590                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9591                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9592                         echo "We will use %Lf."
9593                         ;;
9594                 esac
9595         fi
9596 fi
9597
9598 if $test X"$sPRIfldbl" = X; then
9599         $cat >try.c <<'EOCP'
9600 #include <sys/types.h>
9601 #include <stdio.h>
9602 int main() {
9603   long double d = 123.456;
9604   printf("%.3llf\n", d);
9605 }
9606 EOCP
9607         set try
9608         if eval $compile; then
9609                 yyy=`$run ./try`
9610                 case "$yyy" in
9611                 123.456)
9612                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9613                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9614                         echo "We will use %llf."
9615                         ;;
9616                 esac
9617         fi
9618 fi
9619
9620 if $test X"$sPRIfldbl" = X; then
9621         $cat >try.c <<'EOCP'
9622 #include <sys/types.h>
9623 #include <stdio.h>
9624 int main() {
9625   long double d = 123.456;
9626   printf("%.3lf\n", d);
9627 }
9628 EOCP
9629         set try
9630         if eval $compile; then
9631                 yyy=`$run ./try`
9632                 case "$yyy" in
9633                 123.456)
9634                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9635                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9636                         echo "We will use %lf."
9637                         ;;
9638                 esac
9639         fi
9640 fi
9641
9642 if $test X"$sPRIfldbl" = X; then
9643         echo "Cannot figure out how to print long doubles." >&4
9644 else
9645         sSCNfldbl=$sPRIfldbl    # expect consistency
9646 fi
9647
9648 $rm_try
9649
9650 fi # d_longdbl
9651
9652 case "$sPRIfldbl" in
9653 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9654         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9655         d_SCNfldbl="$undef";
9656         ;;
9657 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9658         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9659         d_SCNfldbl="$define";
9660         ;;
9661 esac
9662
9663 : Check how to convert floats to strings.
9664
9665 if test "X$d_Gconvert" = X; then
9666
9667 echo " "
9668 echo "Checking for an efficient way to convert floats to strings."
9669 echo " " > try.c
9670 case "$uselongdouble" in
9671 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9672 esac
9673 case "$d_longdbl" in
9674 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9675 esac
9676 case "$d_PRIgldbl" in
9677 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9678 esac
9679 $cat >>try.c <<EOP
9680 #ifdef TRY_gconvert
9681 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9682 char *myname = "gconvert";
9683 #endif
9684 #ifdef TRY_gcvt
9685 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9686 char *myname = "gcvt";
9687 #endif
9688 #ifdef TRY_qgcvt
9689 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9690 char *myname = "qgcvt";
9691 #define DOUBLETYPE long double
9692 #endif
9693 #ifdef TRY_sprintf
9694 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9695 #ifdef HAS_PRIgldbl
9696 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9697 #else
9698 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9699 #endif
9700 #else
9701 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9702 #endif
9703 char *myname = "sprintf";
9704 #endif
9705
9706 #ifndef DOUBLETYPE
9707 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9708 #define DOUBLETYPE long double
9709 #else
9710 #define DOUBLETYPE double
9711 #endif
9712 #endif
9713
9714 #include <stdio.h>
9715
9716 #$i_stdlib I_STDLIB
9717 #ifdef I_STDLIB
9718 #include <stdlib.h>
9719 #endif
9720 #$i_string I_STRING
9721 #ifdef I_STRING
9722 #  include <string.h>
9723 #else
9724 #  include <strings.h>
9725 #endif
9726
9727 int checkit(char *expect, char *got)
9728 {
9729     if (strcmp(expect, got)) {
9730                 printf("%s oddity:  Expected %s, got %s\n",
9731                         myname, expect, got);
9732                 exit(1);
9733         }
9734 }
9735
9736 int main()
9737 {
9738         char buf[64];
9739         buf[63] = '\0';
9740
9741         /* This must be 1st test on (which?) platform */
9742         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9743         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9744         checkit("0.1", buf);
9745
9746         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9747         checkit("0.01", buf);
9748
9749         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9750         checkit("0.001", buf);
9751
9752         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9753         checkit("0.0001", buf);
9754
9755         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9756         if (strlen(buf) > 5)
9757             checkit("9e-005", buf); /* for Microsoft ?? */
9758         else
9759             checkit("9e-05", buf);
9760
9761         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9762         checkit("1", buf);
9763
9764         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9765         checkit("1.1", buf);
9766
9767         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9768         checkit("1.01", buf);
9769
9770         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9771         checkit("1.001", buf);
9772
9773         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9774         checkit("1.0001", buf);
9775
9776         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9777         checkit("1.00001", buf);
9778
9779         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9780         checkit("1.000001", buf);
9781
9782         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9783         checkit("0", buf);
9784
9785         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9786         checkit("-1", buf);
9787
9788         /* Some Linux gcvt's give 1.e+5 here. */
9789         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9790         checkit("100000", buf);
9791
9792         /* Some Linux gcvt's give -1.e+5 here. */
9793         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9794         checkit("-100000", buf);
9795
9796         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9797         checkit("123.456", buf);
9798
9799         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9800         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9801         /* 34 should be enough to scare even long double
9802          * places into using the e notation. */
9803         if (strlen(buf) > 5)
9804             checkit("1e+034", buf); /* for Microsoft */
9805         else
9806             checkit("1e+34", buf);
9807
9808         /* For Perl, if you add additional tests here, also add them to
9809          * t/base/num.t for benefit of platforms not using Configure or
9810          * overriding d_Gconvert */
9811
9812         exit(0);
9813 }
9814 EOP
9815 : first add preferred functions to our list
9816 xxx_list=""
9817 for xxx_convert in $gconvert_preference; do
9818     case $xxx_convert in
9819     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9820     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9821     esac
9822 done
9823 : then add any others
9824 for xxx_convert in gconvert gcvt sprintf; do
9825     case "$xxx_list" in
9826     *$xxx_convert*) ;;
9827     *) xxx_list="$xxx_list $xxx_convert" ;;
9828     esac
9829 done
9830
9831 case "$d_longdbl$uselongdouble" in
9832 "$define$define")
9833     : again, add prefered functions to our list first
9834     xxx_ld_list=""
9835     for xxx_convert in $gconvert_ld_preference; do
9836         case $xxx_convert in
9837         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9838         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9839         esac
9840     done
9841     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9842     for xxx_convert in qgcvt sprintf $xxx_list; do
9843         case "$xxx_ld_list" in
9844         $xxx_convert*|*" $xxx_convert"*) ;;
9845         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9846         esac
9847     done
9848     : if sprintf cannot do long doubles, move it to the end
9849     if test "$d_PRIgldbl" != "$define"; then
9850         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9851     fi
9852     : if no qgcvt, remove it
9853     if test "$d_qgcvt" != "$define"; then
9854         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9855     fi
9856     : use the ld_list
9857     xxx_list="$xxx_ld_list"
9858     ;;
9859 esac
9860
9861 for xxx_convert in $xxx_list; do
9862         echo "Trying $xxx_convert..."
9863         $rm -f try try$_o core
9864         set try -DTRY_$xxx_convert
9865         if eval $compile; then
9866                 echo "$xxx_convert() found." >&4
9867                 if $run ./try; then
9868                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9869                         break;
9870                 else
9871                         echo "...But $xxx_convert didn't work as I expected."
9872                         xxx_convert=''
9873                 fi
9874         else
9875                 echo "$xxx_convert NOT found." >&4
9876         fi
9877 done
9878
9879 if test X$xxx_convert = X; then
9880     echo "*** WHOA THERE!!! ***" >&4
9881     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9882     xxx_convert=sprintf
9883 fi
9884
9885 case "$xxx_convert" in
9886 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9887 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9888 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9889 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9890    "$define$define$define")
9891       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9892    "$define$define$undef")
9893       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9894    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9895    esac
9896    ;;
9897 esac
9898
9899 fi
9900 $rm_try
9901
9902 : see if _fwalk exists
9903 set fwalk d__fwalk
9904 eval $inlibc
9905
9906 : Initialize h_fcntl
9907 h_fcntl=false
9908
9909 : Initialize h_sysfile
9910 h_sysfile=false
9911
9912 : access call always available on UNIX
9913 set access d_access
9914 eval $inlibc
9915
9916 : locate the flags for 'access()'
9917 case "$d_access" in
9918 "$define")
9919         echo " "
9920         $cat >access.c <<EOCP
9921 #include <sys/types.h>
9922 #ifdef I_FCNTL
9923 #include <fcntl.h>
9924 #endif
9925 #ifdef I_SYS_FILE
9926 #include <sys/file.h>
9927 #endif
9928 #ifdef I_UNISTD
9929 #include <unistd.h>
9930 #endif
9931 #$i_stdlib I_STDLIB
9932 #ifdef I_STDLIB
9933 #include <stdlib.h>
9934 #endif
9935 int main() {
9936         exit(R_OK);
9937 }
9938 EOCP
9939         : check sys/file.h first, no particular reason here
9940         if $test `./findhdr sys/file.h` && \
9941                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9942                 h_sysfile=true;
9943                 echo "<sys/file.h> defines the *_OK access constants." >&4
9944         elif $test `./findhdr fcntl.h` && \
9945                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9946                 h_fcntl=true;
9947                 echo "<fcntl.h> defines the *_OK access constants." >&4
9948         elif $test `./findhdr unistd.h` && \
9949                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9950                 echo "<unistd.h> defines the *_OK access constants." >&4
9951         else
9952                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9953         fi
9954         ;;
9955 esac
9956 $rm -f access*
9957
9958 : see if accessx exists
9959 set accessx d_accessx
9960 eval $inlibc
9961
9962 : see if aintl exists
9963 set aintl d_aintl
9964 eval $inlibc
9965
9966 : see if alarm exists
9967 set alarm d_alarm
9968 eval $inlibc
9969
9970 : see if 64bit time functions exists
9971
9972 set ctime64 d_ctime64
9973 eval $inlibc
9974
9975 set localtime64 d_localtime64
9976 eval $inlibc
9977
9978 set gmtime64 d_gmtime64
9979 eval $inlibc
9980
9981 set mktime64 d_mktime64
9982 eval $inlibc
9983
9984 set difftime64 d_difftime64
9985 eval $inlibc
9986
9987 set asctime64 d_asctime64
9988 eval $inlibc
9989
9990 : see if POSIX threads are available
9991 set pthread.h i_pthread
9992 eval $inhdr
9993
9994 : define a fucntion to check prototypes
9995 $cat > protochk <<EOSH
9996 $startsh
9997 cc="$cc"
9998 optimize="$optimize"
9999 ccflags="$ccflags"
10000 prototype="$prototype"
10001 define="$define"
10002 rm_try="$rm_try"
10003 usethreads=$usethreads
10004 i_pthread=$i_pthread
10005 pthread_h_first=$pthread_h_first
10006 EOSH
10007
10008 $cat >> protochk <<'EOSH'
10009
10010 $rm_try
10011 foo="$1"
10012 shift
10013 while test $# -ge 2; do
10014         case "$1" in
10015                 $define) echo "#include <$2>" >> try.c ;;
10016                 literal) echo "$2" >> try.c ;;
10017         esac
10018     # Extra magic for the benefit of systems that need pthread.h
10019     # to be included early to correctly detect threadsafe functions.
10020     # Such functions must guarantee themselves, though, that the usethreads
10021     # and i_pthread have been defined, before calling protochk.
10022     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10023         echo "#include <pthread.h>" >> try.c
10024         pthread_h_done=yes
10025     fi
10026     shift 2
10027 done
10028 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10029 cat >> try.c <<'EOCP'
10030 #ifdef CAN_PROTOTYPE
10031 #define _(args) args
10032 #else
10033 #define _(args) ()
10034 #endif
10035 EOCP
10036 echo "$foo" >> try.c
10037 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10038 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10039 status=$?
10040 $rm_try
10041 exit $status
10042 EOSH
10043 chmod +x protochk
10044 $eunicefix protochk
10045
10046 : Define hasproto macro for Configure internal use
10047 hasproto='varname=$1; func=$2; shift; shift;
10048 while $test $# -ge 2; do
10049         case "$1" in
10050         $define) echo "#include <$2>";;
10051         esac ;
10052     shift 2;
10053 done > try.c;
10054 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10055 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10056         echo "$func() prototype found.";
10057         val="$define";
10058 else
10059         echo "$func() prototype NOT found.";
10060         val="$undef";
10061 fi;
10062 set $varname;
10063 eval $setvar;
10064 $rm_try tryout.c'
10065
10066 : see if sys/types.h has to be included
10067 set sys/types.h i_systypes
10068 eval $inhdr
10069
10070 : see if sys/select.h has to be included
10071 set sys/select.h i_sysselct
10072 eval $inhdr
10073
10074 : Define hasfield macro for Configure internal use
10075 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10076 while $test $# -ge 2; do
10077         case "$1" in
10078         $define) echo "#include <$2>";;
10079         esac ;
10080     shift 2;
10081 done > try.c;
10082 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10083 set try;
10084 if eval $compile; then
10085         val="$define";
10086 else
10087         val="$undef";
10088 fi;
10089 set $varname;
10090 eval $setvar;
10091 $rm_try'
10092
10093 : see if we should include time.h, sys/time.h, or both
10094 echo " "
10095 if test "X$timeincl" = X; then
10096         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10097         $echo $n "I'm now running the test program...$c"
10098         $cat >try.c <<EOCP
10099 #include <sys/types.h>
10100 #ifdef I_TIME
10101 #include <time.h>
10102 #endif
10103 #ifdef I_SYSTIME
10104 #ifdef SYSTIMEKERNEL
10105 #define KERNEL
10106 #endif
10107 #include <sys/time.h>
10108 #endif
10109 #ifdef I_SYSSELECT
10110 #include <sys/select.h>
10111 #endif
10112 #$i_stdlib I_STDLIB
10113 #ifdef I_STDLIB
10114 #include <stdlib.h>
10115 #endif
10116 int main()
10117 {
10118         struct tm foo;
10119 #ifdef S_TIMEVAL
10120         struct timeval bar;
10121 #endif
10122 #ifdef S_TIMEZONE
10123         struct timezone tzp;
10124 #endif
10125         if (foo.tm_sec == foo.tm_sec)
10126                 exit(0);
10127 #ifdef S_TIMEVAL
10128         if (bar.tv_sec == bar.tv_sec)
10129                 exit(0);
10130 #endif
10131         exit(1);
10132 }
10133 EOCP
10134         flags=''
10135         for s_timezone in '-DS_TIMEZONE' ''; do
10136         sysselect=''
10137         for s_timeval in '-DS_TIMEVAL' ''; do
10138         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10139         for i_time in '' '-DI_TIME'; do
10140         for i_systime in '-DI_SYSTIME' ''; do
10141                 case "$flags" in
10142                 '') $echo $n ".$c"
10143                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10144                         if eval $compile; then
10145                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10146                                 shift
10147                                 flags="$*"
10148                                 echo " "
10149                                 $echo $n "Succeeded with $flags$c"
10150                         fi
10151                         ;;
10152                 esac
10153         done
10154         done
10155         done
10156         done
10157         done
10158         timeincl=''
10159         echo " "
10160         case "$flags" in
10161         *SYSTIMEKERNEL*) i_systimek="$define"
10162                 timeincl=`./findhdr sys/time.h`
10163                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10164         *) i_systimek="$undef";;
10165         esac
10166         case "$flags" in
10167         *I_TIME*) i_time="$define"
10168                 timeincl=`./findhdr time.h`" $timeincl"
10169                 echo "We'll include <time.h>." >&4;;
10170         *) i_time="$undef";;
10171         esac
10172         case "$flags" in
10173         *I_SYSTIME*) i_systime="$define"
10174                 timeincl=`./findhdr sys/time.h`" $timeincl"
10175                 echo "We'll include <sys/time.h>." >&4;;
10176         *) i_systime="$undef";;
10177         esac
10178         $rm_try
10179 fi
10180 : see if struct tm knows about tm_zone
10181 case "$i_systime$i_time" in
10182 *$define*)
10183         echo " "
10184         echo "Checking to see if your struct tm has tm_zone field..." >&4
10185         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10186         eval $hasfield
10187         ;;
10188 *)      val="$undef"
10189         set d_tm_tm_zone
10190         eval $setvar
10191         ;;
10192 esac
10193 case "$d_tm_tm_zone" in
10194 "$define")      echo "Yes, it does."   ;;
10195 *)              echo "No, it doesn't." ;;
10196 esac
10197 : see if struct tm knows about tm_gmtoff
10198 case "$i_systime$i_time" in
10199 *$define*)
10200         echo " "
10201         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10202         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10203         eval $hasfield
10204         ;;
10205 *)      val="$undef"
10206         set d_tm_tm_gmtoff
10207         eval $setvar
10208         ;;
10209 esac
10210 case "$d_tm_tm_gmtoff" in
10211 "$define")      echo "Yes, it does."   ;;
10212 *)              echo "No, it doesn't." ;;
10213 esac
10214
10215 : see if asctime_r exists
10216 set asctime_r d_asctime_r
10217 eval $inlibc
10218 case "$d_asctime_r" in
10219 "$define")
10220         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10221         case "$d_asctime_r_proto:$usethreads" in
10222         ":define")      d_asctime_r_proto=define
10223                 set d_asctime_r_proto asctime_r $hdrs
10224                 eval $hasproto ;;
10225         *)      ;;
10226         esac
10227         case "$d_asctime_r_proto" in
10228         define)
10229         case "$asctime_r_proto" in
10230         ''|0) try='char* asctime_r(const struct tm*, char*);'
10231         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10232         esac
10233         case "$asctime_r_proto" in
10234         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10235         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10236         esac
10237         case "$asctime_r_proto" in
10238         ''|0) try='int asctime_r(const struct tm*, char*);'
10239         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10240         esac
10241         case "$asctime_r_proto" in
10242         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10243         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10244         esac
10245         case "$asctime_r_proto" in
10246         ''|0)   d_asctime_r=undef
10247                 asctime_r_proto=0
10248                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10249         * )     case "$asctime_r_proto" in
10250                 REENTRANT_PROTO*) ;;
10251                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10252                 esac
10253                 echo "Prototype: $try" ;;
10254         esac
10255         ;;
10256         *)      case "$usethreads" in
10257                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10258                 esac
10259                 d_asctime_r=undef
10260                 asctime_r_proto=0
10261                 ;;
10262         esac
10263         ;;
10264 *)      asctime_r_proto=0
10265         ;;
10266 esac
10267
10268 : see if atolf exists
10269 set atolf d_atolf
10270 eval $inlibc
10271
10272 : see if atoll exists
10273 set atoll d_atoll
10274 eval $inlibc
10275
10276 : Look for GCC-style attribute format
10277 case "$d_attribute_format" in
10278 '')
10279 echo " "
10280 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10281 $cat >attrib.c <<'EOCP'
10282 #include <stdio.h>
10283 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10284 EOCP
10285 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10286         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10287                 echo "Your C compiler doesn't support __attribute__((format))."
10288                 val="$undef"
10289         else
10290                 echo "Your C compiler supports __attribute__((format))."
10291                 val="$define"
10292         fi
10293 else
10294         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10295         val="$undef"
10296 fi
10297 ;;
10298 *) val="$d_attribute_format" ;;
10299 esac
10300 set d_attribute_format
10301 eval $setvar
10302 $rm -f attrib*
10303
10304 : Look for GCC-style attribute format with null format allowed
10305 case "$d_printf_format_null" in
10306 '') case "$d_attribute_format" in
10307     $define)
10308         echo " "
10309         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10310 $cat >attrib.c <<EOCP
10311 #include <stdio.h>
10312 #$i_stdlib I_STDLIB
10313 #ifdef I_STDLIB
10314 #include <stdlib.h>
10315 #endif
10316 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10317 int null_printf (char* pat,...) { return (int)pat; }
10318 int main () { exit(null_printf(NULL)); }
10319 EOCP
10320         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10321             : run the executable in case it produces a run-time warning
10322             if $run ./attrib >>attrib.out 2>&1; then
10323                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10324                     echo "Your C compiler doesn't allow __printf__ format to be null."
10325                     val="$undef"
10326                 else
10327                     echo "Your C compiler allows __printf__ format to be null."
10328                     val="$define"
10329                 fi
10330             else
10331             echo "Your C compiler executable failed with __printf__ format null."
10332             val="$undef"
10333         fi
10334     else
10335         echo "Your C compiler fails with __printf__ format null."
10336         val="$undef"
10337     fi
10338     ;;
10339     *)  val="$undef" ;;
10340     esac
10341 ;;
10342 *)  val="$d_printf_format_null" ;;
10343 esac
10344 set d_printf_format_null
10345 eval $setvar
10346 $rm -f attrib*
10347
10348 : Look for GCC-style attribute malloc
10349 case "$d_attribute_malloc" in
10350 '')
10351 echo " "
10352 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10353 $cat >attrib.c <<'EOCP'
10354 #include <stdio.h>
10355 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10356 EOCP
10357 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10358         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10359                 echo "Your C compiler doesn't support __attribute__((malloc))."
10360                 val="$undef"
10361         else
10362                 echo "Your C compiler supports __attribute__((malloc))."
10363                 val="$define"
10364         fi
10365 else
10366         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10367         val="$undef"
10368 fi
10369 ;;
10370 *) val="$d_attribute_malloc" ;;
10371 esac
10372 set d_attribute_malloc
10373 eval $setvar
10374 $rm -f attrib*
10375
10376 : Look for GCC-style attribute nonnull
10377 case "$d_attribute_nonnull" in
10378 '')
10379 echo " "
10380 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10381 $cat >attrib.c <<'EOCP'
10382 #include <stdio.h>
10383 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10384 EOCP
10385 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10386         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10387                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10388                 val="$undef"
10389         else
10390                 echo "Your C compiler supports __attribute__((nonnull))."
10391                 val="$define"
10392         fi
10393 else
10394         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10395         val="$undef"
10396 fi
10397 ;;
10398 *) val="$d_attribute_nonnull" ;;
10399 esac
10400 set d_attribute_nonnull
10401 eval $setvar
10402 $rm -f attrib*
10403
10404 : Look for GCC-style attribute noreturn
10405 case "$d_attribute_noreturn" in
10406 '')
10407 echo " "
10408 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10409 $cat >attrib.c <<'EOCP'
10410 #include <stdio.h>
10411 void fall_over_dead( void ) __attribute__((noreturn));
10412 EOCP
10413 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10414         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10415                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10416                 val="$undef"
10417         else
10418                 echo "Your C compiler supports __attribute__((noreturn))."
10419                 val="$define"
10420         fi
10421 else
10422         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10423         val="$undef"
10424 fi
10425 ;;
10426 *) val="$d_attribute_noreturn" ;;
10427 esac
10428 set d_attribute_noreturn
10429 eval $setvar
10430 $rm -f attrib*
10431
10432 : Look for GCC-style attribute pure
10433 case "$d_attribute_pure" in
10434 '')
10435 echo " "
10436 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10437 $cat >attrib.c <<'EOCP'
10438 #include <stdio.h>
10439 int square( int n ) __attribute__((pure));
10440 EOCP
10441 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10442         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10443                 echo "Your C compiler doesn't support __attribute__((pure))."
10444                 val="$undef"
10445         else
10446                 echo "Your C compiler supports __attribute__((pure))."
10447                 val="$define"
10448         fi
10449 else
10450         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10451         val="$undef"
10452 fi
10453 ;;
10454 *) val="$d_attribute_pure" ;;
10455 esac
10456 set d_attribute_pure
10457 eval $setvar
10458 $rm -f attrib*
10459
10460 : Look for GCC-style attribute unused
10461 case "$d_attribute_unused" in
10462 '')
10463 echo " "
10464 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10465 $cat >attrib.c <<'EOCP'
10466 #include <stdio.h>
10467 int do_something( int dummy __attribute__((unused)), int n );
10468 EOCP
10469 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10470         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10471                 echo "Your C compiler doesn't support __attribute__((unused))."
10472                 val="$undef"
10473         else
10474                 echo "Your C compiler supports __attribute__((unused))."
10475                 val="$define"
10476         fi
10477 else
10478         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10479         val="$undef"
10480 fi
10481 ;;
10482 *) val="$d_attribute_unused" ;;
10483 esac
10484 set d_attribute_unused
10485 eval $setvar
10486 $rm -f attrib*
10487
10488 : Look for GCC-style attribute warn_unused_result
10489 case "$d_attribute_warn_unused_result" in
10490 '')
10491 echo " "
10492 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10493 $cat >attrib.c <<'EOCP'
10494 #include <stdio.h>
10495 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10496 EOCP
10497 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10498         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10499                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10500                 val="$undef"
10501         else
10502                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10503                 val="$define"
10504         fi
10505 else
10506         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10507         val="$undef"
10508 fi
10509 ;;
10510 *) val="$d_attribute_warn_unused_result" ;;
10511 esac
10512 set d_attribute_warn_unused_result
10513 eval $setvar
10514 $rm -f attrib*
10515
10516 : see if bcmp exists
10517 set bcmp d_bcmp
10518 eval $inlibc
10519
10520 : see if bcopy exists
10521 set bcopy d_bcopy
10522 eval $inlibc
10523
10524 : see if getpgrp exists
10525 set getpgrp d_getpgrp
10526 eval $inlibc
10527
10528 case "$d_getpgrp" in
10529 "$define")
10530         echo " "
10531         echo "Checking to see which flavor of getpgrp is in use..."
10532         $cat >try.c <<EOP
10533 #$i_unistd I_UNISTD
10534 #include <sys/types.h>
10535 #ifdef I_UNISTD
10536 #  include <unistd.h>
10537 #endif
10538 #$i_stdlib I_STDLIB
10539 #ifdef I_STDLIB
10540 #include <stdlib.h>
10541 #endif
10542 int main()
10543 {
10544         if (getuid() == 0) {
10545                 printf("(I see you are running Configure as super-user...)\n");
10546                 setuid(1);
10547         }
10548 #ifdef TRY_BSD_PGRP
10549         if (getpgrp(1) == 0)
10550                 exit(0);
10551 #else
10552         if (getpgrp() > 0)
10553                 exit(0);
10554 #endif
10555         exit(1);
10556 }
10557 EOP
10558         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10559                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10560                 val="$define"
10561         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10562                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10563                 val="$undef"
10564         else
10565                 echo "I can't seem to compile and run the test program."
10566                 if ./usg; then
10567                         xxx="a USG one, i.e. you use getpgrp()."
10568                 else
10569                         # SVR4 systems can appear rather BSD-ish.
10570                         case "$i_unistd" in
10571                         $undef)
10572                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10573                                 val="$define"
10574                                 ;;
10575                         $define)
10576                                 xxx="probably a USG one, i.e. you use getpgrp()."
10577                                 val="$undef"
10578                                 ;;
10579                         esac
10580                 fi
10581                 echo "Assuming your getpgrp is $xxx" >&4
10582         fi
10583         ;;
10584 *) val="$undef";;
10585 esac
10586 set d_bsdgetpgrp
10587 eval $setvar
10588 $rm_try
10589
10590 : see if setpgrp exists
10591 set setpgrp d_setpgrp
10592 eval $inlibc
10593
10594 case "$d_setpgrp" in
10595 "$define")
10596         echo " "
10597         echo "Checking to see which flavor of setpgrp is in use..."
10598         $cat >try.c <<EOP
10599 #$i_unistd I_UNISTD
10600 #include <sys/types.h>
10601 #ifdef I_UNISTD
10602 #  include <unistd.h>
10603 #endif
10604 #$i_stdlib I_STDLIB
10605 #ifdef I_STDLIB
10606 #include <stdlib.h>
10607 #endif
10608 int main()
10609 {
10610         if (getuid() == 0) {
10611                 printf("(I see you are running Configure as super-user...)\n");
10612                 setuid(1);
10613         }
10614 #ifdef TRY_BSD_PGRP
10615         if (-1 == setpgrp(1, 1))
10616                 exit(0);
10617 #else
10618         if (setpgrp() != -1)
10619                 exit(0);
10620 #endif
10621         exit(1);
10622 }
10623 EOP
10624         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10625                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10626                 val="$define"
10627         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10628                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10629                 val="$undef"
10630         else
10631                 echo "(I can't seem to compile and run the test program.)"
10632                 if ./usg; then
10633                         xxx="a USG one, i.e. you use setpgrp()."
10634                 else
10635                         # SVR4 systems can appear rather BSD-ish.
10636                         case "$i_unistd" in
10637                         $undef)
10638                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10639                                 val="$define"
10640                                 ;;
10641                         $define)
10642                                 xxx="probably a USG one, i.e. you use setpgrp()."
10643                                 val="$undef"
10644                                 ;;
10645                         esac
10646                 fi
10647                 echo "Assuming your setpgrp is $xxx" >&4
10648         fi
10649         ;;
10650 *) val="$undef";;
10651 esac
10652 set d_bsdsetpgrp
10653 eval $setvar
10654 $rm_try
10655
10656 : Look for GCC-style __builtin_choose_expr
10657 case "$d_builtin_choose_expr" in
10658 '')
10659     echo " "
10660     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10661     $cat >try.c <<'EOCP'
10662 #include <assert.h>
10663 #include <stdlib.h>
10664 #include <stdio.h>
10665
10666 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10667
10668 int main(void) {
10669     assert( SYRINX(1) == 2112 );
10670     assert( SYRINX(1) != 5150 );
10671     assert( SYRINX(0) == 5150 );
10672     assert( SYRINX(0) != 2112 );
10673     puts( "All good!" );
10674     exit(0);
10675 }
10676
10677 EOCP
10678     set try
10679     if eval $compile && $run ./try; then
10680         echo "Your C compiler supports __builtin_choose_expr."
10681         val="$define"
10682     else
10683         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10684         val="$undef"
10685     fi
10686 ;;
10687 *) val="$d_builtin_choose_expr" ;;
10688 esac
10689
10690 set d_builtin_choose_expr
10691 eval $setvar
10692 $rm_try
10693
10694 : Look for GCC-style __builtin_expect
10695 case "$d_builtin_expect" in
10696 '')
10697     echo " "
10698     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10699     $cat >try.c <<'EOCP'
10700 int main(void) {
10701     int n = 50;
10702     if ( __builtin_expect(n, 0) ) n = 1;
10703     /* Remember shell exit code truth is 0, C truth is non-zero */
10704     return !(n == 1);
10705 }
10706 EOCP
10707     set try
10708     if eval $compile && $run ./try; then
10709         echo "Your C compiler supports __builtin_expect."
10710         val="$define"
10711     else
10712         echo "Your C compiler doesn't seem to understand __builtin_expect."
10713         val="$undef"
10714     fi
10715     ;;
10716 *) val="$d_builtin_expect" ;;
10717 esac
10718
10719 set d_builtin_expect
10720 eval $setvar
10721 $rm_try
10722
10723 : see if bzero exists
10724 set bzero d_bzero
10725 eval $inlibc
10726
10727 : see if stdarg is available
10728 echo " "
10729 if $test `./findhdr stdarg.h`; then
10730         echo "<stdarg.h> found." >&4
10731         valstd="$define"
10732 else
10733         echo "<stdarg.h> NOT found." >&4
10734         valstd="$undef"
10735 fi
10736
10737 : see if varags is available
10738 echo " "
10739 if $test `./findhdr varargs.h`; then
10740         echo "<varargs.h> found." >&4
10741 else
10742         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10743 fi
10744
10745 : set up the varargs testing programs
10746 $cat > varargs.c <<EOP
10747 #ifdef I_STDARG
10748 #include <stdarg.h>
10749 #endif
10750 #ifdef I_VARARGS
10751 #include <varargs.h>
10752 #endif
10753
10754 #ifdef I_STDARG
10755 int f(char *p, ...)
10756 #else
10757 int f(va_alist)
10758 va_dcl
10759 #endif
10760 {
10761         va_list ap;
10762 #ifndef I_STDARG
10763         char *p;
10764 #endif
10765 #ifdef I_STDARG
10766         va_start(ap,p);
10767 #else
10768         va_start(ap);
10769         p = va_arg(ap, char *);
10770 #endif
10771         va_end(ap);
10772         return 0;
10773 }
10774 EOP
10775 $cat > varargs <<EOP
10776 $startsh
10777 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10778         echo "true"
10779 else
10780         echo "false"
10781 fi
10782 $rm -f varargs$_o
10783 EOP
10784 chmod +x varargs
10785
10786 : now check which varargs header should be included
10787 echo " "
10788 i_varhdr=''
10789 case "$valstd" in
10790 "$define")
10791         if `./varargs I_STDARG`; then
10792                 val='stdarg.h'
10793         elif `./varargs I_VARARGS`; then
10794                 val='varargs.h'
10795         fi
10796         ;;
10797 *)
10798         if `./varargs I_VARARGS`; then
10799                 val='varargs.h'
10800         fi
10801         ;;
10802 esac
10803 case "$val" in
10804 '')
10805 echo "I could not find the definition for va_dcl... You have problems..." >&4
10806         val="$undef"; set i_stdarg; eval $setvar
10807         val="$undef"; set i_varargs; eval $setvar
10808         ;;
10809 *)
10810         set i_varhdr
10811         eval $setvar
10812         case "$i_varhdr" in
10813         stdarg.h)
10814                 val="$define"; set i_stdarg; eval $setvar
10815                 val="$undef"; set i_varargs; eval $setvar
10816                 ;;
10817         varargs.h)
10818                 val="$undef"; set i_stdarg; eval $setvar
10819                 val="$define"; set i_varargs; eval $setvar
10820                 ;;
10821         esac
10822         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10823 esac
10824 $rm -f varargs*
10825
10826 : see if the Compiler supports C99 variadic macros
10827 case "$i_stdarg$i_stdlib" in
10828     "$define$define")
10829     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10830     $cat >try.c <<EOCP
10831 #include <stdio.h>
10832 #include <stdarg.h>
10833
10834 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10835
10836 int main() {
10837   char buf[20];
10838   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10839   puts(buf);
10840   return 0;
10841 }
10842 EOCP
10843     set try
10844     if eval $compile && $run ./try 2>&1 >/dev/null; then
10845         case "`$run ./try`" in
10846             "123 456 789")
10847             echo "You have C99 variadic macros." >&4
10848             d_c99_variadic_macros="$define"
10849             ;;
10850             *)
10851             echo "You don't have functional C99 variadic macros." >&4
10852             d_c99_variadic_macros="$undef"
10853             ;;
10854         esac
10855     else
10856         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10857         d_c99_variadic_macros="$undef"
10858     fi
10859     $rm_try
10860     ;;
10861     *)
10862     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10863     d_c99_variadic_macros="$undef"
10864     ;;
10865 esac
10866
10867 : see if signal is declared as pointer to function returning int or void
10868 echo " "
10869 xxx=`./findhdr signal.h`
10870 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10871 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10872         echo "You have int (*signal())() instead of void." >&4
10873         val="$undef"
10874 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10875         echo "You have void (*signal())()." >&4
10876         val="$define"
10877 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10878         echo "You have int (*signal())() instead of void." >&4
10879         val="$undef"
10880 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10881         echo "You have void (*signal())()." >&4
10882         val="$define"
10883 else
10884         case "$d_voidsig" in
10885         '')
10886         echo "I can't determine whether signal handler returns void or int..." >&4
10887                 dflt=void
10888                 rp="What type does your signal handler return?"
10889                 . ./myread
10890                 case "$ans" in
10891                 v*) val="$define";;
10892                 *) val="$undef";;
10893                 esac;;
10894         "$define")
10895                 echo "As you already told me, signal handler returns void." >&4
10896                 val="$define"
10897                 ;;
10898         *)      echo "As you already told me, signal handler returns int." >&4
10899                 val="$undef"
10900                 ;;
10901         esac
10902 fi
10903 set d_voidsig
10904 eval $setvar
10905 case "$d_voidsig" in
10906 "$define") signal_t="void";;
10907 *) signal_t="int";;
10908 esac
10909 $rm -f $$.tmp
10910
10911 : check for ability to cast large floats to 32-bit ints.
10912 echo " "
10913 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10914 if $test "$intsize" -ge 4; then
10915         xxx=int
10916 else
10917         xxx=long
10918 fi
10919 $cat >try.c <<EOCP
10920 #include <stdio.h>
10921 #$i_stdlib I_STDLIB
10922 #ifdef I_STDLIB
10923 #include <stdlib.h>
10924 #endif
10925 #include <sys/types.h>
10926 #include <signal.h>
10927 $signal_t blech(int s) { exit(3); }
10928 int main()
10929 {
10930         $xxx i32;
10931         double f, g;
10932         int result = 0;
10933         char str[16];
10934         signal(SIGFPE, blech);
10935
10936         /* Don't let compiler optimize the test away.  Store the number
10937            in a writable string for gcc to pass to sscanf under HP/UX.
10938         */
10939         sprintf(str, "2147483647");
10940         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10941         g = 10 * f;
10942         i32  = ($xxx) g;
10943
10944         /* x86 processors will probably give 0x8000 0000, which is a
10945            sign change.  We don't want that.  We want to mimic SPARC
10946            behavior here, which is to preserve the sign and give
10947            back 0x7fff ffff.
10948         */
10949         if (i32 != ($xxx) f)
10950                 result |= 1;
10951         exit(result);
10952 }
10953 EOCP
10954 set try
10955 if eval $compile_ok; then
10956         $run ./try
10957         yyy=$?
10958 else
10959         echo "(I can't seem to compile the test program--assuming it can't)"
10960         yyy=1
10961 fi
10962 case "$yyy" in
10963 0)      val="$define"
10964         echo "Yup, it can."
10965         ;;
10966 *)      val="$undef"
10967         echo "Nope, it can't."
10968         ;;
10969 esac
10970 set d_casti32
10971 eval $setvar
10972 $rm_try
10973
10974 : check for ability to cast negative floats to unsigned
10975 echo " "
10976 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10977 $cat >try.c <<EOCP
10978 #include <stdio.h>
10979 #$i_stdlib I_STDLIB
10980 #ifdef I_STDLIB
10981 #include <stdlib.h>
10982 #endif
10983 #include <sys/types.h>
10984 #include <signal.h>
10985 $signal_t blech(int s) { exit(7); }
10986 $signal_t blech_in_list(int s) { exit(4); }
10987 unsigned long dummy_long(unsigned long p) { return p; }
10988 unsigned int dummy_int(unsigned int p) { return p; }
10989 unsigned short dummy_short(unsigned short p) { return p; }
10990 int main()
10991 {
10992         double f;
10993         unsigned long along;
10994         unsigned int aint;
10995         unsigned short ashort;
10996         int result = 0;
10997         char str[16];
10998
10999         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11000            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11001            optimized the whole file away
11002         */
11003         /* Store the number in a writable string for gcc to pass to
11004            sscanf under HP/UX.
11005         */
11006         sprintf(str, "-123");
11007         sscanf(str, "%lf", &f);  /* f = -123.; */
11008
11009         signal(SIGFPE, blech);
11010         along = (unsigned long)f;
11011         aint = (unsigned int)f;
11012         ashort = (unsigned short)f;
11013         if (along != (unsigned long)-123)
11014                 result |= 1;
11015         if (aint != (unsigned int)-123)
11016                 result |= 1;
11017         if (ashort != (unsigned short)-123)
11018                 result |= 1;
11019         sprintf(str, "1073741824.");
11020         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11021         f = f + f;
11022         along = 0;
11023         along = (unsigned long)f;
11024         if (along != 0x80000000)
11025                 result |= 2;
11026         f -= 1.;
11027         along = 0;
11028         along = (unsigned long)f;
11029         if (along != 0x7fffffff)
11030                 result |= 1;
11031         f += 2.;
11032         along = 0;
11033         along = (unsigned long)f;
11034         if (along != 0x80000001)
11035                 result |= 2;
11036         if (result)
11037                 exit(result);
11038         signal(SIGFPE, blech_in_list);
11039         sprintf(str, "123.");
11040         sscanf(str, "%lf", &f);  /* f = 123.; */
11041         along = dummy_long((unsigned long)f);
11042         aint = dummy_int((unsigned int)f);
11043         ashort = dummy_short((unsigned short)f);
11044         if (along != (unsigned long)123)
11045                 result |= 4;
11046         if (aint != (unsigned int)123)
11047                 result |= 4;
11048         if (ashort != (unsigned short)123)
11049                 result |= 4;
11050         exit(result);
11051
11052 }
11053 EOCP
11054 set try
11055 if eval $compile_ok; then
11056         $run ./try
11057         castflags=$?
11058 else
11059         echo "(I can't seem to compile the test program--assuming it can't)"
11060         castflags=7
11061 fi
11062 case "$castflags" in
11063 0)      val="$define"
11064         echo "Yup, it can."
11065         ;;
11066 *)      val="$undef"
11067         echo "Nope, it can't."
11068         ;;
11069 esac
11070 set d_castneg
11071 eval $setvar
11072 $rm_try
11073
11074 : see if vprintf exists
11075 echo " "
11076 if set vprintf val -f d_vprintf; eval $csym; $val; then
11077         echo 'vprintf() found.' >&4
11078         val="$define"
11079         $cat >try.c <<EOF
11080 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11081 #$i_varargs I_VARARGS
11082
11083 #$i_stdlib I_STDLIB
11084 #$i_unistd I_UNISTD
11085
11086 #ifdef I_STDARG
11087 #  include <stdarg.h>
11088 #else /* I_VARARGS */
11089 #  include <varargs.h>
11090 #endif
11091
11092 #ifdef I_UNISTD
11093 #  include <unistd.h>
11094 #endif
11095
11096 #ifdef I_STDLIB
11097 #  include <stdlib.h>
11098 #endif
11099
11100 #include <stdio.h> /* vsprintf prototype */
11101
11102 #ifdef I_STDARG
11103 void xxx(int n, ...)
11104 {
11105     va_list args;
11106     char buf[10];
11107     va_start(args, n);
11108     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11109 }
11110 int main() { xxx(1, "foo"); }
11111
11112 #else /* I_VARARGS */
11113
11114 xxx(va_alist)
11115 va_dcl
11116 {
11117     va_list args;
11118     char buf[10];
11119     va_start(args);
11120     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11121 }
11122 int main() { xxx("foo"); }
11123
11124 #endif
11125
11126 EOF
11127         set try
11128         if eval $compile_ok; then
11129                 if $run ./try; then
11130                         echo "Your vsprintf() returns (int)." >&4
11131                         val2="$undef"
11132                 else
11133                         echo "Your vsprintf() returns (char*)." >&4
11134                         val2="$define"
11135                 fi
11136         else
11137                 echo 'I am unable to compile the vsprintf() test program.' >&4
11138                 # We shouldn't get here.  If we do, assume the standard signature,
11139                 # not the old BSD one.
11140                 echo 'Guessing that vsprintf() returns (int).' >&4
11141                 val2="$undef"
11142         fi
11143 else
11144         echo 'vprintf() NOT found.' >&4
11145         val="$undef"
11146         val2="$undef"
11147 fi
11148 $rm_try
11149 set d_vprintf
11150 eval $setvar
11151 val=$val2
11152 set d_charvspr
11153 eval $setvar
11154
11155 : see if chown exists
11156 set chown d_chown
11157 eval $inlibc
11158
11159 : see if chroot exists
11160 set chroot d_chroot
11161 eval $inlibc
11162
11163 : see if chsize exists
11164 set chsize d_chsize
11165 eval $inlibc
11166
11167 : see if class exists
11168 set class d_class
11169 eval $inlibc
11170
11171 : see if clearenv exists
11172 set clearenv d_clearenv
11173 eval $inlibc
11174
11175 : Define hasstruct macro for Configure internal use
11176 hasstruct='varname=$1; struct=$2; shift; shift;
11177 while $test $# -ge 2; do
11178         case "$1" in
11179         $define) echo "#include <$2>";;
11180         esac ;
11181     shift 2;
11182 done > try.c;
11183 echo "int main () { struct $struct foo; }" >> try.c;
11184 set try;
11185 if eval $compile; then
11186         val="$define";
11187 else
11188         val="$undef";
11189 fi;
11190 set $varname;
11191 eval $setvar;
11192 $rm_try'
11193
11194 : see whether socket exists
11195 socketlib=''
11196 sockethdr=''
11197 echo " "
11198 $echo $n "Hmm... $c" >&4
11199 if set socket val -f d_socket; eval $csym; $val; then
11200         echo "Looks like you have Berkeley networking support." >&4
11201         d_socket="$define"
11202         if set setsockopt val -f; eval $csym; $val; then
11203                 d_oldsock="$undef"
11204         else
11205                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11206                 d_oldsock="$define"
11207         fi
11208 else
11209         if $contains socklib libc.list >/dev/null 2>&1; then
11210                 echo "Looks like you have Berkeley networking support." >&4
11211                 d_socket="$define"
11212                 : we will have to assume that it supports the 4.2 BSD interface
11213                 d_oldsock="$undef"
11214         else
11215                 echo "You don't have Berkeley networking in libc$_a..." >&4
11216                 if test "X$d_socket" = "X$define"; then
11217                    echo "...but you seem to believe that you have sockets." >&4
11218                 else
11219                         for net in net socket
11220                         do
11221                                 if test -f /usr/lib/lib$net$_a; then
11222                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11223                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11224                                         if $contains socket libc.list >/dev/null 2>&1; then
11225                                                 d_socket="$define"
11226                                                 socketlib="-l$net"
11227                                                 case "$net" in
11228                                                 net)
11229                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11230                                                         sockethdr="-I/usr/netinclude"
11231                                                         ;;
11232                                                 esac
11233                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11234                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11235                                                         d_oldsock="$undef"
11236                                                 else
11237                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11238                                                         d_oldsock="$define"
11239                                                 fi
11240                                                 break
11241                                         fi
11242                                 fi
11243                         done
11244                         if test "X$d_socket" != "X$define"; then
11245                            echo "or anywhere else I see." >&4
11246                            d_socket="$undef"
11247                            d_oldsock="$undef"
11248                         fi
11249                 fi
11250         fi
11251 fi
11252
11253 : see if socketpair exists
11254 set socketpair d_sockpair
11255 eval $inlibc
11256
11257
11258 echo " "
11259 echo "Checking the availability of certain socket constants..." >&4
11260 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11261         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11262         $cat >try.c <<EOF
11263 #include <sys/types.h>
11264 #include <sys/socket.h>
11265 int main() {
11266     int i = $ENUM;
11267 }
11268 EOF
11269         val="$undef"
11270         set try; if eval $compile; then
11271                 val="$define"
11272         fi
11273         set d_${enum}; eval $setvar
11274         $rm_try
11275 done
11276
11277 : see if this is a sys/uio.h system
11278 set sys/uio.h i_sysuio
11279 eval $inhdr
11280
11281 : Check for cmsghdr support
11282 echo " "
11283 echo "Checking to see if your system supports struct cmsghdr..." >&4
11284 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11285 eval $hasstruct
11286 case "$d_cmsghdr_s" in
11287 "$define")      echo "Yes, it does."   ;;
11288 *)              echo "No, it doesn't." ;;
11289 esac
11290
11291
11292 : check for const keyword
11293 echo " "
11294 echo 'Checking to see if your C compiler knows about "const"...' >&4
11295 $cat >const.c <<'EOCP'
11296 typedef struct spug { int drokk; } spug;
11297 int main()
11298 {
11299         const char *foo;
11300         const spug y = { 0 };
11301 }
11302 EOCP
11303 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11304         val="$define"
11305         echo "Yup, it does."
11306 else
11307         val="$undef"
11308         echo "Nope, it doesn't."
11309 fi
11310 set d_const
11311 eval $setvar
11312
11313 : see if copysignl exists
11314 set copysignl d_copysignl
11315 eval $inlibc
11316
11317 : see if crypt exists
11318 echo " "
11319 set crypt d_crypt
11320 eval $inlibc
11321 case "$d_crypt" in
11322 $define) cryptlib='' ;;
11323 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11324                 echo 'crypt() found.' >&4
11325                 val="$define"
11326                 cryptlib=''
11327         else
11328                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11329                 if $test -z "$cryptlib"; then
11330                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11331                 else
11332                         cryptlib=-lcrypt
11333                 fi
11334                 if $test -z "$cryptlib"; then
11335                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11336                 else
11337                         cryptlib=-lcrypt
11338                 fi
11339                 if $test -z "$cryptlib"; then
11340                         cryptlib=`./loc libcrypt$_a "" $libpth`
11341                 else
11342                         cryptlib=-lcrypt
11343                 fi
11344                 if $test -z "$cryptlib"; then
11345                         echo 'crypt() NOT found.' >&4
11346                         val="$undef"
11347                 else
11348                         val="$define"
11349                 fi
11350         fi
11351         set d_crypt
11352         eval $setvar
11353         ;;
11354 esac
11355
11356 : see if this is a crypt.h system
11357 set crypt.h i_crypt
11358 eval $inhdr
11359
11360 : see if crypt_r exists
11361 set crypt_r d_crypt_r
11362 eval $inlibc
11363 case "$d_crypt_r" in
11364 "$define")
11365         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11366         case "$d_crypt_r_proto:$usethreads" in
11367         ":define")      d_crypt_r_proto=define
11368                 set d_crypt_r_proto crypt_r $hdrs
11369                 eval $hasproto ;;
11370         *)      ;;
11371         esac
11372         case "$d_crypt_r_proto" in
11373         define)
11374         case "$crypt_r_proto" in
11375         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11376         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11377         esac
11378         case "$crypt_r_proto" in
11379         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11380         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11381         esac
11382         case "$crypt_r_proto" in
11383         ''|0)   d_crypt_r=undef
11384                 crypt_r_proto=0
11385                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11386         * )     case "$crypt_r_proto" in
11387                 REENTRANT_PROTO*) ;;
11388                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11389                 esac
11390                 echo "Prototype: $try" ;;
11391         esac
11392         ;;
11393         *)      case "$usethreads" in
11394                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11395                 esac
11396                 d_crypt_r=undef
11397                 crypt_r_proto=0
11398                 ;;
11399         esac
11400         ;;
11401 *)      crypt_r_proto=0
11402         ;;
11403 esac
11404
11405 : get csh whereabouts
11406 case "$csh" in
11407 'csh') val="$undef" ;;
11408 *) val="$define" ;;
11409 esac
11410 set d_csh
11411 eval $setvar
11412 : Respect a hint or command line value for full_csh.
11413 case "$full_csh" in
11414 '') full_csh=$csh ;;
11415 esac
11416
11417 : see if ctermid exists
11418 set ctermid d_ctermid
11419 eval $inlibc
11420
11421 : see if ctermid_r exists
11422 set ctermid_r d_ctermid_r
11423 eval $inlibc
11424 case "$d_ctermid_r" in
11425 "$define")
11426         hdrs="$i_systypes sys/types.h define stdio.h "
11427         case "$d_ctermid_r_proto:$usethreads" in
11428         ":define")      d_ctermid_r_proto=define
11429                 set d_ctermid_r_proto ctermid_r $hdrs
11430                 eval $hasproto ;;
11431         *)      ;;
11432         esac
11433         case "$d_ctermid_r_proto" in
11434         define)
11435         case "$ctermid_r_proto" in
11436         ''|0) try='char* ctermid_r(char*);'
11437         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11438         esac
11439         case "$ctermid_r_proto" in
11440         ''|0)   d_ctermid_r=undef
11441                 ctermid_r_proto=0
11442                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11443         * )     case "$ctermid_r_proto" in
11444                 REENTRANT_PROTO*) ;;
11445                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11446                 esac
11447                 echo "Prototype: $try" ;;
11448         esac
11449         ;;
11450         *)      case "$usethreads" in
11451                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11452                 esac
11453                 d_ctermid_r=undef
11454                 ctermid_r_proto=0
11455                 ;;
11456         esac
11457         ;;
11458 *)      ctermid_r_proto=0
11459         ;;
11460 esac
11461
11462 : see if ctime_r exists
11463 set ctime_r d_ctime_r
11464 eval $inlibc
11465 case "$d_ctime_r" in
11466 "$define")
11467         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11468         case "$d_ctime_r_proto:$usethreads" in
11469         ":define")      d_ctime_r_proto=define
11470                 set d_ctime_r_proto ctime_r $hdrs
11471                 eval $hasproto ;;
11472         *)      ;;
11473         esac
11474         case "$d_ctime_r_proto" in
11475         define)
11476         case "$ctime_r_proto" in
11477         ''|0) try='char* ctime_r(const time_t*, char*);'
11478         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11479         esac
11480         case "$ctime_r_proto" in
11481         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11482         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11483         esac
11484         case "$ctime_r_proto" in
11485         ''|0) try='int ctime_r(const time_t*, char*);'
11486         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11487         esac
11488         case "$ctime_r_proto" in
11489         ''|0) try='int ctime_r(const time_t*, char*, int);'
11490         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11491         esac
11492         case "$ctime_r_proto" in
11493         ''|0)   d_ctime_r=undef
11494                 ctime_r_proto=0
11495                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11496         * )     case "$ctime_r_proto" in
11497                 REENTRANT_PROTO*) ;;
11498                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11499                 esac
11500                 echo "Prototype: $try" ;;
11501         esac
11502         ;;
11503         *)      case "$usethreads" in
11504                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11505                 esac
11506                 d_ctime_r=undef
11507                 ctime_r_proto=0
11508                 ;;
11509         esac
11510         ;;
11511 *)      ctime_r_proto=0
11512         ;;
11513 esac
11514
11515 : see if cuserid exists
11516 set cuserid d_cuserid
11517 eval $inlibc
11518
11519 : see if this is a limits.h system
11520 set limits.h i_limits
11521 eval $inhdr
11522
11523 : see if this is a float.h system
11524 set float.h i_float
11525 eval $inhdr
11526
11527 : See if number of significant digits in a double precision number is known
11528 echo " "
11529 $cat >dbl_dig.c <<EOM
11530 #$i_limits I_LIMITS
11531 #$i_float I_FLOAT
11532 #ifdef I_LIMITS
11533 #include <limits.h>
11534 #endif
11535 #ifdef I_FLOAT
11536 #include <float.h>
11537 #endif
11538 #ifdef DBL_DIG
11539 printf("Contains DBL_DIG");
11540 #endif
11541 EOM
11542 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11543 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11544         echo "DBL_DIG found." >&4
11545         val="$define"
11546 else
11547         echo "DBL_DIG NOT found." >&4
11548         val="$undef"
11549 fi
11550 $rm -f dbl_dig.?
11551 set d_dbl_dig
11552 eval $setvar
11553
11554 : see if dbm.h is available
11555 : see if dbmclose exists
11556 set dbmclose d_dbmclose
11557 eval $inlibc
11558
11559 case "$d_dbmclose" in
11560 $define)
11561         set dbm.h i_dbm
11562         eval $inhdr
11563         case "$i_dbm" in
11564         $define)
11565                 val="$undef"
11566                 set i_rpcsvcdbm
11567                 eval $setvar
11568                 ;;
11569         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11570                 eval $inhdr
11571                 ;;
11572         esac
11573         ;;
11574 *)      echo "We won't be including <dbm.h>"
11575         val="$undef"
11576         set i_dbm
11577         eval $setvar
11578         val="$undef"
11579         set i_rpcsvcdbm
11580         eval $setvar
11581         ;;
11582 esac
11583
11584 : see if prototype for dbminit is available
11585 echo " "
11586 set d_dbminitproto dbminit $i_dbm dbm.h
11587 eval $hasproto
11588
11589 : see if difftime exists
11590 set difftime d_difftime
11591 eval $inlibc
11592
11593 : see if this is a dirent system
11594 echo " "
11595 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11596         val="$define"
11597         echo "<dirent.h> found." >&4
11598 else
11599         val="$undef"
11600         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11601                 echo "<sys/dir.h> found." >&4
11602                 echo " "
11603         else
11604                 xinc=`./findhdr sys/ndir.h`
11605         fi
11606         echo "<dirent.h> NOT found." >&4
11607 fi
11608 set i_dirent
11609 eval $setvar
11610
11611 : Look for type of directory structure.
11612 echo " "
11613 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11614
11615 case "$direntrytype" in
11616 ''|' ')
11617         case "$i_dirent" in
11618         $define) guess1='struct dirent' ;;
11619         *) guess1='struct direct'  ;;
11620         esac
11621         ;;
11622 *)      guess1="$direntrytype"
11623         ;;
11624 esac
11625
11626 case "$guess1" in
11627 'struct dirent') guess2='struct direct' ;;
11628 *) guess2='struct dirent' ;;
11629 esac
11630
11631 if $contains "$guess1" try.c >/dev/null 2>&1; then
11632         direntrytype="$guess1"
11633         echo "Your directory entries are $direntrytype." >&4
11634 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11635         direntrytype="$guess2"
11636         echo "Your directory entries seem to be $direntrytype." >&4
11637 else
11638         echo "I don't recognize your system's directory entries." >&4
11639         rp="What type is used for directory entries on this system?"
11640         dflt="$guess1"
11641         . ./myread
11642         direntrytype="$ans"
11643 fi
11644 $rm_try
11645
11646 : see if the directory entry stores field length
11647 echo " "
11648 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11649 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11650         echo "Good, your directory entry keeps length information in d_namlen." >&4
11651         val="$define"
11652 else
11653         echo "Your directory entry does not know about the d_namlen field." >&4
11654         val="$undef"
11655 fi
11656 set d_dirnamlen
11657 eval $setvar
11658 $rm_try
11659
11660 : Look for DIR.dd_fd
11661 case "$i_dirent" in
11662 "$define")
11663     echo "Checking to see if DIR has a dd_fd member variable" >&4
11664     $cat >try.c <<EOCP
11665 #$i_stdlib I_STDLIB
11666 #ifdef I_STDLIB
11667 #include <stdlib.h>
11668 #endif
11669 #include <dirent.h>
11670
11671 int main() {
11672     DIR dir;
11673     dir.dd_fd = 1;
11674     return 0;
11675 }
11676 EOCP
11677     val=$undef
11678     set try
11679     if eval $compile; then
11680         echo "Yes, it does."
11681         val="$define"
11682     else
11683         echo "No, it does not."
11684         val="$undef"
11685     fi
11686     ;;
11687 *)
11688     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11689     val="$undef"
11690     ;;
11691 esac
11692 set d_dir_dd_fd
11693 eval $setvar
11694 $rm_try
11695
11696 : see if this is an sysdir system
11697 set sys/dir.h i_sysdir
11698 eval $inhdr
11699
11700 : see if this is an sysndir system
11701 set sys/ndir.h i_sysndir
11702 eval $inhdr
11703
11704 : Look for dirfd
11705 echo " "
11706 $cat >dirfd.c <<EOM
11707 #include <stdio.h>
11708 #$i_stdlib I_STDLIB
11709 #ifdef I_STDLIB
11710 #include <stdlib.h>
11711 #endif
11712 #$i_dirent I_DIRENT             /**/
11713 #$i_sysdir I_SYS_DIR            /**/
11714 #$i_sysndir I_SYS_NDIR          /**/
11715 #$i_systypes I_SYS_TYPES        /**/
11716 #if defined(I_SYS_TYPES)
11717 #include <sys/types.h>
11718 #endif
11719 #if defined(I_DIRENT)
11720 #include <dirent.h>
11721 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11722 #include <sys/dir.h>
11723 #endif
11724 #else
11725 #ifdef I_SYS_NDIR
11726 #include <sys/ndir.h>
11727 #else
11728 #ifdef I_SYS_DIR
11729 #ifdef hp9000s500
11730 #include <ndir.h>       /* may be wrong in the future */
11731 #else
11732 #include <sys/dir.h>
11733 #endif
11734 #endif
11735 #endif
11736 #endif 
11737 int main() {
11738         DIR *dirp = opendir(".");
11739         if (dirfd(dirp) >= 0)
11740                 exit(0);
11741         else
11742                 exit(1);
11743 }
11744 EOM
11745 val=$undef
11746 set dirfd
11747 if eval $compile; then
11748         val="$define"
11749 fi
11750 case "$val" in
11751 $define)        echo "dirfd() found." >&4       ;;
11752 *)              echo "dirfd() NOT found." >&4   ;;
11753 esac
11754 set d_dirfd
11755 eval $setvar
11756 $rm -f dirfd*
11757
11758 : see if dlerror exists
11759 xxx_runnm="$runnm"
11760 runnm=false
11761 set dlerror d_dlerror
11762 eval $inlibc
11763 runnm="$xxx_runnm"
11764
11765 : see if dlfcn is available
11766 set dlfcn.h i_dlfcn
11767 eval $inhdr
11768
11769 : Check what extension to use for shared libs
11770 case "$usedl" in
11771 $define|y|true)
11772         $cat << EOM
11773
11774 On a few systems, the dynamically loaded modules that perl generates and uses
11775 will need a different extension than shared libs. The default will probably
11776 be appropriate.
11777
11778 EOM
11779         case "$dlext" in
11780         '')     dflt="$so" ;;
11781         *)      dflt="$dlext" ;;
11782         esac
11783         rp='What is the extension of dynamically loaded modules'
11784         . ./myread
11785         dlext="$ans"
11786         ;;
11787 *)
11788         dlext="none"
11789         ;;
11790 esac
11791
11792 : Check if dlsym need a leading underscore
11793 echo " "
11794 val="$undef"
11795
11796 case "$dlsrc" in
11797 dl_dlopen.xs)
11798         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11799         $cat >dyna.c <<'EOM'
11800 fred () { }
11801 EOM
11802
11803 $cat >fred.c<<EOM
11804
11805 #include <stdio.h>
11806 #$i_stdlib I_STDLIB
11807 #ifdef I_STDLIB
11808 #include <stdlib.h>
11809 #endif
11810 #$i_dlfcn I_DLFCN
11811 #ifdef I_DLFCN
11812 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11813 #else
11814 #include <sys/types.h>
11815 #include <nlist.h>
11816 #include <link.h>
11817 #endif
11818
11819 extern int fred() ;
11820
11821 int main()
11822 {
11823     void * handle ;
11824     void * symbol ;
11825 #ifndef RTLD_LAZY
11826     int mode = 1 ;
11827 #else
11828     int mode = RTLD_LAZY ;
11829 #endif
11830     handle = dlopen("./dyna.$dlext", mode) ;
11831     if (handle == NULL) {
11832         printf ("1\n") ;
11833         fflush (stdout) ;
11834         exit(0);
11835     }
11836     symbol = dlsym(handle, "fred") ;
11837     if (symbol == NULL) {
11838         /* try putting a leading underscore */
11839         symbol = dlsym(handle, "_fred") ;
11840         if (symbol == NULL) {
11841             printf ("2\n") ;
11842             fflush (stdout) ;
11843             exit(0);
11844         }
11845         printf ("3\n") ;
11846     }
11847     else
11848         printf ("4\n") ;
11849     fflush (stdout) ;
11850     exit(0);
11851 }
11852 EOM
11853         : Call the object file tmp-dyna.o in case dlext=o.
11854         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11855                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11856                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11857                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11858                 xxx=`$run ./fred`
11859                 case $xxx in
11860                 1)      echo "Test program failed using dlopen." >&4
11861                         echo "Perhaps you should not use dynamic loading." >&4;;
11862                 2)      echo "Test program failed using dlsym." >&4
11863                         echo "Perhaps you should not use dynamic loading." >&4;;
11864                 3)      echo "dlsym needs a leading underscore" >&4
11865                         val="$define" ;;
11866                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11867                 esac
11868         else
11869                 echo "I can't compile and run the test program." >&4
11870                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11871         fi
11872         ;;
11873 esac
11874
11875 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11876
11877 set d_dlsymun
11878 eval $setvar
11879
11880 : see if drand48_r exists
11881 set drand48_r d_drand48_r
11882 eval $inlibc
11883 case "$d_drand48_r" in
11884 "$define")
11885         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11886         case "$d_drand48_r_proto:$usethreads" in
11887         ":define")      d_drand48_r_proto=define
11888                 set d_drand48_r_proto drand48_r $hdrs
11889                 eval $hasproto ;;
11890         *)      ;;
11891         esac
11892         case "$d_drand48_r_proto" in
11893         define)
11894         case "$drand48_r_proto" in
11895         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11896         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
11897         esac
11898         case "$drand48_r_proto" in
11899         ''|0)   d_drand48_r=undef
11900                 drand48_r_proto=0
11901                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11902         * )     case "$drand48_r_proto" in
11903                 REENTRANT_PROTO*) ;;
11904                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11905                 esac
11906                 echo "Prototype: $try" ;;
11907         esac
11908         ;;
11909         *)      case "$usethreads" in
11910                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11911                 esac
11912                 d_drand48_r=undef
11913                 drand48_r_proto=0
11914                 ;;
11915         esac
11916         ;;
11917 *)      drand48_r_proto=0
11918         ;;
11919 esac
11920
11921 : see if prototype for drand48 is available
11922 echo " "
11923 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11924 eval $hasproto
11925
11926 : see if dup2 exists
11927 set dup2 d_dup2
11928 eval $inlibc
11929
11930 : see if eaccess exists
11931 set eaccess d_eaccess
11932 eval $inlibc
11933
11934 : see if endgrent exists
11935 set endgrent d_endgrent
11936 eval $inlibc
11937
11938 : see if this is an grp system
11939 set grp.h i_grp
11940 eval $inhdr
11941
11942 case "$i_grp" in
11943 $define)
11944         xxx=`./findhdr grp.h`
11945         $cppstdin $cppflags $cppminus < $xxx >$$.h
11946
11947         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11948                 val="$define"
11949         else
11950                 val="$undef"
11951         fi
11952         set d_grpasswd
11953         eval $setvar
11954
11955         $rm -f $$.h
11956         ;;
11957 *)
11958         val="$undef";
11959         set d_grpasswd; eval $setvar
11960         ;;
11961 esac
11962
11963 : see if endgrent_r exists
11964 set endgrent_r d_endgrent_r
11965 eval $inlibc
11966 case "$d_endgrent_r" in
11967 "$define")
11968         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11969         case "$d_endgrent_r_proto:$usethreads" in
11970         ":define")      d_endgrent_r_proto=define
11971                 set d_endgrent_r_proto endgrent_r $hdrs
11972                 eval $hasproto ;;
11973         *)      ;;
11974         esac
11975         case "$d_endgrent_r_proto" in
11976         define)
11977         case "$endgrent_r_proto" in
11978         ''|0) try='int endgrent_r(FILE**);'
11979         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
11980         esac
11981         case "$endgrent_r_proto" in
11982         ''|0) try='void endgrent_r(FILE**);'
11983         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
11984         esac
11985         case "$endgrent_r_proto" in
11986         ''|0)   d_endgrent_r=undef
11987                 endgrent_r_proto=0
11988                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11989         * )     case "$endgrent_r_proto" in
11990                 REENTRANT_PROTO*) ;;
11991                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11992                 esac
11993                 echo "Prototype: $try" ;;
11994         esac
11995         ;;
11996         *)      case "$usethreads" in
11997                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11998                 esac
11999                 d_endgrent_r=undef
12000                 endgrent_r_proto=0
12001                 ;;
12002         esac
12003         ;;
12004 *)      endgrent_r_proto=0
12005         ;;
12006 esac
12007
12008 : see if endhostent exists
12009 set endhostent d_endhent
12010 eval $inlibc
12011
12012 : see if this is a netdb.h system
12013 set netdb.h i_netdb
12014 eval $inhdr
12015
12016 : see if endhostent_r exists
12017 set endhostent_r d_endhostent_r
12018 eval $inlibc
12019 case "$d_endhostent_r" in
12020 "$define")
12021         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12022         case "$d_endhostent_r_proto:$usethreads" in
12023         ":define")      d_endhostent_r_proto=define
12024                 set d_endhostent_r_proto endhostent_r $hdrs
12025                 eval $hasproto ;;
12026         *)      ;;
12027         esac
12028         case "$d_endhostent_r_proto" in
12029         define)
12030         case "$endhostent_r_proto" in
12031         ''|0) try='int endhostent_r(struct hostent_data*);'
12032         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12033         esac
12034         case "$endhostent_r_proto" in
12035         ''|0) try='void endhostent_r(struct hostent_data*);'
12036         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12037         esac
12038         case "$endhostent_r_proto" in
12039         ''|0)   d_endhostent_r=undef
12040                 endhostent_r_proto=0
12041                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12042         * )     case "$endhostent_r_proto" in
12043                 REENTRANT_PROTO*) ;;
12044                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12045                 esac
12046                 echo "Prototype: $try" ;;
12047         esac
12048         ;;
12049         *)      case "$usethreads" in
12050                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12051                 esac
12052                 d_endhostent_r=undef
12053                 endhostent_r_proto=0
12054                 ;;
12055         esac
12056         ;;
12057 *)      endhostent_r_proto=0
12058         ;;
12059 esac
12060
12061 : see if endnetent exists
12062 set endnetent d_endnent
12063 eval $inlibc
12064
12065 : see if endnetent_r exists
12066 set endnetent_r d_endnetent_r
12067 eval $inlibc
12068 case "$d_endnetent_r" in
12069 "$define")
12070         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12071         case "$d_endnetent_r_proto:$usethreads" in
12072         ":define")      d_endnetent_r_proto=define
12073                 set d_endnetent_r_proto endnetent_r $hdrs
12074                 eval $hasproto ;;
12075         *)      ;;
12076         esac
12077         case "$d_endnetent_r_proto" in
12078         define)
12079         case "$endnetent_r_proto" in
12080         ''|0) try='int endnetent_r(struct netent_data*);'
12081         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12082         esac
12083         case "$endnetent_r_proto" in
12084         ''|0) try='void endnetent_r(struct netent_data*);'
12085         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12086         esac
12087         case "$endnetent_r_proto" in
12088         ''|0)   d_endnetent_r=undef
12089                 endnetent_r_proto=0
12090                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12091         * )     case "$endnetent_r_proto" in
12092                 REENTRANT_PROTO*) ;;
12093                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12094                 esac
12095                 echo "Prototype: $try" ;;
12096         esac
12097         ;;
12098         *)      case "$usethreads" in
12099                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12100                 esac
12101                 d_endnetent_r=undef
12102                 endnetent_r_proto=0
12103                 ;;
12104         esac
12105         ;;
12106 *)      endnetent_r_proto=0
12107         ;;
12108 esac
12109
12110 : see if endprotoent exists
12111 set endprotoent d_endpent
12112 eval $inlibc
12113
12114 : see if endprotoent_r exists
12115 set endprotoent_r d_endprotoent_r
12116 eval $inlibc
12117 case "$d_endprotoent_r" in
12118 "$define")
12119         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12120         case "$d_endprotoent_r_proto:$usethreads" in
12121         ":define")      d_endprotoent_r_proto=define
12122                 set d_endprotoent_r_proto endprotoent_r $hdrs
12123                 eval $hasproto ;;
12124         *)      ;;
12125         esac
12126         case "$d_endprotoent_r_proto" in
12127         define)
12128         case "$endprotoent_r_proto" in
12129         ''|0) try='int endprotoent_r(struct protoent_data*);'
12130         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12131         esac
12132         case "$endprotoent_r_proto" in
12133         ''|0) try='void endprotoent_r(struct protoent_data*);'
12134         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12135         esac
12136         case "$endprotoent_r_proto" in
12137         ''|0)   d_endprotoent_r=undef
12138                 endprotoent_r_proto=0
12139                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12140         * )     case "$endprotoent_r_proto" in
12141                 REENTRANT_PROTO*) ;;
12142                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12143                 esac
12144                 echo "Prototype: $try" ;;
12145         esac
12146         ;;
12147         *)      case "$usethreads" in
12148                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12149                 esac
12150                 d_endprotoent_r=undef
12151                 endprotoent_r_proto=0
12152                 ;;
12153         esac
12154         ;;
12155 *)      endprotoent_r_proto=0
12156         ;;
12157 esac
12158
12159 : see if endpwent exists
12160 set endpwent d_endpwent
12161 eval $inlibc
12162
12163 : see if this is a pwd.h system
12164 set pwd.h i_pwd
12165 eval $inhdr
12166
12167 case "$i_pwd" in
12168 $define)
12169         xxx=`./findhdr pwd.h`
12170         $cppstdin $cppflags $cppminus < $xxx >$$.h
12171
12172         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12173                 val="$define"
12174         else
12175                 val="$undef"
12176         fi
12177         set d_pwquota
12178         eval $setvar
12179
12180         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12181                 val="$define"
12182         else
12183                 val="$undef"
12184         fi
12185         set d_pwage
12186         eval $setvar
12187
12188         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12189                 val="$define"
12190         else
12191                 val="$undef"
12192         fi
12193         set d_pwchange
12194         eval $setvar
12195
12196         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12197                 val="$define"
12198         else
12199                 val="$undef"
12200         fi
12201         set d_pwclass
12202         eval $setvar
12203
12204         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12205                 val="$define"
12206         else
12207                 val="$undef"
12208         fi
12209         set d_pwexpire
12210         eval $setvar
12211
12212         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12213                 val="$define"
12214         else
12215                 val="$undef"
12216         fi
12217         set d_pwcomment
12218         eval $setvar
12219
12220         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12221                 val="$define"
12222         else
12223                 val="$undef"
12224         fi
12225         set d_pwgecos
12226         eval $setvar
12227
12228         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12229                 val="$define"
12230         else
12231                 val="$undef"
12232         fi
12233         set d_pwpasswd
12234         eval $setvar
12235
12236         $rm -f $$.h
12237         ;;
12238 *)
12239         val="$undef"; 
12240         set d_pwquota; eval $setvar
12241         set d_pwage; eval $setvar
12242         set d_pwchange; eval $setvar
12243         set d_pwclass; eval $setvar
12244         set d_pwexpire; eval $setvar
12245         set d_pwcomment; eval $setvar
12246         set d_pwgecos; eval $setvar
12247         set d_pwpasswd; eval $setvar
12248         ;;
12249 esac
12250
12251 : see if endpwent_r exists
12252 set endpwent_r d_endpwent_r
12253 eval $inlibc
12254 case "$d_endpwent_r" in
12255 "$define")
12256         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12257         case "$d_endpwent_r_proto:$usethreads" in
12258         ":define")      d_endpwent_r_proto=define
12259                 set d_endpwent_r_proto endpwent_r $hdrs
12260                 eval $hasproto ;;
12261         *)      ;;
12262         esac
12263         case "$d_endpwent_r_proto" in
12264         define)
12265         case "$endpwent_r_proto" in
12266         ''|0) try='int endpwent_r(FILE**);'
12267         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12268         esac
12269         case "$endpwent_r_proto" in
12270         ''|0) try='void endpwent_r(FILE**);'
12271         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12272         esac
12273         case "$endpwent_r_proto" in
12274         ''|0)   d_endpwent_r=undef
12275                 endpwent_r_proto=0
12276                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12277         * )     case "$endpwent_r_proto" in
12278                 REENTRANT_PROTO*) ;;
12279                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12280                 esac
12281                 echo "Prototype: $try" ;;
12282         esac
12283         ;;
12284         *)      case "$usethreads" in
12285                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12286                 esac
12287                 d_endpwent_r=undef
12288                 endpwent_r_proto=0
12289                 ;;
12290         esac
12291         ;;
12292 *)      endpwent_r_proto=0
12293         ;;
12294 esac
12295
12296 : see if endservent exists
12297 set endservent d_endsent
12298 eval $inlibc
12299
12300 : see if endservent_r exists
12301 set endservent_r d_endservent_r
12302 eval $inlibc
12303 case "$d_endservent_r" in
12304 "$define")
12305         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12306         case "$d_endservent_r_proto:$usethreads" in
12307         ":define")      d_endservent_r_proto=define
12308                 set d_endservent_r_proto endservent_r $hdrs
12309                 eval $hasproto ;;
12310         *)      ;;
12311         esac
12312         case "$d_endservent_r_proto" in
12313         define)
12314         case "$endservent_r_proto" in
12315         ''|0) try='int endservent_r(struct servent_data*);'
12316         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12317         esac
12318         case "$endservent_r_proto" in
12319         ''|0) try='void endservent_r(struct servent_data*);'
12320         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12321         esac
12322         case "$endservent_r_proto" in
12323         ''|0)   d_endservent_r=undef
12324                 endservent_r_proto=0
12325                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12326         * )     case "$endservent_r_proto" in
12327                 REENTRANT_PROTO*) ;;
12328                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12329                 esac
12330                 echo "Prototype: $try" ;;
12331         esac
12332         ;;
12333         *)      case "$usethreads" in
12334                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12335                 esac
12336                 d_endservent_r=undef
12337                 endservent_r_proto=0
12338                 ;;
12339         esac
12340         ;;
12341 *)      endservent_r_proto=0
12342         ;;
12343 esac
12344
12345 : Locate the flags for 'open()'
12346 echo " "
12347 $cat >try.c <<EOCP
12348 #include <sys/types.h>
12349 #ifdef I_FCNTL
12350 #include <fcntl.h>
12351 #endif
12352 #ifdef I_SYS_FILE
12353 #include <sys/file.h>
12354 #endif
12355 #$i_stdlib I_STDLIB
12356 #ifdef I_STDLIB
12357 #include <stdlib.h>
12358 #endif
12359 int main() {
12360         if(O_RDONLY);
12361 #ifdef O_TRUNC
12362         exit(0);
12363 #else
12364         exit(1);
12365 #endif
12366 }
12367 EOCP
12368 : check sys/file.h first to get FREAD on Sun
12369 if $test `./findhdr sys/file.h` && \
12370                 set try -DI_SYS_FILE && eval $compile; then
12371         h_sysfile=true;
12372         echo "<sys/file.h> defines the O_* constants..." >&4
12373         if $run ./try; then
12374                 echo "and you have the 3 argument form of open()." >&4
12375                 val="$define"
12376         else
12377                 echo "but not the 3 argument form of open().  Oh, well." >&4
12378                 val="$undef"
12379         fi
12380 elif $test `./findhdr fcntl.h` && \
12381                 set try -DI_FCNTL && eval $compile; then
12382         h_fcntl=true;
12383         echo "<fcntl.h> defines the O_* constants..." >&4
12384         if $run ./try; then
12385                 echo "and you have the 3 argument form of open()." >&4
12386                 val="$define"
12387         else
12388                 echo "but not the 3 argument form of open().  Oh, well." >&4
12389                 val="$undef"
12390         fi
12391 else
12392         val="$undef"
12393         echo "I can't find the O_* constant definitions!  You got problems." >&4
12394 fi
12395 set d_open3
12396 eval $setvar
12397 $rm_try
12398
12399 : see if this is a sys/file.h system
12400 val=''
12401 set sys/file.h val
12402 eval $inhdr
12403
12404 : do we need to include sys/file.h ?
12405 case "$val" in
12406 "$define")
12407         echo " "
12408         if $h_sysfile; then
12409                 val="$define"
12410                 echo "We'll be including <sys/file.h>." >&4
12411         else
12412                 val="$undef"
12413                 echo "We won't be including <sys/file.h>." >&4
12414         fi
12415         ;;
12416 *)
12417         h_sysfile=false
12418         ;;
12419 esac
12420 set i_sysfile
12421 eval $setvar
12422
12423 : see if fcntl.h is there
12424 val=''
12425 set fcntl.h val
12426 eval $inhdr
12427
12428 : see if we can include fcntl.h
12429 case "$val" in
12430 "$define")
12431         echo " "
12432         if $h_fcntl; then
12433                 val="$define"
12434                 echo "We'll be including <fcntl.h>." >&4
12435         else
12436                 val="$undef"
12437                 if $h_sysfile; then
12438         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12439                 else
12440                         echo "We won't be including <fcntl.h>." >&4
12441                 fi
12442         fi
12443         ;;
12444 *)
12445         h_fcntl=false
12446         val="$undef"
12447         ;;
12448 esac
12449 set i_fcntl
12450 eval $setvar
12451
12452 : see if fork exists
12453 set fork d_fork
12454 eval $inlibc
12455
12456 : see if pipe exists
12457 set pipe d_pipe
12458 eval $inlibc
12459
12460 : check for non-blocking I/O stuff
12461 case "$h_sysfile" in
12462 true) echo "#include <sys/file.h>" > head.c;;
12463 *)
12464        case "$h_fcntl" in
12465        true) echo "#include <fcntl.h>" > head.c;;
12466        *) echo "#include <sys/fcntl.h>" > head.c;;
12467        esac
12468        ;;
12469 esac
12470 echo " "
12471 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12472 case "$o_nonblock" in
12473 '')
12474         $cat head.c > try.c
12475         $cat >>try.c <<EOCP
12476 #include <stdio.h>
12477 #$i_stdlib I_STDLIB
12478 #ifdef I_STDLIB
12479 #include <stdlib.h>
12480 #endif
12481 #$i_fcntl I_FCNTL
12482 #ifdef I_FCNTL
12483 #include <fcntl.h>
12484 #endif
12485 int main() {
12486 #ifdef O_NONBLOCK
12487         printf("O_NONBLOCK\n");
12488         exit(0);
12489 #endif
12490 #ifdef O_NDELAY
12491         printf("O_NDELAY\n");
12492         exit(0);
12493 #endif
12494 #ifdef FNDELAY
12495         printf("FNDELAY\n");
12496         exit(0);
12497 #endif
12498         exit(0);
12499 }
12500 EOCP
12501         set try
12502         if eval $compile_ok; then
12503                 o_nonblock=`$run ./try`
12504                 case "$o_nonblock" in
12505                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12506                 *) echo "Seems like we can use $o_nonblock.";;
12507                 esac
12508         else
12509                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12510         fi
12511         ;;
12512 *) echo "Using $hint value $o_nonblock.";;
12513 esac
12514 $rm_try
12515
12516 echo " "
12517 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12518 case "$eagain" in
12519 '')
12520         case "$d_fork:$d_pipe" in
12521         define:define)
12522         $cat head.c > try.c
12523         $cat >>try.c <<EOCP
12524 #include <errno.h>
12525 #include <sys/types.h>
12526 #include <signal.h>
12527 #include <stdio.h>
12528 #$i_stdlib I_STDLIB
12529 #ifdef I_STDLIB
12530 #include <stdlib.h>
12531 #endif
12532 #$i_fcntl I_FCNTL
12533 #ifdef I_FCNTL
12534 #include <fcntl.h>
12535 #endif
12536 #define MY_O_NONBLOCK $o_nonblock
12537 #ifndef errno  /* XXX need better Configure test */
12538 extern int errno;
12539 #endif
12540 #$i_unistd I_UNISTD
12541 #ifdef I_UNISTD
12542 #include <unistd.h>
12543 #endif
12544 #$i_string I_STRING
12545 #ifdef I_STRING
12546 #include <string.h>
12547 #else
12548 #include <strings.h>
12549 #endif
12550 $signal_t blech(int x) { exit(3); }
12551 EOCP
12552         $cat >> try.c <<'EOCP'
12553 int main()
12554 {
12555         int pd[2];
12556         int pu[2];
12557         char buf[1];
12558         char string[100];
12559
12560         pipe(pd);       /* Down: child -> parent */
12561         pipe(pu);       /* Up: parent -> child */
12562         if (0 != fork()) {
12563                 int ret;
12564                 close(pd[1]);   /* Parent reads from pd[0] */
12565                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12566 #ifdef F_SETFL
12567                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12568                         exit(1);
12569 #else
12570                 exit(4);
12571 #endif
12572                 signal(SIGALRM, blech);
12573                 alarm(5);
12574                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12575                         exit(2);
12576                 sprintf(string, "%d\n", ret);
12577                 write(2, string, strlen(string));
12578                 alarm(0);
12579 #ifdef EAGAIN
12580                 if (errno == EAGAIN) {
12581                         printf("EAGAIN\n");
12582                         goto ok;
12583                 }
12584 #endif
12585 #ifdef EWOULDBLOCK
12586                 if (errno == EWOULDBLOCK)
12587                         printf("EWOULDBLOCK\n");
12588 #endif
12589         ok:
12590                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12591                 sleep(2);                               /* Give it time to close our pipe */
12592                 alarm(5);
12593                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12594                 alarm(0);
12595                 sprintf(string, "%d\n", ret);
12596                 write(4, string, strlen(string));
12597                 exit(0);
12598         }
12599
12600         close(pd[0]);                   /* We write to pd[1] */
12601         close(pu[1]);                   /* We read from pu[0] */
12602         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12603         close(pd[1]);                   /* Pipe pd is now fully closed! */
12604         exit(0);                                /* Bye bye, thank you for playing! */
12605 }
12606 EOCP
12607         set try
12608         if eval $compile_ok; then
12609                 echo "$startsh" >mtry
12610                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12611                 chmod +x mtry
12612                 ./mtry >/dev/null 2>&1
12613                 case $? in
12614                 0) eagain=`$cat try.out`;;
12615                 1) echo "Could not perform non-blocking setting!";;
12616                 2) echo "I did a successful read() for something that was not there!";;
12617                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12618                 4) echo "Could not find F_SETFL!";;
12619                 *) echo "Something terribly wrong happened during testing.";;
12620                 esac
12621                 rd_nodata=`$cat try.ret`
12622                 echo "A read() system call with no data present returns $rd_nodata."
12623                 case "$rd_nodata" in
12624                 0|-1) ;;
12625                 *)
12626                         echo "(That's peculiar, fixing that to be -1.)"
12627                         rd_nodata=-1
12628                         ;;
12629                 esac
12630                 case "$eagain" in
12631                 '')
12632                         echo "Forcing errno EAGAIN on read() with no data available."
12633                         eagain=EAGAIN
12634                         ;;
12635                 *)
12636                         echo "Your read() sets errno to $eagain when no data is available."
12637                         ;;
12638                 esac
12639                 status=`$cat try.err`
12640                 case "$status" in
12641                 0) echo "And it correctly returns 0 to signal EOF.";;
12642                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12643                 *) echo "However, your read() returns '$status' on EOF??";;
12644                 esac
12645                 val="$define"
12646                 if test "$status" = "$rd_nodata"; then
12647                         echo "WARNING: you can't distinguish between EOF and no data!"
12648                         val="$undef"
12649                 fi
12650         else
12651                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12652                 eagain=EAGAIN
12653         fi
12654         ;;
12655         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12656                 eagain=EAGAIN
12657                 val="$define"
12658                 ;;
12659         esac
12660         set d_eofnblk
12661         eval $setvar
12662         ;;
12663 *)
12664         echo "Using $hint value $eagain."
12665         echo "Your read() returns $rd_nodata when no data is present."
12666         case "$d_eofnblk" in
12667         "$define") echo "And you can see EOF because read() returns 0.";;
12668         "$undef") echo "But you can't see EOF status from read() returned value.";;
12669         *)
12670                 echo "(Assuming you can't see EOF status from read anyway.)"
12671                 d_eofnblk=$undef
12672                 ;;
12673         esac
12674         ;;
12675 esac
12676 $rm_try head.c mtry
12677
12678 : see if _ptr and _cnt from stdio act std
12679 echo " "
12680
12681 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12682         echo "(Looks like you have stdio.h from BSD.)"
12683         case "$stdio_ptr" in
12684         '') stdio_ptr='((fp)->_p)'
12685                 ptr_lval=$define
12686                 ;;
12687         *)      ptr_lval=$d_stdio_ptr_lval;;
12688         esac
12689         case "$stdio_cnt" in
12690         '') stdio_cnt='((fp)->_r)'
12691                 cnt_lval=$define
12692                 ;;
12693         *)      cnt_lval=$d_stdio_cnt_lval;;
12694         esac
12695         case "$stdio_base" in
12696         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12697         esac
12698         case "$stdio_bufsiz" in
12699         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12700         esac
12701 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12702         echo "(Looks like you have stdio.h from Linux.)"
12703         case "$stdio_ptr" in
12704         '') stdio_ptr='((fp)->_IO_read_ptr)'
12705                 ptr_lval=$define
12706                 ;;
12707         *)      ptr_lval=$d_stdio_ptr_lval;;
12708         esac
12709         case "$stdio_cnt" in
12710         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12711                 cnt_lval=$undef
12712                 ;;
12713         *)      cnt_lval=$d_stdio_cnt_lval;;
12714         esac
12715         case "$stdio_base" in
12716         '') stdio_base='((fp)->_IO_read_base)';;
12717         esac
12718         case "$stdio_bufsiz" in
12719         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12720         esac
12721 else
12722         case "$stdio_ptr" in
12723         '') stdio_ptr='((fp)->_ptr)'
12724                 ptr_lval=$define
12725                 ;;
12726         *)      ptr_lval=$d_stdio_ptr_lval;;
12727         esac
12728         case "$stdio_cnt" in
12729         '') stdio_cnt='((fp)->_cnt)'
12730                 cnt_lval=$define
12731                 ;;
12732         *)      cnt_lval=$d_stdio_cnt_lval;;
12733         esac
12734         case "$stdio_base" in
12735         '') stdio_base='((fp)->_base)';;
12736         esac
12737         case "$stdio_bufsiz" in
12738         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12739         esac
12740 fi
12741
12742 : test whether _ptr and _cnt really work
12743 echo "Checking how std your stdio is..." >&4
12744 $cat >try.c <<EOP
12745 #include <stdio.h>
12746 #$i_stdlib I_STDLIB
12747 #ifdef I_STDLIB
12748 #include <stdlib.h>
12749 #endif
12750 #define FILE_ptr(fp)    $stdio_ptr
12751 #define FILE_cnt(fp)    $stdio_cnt
12752 int main() {
12753         FILE *fp = fopen("try.c", "r");
12754         char c = getc(fp);
12755         if (
12756                 18 <= FILE_cnt(fp) &&
12757                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12758         )
12759                 exit(0);
12760         exit(1);
12761 }
12762 EOP
12763 val="$undef"
12764 set try
12765 if eval $compile && $to try.c; then
12766         if $run ./try; then
12767                 echo "Your stdio acts pretty std."
12768                 val="$define"
12769         else
12770                 echo "Your stdio isn't very std."
12771         fi
12772 else
12773         echo "Your stdio doesn't appear very std."
12774 fi
12775 $rm_try
12776
12777 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12778 # direct buffer manipulation no longer works.  The Configure tests
12779 # should be changed to correctly detect this, but until then,
12780 # the following check should at least let perl compile and run.
12781 # (This quick fix should be updated before 5.8.1.)
12782 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12783 # A. Dougherty, June 3, 2002.
12784 case "$d_gnulibc" in
12785 $define)
12786         case "$gnulibc_version" in
12787         2.[01]*)  ;;
12788         2.2) ;;
12789         2.2.[0-9]) ;;
12790         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12791                 val="$undef"
12792                 ;;
12793         esac
12794         ;;
12795 esac
12796 set d_stdstdio
12797 eval $setvar
12798
12799 : Can _ptr be used as an lvalue?
12800 case "$d_stdstdio$ptr_lval" in
12801 $define$define) val=$define ;;
12802 *) val=$undef ;;
12803 esac
12804 set d_stdio_ptr_lval
12805 eval $setvar
12806
12807 : Can _cnt be used as an lvalue?
12808 case "$d_stdstdio$cnt_lval" in
12809 $define$define) val=$define ;;
12810 *) val=$undef ;;
12811 esac
12812 set d_stdio_cnt_lval
12813 eval $setvar
12814
12815
12816 : test whether setting _ptr sets _cnt as a side effect
12817 d_stdio_ptr_lval_sets_cnt="$undef"
12818 d_stdio_ptr_lval_nochange_cnt="$undef"
12819 case "$d_stdio_ptr_lval$d_stdstdio" in
12820 $define$define)
12821         echo "Checking to see what happens if we set the stdio ptr..." >&4
12822 $cat >try.c <<EOP
12823 #include <stdio.h>
12824 /* Can we scream? */
12825 /* Eat dust sed :-) */
12826 /* In the buffer space, no one can hear you scream. */
12827 #$i_stdlib I_STDLIB
12828 #ifdef I_STDLIB
12829 #include <stdlib.h>
12830 #endif
12831 #define FILE_ptr(fp)    $stdio_ptr
12832 #define FILE_cnt(fp)    $stdio_cnt
12833 #include <sys/types.h>
12834 int main() {
12835         FILE *fp = fopen("try.c", "r");
12836         int c;
12837         char *ptr;
12838         size_t cnt;
12839         if (!fp) {
12840             puts("Fail even to read");
12841             exit(1);
12842         }
12843         c = getc(fp); /* Read away the first # */
12844         if (c == EOF) {
12845             puts("Fail even to read");
12846             exit(1);
12847         }
12848         if (!(
12849                 18 <= FILE_cnt(fp) &&
12850                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12851         )) {
12852                 puts("Fail even to read");
12853                 exit (1);
12854         }
12855         ptr = (char*) FILE_ptr(fp);
12856         cnt = (size_t)FILE_cnt(fp);
12857
12858         FILE_ptr(fp) += 42;
12859
12860         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12861                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12862                 exit (1);
12863         }
12864         if (FILE_cnt(fp) <= 20) {
12865                 printf ("Fail (<20 chars to test)");
12866                 exit (1);
12867         }
12868         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12869                 puts("Fail compare");
12870                 exit (1);
12871         }
12872         if (cnt == FILE_cnt(fp)) {
12873                 puts("Pass_unchanged");
12874                 exit (0);
12875         }
12876         if (FILE_cnt(fp) == (cnt - 42)) {
12877                 puts("Pass_changed");
12878                 exit (0);
12879         }
12880         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12881         return 1;
12882
12883 }
12884 EOP
12885         set try
12886         if eval $compile && $to try.c; then
12887                 case `$run ./try` in
12888                 Pass_changed)
12889                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12890                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12891                 Pass_unchanged)
12892                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12893                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12894                 Fail*)
12895                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12896                 *)
12897                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12898         esac
12899         else
12900                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12901         fi
12902         $rm_try
12903         ;;
12904 esac
12905
12906 : see if _base is also standard
12907 val="$undef"
12908 case "$d_stdstdio" in
12909 $define)
12910         $cat >try.c <<EOP
12911 #include <stdio.h>
12912 #$i_stdlib I_STDLIB
12913 #ifdef I_STDLIB
12914 #include <stdlib.h>
12915 #endif
12916 #define FILE_base(fp)   $stdio_base
12917 #define FILE_bufsiz(fp) $stdio_bufsiz
12918 int main() {
12919         FILE *fp = fopen("try.c", "r");
12920         char c = getc(fp);
12921         if (
12922                 19 <= FILE_bufsiz(fp) &&
12923                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12924         )
12925                 exit(0);
12926         exit(1);
12927 }
12928 EOP
12929         set try
12930         if eval $compile && $to try.c; then
12931                 if $run ./try; then
12932                         echo "And its _base field acts std."
12933                         val="$define"
12934                 else
12935                         echo "But its _base field isn't std."
12936                 fi
12937         else
12938                 echo "However, it seems to be lacking the _base field."
12939         fi
12940         $rm_try
12941         ;;
12942 esac
12943 set d_stdiobase
12944 eval $setvar
12945
12946 : see if fast_stdio exists
12947 val="$undef"
12948 case "$d_stdstdio:$d_stdio_ptr_lval" in
12949 "$define:$define")
12950         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12951         *$define*)
12952                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12953                 val="$define"
12954                 ;;
12955         esac
12956         ;;
12957 esac
12958 set d_faststdio
12959 eval $setvar
12960
12961
12962
12963 : see if fchdir exists
12964 set fchdir d_fchdir
12965 eval $inlibc
12966
12967 : see if fchmod exists
12968 set fchmod d_fchmod
12969 eval $inlibc
12970
12971 : see if fchown exists
12972 set fchown d_fchown
12973 eval $inlibc
12974
12975 : see if this is an fcntl system
12976 set fcntl d_fcntl
12977 eval $inlibc
12978
12979 : See if fcntl-based locking works.
12980 echo " "
12981 $cat >try.c <<EOCP
12982 #$i_stdlib I_STDLIB
12983 #ifdef I_STDLIB
12984 #include <stdlib.h>
12985 #endif
12986 #include <unistd.h>
12987 #include <fcntl.h>
12988 #include <signal.h>
12989 $signal_t blech(int x) { exit(3); }
12990 int main() {
12991 #if defined(F_SETLK) && defined(F_SETLKW)
12992      struct flock flock;
12993      int retval, fd;
12994      fd = open("try.c", O_RDONLY);
12995      flock.l_type = F_RDLCK;
12996      flock.l_whence = SEEK_SET;
12997      flock.l_start = flock.l_len = 0;
12998      signal(SIGALRM, blech);
12999      alarm(10);
13000      retval = fcntl(fd, F_SETLK, &flock);
13001      close(fd);
13002      (retval < 0 ? exit(2) : exit(0));
13003 #else
13004      exit(2);
13005 #endif
13006 }
13007 EOCP
13008 echo "Checking if fcntl-based file locking works... "
13009 case "$d_fcntl" in
13010 "$define")
13011         set try
13012         if eval $compile_ok; then
13013                 if $run ./try; then
13014                         echo "Yes, it seems to work."
13015                         val="$define"
13016                 else
13017                         echo "Nope, it didn't work."
13018                         val="$undef"
13019                         case "$?" in
13020                         3) $cat >&4 <<EOM
13021 ***
13022 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13023 *** This is (almost) impossible.
13024 *** If your NFS lock daemons are not feeling well, something like
13025 *** this may happen, please investigate.  Cannot continue, aborting.
13026 ***
13027 EOM
13028                                 exit 1
13029                                 ;;
13030                         esac
13031                 fi
13032         else
13033                 echo "I'm unable to compile the test program, so I'll assume not."
13034                 val="$undef"
13035         fi
13036         ;;
13037 *) val="$undef";
13038         echo "Nope, since you don't even have fcntl()."
13039         ;;
13040 esac
13041 set d_fcntl_can_lock
13042 eval $setvar
13043 $rm_try
13044
13045 : check for fd_set items
13046 $cat <<EOM
13047
13048 Checking to see how well your C compiler handles fd_set and friends ...
13049 EOM
13050 $cat >try.c <<EOCP
13051 #$i_stdlib I_STDLIB
13052 #ifdef I_STDLIB
13053 #include <stdlib.h>
13054 #endif
13055 #$i_systime I_SYS_TIME
13056 #$i_sysselct I_SYS_SELECT
13057 #$d_socket HAS_SOCKET
13058 #include <sys/types.h>
13059 #ifdef HAS_SOCKET
13060 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13061 #endif
13062 #ifdef I_SYS_TIME
13063 #include <sys/time.h>
13064 #endif
13065 #ifdef I_SYS_SELECT
13066 #include <sys/select.h>
13067 #endif
13068 int main() {
13069         fd_set fds;
13070
13071 #ifdef TRYBITS
13072         if(fds.fds_bits);
13073 #endif
13074
13075 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13076         exit(0);
13077 #else
13078         exit(1);
13079 #endif
13080 }
13081 EOCP
13082 set try -DTRYBITS
13083 if eval $compile; then
13084         d_fds_bits="$define"
13085         d_fd_set="$define"
13086         echo "Well, your system knows about the normal fd_set typedef..." >&4
13087         if $run ./try; then
13088                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13089                 d_fd_macros="$define"
13090         else
13091                 $cat >&4 <<'EOM'
13092 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13093 EOM
13094                 d_fd_macros="$undef"
13095         fi
13096 else
13097         $cat <<'EOM'
13098 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13099 EOM
13100         set try
13101         if eval $compile; then
13102                 d_fds_bits="$undef"
13103                 d_fd_set="$define"
13104                 echo "Well, your system has some sort of fd_set available..." >&4
13105                 if $run ./try; then
13106                         echo "and you have the normal fd_set macros." >&4
13107                         d_fd_macros="$define"
13108                 else
13109                         $cat <<'EOM'
13110 but not the normal fd_set macros!  Gross!  More work for me...
13111 EOM
13112                         d_fd_macros="$undef"
13113                 fi
13114         else
13115         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13116                 d_fd_set="$undef"
13117                 d_fds_bits="$undef"
13118                 d_fd_macros="$undef"
13119         fi
13120 fi
13121 $rm_try
13122
13123 : see if fgetpos exists
13124 set fgetpos d_fgetpos
13125 eval $inlibc
13126
13127 : see if finite exists
13128 set finite d_finite
13129 eval $inlibc
13130
13131 : see if finitel exists
13132 set finitel d_finitel
13133 eval $inlibc
13134
13135 : see if flock exists
13136 set flock d_flock
13137 eval $inlibc
13138
13139 : see if prototype for flock is available
13140 echo " "
13141 set d_flockproto flock $i_sysfile sys/file.h
13142 eval $hasproto
13143
13144 : see if fp_class exists
13145 set fp_class d_fp_class
13146 eval $inlibc
13147
13148 : see if pathconf exists
13149 set pathconf d_pathconf
13150 eval $inlibc
13151
13152 : see if fpathconf exists
13153 set fpathconf d_fpathconf
13154 eval $inlibc
13155
13156 : see if fpclass exists
13157 set fpclass d_fpclass
13158 eval $inlibc
13159
13160 : see if fpclassify exists
13161 set fpclassify d_fpclassify
13162 eval $inlibc
13163
13164 : see if fpclassl exists
13165 set fpclassl d_fpclassl
13166 eval $inlibc
13167
13168 : check for fpos64_t
13169 echo " "
13170 echo "Checking to see if you have fpos64_t..." >&4
13171 $cat >try.c <<EOCP
13172 #include <stdio.h>
13173 int main() { fpos64_t x = 7; }
13174 EOCP
13175 set try
13176 if eval $compile; then
13177         val="$define"
13178         echo "You have fpos64_t."
13179 else
13180         val="$undef"
13181         echo "You do not have fpos64_t."
13182         case "$fpossize" in
13183         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13184         esac
13185 fi
13186 $rm_try
13187 set d_fpos64_t
13188 eval $setvar
13189
13190 : see if frexpl exists
13191 set frexpl d_frexpl
13192 eval $inlibc
13193
13194 : see if this is a sys/param system
13195 set sys/param.h i_sysparam
13196 eval $inhdr
13197
13198 : see if this is a sys/mount.h system
13199 set sys/mount.h i_sysmount
13200 eval $inhdr
13201
13202 : Check for fs_data_s
13203 echo " "
13204 echo "Checking to see if your system supports struct fs_data..." >&4
13205 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13206 eval $hasstruct
13207 case "$d_fs_data_s" in
13208 "$define")      echo "Yes, it does."   ;;
13209 *)              echo "No, it doesn't." ;;
13210 esac
13211
13212 : see if fseeko exists
13213 set fseeko d_fseeko
13214 eval $inlibc
13215 case "$longsize" in
13216 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13217 esac
13218
13219 : see if fsetpos exists
13220 set fsetpos d_fsetpos
13221 eval $inlibc
13222
13223 : see if fstatfs exists
13224 set fstatfs d_fstatfs
13225 eval $inlibc
13226
13227 : see if statvfs exists
13228 set statvfs d_statvfs
13229 eval $inlibc
13230
13231 : see if fstatvfs exists
13232 set fstatvfs d_fstatvfs
13233 eval $inlibc
13234
13235
13236 : see if fsync exists
13237 set fsync d_fsync
13238 eval $inlibc
13239
13240 : see if ftello exists
13241 set ftello d_ftello
13242 eval $inlibc
13243 case "$longsize" in
13244 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13245 esac
13246
13247 : check for a working futimes
13248 d_futimes="$undef"
13249 echo " "
13250 echo "Checking if you have a working futimes()" >&4
13251 $cat >try.c <<EOCP
13252 #include <stdio.h>
13253 #include <sys/time.h>
13254 #include <errno.h>
13255 #include <fcntl.h>
13256
13257 int main ()
13258 {
13259     int fd, rv;
13260     fd = open ("try.c", O_RDWR);
13261     if (-1 == fd) exit (1);
13262     rv = futimes (fd, NULL);
13263     exit (rv == -1 ? errno : 0);
13264 }
13265 EOCP
13266 set try
13267 if eval $compile; then
13268     `$run ./try`
13269     rc=$?
13270     case "$rc" in
13271         0)  echo "Yes, you have" >&4
13272             d_futimes="$define"
13273             ;;
13274         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13275             ;;
13276     esac
13277 else
13278     echo "No, it does not (probably harmless)" >&4
13279 fi
13280 $rm_try
13281
13282 : see if getcwd exists
13283 set getcwd d_getcwd
13284 eval $inlibc
13285
13286 : see if getespwnam exists
13287 set getespwnam d_getespwnam
13288 eval $inlibc
13289
13290 : see if getfsstat exists
13291 set getfsstat d_getfsstat
13292 eval $inlibc
13293
13294 : see if getgrent exists
13295 set getgrent d_getgrent
13296 eval $inlibc
13297
13298 : see if getgrent_r exists
13299 set getgrent_r d_getgrent_r
13300 eval $inlibc
13301 case "$d_getgrent_r" in
13302 "$define")
13303         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13304         case "$d_getgrent_r_proto:$usethreads" in
13305         ":define")      d_getgrent_r_proto=define
13306                 set d_getgrent_r_proto getgrent_r $hdrs
13307                 eval $hasproto ;;
13308         *)      ;;
13309         esac
13310         case "$d_getgrent_r_proto" in
13311         define)
13312         case "$getgrent_r_proto" in
13313         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13314         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13315         esac
13316         case "$getgrent_r_proto" in
13317         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13318         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13319         esac
13320         case "$getgrent_r_proto" in
13321         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13322         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13323         esac
13324         case "$getgrent_r_proto" in
13325         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13326         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13327         esac
13328         case "$getgrent_r_proto" in
13329         ''|0) try='int getgrent_r(struct group*, char*, int);'
13330         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13331         esac
13332         case "$getgrent_r_proto" in
13333         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13334         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13335         esac
13336         case "$getgrent_r_proto" in
13337         ''|0)   d_getgrent_r=undef
13338                 getgrent_r_proto=0
13339                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13340         * )     case "$getgrent_r_proto" in
13341                 REENTRANT_PROTO*) ;;
13342                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13343                 esac
13344                 echo "Prototype: $try" ;;
13345         esac
13346         ;;
13347         *)      case "$usethreads" in
13348                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13349                 esac
13350                 d_getgrent_r=undef
13351                 getgrent_r_proto=0
13352                 ;;
13353         esac
13354         ;;
13355 *)      getgrent_r_proto=0
13356         ;;
13357 esac
13358
13359 : see if getgrgid_r exists
13360 set getgrgid_r d_getgrgid_r
13361 eval $inlibc
13362 case "$d_getgrgid_r" in
13363 "$define")
13364         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13365         case "$d_getgrgid_r_proto:$usethreads" in
13366         ":define")      d_getgrgid_r_proto=define
13367                 set d_getgrgid_r_proto getgrgid_r $hdrs
13368                 eval $hasproto ;;
13369         *)      ;;
13370         esac
13371         case "$d_getgrgid_r_proto" in
13372         define)
13373         case "$getgrgid_r_proto" in
13374         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13375         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13376         esac
13377         case "$getgrgid_r_proto" in
13378         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13379         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13380         esac
13381         case "$getgrgid_r_proto" in
13382         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13383         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13384         esac
13385         case "$getgrgid_r_proto" in
13386         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13387         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13388         esac
13389         case "$getgrgid_r_proto" in
13390         ''|0)   d_getgrgid_r=undef
13391                 getgrgid_r_proto=0
13392                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13393         * )     case "$getgrgid_r_proto" in
13394                 REENTRANT_PROTO*) ;;
13395                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13396                 esac
13397                 echo "Prototype: $try" ;;
13398         esac
13399         ;;
13400         *)      case "$usethreads" in
13401                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13402                 esac
13403                 d_getgrgid_r=undef
13404                 getgrgid_r_proto=0
13405                 ;;
13406         esac
13407         ;;
13408 *)      getgrgid_r_proto=0
13409         ;;
13410 esac
13411
13412 : see if getgrnam_r exists
13413 set getgrnam_r d_getgrnam_r
13414 eval $inlibc
13415 case "$d_getgrnam_r" in
13416 "$define")
13417         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13418         case "$d_getgrnam_r_proto:$usethreads" in
13419         ":define")      d_getgrnam_r_proto=define
13420                 set d_getgrnam_r_proto getgrnam_r $hdrs
13421                 eval $hasproto ;;
13422         *)      ;;
13423         esac
13424         case "$d_getgrnam_r_proto" in
13425         define)
13426         case "$getgrnam_r_proto" in
13427         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13428         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13429         esac
13430         case "$getgrnam_r_proto" in
13431         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13432         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13433         esac
13434         case "$getgrnam_r_proto" in
13435         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13436         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13437         esac
13438         case "$getgrnam_r_proto" in
13439         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13440         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13441         esac
13442         case "$getgrnam_r_proto" in
13443         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13444         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13445         esac
13446         case "$getgrnam_r_proto" in
13447         ''|0)   d_getgrnam_r=undef
13448                 getgrnam_r_proto=0
13449                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13450         * )     case "$getgrnam_r_proto" in
13451                 REENTRANT_PROTO*) ;;
13452                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13453                 esac
13454                 echo "Prototype: $try" ;;
13455         esac
13456         ;;
13457         *)      case "$usethreads" in
13458                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13459                 esac
13460                 d_getgrnam_r=undef
13461                 getgrnam_r_proto=0
13462                 ;;
13463         esac
13464         ;;
13465 *)      getgrnam_r_proto=0
13466         ;;
13467 esac
13468
13469 : see if gethostbyaddr exists
13470 set gethostbyaddr d_gethbyaddr
13471 eval $inlibc
13472
13473 : see if gethostbyname exists
13474 set gethostbyname d_gethbyname
13475 eval $inlibc
13476
13477 : see if gethostent exists
13478 set gethostent d_gethent
13479 eval $inlibc
13480
13481 : see how we will look up host name
13482 echo " "
13483 call=''
13484 if set gethostname val -f d_gethname; eval $csym; $val; then
13485         echo 'gethostname() found.' >&4
13486         d_gethname="$define"
13487         call=gethostname
13488 fi
13489 if set uname val -f d_uname; eval $csym; $val; then
13490         if ./xenix; then
13491                 $cat <<'EOM'
13492 uname() was found, but you're running xenix, and older versions of xenix
13493 have a broken uname(). If you don't really know whether your xenix is old
13494 enough to have a broken system call, use the default answer.
13495
13496 EOM
13497                 dflt=y
13498                 case "$d_uname" in
13499                 "$define") dflt=n;;
13500                 esac
13501                 rp='Is your uname() broken?'
13502                 . ./myread
13503                 case "$ans" in
13504                 n*) d_uname="$define"; call=uname;;
13505                 esac
13506         else
13507                 echo 'uname() found.' >&4
13508                 d_uname="$define"
13509                 case "$call" in
13510                 '') call=uname ;;
13511                 esac
13512         fi
13513 fi
13514 case "$d_gethname" in
13515 '') d_gethname="$undef";;
13516 esac
13517 case "$d_uname" in
13518 '') d_uname="$undef";;
13519 esac
13520 case "$d_uname$d_gethname" in
13521 *define*)
13522         dflt=n
13523         cat <<EOM
13524
13525 Every now and then someone has a $call() that lies about the hostname
13526 but can't be fixed for political or economic reasons.  If you wish, I can
13527 pretend $call() isn't there and maybe compute hostname at run-time
13528 thanks to the '$phostname' command.
13529
13530 EOM
13531         rp="Shall I ignore $call() from now on?"
13532         . ./myread
13533         case "$ans" in
13534         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13535         esac;;
13536 esac
13537 case "$phostname" in
13538 '') aphostname='';;
13539 *) case "$aphostname" in
13540         /*) ;;
13541         *) set X $phostname
13542                 shift
13543                 file=$1
13544                 shift
13545                 file=`./loc $file $file $pth`
13546                 aphostname=`echo $file $*`
13547                 ;;
13548         esac
13549         ;;
13550 esac
13551 case "$d_uname$d_gethname" in
13552 *define*) ;;
13553 *)
13554         case "$phostname" in
13555         '')
13556                 echo "There will be no way for $package to get your hostname." >&4;;
13557         *)
13558         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13559                 ;;
13560         esac;;
13561 esac
13562 case "$d_phostname" in
13563 '') d_phostname="$undef";;
13564 esac
13565
13566 : see if gethostbyaddr_r exists
13567 set gethostbyaddr_r d_gethostbyaddr_r
13568 eval $inlibc
13569 case "$d_gethostbyaddr_r" in
13570 "$define")
13571         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13572         case "$d_gethostbyaddr_r_proto:$usethreads" in
13573         ":define")      d_gethostbyaddr_r_proto=define
13574                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13575                 eval $hasproto ;;
13576         *)      ;;
13577         esac
13578         case "$d_gethostbyaddr_r_proto" in
13579         define)
13580         case "$gethostbyaddr_r_proto" in
13581         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13582         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13583         esac
13584         case "$gethostbyaddr_r_proto" in
13585         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13586         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13587         esac
13588         case "$gethostbyaddr_r_proto" in
13589         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13590         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13591         esac
13592         case "$gethostbyaddr_r_proto" in
13593         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13594         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13595         esac
13596         case "$gethostbyaddr_r_proto" in
13597         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13598         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13599         esac
13600         case "$gethostbyaddr_r_proto" in
13601         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13602         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13603         esac
13604         case "$gethostbyaddr_r_proto" in
13605         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13606         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13607         esac
13608         case "$gethostbyaddr_r_proto" in
13609         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13610         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13611         esac
13612         case "$gethostbyaddr_r_proto" in
13613         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13614         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13615         esac
13616         case "$gethostbyaddr_r_proto" in
13617         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13618         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13619         esac
13620         case "$gethostbyaddr_r_proto" in
13621         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13622         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13623         esac
13624         case "$gethostbyaddr_r_proto" in
13625         ''|0)   d_gethostbyaddr_r=undef
13626                 gethostbyaddr_r_proto=0
13627                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13628         * )     case "$gethostbyaddr_r_proto" in
13629                 REENTRANT_PROTO*) ;;
13630                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13631                 esac
13632                 echo "Prototype: $try" ;;
13633         esac
13634         ;;
13635         *)      case "$usethreads" in
13636                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13637                 esac
13638                 d_gethostbyaddr_r=undef
13639                 gethostbyaddr_r_proto=0
13640                 ;;
13641         esac
13642         ;;
13643 *)      gethostbyaddr_r_proto=0
13644         ;;
13645 esac
13646
13647 : see if gethostbyname_r exists
13648 set gethostbyname_r d_gethostbyname_r
13649 eval $inlibc
13650 case "$d_gethostbyname_r" in
13651 "$define")
13652         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13653         case "$d_gethostbyname_r_proto:$usethreads" in
13654         ":define")      d_gethostbyname_r_proto=define
13655                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13656                 eval $hasproto ;;
13657         *)      ;;
13658         esac
13659         case "$d_gethostbyname_r_proto" in
13660         define)
13661         case "$gethostbyname_r_proto" in
13662         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13663         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13664         esac
13665         case "$gethostbyname_r_proto" in
13666         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13667         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13668         esac
13669         case "$gethostbyname_r_proto" in
13670         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13671         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13672         esac
13673         case "$gethostbyname_r_proto" in
13674         ''|0)   d_gethostbyname_r=undef
13675                 gethostbyname_r_proto=0
13676                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13677         * )     case "$gethostbyname_r_proto" in
13678                 REENTRANT_PROTO*) ;;
13679                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13680                 esac
13681                 echo "Prototype: $try" ;;
13682         esac
13683         ;;
13684         *)      case "$usethreads" in
13685                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13686                 esac
13687                 d_gethostbyname_r=undef
13688                 gethostbyname_r_proto=0
13689                 ;;
13690         esac
13691         ;;
13692 *)      gethostbyname_r_proto=0
13693         ;;
13694 esac
13695
13696 : see if gethostent_r exists
13697 set gethostent_r d_gethostent_r
13698 eval $inlibc
13699 case "$d_gethostent_r" in
13700 "$define")
13701         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13702         case "$d_gethostent_r_proto:$usethreads" in
13703         ":define")      d_gethostent_r_proto=define
13704                 set d_gethostent_r_proto gethostent_r $hdrs
13705                 eval $hasproto ;;
13706         *)      ;;
13707         esac
13708         case "$d_gethostent_r_proto" in
13709         define)
13710         case "$gethostent_r_proto" in
13711         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13712         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13713         esac
13714         case "$gethostent_r_proto" in
13715         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13716         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13717         esac
13718         case "$gethostent_r_proto" in
13719         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13720         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13721         esac
13722         case "$gethostent_r_proto" in
13723         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13724         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13725         esac
13726         case "$gethostent_r_proto" in
13727         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13728         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13729         esac
13730         case "$gethostent_r_proto" in
13731         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13732         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13733         esac
13734         case "$gethostent_r_proto" in
13735         ''|0)   d_gethostent_r=undef
13736                 gethostent_r_proto=0
13737                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13738         * )     case "$gethostent_r_proto" in
13739                 REENTRANT_PROTO*) ;;
13740                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13741                 esac
13742                 echo "Prototype: $try" ;;
13743         esac
13744         ;;
13745         *)      case "$usethreads" in
13746                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13747                 esac
13748                 d_gethostent_r=undef
13749                 gethostent_r_proto=0
13750                 ;;
13751         esac
13752         ;;
13753 *)      gethostent_r_proto=0
13754         ;;
13755 esac
13756
13757 : see if prototypes for various gethostxxx netdb.h functions are available
13758 echo " "
13759 set d_gethostprotos gethostent $i_netdb netdb.h
13760 eval $hasproto
13761
13762 : see if getitimer exists
13763 set getitimer d_getitimer
13764 eval $inlibc
13765
13766 : see if getlogin exists
13767 set getlogin d_getlogin
13768 eval $inlibc
13769
13770 : see if getlogin_r exists
13771 set getlogin_r d_getlogin_r
13772 eval $inlibc
13773 case "$d_getlogin_r" in
13774 "$define")
13775         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13776         case "$d_getlogin_r_proto:$usethreads" in
13777         ":define")      d_getlogin_r_proto=define
13778                 set d_getlogin_r_proto getlogin_r $hdrs
13779                 eval $hasproto ;;
13780         *)      ;;
13781         esac
13782         case "$d_getlogin_r_proto" in
13783         define)
13784         case "$getlogin_r_proto" in
13785         ''|0) try='int getlogin_r(char*, size_t);'
13786         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13787         esac
13788         case "$getlogin_r_proto" in
13789         ''|0) try='int getlogin_r(char*, int);'
13790         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13791         esac
13792         case "$getlogin_r_proto" in
13793         ''|0) try='char* getlogin_r(char*, size_t);'
13794         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13795         esac
13796         case "$getlogin_r_proto" in
13797         ''|0) try='char* getlogin_r(char*, int);'
13798         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
13799         esac
13800         case "$getlogin_r_proto" in
13801         ''|0)   d_getlogin_r=undef
13802                 getlogin_r_proto=0
13803                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13804         * )     case "$getlogin_r_proto" in
13805                 REENTRANT_PROTO*) ;;
13806                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13807                 esac
13808                 echo "Prototype: $try" ;;
13809         esac
13810         ;;
13811         *)      case "$usethreads" in
13812                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13813                 esac
13814                 d_getlogin_r=undef
13815                 getlogin_r_proto=0
13816                 ;;
13817         esac
13818         ;;
13819 *)      getlogin_r_proto=0
13820         ;;
13821 esac
13822
13823 : see if getmnt exists
13824 set getmnt d_getmnt
13825 eval $inlibc
13826
13827 : see if getmntent exists
13828 set getmntent d_getmntent
13829 eval $inlibc
13830
13831 : see if getnetbyaddr exists
13832 set getnetbyaddr d_getnbyaddr
13833 eval $inlibc
13834
13835 : see if getnetbyname exists
13836 set getnetbyname d_getnbyname
13837 eval $inlibc
13838
13839 : see if getnetent exists
13840 set getnetent d_getnent
13841 eval $inlibc
13842
13843 : see if getnetbyaddr_r exists
13844 set getnetbyaddr_r d_getnetbyaddr_r
13845 eval $inlibc
13846 case "$d_getnetbyaddr_r" in
13847 "$define")
13848         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13849         case "$d_getnetbyaddr_r_proto:$usethreads" in
13850         ":define")      d_getnetbyaddr_r_proto=define
13851                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13852                 eval $hasproto ;;
13853         *)      ;;
13854         esac
13855         case "$d_getnetbyaddr_r_proto" in
13856         define)
13857         case "$getnetbyaddr_r_proto" in
13858         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13859         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13860         esac
13861         case "$getnetbyaddr_r_proto" in
13862         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13863         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13864         esac
13865         case "$getnetbyaddr_r_proto" in
13866         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13867         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13868         esac
13869         case "$getnetbyaddr_r_proto" in
13870         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13871         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13872         esac
13873         case "$getnetbyaddr_r_proto" in
13874         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13875         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13876         esac
13877         case "$getnetbyaddr_r_proto" in
13878         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13879         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13880         esac
13881         case "$getnetbyaddr_r_proto" in
13882         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13883         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13884         esac
13885         case "$getnetbyaddr_r_proto" in
13886         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13887         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13888         esac
13889         case "$getnetbyaddr_r_proto" in
13890         ''|0)   d_getnetbyaddr_r=undef
13891                 getnetbyaddr_r_proto=0
13892                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13893         * )     case "$getnetbyaddr_r_proto" in
13894                 REENTRANT_PROTO*) ;;
13895                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13896                 esac
13897                 echo "Prototype: $try" ;;
13898         esac
13899         ;;
13900         *)      case "$usethreads" in
13901                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13902                 esac
13903                 d_getnetbyaddr_r=undef
13904                 getnetbyaddr_r_proto=0
13905                 ;;
13906         esac
13907         ;;
13908 *)      getnetbyaddr_r_proto=0
13909         ;;
13910 esac
13911
13912 : see if getnetbyname_r exists
13913 set getnetbyname_r d_getnetbyname_r
13914 eval $inlibc
13915 case "$d_getnetbyname_r" in
13916 "$define")
13917         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13918         case "$d_getnetbyname_r_proto:$usethreads" in
13919         ":define")      d_getnetbyname_r_proto=define
13920                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13921                 eval $hasproto ;;
13922         *)      ;;
13923         esac
13924         case "$d_getnetbyname_r_proto" in
13925         define)
13926         case "$getnetbyname_r_proto" in
13927         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13928         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13929         esac
13930         case "$getnetbyname_r_proto" in
13931         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13932         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13933         esac
13934         case "$getnetbyname_r_proto" in
13935         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13936         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13937         esac
13938         case "$getnetbyname_r_proto" in
13939         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13940         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13941         esac
13942         case "$getnetbyname_r_proto" in
13943         ''|0)   d_getnetbyname_r=undef
13944                 getnetbyname_r_proto=0
13945                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13946         * )     case "$getnetbyname_r_proto" in
13947                 REENTRANT_PROTO*) ;;
13948                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13949                 esac
13950                 echo "Prototype: $try" ;;
13951         esac
13952         ;;
13953         *)      case "$usethreads" in
13954                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13955                 esac
13956                 d_getnetbyname_r=undef
13957                 getnetbyname_r_proto=0
13958                 ;;
13959         esac
13960         ;;
13961 *)      getnetbyname_r_proto=0
13962         ;;
13963 esac
13964
13965 : see if getnetent_r exists
13966 set getnetent_r d_getnetent_r
13967 eval $inlibc
13968 case "$d_getnetent_r" in
13969 "$define")
13970         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13971         case "$d_getnetent_r_proto:$usethreads" in
13972         ":define")      d_getnetent_r_proto=define
13973                 set d_getnetent_r_proto getnetent_r $hdrs
13974                 eval $hasproto ;;
13975         *)      ;;
13976         esac
13977         case "$d_getnetent_r_proto" in
13978         define)
13979         case "$getnetent_r_proto" in
13980         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13981         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13982         esac
13983         case "$getnetent_r_proto" in
13984         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13985         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13986         esac
13987         case "$getnetent_r_proto" in
13988         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13989         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13990         esac
13991         case "$getnetent_r_proto" in
13992         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13993         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
13994         esac
13995         case "$getnetent_r_proto" in
13996         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13997         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
13998         esac
13999         case "$getnetent_r_proto" in
14000         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14001         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14002         esac
14003         case "$getnetent_r_proto" in
14004         ''|0)   d_getnetent_r=undef
14005                 getnetent_r_proto=0
14006                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14007         * )     case "$getnetent_r_proto" in
14008                 REENTRANT_PROTO*) ;;
14009                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14010                 esac
14011                 echo "Prototype: $try" ;;
14012         esac
14013         ;;
14014         *)      case "$usethreads" in
14015                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14016                 esac
14017                 d_getnetent_r=undef
14018                 getnetent_r_proto=0
14019                 ;;
14020         esac
14021         ;;
14022 *)      getnetent_r_proto=0
14023         ;;
14024 esac
14025
14026 : see if prototypes for various getnetxxx netdb.h functions are available
14027 echo " "
14028 set d_getnetprotos getnetent $i_netdb netdb.h
14029 eval $hasproto
14030
14031 : see if getpagesize exists
14032 set getpagesize d_getpagsz
14033 eval $inlibc
14034
14035 : Optional checks for getprotobyname and getprotobynumber
14036
14037 : see if getprotobyname exists
14038 set getprotobyname d_getpbyname
14039 eval $inlibc
14040
14041 : see if getprotobynumber exists
14042 set getprotobynumber d_getpbynumber
14043 eval $inlibc
14044
14045 : see if getprotoent exists
14046 set getprotoent d_getpent
14047 eval $inlibc
14048
14049 : see if getpgid exists
14050 set getpgid d_getpgid
14051 eval $inlibc
14052
14053 : see if getpgrp2 exists
14054 set getpgrp2 d_getpgrp2
14055 eval $inlibc
14056
14057 : see if getppid exists
14058 set getppid d_getppid
14059 eval $inlibc
14060
14061 : see if getpriority exists
14062 set getpriority d_getprior
14063 eval $inlibc
14064
14065 : see if getprotobyname_r exists
14066 set getprotobyname_r d_getprotobyname_r
14067 eval $inlibc
14068 case "$d_getprotobyname_r" in
14069 "$define")
14070         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14071         case "$d_getprotobyname_r_proto:$usethreads" in
14072         ":define")      d_getprotobyname_r_proto=define
14073                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14074                 eval $hasproto ;;
14075         *)      ;;
14076         esac
14077         case "$d_getprotobyname_r_proto" in
14078         define)
14079         case "$getprotobyname_r_proto" in
14080         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14081         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14082         esac
14083         case "$getprotobyname_r_proto" in
14084         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14085         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14086         esac
14087         case "$getprotobyname_r_proto" in
14088         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14089         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14090         esac
14091         case "$getprotobyname_r_proto" in
14092         ''|0)   d_getprotobyname_r=undef
14093                 getprotobyname_r_proto=0
14094                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14095         * )     case "$getprotobyname_r_proto" in
14096                 REENTRANT_PROTO*) ;;
14097                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14098                 esac
14099                 echo "Prototype: $try" ;;
14100         esac
14101         ;;
14102         *)      case "$usethreads" in
14103                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14104                 esac
14105                 d_getprotobyname_r=undef
14106                 getprotobyname_r_proto=0
14107                 ;;
14108         esac
14109         ;;
14110 *)      getprotobyname_r_proto=0
14111         ;;
14112 esac
14113
14114 : see if getprotobynumber_r exists
14115 set getprotobynumber_r d_getprotobynumber_r
14116 eval $inlibc
14117 case "$d_getprotobynumber_r" in
14118 "$define")
14119         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14120         case "$d_getprotobynumber_r_proto:$usethreads" in
14121         ":define")      d_getprotobynumber_r_proto=define
14122                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14123                 eval $hasproto ;;
14124         *)      ;;
14125         esac
14126         case "$d_getprotobynumber_r_proto" in
14127         define)
14128         case "$getprotobynumber_r_proto" in
14129         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14130         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14131         esac
14132         case "$getprotobynumber_r_proto" in
14133         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14134         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14135         esac
14136         case "$getprotobynumber_r_proto" in
14137         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14138         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14139         esac
14140         case "$getprotobynumber_r_proto" in
14141         ''|0)   d_getprotobynumber_r=undef
14142                 getprotobynumber_r_proto=0
14143                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14144         * )     case "$getprotobynumber_r_proto" in
14145                 REENTRANT_PROTO*) ;;
14146                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14147                 esac
14148                 echo "Prototype: $try" ;;
14149         esac
14150         ;;
14151         *)      case "$usethreads" in
14152                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14153                 esac
14154                 d_getprotobynumber_r=undef
14155                 getprotobynumber_r_proto=0
14156                 ;;
14157         esac
14158         ;;
14159 *)      getprotobynumber_r_proto=0
14160         ;;
14161 esac
14162
14163 : see if getprotoent_r exists
14164 set getprotoent_r d_getprotoent_r
14165 eval $inlibc
14166 case "$d_getprotoent_r" in
14167 "$define")
14168         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14169         case "$d_getprotoent_r_proto:$usethreads" in
14170         ":define")      d_getprotoent_r_proto=define
14171                 set d_getprotoent_r_proto getprotoent_r $hdrs
14172                 eval $hasproto ;;
14173         *)      ;;
14174         esac
14175         case "$d_getprotoent_r_proto" in
14176         define)
14177         case "$getprotoent_r_proto" in
14178         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14179         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14180         esac
14181         case "$getprotoent_r_proto" in
14182         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14183         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14184         esac
14185         case "$getprotoent_r_proto" in
14186         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14187         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14188         esac
14189         case "$getprotoent_r_proto" in
14190         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14191         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14192         esac
14193         case "$getprotoent_r_proto" in
14194         ''|0)   d_getprotoent_r=undef
14195                 getprotoent_r_proto=0
14196                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14197         * )     case "$getprotoent_r_proto" in
14198                 REENTRANT_PROTO*) ;;
14199                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14200                 esac
14201                 echo "Prototype: $try" ;;
14202         esac
14203         ;;
14204         *)      case "$usethreads" in
14205                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14206                 esac
14207                 d_getprotoent_r=undef
14208                 getprotoent_r_proto=0
14209                 ;;
14210         esac
14211         ;;
14212 *)      getprotoent_r_proto=0
14213         ;;
14214 esac
14215
14216 : see if prototypes for various getprotoxxx netdb.h functions are available
14217 echo " "
14218 set d_getprotoprotos getprotoent $i_netdb netdb.h
14219 eval $hasproto
14220
14221 : see if getprpwnam exists
14222 set getprpwnam d_getprpwnam
14223 eval $inlibc
14224
14225 : see if getpwent exists
14226 set getpwent d_getpwent
14227 eval $inlibc
14228
14229 : see if getpwent_r exists
14230 set getpwent_r d_getpwent_r
14231 eval $inlibc
14232 case "$d_getpwent_r" in
14233 "$define")
14234         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14235         case "$d_getpwent_r_proto:$usethreads" in
14236         ":define")      d_getpwent_r_proto=define
14237                 set d_getpwent_r_proto getpwent_r $hdrs
14238                 eval $hasproto ;;
14239         *)      ;;
14240         esac
14241         case "$d_getpwent_r_proto" in
14242         define)
14243         case "$getpwent_r_proto" in
14244         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14245         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14246         esac
14247         case "$getpwent_r_proto" in
14248         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14249         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14250         esac
14251         case "$getpwent_r_proto" in
14252         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14253         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14254         esac
14255         case "$getpwent_r_proto" in
14256         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14257         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14258         esac
14259         case "$getpwent_r_proto" in
14260         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14261         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14262         esac
14263         case "$getpwent_r_proto" in
14264         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14265         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14266         esac
14267         case "$getpwent_r_proto" in
14268         ''|0)   d_getpwent_r=undef
14269                 getpwent_r_proto=0
14270                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14271         * )     case "$getpwent_r_proto" in
14272                 REENTRANT_PROTO*) ;;
14273                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14274                 esac
14275                 echo "Prototype: $try" ;;
14276         esac
14277         ;;
14278         *)      case "$usethreads" in
14279                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14280                 esac
14281                 d_getpwent_r=undef
14282                 getpwent_r_proto=0
14283                 ;;
14284         esac
14285         ;;
14286 *)      getpwent_r_proto=0
14287         ;;
14288 esac
14289
14290 : see if getpwnam_r exists
14291 set getpwnam_r d_getpwnam_r
14292 eval $inlibc
14293 case "$d_getpwnam_r" in
14294 "$define")
14295         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14296         case "$d_getpwnam_r_proto:$usethreads" in
14297         ":define")      d_getpwnam_r_proto=define
14298                 set d_getpwnam_r_proto getpwnam_r $hdrs
14299                 eval $hasproto ;;
14300         *)      ;;
14301         esac
14302         case "$d_getpwnam_r_proto" in
14303         define)
14304         case "$getpwnam_r_proto" in
14305         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14306         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14307         esac
14308         case "$getpwnam_r_proto" in
14309         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14310         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14311         esac
14312         case "$getpwnam_r_proto" in
14313         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14314         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14315         esac
14316         case "$getpwnam_r_proto" in
14317         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14318         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14319         esac
14320         case "$getpwnam_r_proto" in
14321         ''|0)   d_getpwnam_r=undef
14322                 getpwnam_r_proto=0
14323                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14324         * )     case "$getpwnam_r_proto" in
14325                 REENTRANT_PROTO*) ;;
14326                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14327                 esac
14328                 echo "Prototype: $try" ;;
14329         esac
14330         ;;
14331         *)      case "$usethreads" in
14332                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14333                 esac
14334                 d_getpwnam_r=undef
14335                 getpwnam_r_proto=0
14336                 ;;
14337         esac
14338         ;;
14339 *)      getpwnam_r_proto=0
14340         ;;
14341 esac
14342
14343 : see if getpwuid_r exists
14344 set getpwuid_r d_getpwuid_r
14345 eval $inlibc
14346 case "$d_getpwuid_r" in
14347 "$define")
14348         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14349         case "$d_getpwuid_r_proto:$usethreads" in
14350         ":define")      d_getpwuid_r_proto=define
14351                 set d_getpwuid_r_proto getpwuid_r $hdrs
14352                 eval $hasproto ;;
14353         *)      ;;
14354         esac
14355         case "$d_getpwuid_r_proto" in
14356         define)
14357         case "$getpwuid_r_proto" in
14358         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14359         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14360         esac
14361         case "$getpwuid_r_proto" in
14362         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14363         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14364         esac
14365         case "$getpwuid_r_proto" in
14366         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14367         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14368         esac
14369         case "$getpwuid_r_proto" in
14370         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14371         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14372         esac
14373         case "$getpwuid_r_proto" in
14374         ''|0)   d_getpwuid_r=undef
14375                 getpwuid_r_proto=0
14376                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14377         * )     case "$getpwuid_r_proto" in
14378                 REENTRANT_PROTO*) ;;
14379                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14380                 esac
14381                 echo "Prototype: $try" ;;
14382         esac
14383         ;;
14384         *)      case "$usethreads" in
14385                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14386                 esac
14387                 d_getpwuid_r=undef
14388                 getpwuid_r_proto=0
14389                 ;;
14390         esac
14391         ;;
14392 *)      getpwuid_r_proto=0
14393         ;;
14394 esac
14395
14396 : Optional checks for getsbyname and getsbyport
14397
14398 : see if getservbyname exists
14399 set getservbyname d_getsbyname
14400 eval $inlibc
14401
14402 : see if getservbyport exists
14403 set getservbyport d_getsbyport
14404 eval $inlibc
14405
14406 : see if getservent exists
14407 set getservent d_getsent
14408 eval $inlibc
14409
14410 : see if getservbyname_r exists
14411 set getservbyname_r d_getservbyname_r
14412 eval $inlibc
14413 case "$d_getservbyname_r" in
14414 "$define")
14415         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14416         case "$d_getservbyname_r_proto:$usethreads" in
14417         ":define")      d_getservbyname_r_proto=define
14418                 set d_getservbyname_r_proto getservbyname_r $hdrs
14419                 eval $hasproto ;;
14420         *)      ;;
14421         esac
14422         case "$d_getservbyname_r_proto" in
14423         define)
14424         case "$getservbyname_r_proto" in
14425         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14426         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14427         esac
14428         case "$getservbyname_r_proto" in
14429         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14430         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14431         esac
14432         case "$getservbyname_r_proto" in
14433         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14434         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14435         esac
14436         case "$getservbyname_r_proto" in
14437         ''|0)   d_getservbyname_r=undef
14438                 getservbyname_r_proto=0
14439                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14440         * )     case "$getservbyname_r_proto" in
14441                 REENTRANT_PROTO*) ;;
14442                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14443                 esac
14444                 echo "Prototype: $try" ;;
14445         esac
14446         ;;
14447         *)      case "$usethreads" in
14448                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14449                 esac
14450                 d_getservbyname_r=undef
14451                 getservbyname_r_proto=0
14452                 ;;
14453         esac
14454         ;;
14455 *)      getservbyname_r_proto=0
14456         ;;
14457 esac
14458
14459 : see if getservbyport_r exists
14460 set getservbyport_r d_getservbyport_r
14461 eval $inlibc
14462 case "$d_getservbyport_r" in
14463 "$define")
14464         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14465         case "$d_getservbyport_r_proto:$usethreads" in
14466         ":define")      d_getservbyport_r_proto=define
14467                 set d_getservbyport_r_proto getservbyport_r $hdrs
14468                 eval $hasproto ;;
14469         *)      ;;
14470         esac
14471         case "$d_getservbyport_r_proto" in
14472         define)
14473         case "$getservbyport_r_proto" in
14474         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14475         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14476         esac
14477         case "$getservbyport_r_proto" in
14478         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14479         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14480         esac
14481         case "$getservbyport_r_proto" in
14482         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14483         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14484         esac
14485         case "$getservbyport_r_proto" in
14486         ''|0)   d_getservbyport_r=undef
14487                 getservbyport_r_proto=0
14488                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14489         * )     case "$getservbyport_r_proto" in
14490                 REENTRANT_PROTO*) ;;
14491                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14492                 esac
14493                 echo "Prototype: $try" ;;
14494         esac
14495         ;;
14496         *)      case "$usethreads" in
14497                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14498                 esac
14499                 d_getservbyport_r=undef
14500                 getservbyport_r_proto=0
14501                 ;;
14502         esac
14503         ;;
14504 *)      getservbyport_r_proto=0
14505         ;;
14506 esac
14507
14508 : see if getservent_r exists
14509 set getservent_r d_getservent_r
14510 eval $inlibc
14511 case "$d_getservent_r" in
14512 "$define")
14513         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14514         case "$d_getservent_r_proto:$usethreads" in
14515         ":define")      d_getservent_r_proto=define
14516                 set d_getservent_r_proto getservent_r $hdrs
14517                 eval $hasproto ;;
14518         *)      ;;
14519         esac
14520         case "$d_getservent_r_proto" in
14521         define)
14522         case "$getservent_r_proto" in
14523         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14524         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14525         esac
14526         case "$getservent_r_proto" in
14527         ''|0) try='int getservent_r(struct servent*, char*, int);'
14528         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14529         esac
14530         case "$getservent_r_proto" in
14531         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14532         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14533         esac
14534         case "$getservent_r_proto" in
14535         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14536         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14537         esac
14538         case "$getservent_r_proto" in
14539         ''|0)   d_getservent_r=undef
14540                 getservent_r_proto=0
14541                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14542         * )     case "$getservent_r_proto" in
14543                 REENTRANT_PROTO*) ;;
14544                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14545                 esac
14546                 echo "Prototype: $try" ;;
14547         esac
14548         ;;
14549         *)      case "$usethreads" in
14550                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14551                 esac
14552                 d_getservent_r=undef
14553                 getservent_r_proto=0
14554                 ;;
14555         esac
14556         ;;
14557 *)      getservent_r_proto=0
14558         ;;
14559 esac
14560
14561 : see if prototypes for various getservxxx netdb.h functions are available
14562 echo " "
14563 set d_getservprotos getservent $i_netdb netdb.h
14564 eval $hasproto
14565
14566 : see if getspnam exists
14567 set getspnam d_getspnam
14568 eval $inlibc
14569
14570 : see if this is a shadow.h system
14571 set shadow.h i_shadow
14572 eval $inhdr
14573
14574 : see if getspnam_r exists
14575 set getspnam_r d_getspnam_r
14576 eval $inlibc
14577 case "$d_getspnam_r" in
14578 "$define")
14579         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14580         case "$d_getspnam_r_proto:$usethreads" in
14581         ":define")      d_getspnam_r_proto=define
14582                 set d_getspnam_r_proto getspnam_r $hdrs
14583                 eval $hasproto ;;
14584         *)      ;;
14585         esac
14586         case "$d_getspnam_r_proto" in
14587         define)
14588         case "$getspnam_r_proto" in
14589         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14590         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14591         esac
14592         case "$getspnam_r_proto" in
14593         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14594         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14595         esac
14596         case "$getspnam_r_proto" in
14597         ''|0)   d_getspnam_r=undef
14598                 getspnam_r_proto=0
14599                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14600         * )     case "$getspnam_r_proto" in
14601                 REENTRANT_PROTO*) ;;
14602                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14603                 esac
14604                 echo "Prototype: $try" ;;
14605         esac
14606         ;;
14607         *)      case "$usethreads" in
14608                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14609                 esac
14610                 d_getspnam_r=undef
14611                 getspnam_r_proto=0
14612                 ;;
14613         esac
14614         ;;
14615 *)      getspnam_r_proto=0
14616         ;;
14617 esac
14618
14619 : see if gettimeofday or ftime exists
14620 set gettimeofday d_gettimeod
14621 eval $inlibc
14622 case "$d_gettimeod" in
14623 "$undef")
14624         set ftime d_ftime 
14625         eval $inlibc
14626         ;;
14627 *)
14628         val="$undef"; set d_ftime; eval $setvar
14629         ;;
14630 esac
14631 case "$d_gettimeod$d_ftime" in
14632 "$undef$undef")
14633         echo " "
14634         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14635         ;;
14636 esac
14637
14638 : see if gmtime_r exists
14639 set gmtime_r d_gmtime_r
14640 eval $inlibc
14641 case "$d_gmtime_r" in
14642 "$define")
14643         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14644         case "$d_gmtime_r_proto:$usethreads" in
14645         ":define")      d_gmtime_r_proto=define
14646                 set d_gmtime_r_proto gmtime_r $hdrs
14647                 eval $hasproto ;;
14648         *)      ;;
14649         esac
14650         case "$d_gmtime_r_proto" in
14651         define)
14652         case "$gmtime_r_proto" in
14653         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14654         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14655         esac
14656         case "$gmtime_r_proto" in
14657         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14658         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14659         esac
14660         case "$gmtime_r_proto" in
14661         ''|0)   d_gmtime_r=undef
14662                 gmtime_r_proto=0
14663                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14664         * )     case "$gmtime_r_proto" in
14665                 REENTRANT_PROTO*) ;;
14666                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14667                 esac
14668                 echo "Prototype: $try" ;;
14669         esac
14670         ;;
14671         *)      case "$usethreads" in
14672                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14673                 esac
14674                 d_gmtime_r=undef
14675                 gmtime_r_proto=0
14676                 ;;
14677         esac
14678         ;;
14679 *)      gmtime_r_proto=0
14680         ;;
14681 esac
14682
14683 : see if hasmntopt exists
14684 set hasmntopt d_hasmntopt
14685 eval $inlibc
14686
14687 : see if this is a netinet/in.h or sys/in.h system
14688 set netinet/in.h i_niin sys/in.h i_sysin
14689 eval $inhdr
14690
14691 : see if arpa/inet.h has to be included
14692 set arpa/inet.h i_arpainet
14693 eval $inhdr
14694
14695 : see if htonl --and friends-- exists
14696 val=''
14697 set htonl val
14698 eval $inlibc
14699
14700 : Maybe they are macros.
14701 case "$val" in
14702 $undef)
14703         $cat >htonl.c <<EOM
14704 #include <stdio.h>
14705 #include <sys/types.h>
14706 #$i_niin I_NETINET_IN
14707 #$i_sysin I_SYS_IN
14708 #$i_arpainet I_ARPA_INET
14709 #ifdef I_NETINET_IN
14710 #include <netinet/in.h>
14711 #endif
14712 #ifdef I_SYS_IN
14713 #include <sys/in.h>
14714 #endif
14715 #ifdef I_ARPA_INET
14716 #include <arpa/inet.h>
14717 #endif
14718 #ifdef htonl
14719 printf("Defined as a macro.");
14720 #endif
14721 EOM
14722         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14723         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14724                 val="$define"
14725                 echo "But it seems to be defined as a macro." >&4
14726         fi
14727         $rm -f htonl.?
14728         ;;
14729 esac
14730 set d_htonl
14731 eval $setvar
14732
14733 : see if ilogbl exists
14734 set ilogbl d_ilogbl
14735 eval $inlibc
14736
14737 : index or strchr
14738 echo " "
14739 if set index val -f; eval $csym; $val; then
14740         if set strchr val -f d_strchr; eval $csym; $val; then
14741                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14742                         val="$define"
14743                         vali="$undef"
14744                         echo "strchr() found." >&4
14745                 else
14746                         val="$undef"
14747                         vali="$define"
14748                         echo "index() found." >&4
14749                 fi
14750         else
14751                 val="$undef"
14752                 vali="$define"
14753                 echo "index() found." >&4
14754         fi
14755 else
14756         if set strchr val -f d_strchr; eval $csym; $val; then
14757                 val="$define"
14758                 vali="$undef"
14759                 echo "strchr() found." >&4
14760         else
14761                 echo "No index() or strchr() found!" >&4
14762                 val="$undef"
14763                 vali="$undef"
14764         fi
14765 fi
14766 set d_strchr; eval $setvar
14767 val="$vali"
14768 set d_index; eval $setvar
14769
14770 : check whether inet_aton exists
14771 set inet_aton d_inetaton
14772 eval $inlibc
14773
14774 : Look for isascii
14775 echo " "
14776 $cat >isascii.c <<EOCP
14777 #include <stdio.h>
14778 #include <ctype.h>
14779 #$i_stdlib I_STDLIB
14780 #ifdef I_STDLIB
14781 #include <stdlib.h>
14782 #endif
14783 int main() {
14784         int c = 'A';
14785         if (isascii(c))
14786                 exit(0);
14787         else
14788                 exit(1);
14789 }
14790 EOCP
14791 set isascii
14792 if eval $compile; then
14793         echo "isascii() found." >&4
14794         val="$define"
14795 else
14796         echo "isascii() NOT found." >&4
14797         val="$undef"
14798 fi
14799 set d_isascii
14800 eval $setvar
14801 $rm -f isascii*
14802
14803 : see if isfinite exists
14804 set isfinite d_isfinite
14805 eval $inlibc
14806
14807 : see if isinf exists
14808 set isinf d_isinf
14809 eval $inlibc
14810
14811 : see if isnan exists
14812 set isnan d_isnan
14813 eval $inlibc
14814
14815 : see if isnanl exists
14816 set isnanl d_isnanl
14817 eval $inlibc
14818
14819 : see if killpg exists
14820 set killpg d_killpg
14821 eval $inlibc
14822
14823 : see if lchown exists
14824 echo " "
14825 $cat > try.c <<'EOCP'
14826 /* System header to define __stub macros and hopefully few prototypes,
14827     which can conflict with char lchown(); below.  */
14828 #include <assert.h>
14829 /* Override any gcc2 internal prototype to avoid an error.  */
14830 /* We use char because int might match the return type of a gcc2
14831    builtin and then its argument prototype would still apply.  */
14832 char lchown();
14833 int main() {
14834     /*  The GNU C library defines this for functions which it implements
14835         to always fail with ENOSYS.  Some functions are actually named
14836         something starting with __ and the normal name is an alias.  */
14837 #if defined (__stub_lchown) || defined (__stub___lchown)
14838 choke me
14839 #else
14840 lchown();
14841 #endif
14842 ; return 0; }
14843 EOCP
14844 set try
14845 if eval $compile; then
14846     $echo "lchown() found." >&4
14847     val="$define"
14848 else
14849     $echo "lchown() NOT found." >&4
14850     val="$undef"
14851 fi
14852 set d_lchown
14853 eval $setvar
14854
14855 : See if number of significant digits in a double precision number is known
14856 echo " "
14857 $cat >ldbl_dig.c <<EOM
14858 #$i_limits I_LIMITS
14859 #$i_float I_FLOAT
14860 #ifdef I_LIMITS
14861 #include <limits.h>
14862 #endif
14863 #ifdef I_FLOAT
14864 #include <float.h>
14865 #endif
14866 #ifdef LDBL_DIG
14867 printf("Contains LDBL_DIG");
14868 #endif
14869 EOM
14870 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14871 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14872         echo "LDBL_DIG found." >&4
14873         val="$define"
14874 else
14875         echo "LDBL_DIG NOT found." >&4
14876         val="$undef"
14877 fi
14878 $rm -f ldbl_dig.?
14879 set d_ldbl_dig
14880 eval $setvar
14881
14882 : see if this is a math.h system
14883 set math.h i_math
14884 eval $inhdr
14885
14886 : check to see if math.h defines _LIB_VERSION
14887 d_libm_lib_version="$undef"
14888 case $i_math in
14889     $define)
14890         echo " "
14891         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14892         $cat >try.c <<EOCP
14893 #include <unistd.h>
14894 #include <math.h>
14895 int main (int argc, char *argv[])
14896 {
14897     printf ("%d\n", _LIB_VERSION);
14898     return (0);
14899     } /* main */
14900 EOCP
14901         set try
14902         if eval $compile; then
14903             foo=`$run ./try`
14904             echo "Yes, it does ($foo)" >&4
14905             d_libm_lib_version="$define"
14906         else
14907             echo "No, it does not (probably harmless)" >&4
14908             fi
14909         $rm_try
14910         ;;
14911
14912     esac
14913
14914 : see if link exists
14915 set link d_link
14916 eval $inlibc
14917
14918 : see if localtime_r exists
14919 set localtime_r d_localtime_r
14920 eval $inlibc
14921 case "$d_localtime_r" in
14922 "$define")
14923         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14924         case "$d_localtime_r_proto:$usethreads" in
14925         ":define")      d_localtime_r_proto=define
14926                 set d_localtime_r_proto localtime_r $hdrs
14927                 eval $hasproto ;;
14928         *)      ;;
14929         esac
14930         case "$d_localtime_r_proto" in
14931         define)
14932         case "$localtime_r_proto" in
14933         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14934         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
14935         esac
14936         case "$localtime_r_proto" in
14937         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14938         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
14939         esac
14940         case "$localtime_r_proto" in
14941         ''|0)   d_localtime_r=undef
14942                 localtime_r_proto=0
14943                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14944         * )     case "$localtime_r_proto" in
14945                 REENTRANT_PROTO*) ;;
14946                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14947                 esac
14948                 echo "Prototype: $try" ;;
14949         esac
14950         ;;
14951         *)      case "$usethreads" in
14952                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14953                 esac
14954                 d_localtime_r=undef
14955                 localtime_r_proto=0
14956                 ;;
14957         esac
14958         ;;
14959 *)      localtime_r_proto=0
14960         ;;
14961 esac
14962
14963 : see if localtime_r calls tzset
14964 case "$localtime_r_proto" in
14965 REENTRANT_PROTO*)
14966         $cat >try.c <<EOCP
14967 /*  Does our libc's localtime_r call tzset ?
14968  *  return 0 if so, 1 otherwise.
14969  */
14970 #$i_systypes    I_SYS_TYPES
14971 #$i_unistd      I_UNISTD
14972 #$i_time        I_TIME
14973 #$i_stdlib      I_STDLIB
14974 #$i_string      I_STRING
14975 #$i_malloc      I_MALLOC
14976 #ifdef I_SYS_TYPES
14977 #  include <sys/types.h>
14978 #endif
14979 #ifdef I_UNISTD
14980 #  include <unistd.h>
14981 #endif
14982 #ifdef I_TIME
14983 #  include <time.h>
14984 #endif
14985 #ifdef I_STDLIB
14986 #include <stdlib.h>
14987 #endif
14988 #ifdef I_STRING
14989 #  include <string.h>
14990 #else
14991 #  include <strings.h>
14992 #endif
14993 #ifdef I_MALLOC
14994 #  include <malloc.h>
14995 #endif
14996 int main()
14997 {
14998     time_t t = time(0L);
14999     char w_tz[]="TZ" "=GMT+5",
15000          e_tz[]="TZ" "=GMT-5",
15001         *tz_e = (char*)malloc(16),
15002         *tz_w = (char*)malloc(16);
15003     struct tm tm_e, tm_w;
15004     memset(&tm_e,'\0',sizeof(struct tm));
15005     memset(&tm_w,'\0',sizeof(struct tm));
15006     strcpy(tz_e,e_tz);
15007     strcpy(tz_w,w_tz);
15008
15009     putenv(tz_e);
15010     localtime_r(&t, &tm_e);
15011
15012     putenv(tz_w);
15013     localtime_r(&t, &tm_w);
15014
15015     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15016         return 1;
15017     return 0;
15018 }
15019 EOCP
15020         set try
15021         if eval $compile; then
15022             if $run ./try; then
15023                 d_localtime_r_needs_tzset=undef;
15024             else
15025                 d_localtime_r_needs_tzset=define;
15026             fi;
15027         else
15028             d_localtime_r_needs_tzset=undef;
15029         fi;
15030      ;;
15031   *)
15032      d_localtime_r_needs_tzset=undef;
15033      ;;
15034 esac
15035 $rm_try
15036
15037 : see if localeconv exists
15038 set localeconv d_locconv
15039 eval $inlibc
15040
15041 : see if lockf exists
15042 set lockf d_lockf
15043 eval $inlibc
15044
15045 : see if prototype for lseek is available
15046 echo " "
15047 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15048 eval $hasproto
15049
15050 : see if lstat exists
15051 set lstat d_lstat
15052 eval $inlibc
15053
15054 : see if madvise exists
15055 set madvise d_madvise
15056 eval $inlibc
15057
15058 : see if malloc_size exists
15059 set malloc_size d_malloc_size
15060 eval $inlibc
15061
15062 : see if malloc_size_good exists
15063 set malloc_good_size d_malloc_good_size
15064 eval $inlibc
15065
15066 : see if mblen exists
15067 set mblen d_mblen
15068 eval $inlibc
15069
15070 : see if mbstowcs exists
15071 set mbstowcs d_mbstowcs
15072 eval $inlibc
15073
15074 : see if mbtowc exists
15075 set mbtowc d_mbtowc
15076 eval $inlibc
15077
15078 : see if memchr exists
15079 set memchr d_memchr
15080 eval $inlibc
15081
15082 : see if memcmp exists
15083 set memcmp d_memcmp
15084 eval $inlibc
15085
15086 : see if memcpy exists
15087 set memcpy d_memcpy
15088 eval $inlibc
15089
15090 : see if memmove exists
15091 set memmove d_memmove
15092 eval $inlibc
15093
15094 : see if memset exists
15095 set memset d_memset
15096 eval $inlibc
15097
15098 : see if mkdir exists
15099 set mkdir d_mkdir
15100 eval $inlibc
15101
15102 : see if mkdtemp exists
15103 set mkdtemp d_mkdtemp
15104 eval $inlibc
15105
15106 : see if mkfifo exists
15107 set mkfifo d_mkfifo
15108 eval $inlibc
15109
15110 : see if mkstemp exists
15111 set mkstemp d_mkstemp
15112 eval $inlibc
15113
15114 : see if mkstemps exists
15115 set mkstemps d_mkstemps
15116 eval $inlibc
15117
15118 : see if mktime exists
15119 set mktime d_mktime
15120 eval $inlibc
15121
15122 : see if this is a sys/mman.h system
15123 set sys/mman.h i_sysmman
15124 eval $inhdr
15125
15126 : see if mmap exists
15127 set mmap d_mmap
15128 eval $inlibc
15129 : see what shmat returns
15130 : default to something harmless
15131 mmaptype='void *'
15132 case "$i_sysmman$d_mmap" in
15133 "$define$define")
15134         $cat >mmap.c <<'END'
15135 #include <sys/mman.h>
15136 void *mmap();
15137 END
15138         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15139                 mmaptype='void *'
15140         else
15141                 mmaptype='caddr_t'
15142         fi
15143         echo "and it returns ($mmaptype)." >&4
15144         ;;
15145 esac
15146
15147
15148
15149 : see if sqrtl exists
15150 set sqrtl d_sqrtl
15151 eval $inlibc
15152
15153 : see if scalbnl exists
15154 set scalbnl d_scalbnl
15155 eval $inlibc
15156
15157 : see if modfl exists
15158 set modfl d_modfl
15159 eval $inlibc
15160
15161 : see if prototype for modfl is available
15162 echo " "
15163 set d_modflproto modfl $i_math math.h
15164 eval $hasproto
15165
15166 d_modfl_pow32_bug="$undef"
15167
15168 case "$d_longdbl$d_modfl" in
15169 $define$define)
15170         $cat <<EOM
15171 Checking to see whether your modfl() is okay for large values...
15172 EOM
15173 $cat >try.c <<EOCP
15174 #include <math.h>
15175 #include <stdio.h>
15176 EOCP
15177 if $test "X$d_modflproto" != "X$define"; then
15178         $cat >>try.c <<EOCP
15179 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15180 long double modfl (long double, long double *);
15181 EOCP
15182 fi
15183 $cat >>try.c <<EOCP
15184 int main() {
15185     long double nv = 4294967303.15;
15186     long double v, w;
15187     v = modfl(nv, &w);
15188 #ifdef __GLIBC__
15189     printf("glibc");
15190 #endif
15191     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15192     return 0;
15193 }
15194 EOCP
15195         case "$osname:$gccversion" in
15196         aix:)   saveccflags="$ccflags"
15197                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15198         esac
15199         set try
15200         if eval $compile; then
15201                 foo=`$run ./try`
15202                 case "$foo" in
15203                 *" 4294967303.150000 1.150000 4294967302.000000")
15204                         echo >&4 "Your modfl() is broken for large values."
15205                         d_modfl_pow32_bug="$define"
15206                         case "$foo" in
15207                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15208                         ;;
15209                         esac
15210                         ;;
15211                 *" 4294967303.150000 0.150000 4294967303.000000")
15212                         echo >&4 "Your modfl() seems okay for large values."
15213                         ;;
15214                 *)      echo >&4 "I don't understand your modfl() at all."
15215                         d_modfl="$undef"
15216                         ;;
15217                 esac
15218                 $rm_try
15219         else
15220                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15221                 d_modfl="$undef"
15222         fi
15223         case "$osname:$gccversion" in
15224         aix:)   ccflags="$saveccflags" ;; # restore
15225         esac
15226         ;;
15227 esac
15228
15229 if $test "$uselongdouble" = "$define"; then
15230     message=""
15231     if $test "$d_sqrtl" != "$define"; then
15232         message="$message sqrtl"
15233     fi
15234     if $test "$d_modfl" != "$define"; then
15235         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15236             echo "You have both aintl and copysignl, so I can emulate modfl."
15237         else
15238             message="$message modfl"
15239         fi
15240     fi
15241     if $test "$d_frexpl" != "$define"; then
15242         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15243             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15244         else
15245             message="$message frexpl"
15246         fi
15247     fi
15248
15249     if $test "$message" != ""; then
15250         $cat <<EOM >&4
15251
15252 *** You requested the use of long doubles but you do not seem to have
15253 *** the following mathematical functions needed for long double support:
15254 ***    $message
15255 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15256 *** Cannot continue, aborting.
15257
15258 EOM
15259
15260         exit 1
15261     fi
15262 fi
15263
15264 : see if mprotect exists
15265 set mprotect d_mprotect
15266 eval $inlibc
15267
15268 : see if msgctl exists
15269 set msgctl d_msgctl
15270 eval $inlibc
15271
15272 : see if msgget exists
15273 set msgget d_msgget
15274 eval $inlibc
15275
15276 : see if msgsnd exists
15277 set msgsnd d_msgsnd
15278 eval $inlibc
15279
15280 : see if msgrcv exists
15281 set msgrcv d_msgrcv
15282 eval $inlibc
15283
15284 : see how much of the 'msg*(2)' library is present.
15285 h_msg=true
15286 echo " "
15287 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15288 *"$undef"*) h_msg=false;;
15289 esac
15290 case "$osname" in
15291 freebsd)
15292     case "`ipcs 2>&1`" in
15293     "SVID messages"*"not configured"*)
15294         echo "Your $osname does not have the msg*(2) configured." >&4
15295         h_msg=false
15296         val="$undef"
15297         set msgctl d_msgctl
15298         eval $setvar
15299         set msgget d_msgget
15300         eval $setvar
15301         set msgsnd d_msgsnd
15302         eval $setvar
15303         set msgrcv d_msgrcv
15304         eval $setvar
15305         ;;
15306     esac
15307     ;;
15308 esac
15309 : we could also check for sys/ipc.h ...
15310 if $h_msg && $test `./findhdr sys/msg.h`; then
15311         echo "You have the full msg*(2) library." >&4
15312         val="$define"
15313 else
15314         echo "You don't have the full msg*(2) library." >&4
15315         val="$undef"
15316 fi
15317 set d_msg
15318 eval $setvar
15319
15320 : Check for msghdr_s
15321 echo " "
15322 echo "Checking to see if your system supports struct msghdr..." >&4
15323 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15324 eval $hasstruct
15325 case "$d_msghdr_s" in
15326 "$define")      echo "Yes, it does."   ;;
15327 *)              echo "No, it doesn't." ;;
15328 esac
15329
15330
15331 : see if msync exists
15332 set msync d_msync
15333 eval $inlibc
15334
15335 : see if munmap exists
15336 set munmap d_munmap
15337 eval $inlibc
15338
15339 : see if nice exists
15340 set nice d_nice
15341 eval $inlibc
15342
15343 : see if this is a langinfo.h system
15344 set langinfo.h i_langinfo
15345 eval $inhdr
15346
15347 : see if nl_langinfo exists
15348 set nl_langinfo d_nl_langinfo
15349 eval $inlibc
15350
15351 : check for volatile keyword
15352 echo " "
15353 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15354 $cat >try.c <<'EOCP'
15355 int main()
15356 {
15357         typedef struct _goo_struct goo_struct;
15358         goo_struct * volatile goo = ((goo_struct *)0);
15359         struct _goo_struct {
15360                 long long_int;
15361                 int reg_int;
15362                 char char_var;
15363         };
15364         typedef unsigned short foo_t;
15365         char *volatile foo;
15366         volatile int bar;
15367         volatile foo_t blech;
15368         foo = foo;
15369 }
15370 EOCP
15371 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15372         val="$define"
15373         echo "Yup, it does."
15374 else
15375         val="$undef"
15376         echo "Nope, it doesn't."
15377 fi
15378 set d_volatile
15379 eval $setvar
15380 $rm_try
15381
15382 : Check basic sizes
15383 echo " "
15384 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15385
15386 case "$use64bitint:$d_quad:$quadtype" in
15387 define:define:?*)
15388         ivtype="$quadtype"
15389         uvtype="$uquadtype"
15390         ivsize=8
15391         uvsize=8
15392         ;;
15393 *)      ivtype="long"
15394         uvtype="unsigned long"
15395         ivsize=$longsize
15396         uvsize=$longsize
15397         ;;
15398 esac
15399
15400 case "$uselongdouble:$d_longdbl" in
15401 define:define)
15402         nvtype="long double"
15403         nvsize=$longdblsize
15404         ;;
15405 *)      nvtype=double
15406         nvsize=$doublesize
15407         ;;
15408 esac
15409
15410 $echo "(IV will be "$ivtype", $ivsize bytes)"
15411 $echo "(UV will be "$uvtype", $uvsize bytes)"
15412 $echo "(NV will be "$nvtype", $nvsize bytes)"
15413
15414 $cat >try.c <<EOCP
15415 #$i_inttypes I_INTTYPES
15416 #ifdef I_INTTYPES
15417 #include <inttypes.h>
15418 #endif
15419 #include <stdio.h>
15420 int main() {
15421 #ifdef INT8
15422    int8_t i =  INT8_MAX;
15423   uint8_t u = UINT8_MAX;
15424   printf("int8_t\n");
15425 #endif
15426 #ifdef INT16
15427    int16_t i =  INT16_MAX;
15428   uint16_t i = UINT16_MAX;
15429   printf("int16_t\n");
15430 #endif
15431 #ifdef INT32
15432    int32_t i =  INT32_MAX;
15433   uint32_t u = UINT32_MAX;
15434   printf("int32_t\n");
15435 #endif
15436 }
15437 EOCP
15438
15439 i8type="signed char"
15440 u8type="unsigned char"
15441 i8size=1
15442 u8size=1
15443
15444 case "$i16type" in
15445 '')     case "$shortsize" in
15446         2)      i16type=short
15447                 u16type="unsigned short"
15448                 i16size=$shortsize
15449                 u16size=$shortsize
15450                 ;;
15451         esac
15452         ;;
15453 esac
15454 case "$i16type" in
15455 '')     set try -DINT16
15456         if eval $compile; then
15457                 case "`$run ./try`" in
15458                 int16_t)
15459                         i16type=int16_t
15460                         u16type=uint16_t
15461                         i16size=2
15462                         u16size=2
15463                         ;;
15464                 esac
15465         fi
15466         ;;
15467 esac
15468 case "$i16type" in
15469 '')     if $test $shortsize -ge 2; then
15470                 i16type=short
15471                 u16type="unsigned short"
15472                 i16size=$shortsize
15473                 u16size=$shortsize
15474         fi
15475         ;;
15476 esac
15477
15478 case "$i32type" in
15479 '')     case "$longsize" in
15480         4)      i32type=long
15481                 u32type="unsigned long"
15482                 i32size=$longsize
15483                 u32size=$longsize
15484                 ;;
15485         *)      case "$intsize" in
15486                 4)      i32type=int
15487                         u32type="unsigned int"
15488                         i32size=$intsize
15489                         u32size=$intsize
15490                         ;;
15491                 esac
15492                 ;;
15493         esac
15494         ;;
15495 esac
15496 case "$i32type" in
15497 '')     set try -DINT32
15498         if eval $compile; then
15499                 case "`$run ./try`" in
15500                 int32_t)
15501                         i32type=int32_t
15502                         u32type=uint32_t
15503                         i32size=4
15504                         u32size=4
15505                         ;;
15506                 esac
15507         fi
15508         ;;
15509 esac
15510 case "$i32type" in
15511 '')     if $test $intsize -ge 4; then
15512                 i32type=int
15513                 u32type="unsigned int"
15514                 i32size=$intsize
15515                 u32size=$intsize
15516         fi
15517         ;;
15518 esac
15519
15520 case "$i64type" in
15521 '')     case "$d_quad:$quadtype" in
15522         define:?*)
15523                 i64type="$quadtype"
15524                 u64type="$uquadtype"
15525                 i64size=8
15526                 u64size=8
15527                 ;;
15528         esac
15529         ;;
15530 esac
15531
15532 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15533 : volatile so that the compiler has to store it out to memory.
15534 if test X"$d_volatile" = X"$define"; then
15535         volatile=volatile
15536 fi
15537 $cat <<EOP >try.c
15538 #include <stdio.h>
15539 #$i_stdlib I_STDLIB
15540 #ifdef I_STDLIB
15541 #include <stdlib.h>
15542 #endif
15543 #include <sys/types.h>
15544 #include <signal.h>
15545 #ifdef SIGFPE
15546 $volatile int bletched = 0;
15547 $signal_t blech(int s) { bletched = 1; }
15548 #endif
15549 int main() {
15550     $uvtype u = 0;
15551     $nvtype d;
15552     int     n = 8 * $uvsize;
15553     int     i;
15554 #ifdef SIGFPE
15555     signal(SIGFPE, blech);
15556 #endif
15557
15558     for (i = 0; i < n; i++) {
15559       u = u << 1 | ($uvtype)1;
15560       d = ($nvtype)u;
15561       if (($uvtype)d != u)
15562         break;
15563       if (d <= 0)
15564         break;
15565       d = ($nvtype)(u - 1);
15566       if (($uvtype)d != (u - 1))
15567         break;
15568 #ifdef SIGFPE
15569       if (bletched)
15570         break;
15571 #endif
15572     }
15573     printf("%d\n", ((i == n) ? -n : i));
15574     exit(0);
15575 }
15576 EOP
15577 set try
15578
15579 d_nv_preserves_uv="$undef"
15580 if eval $compile; then
15581         nv_preserves_uv_bits="`$run ./try`"
15582 fi
15583 case "$nv_preserves_uv_bits" in
15584 \-[1-9]*)
15585         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15586         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15587         d_nv_preserves_uv="$define"
15588         ;;
15589 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15590         d_nv_preserves_uv="$undef" ;;
15591 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15592         nv_preserves_uv_bits="0" ;;
15593 esac
15594 $rm_try
15595
15596 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15597 : volatile so that the compiler has to store it out to memory.
15598 if test X"$d_volatile" = X"$define"; then
15599         volatile=volatile
15600 fi
15601 $cat <<EOP >try.c
15602 #include <stdio.h>
15603
15604 typedef $nvtype NV;
15605
15606 int
15607 main() {
15608   NV value = 2;
15609   int count = 1;
15610
15611   while(count < 256) {
15612     $volatile NV up = value + 1.0;
15613     $volatile NV negated = -value;
15614     $volatile NV down = negated - 1.0;
15615     $volatile NV got_up = up - value;
15616     int up_good = got_up == 1.0;
15617     int got_down = down - negated;
15618     int down_good = got_down == -1.0;
15619
15620     if (down_good != up_good) {
15621       fprintf(stderr,
15622               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15623               up_good, (double) got_up, down_good, (double) got_down,
15624               count, (double) value);
15625       return 1;
15626     }
15627     if (!up_good) {
15628       while (1) {
15629         if (count > 8) {
15630           count -= 8;
15631           fputs("256.0", stdout);
15632         } else {
15633           count--;
15634           fputs("2.0", stdout);
15635         }
15636         if (!count) {
15637           puts("");
15638           return 0;
15639         }
15640         fputs("*", stdout);
15641       }
15642     }
15643     value *= 2;
15644     ++count;
15645   }
15646   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15647           count, (double) value);
15648   return 1;
15649 }
15650 EOP
15651 set try
15652
15653 nv_overflows_integers_at='0'
15654 if eval $compile; then
15655     xxx="`$run ./try`"
15656     case "$?" in
15657         0)
15658             case "$xxx" in
15659                 2*)  cat >&4 <<EOM
15660 The largest integer your NVs can preserve is equal to $xxx
15661 EOM
15662                     nv_overflows_integers_at="$xxx"
15663                     ;;
15664                 *)  cat >&4 <<EOM
15665 Cannot determine the largest integer value your NVs can hold, unexpected output
15666 '$xxx'
15667 EOM
15668                     ;;
15669             esac
15670             ;;
15671         *)  cat >&4 <<EOM
15672 Cannot determine the largest integer value your NVs can hold
15673 EOM
15674             ;;
15675     esac
15676 fi
15677 $rm_try
15678
15679 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15680 : volatile so that the compiler has to store it out to memory.
15681 if test X"$d_volatile" = X"$define"; then
15682         volatile=volatile
15683 fi
15684 $cat <<EOP >try.c
15685 #include <stdio.h>
15686 #$i_stdlib I_STDLIB
15687 #ifdef I_STDLIB
15688 #include <stdlib.h>
15689 #endif
15690 #$i_string I_STRING
15691 #ifdef I_STRING
15692 #  include <string.h>
15693 #else
15694 #  include <strings.h>
15695 #endif
15696 #include <sys/types.h>
15697 #include <signal.h>
15698 #ifdef SIGFPE
15699 $volatile int bletched = 0;
15700 $signal_t blech(int s) { bletched = 1; }
15701 #endif
15702
15703 int checkit($nvtype d, char *where) {
15704     unsigned char *p = (char *)&d;
15705     unsigned char *end = p + sizeof(d);
15706     int fail = 0;
15707
15708     while (p < end)
15709         fail += *p++;
15710
15711     if (!fail)
15712         return 0;
15713
15714     p = (char *)&d;
15715     printf("No - %s: 0x", where);
15716     while (p < end)
15717         printf ("%02X", *p++);
15718     printf("\n");
15719     return 1;
15720 }
15721
15722 int main(int argc, char **argv) {
15723     $nvtype d = 0.0;
15724     int fail = 0;
15725     fail += checkit(d, "0.0");
15726
15727     /* The compiler shouldn't be assuming that bletched is 0  */
15728     d = bletched;
15729
15730     fail += checkit(d, "bleched");
15731
15732 #ifdef SIGFPE
15733     signal(SIGFPE, blech);
15734 #endif
15735
15736     /* Paranoia - the compiler should have no way of knowing that ANSI says
15737        that argv[argc] will always be NULL.  Actually, if it did assume this it
15738        would be buggy, as this is C and main() can be called from elsewhere in
15739        the program.  */
15740     d = argv[argc] ? 1 : 0;
15741
15742     if (d) {
15743         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15744     }
15745
15746     fail += checkit(d, "ternary");
15747
15748     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15749
15750     if (d != 0.0) {
15751         printf("No - memset doesn't give 0.0\n");
15752         /* This might just blow up:  */
15753         printf("(gives %g)\n", d);
15754         return 1;
15755     }
15756
15757 #ifdef SIGFPE
15758     if (bletched) {
15759         printf("No - something bleched\n");
15760         return 1;
15761     }
15762 #endif
15763     if (fail) {
15764       printf("No - %d fail(s)\n", fail);
15765       return 1;
15766     }
15767     printf("Yes\n");
15768     return 0;
15769 }
15770 EOP
15771 set try
15772
15773 d_nv_zero_is_allbits_zero="$undef"
15774 if eval $compile; then
15775     xxx="`$run ./try`"
15776     case "$?" in
15777         0)
15778             case "$xxx" in
15779                 Yes)  cat >&4 <<EOM
15780 0.0 is represented as all bits zero in memory
15781 EOM
15782                     d_nv_zero_is_allbits_zero="$define"
15783                     ;;
15784                 *)  cat >&4 <<EOM
15785 0.0 is not represented as all bits zero in memory
15786 EOM
15787                     d_nv_zero_is_allbits_zero="$undef"
15788                     ;;
15789             esac
15790             ;;
15791         *)  cat >&4 <<EOM
15792 0.0 is not represented as all bits zero in memory
15793 EOM
15794             d_nv_zero_is_allbits_zero="$undef"
15795             ;;
15796     esac
15797 fi
15798 $rm_try
15799
15800 : check for off64_t
15801 echo " "
15802 echo "Checking to see if you have off64_t..." >&4
15803 $cat >try.c <<EOCP
15804 #include <sys/types.h>
15805 #include <unistd.h>
15806 int main() { off64_t x = 7; }
15807 EOCP
15808 set try
15809 if eval $compile; then
15810         val="$define"
15811         echo "You have off64_t."
15812 else
15813         val="$undef"
15814         echo "You do not have off64_t."
15815         case "$lseeksize" in
15816         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15817         esac
15818 fi
15819 $rm_try
15820 set d_off64_t
15821 eval $setvar
15822
15823 : how to create joinable pthreads
15824 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15825         echo " "
15826         echo "Checking what constant to use for creating joinable pthreads..." >&4
15827         $cat >try.c <<'EOCP'
15828 #include <pthread.h>
15829 int main() {
15830     int detachstate = JOINABLE;
15831 }
15832 EOCP
15833         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15834         if eval $compile; then
15835                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15836                 val="$undef" # Yes, undef.
15837                 set d_old_pthread_create_joinable
15838                 eval $setvar
15839                 val=""
15840                 set old_pthread_create_joinable
15841                 eval $setvar
15842         else
15843                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15844                 if eval $compile; then
15845                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15846                         val="$define"
15847                         set d_old_pthread_create_joinable
15848                         eval $setvar
15849                         val=PTHREAD_CREATE_UNDETACHED
15850                         set old_pthread_create_joinable
15851                         eval $setvar
15852                 else
15853                         set try -DJOINABLE=__UNDETACHED
15854                         if eval $compile; then
15855                                 echo "You seem to use __UNDETACHED." >&4
15856                                 val="$define"
15857                                 set d_old_pthread_create_joinable
15858                                 eval $setvar
15859                                 val=__UNDETACHED
15860                                 set old_pthread_create_joinable
15861                                 eval $setvar
15862                         else
15863                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15864                                 val="$define"
15865                                 set d_old_pthread_create_joinable
15866                                 eval $setvar
15867                                 val=0
15868                                 set old_pthread_create_joinable
15869                                 eval $setvar
15870                         fi
15871                 fi
15872         fi
15873         $rm_try
15874 else
15875     d_old_pthread_create_joinable="$undef"
15876     old_pthread_create_joinable=""
15877 fi
15878
15879 : see if pause exists
15880 set pause d_pause
15881 eval $inlibc
15882
15883 : see if poll exists
15884 set poll d_poll
15885 eval $inlibc
15886
15887 : see if readlink exists
15888 set readlink d_readlink
15889 eval $inlibc
15890
15891 : Check if exe is symlink to abs path of executing program
15892 echo " "
15893 procselfexe=''
15894 val="$undef"
15895 case "$d_readlink" in
15896 "$define")
15897         if $issymlink /proc/self/exe ; then
15898                 $ls -l /proc/self/exe > reflect
15899                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15900                         echo "You have Linux-like /proc/self/exe."
15901                         procselfexe='"/proc/self/exe"'
15902                         val="$define"
15903                 fi
15904         fi
15905         if $issymlink /proc/curproc/file ; then
15906                 $ls -l /proc/curproc/file > reflect
15907                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15908                         echo "You have BSD-like /proc/curproc/file."
15909                         procselfexe='"/proc/curproc/file"'
15910                         val="$define"
15911                 fi
15912         fi
15913         ;;
15914 esac
15915 $rm -f reflect
15916 set d_procselfexe
15917 eval $setvar
15918
15919 : backward compatibility for d_hvfork
15920 if test X$d_hvfork != X; then
15921         d_vfork="$d_hvfork"
15922         d_hvfork=''
15923 fi
15924 : see if there is a vfork
15925 val=''
15926 set vfork val
15927 eval $inlibc
15928
15929 d_pseudofork=$undef
15930
15931 : Ok, but do we want to use it. vfork is reportedly unreliable in
15932 : perl on Solaris 2.x, and probably elsewhere.
15933 case "$val" in
15934 $define)
15935         echo " "
15936         case "$usevfork" in
15937         false) dflt='n';;
15938         *) dflt='y';;
15939         esac
15940         cat <<'EOM'
15941
15942 Perl can only use a vfork() that doesn't suffer from strict
15943 restrictions on calling functions or modifying global data in
15944 the child.  For example, glibc-2.1 contains such a vfork()
15945 that is unsuitable.  If your system provides a proper fork()
15946 call, chances are that you do NOT want perl to use vfork().
15947
15948 EOM
15949         rp="Do you still want to use vfork()?"
15950         . ./myread
15951         case "$ans" in
15952         y|Y) ;;
15953         *)
15954                 echo "Ok, we won't use vfork()."
15955                 val="$undef"
15956                 ;;
15957         esac
15958         ;;
15959 esac
15960 set d_vfork
15961 eval $setvar
15962 case "$d_vfork" in
15963 $define) usevfork='true';;
15964 *) usevfork='false';;
15965 esac
15966
15967 : see whether the pthread_atfork exists
15968 $cat >try.c <<EOP
15969 #include <pthread.h>
15970 #include <stdio.h>
15971 int main() {
15972 #ifdef  PTHREAD_ATFORK
15973         pthread_atfork(NULL,NULL,NULL);
15974 #endif
15975 }
15976 EOP
15977
15978 : see if pthread_atfork exists
15979 set try -DPTHREAD_ATFORK
15980 if eval $compile; then
15981     val="$define"
15982 else
15983     val="$undef"
15984 fi
15985 case "$usethreads" in
15986 $define)
15987         case "$val" in
15988         $define) echo 'pthread_atfork found.' >&4        ;;
15989         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15990         esac
15991 esac
15992 set d_pthread_atfork
15993 eval $setvar
15994
15995 : see if pthread_attr_setscope exists
15996 set pthread_attr_setscope d_pthread_attr_setscope
15997 eval $inlibc
15998
15999 : see whether the various POSIXish _yields exist
16000 $cat >try.c <<EOP
16001 #include <pthread.h>
16002 #include <stdio.h>
16003 int main() {
16004 #ifdef SCHED_YIELD
16005         sched_yield();
16006 #else
16007 #ifdef PTHREAD_YIELD
16008         pthread_yield();
16009 #else
16010 #ifdef PTHREAD_YIELD_NULL
16011         pthread_yield(NULL);
16012 #endif
16013 #endif
16014 #endif
16015 }
16016 EOP
16017 : see if sched_yield exists
16018 set try -DSCHED_YIELD
16019 if eval $compile; then
16020     val="$define"
16021     sched_yield='sched_yield()'
16022 else
16023     val="$undef"
16024 fi
16025 case "$usethreads" in
16026 $define)
16027         case "$val" in
16028         $define) echo 'sched_yield() found.' >&4        ;;
16029         *)       echo 'sched_yield() NOT found.' >&4    ;;
16030         esac
16031 esac
16032 set d_sched_yield
16033 eval $setvar
16034
16035 : see if pthread_yield exists
16036 set try -DPTHREAD_YIELD
16037 if eval $compile; then
16038     val="$define"
16039     case "$sched_yield" in
16040     '') sched_yield='pthread_yield()' ;;
16041     esac
16042 else
16043     set try -DPTHREAD_YIELD_NULL
16044     if eval $compile; then
16045         val="$define"
16046         case "$sched_yield" in
16047         '') sched_yield='pthread_yield(NULL)' ;;
16048         esac
16049     else
16050         val="$undef"
16051     fi
16052 fi
16053 case "$usethreads" in
16054 $define)
16055         case "$val" in
16056         $define) echo 'pthread_yield() found.' >&4      ;;
16057         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16058         esac
16059         ;;
16060 esac
16061 set d_pthread_yield
16062 eval $setvar
16063 case "$sched_yield" in
16064 '') sched_yield=undef ;;
16065 esac
16066 $rm_try
16067
16068 : see if random_r exists
16069 set random_r d_random_r
16070 eval $inlibc
16071 case "$d_random_r" in
16072 "$define")
16073         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16074         case "$d_random_r_proto:$usethreads" in
16075         ":define")      d_random_r_proto=define
16076                 set d_random_r_proto random_r $hdrs
16077                 eval $hasproto ;;
16078         *)      ;;
16079         esac
16080         case "$d_random_r_proto" in
16081         define)
16082         case "$random_r_proto" in
16083         ''|0) try='int random_r(int*, struct random_data*);'
16084         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16085         esac
16086         case "$random_r_proto" in
16087         ''|0) try='int random_r(long*, struct random_data*);'
16088         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16089         esac
16090         case "$random_r_proto" in
16091         ''|0) try='int random_r(struct random_data*, int32_t*);'
16092         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16093         esac
16094         case "$random_r_proto" in
16095         ''|0)   d_random_r=undef
16096                 random_r_proto=0
16097                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16098         * )     case "$random_r_proto" in
16099                 REENTRANT_PROTO*) ;;
16100                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16101                 esac
16102                 echo "Prototype: $try" ;;
16103         esac
16104         ;;
16105         *)      case "$usethreads" in
16106                 define) echo "random_r has no prototype, not using it." >&4 ;;
16107                 esac
16108                 d_random_r=undef
16109                 random_r_proto=0
16110                 ;;
16111         esac
16112         ;;
16113 *)      random_r_proto=0
16114         ;;
16115 esac
16116
16117 : see if readdir and friends exist
16118 set readdir d_readdir
16119 eval $inlibc
16120 set seekdir d_seekdir
16121 eval $inlibc
16122 set telldir d_telldir
16123 eval $inlibc
16124 set rewinddir d_rewinddir
16125 eval $inlibc
16126
16127 : see if readdir64_r exists
16128 set readdir64_r d_readdir64_r
16129 eval $inlibc
16130 case "$d_readdir64_r" in
16131 "$define")
16132         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16133         case "$d_readdir64_r_proto:$usethreads" in
16134         ":define")      d_readdir64_r_proto=define
16135                 set d_readdir64_r_proto readdir64_r $hdrs
16136                 eval $hasproto ;;
16137         *)      ;;
16138         esac
16139         case "$d_readdir64_r_proto" in
16140         define)
16141         case "$readdir64_r_proto" in
16142         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16143         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16144         esac
16145         case "$readdir64_r_proto" in
16146         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16147         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16148         esac
16149         case "$readdir64_r_proto" in
16150         ''|0)   d_readdir64_r=undef
16151                 readdir64_r_proto=0
16152                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16153         * )     case "$readdir64_r_proto" in
16154                 REENTRANT_PROTO*) ;;
16155                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16156                 esac
16157                 echo "Prototype: $try" ;;
16158         esac
16159         ;;
16160         *)      case "$usethreads" in
16161                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16162                 esac
16163                 d_readdir64_r=undef
16164                 readdir64_r_proto=0
16165                 ;;
16166         esac
16167         ;;
16168 *)      readdir64_r_proto=0
16169         ;;
16170 esac
16171
16172 : see if readdir_r exists
16173 set readdir_r d_readdir_r
16174 eval $inlibc
16175 case "$d_readdir_r" in
16176 "$define")
16177         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16178         case "$d_readdir_r_proto:$usethreads" in
16179         ":define")      d_readdir_r_proto=define
16180                 set d_readdir_r_proto readdir_r $hdrs
16181                 eval $hasproto ;;
16182         *)      ;;
16183         esac
16184         case "$d_readdir_r_proto" in
16185         define)
16186         case "$readdir_r_proto" in
16187         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16188         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16189         esac
16190         case "$readdir_r_proto" in
16191         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16192         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16193         esac
16194         case "$readdir_r_proto" in
16195         ''|0)   d_readdir_r=undef
16196                 readdir_r_proto=0
16197                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16198         * )     case "$readdir_r_proto" in
16199                 REENTRANT_PROTO*) ;;
16200                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16201                 esac
16202                 echo "Prototype: $try" ;;
16203         esac
16204         ;;
16205         *)      case "$usethreads" in
16206                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16207                 esac
16208                 d_readdir_r=undef
16209                 readdir_r_proto=0
16210                 ;;
16211         esac
16212         ;;
16213 *)      readdir_r_proto=0
16214         ;;
16215 esac
16216
16217 : see if readv exists
16218 set readv d_readv
16219 eval $inlibc
16220
16221 : see if recvmsg exists
16222 set recvmsg d_recvmsg
16223 eval $inlibc
16224
16225 : see if rename exists
16226 set rename d_rename
16227 eval $inlibc
16228
16229 : see if rmdir exists
16230 set rmdir d_rmdir
16231 eval $inlibc
16232
16233 : see if memory.h is available.
16234 val=''
16235 set memory.h val
16236 eval $inhdr
16237
16238 : See if it conflicts with string.h
16239 case "$val" in
16240 $define)
16241         case "$strings" in
16242         '') ;;
16243         *)
16244                 $cppstdin $cppflags $cppminus < $strings > mem.h
16245                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16246                         echo " "
16247                         echo "We won't be including <memory.h>."
16248                         val="$undef"
16249                 fi
16250                 $rm -f mem.h
16251                 ;;
16252         esac
16253 esac
16254 set i_memory
16255 eval $setvar
16256
16257 : can bcopy handle overlapping blocks?
16258 echo " "
16259 val="$undef"
16260 case "$d_memmove" in
16261 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16262 *)      case "$d_bcopy" in
16263         "$define")
16264                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16265                 $cat >try.c <<EOCP
16266 #$i_memory I_MEMORY
16267 #$i_stdlib I_STDLIB
16268 #$i_string I_STRING
16269 #$i_unistd I_UNISTD
16270 EOCP
16271         $cat >>try.c <<'EOCP'
16272 #include <stdio.h>
16273 #ifdef I_MEMORY
16274 #  include <memory.h>
16275 #endif
16276 #ifdef I_STDLIB
16277 #  include <stdlib.h>
16278 #endif
16279 #ifdef I_STRING
16280 #  include <string.h>
16281 #else
16282 #  include <strings.h>
16283 #endif
16284 #ifdef I_UNISTD
16285 #  include <unistd.h>  /* Needed for NetBSD */
16286 #endif
16287 int main()
16288 {
16289 char buf[128], abc[128];
16290 char *b;
16291 int len;
16292 int off;
16293 int align;
16294
16295 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16296    try to store the string in read-only memory. */
16297 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16298
16299 for (align = 7; align >= 0; align--) {
16300         for (len = 36; len; len--) {
16301                 b = buf+align;
16302                 bcopy(abc, b, len);
16303                 for (off = 1; off <= len; off++) {
16304                         bcopy(b, b+off, len);
16305                         bcopy(b+off, b, len);
16306                         if (bcmp(b, abc, len))
16307                                 exit(1);
16308                 }
16309         }
16310 }
16311 exit(0);
16312 }
16313 EOCP
16314                 set try
16315                 if eval $compile_ok; then
16316                         if $run ./try 2>/dev/null; then
16317                                 echo "Yes, it can."
16318                                 val="$define"
16319                         else
16320                                 echo "It can't, sorry."
16321                         fi
16322                 else
16323                         echo "(I can't compile the test program, so we'll assume not...)"
16324                 fi
16325                 ;;
16326         esac
16327         $rm_try
16328         ;;
16329 esac
16330 set d_safebcpy
16331 eval $setvar
16332
16333 : can memcpy handle overlapping blocks?
16334 echo " "
16335 val="$undef"
16336 case "$d_memmove" in
16337 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16338 *)      case "$d_memcpy" in
16339         "$define")
16340                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16341                 $cat >try.c <<EOCP
16342 #$i_memory I_MEMORY
16343 #$i_stdlib I_STDLIB
16344 #$i_string I_STRING
16345 #$i_unistd I_UNISTD
16346 EOCP
16347         $cat >>try.c <<'EOCP'
16348 #include <stdio.h>
16349 #ifdef I_MEMORY
16350 #  include <memory.h>
16351 #endif
16352 #ifdef I_STDLIB
16353 #  include <stdlib.h>
16354 #endif
16355 #ifdef I_STRING
16356 #  include <string.h>
16357 #else
16358 #  include <strings.h>
16359 #endif
16360 #ifdef I_UNISTD
16361 #  include <unistd.h>  /* Needed for NetBSD */
16362 #endif
16363 int main()
16364 {
16365 char buf[128], abc[128];
16366 char *b;
16367 int len;
16368 int off;
16369 int align;
16370
16371 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16372    try to store the string in read-only memory. */
16373 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16374
16375 for (align = 7; align >= 0; align--) {
16376         for (len = 36; len; len--) {
16377                 b = buf+align;
16378                 memcpy(b, abc, len);
16379                 for (off = 1; off <= len; off++) {
16380                         memcpy(b+off, b, len);
16381                         memcpy(b, b+off, len);
16382                         if (memcmp(b, abc, len))
16383                                 exit(1);
16384                 }
16385         }
16386 }
16387 exit(0);
16388 }
16389 EOCP
16390                 set try
16391                 if eval $compile_ok; then
16392                         if $run ./try 2>/dev/null; then
16393                                 echo "Yes, it can."
16394                                 val="$define"
16395                         else
16396                                 echo "It can't, sorry."
16397                         fi
16398                 else
16399                         echo "(I can't compile the test program, so we'll assume not...)"
16400                 fi
16401                 ;;
16402         esac
16403         $rm_try
16404         ;;
16405 esac
16406 set d_safemcpy
16407 eval $setvar
16408
16409 : can memcmp be trusted to compare relative magnitude?
16410 val="$undef"
16411 case "$d_memcmp" in
16412 "$define")
16413         echo " "
16414         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16415         $cat >try.c <<EOCP
16416 #$i_memory I_MEMORY
16417 #$i_stdlib I_STDLIB
16418 #$i_string I_STRING
16419 #$i_unistd I_UNISTD
16420 EOCP
16421         $cat >>try.c <<'EOCP'
16422 #include <stdio.h>
16423 #ifdef I_MEMORY
16424 #  include <memory.h>
16425 #endif
16426 #ifdef I_STDLIB
16427 #  include <stdlib.h>
16428 #endif
16429 #ifdef I_STRING
16430 #  include <string.h>
16431 #else
16432 #  include <strings.h>
16433 #endif
16434 #ifdef I_UNISTD
16435 #  include <unistd.h>  /* Needed for NetBSD */
16436 #endif
16437 int main()
16438 {
16439 char a = -1;
16440 char b = 0;
16441 if ((a < b) && memcmp(&a, &b, 1) < 0)
16442         exit(1);
16443 exit(0);
16444 }
16445 EOCP
16446         set try
16447         if eval $compile_ok; then
16448                 if $run ./try 2>/dev/null; then
16449                         echo "Yes, it can."
16450                         val="$define"
16451                 else
16452                         echo "No, it can't (it uses signed chars)."
16453                 fi
16454         else
16455                 echo "(I can't compile the test program, so we'll assume not...)"
16456         fi
16457         ;;
16458 esac
16459 $rm_try
16460 set d_sanemcmp
16461 eval $setvar
16462
16463 : see if prototype for sbrk is available
16464 echo " "
16465 set d_sbrkproto sbrk $i_unistd unistd.h
16466 eval $hasproto
16467
16468 : see if select exists
16469 set select d_select
16470 eval $inlibc
16471
16472 : see if semctl exists
16473 set semctl d_semctl
16474 eval $inlibc
16475
16476 : see if semget exists
16477 set semget d_semget
16478 eval $inlibc
16479
16480 : see if semop exists
16481 set semop d_semop
16482 eval $inlibc
16483
16484 : see how much of the 'sem*(2)' library is present.
16485 h_sem=true
16486 echo " "
16487 case "$d_semctl$d_semget$d_semop" in
16488 *"$undef"*) h_sem=false;;
16489 esac
16490 case "$osname" in
16491 freebsd)
16492     case "`ipcs 2>&1`" in
16493     "SVID messages"*"not configured"*)
16494         echo "Your $osname does not have the sem*(2) configured." >&4
16495         h_sem=false
16496         val="$undef"
16497         set semctl d_semctl
16498         eval $setvar
16499         set semget d_semget
16500         eval $setvar
16501         set semop d_semop
16502         eval $setvar
16503         ;;
16504     esac
16505     ;;
16506 esac
16507 : we could also check for sys/ipc.h ...
16508 if $h_sem && $test `./findhdr sys/sem.h`; then
16509         echo "You have the full sem*(2) library." >&4
16510         val="$define"
16511 else
16512         echo "You don't have the full sem*(2) library." >&4
16513         val="$undef"
16514 fi
16515 set d_sem
16516 eval $setvar
16517
16518 : see whether sys/sem.h defines union semun
16519 echo " "
16520 $cat > try.c <<'END'
16521 #include <sys/types.h>
16522 #include <sys/ipc.h>
16523 #include <sys/sem.h>
16524 int main () { union semun semun; semun.buf = 0; }
16525 END
16526 set try
16527 if eval $compile; then
16528     echo "You have union semun in <sys/sem.h>." >&4
16529     val="$define"
16530 else
16531     echo "You do not have union semun in <sys/sem.h>." >&4
16532     val="$undef"
16533 fi
16534 $rm_try
16535 set d_union_semun
16536 eval $setvar
16537
16538 : see how to do semctl IPC_STAT
16539 case "$d_sem" in
16540 $define)
16541     echo " "
16542     $cat > tryh.h <<END
16543 #ifndef S_IRUSR
16544 #   ifdef S_IREAD
16545 #       define S_IRUSR S_IREAD
16546 #       define S_IWUSR S_IWRITE
16547 #       define S_IXUSR S_IEXEC
16548 #   else
16549 #       define S_IRUSR 0400
16550 #       define S_IWUSR 0200
16551 #       define S_IXUSR 0100
16552 #   endif
16553 #   define S_IRGRP (S_IRUSR>>3)
16554 #   define S_IWGRP (S_IWUSR>>3)
16555 #   define S_IXGRP (S_IXUSR>>3)
16556 #   define S_IROTH (S_IRUSR>>6)
16557 #   define S_IWOTH (S_IWUSR>>6)
16558 #   define S_IXOTH (S_IXUSR>>6)
16559 #endif
16560 #ifndef S_IRWXU
16561 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16562 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16563 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16564 #endif
16565 END
16566     : see whether semctl IPC_STAT can use union semun
16567     case "$d_semctl_semun" in
16568     '')
16569       val="$undef"
16570       $cat > try.c <<END
16571 #include <sys/types.h>
16572 #include <sys/ipc.h>
16573 #include <sys/sem.h>
16574 #include <sys/stat.h>
16575 #include <stdio.h>
16576 #include <errno.h>
16577 #include "tryh.h"
16578 #ifndef errno
16579 extern int errno;
16580 #endif
16581 #$d_union_semun HAS_UNION_SEMUN
16582 int main() {
16583     union semun
16584 #ifndef HAS_UNION_SEMUN
16585     {
16586         int val;
16587         struct semid_ds *buf;
16588         unsigned short *array;
16589     }
16590 #endif
16591     arg;
16592     int sem, st;
16593
16594 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16595     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16596     if (sem > -1) {
16597         struct semid_ds argbuf;
16598         arg.buf = &argbuf;
16599 #       ifdef IPC_STAT
16600         st = semctl(sem, 0, IPC_STAT, arg);
16601         if (st == 0)
16602             printf("semun\n");
16603         else
16604 #       endif /* IPC_STAT */
16605             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16606 #       ifdef IPC_RMID
16607         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16608 #       endif /* IPC_RMID */
16609             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16610     } else
16611 #endif /* IPC_PRIVATE && ... */
16612         printf("semget failed: errno = %d\n", errno);
16613   return 0;
16614 }
16615 END
16616       set try
16617       if eval $compile; then
16618           xxx=`$run ./try`
16619           case "$xxx" in
16620           semun) val="$define" ;;
16621           esac
16622       fi
16623       $rm_try
16624       set d_semctl_semun
16625       eval $setvar
16626       ;;
16627     esac
16628     case "$d_semctl_semun" in
16629     $define)
16630         echo "You can use union semun for semctl IPC_STAT." >&4
16631         also='also'
16632         ;;
16633     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16634         also=''
16635         ;;
16636     esac
16637
16638     : see whether semctl IPC_STAT can use struct semid_ds pointer
16639     case "$d_semctl_semid_ds" in
16640     '')
16641       val="$undef"
16642       $cat > try.c <<'END'
16643 #include <sys/types.h>
16644 #include <sys/ipc.h>
16645 #include <sys/sem.h>
16646 #include <sys/stat.h>
16647 #include "tryh.h"
16648 #include <stdio.h>
16649 #include <errno.h>
16650 #ifndef errno
16651 extern int errno;
16652 #endif
16653 int main() {
16654     struct semid_ds arg;
16655     int sem, st;
16656
16657 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16658     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16659     if (sem > -1) {
16660 #       ifdef IPC_STAT
16661         st = semctl(sem, 0, IPC_STAT, &arg);
16662         if (st == 0)
16663             printf("semid_ds\n");
16664         else
16665 #       endif /* IPC_STAT */
16666             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16667 #       ifdef IPC_RMID
16668         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16669 #       endif /* IPC_RMID */
16670             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16671     } else
16672 #endif /* IPC_PRIVATE && ... */
16673         printf("semget failed: errno = %d\n", errno);
16674
16675     return 0;
16676 }
16677 END
16678       set try
16679       if eval $compile; then
16680           xxx=`$run ./try`
16681           case "$xxx" in
16682           semid_ds) val="$define" ;;
16683           esac
16684       fi
16685       $rm_try
16686       set d_semctl_semid_ds
16687       eval $setvar
16688       ;;
16689     esac
16690     case "$d_semctl_semid_ds" in
16691     $define)
16692         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16693         ;;
16694     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16695         ;;
16696     esac
16697     ;;
16698 *)  val="$undef"
16699
16700     # We do not have the full sem*(2) library, so assume we can not
16701     # use either.
16702
16703     set d_semctl_semun
16704     eval $setvar
16705
16706     set d_semctl_semid_ds
16707     eval $setvar
16708     ;;
16709 esac
16710 $rm_try tryh.h
16711
16712 : see if sendmsg exists
16713 set sendmsg d_sendmsg
16714 eval $inlibc
16715
16716 : see if setegid exists
16717 set setegid d_setegid
16718 eval $inlibc
16719
16720 : see if seteuid exists
16721 set seteuid d_seteuid
16722 eval $inlibc
16723
16724 : see if setgrent exists
16725 set setgrent d_setgrent
16726 eval $inlibc
16727
16728 : see if setgrent_r exists
16729 set setgrent_r d_setgrent_r
16730 eval $inlibc
16731 case "$d_setgrent_r" in
16732 "$define")
16733         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16734         case "$d_setgrent_r_proto:$usethreads" in
16735         ":define")      d_setgrent_r_proto=define
16736                 set d_setgrent_r_proto setgrent_r $hdrs
16737                 eval $hasproto ;;
16738         *)      ;;
16739         esac
16740         case "$d_setgrent_r_proto" in
16741         define)
16742         case "$setgrent_r_proto" in
16743         ''|0) try='int setgrent_r(FILE**);'
16744         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
16745         esac
16746         case "$setgrent_r_proto" in
16747         ''|0) try='void setgrent_r(FILE**);'
16748         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
16749         esac
16750         case "$setgrent_r_proto" in
16751         ''|0)   d_setgrent_r=undef
16752                 setgrent_r_proto=0
16753                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16754         * )     case "$setgrent_r_proto" in
16755                 REENTRANT_PROTO*) ;;
16756                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16757                 esac
16758                 echo "Prototype: $try" ;;
16759         esac
16760         ;;
16761         *)      case "$usethreads" in
16762                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16763                 esac
16764                 d_setgrent_r=undef
16765                 setgrent_r_proto=0
16766                 ;;
16767         esac
16768         ;;
16769 *)      setgrent_r_proto=0
16770         ;;
16771 esac
16772
16773 : see if sethostent exists
16774 set sethostent d_sethent
16775 eval $inlibc
16776
16777 : see if sethostent_r exists
16778 set sethostent_r d_sethostent_r
16779 eval $inlibc
16780 case "$d_sethostent_r" in
16781 "$define")
16782         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16783         case "$d_sethostent_r_proto:$usethreads" in
16784         ":define")      d_sethostent_r_proto=define
16785                 set d_sethostent_r_proto sethostent_r $hdrs
16786                 eval $hasproto ;;
16787         *)      ;;
16788         esac
16789         case "$d_sethostent_r_proto" in
16790         define)
16791         case "$sethostent_r_proto" in
16792         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16793         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
16794         esac
16795         case "$sethostent_r_proto" in
16796         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16797         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
16798         esac
16799         case "$sethostent_r_proto" in
16800         ''|0)   d_sethostent_r=undef
16801                 sethostent_r_proto=0
16802                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16803         * )     case "$sethostent_r_proto" in
16804                 REENTRANT_PROTO*) ;;
16805                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16806                 esac
16807                 echo "Prototype: $try" ;;
16808         esac
16809         ;;
16810         *)      case "$usethreads" in
16811                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16812                 esac
16813                 d_sethostent_r=undef
16814                 sethostent_r_proto=0
16815                 ;;
16816         esac
16817         ;;
16818 *)      sethostent_r_proto=0
16819         ;;
16820 esac
16821
16822 : see if setitimer exists
16823 set setitimer d_setitimer
16824 eval $inlibc
16825
16826 : see if setlinebuf exists
16827 set setlinebuf d_setlinebuf
16828 eval $inlibc
16829
16830 : see if setlocale exists
16831 set setlocale d_setlocale
16832 eval $inlibc
16833
16834 : see if locale.h is available
16835 set locale.h i_locale
16836 eval $inhdr
16837
16838 : see if setlocale_r exists
16839 set setlocale_r d_setlocale_r
16840 eval $inlibc
16841 case "$d_setlocale_r" in
16842 "$define")
16843         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16844         case "$d_setlocale_r_proto:$usethreads" in
16845         ":define")      d_setlocale_r_proto=define
16846                 set d_setlocale_r_proto setlocale_r $hdrs
16847                 eval $hasproto ;;
16848         *)      ;;
16849         esac
16850         case "$d_setlocale_r_proto" in
16851         define)
16852         case "$setlocale_r_proto" in
16853         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16854         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16855         esac
16856         case "$setlocale_r_proto" in
16857         ''|0)   d_setlocale_r=undef
16858                 setlocale_r_proto=0
16859                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16860         * )     case "$setlocale_r_proto" in
16861                 REENTRANT_PROTO*) ;;
16862                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16863                 esac
16864                 echo "Prototype: $try" ;;
16865         esac
16866         ;;
16867         *)      case "$usethreads" in
16868                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16869                 esac
16870                 d_setlocale_r=undef
16871                 setlocale_r_proto=0
16872                 ;;
16873         esac
16874         ;;
16875 *)      setlocale_r_proto=0
16876         ;;
16877 esac
16878
16879 : see if setnetent exists
16880 set setnetent d_setnent
16881 eval $inlibc
16882
16883 : see if setnetent_r exists
16884 set setnetent_r d_setnetent_r
16885 eval $inlibc
16886 case "$d_setnetent_r" in
16887 "$define")
16888         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16889         case "$d_setnetent_r_proto:$usethreads" in
16890         ":define")      d_setnetent_r_proto=define
16891                 set d_setnetent_r_proto setnetent_r $hdrs
16892                 eval $hasproto ;;
16893         *)      ;;
16894         esac
16895         case "$d_setnetent_r_proto" in
16896         define)
16897         case "$setnetent_r_proto" in
16898         ''|0) try='int setnetent_r(int, struct netent_data*);'
16899         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
16900         esac
16901         case "$setnetent_r_proto" in
16902         ''|0) try='void setnetent_r(int, struct netent_data*);'
16903         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
16904         esac
16905         case "$setnetent_r_proto" in
16906         ''|0)   d_setnetent_r=undef
16907                 setnetent_r_proto=0
16908                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16909         * )     case "$setnetent_r_proto" in
16910                 REENTRANT_PROTO*) ;;
16911                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16912                 esac
16913                 echo "Prototype: $try" ;;
16914         esac
16915         ;;
16916         *)      case "$usethreads" in
16917                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16918                 esac
16919                 d_setnetent_r=undef
16920                 setnetent_r_proto=0
16921                 ;;
16922         esac
16923         ;;
16924 *)      setnetent_r_proto=0
16925         ;;
16926 esac
16927
16928 : see if setprotoent exists
16929 set setprotoent d_setpent
16930 eval $inlibc
16931
16932 : see if setpgid exists
16933 set setpgid d_setpgid
16934 eval $inlibc
16935
16936 : see if setpgrp2 exists
16937 set setpgrp2 d_setpgrp2
16938 eval $inlibc
16939
16940 : see if setpriority exists
16941 set setpriority d_setprior
16942 eval $inlibc
16943
16944 : see if setproctitle exists
16945 set setproctitle d_setproctitle
16946 eval $inlibc
16947
16948 : see if setprotoent_r exists
16949 set setprotoent_r d_setprotoent_r
16950 eval $inlibc
16951 case "$d_setprotoent_r" in
16952 "$define")
16953         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16954         case "$d_setprotoent_r_proto:$usethreads" in
16955         ":define")      d_setprotoent_r_proto=define
16956                 set d_setprotoent_r_proto setprotoent_r $hdrs
16957                 eval $hasproto ;;
16958         *)      ;;
16959         esac
16960         case "$d_setprotoent_r_proto" in
16961         define)
16962         case "$setprotoent_r_proto" in
16963         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16964         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
16965         esac
16966         case "$setprotoent_r_proto" in
16967         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16968         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
16969         esac
16970         case "$setprotoent_r_proto" in
16971         ''|0)   d_setprotoent_r=undef
16972                 setprotoent_r_proto=0
16973                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16974         * )     case "$setprotoent_r_proto" in
16975                 REENTRANT_PROTO*) ;;
16976                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16977                 esac
16978                 echo "Prototype: $try" ;;
16979         esac
16980         ;;
16981         *)      case "$usethreads" in
16982                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16983                 esac
16984                 d_setprotoent_r=undef
16985                 setprotoent_r_proto=0
16986                 ;;
16987         esac
16988         ;;
16989 *)      setprotoent_r_proto=0
16990         ;;
16991 esac
16992
16993 : see if setpwent exists
16994 set setpwent d_setpwent
16995 eval $inlibc
16996
16997 : see if setpwent_r exists
16998 set setpwent_r d_setpwent_r
16999 eval $inlibc
17000 case "$d_setpwent_r" in
17001 "$define")
17002         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17003         case "$d_setpwent_r_proto:$usethreads" in
17004         ":define")      d_setpwent_r_proto=define
17005                 set d_setpwent_r_proto setpwent_r $hdrs
17006                 eval $hasproto ;;
17007         *)      ;;
17008         esac
17009         case "$d_setpwent_r_proto" in
17010         define)
17011         case "$setpwent_r_proto" in
17012         ''|0) try='int setpwent_r(FILE**);'
17013         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17014         esac
17015         case "$setpwent_r_proto" in
17016         ''|0) try='void setpwent_r(FILE**);'
17017         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17018         esac
17019         case "$setpwent_r_proto" in
17020         ''|0)   d_setpwent_r=undef
17021                 setpwent_r_proto=0
17022                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17023         * )     case "$setpwent_r_proto" in
17024                 REENTRANT_PROTO*) ;;
17025                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17026                 esac
17027                 echo "Prototype: $try" ;;
17028         esac
17029         ;;
17030         *)      case "$usethreads" in
17031                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17032                 esac
17033                 d_setpwent_r=undef
17034                 setpwent_r_proto=0
17035                 ;;
17036         esac
17037         ;;
17038 *)      setpwent_r_proto=0
17039         ;;
17040 esac
17041
17042 : see if setregid exists
17043 set setregid d_setregid
17044 eval $inlibc
17045 set setresgid d_setresgid
17046 eval $inlibc
17047
17048 : see if setreuid exists
17049 set setreuid d_setreuid
17050 eval $inlibc
17051 set setresuid d_setresuid
17052 eval $inlibc
17053
17054 : see if setrgid exists
17055 set setrgid d_setrgid
17056 eval $inlibc
17057
17058 : see if setruid exists
17059 set setruid d_setruid
17060 eval $inlibc
17061
17062 : see if setservent exists
17063 set setservent d_setsent
17064 eval $inlibc
17065
17066 : see if setservent_r exists
17067 set setservent_r d_setservent_r
17068 eval $inlibc
17069 case "$d_setservent_r" in
17070 "$define")
17071         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17072         case "$d_setservent_r_proto:$usethreads" in
17073         ":define")      d_setservent_r_proto=define
17074                 set d_setservent_r_proto setservent_r $hdrs
17075                 eval $hasproto ;;
17076         *)      ;;
17077         esac
17078         case "$d_setservent_r_proto" in
17079         define)
17080         case "$setservent_r_proto" in
17081         ''|0) try='int setservent_r(int, struct servent_data*);'
17082         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17083         esac
17084         case "$setservent_r_proto" in
17085         ''|0) try='void setservent_r(int, struct servent_data*);'
17086         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17087         esac
17088         case "$setservent_r_proto" in
17089         ''|0)   d_setservent_r=undef
17090                 setservent_r_proto=0
17091                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17092         * )     case "$setservent_r_proto" in
17093                 REENTRANT_PROTO*) ;;
17094                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17095                 esac
17096                 echo "Prototype: $try" ;;
17097         esac
17098         ;;
17099         *)      case "$usethreads" in
17100                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17101                 esac
17102                 d_setservent_r=undef
17103                 setservent_r_proto=0
17104                 ;;
17105         esac
17106         ;;
17107 *)      setservent_r_proto=0
17108         ;;
17109 esac
17110
17111 : see if setsid exists
17112 set setsid d_setsid
17113 eval $inlibc
17114
17115 : see if setvbuf exists
17116 set setvbuf d_setvbuf
17117 eval $inlibc
17118
17119 : see if sfio.h is available
17120 set sfio.h i_sfio
17121 eval $inhdr
17122
17123 : see if sfio library is available
17124 case "$i_sfio" in
17125 $define)
17126         val=''
17127         set sfreserve val
17128         eval $inlibc
17129         ;;
17130 *)
17131         val="$undef"
17132         ;;
17133 esac
17134 : Ok, but do we want to use it.
17135 case "$val" in
17136 $define)
17137         case "$usesfio" in
17138         true|$define|[yY]*) dflt='y';;
17139         *) dflt='n';;
17140         esac
17141         echo "$package can use the sfio library, but it is experimental."
17142         case "$useperlio" in
17143         "$undef")
17144             echo "For sfio also the PerlIO abstraction layer is needed."
17145             echo "Earlier you said you wouldn't want that."
17146             ;;
17147         esac
17148         rp="You seem to have sfio available, do you want to try using it?"
17149         . ./myread
17150         case "$ans" in
17151         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17152                 useperlio="$define"
17153                 val="$define"
17154                 ;;
17155         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17156                 val="$undef"
17157                 ;;
17158         esac
17159         ;;
17160 *)      case "$usesfio" in
17161         true|$define|[yY]*)
17162                 echo "Sorry, cannot find sfio on this machine." >&4
17163                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17164                 val="$undef"
17165                 ;;
17166         esac
17167         ;;
17168 esac
17169 set d_sfio
17170 eval $setvar
17171 case "$d_sfio" in
17172 $define) usesfio='true';;
17173 *) usesfio='false';;
17174 esac
17175 case "$d_sfio" in
17176 $define) ;;
17177 *)      : Remove sfio from list of libraries to use
17178         case "$libs" in
17179         *-lsfio*)
17180                 echo "Removing unneeded -lsfio from library list" >&4
17181                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17182                 shift
17183                 libs="$*"
17184                 echo "libs = $libs" >&4
17185                 ;;
17186         esac
17187 ;;
17188 esac
17189
17190
17191 : see if shmctl exists
17192 set shmctl d_shmctl
17193 eval $inlibc
17194
17195 : see if shmget exists
17196 set shmget d_shmget
17197 eval $inlibc
17198
17199 : see if shmat exists
17200 set shmat d_shmat
17201 eval $inlibc
17202 : see what shmat returns
17203 case "$d_shmat" in
17204 "$define")
17205         $cat >shmat.c <<'END'
17206 #include <sys/shm.h>
17207 void *shmat();
17208 END
17209         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17210                 shmattype='void *'
17211         else
17212                 shmattype='char *'
17213         fi
17214         echo "and it returns ($shmattype)." >&4
17215         : see if a prototype for shmat is available
17216         xxx=`./findhdr sys/shm.h`
17217         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17218         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17219                 val="$define"
17220         else
17221                 val="$undef"
17222         fi
17223         $rm -f shmat.[co]
17224         ;;
17225 *)
17226         val="$undef"
17227         ;;
17228 esac
17229 set d_shmatprototype
17230 eval $setvar
17231
17232 : see if shmdt exists
17233 set shmdt d_shmdt
17234 eval $inlibc
17235
17236 : see how much of the 'shm*(2)' library is present.
17237 h_shm=true
17238 echo " "
17239 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17240 *"$undef"*) h_shm=false;;
17241 esac
17242 case "$osname" in
17243 freebsd)
17244     case "`ipcs 2>&1`" in
17245     "SVID shared memory"*"not configured"*)
17246         echo "Your $osname does not have the shm*(2) configured." >&4
17247         h_shm=false
17248         val="$undef"
17249         set shmctl d_shmctl
17250         evat $setvar
17251         set shmget d_shmget
17252         evat $setvar
17253         set shmat d_shmat
17254         evat $setvar
17255         set shmdt d_shmdt
17256         evat $setvar
17257         ;;
17258     esac
17259     ;;
17260 esac
17261 : we could also check for sys/ipc.h ...
17262 if $h_shm && $test `./findhdr sys/shm.h`; then
17263         echo "You have the full shm*(2) library." >&4
17264         val="$define"
17265 else
17266         echo "You don't have the full shm*(2) library." >&4
17267         val="$undef"
17268 fi
17269 set d_shm
17270 eval $setvar
17271
17272 : see if we have sigaction
17273 echo " "
17274 if set sigaction val -f d_sigaction; eval $csym; $val; then
17275         echo 'sigaction() found.' >&4
17276         $cat > try.c <<EOP
17277 #include <stdio.h>
17278 #include <sys/types.h>
17279 #include <signal.h>
17280 #$i_stdlib I_STDLIB
17281 #ifdef I_STDLIB
17282 #include <stdlib.h>
17283 #endif
17284 int main()
17285 {
17286     struct sigaction act, oact;
17287     act.sa_flags = 0;
17288     oact.sa_handler = 0;
17289     /* so that act and oact are used */
17290     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17291 }
17292 EOP
17293         set try
17294         if eval $compile_ok; then
17295                 val="$define"
17296         else
17297                 echo "But you don't seem to have a useable struct sigaction." >&4
17298                 val="$undef"
17299         fi
17300 else
17301         echo 'sigaction NOT found.' >&4
17302         val="$undef"
17303 fi
17304 set d_sigaction; eval $setvar
17305 $rm_try
17306
17307 : see if this is a sunmath.h system
17308 set sunmath.h i_sunmath
17309 eval $inhdr
17310
17311 : see if signbit exists
17312 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17313 $cat >try.c <<EOCP
17314 #$i_math I_MATH
17315 #$i_sunmath I_SUNMATH
17316 #ifdef I_MATH
17317 #  include <math.h>
17318 #endif
17319 #ifdef I_SUNMATH  /* Solaris special math library */
17320 #  include <sunmath.h>
17321 #endif
17322 #define NV $nvtype
17323 int main(int argc, char **argv)
17324 {
17325     NV x = 0.0;
17326     NV y = -0.0;
17327     if ((signbit(x) == 0) && (signbit(y) != 0))
17328         return 0;
17329     else
17330         return 1;
17331 }
17332 EOCP
17333 val="$undef"
17334 set try
17335 if eval $compile; then
17336     if $run ./try; then
17337         $echo "Yes." >&4
17338         val="$define"
17339     else
17340         $echo "Signbit seems to be available, but doesn't work as I expected."
17341         $echo "I won't use it." >&4
17342         val="$undef"
17343     fi
17344 else
17345     $echo "Nope." >&4
17346     dflt="$undef"
17347 fi
17348 set d_signbit
17349 eval $setvar
17350 $rm_try
17351
17352 : see if sigprocmask exists
17353 set sigprocmask d_sigprocmask
17354 eval $inlibc
17355
17356 : see if sigsetjmp exists
17357 echo " "
17358 case "$d_sigsetjmp" in
17359 '')
17360         $cat >try.c <<EOP
17361 #include <setjmp.h>
17362 #$i_stdlib I_STDLIB
17363 #ifdef I_STDLIB
17364 #include <stdlib.h>
17365 #endif
17366 sigjmp_buf env;
17367 int set = 1;
17368 int main()
17369 {
17370         if (sigsetjmp(env,1))
17371                 exit(set);
17372         set = 0;
17373         siglongjmp(env, 1);
17374         exit(1);
17375 }
17376 EOP
17377         set try
17378         if eval $compile; then
17379                 if $run ./try >/dev/null 2>&1; then
17380                         echo "POSIX sigsetjmp found." >&4
17381                         val="$define"
17382                 else
17383                         $cat >&4 <<EOM
17384 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17385 I'll ignore them.
17386 EOM
17387                         val="$undef"
17388                 fi
17389         else
17390                 echo "sigsetjmp not found." >&4
17391                 val="$undef"
17392         fi
17393         ;;
17394 *) val="$d_sigsetjmp"
17395         case "$d_sigsetjmp" in
17396         $define) echo "POSIX sigsetjmp found." >&4;;
17397         $undef) echo "sigsetjmp not found." >&4;;
17398         esac
17399         ;;
17400 esac
17401 set d_sigsetjmp
17402 eval $setvar
17403 $rm_try
17404
17405 : see if snprintf exists
17406 set snprintf d_snprintf
17407 eval $inlibc
17408
17409 : see if vsnprintf exists
17410 set vsnprintf d_vsnprintf
17411 eval $inlibc
17412
17413 case "$d_snprintf-$d_vsnprintf" in
17414 "$define-$define")
17415     $cat <<EOM
17416 Checking whether your snprintf() and vsnprintf() work okay...
17417 EOM
17418     $cat >try.c <<'EOCP'
17419 /* v?snprintf testing logic courtesy of Russ Allbery.
17420  * According to C99:
17421  * - if the buffer is too short it still must be \0-terminated
17422  * - if the buffer is too short the potentially required length
17423  *   must be returned and not -1
17424  * - if the buffer is NULL the potentially required length
17425  *   must be returned and not -1 or core dump
17426  */
17427 #include <stdio.h>
17428 #include <stdarg.h>
17429
17430 char buf[2];
17431
17432 int test (char *format, ...)
17433 {
17434     va_list args;
17435     int count;
17436
17437     va_start (args, format);
17438     count = vsnprintf (buf, sizeof buf, format, args);
17439     va_end (args);
17440     return count;
17441 }
17442
17443 int main ()
17444 {
17445     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17446              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17447 }
17448 EOCP
17449     set try
17450     if eval $compile; then
17451         `$run ./try`
17452         case "$?" in
17453         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17454         *) cat <<EOM >&4
17455 Your snprintf() and snprintf() don't seem to be working okay.
17456 EOM
17457            d_snprintf="$undef"
17458            d_vsnprintf="$undef"
17459            ;;
17460         esac
17461     else
17462         echo "(I can't seem to compile the test program--assuming they don't)"
17463         d_snprintf="$undef"
17464         d_vsnprintf="$undef"
17465     fi
17466     $rm_try
17467     ;;
17468 esac
17469
17470 : see if sockatmark exists
17471 set sockatmark d_sockatmark
17472 eval $inlibc
17473
17474 : see if prototype for sockatmark is available
17475 echo " "
17476 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17477 eval $hasproto
17478
17479 : see if socks5_init exists
17480 set socks5_init d_socks5_init
17481 eval $inlibc
17482
17483 : see if sprintf returns the length of the string in the buffer as per ANSI
17484 $echo "Checking whether sprintf returns the length of the string..." >&4
17485 $cat <<EOP >try.c
17486 #include <stdio.h>
17487 #$i_stdlib I_STDLIB
17488 #ifdef I_STDLIB
17489 #include <stdlib.h>
17490 #endif
17491 #$i_string I_STRING
17492 #ifdef I_STRING
17493 #  include <string.h>
17494 #else
17495 #  include <strings.h>
17496 #endif
17497 #$i_math I_MATH
17498 #ifdef I_MATH
17499 #include <math.h>
17500 #endif
17501
17502 char buffer[256];
17503
17504 int check (size_t expect, int test) {
17505   size_t got = strlen(buffer);
17506   if (expect == got)
17507     return 0;
17508
17509   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17510        test, buffer);
17511   exit (test);
17512 }
17513
17514 int main(int argc, char **argv) {
17515   int test = 0;
17516
17517   check(sprintf(buffer, ""), ++test);
17518   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17519   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17520
17521   return 0;
17522 }
17523 EOP
17524 set try
17525
17526 if eval $compile; then
17527     xxx="`$run ./try`"
17528     case "$?" in
17529         0) cat >&4 <<EOM
17530 sprintf returns the length of the string (as ANSI says it should)
17531 EOM
17532         d_sprintf_returns_strlen="$define"
17533         ;;
17534         *) cat >&4 <<EOM
17535 sprintf does not return the length of the string (how old is this system?)
17536 EOM
17537         d_sprintf_returns_strlen="$undef"
17538         ;;
17539     esac
17540 else
17541     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17542     d_sprintf_returns_strlen="$undef"
17543 fi
17544 $rm_try
17545
17546 : see if srand48_r exists
17547 set srand48_r d_srand48_r
17548 eval $inlibc
17549 case "$d_srand48_r" in
17550 "$define")
17551         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17552         case "$d_srand48_r_proto:$usethreads" in
17553         ":define")      d_srand48_r_proto=define
17554                 set d_srand48_r_proto srand48_r $hdrs
17555                 eval $hasproto ;;
17556         *)      ;;
17557         esac
17558         case "$d_srand48_r_proto" in
17559         define)
17560         case "$srand48_r_proto" in
17561         ''|0) try='int srand48_r(long, struct drand48_data*);'
17562         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17563         esac
17564         case "$srand48_r_proto" in
17565         ''|0)   d_srand48_r=undef
17566                 srand48_r_proto=0
17567                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17568         * )     case "$srand48_r_proto" in
17569                 REENTRANT_PROTO*) ;;
17570                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17571                 esac
17572                 echo "Prototype: $try" ;;
17573         esac
17574         ;;
17575         *)      case "$usethreads" in
17576                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17577                 esac
17578                 d_srand48_r=undef
17579                 srand48_r_proto=0
17580                 ;;
17581         esac
17582         ;;
17583 *)      srand48_r_proto=0
17584         ;;
17585 esac
17586
17587 : see if srandom_r exists
17588 set srandom_r d_srandom_r
17589 eval $inlibc
17590 case "$d_srandom_r" in
17591 "$define")
17592         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17593         case "$d_srandom_r_proto:$usethreads" in
17594         ":define")      d_srandom_r_proto=define
17595                 set d_srandom_r_proto srandom_r $hdrs
17596                 eval $hasproto ;;
17597         *)      ;;
17598         esac
17599         case "$d_srandom_r_proto" in
17600         define)
17601         case "$srandom_r_proto" in
17602         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17603         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17604         esac
17605         case "$srandom_r_proto" in
17606         ''|0)   d_srandom_r=undef
17607                 srandom_r_proto=0
17608                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17609         * )     case "$srandom_r_proto" in
17610                 REENTRANT_PROTO*) ;;
17611                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17612                 esac
17613                 echo "Prototype: $try" ;;
17614         esac
17615         ;;
17616         *)      case "$usethreads" in
17617                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17618                 esac
17619                 d_srandom_r=undef
17620                 srandom_r_proto=0
17621                 ;;
17622         esac
17623         ;;
17624 *)      srandom_r_proto=0
17625         ;;
17626 esac
17627
17628 : see if prototype for setresgid is available
17629 echo " "
17630 set d_sresgproto setresgid $i_unistd unistd.h
17631 eval $hasproto
17632
17633 : see if prototype for setresuid is available
17634 echo " "
17635 set d_sresuproto setresuid $i_unistd unistd.h
17636 eval $hasproto
17637
17638 : see if sys/stat.h is available
17639 set sys/stat.h i_sysstat
17640 eval $inhdr
17641
17642 : see if stat knows about block sizes
17643 echo " "
17644 echo "Checking to see if your struct stat has st_blocks field..." >&4
17645 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17646 eval $hasfield
17647
17648 : see if this is a sys/vfs.h system
17649 set sys/vfs.h i_sysvfs
17650 eval $inhdr
17651
17652 : see if this is a sys/statfs.h system
17653 set sys/statfs.h i_sysstatfs
17654 eval $inhdr
17655
17656 : Check for statfs_s
17657 echo " "
17658 echo "Checking to see if your system supports struct statfs..." >&4
17659 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
17660 eval $hasstruct
17661 case "$d_statfs_s" in
17662 "$define")      echo "Yes, it does."   ;;
17663 *)              echo "No, it doesn't." ;;
17664 esac
17665
17666
17667 : see if struct statfs knows about f_flags
17668 case "$d_statfs_s" in
17669 define)
17670         echo " "
17671         echo "Checking to see if your struct statfs has f_flags field..." >&4
17672         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
17673         eval $hasfield
17674         ;;
17675 *)      val="$undef"
17676         set d_statfs_f_flags
17677         eval $setvar
17678         ;;
17679 esac
17680 case "$d_statfs_f_flags" in
17681 "$define")      echo "Yes, it does."   ;;
17682 *)              echo "No, it doesn't." ;;
17683 esac
17684
17685 : Check stream access
17686 $cat >&4 <<EOM
17687 Checking how to access stdio streams by file descriptor number...
17688 EOM
17689 case "$stdio_stream_array" in
17690 '')     $cat >try.c <<EOCP
17691 #include <stdio.h>
17692 int main() {
17693   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17694     printf("yes\n");
17695 }
17696 EOCP
17697         for s in _iob __iob __sF
17698         do
17699                 set try -DSTDIO_STREAM_ARRAY=$s
17700                 if eval $compile; then
17701                         case "`$run ./try`" in
17702                         yes)    stdio_stream_array=$s; break ;;
17703                         esac
17704                 fi
17705         done
17706         $rm_try
17707 esac
17708 case "$stdio_stream_array" in
17709 '')     $cat >&4 <<EOM
17710 I can't figure out how to access stdio streams by file descriptor number.
17711 EOM
17712         d_stdio_stream_array="$undef"
17713         ;;
17714 *)      $cat >&4 <<EOM
17715 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17716 EOM
17717         d_stdio_stream_array="$define"
17718         ;;
17719 esac
17720
17721 : see if strcoll exists
17722 set strcoll d_strcoll
17723 eval $inlibc
17724
17725 : check for structure copying
17726 echo " "
17727 echo "Checking to see if your C compiler can copy structs..." >&4
17728 $cat >try.c <<'EOCP'
17729 int main()
17730 {
17731         struct blurfl {
17732                 int dyick;
17733         } foo, bar;
17734
17735         foo = bar;
17736 }
17737 EOCP
17738 if $cc -c try.c >/dev/null 2>&1 ; then
17739         val="$define"
17740         echo "Yup, it can."
17741 else
17742         val="$undef"
17743         echo "Nope, it can't."
17744 fi
17745 set d_strctcpy
17746 eval $setvar
17747 $rm_try
17748
17749 : see if strerror and/or sys_errlist[] exist
17750 echo " "
17751 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17752     if set strerror val -f d_strerror; eval $csym; $val; then
17753                 echo 'strerror() found.' >&4
17754                 d_strerror="$define"
17755                 d_strerrm='strerror(e)'
17756                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17757                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17758                         d_syserrlst="$define"
17759                 else
17760                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17761                         d_syserrlst="$undef"
17762                 fi
17763     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17764                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17765                 echo 'strerror() found in string header.' >&4
17766                 d_strerror="$define"
17767                 d_strerrm='strerror(e)'
17768                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17769                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17770                                 d_syserrlst="$define"
17771                 else
17772                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17773                         d_syserrlst="$undef"
17774                 fi
17775     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17776                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17777                 d_strerror="$undef"
17778                 d_syserrlst="$define"
17779                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17780     else
17781                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17782                 d_strerror="$undef"
17783                 d_syserrlst="$undef"
17784                 d_strerrm='"unknown"'
17785     fi
17786 fi
17787
17788 : see if strerror_r exists
17789 set strerror_r d_strerror_r
17790 eval $inlibc
17791 case "$d_strerror_r" in
17792 "$define")
17793         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17794         case "$d_strerror_r_proto:$usethreads" in
17795         ":define")      d_strerror_r_proto=define
17796                 set d_strerror_r_proto strerror_r $hdrs
17797                 eval $hasproto ;;
17798         *)      ;;
17799         esac
17800         case "$d_strerror_r_proto" in
17801         define)
17802         case "$strerror_r_proto" in
17803         ''|0) try='int strerror_r(int, char*, size_t);'
17804         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
17805         esac
17806         case "$strerror_r_proto" in
17807         ''|0) try='int strerror_r(int, char*, int);'
17808         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
17809         esac
17810         case "$strerror_r_proto" in
17811         ''|0) try='char* strerror_r(int, char*, size_t);'
17812         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
17813         esac
17814         case "$strerror_r_proto" in
17815         ''|0)   d_strerror_r=undef
17816                 strerror_r_proto=0
17817                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17818         * )     case "$strerror_r_proto" in
17819                 REENTRANT_PROTO*) ;;
17820                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17821                 esac
17822                 echo "Prototype: $try" ;;
17823         esac
17824         ;;
17825         *)      case "$usethreads" in
17826                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17827                 esac
17828                 d_strerror_r=undef
17829                 strerror_r_proto=0
17830                 ;;
17831         esac
17832         ;;
17833 *)      strerror_r_proto=0
17834         ;;
17835 esac
17836
17837 : see if strftime exists
17838 set strftime d_strftime
17839 eval $inlibc
17840
17841 : see if strlcat exists
17842 set strlcat d_strlcat
17843 eval $inlibc
17844
17845 : see if strlcpy exists
17846 set strlcpy d_strlcpy
17847 eval $inlibc
17848
17849 : see if strtod exists
17850 set strtod d_strtod
17851 eval $inlibc
17852
17853 : see if strtol exists
17854 set strtol d_strtol
17855 eval $inlibc
17856
17857 : see if strtold exists
17858 set strtold d_strtold
17859 eval $inlibc
17860
17861 : see if strtoll exists
17862 set strtoll d_strtoll
17863 eval $inlibc
17864
17865 case "$d_longlong-$d_strtoll" in
17866 "$define-$define")
17867         $cat <<EOM
17868 Checking whether your strtoll() works okay...
17869 EOM
17870         $cat >try.c <<'EOCP'
17871 #include <errno.h>
17872 #ifdef __hpux
17873 #define strtoll __strtoll
17874 #endif
17875 #ifdef __EMX__
17876 #define strtoll _strtoll
17877 #endif
17878 #include <stdio.h>
17879 extern long long int strtoll(char *s, char **, int);
17880 static int bad = 0;
17881 int check(char *s, long long ell, int een) {
17882         long long gll;
17883         errno = 0;
17884         gll = strtoll(s, 0, 10);
17885         if (!((gll == ell) && (errno == een)))
17886                 bad++;
17887 }
17888 int main() {
17889         check(" 1",                                      1LL, 0);
17890         check(" 0",                                      0LL, 0);
17891         check("-1",                                     -1LL, 0);
17892         check("-9223372036854775808", -9223372036854775808LL, 0);
17893         check("-9223372036854775808", -9223372036854775808LL, 0);
17894         check(" 9223372036854775807",  9223372036854775807LL, 0);
17895         check("-9223372036854775808", -9223372036854775808LL, 0);
17896         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17897         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17898         if (!bad)
17899                 printf("ok\n");
17900 }
17901 EOCP
17902         set try
17903         if eval $compile; then
17904                 yyy=`$run ./try`
17905                 case "$yyy" in
17906                 ok) echo "Your strtoll() seems to be working okay." ;;
17907                 *) cat <<EOM >&4
17908 Your strtoll() doesn't seem to be working okay.
17909 EOM
17910                    d_strtoll="$undef"
17911                    ;;
17912                 esac
17913         else
17914                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17915                 d_strtoll="$undef"
17916         fi
17917         ;;
17918 esac
17919
17920 : see if strtoq exists
17921 set strtoq d_strtoq
17922 eval $inlibc
17923
17924 : see if strtoul exists
17925 set strtoul d_strtoul
17926 eval $inlibc
17927
17928 case "$d_strtoul" in
17929 "$define")
17930         $cat <<EOM
17931 Checking whether your strtoul() works okay...
17932 EOM
17933         $cat >try.c <<'EOCP'
17934 #include <errno.h>
17935 #include <stdio.h>
17936 extern unsigned long int strtoul(char *s, char **, int);
17937 static int bad = 0;
17938 void check(char *s, unsigned long eul, int een) {
17939         unsigned long gul;
17940         errno = 0;
17941         gul = strtoul(s, 0, 10);
17942         if (!((gul == eul) && (errno == een)))
17943                 bad++;
17944 }
17945 int main() {
17946         check(" 1", 1L, 0);
17947         check(" 0", 0L, 0);
17948 EOCP
17949         case "$longsize" in
17950         8)
17951             $cat >>try.c <<'EOCP'
17952         check("18446744073709551615", 18446744073709551615UL, 0);
17953         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17954 #if 0 /* strtoul() for /^-/ strings is undefined. */
17955         check("-1", 18446744073709551615UL, 0);
17956         check("-18446744073709551614", 2, 0);
17957         check("-18446744073709551615", 1, 0);
17958         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17959         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17960 #endif
17961 EOCP
17962                 ;;
17963         4)
17964                     $cat >>try.c <<'EOCP'
17965         check("4294967295", 4294967295UL, 0);
17966         check("4294967296", 4294967295UL, ERANGE);
17967 #if 0 /* strtoul() for /^-/ strings is undefined. */
17968         check("-1", 4294967295UL, 0);
17969         check("-4294967294", 2, 0);
17970         check("-4294967295", 1, 0);
17971         check("-4294967296", 4294967295UL, ERANGE);
17972         check("-4294967297", 4294967295UL, ERANGE);
17973 #endif
17974 EOCP
17975                 ;;
17976         *)
17977 : Should we write these tests to be more portable by sprintf-ing
17978 : ~0 and then manipulating that char string as input for strtol?
17979                 ;;
17980         esac
17981         $cat >>try.c <<'EOCP'
17982         if (!bad)
17983                 printf("ok\n");
17984         return 0;
17985 }
17986 EOCP
17987         set try
17988         if eval $compile; then
17989                 case "`$run ./try`" in
17990                 ok) echo "Your strtoul() seems to be working okay." ;;
17991                 *) cat <<EOM >&4
17992 Your strtoul() doesn't seem to be working okay.
17993 EOM
17994                    d_strtoul="$undef"
17995                    ;;
17996                 esac
17997         else
17998                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17999                 d_strtoul="$undef"
18000         fi
18001         ;;
18002 esac
18003
18004 : see if strtoull exists
18005 set strtoull d_strtoull
18006 eval $inlibc
18007
18008 case "$d_longlong-$d_strtoull" in
18009 "$define-$define")
18010         $cat <<EOM
18011 Checking whether your strtoull() works okay...
18012 EOM
18013         $cat >try.c <<'EOCP'
18014 #include <errno.h>
18015 #ifdef __hpux
18016 #define strtoull __strtoull
18017 #endif
18018 #include <stdio.h>
18019 extern unsigned long long int strtoull(char *s, char **, int);
18020 static int bad = 0;
18021 int check(char *s, long long eull, int een) {
18022         long long gull;
18023         errno = 0;
18024         gull = strtoull(s, 0, 10);
18025         if (!((gull == eull) && (errno == een)))
18026                 bad++;
18027 }
18028 int main() {
18029         check(" 1",                                        1LL, 0);
18030         check(" 0",                                        0LL, 0);
18031         check("18446744073709551615",  18446744073709551615ULL, 0);
18032         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18033 #if 0 /* strtoull() for /^-/ strings is undefined. */
18034         check("-1",                    18446744073709551615ULL, 0);
18035         check("-18446744073709551614",                     2LL, 0);
18036         check("-18446744073709551615",                     1LL, 0);
18037         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18038         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18039 #endif
18040         if (!bad)
18041                 printf("ok\n");
18042 }
18043 EOCP
18044         set try
18045         if eval $compile; then
18046                 case "`$run ./try`" in
18047                 ok) echo "Your strtoull() seems to be working okay." ;;
18048                 *) cat <<EOM >&4
18049 Your strtoull() doesn't seem to be working okay.
18050 EOM
18051                    d_strtoull="$undef"
18052                    ;;
18053                 esac
18054         else
18055                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18056                 d_strtoull="$undef"
18057         fi
18058         ;;
18059 esac
18060
18061 : see if strtouq exists
18062 set strtouq d_strtouq
18063 eval $inlibc
18064
18065 case "$d_strtouq" in
18066 "$define")
18067         $cat <<EOM
18068 Checking whether your strtouq() works okay...
18069 EOM
18070         $cat >try.c <<'EOCP'
18071 #include <errno.h>
18072 #include <stdio.h>
18073 extern unsigned long long int strtouq(char *s, char **, int);
18074 static int bad = 0;
18075 void check(char *s, unsigned long long eull, int een) {
18076         unsigned long long gull;
18077         errno = 0;
18078         gull = strtouq(s, 0, 10);
18079         if (!((gull == eull) && (errno == een)))
18080                 bad++;
18081 }
18082 int main() {
18083         check(" 1",                                        1LL, 0);
18084         check(" 0",                                        0LL, 0);
18085         check("18446744073709551615",  18446744073709551615ULL, 0);
18086         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18087 #if 0 /* strtouq() for /^-/ strings is undefined. */
18088         check("-1",                    18446744073709551615ULL, 0);
18089         check("-18446744073709551614",                     2LL, 0);
18090         check("-18446744073709551615",                     1LL, 0);
18091         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18092         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18093 #endif
18094         if (!bad)
18095                 printf("ok\n");
18096         return 0;
18097 }
18098 EOCP
18099         set try
18100         if eval $compile; then
18101                 case "`$run ./try`" in
18102                 ok) echo "Your strtouq() seems to be working okay." ;;
18103                 *) cat <<EOM >&4
18104 Your strtouq() doesn't seem to be working okay.
18105 EOM
18106                    d_strtouq="$undef"
18107                    ;;
18108                 esac
18109         else
18110                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18111                 d_strtouq="$undef"
18112         fi
18113         ;;
18114 esac
18115
18116 : see if strxfrm exists
18117 set strxfrm d_strxfrm
18118 eval $inlibc
18119
18120 : see if symlink exists
18121 set symlink d_symlink
18122 eval $inlibc
18123
18124 : see if syscall exists
18125 set syscall d_syscall
18126 eval $inlibc
18127
18128 : see if prototype for syscall is available
18129 echo " "
18130 set d_syscallproto syscall $i_unistd unistd.h
18131 eval $hasproto
18132
18133 : see if sysconf exists
18134 set sysconf d_sysconf
18135 eval $inlibc
18136
18137 : see if system exists
18138 set system d_system
18139 eval $inlibc
18140
18141 : see if tcgetpgrp exists
18142 set tcgetpgrp d_tcgetpgrp
18143 eval $inlibc
18144
18145 : see if tcsetpgrp exists
18146 set tcsetpgrp d_tcsetpgrp
18147 eval $inlibc
18148
18149 : see if prototype for telldir is available
18150 echo " "
18151 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18152 eval $hasproto
18153
18154 : see if time exists
18155 echo " "
18156 if test "X$d_time" = X -o X"$timetype" = X; then
18157     if set time val -f d_time; eval $csym; $val; then
18158                 echo 'time() found.' >&4
18159                 val="$define"
18160                 rp="What is the type returned by time() on this system?"
18161                 set time_t timetype long stdio.h sys/types.h
18162                 eval $typedef_ask
18163     else
18164                 echo 'time() not found, hope that will do.' >&4
18165                 val="$undef"
18166                 timetype='int';
18167     fi
18168     set d_time
18169     eval $setvar
18170 fi
18171
18172 : see if timegm exists
18173 set timegm d_timegm
18174 eval $inlibc
18175
18176 : see if this is a sys/times.h system
18177 set sys/times.h i_systimes
18178 eval $inhdr
18179
18180 : see if times exists
18181 echo " "
18182 if set times val -f d_times; eval $csym; $val; then
18183         echo 'times() found.' >&4
18184         d_times="$define"
18185         inc=''
18186         case "$i_systimes" in
18187         "$define") inc='sys/times.h';;
18188         esac
18189         rp="What is the type returned by times() on this system?"
18190         set clock_t clocktype long stdio.h sys/types.h $inc
18191         eval $typedef_ask
18192 else
18193         echo 'times() NOT found, hope that will do.' >&4
18194         d_times="$undef"
18195         clocktype='int'
18196 fi
18197
18198 : see if tmpnam_r exists
18199 set tmpnam_r d_tmpnam_r
18200 eval $inlibc
18201 case "$d_tmpnam_r" in
18202 "$define")
18203         hdrs="$i_systypes sys/types.h define stdio.h "
18204         case "$d_tmpnam_r_proto:$usethreads" in
18205         ":define")      d_tmpnam_r_proto=define
18206                 set d_tmpnam_r_proto tmpnam_r $hdrs
18207                 eval $hasproto ;;
18208         *)      ;;
18209         esac
18210         case "$d_tmpnam_r_proto" in
18211         define)
18212         case "$tmpnam_r_proto" in
18213         ''|0) try='char* tmpnam_r(char*);'
18214         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18215         esac
18216         case "$tmpnam_r_proto" in
18217         ''|0)   d_tmpnam_r=undef
18218                 tmpnam_r_proto=0
18219                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18220         * )     case "$tmpnam_r_proto" in
18221                 REENTRANT_PROTO*) ;;
18222                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18223                 esac
18224                 echo "Prototype: $try" ;;
18225         esac
18226         ;;
18227         *)      case "$usethreads" in
18228                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18229                 esac
18230                 d_tmpnam_r=undef
18231                 tmpnam_r_proto=0
18232                 ;;
18233         esac
18234         ;;
18235 *)      tmpnam_r_proto=0
18236         ;;
18237 esac
18238
18239 : see if truncate exists
18240 set truncate d_truncate
18241 eval $inlibc
18242
18243 : see if ttyname_r exists
18244 set ttyname_r d_ttyname_r
18245 eval $inlibc
18246 case "$d_ttyname_r" in
18247 "$define")
18248         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18249         case "$d_ttyname_r_proto:$usethreads" in
18250         ":define")      d_ttyname_r_proto=define
18251                 set d_ttyname_r_proto ttyname_r $hdrs
18252                 eval $hasproto ;;
18253         *)      ;;
18254         esac
18255         case "$d_ttyname_r_proto" in
18256         define)
18257         case "$ttyname_r_proto" in
18258         ''|0) try='int ttyname_r(int, char*, size_t);'
18259         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18260         esac
18261         case "$ttyname_r_proto" in
18262         ''|0) try='int ttyname_r(int, char*, int);'
18263         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18264         esac
18265         case "$ttyname_r_proto" in
18266         ''|0) try='char* ttyname_r(int, char*, int);'
18267         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18268         esac
18269         case "$ttyname_r_proto" in
18270         ''|0)   d_ttyname_r=undef
18271                 ttyname_r_proto=0
18272                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18273         * )     case "$ttyname_r_proto" in
18274                 REENTRANT_PROTO*) ;;
18275                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18276                 esac
18277                 echo "Prototype: $try" ;;
18278         esac
18279         ;;
18280         *)      case "$usethreads" in
18281                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18282                 esac
18283                 d_ttyname_r=undef
18284                 ttyname_r_proto=0
18285                 ;;
18286         esac
18287         ;;
18288 *)      ttyname_r_proto=0
18289         ;;
18290 esac
18291
18292 : see if tzname[] exists
18293 echo " "
18294 if set tzname val -a d_tzname; eval $csym; $val; then
18295         val="$define"
18296         echo 'tzname[] found.' >&4
18297 else
18298         val="$undef"
18299         echo 'tzname[] NOT found.' >&4
18300 fi
18301 set d_tzname
18302 eval $setvar
18303
18304 : Check if is a multiplatform env
18305 case "$osname" in
18306 next|rhapsody|darwin) multiarch="$define" ;;
18307 esac
18308 case "$multiarch" in
18309 ''|[nN]*) multiarch="$undef" ;;
18310 esac
18311
18312 : check for ordering of bytes in a UV
18313 echo " "
18314 case "$usecrosscompile$multiarch" in
18315 *$define*)
18316         $cat <<EOM
18317 You seem to be either cross-compiling or doing a multiarchitecture build,
18318 skipping the byteorder check.
18319
18320 EOM
18321         byteorder='ffff'
18322         ;;
18323 *)
18324         case "$byteorder" in
18325         '')
18326                 $cat <<'EOM'
18327 In the following, larger digits indicate more significance.  A big-endian
18328 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18329 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18330 machines may have weird orders like 3412.  A Cray will report 87654321,
18331 an Alpha will report 12345678. If the test program works the default is
18332 probably right.
18333 I'm now running the test program...
18334 EOM
18335                 $cat >try.c <<EOCP
18336 #include <stdio.h>
18337 #$i_stdlib I_STDLIB
18338 #ifdef I_STDLIB
18339 #include <stdlib.h>
18340 #endif
18341 #include <sys/types.h>
18342 typedef $uvtype UV;
18343 int main()
18344 {
18345         int i;
18346         union {
18347                 UV l;
18348                 char c[$uvsize];
18349         } u;
18350
18351         if ($uvsize > 4)
18352                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18353         else
18354                 u.l = (UV)0x04030201;
18355         for (i = 0; i < $uvsize; i++)
18356                 printf("%c", u.c[i]+'0');
18357         printf("\n");
18358         exit(0);
18359 }
18360 EOCP
18361                 xxx_prompt=y
18362                 set try
18363                 if eval $compile && $run ./try > /dev/null; then
18364                         dflt=`$run ./try`
18365                         case "$dflt" in
18366                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18367                                 echo "(The test program ran ok.)"
18368                                 echo "byteorder=$dflt"
18369                                 xxx_prompt=n
18370                         ;;
18371                         ????|????????) echo "(The test program ran ok.)" ;;
18372                         *) echo "(The test program didn't run right for some reason.)" ;;
18373                         esac
18374                 else
18375                         dflt='4321'
18376                         cat <<'EOM'
18377 (I can't seem to compile the test program.  Guessing big-endian...)
18378 EOM
18379                 fi
18380                 case "$xxx_prompt" in
18381                 y)
18382                         rp="What is the order of bytes in $uvtype?"
18383                         . ./myread
18384                         byteorder="$ans"
18385                         ;;
18386                 *)      byteorder=$dflt
18387                         ;;
18388                 esac
18389                 ;;
18390         esac
18391         $rm_try
18392         ;;
18393 esac
18394
18395 : Checking 32bit aligndness
18396 $cat <<EOM
18397
18398 Checking to see whether you can access character data unalignedly...
18399 EOM
18400 case "$d_u32align" in
18401 '')   $cat >try.c <<EOCP
18402 #include <stdio.h>
18403 #$i_stdlib I_STDLIB
18404 #ifdef I_STDLIB
18405 #include <stdlib.h>
18406 #endif
18407 #define U32 $u32type
18408 #define BYTEORDER 0x$byteorder
18409 #define U8 $u8type
18410 #include <signal.h>
18411 #ifdef SIGBUS
18412 $signal_t bletch(int s) { exit(4); }
18413 #endif
18414 int main() {
18415 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18416     U8 buf[8];
18417     U32 *up;
18418     int i;
18419
18420     if (sizeof(U32) != 4) {
18421         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18422         exit(1);
18423     }
18424
18425     fflush(stdout);
18426
18427 #ifdef SIGBUS
18428     signal(SIGBUS, bletch);
18429 #endif
18430
18431     buf[0] = 0;
18432     buf[1] = 0;
18433     buf[2] = 0;
18434     buf[3] = 1;
18435     buf[4] = 0;
18436     buf[5] = 0;
18437     buf[6] = 0;
18438     buf[7] = 1;
18439
18440     for (i = 0; i < 4; i++) {
18441         up = (U32*)(buf + i);
18442         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18443                (*up == 1 << (8*(3-i)))  /* little-endian */
18444               )
18445            )
18446         {
18447             printf("read failed (%x)\n", *up);
18448             exit(2);
18449         }
18450     }
18451
18452     /* write test */
18453     for (i = 0; i < 4; i++) {
18454         up = (U32*)(buf + i);
18455         *up = 0xBeef;
18456         if (*up != 0xBeef) {
18457             printf("write failed (%x)\n", *up);
18458             exit(3);
18459         }
18460     }
18461
18462     exit(0);
18463 #else
18464     printf("1\n");
18465     exit(1);
18466 #endif
18467     return 0;
18468 }
18469 EOCP
18470 set try
18471 if eval $compile_ok; then
18472         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18473         $run ./try 2>&1 >/dev/null
18474         case "$?" in
18475         0)      cat >&4 <<EOM
18476 You can access character data pretty unalignedly.
18477 EOM
18478                 d_u32align="$undef"
18479                 ;;
18480         *)      cat >&4 <<EOM
18481 It seems that you must access character data in an aligned manner.
18482 EOM
18483                 d_u32align="$define"
18484                 ;;
18485         esac
18486 else
18487         rp='Can you access character data at unaligned addresses?'
18488         dflt='n'
18489         . ./myread
18490         case "$ans" in
18491         [yY]*)  d_u32align="$undef"  ;;
18492         *)      d_u32align="$define" ;;
18493         esac
18494 fi
18495 $rm_try
18496 ;;
18497 esac
18498
18499 : see if ualarm exists
18500 set ualarm d_ualarm
18501 eval $inlibc
18502
18503 : see if umask exists
18504 set umask d_umask
18505 eval $inlibc
18506
18507 : see if unordered exists
18508 set unordered d_unordered
18509 eval $inlibc
18510
18511 : see if unsetenv exists
18512 set unsetenv d_unsetenv
18513 eval $inlibc
18514
18515 : see if usleep exists
18516 set usleep d_usleep
18517 eval $inlibc
18518
18519 : see if prototype for usleep is available
18520 echo " "
18521 set d_usleepproto usleep $i_unistd unistd.h
18522 eval $hasproto
18523
18524 : see if ustat exists
18525 set ustat d_ustat
18526 eval $inlibc
18527
18528 : see if closedir exists
18529 set closedir d_closedir
18530 eval $inlibc
18531
18532 case "$d_closedir" in
18533 "$define")
18534         echo " "
18535         echo "Checking whether closedir() returns a status..." >&4
18536         cat > try.c <<EOM
18537 #$i_dirent I_DIRENT             /**/
18538 #$i_sysdir I_SYS_DIR            /**/
18539 #$i_sysndir I_SYS_NDIR          /**/
18540 #$i_systypes I_SYS_TYPES        /**/
18541
18542 #if defined(I_SYS_TYPES)
18543 #include <sys/types.h>
18544 #endif
18545 #if defined(I_DIRENT)
18546 #include <dirent.h>
18547 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18548 #include <sys/dir.h>
18549 #endif
18550 #else
18551 #ifdef I_SYS_NDIR
18552 #include <sys/ndir.h>
18553 #else
18554 #ifdef I_SYS_DIR
18555 #ifdef hp9000s500
18556 #include <ndir.h>       /* may be wrong in the future */
18557 #else
18558 #include <sys/dir.h>
18559 #endif
18560 #endif
18561 #endif
18562 #endif
18563 int main() { return closedir(opendir(".")); }
18564 EOM
18565         set try
18566         if eval $compile_ok; then
18567                 if $run ./try > /dev/null 2>&1 ; then
18568                         echo "Yes, it does."
18569                         val="$undef"
18570                 else
18571                         echo "No, it doesn't."
18572                         val="$define"
18573                 fi
18574         else
18575                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18576                 val="$define"
18577         fi
18578         ;;
18579 *)
18580         val="$undef";
18581         ;;
18582 esac
18583 set d_void_closedir
18584 eval $setvar
18585 $rm_try
18586
18587 : see if there is a wait4
18588 set wait4 d_wait4
18589 eval $inlibc
18590
18591 : see if waitpid exists
18592 set waitpid d_waitpid
18593 eval $inlibc
18594
18595 : see if wcstombs exists
18596 set wcstombs d_wcstombs
18597 eval $inlibc
18598
18599 : see if wctomb exists
18600 set wctomb d_wctomb
18601 eval $inlibc
18602
18603 : see if writev exists
18604 set writev d_writev
18605 eval $inlibc
18606
18607 : preserve RCS keywords in files with variable substitution, grrr
18608 Date='$Date'
18609 Id='$Id'
18610 Log='$Log'
18611 RCSfile='$RCSfile'
18612 Revision='$Revision'
18613
18614 : check for alignment requirements
18615 echo " "
18616 case "$usecrosscompile$multiarch" in
18617 *$define*)
18618         $cat <<EOM
18619 You seem to be either cross-compiling or doing a multiarchitecture build,
18620 skipping the memory alignment check.
18621
18622 EOM
18623         case "$alignbytes" in
18624         '') alignbytes=8 ;;
18625         esac
18626         ;;
18627 *)
18628         case "$alignbytes" in
18629         '') echo "Checking alignment constraints..." >&4
18630                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18631                         $cat >try.c <<'EOCP'
18632 typedef long double NV;
18633 EOCP
18634                 else
18635                         $cat >try.c <<'EOCP'
18636 typedef double NV;
18637 EOCP
18638                 fi
18639                 $cat >>try.c <<'EOCP'
18640 #include <stdio.h>
18641 struct foobar {
18642         char foo;
18643         NV bar;
18644 } try_algn;
18645 int main()
18646 {
18647     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18648     return(0);
18649 }
18650 EOCP
18651                 set try
18652                 if eval $compile_ok; then
18653                         dflt=`$run ./try`
18654                 else
18655                         dflt='8'
18656                         echo "(I can't seem to compile the test program...)"
18657                 fi
18658                 ;;
18659         *) dflt="$alignbytes"
18660                 ;;
18661         esac
18662         rp="Doubles must be aligned on a how-many-byte boundary?"
18663         . ./myread
18664         alignbytes="$ans"
18665         $rm_try
18666         ;;
18667 esac
18668
18669
18670 : set the base revision
18671 baserev=5.0
18672
18673 : how do we concatenate cpp tokens here?
18674 echo " "
18675 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18676 $cat >cpp_stuff.c <<'EOCP'
18677 #define RCAT(a,b)a/**/b
18678 #define ACAT(a,b)a ## b
18679 RCAT(Rei,ser)
18680 ACAT(Cir,cus)
18681 EOCP
18682 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18683 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18684         echo "Oh!  Smells like ANSI's been here." >&4
18685         echo "We can catify or stringify, separately or together!"
18686         cpp_stuff=42
18687 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18688         echo "Ah, yes!  The good old days!" >&4
18689         echo "However, in the good old days we don't know how to stringify and"
18690         echo "catify at the same time."
18691         cpp_stuff=1
18692 else
18693         $cat >&4 <<EOM
18694 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18695 You're going to have to edit the values of CAT[2-5] in config.h...
18696 EOM
18697         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18698 fi
18699 $rm -f cpp_stuff.*
18700
18701 : see if this is a db.h system
18702 set db.h i_db
18703 eval $inhdr
18704
18705 case "$i_db" in
18706 $define)
18707         : Check db version.
18708         echo " "
18709         echo "Checking Berkeley DB version ..." >&4
18710         $cat >try.c <<EOCP
18711 #$d_const HASCONST
18712 #ifndef HASCONST
18713 #define const
18714 #endif
18715 #include <sys/types.h>
18716 #include <stdio.h>
18717 #$i_stdlib I_STDLIB
18718 #ifdef I_STDLIB
18719 #include <stdlib.h>
18720 #endif
18721 #include <db.h>
18722 int main(int argc, char *argv[])
18723 {
18724 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18725     int Major, Minor, Patch ;
18726     unsigned long Version ;
18727     (void)db_version(&Major, &Minor, &Patch) ;
18728     if (argc == 2) {
18729         printf("%d %d %d %d %d %d\n",
18730                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18731                Major, Minor, Patch);
18732         exit(0);
18733     }
18734     printf("You have Berkeley DB Version 2 or greater.\n");
18735
18736     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18737                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18738     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18739                 Major, Minor, Patch) ;
18740
18741     /* check that db.h & libdb are compatible */
18742     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18743         printf("db.h and libdb are incompatible.\n") ;
18744         exit(3);
18745     }
18746
18747     printf("db.h and libdb are compatible.\n") ;
18748
18749     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18750                 + DB_VERSION_PATCH ;
18751
18752     /* needs to be >= 2.3.4 */
18753     if (Version < 2003004) {
18754     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18755         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18756         exit(2);
18757     }
18758
18759     exit(0);
18760 #else
18761 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18762     if (argc == 2) {
18763         printf("1 0 0\n");
18764         exit(0);
18765     }
18766     printf("You have Berkeley DB Version 1.\n");
18767     exit(0);    /* DB version < 2: the coast is clear. */
18768 #else
18769     exit(1);    /* <db.h> not Berkeley DB? */
18770 #endif
18771 #endif
18772 }
18773 EOCP
18774         set try
18775         if eval $compile_ok && $run ./try; then
18776                 echo 'Looks OK.' >&4
18777                 set `$run ./try 1`
18778                 db_version_major=$1
18779                 db_version_minor=$2
18780                 db_version_patch=$3
18781         else
18782                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18783                 i_db=$undef
18784                 case " $libs " in
18785                 *"-ldb "*)
18786                         : Remove db from list of libraries to use
18787                         echo "Removing unusable -ldb from library list" >&4
18788                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18789                         shift
18790                         libs="$*"
18791                         echo "libs = $libs" >&4
18792                         ;;
18793                 esac
18794         fi
18795         $rm_try
18796         ;;
18797 esac
18798
18799 case "$i_db" in
18800 define)
18801         : Check the return type needed for hash
18802         echo " "
18803         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18804         $cat >try.c <<EOCP
18805 #$d_const HASCONST
18806 #ifndef HASCONST
18807 #define const
18808 #endif
18809 #include <sys/types.h>
18810 #include <db.h>
18811
18812 #ifndef DB_VERSION_MAJOR
18813 u_int32_t hash_cb (ptr, size)
18814 const void *ptr;
18815 size_t size;
18816 {
18817 }
18818 HASHINFO info;
18819 int main()
18820 {
18821         info.hash = hash_cb;
18822 }
18823 #endif
18824 EOCP
18825         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18826                 if $contains warning try.out >>/dev/null 2>&1 ; then
18827                         db_hashtype='int'
18828                 else
18829                         db_hashtype='u_int32_t'
18830                 fi
18831         else
18832                 : XXX Maybe we should just give up here.
18833                 db_hashtype=u_int32_t
18834                 $cat try.out >&4
18835                 echo "Help:  I can't seem to compile the db test program." >&4
18836                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18837         fi
18838         $rm_try
18839         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18840         ;;
18841 *)      db_hashtype=u_int32_t
18842         ;;
18843 esac
18844 case "$i_db" in
18845 define)
18846         : Check the return type needed for prefix
18847         echo " "
18848         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18849         cat >try.c <<EOCP
18850 #$d_const HASCONST
18851 #ifndef HASCONST
18852 #define const
18853 #endif
18854 #include <sys/types.h>
18855 #include <db.h>
18856
18857 #ifndef DB_VERSION_MAJOR
18858 size_t prefix_cb (key1, key2)
18859 const DBT *key1;
18860 const DBT *key2;
18861 {
18862 }
18863 BTREEINFO info;
18864 int main()
18865 {
18866         info.prefix = prefix_cb;
18867 }
18868 #endif
18869 EOCP
18870         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18871                 if $contains warning try.out >>/dev/null 2>&1 ; then
18872                         db_prefixtype='int'
18873                 else
18874                         db_prefixtype='size_t'
18875                 fi
18876         else
18877                 db_prefixtype='size_t'
18878                 : XXX Maybe we should just give up here.
18879                 $cat try.out >&4
18880                 echo "Help:  I can't seem to compile the db test program." >&4
18881                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18882         fi
18883         $rm_try
18884         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18885         ;;
18886 *)      db_prefixtype='size_t'
18887         ;;
18888 esac
18889
18890 : How can we generate normalized random numbers ?
18891 echo " "
18892 echo "Looking for a random number function..." >&4
18893 case "$randfunc" in
18894 '')
18895         if set drand48 val -f; eval $csym; $val; then
18896                 dflt="drand48"
18897                 echo "Good, found drand48()." >&4
18898         elif set random val -f; eval $csym; $val; then
18899                 dflt="random"
18900                 echo "OK, found random()." >&4
18901         else
18902                 dflt="rand"
18903                 echo "Yick, looks like I have to use rand()." >&4
18904         fi
18905         echo " "
18906         ;;
18907 *)
18908         dflt="$randfunc"
18909         ;;
18910 esac
18911 cont=true
18912
18913 case "$ccflags" in
18914 *-Dmy_rand=*|*-Dmy_srand=*)
18915         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18916         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18917         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18918         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18919         ;;
18920 esac
18921
18922 while $test "$cont"; do
18923         rp="Use which function to generate random numbers?"
18924         . ./myread
18925         if $test "$ans" = "$dflt"; then
18926                 : null
18927         else
18928                 randbits=''
18929         fi
18930         randfunc="$ans"
18931         if set $ans val -f; eval $csym; $val; then
18932                 cont=''
18933         else
18934                 dflt=y
18935                 rp="I cannot find function $ans. Use that name anyway?"
18936                 . ./myread
18937                 dflt=rand
18938                 case "$ans" in
18939                         [yY]*) cont='';;
18940                 esac
18941         fi
18942         case "$cont" in
18943         '')
18944                 case "$randfunc" in
18945                 drand48)
18946                         drand01="drand48()"
18947                         seedfunc="srand48"
18948                         randbits=48
18949                         randseedtype=long
18950                         ;;
18951                 rand|random)
18952                         case "$randbits" in
18953                         '')
18954 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18955                                 $cat >try.c <<EOCP
18956 #$i_unistd I_UNISTD
18957 #$i_stdlib I_STDLIB
18958 #include <stdio.h>
18959 #ifdef I_UNISTD
18960 #  include <unistd.h>
18961 #endif
18962 #ifdef I_STDLIB
18963 #  include <stdlib.h>
18964 #endif
18965 int main()
18966 {
18967         register int i;
18968         register unsigned long tmp;
18969         register unsigned long max = 0L;
18970
18971         for (i = 1000; i; i--) {
18972                 tmp = (unsigned long) $randfunc();
18973                 if (tmp > max) max = tmp;
18974         }
18975         for (i = 0; max; i++)
18976                 max /= 2;
18977         printf("%d\n",i);
18978 }
18979 EOCP
18980                                 set try
18981                                 if eval $compile_ok; then
18982                                         dflt=`try`
18983                                 else
18984                                         dflt='?'
18985                                         echo "(I can't seem to compile the test program...)"
18986                                 fi
18987                                 ;;
18988                         *)
18989                                 dflt="$randbits"
18990                                 ;;
18991                         esac
18992                         rp="How many bits does your $randfunc() function produce?"
18993                         . ./myread
18994                         randbits="$ans"
18995                         $rm_try
18996                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18997                         seedfunc="s$randfunc"
18998                         randseedtype=unsigned
18999                         ;;
19000                 *)
19001                         dflt="31"
19002                         rp="How many bits does your $randfunc() function produce?"
19003                         . ./myread
19004                         randbits="$ans"
19005                         seedfunc="s$randfunc"
19006                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19007                         if set $seedfunc val -f; eval $csym; $val; then
19008                                 echo "(Using $seedfunc() to seed random generator)"
19009                         else
19010                                 echo "(Warning: no $seedfunc() to seed random generator)"
19011                                 seedfunc=rand
19012                         fi
19013                         randseedtype=unsigned
19014                         ;;
19015                 esac
19016                 ;;
19017         esac
19018 done
19019
19020 : Determine if this is an EBCDIC system
19021 echo " "
19022 echo "Determining whether or not we are on an EBCDIC system..." >&4
19023 $cat >try.c <<'EOM'
19024 int main()
19025 {
19026   if ('M'==0xd4) return 0;
19027   return 1;
19028 }
19029 EOM
19030
19031 val=$undef
19032 set try
19033 if eval $compile_ok; then
19034         if $run ./try; then
19035                 echo "You seem to speak EBCDIC." >&4
19036                 val="$define"
19037         else
19038                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19039         fi
19040 else
19041         echo "I'm unable to compile the test program." >&4
19042         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19043 fi
19044 $rm_try
19045 set ebcdic
19046 eval $setvar
19047
19048 : Check how to flush
19049 echo " "
19050 $cat >&4 <<EOM
19051 Checking how to flush all pending stdio output...
19052 EOM
19053 # I only know how to find the first 32 possibly open files on SunOS.
19054 # See also hints/sunos_4_1.sh and util.c  --AD
19055 case "$osname" in
19056 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19057 esac
19058 $cat >>try.c <<EOCP
19059 #include <stdio.h>
19060 #$i_stdlib I_STDLIB
19061 #ifdef I_STDLIB
19062 #include <stdlib.h>
19063 #endif
19064 #$i_unistd I_UNISTD
19065 #ifdef I_UNISTD
19066 # include <unistd.h>
19067 #endif
19068 #$d_sysconf HAS_SYSCONF
19069 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19070 #ifdef HAS_STDIO_STREAM_ARRAY
19071 # define STDIO_STREAM_ARRAY $stdio_stream_array
19072 #endif
19073 int main() {
19074   FILE* p;
19075   unlink("try.out");
19076   p = fopen("try.out", "w");
19077 #ifdef TRY_FPUTC
19078   fputc('x', p);
19079 #else
19080 # ifdef TRY_FPRINTF
19081   fprintf(p, "x");
19082 # endif
19083 #endif
19084 #ifdef TRY_FFLUSH_NULL
19085   fflush(NULL);
19086 #endif
19087 #ifdef TRY_FFLUSH_ALL
19088   {
19089     long open_max = -1;
19090 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19091     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19092 # else
19093 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19094     open_max = sysconf(_SC_OPEN_MAX);
19095 #  else
19096 #   ifdef FOPEN_MAX
19097     open_max = FOPEN_MAX;
19098 #   else
19099 #    ifdef OPEN_MAX
19100     open_max = OPEN_MAX;
19101 #    else
19102 #     ifdef _NFILE
19103     open_max = _NFILE;
19104 #     endif
19105 #    endif
19106 #   endif
19107 #  endif
19108 # endif
19109 # ifdef HAS_STDIO_STREAM_ARRAY
19110     if (open_max > 0) {
19111       long i;
19112       for (i = 0; i < open_max; i++)
19113             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19114                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19115                 STDIO_STREAM_ARRAY[i]._flag)
19116                 fflush(&STDIO_STREAM_ARRAY[i]);
19117     }
19118   }
19119 # endif
19120 #endif
19121   _exit(42);
19122 }
19123 EOCP
19124 : first we have to find out how _not_ to flush
19125 $to try.c
19126 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19127     output=''
19128     set try -DTRY_FPUTC
19129     if eval $compile; then
19130             $run ./try 2>/dev/null
19131             code="$?"
19132             $from try.out
19133             if $test ! -s try.out -a "X$code" = X42; then
19134                 output=-DTRY_FPUTC
19135             fi
19136     fi
19137     case "$output" in
19138     '')
19139             set try -DTRY_FPRINTF
19140             if eval $compile; then
19141                     $run ./try 2>/dev/null
19142                     code="$?"
19143                     $from try.out
19144                     if $test ! -s try.out -a "X$code" = X42; then
19145                         output=-DTRY_FPRINTF
19146                     fi
19147             fi
19148         ;;
19149     esac
19150 fi
19151 : check for fflush NULL behaviour
19152 case "$fflushNULL" in
19153 '')     set try -DTRY_FFLUSH_NULL $output
19154         if eval $compile; then
19155                 $run ./try 2>/dev/null
19156                 code="$?"
19157                 $from try.out
19158                 if $test -s try.out -a "X$code" = X42; then
19159                         fflushNULL="`$cat try.out`"
19160                 else
19161                         if $test "X$code" != X42; then
19162                                 $cat >&4 <<EOM
19163 (If this test failed, don't worry, we'll try another method shortly.)
19164 EOM
19165                         fi
19166                 fi
19167         fi
19168         $rm -f core try.core core.try.*
19169         case "$fflushNULL" in
19170         x)      $cat >&4 <<EOM
19171 Your fflush(NULL) works okay for output streams.
19172 Let's see if it clobbers input pipes...
19173 EOM
19174 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19175 # bug that improperly flushes the input end of pipes.  So we avoid the
19176 # autoflush on fork/system/exec support for now. :-(
19177 $cat >tryp.c <<EOCP
19178 #include <stdio.h>
19179 int
19180 main(int argc, char **argv)
19181 {
19182     char buf[1024];
19183     int i;
19184     char *bp = buf;
19185     while (1) {
19186         while ((i = getc(stdin)) != -1
19187                && (*bp++ = i) != '\n'
19188                && bp < &buf[1024])
19189         /* DO NOTHING */ ;
19190         *bp = '\0';
19191         fprintf(stdout, "%s", buf);
19192         fflush(NULL);
19193         if (i == -1)
19194             return 0;
19195         bp = buf;
19196     }
19197 }
19198 EOCP
19199                 fflushNULL="$define"
19200                 set tryp
19201                 if eval $compile; then
19202                     $rm -f tryp.out
19203                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19204                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19205                        $cat >&4 <<EOM
19206 fflush(NULL) seems to behave okay with input streams.
19207 EOM
19208                         fflushNULL="$define"
19209                     else
19210                         $cat >&4 <<EOM
19211 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19212 EOM
19213                         fflushNULL="$undef"
19214                     fi
19215                 fi
19216                 $rm -f core tryp.c tryp.core core.tryp.*
19217                 ;;
19218         '')     $cat >&4 <<EOM
19219 Your fflush(NULL) isn't working (contrary to ANSI C).
19220 EOM
19221                 fflushNULL="$undef"
19222                 ;;
19223         *)      $cat >&4 <<EOM
19224 Cannot figure out whether your fflush(NULL) works or not.
19225 I'm assuming it doesn't (contrary to ANSI C).
19226 EOM
19227                 fflushNULL="$undef"
19228                 ;;
19229         esac
19230         ;;
19231 $define|true|[yY]*)
19232         fflushNULL="$define"
19233         ;;
19234 *)
19235         fflushNULL="$undef"
19236         ;;
19237 esac
19238 : check explicit looping only if NULL did not work, and if the pipe
19239 : bug does not show up on an explicit flush too
19240 case "$fflushNULL" in
19241 "$undef")
19242         $cat >tryp.c <<EOCP
19243 #include <stdio.h>
19244 int
19245 main(int argc, char **argv)
19246 {
19247     char buf[1024];
19248     int i;
19249     char *bp = buf;
19250     while (1) {
19251         while ((i = getc(stdin)) != -1
19252                && (*bp++ = i) != '\n'
19253                && bp < &buf[1024])
19254         /* DO NOTHING */ ;
19255         *bp = '\0';
19256         fprintf(stdout, "%s", buf);
19257         fflush(stdin);
19258         if (i == -1)
19259             return 0;
19260         bp = buf;
19261     }
19262 }
19263 EOCP
19264         set tryp
19265         if eval $compile; then
19266             $rm -f tryp.out
19267             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19268             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19269                $cat >&4 <<EOM
19270 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19271 EOM
19272                 : now check for fflushall behaviour
19273                 case "$fflushall" in
19274                 '')     set try -DTRY_FFLUSH_ALL $output
19275                         if eval $compile; then
19276                                 $cat >&4 <<EOM
19277 (Now testing the other method--but note that this also may fail.)
19278 EOM
19279                                 $run ./try 2>/dev/null
19280                                 code=$?
19281                                 $from try.out
19282                                 if $test -s try.out -a "X$code" = X42; then
19283                                         fflushall="`$cat try.out`"
19284                                 fi
19285                         fi
19286                         $rm_try
19287                         case "$fflushall" in
19288                         x)      $cat >&4 <<EOM
19289 Whew. Flushing explicitly all the stdio streams works.
19290 EOM
19291                                 fflushall="$define"
19292                                 ;;
19293                         '')     $cat >&4 <<EOM
19294 Sigh. Flushing explicitly all the stdio streams doesn't work.
19295 EOM
19296                                 fflushall="$undef"
19297                                 ;;
19298                         *)      $cat >&4 <<EOM
19299 Cannot figure out whether flushing stdio streams explicitly works or not.
19300 I'm assuming it doesn't.
19301 EOM
19302                                 fflushall="$undef"
19303                                 ;;
19304                         esac
19305                         ;;
19306                 "$define"|true|[yY]*)
19307                         fflushall="$define"
19308                         ;;
19309                 *)
19310                         fflushall="$undef"
19311                         ;;
19312                 esac
19313             else
19314                 $cat >&4 <<EOM
19315 All is futile.  Even fflush(stdin) clobbers input pipes!
19316 EOM
19317                 fflushall="$undef"
19318             fi
19319         else
19320             fflushall="$undef"
19321         fi
19322         $rm -f core tryp.c tryp.core core.tryp.*
19323         ;;
19324 *)      fflushall="$undef"
19325         ;;
19326 esac
19327
19328 case "$fflushNULL$fflushall" in
19329 undefundef)
19330         $cat <<EOM
19331 OK, I give up.  I cannot figure out how to flush pending stdio output.
19332 We won't be flushing handles at all before fork/exec/popen.
19333 EOM
19334         ;;
19335 esac
19336 $rm_try tryp
19337
19338 : Store the full pathname to the ar program for use in the C program
19339 : Respect a hint or command line value for full_ar.
19340 case "$full_ar" in
19341 '') full_ar=$ar ;;
19342 esac
19343
19344 : Store the full pathname to the sed program for use in the C program
19345 full_sed=$sed
19346
19347 : see what type gids are declared as in the kernel
19348 echo " "
19349 echo "Looking for the type for group ids returned by getgid()."
19350 set gid_t gidtype xxx stdio.h sys/types.h
19351 eval $typedef
19352 case "$gidtype" in
19353 xxx)
19354         xxx=`./findhdr sys/user.h`
19355         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19356         case $1 in
19357         unsigned) dflt="$1 $2" ;;
19358         *) dflt="$1" ;;
19359         esac
19360         ;;
19361 *) dflt="$gidtype";;
19362 esac
19363 case "$gidtype" in
19364 gid_t) echo "gid_t found." ;;
19365 *)      rp="What is the type for group ids returned by getgid()?"
19366         . ./myread
19367         gidtype="$ans"
19368         ;;
19369 esac
19370
19371 : Check the size of GID
19372 echo " "
19373 case "$gidtype" in
19374 *_t) zzz="$gidtype"     ;;
19375 *)   zzz="gid"          ;;
19376 esac
19377 echo "Checking the size of $zzz..." >&4
19378 cat > try.c <<EOCP
19379 #include <sys/types.h>
19380 #include <stdio.h>
19381 #$i_stdlib I_STDLIB
19382 #ifdef I_STDLIB
19383 #include <stdlib.h>
19384 #endif
19385 int main() {
19386     printf("%d\n", (int)sizeof($gidtype));
19387     exit(0);
19388 }
19389 EOCP
19390 set try
19391 if eval $compile_ok; then
19392         yyy=`$run ./try`
19393         case "$yyy" in
19394         '')     gidsize=4
19395                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19396                 ;;
19397         *)      gidsize=$yyy
19398                 echo "Your $zzz is $gidsize bytes long."
19399                 ;;
19400         esac
19401 else
19402         gidsize=4
19403         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19404 fi
19405
19406
19407 : Check if GID is signed
19408 echo " "
19409 case "$gidtype" in
19410 *_t) zzz="$gidtype"     ;;
19411 *)   zzz="gid"          ;;
19412 esac
19413 echo "Checking the sign of $zzz..." >&4
19414 cat > try.c <<EOCP
19415 #include <sys/types.h>
19416 #include <stdio.h>
19417 int main() {
19418         $gidtype foo = -1;
19419         if (foo < 0)
19420                 printf("-1\n");
19421         else
19422                 printf("1\n");
19423 }
19424 EOCP
19425 set try
19426 if eval $compile; then
19427         yyy=`$run ./try`
19428         case "$yyy" in
19429         '')     gidsign=1
19430                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19431                 ;;
19432         *)      gidsign=$yyy
19433                 case "$gidsign" in
19434                  1) echo "Your $zzz is unsigned." ;;
19435                 -1) echo "Your $zzz is signed."   ;;
19436                 esac
19437                 ;;
19438         esac
19439 else
19440         gidsign=1
19441         echo "(I can't compile the test program--guessing unsigned.)" >&4
19442 fi
19443
19444
19445 : Check 64bit sizes
19446 echo " "
19447
19448 if $test X"$quadtype" != X; then
19449
19450 echo "Checking how to print 64-bit integers..." >&4
19451
19452 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19453         $cat >try.c <<'EOCP'
19454 #include <sys/types.h>
19455 #include <stdio.h>
19456 int main() {
19457   int q = 12345678901;
19458   printf("%ld\n", q);
19459 }
19460 EOCP
19461         set try
19462         if eval $compile; then
19463                 yyy=`$run ./try`
19464                 case "$yyy" in
19465                 12345678901)
19466                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19467                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19468                         echo "We will use %d."
19469                         ;;
19470                 esac
19471         fi
19472 fi
19473
19474 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19475         $cat >try.c <<'EOCP'
19476 #include <sys/types.h>
19477 #include <stdio.h>
19478 int main() {
19479   long q = 12345678901;
19480   printf("%ld\n", q);
19481 }
19482 EOCP
19483         set try
19484         if eval $compile; then
19485                 yyy=`$run ./try`
19486                 case "$yyy" in
19487                 12345678901)
19488                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19489                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19490                         echo "We will use %ld."
19491                         ;;
19492                 esac
19493         fi
19494 fi
19495
19496 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19497         $cat >try.c <<'EOCP'
19498 #include <sys/types.h>
19499 #include <inttypes.h>
19500 #include <stdio.h>
19501 int main() {
19502   int64_t q = 12345678901;
19503   printf("%" PRId64 "\n", q);
19504 }
19505 EOCP
19506         set try
19507         if eval $compile; then
19508                 yyy=`$run ./try`
19509                 case "$yyy" in
19510                 12345678901)
19511                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19512                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19513                         echo "We will use the C9X style."
19514                         ;;
19515                 esac
19516         fi
19517 fi
19518
19519 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19520         $cat >try.c <<EOCP
19521 #include <sys/types.h>
19522 #include <stdio.h>
19523 int main() {
19524   $quadtype q = 12345678901;
19525   printf("%Ld\n", q);
19526 }
19527 EOCP
19528         set try
19529         if eval $compile; then
19530                 yyy=`$run ./try`
19531                 case "$yyy" in
19532                 12345678901)
19533                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19534                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19535                         echo "We will use %Ld."
19536                         ;;
19537                 esac
19538         fi
19539 fi
19540
19541 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19542         $cat >try.c <<'EOCP'
19543 #include <sys/types.h>
19544 #include <stdio.h>
19545 int main() {
19546   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19547   printf("%lld\n", q);
19548 }
19549 EOCP
19550         set try
19551         if eval $compile; then
19552                 yyy=`$run ./try`
19553                 case "$yyy" in
19554                 12345678901)
19555                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19556                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19557                         echo "We will use the %lld style."
19558                         ;;
19559                 esac
19560         fi
19561 fi
19562
19563 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19564         $cat >try.c <<EOCP
19565 #include <sys/types.h>
19566 #include <stdio.h>
19567 int main() {
19568   $quadtype q = 12345678901;
19569   printf("%qd\n", q);
19570 }
19571 EOCP
19572         set try
19573         if eval $compile; then
19574                 yyy=`$run ./try`
19575                 case "$yyy" in
19576                 12345678901)
19577                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19578                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19579                         echo "We will use %qd."
19580                         ;;
19581                 esac
19582         fi
19583 fi
19584
19585 if $test X"$sPRId64" = X; then
19586         echo "Cannot figure out how to print 64-bit integers." >&4
19587 fi
19588 $rm_try
19589
19590 fi
19591
19592 case "$sPRId64" in
19593 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19594         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19595         ;;
19596 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19597         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19598         ;;
19599 esac
19600
19601 : Check format strings for internal types
19602 echo " "
19603 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19604
19605 if $test X"$ivsize" = X8; then
19606         ivdformat="$sPRId64"
19607         uvuformat="$sPRIu64"
19608         uvoformat="$sPRIo64"
19609         uvxformat="$sPRIx64"
19610         uvXUformat="$sPRIXU64"
19611 else
19612         if $test X"$ivsize" = X"$longsize"; then
19613                 ivdformat='"ld"'
19614                 uvuformat='"lu"'
19615                 uvoformat='"lo"'
19616                 uvxformat='"lx"'
19617                 uvXUformat='"lX"'
19618         else
19619                 if $test X"$ivsize" = X"$intsize"; then
19620                         ivdformat='"d"'
19621                         uvuformat='"u"'
19622                         uvoformat='"o"'
19623                         uvxformat='"x"'
19624                         uvXUformat='"X"'
19625                 else
19626                         : far out
19627                         if $test X"$ivsize" = X"$shortsize"; then
19628                                 ivdformat='"hd"'
19629                                 uvuformat='"hu"'
19630                                 uvoformat='"ho"'
19631                                 uvxformat='"hx"'
19632                                 uvXUformat='"hX"'
19633                         fi
19634                 fi
19635         fi
19636 fi
19637
19638 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19639         nveformat="$sPRIeldbl"
19640         nvfformat="$sPRIfldbl"
19641         nvgformat="$sPRIgldbl"
19642         nvEUformat="$sPRIEUldbl"
19643         nvFUformat="$sPRIFUldbl"
19644         nvGUformat="$sPRIGUldbl"
19645 else
19646         nveformat='"e"'
19647         nvfformat='"f"'
19648         nvgformat='"g"'
19649         nvEUformat='"E"'
19650         nvFUformat='"F"'
19651         nvGUformat='"G"'
19652 fi
19653
19654 case "$ivdformat" in
19655 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19656     exit 1
19657     ;;
19658 esac
19659
19660 : Check format string for GID
19661
19662 echo " "
19663 $echo "Checking the format string to be used for gids..." >&4
19664
19665 case "$gidsign" in
19666 -1)     if $test X"$gidsize" = X"$ivsize"; then
19667                 gidformat="$ivdformat"
19668         else
19669                 if $test X"$gidsize" = X"$longsize"; then
19670                         gidformat='"ld"'
19671                 else
19672                         if $test X"$gidsize" = X"$intsize"; then
19673                                 gidformat='"d"'
19674                         else
19675                                 if $test X"$gidsize" = X"$shortsize"; then
19676                                         gidformat='"hd"'
19677                                 fi
19678                         fi
19679                 fi
19680         fi
19681         ;;
19682 *)      if $test X"$gidsize" = X"$uvsize"; then
19683                 gidformat="$uvuformat"
19684         else
19685                 if $test X"$gidsize" = X"$longsize"; then
19686                         gidformat='"lu"'
19687                 else
19688                         if $test X"$gidsize" = X"$intsize"; then
19689                                 gidformat='"u"'
19690                         else
19691                                 if $test X"$gidsize" = X"$shortsize"; then
19692                                         gidformat='"hu"'
19693                                 fi
19694                         fi
19695                 fi
19696         fi
19697         ;;
19698 esac
19699
19700 : see if getgroups exists
19701 set getgroups d_getgrps
19702 eval $inlibc
19703
19704 : see if setgroups exists
19705 set setgroups d_setgrps
19706 eval $inlibc
19707
19708 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19709 echo " "
19710 case "$d_getgrps$d_setgrps" in
19711 *define*)
19712         case "$groupstype" in
19713         '') dflt="$gidtype" ;;
19714         *)  dflt="$groupstype" ;;
19715         esac
19716         $cat <<EOM
19717 What type of pointer is the second argument to getgroups() and setgroups()?
19718 Usually this is the same as group ids, $gidtype, but not always.
19719
19720 EOM
19721         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19722         . ./myread
19723         groupstype="$ans"
19724         ;;
19725 *)  groupstype="$gidtype";;
19726 esac
19727
19728 : MAD = Misc Attribute Definition
19729
19730 if $test $patchlevel -lt 9; then
19731 : MAD is not available in 5.8.x or earlier.
19732     ans=n;
19733 else
19734     case "$mad" in
19735     $define|true|[yY]*) dflt='y' ;;
19736     *)                  dflt='n' ;;
19737     esac
19738     cat <<EOM
19739
19740 Would you like to build with Misc Attribute Decoration? This is development
19741 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19742 overhead on the interpreter.
19743
19744 If this doesn't make any sense to you, just accept the default '$dflt'.
19745 EOM
19746     rp='Build Perl with MAD?'
19747     . ./myread
19748 fi
19749 case "$ans" in
19750 y|Y)    val="$define"
19751         madlyh='madly.h madly.act madly.tab'
19752         madlysrc='madly.c'
19753         madlyobj="madly$_o" ;;
19754 *)      val="$undef"
19755         madlyh=''
19756         madlysrc=''
19757         madlyobj='' ;;
19758 esac
19759 set mad
19760 eval $setvar
19761
19762 : check whether make sets MAKE
19763 echo " "
19764 echo "Checking if your $make program sets \$(MAKE)..." >&4
19765 case "$make_set_make" in
19766 '')
19767         $sed 's/^X //' > testmake.mak << 'EOF'
19768 Xall:
19769 X       @echo 'maketemp="$(MAKE)"'
19770 EOF
19771         case "`$make -f testmake.mak 2>/dev/null`" in
19772         *maketemp=*) make_set_make='#' ;;
19773         *)      make_set_make="MAKE=$make" ;;
19774         esac
19775         $rm -f testmake.mak
19776         ;;
19777 esac
19778 case "$make_set_make" in
19779 '#') echo "Yup, it does.";;
19780 *) echo "Nope, it doesn't.";;
19781 esac
19782
19783 : see what type is used for mode_t
19784 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19785 set mode_t modetype int stdio.h sys/types.h
19786 eval $typedef_ask
19787
19788 : see if we need va_copy
19789 echo " "
19790 case "$i_stdarg" in
19791 "$define")
19792         $cat >try.c <<EOCP
19793 #include <stdarg.h>
19794 #include <stdio.h>
19795 #$i_stdlib I_STDLIB
19796 #ifdef I_STDLIB
19797 #include <stdlib.h>
19798 #endif
19799 #include <signal.h>
19800
19801 int
19802 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19803 {
19804   return vfprintf(f, fmt, *valp);
19805 }
19806
19807 int
19808 myvfprintf(FILE *f, const  char *fmt, va_list val)
19809 {
19810   return ivfprintf(f, fmt, &val);
19811 }
19812
19813 int
19814 myprintf(char *fmt, ...)
19815 {
19816   va_list val;
19817   va_start(val, fmt);
19818   return myvfprintf(stdout, fmt, val);
19819 }
19820
19821 int
19822 main(int ac, char **av)
19823 {
19824   signal(SIGSEGV, exit);
19825
19826   myprintf("%s%cs all right, then\n", "that", '\'');
19827   exit(0);
19828 }
19829 EOCP
19830         set try
19831         if eval $compile && $run ./try 2>&1 >/dev/null; then
19832                 case "`$run ./try`" in
19833                 "that's all right, then")
19834                         okay=yes
19835                         ;;
19836                 esac
19837         fi
19838         case "$okay" in
19839         yes)    echo "It seems that you don't need va_copy()." >&4
19840                 need_va_copy="$undef"
19841                 ;;
19842         *)      echo "It seems that va_copy() or similar will be needed." >&4
19843                 need_va_copy="$define"
19844                 ;;
19845         esac
19846         $rm_try
19847         ;;
19848 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19849         ;;
19850 esac
19851
19852 : see what type is used for size_t
19853 rp="What is the type used for the length parameter for string functions?"
19854 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19855 eval $typedef_ask
19856
19857 : check for type of arguments to gethostbyaddr. 
19858 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19859         case "$d_gethbyaddr" in
19860         $define)
19861                 $cat <<EOM
19862
19863 Checking to see what type of arguments are accepted by gethostbyaddr().
19864 EOM
19865                 hdrs="$define sys/types.h
19866                         $d_socket sys/socket.h 
19867                         $i_niin netinet/in.h 
19868                         $i_netdb netdb.h
19869                         $i_unistd unistd.h"
19870                 : The first arg can 'char *' or 'void *'
19871                 : The second arg is some of integral type
19872                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19873                         for yyy in size_t long int; do
19874                                 case "$netdb_host_type" in
19875                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
19876                                         if ./protochk "$try" $hdrs; then
19877                                                 echo "Your system accepts $xxx for the first arg."
19878                                                 echo "...and $yyy for the second arg."
19879                                                 netdb_host_type="$xxx"
19880                                                 netdb_hlen_type="$yyy"
19881                                         fi
19882                                         ;;
19883                                 esac
19884                         done
19885                 done
19886                 : In case none of those worked, prompt the user.
19887                 case "$netdb_host_type" in
19888                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19889                         dflt='char *'
19890                         . ./myread
19891                         netdb_host_type=$ans
19892                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19893                         dflt="$sizetype"
19894                         . ./myread
19895                         netdb_hlen_type=$ans
19896                         ;;
19897                 esac
19898                 ;;
19899         *)      : no gethostbyaddr, so pick harmless defaults
19900                 netdb_host_type='char *'
19901                 netdb_hlen_type="$sizetype"
19902                 ;;
19903         esac
19904         # Remove the "const" if needed. -- but then we'll have a 
19905         # prototype clash!
19906         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19907 fi
19908
19909 : check for type of argument to gethostbyname. 
19910 if test "X$netdb_name_type" = X ; then
19911         case "$d_gethbyname" in
19912         $define)
19913                 $cat <<EOM
19914
19915 Checking to see what type of argument is accepted by gethostbyname().
19916 EOM
19917                 hdrs="$define sys/types.h
19918                         $d_socket sys/socket.h 
19919                         $i_niin netinet/in.h 
19920                         $i_netdb netdb.h
19921                         $i_unistd unistd.h"
19922                 for xxx in "const char *" "char *"; do
19923                         case "$netdb_name_type" in
19924                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
19925                                 if ./protochk "$try" $hdrs; then
19926                                         echo "Your system accepts $xxx."
19927                                         netdb_name_type="$xxx"
19928                                 fi
19929                                 ;;
19930                         esac
19931                 done
19932                 : In case none of those worked, prompt the user.
19933                 case "$netdb_name_type" in
19934                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19935                         dflt='char *'
19936                         . ./myread
19937                         netdb_name_type=$ans
19938                         ;;
19939                 esac
19940                 ;;
19941         *)      : no gethostbyname, so pick harmless default
19942                 netdb_name_type='char *'
19943                 ;;
19944         esac
19945 fi
19946
19947 : check for type of 1st argument to getnetbyaddr. 
19948 if test "X$netdb_net_type" = X ; then
19949         case "$d_getnbyaddr" in
19950         $define)
19951                 $cat <<EOM
19952
19953 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19954 EOM
19955                 hdrs="$define sys/types.h
19956                         $d_socket sys/socket.h 
19957                         $i_niin netinet/in.h 
19958                         $i_netdb netdb.h
19959                         $i_unistd unistd.h"
19960                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19961                         case "$netdb_net_type" in
19962                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
19963                                 if ./protochk "$try" $hdrs; then
19964                                         echo "Your system accepts $xxx."
19965                                         netdb_net_type="$xxx"
19966                                 fi
19967                                 ;;
19968                         esac
19969                 done
19970                 : In case none of those worked, prompt the user.
19971                 case "$netdb_net_type" in
19972                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19973                         dflt='long'
19974                         . ./myread
19975                         netdb_net_type=$ans
19976                         ;;
19977                 esac
19978                 ;;
19979         *)      : no getnetbyaddr, so pick harmless default
19980                 netdb_net_type='long'
19981                 ;;
19982         esac
19983 fi
19984 : locate the preferred pager for this system
19985 fn=f/
19986 case "$pager" in
19987 '')
19988         dflt=''
19989         case "$pg" in
19990         /*) dflt=$pg;;
19991         [a-zA-Z]:/*) dflt=$pg;;
19992         esac
19993         case "$more" in
19994         /*) dflt=$more;;
19995         [a-zA-Z]:/*) dflt=$more;;
19996         esac
19997         case "$less" in
19998         /*) dflt=$less;;
19999         [a-zA-Z]:/*) dflt=$less;;
20000         esac
20001         case "$dflt" in
20002         '') dflt=/usr/ucb/more;;
20003         esac
20004         ;;
20005 *)      dflt="$pager"
20006         fn="f/($pager)"
20007         ;;
20008 esac
20009 echo " "
20010 rp='What pager is used on your system?'
20011 . ./getfile
20012 pager="$ans"
20013
20014 : see what type pids are declared as in the kernel
20015 rp="What is the type of process ids on this system?"
20016 set pid_t pidtype int stdio.h sys/types.h
20017 eval $typedef_ask
20018
20019 : see if ar generates random libraries by itself
20020 echo " "
20021 echo "Checking how to generate random libraries on your machine..." >&4
20022 echo 'int bar1() { return bar2(); }' > bar1.c
20023 echo 'int bar2() { return 2; }' > bar2.c
20024 $cat > foo.c <<EOP
20025 #$i_stdlib I_STDLIB
20026 #ifdef I_STDLIB
20027 #include <stdlib.h>
20028 #endif
20029 int main() { printf("%d\n", bar1()); exit(0); }
20030 EOP
20031 $cc $ccflags -c bar1.c >/dev/null 2>&1
20032 $cc $ccflags -c bar2.c >/dev/null 2>&1
20033 $cc $ccflags -c foo.c >/dev/null 2>&1
20034 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20035 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20036         $run ./foobar >/dev/null 2>&1; then
20037         echo "$ar appears to generate random libraries itself."
20038         orderlib=false
20039         if [ "X$ranlib" = "X" ]; then
20040             ranlib=":"
20041         fi
20042 elif $ar s bar$_a >/dev/null 2>&1 &&
20043         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20044         $run ./foobar >/dev/null 2>&1; then
20045                 echo "a table of contents needs to be added with '$ar s'."
20046                 orderlib=false
20047                 ranlib="$ar s"
20048 elif $ar ts bar$_a >/dev/null 2>&1 &&
20049         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20050         $run ./foobar >/dev/null 2>&1; then
20051                 echo "a table of contents needs to be added with '$ar ts'."
20052                 orderlib=false
20053                 ranlib="$ar ts"
20054 else
20055         case "$ranlib" in
20056         :) ranlib='';;
20057         '')
20058                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20059                 $test -f $ranlib || ranlib=''
20060                 ;;
20061         esac
20062         if $test -n "$ranlib"; then
20063                 echo "your system has '$ranlib'; we'll use that."
20064                 orderlib=false
20065         else
20066                 echo "your system doesn't seem to support random libraries"
20067                 echo "so we'll use lorder and tsort to order the libraries."
20068                 orderlib=true
20069                 ranlib=":"
20070         fi
20071 fi
20072 $rm -f foo* bar*
20073
20074 : see if this is a values.h system
20075 set values.h i_values
20076 eval $inhdr
20077
20078 : Check the max offset that gmtime and localtime accept
20079 echo "Checking max offsets that gmtime () accepts"
20080
20081 case $i_values in
20082     define) yyy="#include <values.h>" ;;
20083     *)      yyy="" ;;
20084     esac
20085
20086 case "$sGMTIME_min/$sGMTIME_max" in
20087     0/0|/)
20088         $cat >try.c <<EOCP
20089 #include <sys/types.h>
20090 #include <stdio.h>
20091 #include <time.h>
20092 $yyy
20093
20094 int i;
20095 struct tm *tmp;
20096 time_t pt;
20097
20098 void gm_check (time_t t, int min_year, int max_year)
20099 {
20100     tmp = gmtime (&t);
20101     if ( tmp == NULL ||
20102         /* Check tm_year overflow */
20103          tmp->tm_year < min_year || tmp->tm_year > max_year)
20104         tmp = NULL;
20105     else
20106         pt = t;
20107     } /* gm_check */
20108
20109 int check_max ()
20110 {
20111     tmp = NULL;
20112     pt  = 0;
20113 #ifdef MAXLONG
20114     gm_check (MAXLONG, 69, 0x7fffffff);
20115 #endif
20116     if (tmp == NULL || tmp->tm_year < 0) {
20117         for (i = 63; i >= 0; i--) {
20118             time_t x = pt | ((time_t)1 << i);
20119             if (x < 0 || x < pt) continue;
20120             gm_check (x, 69, 0x7fffffff);
20121             }
20122         }
20123     printf ("sGMTIME_max=%ld\n", pt);
20124     return (0);
20125     } /* check_max */
20126
20127 int check_min ()
20128 {
20129     tmp = NULL;
20130     pt  = 0;
20131 #ifdef MINLONG
20132     gm_check (MINLONG, -1900, 70);
20133 #endif
20134     if (tmp == NULL) {
20135         for (i = 36; i >= 0; i--) {
20136             time_t x = pt - ((time_t)1 << i);
20137             if (x > 0) continue;
20138             gm_check (x, -1900, 70);
20139             }
20140         }
20141     printf ("sGMTIME_min=%ld\n", pt);
20142     return (0);
20143     } /* check_min */
20144
20145 int main (int argc, char *argv[])
20146 {
20147     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20148     check_max ();
20149     check_min ();
20150     return (0);
20151     } /* main */
20152 EOCP
20153         set try
20154         if eval $compile; then
20155             eval `$run ./try`
20156         else
20157             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20158             fi
20159         $rm_try
20160         ;;
20161     esac
20162
20163 echo "Checking max offsets that localtime () accepts"
20164
20165 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20166     0/0|/)
20167         $cat >try.c <<EOCP
20168 #include <sys/types.h>
20169 #include <stdio.h>
20170 #include <time.h>
20171 $yyy
20172
20173 int i;
20174 struct tm *tmp;
20175 time_t pt;
20176
20177 void local_check (time_t t, int min_year, int max_year)
20178 {
20179     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20180         tmp = NULL;
20181     else
20182         tmp = localtime (&t);
20183     if ( tmp == NULL ||
20184         /* Check tm_year overflow */
20185          tmp->tm_year < min_year || tmp->tm_year > max_year)
20186         tmp = NULL;
20187     else
20188         pt = t;
20189     } /* local_check */
20190
20191 int check_max ()
20192 {
20193     tmp = NULL;
20194     pt  = 0;
20195 #ifdef MAXLONG
20196     local_check (MAXLONG, 69, 0x7fffffff);
20197 #endif
20198     if (tmp == NULL || tmp->tm_year < 0) {
20199         for (i = 63; i >= 0; i--) {
20200             time_t x = pt | ((time_t)1 << i);
20201             if (x < 0 || x < pt) continue;
20202             local_check (x, 69, 0x7fffffff);
20203             }
20204         }
20205     printf ("sLOCALTIME_max=%ld\n", pt);
20206     return (0);
20207    } /* check_max */
20208
20209 int check_min ()
20210 {
20211     tmp = NULL;
20212     pt  = 0;
20213 #ifdef MINLONG
20214     local_check (MINLONG, -1900, 70);
20215 #endif
20216     if (tmp == NULL) {
20217         for (i = 36; i >= 0; i--) {
20218             time_t x = pt - ((time_t)1 << i);
20219             if (x > 0) continue;
20220             local_check (x, -1900, 70);
20221             }
20222         }
20223     printf ("sLOCALTIME_min=%ld\n", pt);
20224     return (0);
20225     } /* check_min */
20226
20227 int main (int argc, char *argv[])
20228 {
20229     check_max ();
20230     check_min ();
20231     return (0);
20232     } /* main */
20233 EOCP
20234         set try
20235         if eval $compile; then
20236             eval `$run ./try`
20237         else
20238             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20239             fi
20240         $rm_try
20241         ;;
20242     esac
20243
20244 : check for type of arguments to select.
20245 case "$selecttype" in
20246 '') case "$d_select" in
20247         $define)
20248                 echo " "
20249                 $cat <<EOM
20250 Checking to see what type of arguments are accepted by select().
20251 EOM
20252                 hdrs="$define sys/types.h
20253                         $i_systime sys/time.h
20254                         $i_sysselct sys/select.h
20255                         $d_socket sys/socket.h"
20256                 : The first arg can be int, unsigned, or size_t
20257                 : The last arg may or may not be 'const'
20258                 val=''
20259                 : void pointer has been seen but using that
20260                 : breaks the selectminbits test
20261                 for xxx in 'fd_set *' 'int *'; do
20262                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20263                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20264                                         case "$val" in
20265                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20266                                                 if ./protochk "$try" $hdrs; then
20267                                                         echo "Your system accepts $xxx."
20268                                                         val="$xxx"
20269                                                 fi
20270                                                 ;;
20271                                         esac
20272                                 done
20273                         done
20274                 done
20275                 case "$val" in
20276                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20277                         case "$d_fd_set" in
20278                                 $define) dflt="fd_set *" ;;
20279                                 *)              dflt="int *" ;;
20280                         esac
20281                         . ./myread
20282                         val=$ans
20283                         ;;
20284                 esac
20285                 selecttype="$val"
20286                 ;;
20287         *)      : no select, so pick a harmless default
20288                 selecttype='int *'
20289                 ;;
20290         esac
20291         ;;
20292 esac
20293
20294 : check for the select 'width'
20295 case "$selectminbits" in
20296 '') safebits=`expr $ptrsize \* 8`
20297     case "$d_select" in
20298         $define)
20299                 $cat <<EOM
20300
20301 Checking to see on how many bits at a time your select() operates...
20302 EOM
20303                 $cat >try.c <<EOCP
20304 #include <sys/types.h>
20305 #$i_time I_TIME
20306 #$i_systime I_SYS_TIME
20307 #$i_systimek I_SYS_TIME_KERNEL
20308 #ifdef I_TIME
20309 #   include <time.h>
20310 #endif
20311 #ifdef I_SYS_TIME
20312 #   ifdef I_SYS_TIME_KERNEL
20313 #       define KERNEL
20314 #   endif
20315 #   include <sys/time.h>
20316 #   ifdef I_SYS_TIME_KERNEL
20317 #       undef KERNEL
20318 #   endif
20319 #endif
20320 #$i_sysselct I_SYS_SELECT
20321 #ifdef I_SYS_SELECT
20322 #include <sys/select.h>
20323 #endif
20324 #$d_socket HAS_SOCKET
20325 #ifdef HAS_SOCKET
20326 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20327 #endif
20328 #include <stdio.h>
20329 #$i_stdlib I_STDLIB
20330 #ifdef I_STDLIB
20331 #include <stdlib.h>
20332 #endif
20333 $selecttype b;
20334 #define S sizeof(*(b))
20335 #define MINBITS 64
20336 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20337 #define NBITS  (NBYTES * 8)
20338 int main() {
20339     char *s = (char *)malloc(NBYTES);
20340     struct timeval t;
20341     int i;
20342     FILE* fp;
20343     int fd;
20344
20345     if (!s)
20346         exit(1);
20347     fclose(stdin);
20348     fp = fopen("try.c", "r");
20349     if (fp == 0)
20350       exit(2);
20351     fd = fileno(fp);
20352     if (fd < 0)
20353       exit(3);
20354     b = ($selecttype)s;
20355     for (i = 0; i < NBITS; i++)
20356         FD_SET(i, b);
20357     t.tv_sec  = 0;
20358     t.tv_usec = 0;
20359     select(fd + 1, b, 0, 0, &t);
20360     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20361     free(s);
20362     printf("%d\n", i + 1);
20363     return 0;
20364 }
20365 EOCP
20366                 set try
20367                 if eval $compile_ok; then
20368                         selectminbits=`$run ./try`
20369                         case "$selectminbits" in
20370                         '')     cat >&4 <<EOM
20371 Cannot figure out on how many bits at a time your select() operates.
20372 I'll play safe and guess it is $safebits bits.
20373 EOM
20374                                 selectminbits=$safebits
20375                                 bits="$safebits bits"
20376                                 ;;
20377                         1)      bits="1 bit" ;;
20378                         *)      bits="$selectminbits bits" ;;
20379                         esac
20380                         echo "Your select() operates on $bits at a time." >&4
20381                 else
20382                         rp='What is the minimum number of bits your select() operates on?'
20383                         case "$byteorder" in
20384                         12345678)       dflt=64 ;;
20385                         1234)           dflt=32 ;;
20386                         *)              dflt=1  ;;
20387                         esac
20388                         . ./myread
20389                         val=$ans
20390                         selectminbits="$val"
20391                 fi
20392                 $rm_try
20393                 ;;
20394         *)      : no select, so pick a harmless default
20395                 selectminbits=$safebits
20396                 ;;
20397         esac
20398         ;;
20399 esac
20400
20401 : Trace out the files included by signal.h, then look for SIGxxx names.
20402 if [ "X$fieldn" = X ]; then
20403         : Just make some guesses.  We check them later.
20404         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20405 else
20406         xxx=`echo '#include <signal.h>' |
20407         $cppstdin $cppminus $cppflags 2>/dev/null |
20408         $grep '^[       ]*#.*include' |
20409         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20410                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20411 fi
20412 xxxfiles=''
20413 for xx in $xxx /dev/null ; do
20414         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20415 done
20416 case "$xxxfiles" in
20417 '')     xxxfiles=`./findhdr signal.h` ;;
20418 esac
20419 xxx=`awk '
20420 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20421         print substr($2, 4, 20)
20422 }
20423 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20424         print substr($3, 4, 20)
20425 }' $xxxfiles`
20426 : Append some common names just in case the awk scan failed.
20427 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20428 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20429 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20430 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20431 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20432
20433 : generate a few handy files for later
20434 $cat > signal.c <<EOCP
20435 #include <sys/types.h>
20436 #include <signal.h>
20437 #$i_stdlib I_STDLIB
20438 #ifdef I_STDLIB
20439 #include <stdlib.h>
20440 #endif
20441 #include <stdio.h>
20442 int main() {
20443
20444 /* Strange style to avoid deeply-nested #if/#else/#endif */
20445 #ifndef NSIG
20446 #  ifdef _NSIG
20447 #    define NSIG (_NSIG)
20448 #  endif
20449 #endif
20450
20451 #ifndef NSIG
20452 #  ifdef SIGMAX
20453 #    define NSIG (SIGMAX+1)
20454 #  endif
20455 #endif
20456
20457 #ifndef NSIG
20458 #  ifdef SIG_MAX
20459 #    define NSIG (SIG_MAX+1)
20460 #  endif
20461 #endif
20462
20463 #ifndef NSIG
20464 #  ifdef _SIG_MAX
20465 #    define NSIG (_SIG_MAX+1)
20466 #  endif
20467 #endif
20468
20469 #ifndef NSIG
20470 #  ifdef MAXSIG
20471 #    define NSIG (MAXSIG+1)
20472 #  endif
20473 #endif
20474
20475 #ifndef NSIG
20476 #  ifdef MAX_SIG
20477 #    define NSIG (MAX_SIG+1)
20478 #  endif
20479 #endif
20480
20481 #ifndef NSIG
20482 #  ifdef SIGARRAYSIZE
20483 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20484 #  endif
20485 #endif
20486
20487 #ifndef NSIG
20488 #  ifdef _sys_nsig
20489 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20490 #  endif
20491 #endif
20492
20493 /* Default to some arbitrary number that's big enough to get most
20494    of the common signals.
20495 */
20496 #ifndef NSIG
20497 #    define NSIG 50
20498 #endif
20499
20500 printf("NSIG %d\n", NSIG);
20501
20502 #ifndef JUST_NSIG
20503
20504 EOCP
20505
20506 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20507 {
20508         printf "#ifdef SIG"; printf $1; printf "\n"
20509         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20510         printf $1; printf ");\n"
20511         printf "#endif\n"
20512 }
20513 END {
20514         printf "#endif /* JUST_NSIG */\n";
20515         printf "exit(0);\n}\n";
20516 }
20517 ' >>signal.c
20518 $cat >signal.awk <<'EOP'
20519 BEGIN { ndups = 0 }
20520 $1 ~ /^NSIG$/ { nsig = $2 }
20521 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20522     if ($2 > maxsig) { maxsig = $2 }
20523     if (sig_name[$2]) {
20524         dup_name[ndups] = $1
20525         dup_num[ndups] = $2
20526         ndups++
20527     }
20528     else {
20529         sig_name[$2] = $1
20530         sig_num[$2] = $2
20531     }
20532 }
20533 END {
20534     if (nsig == 0) {
20535         nsig = maxsig + 1
20536     }
20537     printf("NSIG %d\n", nsig);
20538     for (n = 1; n < nsig; n++) {
20539         if (sig_name[n]) {
20540             printf("%s %d\n", sig_name[n], sig_num[n])
20541         }
20542         else {
20543             printf("NUM%d %d\n", n, n)
20544         }
20545     }
20546     for (n = 0; n < ndups; n++) {
20547         printf("%s %d\n", dup_name[n], dup_num[n])
20548     }
20549 }
20550 EOP
20551 $cat >signal_cmd <<EOS
20552 $startsh
20553 if $test -s signal.lst; then
20554     echo "Using your existing signal.lst file"
20555         exit 0
20556 fi
20557 xxx="$xxx"
20558 EOS
20559 $cat >>signal_cmd <<'EOS'
20560
20561 set signal
20562 if eval $compile_ok; then
20563         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20564                 $uniq | $awk -f signal.awk >signal.lst
20565 else
20566         echo "(I can't seem be able to compile the whole test program)" >&4
20567         echo "(I'll try it in little pieces.)" >&4
20568         set signal -DJUST_NSIG
20569         if eval $compile_ok; then
20570                 $run ./signal$_exe > signal.nsg
20571                 $cat signal.nsg
20572         else
20573                 echo "I can't seem to figure out how many signals you have." >&4
20574                 echo "Guessing 50." >&4
20575                 echo 'NSIG 50' > signal.nsg
20576         fi
20577         : Now look at all the signal names, one at a time.
20578         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20579                 $cat > signal.c <<EOCP
20580 #include <sys/types.h>
20581 #include <signal.h>
20582 #include <stdio.h>
20583 int main() {
20584 printf("$xx %d\n", SIG${xx});
20585 return 0;
20586 }
20587 EOCP
20588                 set signal
20589                 if eval $compile; then
20590                         echo "SIG${xx} found."
20591                         $run ./signal$_exe  >> signal.ls1
20592                 else
20593                         echo "SIG${xx} NOT found."
20594                 fi
20595         done
20596         if $test -s signal.ls1; then
20597                 $cat signal.nsg signal.ls1 |
20598                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20599         fi
20600
20601 fi
20602 if $test -s signal.lst; then
20603         :
20604 else
20605         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20606         echo 'kill -l' >signal
20607         set X `csh -f <signal`
20608         $rm -f signal
20609         shift
20610         case $# in
20611         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20612         esac
20613         echo $@ | $tr ' ' $trnl | \
20614             $awk '{ printf "%s %d\n", $1, ++s; }
20615                   END { printf "NSIG %d\n", ++s }' >signal.lst
20616 fi
20617 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20618 EOS
20619 chmod a+x signal_cmd
20620 $eunicefix signal_cmd
20621
20622 : generate list of signal names
20623 echo " "
20624 case "$sig_name_init" in
20625 '') doinit=yes ;;
20626 *)  case "$sig_num_init" in
20627     ''|*,*) doinit=yes ;;
20628     esac ;;
20629 esac
20630 case "$doinit" in
20631 yes)
20632         echo "Generating a list of signal names and numbers..." >&4
20633         . ./signal_cmd
20634         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20635         sig_name=`$awk 'BEGIN { printf "ZERO " }
20636                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20637         sig_num=`$awk  'BEGIN { printf "0 " }
20638                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20639         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20640                              !/^NSIG/   { printf "\"%s\", ", $1 }
20641                              END        { printf "0\n" }' signal.lst`
20642         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20643                              !/^NSIG/   { printf "%d, ", $2}
20644                              END        { printf "0\n"}' signal.lst`
20645         ;;
20646 esac
20647 echo "The following $sig_count signals are available:"
20648 echo " "
20649 echo $sig_name | $awk \
20650 'BEGIN { linelen = 0 }
20651 {
20652         for (i = 1; i <= NF; i++) {
20653                 name = "SIG" $i " "
20654                 linelen = linelen + length(name)
20655                 if (linelen > 70) {
20656                         printf "\n"
20657                         linelen = length(name)
20658                 }
20659                 printf "%s", name
20660         }
20661         printf "\n"
20662 }'
20663 sig_size=`echo $sig_name | awk '{print NF}'`
20664 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20665
20666 : Check size of size
20667 echo " "
20668 case "$sizetype" in
20669 *_t) zzz="$sizetype"    ;;
20670 *)   zzz="filesize"     ;;
20671 esac
20672 echo "Checking the size of $zzz..." >&4
20673 cat > try.c <<EOCP
20674 #include <sys/types.h>
20675 #include <stdio.h>
20676 #$i_stdlib I_STDLIB
20677 #ifdef I_STDLIB
20678 #include <stdlib.h>
20679 #endif
20680 int main() {
20681     printf("%d\n", (int)sizeof($sizetype));
20682     exit(0);
20683 }
20684 EOCP
20685 set try
20686 if eval $compile_ok; then
20687         yyy=`$run ./try`
20688         case "$yyy" in
20689         '')     sizesize=4
20690                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20691                 ;;
20692         *)      sizesize=$yyy
20693                 echo "Your $zzz size is $sizesize bytes."
20694                 ;;
20695         esac
20696 else
20697         sizesize=4
20698         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20699 fi
20700
20701
20702 : check for socklen_t
20703 echo " "
20704 echo "Checking to see if you have socklen_t..." >&4
20705 $cat >try.c <<EOCP
20706 #include <sys/types.h>
20707 #$d_socket HAS_SOCKET
20708 #ifdef HAS_SOCKET
20709 #include <sys/socket.h>
20710 #endif
20711 int main() { socklen_t x = 16; }
20712 EOCP
20713 set try
20714 if eval $compile; then
20715         val="$define"
20716         echo "You have socklen_t."
20717 else
20718         val="$undef"
20719         echo "You do not have socklen_t."
20720         case "$sizetype" in
20721         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20722         esac
20723 fi
20724 $rm_try
20725 set d_socklen_t
20726 eval $setvar
20727
20728 : see if this is a socks.h system
20729 set socks.h i_socks
20730 eval $inhdr
20731
20732 : check for type of the size argument to socket calls
20733 case "$d_socket" in
20734 "$define")
20735         $cat <<EOM
20736
20737 Checking to see what type is the last argument of accept().
20738 EOM
20739         yyy=''
20740         case "$d_socklen_t" in
20741         "$define") yyy="$yyy socklen_t"
20742         esac
20743         yyy="$yyy $sizetype int long unsigned"
20744         for xxx in $yyy; do
20745                 case "$socksizetype" in
20746                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
20747                         case "$usesocks" in
20748                         "$define")
20749                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20750                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20751                                         socksizetype="$xxx"
20752                                 fi
20753                                 ;;
20754                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20755                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20756                                         socksizetype="$xxx"
20757                                 fi
20758                                 ;;
20759                         esac
20760                         ;;
20761                 esac
20762         done
20763 : In case none of those worked, prompt the user.
20764         case "$socksizetype" in
20765         '')     rp='What is the type for socket address structure sizes?'
20766                 dflt='int'
20767                 . ./myread
20768                 socksizetype=$ans
20769                 ;;
20770         esac
20771         ;;
20772 *)      : no sockets, so pick relatively harmless default
20773         socksizetype='int'
20774         ;;
20775 esac
20776
20777 : see what type is used for signed size_t
20778 set ssize_t ssizetype int stdio.h sys/types.h
20779 eval $typedef
20780 dflt="$ssizetype"
20781 $cat > try.c <<EOM
20782 #include <stdio.h>
20783 #$i_stdlib I_STDLIB
20784 #ifdef I_STDLIB
20785 #include <stdlib.h>
20786 #endif
20787 #include <sys/types.h>
20788 #define Size_t $sizetype
20789 #define SSize_t $dflt
20790 int main()
20791 {
20792         if (sizeof(Size_t) == sizeof(SSize_t))
20793                 printf("$dflt\n");
20794         else if (sizeof(Size_t) == sizeof(int))
20795                 printf("int\n");
20796         else
20797                 printf("long\n");
20798         exit(0);
20799 }
20800 EOM
20801 echo " "
20802 set try
20803 if eval $compile_ok && $run ./try > /dev/null; then
20804         ssizetype=`$run ./try`
20805         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20806 else
20807         $cat >&4 <<EOM
20808 Help! I can't compile and run the ssize_t test program: please enlighten me!
20809 (This is probably a misconfiguration in your system or libraries, and
20810 you really ought to fix it.  Still, I'll try anyway.)
20811
20812 I need a type that is the same size as $sizetype, but is guaranteed to
20813 be signed.  Common values are ssize_t, int and long.
20814
20815 EOM
20816         rp="What signed type is the same size as $sizetype?"
20817         . ./myread
20818         ssizetype="$ans"
20819 fi
20820 $rm_try
20821
20822 : see what type of char stdio uses.
20823 echo " "
20824 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
20825 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20826         echo "Your stdio uses unsigned chars." >&4
20827         stdchar="unsigned char"
20828 else
20829         echo "Your stdio uses signed chars." >&4
20830         stdchar="char"
20831 fi
20832 $rm -f stdioh
20833
20834 : see what type uids are declared as in the kernel
20835 echo " "
20836 echo "Looking for the type for user ids returned by getuid()."
20837 set uid_t uidtype xxx stdio.h sys/types.h
20838 eval $typedef
20839 case "$uidtype" in
20840 xxx)
20841         xxx=`./findhdr sys/user.h`
20842         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20843         case $1 in
20844         unsigned) dflt="$1 $2" ;;
20845         *) dflt="$1" ;;
20846         esac
20847         ;;
20848 *) dflt="$uidtype";;
20849 esac
20850 case "$uidtype" in
20851 uid_t)  echo "uid_t found." ;;
20852 *)      rp="What is the type for user ids returned by getuid()?"
20853         . ./myread
20854         uidtype="$ans"
20855         ;;
20856 esac
20857
20858 : Check size of UID
20859 echo " "
20860 case "$uidtype" in
20861 *_t) zzz="$uidtype"     ;;
20862 *)   zzz="uid"          ;;
20863 esac
20864 echo "Checking the size of $zzz..." >&4
20865 cat > try.c <<EOCP
20866 #include <sys/types.h>
20867 #include <stdio.h>
20868 #$i_stdlib I_STDLIB
20869 #ifdef I_STDLIB
20870 #include <stdlib.h>
20871 #endif
20872 int main() {
20873     printf("%d\n", (int)sizeof($uidtype));
20874     exit(0);
20875 }
20876 EOCP
20877 set try
20878 if eval $compile_ok; then
20879         yyy=`$run ./try`
20880         case "$yyy" in
20881         '')     uidsize=4
20882                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20883                 ;;
20884         *)      uidsize=$yyy
20885                 echo "Your $zzz is $uidsize bytes long."
20886                 ;;
20887         esac
20888 else
20889         uidsize=4
20890         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20891 fi
20892
20893 : Check if UID is signed
20894 echo " "
20895 case "$uidtype" in
20896 *_t) zzz="$uidtype"     ;;
20897 *)   zzz="uid"          ;;
20898 esac
20899 echo "Checking the sign of $zzz..." >&4
20900 cat > try.c <<EOCP
20901 #include <sys/types.h>
20902 #include <stdio.h>
20903 int main() {
20904         $uidtype foo = -1;
20905         if (foo < 0)
20906                 printf("-1\n");
20907         else
20908                 printf("1\n");
20909 }
20910 EOCP
20911 set try
20912 if eval $compile; then
20913         yyy=`$run ./try`
20914         case "$yyy" in
20915         '')     uidsign=1
20916                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20917                 ;;
20918         *)      uidsign=$yyy
20919                 case "$uidsign" in
20920                  1) echo "Your $zzz is unsigned." ;;
20921                 -1) echo "Your $zzz is signed."   ;;
20922                 esac
20923                 ;;
20924         esac
20925 else
20926         uidsign=1
20927         echo "(I can't compile the test program--guessing unsigned.)" >&4
20928 fi
20929
20930
20931 : Check format string for UID
20932 echo " "
20933 $echo "Checking the format string to be used for uids..." >&4
20934
20935 case "$uidsign" in
20936 -1)     if $test X"$uidsize" = X"$ivsize"; then
20937                 uidformat="$ivdformat"
20938         else
20939                 if $test X"$uidsize" = X"$longsize"; then
20940                         uidformat='"ld"'
20941                 else
20942                         if $test X"$uidsize" = X"$intsize"; then
20943                                 uidformat='"d"'
20944                         else
20945                                 if $test X"$uidsize" = X"$shortsize"; then
20946                                         uidformat='"hd"'
20947                                 fi
20948                         fi
20949                 fi
20950         fi
20951         ;;
20952 *)      if $test X"$uidsize" = X"$uvsize"; then
20953                 uidformat="$uvuformat"
20954         else
20955                 if $test X"$uidsize" = X"$longsize"; then
20956                         uidformat='"lu"'
20957                 else
20958                         if $test X"$uidsize" = X"$intsize"; then
20959                                 uidformat='"u"'
20960                         else
20961                                 if $test X"$uidsize" = X"$shortsize"; then
20962                                         uidformat='"hu"'
20963                                 fi
20964                         fi
20965                 fi
20966         fi
20967         ;;
20968 esac
20969
20970 : Check if site customization support was requested
20971 case "$usesitecustomize" in
20972     $define|true|[Yy]*)
20973         usesitecustomize="$define"
20974         ;;
20975     *)
20976         usesitecustomize="$undef"
20977         ;;
20978     esac
20979
20980 : determine compiler compiler
20981 case "$yacc" in
20982 '')
20983         dflt=yacc;;
20984 *)
20985         dflt="$yacc";;
20986 esac
20987 echo " "
20988 comp='yacc'
20989 if $test -f "$byacc$_exe"; then
20990         dflt="$byacc"
20991         comp="byacc or $comp"
20992 fi
20993 if $test -f "$bison$_exe"; then
20994         comp="$comp or bison -y"
20995 fi
20996 rp="Which compiler compiler ($comp) shall I use?"
20997 . ./myread
20998 yacc="$ans"
20999 case "$yacc" in
21000 *bis*)
21001         case "$yacc" in
21002         *-y*) ;;
21003         *)
21004                 yacc="$yacc -y"
21005                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21006                 ;;
21007         esac
21008         ;;
21009 esac
21010
21011 : see if this is a assert.h system
21012 set assert.h i_assert
21013 eval $inhdr
21014
21015 : see if this is a fp.h system
21016 set fp.h i_fp
21017 eval $inhdr
21018
21019 : see if this is a fp_class.h system
21020 set fp_class.h i_fp_class
21021 eval $inhdr
21022
21023 : see if gdbm.h is available
21024 set gdbm.h t_gdbm
21025 eval $inhdr
21026 case "$t_gdbm" in
21027 $define)
21028         : see if gdbm_open exists
21029         set gdbm_open d_gdbm_open
21030         eval $inlibc
21031         case "$d_gdbm_open" in
21032         $undef)
21033                 t_gdbm="$undef"
21034                 echo "We won't be including <gdbm.h>"
21035                 ;;
21036         esac
21037         ;;
21038 esac
21039 val="$t_gdbm"
21040 set i_gdbm
21041 eval $setvar
21042
21043 : see if ndbm.h is available
21044 set ndbm.h i_ndbm
21045 eval $inhdr
21046 : Compatibility location for RedHat 7.1
21047 set gdbm/ndbm.h i_gdbmndbm
21048 eval $inhdr
21049 : Compatibility location for Debian 4.0
21050 set gdbm-ndbm.h i_gdbm_ndbm
21051 eval $inhdr
21052
21053 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
21054         : see if dbm_open exists
21055         set dbm_open d_dbm_open
21056         eval $inlibc
21057         case "$d_dbm_open" in
21058         $undef)
21059                 i_ndbm="$undef"
21060                 i_gdbmndbm="$undef"
21061                 i_gdbm_ndbm="$undef"
21062                 echo "We won't be including <ndbm.h>"
21063             val="$undef"
21064                 ;;
21065         *) val="$define"
21066            ;;
21067         esac
21068 fi
21069 set d_ndbm
21070 eval $setvar
21071
21072 : see if this is a ieeefp.h system
21073 case "$i_ieeefp" in
21074 '' ) set ieeefp.h i_ieeefp
21075      eval $inhdr
21076      ;;
21077 esac
21078
21079 : see if this is a libutil.h system
21080 set libutil.h i_libutil
21081 eval $inhdr
21082
21083 : see if mach cthreads are available
21084 if test "X$usethreads" = "X$define"; then
21085         set mach/cthreads.h i_machcthr
21086         eval $inhdr
21087 else
21088         i_machcthr="$undef"
21089 fi
21090
21091 : see if this is a mntent.h system
21092 set mntent.h i_mntent
21093 eval $inhdr
21094
21095 : see if net/errno.h is available
21096 val=''
21097 set net/errno.h val
21098 eval $inhdr
21099
21100 : Unfortunately, it causes problems on some systems.  Arrgh.
21101 case "$val" in
21102 $define)
21103         cat > try.c <<'EOM'
21104 #include <stdio.h>
21105 #include <errno.h>
21106 #include <net/errno.h>
21107 int func()
21108 {
21109         return ENOTSOCK;
21110 }
21111 EOM
21112         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21113                 echo "We'll be including <net/errno.h>." >&4
21114         else
21115                 echo "We won't be including <net/errno.h>." >&4
21116                 val="$undef"
21117         fi
21118         $rm_try
21119         ;;
21120 esac
21121 set i_neterrno
21122 eval $setvar
21123
21124 : see if netinet/tcp.h is available
21125 set netinet/tcp.h i_netinettcp
21126 eval $inhdr
21127
21128 : see if this is a poll.h system
21129 set poll.h i_poll
21130 eval $inhdr
21131
21132 : see if this is a prot.h system
21133 set prot.h i_prot
21134 eval $inhdr
21135
21136 : Preprocessor symbols
21137 echo " "
21138 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21139 $cat <<'EOSH' > Cppsym.know
21140 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21141 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21142 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21143 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21144 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21145 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21146 bull c cadmus clipper CMU COFF COMPILER_VERSION
21147 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21148 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21149 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21150 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21151 GLIBC GLIBC_MINOR
21152 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21153 H3050R H3050RX hbullx20 hcx host_mips
21154 hp200 hp300 hp700 HP700 hp800 hp9000
21155 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21156 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21157 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21158 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21159 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21160 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21161 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21162 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21163 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21164 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21165 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21166 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21167 MATH_HAS_NO_SIDE_EFFECTS
21168 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21169 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21170 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21171 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21172 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21173 NetBSD news1500 news1700 news1800 news1900 news3700
21174 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21175 ns32016 ns32332 ns32k nsc32000
21176 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21177 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21178 pc532 pdp11 PGC PIC plexus PORTAR posix
21179 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21180 POSIX_C_SOURCE POSIX_SOURCE POWER
21181 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21182 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21183 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21184 sony sony_news sonyrisc sparc sparclite spectrum
21185 stardent stdc STDC_EXT stratos sun sun3 sun386
21186 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21187 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21188 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21189 sysV68 sysV88 Tek4132 Tek4300 titan
21190 TM3200 TM5400 TM5600
21191 tower tower32 tower32_200 tower32_600 tower32_700
21192 tower32_800 tower32_850 tss
21193 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21194 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21195 unix UNIX95 UNIX99 unixpc unos
21196 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21197 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21198 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21199 USGr4 USGr4_2
21200 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21201 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21202 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21203 z8000
21204 EOSH
21205 # Maybe put other stuff here too.
21206 cat <<EOSH >>Cppsym.know
21207 $osname
21208 EOSH
21209 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21210 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21211 $cat Cppsym.know > Cppsym.c
21212 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21213 $rm -f Cppsym.a Cppsym.b Cppsym.c
21214 cat <<EOSH > Cppsym
21215 $startsh
21216 if $test \$# -gt 0; then
21217     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21218     if $test -s Cppsym.got; then
21219         $rm -f Cppsym.got
21220         exit 0
21221     fi
21222     $rm -f Cppsym.got
21223     exit 1
21224 else
21225     $tr " " "$trnl" | ./Cppsym.try
21226     exit 0
21227 fi
21228 EOSH
21229 chmod +x Cppsym
21230 $eunicefix Cppsym
21231 cat <<EOSH > Cppsym.try
21232 $startsh
21233 cat <<'EOCP' > try.c
21234 #include <stdio.h>
21235 #if cpp_stuff == 1
21236 #define STRINGIFY(a)    "a"
21237 #endif
21238 #if cpp_stuff == 42
21239 #define StGiFy(a)  #a
21240 #define STRINGIFY(a)    StGiFy(a)
21241 #endif
21242 #if $cpp_stuff != 1 && $cpp_stuff != 42
21243 #   include "Bletch: How does this C preprocessor stringify macros?"
21244 #endif
21245 int main() {
21246 EOCP
21247 $awk \\
21248 EOSH
21249 cat <<'EOSH' >> Cppsym.try
21250 'length($1) > 0 {
21251     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21252     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21253     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21254     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21255 }'       >> try.c
21256 echo 'return 0;}' >> try.c
21257 EOSH
21258 cat <<EOSH >> Cppsym.try
21259 ccflags="$ccflags"
21260 case "$osname-$gccversion" in
21261 irix-) ccflags="\$ccflags -woff 1178" ;;
21262 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21263 esac
21264 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21265 EOSH
21266 chmod +x Cppsym.try
21267 $eunicefix Cppsym.try
21268 ./Cppsym < Cppsym.know > Cppsym.true
21269 : Add in any linux cpp "predefined macros":
21270 case "$osname::$gccversion" in
21271   *linux*::*.*)
21272     tHdrH=_tmpHdr
21273     rm -f $tHdrH'.h' $tHdrH
21274     touch $tHdrH'.h'
21275     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21276        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21277        if [ -s $tHdrH'_cppsym.real' ]; then
21278           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21279        fi
21280     fi
21281     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21282   ;;
21283 esac
21284 : now check the C compiler for additional symbols
21285 postprocess_cc_v=''
21286 case "$osname" in
21287 aix) postprocess_cc_v="|$tr , ' '" ;;
21288 esac
21289 $cat >ccsym <<EOS
21290 $startsh
21291 $cat >tmp.c <<EOF
21292 extern int foo;
21293 EOF
21294 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21295 do
21296         case "\$i" in
21297         -D*) echo "\$i" | $sed 's/^-D//';;
21298         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21299         esac
21300 done
21301 $rm_try
21302 EOS
21303 postprocess_cc_v=''
21304 chmod +x ccsym
21305 $eunicefix ccsym
21306 ./ccsym > ccsym1.raw
21307 if $test -s ccsym1.raw; then
21308        $sort ccsym1.raw | $uniq >ccsym.raw
21309 else
21310        mv ccsym1.raw ccsym.raw
21311 fi
21312
21313 $awk '/\=/ { print $0; next }
21314         { print $0"=1" }' ccsym.raw >ccsym.list
21315 $comm -13 Cppsym.true ccsym.list >ccsym.own
21316 $comm -12 Cppsym.true ccsym.list >ccsym.com
21317 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21318 also=''
21319 if $test -z ccsym.raw; then
21320         echo "Your C compiler doesn't seem to define any symbols!" >&4
21321         echo " "
21322         echo "However, your C preprocessor defines the following symbols:"
21323         $cat Cppsym.true
21324         ccsymbols=''
21325         cppsymbols=`$cat Cppsym.true`
21326         cppsymbols=`echo $cppsymbols`
21327         cppccsymbols="$cppsymbols"
21328 else
21329         if $test -s ccsym.com; then
21330                 echo "Your C compiler and pre-processor define these symbols:"
21331                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21332                 also='also '
21333                 symbols='ones'
21334                 cppccsymbols=`$cat ccsym.com`
21335                 cppccsymbols=`echo $cppccsymbols`
21336                 $test "$silent" || sleep 1
21337         fi
21338         if $test -s ccsym.cpp; then
21339                 $test "$also" && echo " "
21340                 echo "Your C pre-processor ${also}defines the following symbols:"
21341                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21342                 also='further '
21343                 cppsymbols=`$cat ccsym.cpp`
21344                 cppsymbols=`echo $cppsymbols`
21345                 $test "$silent" || sleep 1
21346         fi
21347         if $test -s ccsym.own; then
21348                 $test "$also" && echo " "
21349                 echo "Your C compiler ${also}defines the following cpp symbols:"
21350                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21351                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21352                 ccsymbols=`$cat ccsym.own`
21353                 ccsymbols=`echo $ccsymbols`
21354                 $test "$silent" || sleep 1
21355         fi
21356 fi
21357
21358 : see if this is a termio system
21359 val="$undef"
21360 val2="$undef"
21361 val3="$undef"
21362 if $test `./findhdr termios.h`; then
21363         set tcsetattr i_termios
21364         eval $inlibc
21365         val3="$i_termios"
21366 fi
21367 echo " "
21368 case "$val3" in
21369 "$define") echo "You have POSIX termios.h... good!" >&4;;
21370 *) if ./Cppsym pyr; then
21371                 case "`/bin/universe`" in
21372                 ucb) if $test `./findhdr sgtty.h`; then
21373                                 val2="$define"
21374                                 echo "<sgtty.h> found." >&4
21375                         else
21376                                 echo "System is pyramid with BSD universe."
21377                                 ./warn "<sgtty.h> not found--you could have problems."
21378                         fi;;
21379                 *) if $test `./findhdr termio.h`; then
21380                                 val="$define"
21381                                 echo "<termio.h> found." >&4
21382                         else
21383                                 echo "System is pyramid with USG universe."
21384                                 ./warn "<termio.h> not found--you could have problems."
21385                         fi;;
21386                 esac
21387         elif ./usg; then
21388                 if $test `./findhdr termio.h`; then
21389                         echo "<termio.h> found." >&4
21390                         val="$define"
21391                 elif $test `./findhdr sgtty.h`; then
21392                         echo "<sgtty.h> found." >&4
21393                         val2="$define"
21394                 else
21395                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21396                 fi
21397         else
21398                 if $test `./findhdr sgtty.h`; then
21399                         echo "<sgtty.h> found." >&4
21400                         val2="$define"
21401                 elif $test `./findhdr termio.h`; then
21402                         echo "<termio.h> found." >&4
21403                         val="$define"
21404                 else
21405                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21406                 fi
21407         fi;;
21408 esac
21409 set i_termio; eval $setvar
21410 val=$val2; set i_sgtty; eval $setvar
21411 val=$val3; set i_termios; eval $setvar
21412
21413 : see if stddef is available
21414 set stddef.h i_stddef
21415 eval $inhdr
21416
21417 : see if sys/access.h is available
21418 set sys/access.h i_sysaccess
21419 eval $inhdr
21420
21421 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21422 set sys/filio.h i_sysfilio
21423 eval $inhdr
21424 echo " "
21425 if $test `./findhdr sys/ioctl.h`; then
21426         val="$define"
21427         echo '<sys/ioctl.h> found.' >&4
21428 else
21429         val="$undef"
21430         if $test $i_sysfilio = "$define"; then
21431             echo '<sys/ioctl.h> NOT found.' >&4
21432         else
21433                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21434                 $test $i_termio = "$define" && xxx="termio.h"
21435                 $test $i_termios = "$define" && xxx="termios.h"
21436 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21437         fi
21438 fi
21439 set i_sysioctl
21440 eval $setvar
21441
21442 : see if socket ioctl defs are in sys/sockio.h
21443 echo " "
21444 xxx=`./findhdr sys/sockio.h`
21445 if $test "$xxx"; then
21446         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21447                 val="$define"
21448                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21449         else
21450                 val="$undef"
21451                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21452         fi
21453 else
21454         val="$undef"
21455         $cat <<EOM
21456 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21457 EOM
21458 fi
21459 set i_syssockio
21460 eval $setvar
21461
21462 : see if this is a syslog.h system
21463 set syslog.h i_syslog
21464 eval $inhdr
21465
21466 : see if this is a sys/mode.h system
21467 set sys/mode.h i_sysmode
21468 eval $inhdr
21469
21470 : see if there is a sys/poll.h file
21471 set sys/poll.h i_syspoll
21472 eval $inhdr
21473
21474 : see if sys/resource.h has to be included
21475 set sys/resource.h i_sysresrc
21476 eval $inhdr
21477
21478 : see if sys/security.h is available
21479 set sys/security.h i_syssecrt
21480 eval $inhdr
21481
21482 : see if this is a sys/statvfs.h system
21483 set sys/statvfs.h i_sysstatvfs
21484 eval $inhdr
21485
21486 : see if this is a sys/un.h system
21487 set sys/un.h i_sysun
21488 eval $inhdr
21489
21490 : see if this is a sys/utsname.h system
21491 set sys/utsname.h i_sysutsname
21492 eval $inhdr
21493
21494 : see if this is a syswait system
21495 set sys/wait.h i_syswait
21496 eval $inhdr
21497
21498 : see if this is a ustat.h system
21499 set ustat.h i_ustat
21500 eval $inhdr
21501
21502 : see if this is an utime system
21503 set utime.h i_utime
21504 eval $inhdr
21505
21506 : see if this is a vfork system
21507 case "$d_vfork" in
21508 "$define")
21509         set vfork.h i_vfork
21510         eval $inhdr
21511         ;;
21512 *)
21513         i_vfork="$undef"
21514         ;;
21515 esac
21516
21517 : Check extensions
21518 echo " "
21519 echo "Looking for extensions..." >&4
21520 : If we are using the old config.sh, known_extensions may contain
21521 : old or inaccurate or duplicate values.
21522 known_extensions=''
21523 nonxs_extensions=''
21524 : We do not use find because it might not be available.
21525 : We do not just use MANIFEST because the user may have dropped
21526 : some additional extensions into the source tree and expect them
21527 : to be built.
21528
21529 : Function to recursively find available extensions, ignoring DynaLoader
21530 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21531 find_extensions='
21532     for xxx in *; do
21533         case "$xxx" in
21534             DynaLoader|dynaload) ;;
21535             *)
21536             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21537                 known_extensions="$known_extensions $1$xxx";
21538             elif $test -f $xxx/Makefile.PL; then
21539                 nonxs_extensions="$nonxs_extensions $1$xxx";
21540             else
21541                 if $test -d $xxx -a $# -lt 10; then
21542                     set $1$xxx/ $*;
21543                     cd "$xxx";
21544                     eval $find_extensions;
21545                     cd ..;
21546                     shift;
21547                 fi;
21548             fi
21549             ;;
21550         esac;
21551     done'
21552 tdir=`pwd`
21553 cd "$rsrc/ext"
21554 set X
21555 shift
21556 eval $find_extensions
21557 # Special case:  Add in modules that nest beyond the first level.
21558 # Currently threads/shared and Hash/Util/FieldHash, since they are
21559 # not picked up by the recursive find above (and adding in general
21560 # recursive finding breaks SDBM_File/sdbm).
21561 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21562 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21563 set X $known_extensions
21564 shift
21565 known_extensions="$*"
21566 set X $nonxs_extensions
21567 shift
21568 nonxs_extensions="$*"
21569 cd "$tdir"
21570
21571 : Now see which are supported on this system.
21572 avail_ext=''
21573 for xxx in $known_extensions ; do
21574         case "$xxx" in
21575         DB_File|db_file)
21576                 case "$i_db" in
21577                 $define) avail_ext="$avail_ext $xxx" ;;
21578                 esac
21579                 ;;
21580         GDBM_File|gdbm_fil)
21581                 case "$i_gdbm" in
21582                 $define) avail_ext="$avail_ext $xxx" ;;
21583                 esac
21584                 ;;
21585         I18N/Langinfo|i18n_lan)
21586                 case "$i_langinfo$d_nl_langinfo" in
21587                 $define$define) avail_ext="$avail_ext $xxx" ;;
21588                 esac
21589                 ;;
21590         IPC/SysV|ipc/sysv)
21591                 : XXX Do we need a useipcsysv variable here
21592                 case "${d_msg}${d_sem}${d_shm}" in
21593                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21594                 esac
21595                 ;;
21596         NDBM_File|ndbm_fil)
21597                 case "$i_ndbm" in
21598                 $define)
21599                     case "$osname-$use64bitint" in
21600                     hpux-define)
21601                         case "$libs" in
21602                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21603                         esac
21604                         ;;
21605                     *) avail_ext="$avail_ext $xxx" ;;
21606                     esac
21607                     ;;
21608                 esac
21609                 ;;
21610         ODBM_File|odbm_fil)
21611                 case "${i_dbm}${i_rpcsvcdbm}" in
21612                 *"${define}"*)
21613                     case "$d_cplusplus" in
21614                     define) ;; # delete as a function name will not work
21615                     *)  case "$osname-$use64bitint" in
21616                         hpux-define)
21617                             case "$libs" in
21618                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21619                             esac
21620                             ;;
21621                         *) avail_ext="$avail_ext $xxx" ;;
21622                         esac
21623                         ;;
21624                     esac
21625                     ;;
21626                 esac
21627                 ;;
21628         Opcode|opcode)
21629                 case "$useopcode" in
21630                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21631                 esac
21632                 ;;
21633         POSIX|posix)
21634                 case "$useposix" in
21635                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21636                 esac
21637                 ;;
21638         Socket|socket)
21639                 case "$d_socket" in
21640                 true|$define|y)
21641                     case "$osname" in
21642                     beos) ;; # not unless BONE
21643                     *) avail_ext="$avail_ext $xxx" ;;
21644                     esac
21645                     ;;
21646                 esac
21647                 ;;
21648         Sys/Syslog|sys/syslog)
21649                 : XXX syslog requires socket
21650                 case "$d_socket" in
21651                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21652                 esac
21653                 ;;
21654         Thread|thread)
21655                 case "$usethreads" in
21656                 true|$define|y)
21657                         case "$use5005threads" in
21658                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21659                         esac
21660                 esac
21661                 ;;
21662         threads|threads/shared)
21663                 # threads and threads::shared are special cases.
21664                 # To stop people from asking "Perl 5.8.0 was supposed
21665                 # to have this new fancy threads implementation but my
21666                 # perl doesn't have it" and from people trying to
21667                 # (re)install the threads module using CPAN.pm and
21668                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21669                 # the threads.pm and threads/shared.pm will always be
21670                 # there, croaking informatively ("you need to rebuild
21671                 # all of Perl with threads, sorry") when threads haven't
21672                 # been compiled in.
21673                 # --jhi
21674                 avail_ext="$avail_ext $xxx"
21675                 ;;
21676         Win32*)
21677                 case "$osname" in
21678                 cygwin) avail_ext="$avail_ext $xxx" ;;
21679                 esac
21680                 ;;
21681         XS/APItest|xs/apitest)
21682                 # This is just for testing.  Skip it unless we have dynamic loading.
21683
21684                 case "$usedl" in
21685                 $define) avail_ext="$avail_ext $xxx" ;;
21686                 esac
21687                 ;;
21688         XS/Typemap|xs/typemap)
21689                 # This is just for testing.  Skip it unless we have dynamic loading.
21690                 case "$usedl" in
21691                 $define) avail_ext="$avail_ext $xxx" ;;
21692                 esac
21693                 ;;
21694         *)      avail_ext="$avail_ext $xxx"
21695                 ;;
21696         esac
21697 done
21698
21699 set X $avail_ext
21700 shift
21701 avail_ext="$*"
21702
21703 case "$onlyextensions" in
21704 '') ;;
21705 *)  keepextensions=''
21706     echo "You have requested that only certains extensions be included..." >&4
21707     for i in $onlyextensions; do
21708         case " $avail_ext " in
21709         *" $i "*)
21710             echo "Keeping extension $i."
21711             keepextensions="$keepextensions $i"
21712             ;;
21713         *) echo "Ignoring extension $i." ;;
21714         esac
21715     done
21716     avail_ext="$keepextensions"
21717     ;;
21718 esac
21719
21720 case "$noextensions" in
21721 '') ;;
21722 *)  keepextensions=''
21723     echo "You have requested that certain extensions be ignored..." >&4
21724     for i in $avail_ext; do
21725         case " $noextensions " in
21726         *" $i "*) echo "Ignoring extension $i." ;;
21727         *) echo "Keeping extension $i.";
21728            keepextensions="$keepextensions $i"
21729            ;;
21730         esac
21731     done
21732     avail_ext="$keepextensions"
21733     ;;
21734 esac
21735
21736 : Now see which nonxs extensions are supported on this system.
21737 : For now assume all are.
21738 nonxs_ext=''
21739 for xxx in $nonxs_extensions ; do
21740         case "$xxx" in
21741         *)      nonxs_ext="$nonxs_ext $xxx"
21742                 ;;
21743         esac
21744 done
21745
21746 set X $nonxs_ext
21747 shift
21748 nonxs_ext="$*"
21749
21750 case $usedl in
21751 $define)
21752         $cat <<EOM
21753 A number of extensions are supplied with $package.  You may choose to
21754 compile these extensions for dynamic loading (the default), compile
21755 them into the $package executable (static loading), or not include
21756 them at all.  Answer "none" to include no extensions.
21757 Note that DynaLoader is always built and need not be mentioned here.
21758
21759 EOM
21760         case "$dynamic_ext" in
21761         '')
21762                 : Exclude those listed in static_ext
21763                 dflt=''
21764                 for xxx in $avail_ext; do
21765                         case " $static_ext " in
21766                         *" $xxx "*) ;;
21767                         *) dflt="$dflt $xxx" ;;
21768                         esac
21769                 done
21770                 set X $dflt
21771                 shift
21772                 dflt="$*"
21773                 ;;
21774         *)      dflt="$dynamic_ext"
21775                 # Perhaps we are reusing an old out-of-date config.sh.
21776                 case "$hint" in
21777                 previous)
21778                         if test X"$dynamic_ext" != X"$avail_ext"; then
21779                                 $cat <<EOM
21780 NOTICE:  Your previous config.sh list may be incorrect.
21781 The extensions now available to you are
21782         ${avail_ext}
21783 but the default list from your previous config.sh is
21784         ${dynamic_ext}
21785
21786 EOM
21787                         fi
21788                         ;;
21789                 esac
21790                 ;;
21791         esac
21792         case "$dflt" in
21793         '')     dflt=none;;
21794         esac
21795         rp="What extensions do you wish to load dynamically?"
21796         . ./myread
21797         case "$ans" in
21798         none) dynamic_ext=' ' ;;
21799         *) dynamic_ext="$ans" ;;
21800         esac
21801
21802         case "$static_ext" in
21803         '')
21804                 : Exclude those already listed in dynamic linking
21805                 dflt=''
21806                 for xxx in $avail_ext; do
21807                         case " $dynamic_ext " in
21808                         *" $xxx "*) ;;
21809                         *) dflt="$dflt $xxx" ;;
21810                         esac
21811                 done
21812                 set X $dflt
21813                 shift
21814                 dflt="$*"
21815                 ;;
21816         *)  dflt="$static_ext"
21817                 ;;
21818         esac
21819
21820         case "$dflt" in
21821         '')     dflt=none;;
21822         esac
21823         rp="What extensions do you wish to load statically?"
21824         . ./myread
21825         case "$ans" in
21826         none) static_ext=' ' ;;
21827         *) static_ext="$ans" ;;
21828         esac
21829         ;;
21830 *)
21831         $cat <<EOM
21832 A number of extensions are supplied with $package.  Answer "none"
21833 to include no extensions.
21834 Note that DynaLoader is always built and need not be mentioned here.
21835
21836 EOM
21837         case "$static_ext" in
21838         '') dflt="$avail_ext" ;;
21839         *)      dflt="$static_ext"
21840                 # Perhaps we are reusing an old out-of-date config.sh.
21841                 case "$hint" in
21842                 previous)
21843                         if test X"$static_ext" != X"$avail_ext"; then
21844                                 $cat <<EOM
21845 NOTICE:  Your previous config.sh list may be incorrect.
21846 The extensions now available to you are
21847         ${avail_ext}
21848 but the default list from your previous config.sh is
21849         ${static_ext}
21850
21851 EOM
21852                         fi
21853                         ;;
21854                 esac
21855                 ;;
21856         esac
21857         : Exclude those that are not xs extensions
21858         case "$dflt" in
21859         '')     dflt=none;;
21860         esac
21861         rp="What extensions do you wish to include?"
21862         . ./myread
21863         case "$ans" in
21864         none) static_ext=' ' ;;
21865         *) static_ext="$ans" ;;
21866         esac
21867         ;;
21868 esac
21869 #
21870 # Encode is a special case.  If we are building Encode as a static
21871 # extension, we need to explicitly list its subextensions as well.
21872 # For other nested extensions, this is handled automatically by
21873 # the appropriate Makefile.PL.
21874 case " $static_ext " in
21875         *" Encode "*) # Add the subextensions of Encode
21876         cd "$rsrc/ext"
21877         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21878                 static_ext="$static_ext Encode/$xxx"
21879         done
21880         cd "$tdir"
21881         ;;
21882 esac
21883
21884 set X $dynamic_ext $static_ext $nonxs_ext
21885 shift
21886 extensions="$*"
21887
21888 # Sanity check:  We require an extension suitable for use with
21889 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21890 # should show up as failures in the test suite, but it's helpful to
21891 # catch them now.) The 'extensions' list is normally sorted
21892 # alphabetically, so we need to accept either
21893 #    DB_File ... Fcntl ... IO  ....
21894 # or something like
21895 #    Fcntl ... NDBM_File ... IO  ....
21896 case " $extensions"  in
21897 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21898 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21899 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21900 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21901    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21902    ;;
21903 esac
21904
21905 : Remove libraries needed only for extensions
21906 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21907 : The exception is SunOS 4.x, which needs them.
21908 case "${osname}X${osvers}" in
21909 sunos*X4*)
21910     perllibs="$libs"
21911     ;;
21912 *) case "$usedl" in
21913     $define|true|[yY]*)
21914             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21915             shift
21916             perllibs="$*"
21917             ;;
21918     *)  perllibs="$libs"
21919             ;;
21920     esac
21921     ;;
21922 esac
21923
21924 : Remove build directory name from cppstdin so it can be used from
21925 : either the present location or the final installed location.
21926 echo " "
21927 : Get out of the UU directory to get correct path name.
21928 cd ..
21929 case "$cppstdin" in
21930 `pwd`/cppstdin)
21931         echo "Stripping down cppstdin path name"
21932         cppstdin=cppstdin
21933         ;;
21934 esac
21935 cd UU
21936
21937 : end of configuration questions
21938 echo " "
21939 echo "End of configuration questions."
21940 echo " "
21941
21942 : back to where it started
21943 if test -d ../UU; then
21944         cd ..
21945 fi
21946
21947 : configuration may be unconditionally patched via a 'config.arch' file
21948 if $test -f config.arch; then
21949         echo "I see a config.arch file, loading it." >&4
21950         . ./config.arch
21951 fi
21952
21953 : configuration may be patched via a 'config.over' file
21954 if $test -f config.over; then
21955         echo " "
21956         dflt=y
21957         rp='I see a config.over file.  Do you wish to load it?'
21958         . UU/myread
21959         case "$ans" in
21960         n*) echo "OK, I'll ignore it.";;
21961         *)      . ./config.over
21962                 echo "Configuration override changes have been loaded."
21963                 ;;
21964         esac
21965 fi
21966
21967 : in case they want portability, strip down executable paths
21968 case "$d_portable" in
21969 "$define")
21970         echo " "
21971         echo "Stripping down executable paths..." >&4
21972         for file in $loclist $trylist; do
21973                 eval temp=\$$file
21974                 eval $file=`basename $temp`
21975         done
21976         ;;
21977 esac
21978
21979 : create config.sh file
21980 echo " "
21981 echo "Creating config.sh..." >&4
21982 $spitshell <<EOT >config.sh
21983 $startsh
21984 #
21985 # This file was produced by running the Configure script. It holds all the
21986 # definitions figured out by Configure. Should you modify one of these values,
21987 # do not forget to propagate your changes by running "Configure -der". You may
21988 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21989 #
21990
21991 # Package name      : $package
21992 # Source directory  : $src
21993 # Configuration time: $cf_time
21994 # Configured by     : $cf_by
21995 # Target system     : $myuname
21996
21997 EOT
21998 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21999 $spitshell <<EOT >>config.sh
22000
22001 Author='$Author'
22002 Date='$Date'
22003 Header='$Header'
22004 Id='$Id'
22005 Locker='$Locker'
22006 Log='$Log'
22007 RCSfile='$RCSfile'
22008 Revision='$Revision'
22009 Source='$Source'
22010 State='$State'
22011 _a='$_a'
22012 _exe='$_exe'
22013 _o='$_o'
22014 afs='$afs'
22015 afsroot='$afsroot'
22016 alignbytes='$alignbytes'
22017 ansi2knr='$ansi2knr'
22018 aphostname='$aphostname'
22019 api_revision='$api_revision'
22020 api_subversion='$api_subversion'
22021 api_version='$api_version'
22022 api_versionstring='$api_versionstring'
22023 ar='$ar'
22024 archlib='$archlib'
22025 archlibexp='$archlibexp'
22026 archname64='$archname64'
22027 archname='$archname'
22028 archobjs='$archobjs'
22029 asctime_r_proto='$asctime_r_proto'
22030 awk='$awk'
22031 baserev='$baserev'
22032 bash='$bash'
22033 bin='$bin'
22034 binexp='$binexp'
22035 bison='$bison'
22036 byacc='$byacc'
22037 byteorder='$byteorder'
22038 c='$c'
22039 castflags='$castflags'
22040 cat='$cat'
22041 cc='$cc'
22042 cccdlflags='$cccdlflags'
22043 ccdlflags='$ccdlflags'
22044 ccflags='$ccflags'
22045 ccflags_uselargefiles='$ccflags_uselargefiles'
22046 ccname='$ccname'
22047 ccsymbols='$ccsymbols'
22048 ccversion='$ccversion'
22049 cf_by='$cf_by'
22050 cf_email='$cf_email'
22051 cf_time='$cf_time'
22052 chgrp='$chgrp'
22053 chmod='$chmod'
22054 chown='$chown'
22055 clocktype='$clocktype'
22056 comm='$comm'
22057 compress='$compress'
22058 contains='$contains'
22059 cp='$cp'
22060 cpio='$cpio'
22061 cpp='$cpp'
22062 cpp_stuff='$cpp_stuff'
22063 cppccsymbols='$cppccsymbols'
22064 cppflags='$cppflags'
22065 cpplast='$cpplast'
22066 cppminus='$cppminus'
22067 cpprun='$cpprun'
22068 cppstdin='$cppstdin'
22069 cppsymbols='$cppsymbols'
22070 crypt_r_proto='$crypt_r_proto'
22071 cryptlib='$cryptlib'
22072 csh='$csh'
22073 ctermid_r_proto='$ctermid_r_proto'
22074 ctime_r_proto='$ctime_r_proto'
22075 d_Gconvert='$d_Gconvert'
22076 d_PRIEUldbl='$d_PRIEUldbl'
22077 d_PRIFUldbl='$d_PRIFUldbl'
22078 d_PRIGUldbl='$d_PRIGUldbl'
22079 d_PRIXU64='$d_PRIXU64'
22080 d_PRId64='$d_PRId64'
22081 d_PRIeldbl='$d_PRIeldbl'
22082 d_PRIfldbl='$d_PRIfldbl'
22083 d_PRIgldbl='$d_PRIgldbl'
22084 d_PRIi64='$d_PRIi64'
22085 d_PRIo64='$d_PRIo64'
22086 d_PRIu64='$d_PRIu64'
22087 d_PRIx64='$d_PRIx64'
22088 d_SCNfldbl='$d_SCNfldbl'
22089 d__fwalk='$d__fwalk'
22090 d_access='$d_access'
22091 d_accessx='$d_accessx'
22092 d_aintl='$d_aintl'
22093 d_alarm='$d_alarm'
22094 d_archlib='$d_archlib'
22095 d_asctime64='$d_asctime64'
22096 d_asctime_r='$d_asctime_r'
22097 d_atolf='$d_atolf'
22098 d_atoll='$d_atoll'
22099 d_attribute_format='$d_attribute_format'
22100 d_attribute_malloc='$d_attribute_malloc'
22101 d_attribute_nonnull='$d_attribute_nonnull'
22102 d_attribute_noreturn='$d_attribute_noreturn'
22103 d_attribute_pure='$d_attribute_pure'
22104 d_attribute_unused='$d_attribute_unused'
22105 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22106 d_bcmp='$d_bcmp'
22107 d_bcopy='$d_bcopy'
22108 d_bsd='$d_bsd'
22109 d_bsdgetpgrp='$d_bsdgetpgrp'
22110 d_bsdsetpgrp='$d_bsdsetpgrp'
22111 d_builtin_choose_expr='$d_builtin_choose_expr'
22112 d_builtin_expect='$d_builtin_expect'
22113 d_bzero='$d_bzero'
22114 d_c99_variadic_macros='$d_c99_variadic_macros'
22115 d_casti32='$d_casti32'
22116 d_castneg='$d_castneg'
22117 d_charvspr='$d_charvspr'
22118 d_chown='$d_chown'
22119 d_chroot='$d_chroot'
22120 d_chsize='$d_chsize'
22121 d_class='$d_class'
22122 d_clearenv='$d_clearenv'
22123 d_closedir='$d_closedir'
22124 d_cmsghdr_s='$d_cmsghdr_s'
22125 d_const='$d_const'
22126 d_copysignl='$d_copysignl'
22127 d_cplusplus='$d_cplusplus'
22128 d_crypt='$d_crypt'
22129 d_crypt_r='$d_crypt_r'
22130 d_csh='$d_csh'
22131 d_ctermid='$d_ctermid'
22132 d_ctermid_r='$d_ctermid_r'
22133 d_ctime64='$d_ctime64'
22134 d_ctime_r='$d_ctime_r'
22135 d_cuserid='$d_cuserid'
22136 d_dbl_dig='$d_dbl_dig'
22137 d_dbminitproto='$d_dbminitproto'
22138 d_difftime64='$d_difftime64'
22139 d_difftime='$d_difftime'
22140 d_dir_dd_fd='$d_dir_dd_fd'
22141 d_dirfd='$d_dirfd'
22142 d_dirnamlen='$d_dirnamlen'
22143 d_dlerror='$d_dlerror'
22144 d_dlopen='$d_dlopen'
22145 d_dlsymun='$d_dlsymun'
22146 d_dosuid='$d_dosuid'
22147 d_drand48_r='$d_drand48_r'
22148 d_drand48proto='$d_drand48proto'
22149 d_dup2='$d_dup2'
22150 d_eaccess='$d_eaccess'
22151 d_endgrent='$d_endgrent'
22152 d_endgrent_r='$d_endgrent_r'
22153 d_endhent='$d_endhent'
22154 d_endhostent_r='$d_endhostent_r'
22155 d_endnent='$d_endnent'
22156 d_endnetent_r='$d_endnetent_r'
22157 d_endpent='$d_endpent'
22158 d_endprotoent_r='$d_endprotoent_r'
22159 d_endpwent='$d_endpwent'
22160 d_endpwent_r='$d_endpwent_r'
22161 d_endsent='$d_endsent'
22162 d_endservent_r='$d_endservent_r'
22163 d_eofnblk='$d_eofnblk'
22164 d_eunice='$d_eunice'
22165 d_faststdio='$d_faststdio'
22166 d_fchdir='$d_fchdir'
22167 d_fchmod='$d_fchmod'
22168 d_fchown='$d_fchown'
22169 d_fcntl='$d_fcntl'
22170 d_fcntl_can_lock='$d_fcntl_can_lock'
22171 d_fd_macros='$d_fd_macros'
22172 d_fd_set='$d_fd_set'
22173 d_fds_bits='$d_fds_bits'
22174 d_fgetpos='$d_fgetpos'
22175 d_finite='$d_finite'
22176 d_finitel='$d_finitel'
22177 d_flexfnam='$d_flexfnam'
22178 d_flock='$d_flock'
22179 d_flockproto='$d_flockproto'
22180 d_fork='$d_fork'
22181 d_fp_class='$d_fp_class'
22182 d_fpathconf='$d_fpathconf'
22183 d_fpclass='$d_fpclass'
22184 d_fpclassify='$d_fpclassify'
22185 d_fpclassl='$d_fpclassl'
22186 d_fpos64_t='$d_fpos64_t'
22187 d_frexpl='$d_frexpl'
22188 d_fs_data_s='$d_fs_data_s'
22189 d_fseeko='$d_fseeko'
22190 d_fsetpos='$d_fsetpos'
22191 d_fstatfs='$d_fstatfs'
22192 d_fstatvfs='$d_fstatvfs'
22193 d_fsync='$d_fsync'
22194 d_ftello='$d_ftello'
22195 d_ftime='$d_ftime'
22196 d_futimes='$d_futimes'
22197 d_getcwd='$d_getcwd'
22198 d_getespwnam='$d_getespwnam'
22199 d_getfsstat='$d_getfsstat'
22200 d_getgrent='$d_getgrent'
22201 d_getgrent_r='$d_getgrent_r'
22202 d_getgrgid_r='$d_getgrgid_r'
22203 d_getgrnam_r='$d_getgrnam_r'
22204 d_getgrps='$d_getgrps'
22205 d_gethbyaddr='$d_gethbyaddr'
22206 d_gethbyname='$d_gethbyname'
22207 d_gethent='$d_gethent'
22208 d_gethname='$d_gethname'
22209 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22210 d_gethostbyname_r='$d_gethostbyname_r'
22211 d_gethostent_r='$d_gethostent_r'
22212 d_gethostprotos='$d_gethostprotos'
22213 d_getitimer='$d_getitimer'
22214 d_getlogin='$d_getlogin'
22215 d_getlogin_r='$d_getlogin_r'
22216 d_getmnt='$d_getmnt'
22217 d_getmntent='$d_getmntent'
22218 d_getnbyaddr='$d_getnbyaddr'
22219 d_getnbyname='$d_getnbyname'
22220 d_getnent='$d_getnent'
22221 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22222 d_getnetbyname_r='$d_getnetbyname_r'
22223 d_getnetent_r='$d_getnetent_r'
22224 d_getnetprotos='$d_getnetprotos'
22225 d_getpagsz='$d_getpagsz'
22226 d_getpbyname='$d_getpbyname'
22227 d_getpbynumber='$d_getpbynumber'
22228 d_getpent='$d_getpent'
22229 d_getpgid='$d_getpgid'
22230 d_getpgrp2='$d_getpgrp2'
22231 d_getpgrp='$d_getpgrp'
22232 d_getppid='$d_getppid'
22233 d_getprior='$d_getprior'
22234 d_getprotobyname_r='$d_getprotobyname_r'
22235 d_getprotobynumber_r='$d_getprotobynumber_r'
22236 d_getprotoent_r='$d_getprotoent_r'
22237 d_getprotoprotos='$d_getprotoprotos'
22238 d_getprpwnam='$d_getprpwnam'
22239 d_getpwent='$d_getpwent'
22240 d_getpwent_r='$d_getpwent_r'
22241 d_getpwnam_r='$d_getpwnam_r'
22242 d_getpwuid_r='$d_getpwuid_r'
22243 d_getsbyname='$d_getsbyname'
22244 d_getsbyport='$d_getsbyport'
22245 d_getsent='$d_getsent'
22246 d_getservbyname_r='$d_getservbyname_r'
22247 d_getservbyport_r='$d_getservbyport_r'
22248 d_getservent_r='$d_getservent_r'
22249 d_getservprotos='$d_getservprotos'
22250 d_getspnam='$d_getspnam'
22251 d_getspnam_r='$d_getspnam_r'
22252 d_gettimeod='$d_gettimeod'
22253 d_gmtime64='$d_gmtime64'
22254 d_gmtime_r='$d_gmtime_r'
22255 d_gnulibc='$d_gnulibc'
22256 d_grpasswd='$d_grpasswd'
22257 d_hasmntopt='$d_hasmntopt'
22258 d_htonl='$d_htonl'
22259 d_ilogbl='$d_ilogbl'
22260 d_inc_version_list='$d_inc_version_list'
22261 d_index='$d_index'
22262 d_inetaton='$d_inetaton'
22263 d_int64_t='$d_int64_t'
22264 d_isascii='$d_isascii'
22265 d_isfinite='$d_isfinite'
22266 d_isinf='$d_isinf'
22267 d_isnan='$d_isnan'
22268 d_isnanl='$d_isnanl'
22269 d_killpg='$d_killpg'
22270 d_lchown='$d_lchown'
22271 d_ldbl_dig='$d_ldbl_dig'
22272 d_libm_lib_version='$d_libm_lib_version'
22273 d_link='$d_link'
22274 d_localtime64='$d_localtime64'
22275 d_localtime_r='$d_localtime_r'
22276 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22277 d_locconv='$d_locconv'
22278 d_lockf='$d_lockf'
22279 d_longdbl='$d_longdbl'
22280 d_longlong='$d_longlong'
22281 d_lseekproto='$d_lseekproto'
22282 d_lstat='$d_lstat'
22283 d_madvise='$d_madvise'
22284 d_malloc_good_size='$d_malloc_good_size'
22285 d_malloc_size='$d_malloc_size'
22286 d_mblen='$d_mblen'
22287 d_mbstowcs='$d_mbstowcs'
22288 d_mbtowc='$d_mbtowc'
22289 d_memchr='$d_memchr'
22290 d_memcmp='$d_memcmp'
22291 d_memcpy='$d_memcpy'
22292 d_memmove='$d_memmove'
22293 d_memset='$d_memset'
22294 d_mkdir='$d_mkdir'
22295 d_mkdtemp='$d_mkdtemp'
22296 d_mkfifo='$d_mkfifo'
22297 d_mkstemp='$d_mkstemp'
22298 d_mkstemps='$d_mkstemps'
22299 d_mktime64='$d_mktime64'
22300 d_mktime='$d_mktime'
22301 d_mmap='$d_mmap'
22302 d_modfl='$d_modfl'
22303 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22304 d_modflproto='$d_modflproto'
22305 d_mprotect='$d_mprotect'
22306 d_msg='$d_msg'
22307 d_msg_ctrunc='$d_msg_ctrunc'
22308 d_msg_dontroute='$d_msg_dontroute'
22309 d_msg_oob='$d_msg_oob'
22310 d_msg_peek='$d_msg_peek'
22311 d_msg_proxy='$d_msg_proxy'
22312 d_msgctl='$d_msgctl'
22313 d_msgget='$d_msgget'
22314 d_msghdr_s='$d_msghdr_s'
22315 d_msgrcv='$d_msgrcv'
22316 d_msgsnd='$d_msgsnd'
22317 d_msync='$d_msync'
22318 d_munmap='$d_munmap'
22319 d_mymalloc='$d_mymalloc'
22320 d_ndbm='$d_ndbm'
22321 d_nice='$d_nice'
22322 d_nl_langinfo='$d_nl_langinfo'
22323 d_nv_preserves_uv='$d_nv_preserves_uv'
22324 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22325 d_off64_t='$d_off64_t'
22326 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22327 d_oldpthreads='$d_oldpthreads'
22328 d_oldsock='$d_oldsock'
22329 d_open3='$d_open3'
22330 d_pathconf='$d_pathconf'
22331 d_pause='$d_pause'
22332 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22333 d_phostname='$d_phostname'
22334 d_pipe='$d_pipe'
22335 d_poll='$d_poll'
22336 d_portable='$d_portable'
22337 d_printf_format_null='$d_printf_format_null'
22338 d_procselfexe='$d_procselfexe'
22339 d_pseudofork='$d_pseudofork'
22340 d_pthread_atfork='$d_pthread_atfork'
22341 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22342 d_pthread_yield='$d_pthread_yield'
22343 d_pwage='$d_pwage'
22344 d_pwchange='$d_pwchange'
22345 d_pwclass='$d_pwclass'
22346 d_pwcomment='$d_pwcomment'
22347 d_pwexpire='$d_pwexpire'
22348 d_pwgecos='$d_pwgecos'
22349 d_pwpasswd='$d_pwpasswd'
22350 d_pwquota='$d_pwquota'
22351 d_qgcvt='$d_qgcvt'
22352 d_quad='$d_quad'
22353 d_random_r='$d_random_r'
22354 d_readdir64_r='$d_readdir64_r'
22355 d_readdir='$d_readdir'
22356 d_readdir_r='$d_readdir_r'
22357 d_readlink='$d_readlink'
22358 d_readv='$d_readv'
22359 d_recvmsg='$d_recvmsg'
22360 d_rename='$d_rename'
22361 d_rewinddir='$d_rewinddir'
22362 d_rmdir='$d_rmdir'
22363 d_safebcpy='$d_safebcpy'
22364 d_safemcpy='$d_safemcpy'
22365 d_sanemcmp='$d_sanemcmp'
22366 d_sbrkproto='$d_sbrkproto'
22367 d_scalbnl='$d_scalbnl'
22368 d_sched_yield='$d_sched_yield'
22369 d_scm_rights='$d_scm_rights'
22370 d_seekdir='$d_seekdir'
22371 d_select='$d_select'
22372 d_sem='$d_sem'
22373 d_semctl='$d_semctl'
22374 d_semctl_semid_ds='$d_semctl_semid_ds'
22375 d_semctl_semun='$d_semctl_semun'
22376 d_semget='$d_semget'
22377 d_semop='$d_semop'
22378 d_sendmsg='$d_sendmsg'
22379 d_setegid='$d_setegid'
22380 d_seteuid='$d_seteuid'
22381 d_setgrent='$d_setgrent'
22382 d_setgrent_r='$d_setgrent_r'
22383 d_setgrps='$d_setgrps'
22384 d_sethent='$d_sethent'
22385 d_sethostent_r='$d_sethostent_r'
22386 d_setitimer='$d_setitimer'
22387 d_setlinebuf='$d_setlinebuf'
22388 d_setlocale='$d_setlocale'
22389 d_setlocale_r='$d_setlocale_r'
22390 d_setnent='$d_setnent'
22391 d_setnetent_r='$d_setnetent_r'
22392 d_setpent='$d_setpent'
22393 d_setpgid='$d_setpgid'
22394 d_setpgrp2='$d_setpgrp2'
22395 d_setpgrp='$d_setpgrp'
22396 d_setprior='$d_setprior'
22397 d_setproctitle='$d_setproctitle'
22398 d_setprotoent_r='$d_setprotoent_r'
22399 d_setpwent='$d_setpwent'
22400 d_setpwent_r='$d_setpwent_r'
22401 d_setregid='$d_setregid'
22402 d_setresgid='$d_setresgid'
22403 d_setresuid='$d_setresuid'
22404 d_setreuid='$d_setreuid'
22405 d_setrgid='$d_setrgid'
22406 d_setruid='$d_setruid'
22407 d_setsent='$d_setsent'
22408 d_setservent_r='$d_setservent_r'
22409 d_setsid='$d_setsid'
22410 d_setvbuf='$d_setvbuf'
22411 d_sfio='$d_sfio'
22412 d_shm='$d_shm'
22413 d_shmat='$d_shmat'
22414 d_shmatprototype='$d_shmatprototype'
22415 d_shmctl='$d_shmctl'
22416 d_shmdt='$d_shmdt'
22417 d_shmget='$d_shmget'
22418 d_sigaction='$d_sigaction'
22419 d_signbit='$d_signbit'
22420 d_sigprocmask='$d_sigprocmask'
22421 d_sigsetjmp='$d_sigsetjmp'
22422 d_sitearch='$d_sitearch'
22423 d_snprintf='$d_snprintf'
22424 d_sockatmark='$d_sockatmark'
22425 d_sockatmarkproto='$d_sockatmarkproto'
22426 d_socket='$d_socket'
22427 d_socklen_t='$d_socklen_t'
22428 d_sockpair='$d_sockpair'
22429 d_socks5_init='$d_socks5_init'
22430 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22431 d_sqrtl='$d_sqrtl'
22432 d_srand48_r='$d_srand48_r'
22433 d_srandom_r='$d_srandom_r'
22434 d_sresgproto='$d_sresgproto'
22435 d_sresuproto='$d_sresuproto'
22436 d_statblks='$d_statblks'
22437 d_statfs_f_flags='$d_statfs_f_flags'
22438 d_statfs_s='$d_statfs_s'
22439 d_statvfs='$d_statvfs'
22440 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22441 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22442 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22443 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22444 d_stdio_stream_array='$d_stdio_stream_array'
22445 d_stdiobase='$d_stdiobase'
22446 d_stdstdio='$d_stdstdio'
22447 d_strchr='$d_strchr'
22448 d_strcoll='$d_strcoll'
22449 d_strctcpy='$d_strctcpy'
22450 d_strerrm='$d_strerrm'
22451 d_strerror='$d_strerror'
22452 d_strerror_r='$d_strerror_r'
22453 d_strftime='$d_strftime'
22454 d_strlcat='$d_strlcat'
22455 d_strlcpy='$d_strlcpy'
22456 d_strtod='$d_strtod'
22457 d_strtol='$d_strtol'
22458 d_strtold='$d_strtold'
22459 d_strtoll='$d_strtoll'
22460 d_strtoq='$d_strtoq'
22461 d_strtoul='$d_strtoul'
22462 d_strtoull='$d_strtoull'
22463 d_strtouq='$d_strtouq'
22464 d_strxfrm='$d_strxfrm'
22465 d_suidsafe='$d_suidsafe'
22466 d_symlink='$d_symlink'
22467 d_syscall='$d_syscall'
22468 d_syscallproto='$d_syscallproto'
22469 d_sysconf='$d_sysconf'
22470 d_sysernlst='$d_sysernlst'
22471 d_syserrlst='$d_syserrlst'
22472 d_system='$d_system'
22473 d_tcgetpgrp='$d_tcgetpgrp'
22474 d_tcsetpgrp='$d_tcsetpgrp'
22475 d_telldir='$d_telldir'
22476 d_telldirproto='$d_telldirproto'
22477 d_time='$d_time'
22478 d_timegm='$d_timegm'
22479 d_times='$d_times'
22480 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22481 d_tm_tm_zone='$d_tm_tm_zone'
22482 d_tmpnam_r='$d_tmpnam_r'
22483 d_truncate='$d_truncate'
22484 d_ttyname_r='$d_ttyname_r'
22485 d_tzname='$d_tzname'
22486 d_u32align='$d_u32align'
22487 d_ualarm='$d_ualarm'
22488 d_umask='$d_umask'
22489 d_uname='$d_uname'
22490 d_union_semun='$d_union_semun'
22491 d_unordered='$d_unordered'
22492 d_unsetenv='$d_unsetenv'
22493 d_usleep='$d_usleep'
22494 d_usleepproto='$d_usleepproto'
22495 d_ustat='$d_ustat'
22496 d_vendorarch='$d_vendorarch'
22497 d_vendorbin='$d_vendorbin'
22498 d_vendorlib='$d_vendorlib'
22499 d_vendorscript='$d_vendorscript'
22500 d_vfork='$d_vfork'
22501 d_void_closedir='$d_void_closedir'
22502 d_voidsig='$d_voidsig'
22503 d_voidtty='$d_voidtty'
22504 d_volatile='$d_volatile'
22505 d_vprintf='$d_vprintf'
22506 d_vsnprintf='$d_vsnprintf'
22507 d_wait4='$d_wait4'
22508 d_waitpid='$d_waitpid'
22509 d_wcstombs='$d_wcstombs'
22510 d_wctomb='$d_wctomb'
22511 d_writev='$d_writev'
22512 d_xenix='$d_xenix'
22513 date='$date'
22514 db_hashtype='$db_hashtype'
22515 db_prefixtype='$db_prefixtype'
22516 db_version_major='$db_version_major'
22517 db_version_minor='$db_version_minor'
22518 db_version_patch='$db_version_patch'
22519 defvoidused='$defvoidused'
22520 direntrytype='$direntrytype'
22521 dlext='$dlext'
22522 dlsrc='$dlsrc'
22523 doublesize='$doublesize'
22524 drand01='$drand01'
22525 drand48_r_proto='$drand48_r_proto'
22526 dtrace='$dtrace'
22527 dynamic_ext='$dynamic_ext'
22528 eagain='$eagain'
22529 ebcdic='$ebcdic'
22530 echo='$echo'
22531 egrep='$egrep'
22532 emacs='$emacs'
22533 endgrent_r_proto='$endgrent_r_proto'
22534 endhostent_r_proto='$endhostent_r_proto'
22535 endnetent_r_proto='$endnetent_r_proto'
22536 endprotoent_r_proto='$endprotoent_r_proto'
22537 endpwent_r_proto='$endpwent_r_proto'
22538 endservent_r_proto='$endservent_r_proto'
22539 eunicefix='$eunicefix'
22540 exe_ext='$exe_ext'
22541 expr='$expr'
22542 extensions='$extensions'
22543 extern_C='$extern_C'
22544 extras='$extras'
22545 fflushNULL='$fflushNULL'
22546 fflushall='$fflushall'
22547 find='$find'
22548 firstmakefile='$firstmakefile'
22549 flex='$flex'
22550 fpossize='$fpossize'
22551 fpostype='$fpostype'
22552 freetype='$freetype'
22553 from='$from'
22554 full_ar='$full_ar'
22555 full_csh='$full_csh'
22556 full_sed='$full_sed'
22557 gccansipedantic='$gccansipedantic'
22558 gccosandvers='$gccosandvers'
22559 gccversion='$gccversion'
22560 getgrent_r_proto='$getgrent_r_proto'
22561 getgrgid_r_proto='$getgrgid_r_proto'
22562 getgrnam_r_proto='$getgrnam_r_proto'
22563 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22564 gethostbyname_r_proto='$gethostbyname_r_proto'
22565 gethostent_r_proto='$gethostent_r_proto'
22566 getlogin_r_proto='$getlogin_r_proto'
22567 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22568 getnetbyname_r_proto='$getnetbyname_r_proto'
22569 getnetent_r_proto='$getnetent_r_proto'
22570 getprotobyname_r_proto='$getprotobyname_r_proto'
22571 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22572 getprotoent_r_proto='$getprotoent_r_proto'
22573 getpwent_r_proto='$getpwent_r_proto'
22574 getpwnam_r_proto='$getpwnam_r_proto'
22575 getpwuid_r_proto='$getpwuid_r_proto'
22576 getservbyname_r_proto='$getservbyname_r_proto'
22577 getservbyport_r_proto='$getservbyport_r_proto'
22578 getservent_r_proto='$getservent_r_proto'
22579 getspnam_r_proto='$getspnam_r_proto'
22580 gidformat='$gidformat'
22581 gidsign='$gidsign'
22582 gidsize='$gidsize'
22583 gidtype='$gidtype'
22584 glibpth='$glibpth'
22585 gmake='$gmake'
22586 gmtime_r_proto='$gmtime_r_proto'
22587 gnulibc_version='$gnulibc_version'
22588 grep='$grep'
22589 groupcat='$groupcat'
22590 groupstype='$groupstype'
22591 gzip='$gzip'
22592 h_fcntl='$h_fcntl'
22593 h_sysfile='$h_sysfile'
22594 hint='$hint'
22595 hostcat='$hostcat'
22596 html1dir='$html1dir'
22597 html1direxp='$html1direxp'
22598 html3dir='$html3dir'
22599 html3direxp='$html3direxp'
22600 i16size='$i16size'
22601 i16type='$i16type'
22602 i32size='$i32size'
22603 i32type='$i32type'
22604 i64size='$i64size'
22605 i64type='$i64type'
22606 i8size='$i8size'
22607 i8type='$i8type'
22608 i_arpainet='$i_arpainet'
22609 i_assert='$i_assert'
22610 i_bsdioctl='$i_bsdioctl'
22611 i_crypt='$i_crypt'
22612 i_db='$i_db'
22613 i_dbm='$i_dbm'
22614 i_dirent='$i_dirent'
22615 i_dld='$i_dld'
22616 i_dlfcn='$i_dlfcn'
22617 i_fcntl='$i_fcntl'
22618 i_float='$i_float'
22619 i_fp='$i_fp'
22620 i_fp_class='$i_fp_class'
22621 i_gdbm='$i_gdbm'
22622 i_gdbm_ndbm='$i_gdbm_ndbm'
22623 i_gdbmndbm='$i_gdbmndbm'
22624 i_grp='$i_grp'
22625 i_ieeefp='$i_ieeefp'
22626 i_inttypes='$i_inttypes'
22627 i_langinfo='$i_langinfo'
22628 i_libutil='$i_libutil'
22629 i_limits='$i_limits'
22630 i_locale='$i_locale'
22631 i_machcthr='$i_machcthr'
22632 i_malloc='$i_malloc'
22633 i_mallocmalloc='$i_mallocmalloc'
22634 i_math='$i_math'
22635 i_memory='$i_memory'
22636 i_mntent='$i_mntent'
22637 i_ndbm='$i_ndbm'
22638 i_netdb='$i_netdb'
22639 i_neterrno='$i_neterrno'
22640 i_netinettcp='$i_netinettcp'
22641 i_niin='$i_niin'
22642 i_poll='$i_poll'
22643 i_prot='$i_prot'
22644 i_pthread='$i_pthread'
22645 i_pwd='$i_pwd'
22646 i_rpcsvcdbm='$i_rpcsvcdbm'
22647 i_sfio='$i_sfio'
22648 i_sgtty='$i_sgtty'
22649 i_shadow='$i_shadow'
22650 i_socks='$i_socks'
22651 i_stdarg='$i_stdarg'
22652 i_stddef='$i_stddef'
22653 i_stdlib='$i_stdlib'
22654 i_string='$i_string'
22655 i_sunmath='$i_sunmath'
22656 i_sysaccess='$i_sysaccess'
22657 i_sysdir='$i_sysdir'
22658 i_sysfile='$i_sysfile'
22659 i_sysfilio='$i_sysfilio'
22660 i_sysin='$i_sysin'
22661 i_sysioctl='$i_sysioctl'
22662 i_syslog='$i_syslog'
22663 i_sysmman='$i_sysmman'
22664 i_sysmode='$i_sysmode'
22665 i_sysmount='$i_sysmount'
22666 i_sysndir='$i_sysndir'
22667 i_sysparam='$i_sysparam'
22668 i_syspoll='$i_syspoll'
22669 i_sysresrc='$i_sysresrc'
22670 i_syssecrt='$i_syssecrt'
22671 i_sysselct='$i_sysselct'
22672 i_syssockio='$i_syssockio'
22673 i_sysstat='$i_sysstat'
22674 i_sysstatfs='$i_sysstatfs'
22675 i_sysstatvfs='$i_sysstatvfs'
22676 i_systime='$i_systime'
22677 i_systimek='$i_systimek'
22678 i_systimes='$i_systimes'
22679 i_systypes='$i_systypes'
22680 i_sysuio='$i_sysuio'
22681 i_sysun='$i_sysun'
22682 i_sysutsname='$i_sysutsname'
22683 i_sysvfs='$i_sysvfs'
22684 i_syswait='$i_syswait'
22685 i_termio='$i_termio'
22686 i_termios='$i_termios'
22687 i_time='$i_time'
22688 i_unistd='$i_unistd'
22689 i_ustat='$i_ustat'
22690 i_utime='$i_utime'
22691 i_values='$i_values'
22692 i_varargs='$i_varargs'
22693 i_varhdr='$i_varhdr'
22694 i_vfork='$i_vfork'
22695 ignore_versioned_solibs='$ignore_versioned_solibs'
22696 inc_version_list='$inc_version_list'
22697 inc_version_list_init='$inc_version_list_init'
22698 incpath='$incpath'
22699 inews='$inews'
22700 initialinstalllocation='$initialinstalllocation'
22701 installarchlib='$installarchlib'
22702 installbin='$installbin'
22703 installhtml1dir='$installhtml1dir'
22704 installhtml3dir='$installhtml3dir'
22705 installman1dir='$installman1dir'
22706 installman3dir='$installman3dir'
22707 installprefix='$installprefix'
22708 installprefixexp='$installprefixexp'
22709 installprivlib='$installprivlib'
22710 installscript='$installscript'
22711 installsitearch='$installsitearch'
22712 installsitebin='$installsitebin'
22713 installsitehtml1dir='$installsitehtml1dir'
22714 installsitehtml3dir='$installsitehtml3dir'
22715 installsitelib='$installsitelib'
22716 installsiteman1dir='$installsiteman1dir'
22717 installsiteman3dir='$installsiteman3dir'
22718 installsitescript='$installsitescript'
22719 installstyle='$installstyle'
22720 installusrbinperl='$installusrbinperl'
22721 installvendorarch='$installvendorarch'
22722 installvendorbin='$installvendorbin'
22723 installvendorhtml1dir='$installvendorhtml1dir'
22724 installvendorhtml3dir='$installvendorhtml3dir'
22725 installvendorlib='$installvendorlib'
22726 installvendorman1dir='$installvendorman1dir'
22727 installvendorman3dir='$installvendorman3dir'
22728 installvendorscript='$installvendorscript'
22729 intsize='$intsize'
22730 issymlink='$issymlink'
22731 ivdformat='$ivdformat'
22732 ivsize='$ivsize'
22733 ivtype='$ivtype'
22734 known_extensions='$known_extensions'
22735 ksh='$ksh'
22736 ld='$ld'
22737 lddlflags='$lddlflags'
22738 ldflags='$ldflags'
22739 ldflags_uselargefiles='$ldflags_uselargefiles'
22740 ldlibpthname='$ldlibpthname'
22741 less='$less'
22742 lib_ext='$lib_ext'
22743 libc='$libc'
22744 libperl='$libperl'
22745 libpth='$libpth'
22746 libs='$libs'
22747 libsdirs='$libsdirs'
22748 libsfiles='$libsfiles'
22749 libsfound='$libsfound'
22750 libspath='$libspath'
22751 libswanted='$libswanted'
22752 libswanted_uselargefiles='$libswanted_uselargefiles'
22753 line='$line'
22754 lint='$lint'
22755 lkflags='$lkflags'
22756 ln='$ln'
22757 lns='$lns'
22758 localtime_r_proto='$localtime_r_proto'
22759 locincpth='$locincpth'
22760 loclibpth='$loclibpth'
22761 longdblsize='$longdblsize'
22762 longlongsize='$longlongsize'
22763 longsize='$longsize'
22764 lp='$lp'
22765 lpr='$lpr'
22766 ls='$ls'
22767 lseeksize='$lseeksize'
22768 lseektype='$lseektype'
22769 mad='$mad'
22770 madlyh='$madlyh'
22771 madlyobj='$madlyobj'
22772 madlysrc='$madlysrc'
22773 mail='$mail'
22774 mailx='$mailx'
22775 make='$make'
22776 make_set_make='$make_set_make'
22777 mallocobj='$mallocobj'
22778 mallocsrc='$mallocsrc'
22779 malloctype='$malloctype'
22780 man1dir='$man1dir'
22781 man1direxp='$man1direxp'
22782 man1ext='$man1ext'
22783 man3dir='$man3dir'
22784 man3direxp='$man3direxp'
22785 man3ext='$man3ext'
22786 mips_type='$mips_type'
22787 mistrustnm='$mistrustnm'
22788 mkdir='$mkdir'
22789 mmaptype='$mmaptype'
22790 modetype='$modetype'
22791 more='$more'
22792 multiarch='$multiarch'
22793 mv='$mv'
22794 myarchname='$myarchname'
22795 mydomain='$mydomain'
22796 myhostname='$myhostname'
22797 myuname='$myuname'
22798 n='$n'
22799 need_va_copy='$need_va_copy'
22800 netdb_hlen_type='$netdb_hlen_type'
22801 netdb_host_type='$netdb_host_type'
22802 netdb_name_type='$netdb_name_type'
22803 netdb_net_type='$netdb_net_type'
22804 nm='$nm'
22805 nm_opt='$nm_opt'
22806 nm_so_opt='$nm_so_opt'
22807 nonxs_ext='$nonxs_ext'
22808 nroff='$nroff'
22809 nvEUformat='$nvEUformat'
22810 nvFUformat='$nvFUformat'
22811 nvGUformat='$nvGUformat'
22812 nv_overflows_integers_at='$nv_overflows_integers_at'
22813 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22814 nveformat='$nveformat'
22815 nvfformat='$nvfformat'
22816 nvgformat='$nvgformat'
22817 nvsize='$nvsize'
22818 nvtype='$nvtype'
22819 o_nonblock='$o_nonblock'
22820 obj_ext='$obj_ext'
22821 old_pthread_create_joinable='$old_pthread_create_joinable'
22822 optimize='$optimize'
22823 orderlib='$orderlib'
22824 osname='$osname'
22825 osvers='$osvers'
22826 otherlibdirs='$otherlibdirs'
22827 package='$package'
22828 pager='$pager'
22829 passcat='$passcat'
22830 patchlevel='$patchlevel'
22831 path_sep='$path_sep'
22832 perl5='$perl5'
22833 perl='$perl'
22834 perl_patchlevel='$perl_patchlevel'
22835 perladmin='$perladmin'
22836 perllibs='$perllibs'
22837 perlpath='$perlpath'
22838 pg='$pg'
22839 phostname='$phostname'
22840 pidtype='$pidtype'
22841 plibpth='$plibpth'
22842 pmake='$pmake'
22843 pr='$pr'
22844 prefix='$prefix'
22845 prefixexp='$prefixexp'
22846 privlib='$privlib'
22847 privlibexp='$privlibexp'
22848 procselfexe='$procselfexe'
22849 prototype='$prototype'
22850 ptrsize='$ptrsize'
22851 quadkind='$quadkind'
22852 quadtype='$quadtype'
22853 randbits='$randbits'
22854 randfunc='$randfunc'
22855 random_r_proto='$random_r_proto'
22856 randseedtype='$randseedtype'
22857 ranlib='$ranlib'
22858 rd_nodata='$rd_nodata'
22859 readdir64_r_proto='$readdir64_r_proto'
22860 readdir_r_proto='$readdir_r_proto'
22861 revision='$revision'
22862 rm='$rm'
22863 rm_try='$rm_try'
22864 rmail='$rmail'
22865 run='$run'
22866 runnm='$runnm'
22867 sGMTIME_max='$sGMTIME_max'
22868 sGMTIME_min='$sGMTIME_min'
22869 sLOCALTIME_max='$sLOCALTIME_max'
22870 sLOCALTIME_min='$sLOCALTIME_min'
22871 sPRIEUldbl='$sPRIEUldbl'
22872 sPRIFUldbl='$sPRIFUldbl'
22873 sPRIGUldbl='$sPRIGUldbl'
22874 sPRIXU64='$sPRIXU64'
22875 sPRId64='$sPRId64'
22876 sPRIeldbl='$sPRIeldbl'
22877 sPRIfldbl='$sPRIfldbl'
22878 sPRIgldbl='$sPRIgldbl'
22879 sPRIi64='$sPRIi64'
22880 sPRIo64='$sPRIo64'
22881 sPRIu64='$sPRIu64'
22882 sPRIx64='$sPRIx64'
22883 sSCNfldbl='$sSCNfldbl'
22884 sched_yield='$sched_yield'
22885 scriptdir='$scriptdir'
22886 scriptdirexp='$scriptdirexp'
22887 sed='$sed'
22888 seedfunc='$seedfunc'
22889 selectminbits='$selectminbits'
22890 selecttype='$selecttype'
22891 sendmail='$sendmail'
22892 setgrent_r_proto='$setgrent_r_proto'
22893 sethostent_r_proto='$sethostent_r_proto'
22894 setlocale_r_proto='$setlocale_r_proto'
22895 setnetent_r_proto='$setnetent_r_proto'
22896 setprotoent_r_proto='$setprotoent_r_proto'
22897 setpwent_r_proto='$setpwent_r_proto'
22898 setservent_r_proto='$setservent_r_proto'
22899 sh='$sh'
22900 shar='$shar'
22901 sharpbang='$sharpbang'
22902 shmattype='$shmattype'
22903 shortsize='$shortsize'
22904 shrpenv='$shrpenv'
22905 shsharp='$shsharp'
22906 sig_count='$sig_count'
22907 sig_name='$sig_name'
22908 sig_name_init='$sig_name_init'
22909 sig_num='$sig_num'
22910 sig_num_init='$sig_num_init'
22911 sig_size='$sig_size'
22912 signal_t='$signal_t'
22913 sitearch='$sitearch'
22914 sitearchexp='$sitearchexp'
22915 sitebin='$sitebin'
22916 sitebinexp='$sitebinexp'
22917 sitehtml1dir='$sitehtml1dir'
22918 sitehtml1direxp='$sitehtml1direxp'
22919 sitehtml3dir='$sitehtml3dir'
22920 sitehtml3direxp='$sitehtml3direxp'
22921 sitelib='$sitelib'
22922 sitelib_stem='$sitelib_stem'
22923 sitelibexp='$sitelibexp'
22924 siteman1dir='$siteman1dir'
22925 siteman1direxp='$siteman1direxp'
22926 siteman3dir='$siteman3dir'
22927 siteman3direxp='$siteman3direxp'
22928 siteprefix='$siteprefix'
22929 siteprefixexp='$siteprefixexp'
22930 sitescript='$sitescript'
22931 sitescriptexp='$sitescriptexp'
22932 sizesize='$sizesize'
22933 sizetype='$sizetype'
22934 sleep='$sleep'
22935 smail='$smail'
22936 so='$so'
22937 sockethdr='$sockethdr'
22938 socketlib='$socketlib'
22939 socksizetype='$socksizetype'
22940 sort='$sort'
22941 spackage='$spackage'
22942 spitshell='$spitshell'
22943 srand48_r_proto='$srand48_r_proto'
22944 srandom_r_proto='$srandom_r_proto'
22945 src='$src'
22946 ssizetype='$ssizetype'
22947 startperl='$startperl'
22948 startsh='$startsh'
22949 static_ext='$static_ext'
22950 stdchar='$stdchar'
22951 stdio_base='$stdio_base'
22952 stdio_bufsiz='$stdio_bufsiz'
22953 stdio_cnt='$stdio_cnt'
22954 stdio_filbuf='$stdio_filbuf'
22955 stdio_ptr='$stdio_ptr'
22956 stdio_stream_array='$stdio_stream_array'
22957 strerror_r_proto='$strerror_r_proto'
22958 strings='$strings'
22959 submit='$submit'
22960 subversion='$subversion'
22961 sysman='$sysman'
22962 tail='$tail'
22963 tar='$tar'
22964 targetarch='$targetarch'
22965 tbl='$tbl'
22966 tee='$tee'
22967 test='$test'
22968 timeincl='$timeincl'
22969 timetype='$timetype'
22970 tmpnam_r_proto='$tmpnam_r_proto'
22971 to='$to'
22972 touch='$touch'
22973 tr='$tr'
22974 trnl='$trnl'
22975 troff='$troff'
22976 ttyname_r_proto='$ttyname_r_proto'
22977 u16size='$u16size'
22978 u16type='$u16type'
22979 u32size='$u32size'
22980 u32type='$u32type'
22981 u64size='$u64size'
22982 u64type='$u64type'
22983 u8size='$u8size'
22984 u8type='$u8type'
22985 uidformat='$uidformat'
22986 uidsign='$uidsign'
22987 uidsize='$uidsize'
22988 uidtype='$uidtype'
22989 uname='$uname'
22990 uniq='$uniq'
22991 uquadtype='$uquadtype'
22992 use5005threads='$use5005threads'
22993 use64bitall='$use64bitall'
22994 use64bitint='$use64bitint'
22995 usecrosscompile='$usecrosscompile'
22996 usedl='$usedl'
22997 usedtrace='$usedtrace'
22998 usefaststdio='$usefaststdio'
22999 useithreads='$useithreads'
23000 uselargefiles='$uselargefiles'
23001 uselongdouble='$uselongdouble'
23002 usemallocwrap='$usemallocwrap'
23003 usemorebits='$usemorebits'
23004 usemultiplicity='$usemultiplicity'
23005 usemymalloc='$usemymalloc'
23006 usenm='$usenm'
23007 useopcode='$useopcode'
23008 useperlio='$useperlio'
23009 useposix='$useposix'
23010 usereentrant='$usereentrant'
23011 userelocatableinc='$userelocatableinc'
23012 usesfio='$usesfio'
23013 useshrplib='$useshrplib'
23014 usesitecustomize='$usesitecustomize'
23015 usesocks='$usesocks'
23016 usethreads='$usethreads'
23017 usevendorprefix='$usevendorprefix'
23018 usevfork='$usevfork'
23019 usrinc='$usrinc'
23020 uuname='$uuname'
23021 uvXUformat='$uvXUformat'
23022 uvoformat='$uvoformat'
23023 uvsize='$uvsize'
23024 uvtype='$uvtype'
23025 uvuformat='$uvuformat'
23026 uvxformat='$uvxformat'
23027 vendorarch='$vendorarch'
23028 vendorarchexp='$vendorarchexp'
23029 vendorbin='$vendorbin'
23030 vendorbinexp='$vendorbinexp'
23031 vendorhtml1dir='$vendorhtml1dir'
23032 vendorhtml1direxp='$vendorhtml1direxp'
23033 vendorhtml3dir='$vendorhtml3dir'
23034 vendorhtml3direxp='$vendorhtml3direxp'
23035 vendorlib='$vendorlib'
23036 vendorlib_stem='$vendorlib_stem'
23037 vendorlibexp='$vendorlibexp'
23038 vendorman1dir='$vendorman1dir'
23039 vendorman1direxp='$vendorman1direxp'
23040 vendorman3dir='$vendorman3dir'
23041 vendorman3direxp='$vendorman3direxp'
23042 vendorprefix='$vendorprefix'
23043 vendorprefixexp='$vendorprefixexp'
23044 vendorscript='$vendorscript'
23045 vendorscriptexp='$vendorscriptexp'
23046 version='$version'
23047 version_patchlevel_string='$version_patchlevel_string'
23048 versiononly='$versiononly'
23049 vi='$vi'
23050 voidflags='$voidflags'
23051 xlibpth='$xlibpth'
23052 yacc='$yacc'
23053 yaccflags='$yaccflags'
23054 zcat='$zcat'
23055 zip='$zip'
23056 EOT
23057
23058 : Add in command line options if available
23059 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23060
23061 : add special variables
23062 $test -f $src/patchlevel.h && \
23063 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23064 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
23065 echo "PERL_CONFIG_SH=true" >>config.sh
23066
23067 : propagate old symbols
23068 if $test -f UU/config.sh; then
23069         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23070         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23071                 config.sh config.sh UU/oldconfig.sh |\
23072                 $sort | $uniq -u >UU/oldsyms
23073         set X `cat UU/oldsyms`
23074         shift
23075         case $# in
23076         0) ;;
23077         *)
23078                 cat <<EOM
23079 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23080 EOM
23081                 echo ": Variables propagated from previous config.sh file." >>config.sh
23082                 for sym in `cat UU/oldsyms`; do
23083                         echo "    Propagating $hint variable "'$'"$sym..."
23084                         eval 'tmp="$'"${sym}"'"'
23085                         echo "$tmp" | \
23086                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23087                 done
23088                 ;;
23089         esac
23090 fi
23091
23092 : Finish up by extracting the .SH files
23093 case "$alldone" in
23094 exit)
23095         $rm -rf UU
23096         echo "Extraction done."
23097         exit 0
23098         ;;
23099 cont)
23100         ;;
23101 '')
23102         dflt=''
23103         nostick=true
23104         $cat <<EOM
23105
23106 If you'd like to make any changes to the config.sh file before I begin
23107 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23108
23109 EOM
23110         rp="Press return or use a shell escape to edit config.sh:"
23111         . UU/myread
23112         nostick=''
23113         case "$ans" in
23114         '') ;;
23115         *) : in case they cannot read
23116                 sh 1>&4 -c "$ans";;
23117         esac
23118         ;;
23119 esac
23120
23121 : if this fails, just run all the .SH files by hand
23122 . ./config.sh
23123
23124 echo " "
23125 exec 1>&4
23126 pwd=`pwd`
23127 . ./UU/extract
23128 cd "$pwd"
23129
23130 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23131         dflt=y
23132         case "$silent" in
23133         true) ;;
23134         *)
23135                 $cat <<EOM
23136
23137 Now you need to generate make dependencies by running "$make depend".
23138 You might prefer to run it in background: "$make depend > makedepend.out &"
23139 It can take a while, so you might not want to run it right now.
23140
23141 EOM
23142                 ;;
23143         esac
23144         rp="Run $make depend now?"
23145         . UU/myread
23146         case "$ans" in
23147         y*)
23148                 $make depend && echo "Now you must run '$make'."
23149                 ;;
23150         *)
23151                 echo "You must run '$make depend' then '$make'."
23152                 ;;
23153         esac
23154 elif test -f [Mm]akefile; then
23155         echo " "
23156         echo "Now you must run a $make."
23157 else
23158         echo "Configure done."
23159 fi
23160
23161 if $test -f Policy.sh; then
23162     $cat <<EOM
23163
23164 If you compile $package on a different machine or from a different object
23165 directory, copy the Policy.sh file from this object directory to the
23166 new one before you run Configure -- this will help you with most of
23167 the policy defaults.
23168
23169 EOM
23170 fi
23171 if $test -f config.msg; then
23172     echo "Hmm.  I also noted the following information while running:"
23173     echo " "
23174     $cat config.msg >&4
23175     $rm -f config.msg
23176 fi
23177 $rm -f kit*isdone ark*isdone
23178 $rm -rf UU
23179
23180 : End of Configure
23181