This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldelta: mention OP_PADRANGE
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist package (which contains metaconfig) is available via SVN:
17 #     svn co https://svn.sourceforge.net/svnroot/dist/trunk/dist
18 #
19 # Though this script was generated by metaconfig from metaunits, it is
20 # OK to send patches against Configure itself. It's up to the Configure
21 # pumpkin to backport the patch to the metaunits if it is accepted.
22 # For more information on patching Configure, see pod/perlhack.pod
23 #
24 # The metaunits are also available from the public git repository:
25 #     http://perl5.git.perl.org/metaconfig.git/ or
26 #     $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
27 #
28 # See Porting/pumpkin.pod for more information on metaconfig.
29 #
30
31 # Generated on Sun Aug 26 14:33:39 CEST 2012 [metaconfig 3.5 PL0]
32 # (with additional metaconfig patches by perlbug@perl.org)
33
34 cat >c1$$ <<EOF
35 ARGGGHHHH!!!!!
36
37 SCO csh still thinks true is false.  Write to SCO today and tell them that next
38 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
39
40 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
41 we'd have to do is go in and swap the && and || tokens, wherever they are.)
42
43 [End of diatribe. We now return you to your regularly scheduled programming...]
44 EOF
45 cat >c2$$ <<EOF
46
47 OOPS!  You naughty creature!  You didn't run Configure with sh!
48 I will attempt to remedy the situation by running sh for you...
49 EOF
50
51 true || cat c1$$ c2$$
52 true || exec sh $0 $argv:q
53
54 (exit $?0) || cat c2$$
55 (exit $?0) || exec sh $0 $argv:q
56 rm -f c1$$ c2$$
57
58 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
59         cat <<EOF
60 ***
61 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
62 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
63 *** Please read the README.plan9 for further instructions.
64 *** Cannot continue, aborting.
65 ***
66 EOF
67         exit 1
68 fi
69
70 if test ! -c /dev/null ; then
71         cat <<EOF
72 ***
73 *** I'm sorry, but /dev/null appears to be a file rather than a device.
74 *** Please consult your operating sytem's notes for making a device
75 *** in /dev.
76 *** Cannot continue, aborting.
77 ***
78 EOF
79         exit 1
80 fi
81
82 : compute my invocation name
83 me=$0
84 case "$0" in
85 */*)
86         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
87         test "$me" || me=$0
88         ;;
89 esac
90
91 : Proper separator for the PATH environment variable
92 p_=:
93 : On OS/2 this directory should exist if this is not floppy only system ":-]"
94 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
95         if test -n "$OS2_SHELL"; then
96                 p_=\;
97                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
98                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
99                 is_os2=yes
100         elif test -n "$DJGPP"; then
101                 case "X${MACHTYPE:-nonesuchmach}" in
102                 *cygwin) ;;
103                 *) p_=\; ;;
104                 esac
105         fi
106 fi
107
108 : Proper PATH setting
109 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
110 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
111 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
112 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
113 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
114 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
115 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
116 paths="$paths /sbin /usr/sbin /usr/libexec"
117 paths="$paths /system/gnu_library/bin"
118
119 for p in $paths
120 do
121         case "$p_$PATH$p_" in
122         *$p_$p$p_*) ;;
123         *) test -d $p && PATH=$PATH$p_$p ;;
124         esac
125 done
126
127 PATH=.$p_$PATH
128 export PATH
129
130 : shall we be using ksh?
131 inksh=''
132 needksh=''
133 avoidksh=''
134 newsh=/bin/ksh
135 changesh=''
136 if (PATH=.; alias -x) >/dev/null 2>&1; then
137                 inksh=true
138 fi
139 if test -f /hp-ux -a -f /bin/ksh; then
140         needksh='to avoid sh bug in "here document" expansion'
141 fi
142 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
143         if test X`/usr/bin/uname -v` = X4; then
144                 avoidksh="to avoid AIX 4's /bin/sh"
145                 newsh=/usr/bin/bsh
146         fi
147 fi
148 if test -f /osf_boot -a -f /usr/sbin/setld; then
149         if test X`/usr/bin/uname -s` = XOSF1; then
150                 avoidksh="to avoid Digital UNIX' ksh"
151                 newsh=/bin/sh
152                 unset BIN_SH
153         fi
154 fi
155 case "$inksh/$needksh" in
156 /[a-z]*)
157                 ENV=''
158                 changesh=true
159                 reason="$needksh"
160         ;;
161 esac
162 case "$inksh/$avoidksh" in
163 true/[a-z]*)
164         changesh=true
165         reason="$avoidksh"
166         ;;
167 esac
168 case "$inksh/$needksh-$avoidksh-" in
169 true/--)
170                 cat <<EOM
171 (I see you are using the Korn shell.  Some ksh's blow up on $me,
172 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
173 EOM
174         ;;
175 esac
176 case "$changesh" in
177 true)
178         export newsh
179         echo "(Feeding myself to $newsh $reason.)"
180         case "$0" in
181         Configure|*/Configure) exec $newsh $0 "$@";;
182         *) exec $newsh Configure "$@";;
183         esac
184         ;;
185 esac
186 test -x "${newsh}" || unset newsh
187
188 : if needed, set CDPATH to a harmless value that is not chatty
189 : avoid bash 2.02 problems with empty CDPATH.
190 case "$CDPATH" in
191 '')     ;;
192 *)      case "$SHELL" in
193         *bash*) CDPATH='.' ;;
194         *) CDPATH='' ;;
195         esac
196         ;;
197 esac
198
199 : Configure runs within the UU subdirectory
200 test -d UU || mkdir UU
201 cd UU && rm -f ./*
202
203 ccname=''
204 ccversion=''
205 ccsymbols=''
206 cppccsymbols=''
207 cppsymbols=''
208 from=''
209 run=''
210 targetarch=''
211 to=''
212 usecrosscompile=''
213 extern_C=''
214 mistrustnm=''
215 usedevel=''
216 perllibs=''
217 dynamic_ext=''
218 extensions=''
219 known_extensions=''
220 nonxs_ext=''
221 static_ext=''
222 useopcode=''
223 useposix=''
224 extras=''
225 d_bsd=''
226 d_eunice=''
227 d_xenix=''
228 eunicefix=''
229 ar=''
230 awk=''
231 bash=''
232 bison=''
233 byacc=''
234 cat=''
235 chgrp=''
236 chmod=''
237 chown=''
238 comm=''
239 compress=''
240 cp=''
241 cpio=''
242 cpp=''
243 csh=''
244 date=''
245 echo=''
246 egrep=''
247 emacs=''
248 expr=''
249 find=''
250 flex=''
251 gmake=''
252 grep=''
253 gzip=''
254 inews=''
255 ksh=''
256 less=''
257 line=''
258 lint=''
259 ln=''
260 lp=''
261 lpr=''
262 ls=''
263 mail=''
264 mailx=''
265 make=''
266 mkdir=''
267 more=''
268 mv=''
269 nm=''
270 nroff=''
271 perl=''
272 pg=''
273 pmake=''
274 pr=''
275 rm=''
276 rmail=''
277 sed=''
278 sendmail=''
279 shar=''
280 sleep=''
281 smail=''
282 sort=''
283 submit=''
284 tail=''
285 tar=''
286 tbl=''
287 tee=''
288 test=''
289 touch=''
290 tr=''
291 troff=''
292 uname=''
293 uniq=''
294 uuname=''
295 vi=''
296 zcat=''
297 zip=''
298 full_ar=''
299 full_sed=''
300 libswanted=''
301 hint=''
302 myuname=''
303 osname=''
304 osvers=''
305 Author=''
306 Date=''
307 Header=''
308 Id=''
309 Locker=''
310 Log=''
311 RCSfile=''
312 Revision=''
313 Source=''
314 State=''
315 _a=''
316 _exe=''
317 _o=''
318 archobjs=''
319 exe_ext=''
320 firstmakefile=''
321 lib_ext=''
322 obj_ext=''
323 path_sep=''
324 rm_try=''
325 afs=''
326 afsroot=''
327 alignbytes=''
328 ansi2knr=''
329 archlib=''
330 archlibexp=''
331 d_archlib=''
332 installarchlib=''
333 archname=''
334 myarchname=''
335 d_atolf=''
336 d_atoll=''
337 baserev=''
338 bin=''
339 binexp=''
340 initialinstalllocation=''
341 installbin=''
342 userelocatableinc=''
343 byteorder=''
344 cc=''
345 ccflags=''
346 cppflags=''
347 ldflags=''
348 lkflags=''
349 locincpth=''
350 optimize=''
351 cf_email=''
352 cf_by=''
353 cf_time=''
354 charbits=''
355 charsize=''
356 contains=''
357 cpp_stuff=''
358 cpplast=''
359 cppminus=''
360 cpprun=''
361 cppstdin=''
362 d__fwalk=''
363 d_access=''
364 d_accessx=''
365 d_aintl=''
366 d_alarm=''
367 asctime_r_proto=''
368 d_asctime_r=''
369 d_attribute_deprecated=''
370 d_attribute_format=''
371 d_attribute_malloc=''
372 d_attribute_nonnull=''
373 d_attribute_noreturn=''
374 d_attribute_pure=''
375 d_attribute_unused=''
376 d_attribute_warn_unused_result=''
377 d_printf_format_null=''
378 d_bcmp=''
379 d_bcopy=''
380 d_builtin_choose_expr=''
381 d_builtin_expect=''
382 d_bzero=''
383 d_c99_variadic_macros=''
384 d_casti32=''
385 castflags=''
386 d_castneg=''
387 d_chown=''
388 d_chroot=''
389 d_chsize=''
390 d_class=''
391 d_clearenv=''
392 d_closedir=''
393 d_void_closedir=''
394 d_cmsghdr_s=''
395 d_const=''
396 d_copysignl=''
397 d_cplusplus=''
398 cryptlib=''
399 d_crypt=''
400 crypt_r_proto=''
401 d_crypt_r=''
402 d_csh=''
403 full_csh=''
404 d_ctermid=''
405 ctermid_r_proto=''
406 d_ctermid_r=''
407 ctime_r_proto=''
408 d_ctime_r=''
409 d_cuserid=''
410 d_dbl_dig=''
411 d_dbminitproto=''
412 d_difftime=''
413 d_dir_dd_fd=''
414 d_dirfd=''
415 d_dlerror=''
416 d_dlopen=''
417 d_dlsymun=''
418 d_dosuid=''
419 d_suidsafe=''
420 d_drand48_r=''
421 drand48_r_proto=''
422 d_drand48proto=''
423 d_dup2=''
424 d_eaccess=''
425 d_endgrent=''
426 d_endgrent_r=''
427 endgrent_r_proto=''
428 d_endhent=''
429 d_endhostent_r=''
430 endhostent_r_proto=''
431 d_endnent=''
432 d_endnetent_r=''
433 endnetent_r_proto=''
434 d_endpent=''
435 d_endprotoent_r=''
436 endprotoent_r_proto=''
437 d_endpwent=''
438 d_endpwent_r=''
439 endpwent_r_proto=''
440 d_endsent=''
441 d_endservent_r=''
442 endservent_r_proto=''
443 d_faststdio=''
444 d_fchdir=''
445 d_fchmod=''
446 d_fchown=''
447 d_fcntl=''
448 d_fcntl_can_lock=''
449 d_fd_macros=''
450 d_fd_set=''
451 d_fds_bits=''
452 d_fgetpos=''
453 d_finite=''
454 d_finitel=''
455 d_flexfnam=''
456 d_flock=''
457 d_flockproto=''
458 d_fork=''
459 d_fp_class=''
460 d_fpclass=''
461 d_fpclassify=''
462 d_fpclassl=''
463 d_fpos64_t=''
464 d_frexpl=''
465 d_fs_data_s=''
466 d_fseeko=''
467 d_fsetpos=''
468 d_fstatfs=''
469 d_fsync=''
470 d_ftello=''
471 d_ftime=''
472 d_gettimeod=''
473 d_futimes=''
474 d_Gconvert=''
475 d_getaddrinfo=''
476 d_getcwd=''
477 d_getespwnam=''
478 d_getfsstat=''
479 d_getgrent=''
480 d_getgrent_r=''
481 getgrent_r_proto=''
482 d_getgrgid_r=''
483 getgrgid_r_proto=''
484 d_getgrnam_r=''
485 getgrnam_r_proto=''
486 d_getgrps=''
487 d_gethbyaddr=''
488 d_gethbyname=''
489 d_gethent=''
490 aphostname=''
491 d_gethname=''
492 d_phostname=''
493 d_uname=''
494 d_gethostbyaddr_r=''
495 gethostbyaddr_r_proto=''
496 d_gethostbyname_r=''
497 gethostbyname_r_proto=''
498 d_gethostent_r=''
499 gethostent_r_proto=''
500 d_gethostprotos=''
501 d_getitimer=''
502 d_getlogin=''
503 d_getlogin_r=''
504 getlogin_r_proto=''
505 d_getmnt=''
506 d_getmntent=''
507 d_getnameinfo=''
508 d_getnbyaddr=''
509 d_getnbyname=''
510 d_getnent=''
511 d_getnetbyaddr_r=''
512 getnetbyaddr_r_proto=''
513 d_getnetbyname_r=''
514 getnetbyname_r_proto=''
515 d_getnetent_r=''
516 getnetent_r_proto=''
517 d_getnetprotos=''
518 d_getpagsz=''
519 d_getpent=''
520 d_getpgid=''
521 d_getpgrp2=''
522 d_bsdgetpgrp=''
523 d_getpgrp=''
524 d_getppid=''
525 d_getprior=''
526 d_getpbyname=''
527 d_getpbynumber=''
528 d_getprotobyname_r=''
529 getprotobyname_r_proto=''
530 d_getprotobynumber_r=''
531 getprotobynumber_r_proto=''
532 d_getprotoent_r=''
533 getprotoent_r_proto=''
534 d_getprotoprotos=''
535 d_getprpwnam=''
536 d_getpwent=''
537 d_getpwent_r=''
538 getpwent_r_proto=''
539 d_getpwnam_r=''
540 getpwnam_r_proto=''
541 d_getpwuid_r=''
542 getpwuid_r_proto=''
543 d_getsent=''
544 d_getservbyname_r=''
545 getservbyname_r_proto=''
546 d_getservbyport_r=''
547 getservbyport_r_proto=''
548 d_getservent_r=''
549 getservent_r_proto=''
550 d_getservprotos=''
551 d_getspnam=''
552 d_getspnam_r=''
553 getspnam_r_proto=''
554 d_getsbyname=''
555 d_getsbyport=''
556 d_gmtime_r=''
557 gmtime_r_proto=''
558 d_gnulibc=''
559 gnulibc_version=''
560 d_hasmntopt=''
561 d_htonl=''
562 d_ilogbl=''
563 d_inetaton=''
564 d_inetntop=''
565 d_inetpton=''
566 d_int64_t=''
567 d_isascii=''
568 d_isblank=''
569 d_isfinite=''
570 d_isinf=''
571 d_isnan=''
572 d_isnanl=''
573 d_killpg=''
574 d_lchown=''
575 d_ldbl_dig=''
576 d_libm_lib_version=''
577 d_link=''
578 d_localtime_r=''
579 d_localtime_r_needs_tzset=''
580 localtime_r_proto=''
581 d_locconv=''
582 d_lockf=''
583 d_longdbl=''
584 longdblsize=''
585 d_longlong=''
586 longlongsize=''
587 d_lseekproto=''
588 d_lstat=''
589 d_madvise=''
590 d_malloc_good_size=''
591 d_malloc_size=''
592 d_mblen=''
593 d_mbstowcs=''
594 d_mbtowc=''
595 d_memchr=''
596 d_memcmp=''
597 d_memcpy=''
598 d_memmove=''
599 d_memset=''
600 d_mkdir=''
601 d_mkdtemp=''
602 d_mkfifo=''
603 d_mkstemp=''
604 d_mkstemps=''
605 d_mktime=''
606 d_mmap=''
607 mmaptype=''
608 d_modfl=''
609 d_modfl_pow32_bug=''
610 d_modflproto=''
611 d_mprotect=''
612 d_msg=''
613 d_msgctl=''
614 d_msgget=''
615 d_msghdr_s=''
616 d_msgrcv=''
617 d_msgsnd=''
618 d_msync=''
619 d_munmap=''
620 d_nice=''
621 d_nl_langinfo=''
622 d_off64_t=''
623 d_open3=''
624 d_fpathconf=''
625 d_pathconf=''
626 d_pause=''
627 d_pipe=''
628 d_poll=''
629 d_portable=''
630 d_prctl=''
631 d_prctl_set_name=''
632 d_procselfexe=''
633 procselfexe=''
634 d_old_pthread_create_joinable=''
635 old_pthread_create_joinable=''
636 d_pthread_atfork=''
637 d_pthread_attr_setscope=''
638 d_pthread_yield=''
639 d_sched_yield=''
640 sched_yield=''
641 d_qgcvt=''
642 d_random_r=''
643 random_r_proto=''
644 d_readdir64_r=''
645 readdir64_r_proto=''
646 d_readdir=''
647 d_rewinddir=''
648 d_seekdir=''
649 d_telldir=''
650 d_readdir_r=''
651 readdir_r_proto=''
652 d_readlink=''
653 d_readv=''
654 d_recvmsg=''
655 d_rename=''
656 d_rmdir=''
657 d_safebcpy=''
658 d_safemcpy=''
659 d_sanemcmp=''
660 d_sbrkproto=''
661 d_scalbnl=''
662 d_select=''
663 d_sem=''
664 d_semctl=''
665 d_semget=''
666 d_semop=''
667 d_sendmsg=''
668 d_setegid=''
669 d_seteuid=''
670 d_setgrent=''
671 d_setgrent_r=''
672 setgrent_r_proto=''
673 d_setgrps=''
674 d_sethent=''
675 d_sethostent_r=''
676 sethostent_r_proto=''
677 d_setitimer=''
678 d_setlinebuf=''
679 d_setlocale=''
680 d_setlocale_r=''
681 setlocale_r_proto=''
682 d_setnent=''
683 d_setnetent_r=''
684 setnetent_r_proto=''
685 d_setpent=''
686 d_setpgid=''
687 d_setpgrp2=''
688 d_bsdsetpgrp=''
689 d_setpgrp=''
690 d_setprior=''
691 d_setproctitle=''
692 d_setprotoent_r=''
693 setprotoent_r_proto=''
694 d_setpwent=''
695 d_setpwent_r=''
696 setpwent_r_proto=''
697 d_setregid=''
698 d_setresgid=''
699 d_setresuid=''
700 d_setreuid=''
701 d_setrgid=''
702 d_setruid=''
703 d_setsent=''
704 d_setservent_r=''
705 setservent_r_proto=''
706 d_setsid=''
707 d_setvbuf=''
708 d_sfio=''
709 usesfio=''
710 d_shm=''
711 d_shmat=''
712 d_shmatprototype=''
713 shmattype=''
714 d_shmctl=''
715 d_shmdt=''
716 d_shmget=''
717 d_sigaction=''
718 d_signbit=''
719 d_sigprocmask=''
720 d_sigsetjmp=''
721 usesitecustomize=''
722 d_snprintf=''
723 d_vsnprintf=''
724 d_sockatmark=''
725 d_sockatmarkproto=''
726 d_ip_mreq=''
727 d_ip_mreq_source=''
728 d_ipv6_mreq=''
729 d_ipv6_mreq_source=''
730 d_msg_ctrunc=''
731 d_msg_dontroute=''
732 d_msg_oob=''
733 d_msg_peek=''
734 d_msg_proxy=''
735 d_oldsock=''
736 d_scm_rights=''
737 d_sin6_scope_id=''
738 d_sockaddr_in6=''
739 d_sockaddr_sa_len=''
740 d_socket=''
741 d_sockpair=''
742 sockethdr=''
743 socketlib=''
744 d_socklen_t=''
745 d_socks5_init=''
746 d_sprintf_returns_strlen=''
747 d_sqrtl=''
748 d_srand48_r=''
749 srand48_r_proto=''
750 d_srandom_r=''
751 srandom_r_proto=''
752 d_sresgproto=''
753 d_sresuproto=''
754 d_statblks=''
755 d_statfs_f_flags=''
756 d_statfs_s=''
757 d_static_inline=''
758 perl_static_inline=''
759 d_fstatvfs=''
760 d_statvfs=''
761 d_stdio_cnt_lval=''
762 d_stdio_ptr_lval=''
763 d_stdio_ptr_lval_nochange_cnt=''
764 d_stdio_ptr_lval_sets_cnt=''
765 d_stdiobase=''
766 d_stdstdio=''
767 stdio_base=''
768 stdio_bufsiz=''
769 stdio_cnt=''
770 stdio_filbuf=''
771 stdio_ptr=''
772 d_index=''
773 d_strchr=''
774 d_strcoll=''
775 d_strctcpy=''
776 d_strerrm=''
777 d_strerror=''
778 d_sysernlst=''
779 d_syserrlst=''
780 d_strerror_r=''
781 strerror_r_proto=''
782 d_strftime=''
783 d_strlcat=''
784 d_strlcpy=''
785 d_strtod=''
786 d_strtol=''
787 d_strtold=''
788 d_strtoll=''
789 d_strtoq=''
790 d_strtoul=''
791 d_strtoull=''
792 d_strtouq=''
793 d_strxfrm=''
794 d_symlink=''
795 d_syscall=''
796 d_syscallproto=''
797 d_sysconf=''
798 d_system=''
799 d_tcgetpgrp=''
800 d_tcsetpgrp=''
801 d_telldirproto=''
802 d_time=''
803 timetype=''
804 d_asctime64=''
805 d_ctime64=''
806 d_difftime64=''
807 d_gmtime64=''
808 d_localtime64=''
809 d_mktime64=''
810 d_timegm=''
811 clocktype=''
812 d_times=''
813 d_tmpnam_r=''
814 tmpnam_r_proto=''
815 d_truncate=''
816 d_ttyname_r=''
817 ttyname_r_proto=''
818 d_tzname=''
819 d_u32align=''
820 d_ualarm=''
821 d_umask=''
822 d_semctl_semid_ds=''
823 d_semctl_semun=''
824 d_union_semun=''
825 d_unordered=''
826 d_unsetenv=''
827 d_usleep=''
828 d_usleepproto=''
829 d_ustat=''
830 d_pseudofork=''
831 d_vfork=''
832 usevfork=''
833 d_voidsig=''
834 signal_t=''
835 d_volatile=''
836 d_charvspr=''
837 d_vprintf=''
838 d_wait4=''
839 d_waitpid=''
840 d_wcstombs=''
841 d_wctomb=''
842 d_writev=''
843 dlext=''
844 bin_ELF=''
845 cccdlflags=''
846 ccdlflags=''
847 dlsrc=''
848 ld=''
849 ld_can_script=''
850 lddlflags=''
851 usedl=''
852 doublesize=''
853 ebcdic=''
854 fflushNULL=''
855 fflushall=''
856 fpossize=''
857 fpostype=''
858 gccansipedantic=''
859 gccosandvers=''
860 gccversion=''
861 gidformat=''
862 gidsign=''
863 gidsize=''
864 gidtype=''
865 groupstype=''
866 h_fcntl=''
867 h_sysfile=''
868 html1dir=''
869 html1direxp=''
870 installhtml1dir=''
871 html3dir=''
872 html3direxp=''
873 installhtml3dir=''
874 i_arpainet=''
875 i_assert=''
876 i_crypt=''
877 db_hashtype=''
878 db_prefixtype=''
879 db_version_major=''
880 db_version_minor=''
881 db_version_patch=''
882 i_db=''
883 i_dbm=''
884 i_rpcsvcdbm=''
885 d_dirnamlen=''
886 direntrytype=''
887 i_dirent=''
888 i_dld=''
889 i_dlfcn=''
890 i_fcntl=''
891 i_float=''
892 i_fp=''
893 i_fp_class=''
894 i_gdbm=''
895 d_grpasswd=''
896 i_grp=''
897 i_ieeefp=''
898 i_inttypes=''
899 i_langinfo=''
900 i_libutil=''
901 i_limits=''
902 i_locale=''
903 i_machcthr=''
904 i_malloc=''
905 i_mallocmalloc=''
906 i_math=''
907 i_memory=''
908 i_mntent=''
909 d_gdbm_ndbm_h_uses_prototypes=''
910 d_gdbmndbm_h_uses_prototypes=''
911 d_ndbm=''
912 d_ndbm_h_uses_prototypes=''
913 i_gdbm_ndbm=''
914 i_gdbmndbm=''
915 i_ndbm=''
916 i_netdb=''
917 i_neterrno=''
918 i_netinettcp=''
919 i_niin=''
920 i_sysin=''
921 i_poll=''
922 i_prot=''
923 i_pthread=''
924 d_pwage=''
925 d_pwchange=''
926 d_pwclass=''
927 d_pwcomment=''
928 d_pwexpire=''
929 d_pwgecos=''
930 d_pwpasswd=''
931 d_pwquota=''
932 i_pwd=''
933 i_sfio=''
934 i_shadow=''
935 i_socks=''
936 i_stdbool=''
937 i_stddef=''
938 i_stdlib=''
939 i_string=''
940 strings=''
941 i_sunmath=''
942 i_sysaccess=''
943 i_sysdir=''
944 i_sysfile=''
945 d_voidtty=''
946 i_bsdioctl=''
947 i_sysfilio=''
948 i_sysioctl=''
949 i_syssockio=''
950 i_syslog=''
951 i_sysmman=''
952 i_sysmode=''
953 i_sysmount=''
954 i_sysndir=''
955 i_sysparam=''
956 i_syspoll=''
957 i_sysresrc=''
958 i_syssecrt=''
959 i_sysselct=''
960 i_sysstat=''
961 i_sysstatfs=''
962 i_sysstatvfs=''
963 i_systimes=''
964 i_systypes=''
965 i_sysuio=''
966 i_sysun=''
967 i_sysutsname=''
968 i_sysvfs=''
969 i_syswait=''
970 i_sgtty=''
971 i_termio=''
972 i_termios=''
973 d_tm_tm_gmtoff=''
974 d_tm_tm_zone=''
975 i_systime=''
976 i_systimek=''
977 i_time=''
978 timeincl=''
979 i_unistd=''
980 i_ustat=''
981 i_utime=''
982 i_values=''
983 i_stdarg=''
984 i_varargs=''
985 i_varhdr=''
986 i_vfork=''
987 d_inc_version_list=''
988 inc_version_list=''
989 inc_version_list_init=''
990 installprefix=''
991 installprefixexp=''
992 installstyle=''
993 installusrbinperl=''
994 intsize=''
995 longsize=''
996 shortsize=''
997 issymlink=''
998 libc=''
999 ldlibpthname=''
1000 libperl=''
1001 shrpenv=''
1002 useshrplib=''
1003 glibpth=''
1004 libpth=''
1005 loclibpth=''
1006 plibpth=''
1007 xlibpth=''
1008 ignore_versioned_solibs=''
1009 libs=''
1010 libsdirs=''
1011 libsfiles=''
1012 libsfound=''
1013 libspath=''
1014 lns=''
1015 d_PRIEUldbl=''
1016 d_PRIFUldbl=''
1017 d_PRIGUldbl=''
1018 d_PRIeldbl=''
1019 d_PRIfldbl=''
1020 d_PRIgldbl=''
1021 d_SCNfldbl=''
1022 sPRIEUldbl=''
1023 sPRIFUldbl=''
1024 sPRIGUldbl=''
1025 sPRIeldbl=''
1026 sPRIfldbl=''
1027 sPRIgldbl=''
1028 sSCNfldbl=''
1029 lseeksize=''
1030 lseektype=''
1031 mad=''
1032 madlyh=''
1033 madlyobj=''
1034 madlysrc=''
1035 make_set_make=''
1036 d_mymalloc=''
1037 freetype=''
1038 mallocobj=''
1039 mallocsrc=''
1040 malloctype=''
1041 usemallocwrap=''
1042 usemymalloc=''
1043 installman1dir=''
1044 man1dir=''
1045 man1direxp=''
1046 man1ext=''
1047 installman3dir=''
1048 man3dir=''
1049 man3direxp=''
1050 man3ext=''
1051 modetype=''
1052 multiarch=''
1053 mydomain=''
1054 myhostname=''
1055 phostname=''
1056 c=''
1057 n=''
1058 d_eofnblk=''
1059 eagain=''
1060 o_nonblock=''
1061 rd_nodata=''
1062 need_va_copy=''
1063 netdb_hlen_type=''
1064 netdb_host_type=''
1065 netdb_name_type=''
1066 netdb_net_type=''
1067 groupcat=''
1068 hostcat=''
1069 passcat=''
1070 orderlib=''
1071 ranlib=''
1072 d_perl_otherlibdirs=''
1073 otherlibdirs=''
1074 package=''
1075 spackage=''
1076 pager=''
1077 api_revision=''
1078 api_subversion=''
1079 api_version=''
1080 api_versionstring=''
1081 patchlevel=''
1082 perl_patchlevel=''
1083 revision=''
1084 subversion=''
1085 version=''
1086 version_patchlevel_string=''
1087 perl5=''
1088 perladmin=''
1089 perlpath=''
1090 d_nv_preserves_uv=''
1091 d_nv_zero_is_allbits_zero=''
1092 i16size=''
1093 i16type=''
1094 i32size=''
1095 i32type=''
1096 i64size=''
1097 i64type=''
1098 i8size=''
1099 i8type=''
1100 ivsize=''
1101 ivtype=''
1102 nv_overflows_integers_at=''
1103 nv_preserves_uv_bits=''
1104 nvsize=''
1105 nvtype=''
1106 u16size=''
1107 u16type=''
1108 u32size=''
1109 u32type=''
1110 u64size=''
1111 u64type=''
1112 u8size=''
1113 u8type=''
1114 uvsize=''
1115 uvtype=''
1116 ivdformat=''
1117 nvEUformat=''
1118 nvFUformat=''
1119 nvGUformat=''
1120 nveformat=''
1121 nvfformat=''
1122 nvgformat=''
1123 uvXUformat=''
1124 uvoformat=''
1125 uvuformat=''
1126 uvxformat=''
1127 pidtype=''
1128 prefix=''
1129 prefixexp=''
1130 installprivlib=''
1131 privlib=''
1132 privlibexp=''
1133 prototype=''
1134 ptrsize=''
1135 d_PRIXU64=''
1136 d_PRId64=''
1137 d_PRIi64=''
1138 d_PRIo64=''
1139 d_PRIu64=''
1140 d_PRIx64=''
1141 sPRIXU64=''
1142 sPRId64=''
1143 sPRIi64=''
1144 sPRIo64=''
1145 sPRIu64=''
1146 sPRIx64=''
1147 d_quad=''
1148 quadkind=''
1149 quadtype=''
1150 uquadtype=''
1151 drand01=''
1152 randbits=''
1153 randfunc=''
1154 randseedtype=''
1155 seedfunc=''
1156 installscript=''
1157 scriptdir=''
1158 scriptdirexp=''
1159 selectminbits=''
1160 selecttype=''
1161 sh=''
1162 sig_count=''
1163 sig_name=''
1164 sig_name_init=''
1165 sig_num=''
1166 sig_num_init=''
1167 sig_size=''
1168 d_sitearch=''
1169 installsitearch=''
1170 sitearch=''
1171 sitearchexp=''
1172 installsitebin=''
1173 sitebin=''
1174 sitebinexp=''
1175 installsitehtml1dir=''
1176 sitehtml1dir=''
1177 sitehtml1direxp=''
1178 installsitehtml3dir=''
1179 sitehtml3dir=''
1180 sitehtml3direxp=''
1181 installsitelib=''
1182 sitelib=''
1183 sitelib_stem=''
1184 sitelibexp=''
1185 installsiteman1dir=''
1186 siteman1dir=''
1187 siteman1direxp=''
1188 installsiteman3dir=''
1189 siteman3dir=''
1190 siteman3direxp=''
1191 siteprefix=''
1192 siteprefixexp=''
1193 installsitescript=''
1194 sitescript=''
1195 sitescriptexp=''
1196 sizesize=''
1197 sizetype=''
1198 so=''
1199 socksizetype=''
1200 sharpbang=''
1201 shsharp=''
1202 spitshell=''
1203 src=''
1204 ssizetype=''
1205 st_ino_sign=''
1206 st_ino_size=''
1207 startperl=''
1208 startsh=''
1209 stdchar=''
1210 d_stdio_stream_array=''
1211 stdio_stream_array=''
1212 sysman=''
1213 sGMTIME_max=''
1214 sGMTIME_min=''
1215 sLOCALTIME_max=''
1216 sLOCALTIME_min=''
1217 trnl=''
1218 uidformat=''
1219 uidsign=''
1220 uidsize=''
1221 uidtype=''
1222 archname64=''
1223 use64bitall=''
1224 use64bitint=''
1225 dtrace=''
1226 usedtrace=''
1227 usefaststdio=''
1228 usekernprocpathname=''
1229 ccflags_uselargefiles=''
1230 ldflags_uselargefiles=''
1231 libswanted_uselargefiles=''
1232 uselargefiles=''
1233 uselongdouble=''
1234 usemorebits=''
1235 usemultiplicity=''
1236 nm_opt=''
1237 nm_so_opt=''
1238 runnm=''
1239 usenm=''
1240 usensgetexecutablepath=''
1241 useperlio=''
1242 usesocks=''
1243 d_oldpthreads=''
1244 use5005threads=''
1245 useithreads=''
1246 usereentrant=''
1247 usethreads=''
1248 incpath=''
1249 mips_type=''
1250 usrinc=''
1251 vaproto=''
1252 d_vendorarch=''
1253 installvendorarch=''
1254 vendorarch=''
1255 vendorarchexp=''
1256 d_vendorbin=''
1257 installvendorbin=''
1258 vendorbin=''
1259 vendorbinexp=''
1260 installvendorhtml1dir=''
1261 vendorhtml1dir=''
1262 vendorhtml1direxp=''
1263 installvendorhtml3dir=''
1264 vendorhtml3dir=''
1265 vendorhtml3direxp=''
1266 d_vendorlib=''
1267 installvendorlib=''
1268 vendorlib=''
1269 vendorlib_stem=''
1270 vendorlibexp=''
1271 installvendorman1dir=''
1272 vendorman1dir=''
1273 vendorman1direxp=''
1274 installvendorman3dir=''
1275 vendorman3dir=''
1276 vendorman3direxp=''
1277 usevendorprefix=''
1278 vendorprefix=''
1279 vendorprefixexp=''
1280 d_vendorscript=''
1281 installvendorscript=''
1282 vendorscript=''
1283 vendorscriptexp=''
1284 versiononly=''
1285 defvoidused=''
1286 voidflags=''
1287 yacc=''
1288 yaccflags=''
1289 CONFIG=''
1290
1291 : Detect odd OSs
1292 define='define'
1293 undef='undef'
1294 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1295 rmlist=''
1296
1297 : We must find out about Eunice early
1298 eunicefix=':'
1299 if test -f /etc/unixtovms; then
1300         eunicefix=/etc/unixtovms
1301 fi
1302 if test -f /etc/unixtovms.exe; then
1303         eunicefix=/etc/unixtovms.exe
1304 fi
1305
1306 : Set executable suffix now -- needed before hints available
1307 if test -f "/libs/version.library"; then
1308 : Amiga OS
1309     _exe=""
1310 elif test -f "/system/gnu_library/bin/ar.pm"; then
1311 : Stratus VOS
1312     _exe=".pm"
1313 elif test -n "$DJGPP"; then
1314 : DOS DJGPP
1315     _exe=".exe"
1316 elif test -d c:/. -o -n "$is_os2" ; then
1317 : OS/2 or cygwin
1318     _exe=".exe"
1319 fi
1320
1321 groupstype=''
1322 i_whoami=''
1323 : Trailing extension.  Override this in a hint file, if needed.
1324 : Extra object files, if any, needed on this platform.
1325 archobjs=''
1326 archname=''
1327 : Possible local include directories to search.
1328 : Set locincpth to "" in a hint file to defeat local include searches.
1329 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1330 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1331 :
1332 : no include file wanted by default
1333 inclwanted=''
1334
1335 : Enable -DEBUGGING and -DDEBUGGING from the command line
1336 EBUGGING=''
1337 DEBUGGING=''
1338
1339 libnames=''
1340 : change the next line if compiling for Xenix/286 on Xenix/386
1341 xlibpth='/usr/lib/386 /lib/386'
1342 : Possible local library directories to search.
1343 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1344 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1345
1346 : general looking path for locating libraries
1347 glibpth="/lib /usr/lib $xlibpth"
1348 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1349 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1350 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1351 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1352
1353 : Private path used by Configure to find libraries.  Its value
1354 : is prepended to libpth. This variable takes care of special
1355 : machines, like the mips.  Usually, it should be empty.
1356 plibpth=''
1357
1358 : default library list
1359 libswanted=''
1360 : some systems want to use only the non-versioned libso:s
1361 ignore_versioned_solibs=''
1362 : set usethreads on the Configure command line to enable threads.
1363 usereentrant='undef'
1364 : full support for void wanted by default
1365 defvoidused=15
1366
1367 ccname=''
1368 ccversion=''
1369 perllibs=''
1370 : set useposix=false in your hint file to disable the POSIX extension.
1371 useposix=true
1372 : set useopcode=false in your hint file to disable the Opcode extension.
1373 useopcode=true
1374 archname64=''
1375 ccflags_uselargefiles=''
1376 ldflags_uselargefiles=''
1377 libswanted_uselargefiles=''
1378 : set usemultiplicity on the Configure command line to enable multiplicity.
1379 : set usesocks on the Configure command line to enable socks.
1380 : List of libraries we want.
1381 : If anyone needs extra -lxxx, put those in a hint file.
1382 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1383 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1384 : We probably want to search /usr/shlib before most other libraries.
1385 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1386 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1387 glibpth="/usr/shlib $glibpth"
1388 : Do not use vfork unless overridden by a hint file.
1389 usevfork=false
1390
1391 : Find the basic shell for Bourne shell scripts
1392 case "$sh" in
1393 '')
1394         case "$SYSTYPE" in
1395         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1396         *) xxx='/bin/sh';;
1397         esac
1398         if test -f "$xxx"; then
1399                 sh="$xxx"
1400         else
1401                 : Build up a list and do a single loop so we can 'break' out.
1402                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1403                 for xxx in sh bash ksh pdksh ash; do
1404                         for p in $pth; do
1405                                 try="$try ${p}/${xxx}"
1406                         done
1407                 done
1408                 for xxx in $try; do
1409                         if test -f "$xxx"; then
1410                                 sh="$xxx";
1411                                 break
1412                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1413                                 sh="$xxx";
1414                                 break
1415                         elif test -f "$xxx.exe"; then
1416                                 sh="$xxx";
1417                                 break
1418                         fi
1419                 done
1420         fi
1421         ;;
1422 esac
1423
1424 case "$sh" in
1425 '')     cat >&2 <<EOM
1426 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1427
1428 Usually it's in /bin/sh.  How did you even get this far?
1429 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1430 we'll try to straighten this all out.
1431 EOM
1432         exit 1
1433         ;;
1434 esac
1435
1436 : see if sh knows # comments
1437 if `$sh -c '#' >/dev/null 2>&1`; then
1438         shsharp=true
1439         spitshell=cat
1440         xcat=/bin/cat
1441         test -f $xcat$_exe || xcat=/usr/bin/cat
1442         if test ! -f $xcat$_exe; then
1443                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1444                         if test -f $p/cat$_exe; then
1445                                 xcat=$p/cat
1446                                 break
1447                         fi
1448                 done
1449                 if test ! -f $xcat$_exe; then
1450                         echo "Can't find cat anywhere!"
1451                         exit 1
1452                 fi
1453         fi
1454         echo "#!$xcat" >sharp
1455         $eunicefix sharp
1456         chmod +x sharp
1457         ./sharp > today 2>/dev/null
1458         if test -s today; then
1459                 sharpbang='#!'
1460         else
1461                 echo "#! $xcat" > sharp
1462                 $eunicefix sharp
1463                 chmod +x sharp
1464                 ./sharp > today 2>/dev/null
1465                 if test -s today; then
1466                         sharpbang='#! '
1467                 else
1468                         sharpbang=': use '
1469                 fi
1470         fi
1471 else
1472         echo " "
1473         echo "Your $sh doesn't grok # comments--I will strip them later on."
1474         shsharp=false
1475         cd ..
1476         echo "exec grep -v '^[  ]*#'" >spitshell
1477         chmod +x spitshell
1478         $eunicefix spitshell
1479         spitshell=`pwd`/spitshell
1480         cd UU
1481         echo "I presume that if # doesn't work, #! won't work either!"
1482         sharpbang=': use '
1483 fi
1484 rm -f sharp today
1485
1486 : figure out how to guarantee sh startup
1487 case "$startsh" in
1488 '') startsh=${sharpbang}${sh} ;;
1489 *)
1490 esac
1491 cat >sharp <<EOSS
1492 $startsh
1493 set abc
1494 test "$?abc" != 1
1495 EOSS
1496
1497 chmod +x sharp
1498 $eunicefix sharp
1499 if ./sharp; then
1500         : echo "Yup, it does."
1501 else
1502         echo "Hmm... '$startsh' does not guarantee sh startup..."
1503         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1504 fi
1505 rm -f sharp
1506
1507 : Save command line options in file UU/cmdline.opt for later use in
1508 : generating config.sh.
1509 cat > cmdline.opt <<EOSH
1510 : Configure command line arguments.
1511 config_arg0='$0'
1512 config_args='$*'
1513 config_argc=$#
1514 EOSH
1515 argn=1
1516 args_exp=''
1517 args_sep=''
1518 for arg in "$@"; do
1519         cat >>cmdline.opt <<EOSH
1520 config_arg$argn='$arg'
1521 EOSH
1522         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1523 $arg
1524 EOC
1525         arg_exp=`cat cmdl.opt`
1526         args_exp="$args_exp$args_sep'$arg_exp'"
1527         argn=`expr $argn + 1`
1528         args_sep=' '
1529 done
1530 rm -f cmdl.opt
1531
1532 : produce awk script to parse command line options
1533 cat >options.awk <<'EOF'
1534 BEGIN {
1535         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1536
1537         len = length(optstr);
1538         for (i = 1; i <= len; i++) {
1539                 c = substr(optstr, i, 1);
1540                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1541                 if (a == ":") {
1542                         arg[c] = 1;
1543                         i++;
1544                 }
1545                 opt[c] = 1;
1546         }
1547 }
1548 {
1549         expect = 0;
1550         str = $0;
1551         if (substr(str, 1, 1) != "-") {
1552                 printf("'%s'\n", str);
1553                 next;
1554         }
1555         len = length($0);
1556         for (i = 2; i <= len; i++) {
1557                 c = substr(str, i, 1);
1558                 if (!opt[c]) {
1559                         printf("-%s\n", substr(str, i));
1560                         next;
1561                 }
1562                 printf("-%s\n", c);
1563                 if (arg[c]) {
1564                         if (i < len)
1565                                 printf("'%s'\n", substr(str, i + 1));
1566                         else
1567                                 expect = 1;
1568                         next;
1569                 }
1570         }
1571 }
1572 END {
1573         if (expect)
1574                 print "?";
1575 }
1576 EOF
1577
1578 : process the command line options
1579 set X `for arg in "$@"; do echo "X$arg"; done |
1580         sed -e s/X// | awk -f options.awk`
1581 eval "set $*"
1582 shift
1583 rm -f options.awk
1584
1585 : set up default values
1586 fastread=''
1587 reuseval=false
1588 config_sh=''
1589 alldone=''
1590 error=''
1591 silent=''
1592 extractsh=''
1593 override=''
1594 knowitall=''
1595 rm -f optdef.sh posthint.sh
1596 cat >optdef.sh <<EOS
1597 $startsh
1598 EOS
1599
1600
1601 : option parsing
1602 while test $# -gt 0; do
1603         case "$1" in
1604         -d) shift; fastread=yes;;
1605         -e) shift; alldone=cont;;
1606         -f)
1607                 shift
1608                 cd ..
1609                 if test -r "$1"; then
1610                         config_sh="$1"
1611                 else
1612                         echo "$me: cannot read config file $1." >&2
1613                         error=true
1614                 fi
1615                 cd UU
1616                 shift;;
1617         --help|\
1618         -h) shift; error=true;;
1619         -r) shift; reuseval=true;;
1620         -s) shift; silent=true; realsilent=true;;
1621         -E) shift; alldone=exit;;
1622         -K) shift; knowitall=true;;
1623         -O) shift; override=true;;
1624         -S) shift; silent=true; extractsh=true;;
1625         -D)
1626                 shift
1627                 case "$1" in
1628                 *=)
1629                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1630                         echo "$me: ignoring -D $1" >&2
1631                         ;;
1632                 *=*) echo "$1" | \
1633                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1634                 *) echo "$1='define'" >> optdef.sh;;
1635                 esac
1636                 shift
1637                 ;;
1638         -U)
1639                 shift
1640                 case "$1" in
1641                 *=) echo "$1" >> optdef.sh;;
1642                 *=*)
1643                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1644                         echo "$me: ignoring -U $1" >&2
1645                         ;;
1646                 *) echo "$1='undef'" >> optdef.sh;;
1647                 esac
1648                 shift
1649                 ;;
1650         -A)
1651             shift
1652             xxx=''
1653             yyy="$1"
1654             zzz=''
1655             uuu=undef
1656             case "$yyy" in
1657             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1658                  case "$zzz" in
1659                  *:*) zzz='' ;;
1660                  *)   xxx=append
1661                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1662                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1663                  esac
1664                  ;;
1665             esac
1666             case "$xxx" in
1667             '')  case "$yyy" in
1668                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1669                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1670                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1671                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1672                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1673                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1674                  esac
1675                  ;;
1676             esac
1677             case "$xxx" in
1678             append)
1679                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1680             clear)
1681                 echo "$yyy=''"                  >> posthint.sh ;;
1682             define)
1683                 case "$zzz" in
1684                 '') zzz=define ;;
1685                 esac
1686                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1687             eval)
1688                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1689             prepend)
1690                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1691             undef)
1692                 case "$zzz" in
1693                 '') zzz="$uuu" ;;
1694                 esac
1695                 echo "$yyy=$zzz"                >> posthint.sh ;;
1696             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1697             esac
1698             shift
1699             ;;
1700         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1701             exit 0;;
1702         --) break;;
1703         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1704         *) break;;
1705         esac
1706 done
1707
1708 case "$error" in
1709 true)
1710         cat >&2 <<EOM
1711 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1712                  [-U symbol] [-U symbol=] [-A command:symbol...]
1713   -d : use defaults for all answers.
1714   -e : go on without questioning past the production of config.sh.
1715   -f : specify an alternate default configuration file.
1716   -h : print this help message and exit (with an error status).
1717   -r : reuse C symbols value if possible (skips costly nm extraction).
1718   -s : silent mode, only echoes questions and essential information.
1719   -D : define symbol to have some value:
1720          -D symbol         symbol gets the value 'define'
1721          -D symbol=value   symbol gets the value 'value'
1722        common used examples (see INSTALL for more info):
1723          -Duse64bitint            use 64bit integers
1724          -Duse64bitall            use 64bit integers and pointers
1725          -Dusethreads             use thread support
1726          -Dinc_version_list=none  do not include older perl trees in @INC
1727          -DEBUGGING=none          DEBUGGING options
1728          -Dcc=gcc                 choose your compiler
1729          -Dprefix=/opt/perl5      choose your destination
1730   -E : stop at the end of questions, after having produced config.sh.
1731   -K : do not use unless you know what you are doing.
1732   -O : let -D and -U override definitions from loaded configuration file.
1733   -S : perform variable substitutions on all .SH files (can mix with -f)
1734   -U : undefine symbol:
1735          -U symbol    symbol gets the value 'undef'
1736          -U symbol=   symbol gets completely empty
1737        e.g.:  -Uversiononly
1738   -A : manipulate symbol after the platform specific hints have been applied:
1739          -A append:symbol=value   append value to symbol
1740          -A symbol=value          like append:, but with a separating space
1741          -A define:symbol=value   define symbol to have value
1742          -A clear:symbol          define symbol to be ''
1743          -A define:symbol         define symbol to be 'define'
1744          -A eval:symbol=value     define symbol to be eval of value
1745          -A prepend:symbol=value  prepend value to symbol
1746          -A undef:symbol          define symbol to be 'undef'
1747          -A undef:symbol=         define symbol to be ''
1748        e.g.:  -A prepend:libswanted='cl pthread '
1749               -A ccflags=-DSOME_MACRO
1750   -V : print version number and exit (with a zero status).
1751 EOM
1752         exit 1
1753         ;;
1754 esac
1755
1756 : Sanity checks
1757 case "$fastread$alldone" in
1758 yescont|yesexit) ;;
1759 *)
1760         case "$extractsh" in
1761         true) ;;
1762         *)
1763                 if test ! -t 0; then
1764                         echo "Say 'sh Configure', not 'sh <Configure'"
1765                         exit 1
1766                 fi
1767                 ;;
1768         esac
1769         ;;
1770 esac
1771
1772 exec 4>&1
1773 case "$silent" in
1774 true) exec 1>/dev/null;;
1775 esac
1776
1777 : run the defines and the undefines, if any, but leave the file out there...
1778 touch optdef.sh
1779 . ./optdef.sh
1780 : create the posthint manipulation script and leave the file out there...
1781 touch posthint.sh
1782
1783 : set package name
1784 package='perl5'
1785 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1786 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1787 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1788 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1789 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1790 esac
1791
1792 : Some greps do not return status, grrr.
1793 echo "grimblepritz" >grimble
1794 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1795         contains=contains
1796 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1797         contains=grep
1798 else
1799         contains=contains
1800 fi
1801 rm -f grimble
1802 : the following should work in any shell
1803 case "$contains" in
1804 contains*)
1805         echo " "
1806         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1807         cat >contains <<'EOSS'
1808 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1809 EOSS
1810 chmod +x contains
1811 esac
1812
1813 : Find the path to the source tree
1814 case "$src" in
1815 '') case "$0" in
1816     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1817          case "$src" in
1818          /*)    ;;
1819          .)     ;;
1820          *)     src=`cd ../$src && pwd` ;;
1821          esac
1822          ;;
1823     *)   src='.';;
1824     esac;;
1825 esac
1826 case "$src" in
1827 '')     src=/
1828         rsrc=/
1829         ;;
1830 /*)     rsrc="$src";;
1831 *)      rsrc="../$src";;
1832 esac
1833 if test -f $rsrc/Configure && \
1834         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1835 then
1836    : found it, so we are ok.
1837 else
1838         rsrc=''
1839         for src in . .. ../.. ../../.. ../../../..; do
1840                 if test -f ../$src/Configure && \
1841                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1842                 then
1843                         rsrc=../$src
1844                         break
1845                 fi
1846         done
1847 fi
1848 case "$rsrc" in
1849 '')
1850         cat <<EOM >&4
1851
1852 Sorry, I can't seem to locate the source dir for $package.  Please start
1853 Configure with an explicit path -- i.e. /some/path/Configure.
1854
1855 EOM
1856         exit 1
1857         ;;
1858 ../.)   rsrc='..';;
1859 *)
1860         echo " "
1861         echo "Sources for $package found in \"$src\"." >&4
1862         ;;
1863 esac
1864
1865 : script used to extract .SH files with variable substitutions
1866 cat >extract <<'EOS'
1867 PERL_CONFIG_SH=true
1868 echo "Doing variable substitutions on .SH files..."
1869 if test -f MANIFEST; then
1870         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1871 else
1872         echo "(Looking for .SH files under the source directory.)"
1873         set x `(cd "$src"; find . -name "*.SH" -print)`
1874 fi
1875 shift
1876 case $# in
1877 0) set x `(cd "$src"; echo *.SH)`; shift;;
1878 esac
1879 if test ! -f "$src/$1"; then
1880         shift
1881 fi
1882 mkdir_p='
1883 name=$1;
1884 create="";
1885 while test $name; do
1886         if test ! -d "$name"; then
1887                 create="$name $create";
1888                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1889                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1890         else
1891                 name="";
1892         fi;
1893 done;
1894 for file in $create; do
1895         mkdir $file;
1896 done
1897 '
1898 for file in $*; do
1899         case "$src" in
1900         ".")
1901                 case "$file" in
1902                 */*)
1903                         dir=`expr X$file : 'X\(.*\)/'`
1904                         file=`expr X$file : 'X.*/\(.*\)'`
1905                         (cd "$dir" && . ./$file)
1906                         ;;
1907                 *)
1908                         . ./$file
1909                         ;;
1910                 esac
1911                 ;;
1912         *)
1913                 case "$file" in
1914                 */*)
1915                         dir=`expr X$file : 'X\(.*\)/'`
1916                         file=`expr X$file : 'X.*/\(.*\)'`
1917                         (set x $dir; shift; eval $mkdir_p)
1918                         sh <"$src/$dir/$file"
1919                         ;;
1920                 *)
1921                         sh <"$src/$file"
1922                         ;;
1923                 esac
1924                 ;;
1925         esac
1926 done
1927 if test -f "$src/config_h.SH"; then
1928         if test ! -f config.h; then
1929         : oops, they left it out of MANIFEST, probably, so do it anyway.
1930         . "$src/config_h.SH"
1931         fi
1932 fi
1933 EOS
1934
1935 : extract files and exit if asked to do so
1936 case "$extractsh" in
1937 true)
1938         case "$realsilent" in
1939         true) ;;
1940         *) exec 1>&4;;
1941         esac
1942         case "$config_sh" in
1943         '') config_sh='config.sh';;
1944         esac
1945         echo " "
1946         echo "Fetching answers from $config_sh..."
1947         cd ..
1948         . $config_sh
1949         test "$override" && . ./optdef.sh
1950         echo " "
1951         . UU/extract
1952         rm -rf UU
1953         echo "Extraction done."
1954         exit 0
1955         ;;
1956 esac
1957
1958 : Eunice requires " " instead of "", can you believe it
1959 echo " "
1960 : Here we go...
1961 echo "Beginning of configuration questions for $package."
1962
1963 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1964
1965 : first determine how to suppress newline on echo command
1966 echo " "
1967 echo "Checking echo to see how to suppress newlines..."
1968 (echo "hi there\c" ; echo " ") >.echotmp
1969 if $contains c .echotmp >/dev/null 2>&1 ; then
1970         echo "...using -n."
1971         n='-n'
1972         c=''
1973 else
1974         cat <<'EOM'
1975 ...using \c
1976 EOM
1977         n=''
1978         c='\c'
1979 fi
1980 echo $n "The star should be here-->$c"
1981 echo '*'
1982 rm -f .echotmp
1983
1984 : Now test for existence of everything in MANIFEST
1985 echo " "
1986 if test -f "$rsrc/MANIFEST"; then
1987         echo "First let's make sure your kit is complete.  Checking..." >&4
1988         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1989                 (split -l 50 2>/dev/null || split -50)
1990         rm -f missing
1991         tmppwd=`pwd`
1992         for filelist in x??; do
1993                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1994                         >/dev/null 2>>"$tmppwd/missing")
1995         done
1996         if test -s missing; then
1997                 cat missing >&4
1998                 cat >&4 <<'EOM'
1999
2000 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2001
2002 You have the option of continuing the configuration process, despite the
2003 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2004 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2005 and contact the author (perlbug@perl.org).
2006
2007 EOM
2008                 echo $n "Continue? [n] $c" >&4
2009                 read ans
2010                 case "$ans" in
2011                 y*)
2012                         echo "Continuing..." >&4
2013                         rm -f missing
2014                         ;;
2015                 *)
2016                         echo "ABORTING..." >&4
2017                         kill $$
2018                         ;;
2019                 esac
2020         else
2021                 echo "Looks good..."
2022         fi
2023 else
2024         echo "There is no MANIFEST file.  I hope your kit is complete !"
2025 fi
2026 rm -f missing x??
2027
2028 : Find the appropriate value for a newline for tr
2029 echo " "
2030 if test -n "$DJGPP"; then
2031        trnl='\012'
2032 fi
2033 if test X"$trnl" = X; then
2034         case "`echo foo|tr '\n' x 2>/dev/null`" in
2035         foox) trnl='\n' ;;
2036         esac
2037 fi
2038 if test X"$trnl" = X; then
2039         case "`echo foo|tr '\012' x 2>/dev/null`" in
2040         foox) trnl='\012' ;;
2041         esac
2042 fi
2043 if test X"$trnl" = X; then
2044        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2045        fooxy) trnl='\n\r' ;;
2046        esac
2047 fi
2048 if test X"$trnl" = X; then
2049         cat <<EOM >&2
2050
2051 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2052
2053 EOM
2054         exit 1
2055 fi
2056
2057 : compute the number of columns on the terminal for proper question formatting
2058 case "$COLUMNS" in
2059 '') COLUMNS='80';;
2060 esac
2061
2062 : set up the echo used in my read
2063 myecho="case \"\$xxxm\" in
2064 '') echo $n \"\$rp $c\" >&4;;
2065 *) case \"\$rp\" in
2066         '') echo $n \"[\$xxxm] $c\";;
2067         *)
2068                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2069                         echo \"\$rp\" >&4
2070                         echo $n \"[\$xxxm] $c\" >&4
2071                 else
2072                         echo $n \"\$rp [\$xxxm] $c\" >&4
2073                 fi
2074                 ;;
2075         esac;;
2076 esac"
2077
2078 : now set up to do reads with possible shell escape and default assignment
2079 cat <<EOSC >myread
2080 $startsh
2081 xxxm=\$dflt
2082 $myecho
2083 ans='!'
2084 case "\$fastread" in
2085 yes) case "\$dflt" in
2086         '') ;;
2087         *) ans='';
2088                 case "\$silent-\$rp" in
2089                 true-) ;;
2090                 *) echo " " >&4;;
2091                 esac;;
2092         esac;;
2093 *) case "\$silent" in
2094         true) case "\$rp" in
2095                 '') ans='';;
2096                 esac;;
2097         esac;;
2098 esac
2099 while expr "X\$ans" : "X!" >/dev/null; do
2100         read answ
2101         set x \$xxxm
2102         shift
2103         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2104         case  "\$answ" in
2105         "!")
2106                 sh 1>&4
2107                 echo " "
2108                 $myecho
2109                 ;;
2110         !*)
2111                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2112                 shift
2113                 sh 1>&4 -c "\$*"
2114                 echo " "
2115                 $myecho
2116                 ;;
2117         "\$ans")
2118                 case "\$ans" in
2119                 \\&*)
2120                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2121                         shift
2122                         case "\$1" in
2123                         -d)
2124                                 fastread=yes
2125                                 echo "(OK, I'll run with -d after this question.)" >&4
2126                                 ;;
2127                         -*)
2128                                 echo "*** Sorry, \$1 not supported yet." >&4
2129                                 ;;
2130                         esac
2131                         $myecho
2132                         ans=!
2133                         ;;
2134                 esac;;
2135         *)
2136                 case "\$aok" in
2137                 y)
2138                         echo "*** Substitution done -- please confirm."
2139                         xxxm="\$ans"
2140                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2141                         xxxm="\$ans"
2142                         ans=!
2143                         ;;
2144                 *)
2145                         echo "*** Error -- try again."
2146                         ans=!
2147                         ;;
2148                 esac
2149                 $myecho
2150                 ;;
2151         esac
2152         case "\$ans\$xxxm\$nostick" in
2153         '')
2154                 ans=!
2155                 $myecho
2156                 ;;
2157         esac
2158 done
2159 case "\$ans" in
2160 '') ans="\$xxxm";;
2161 esac
2162 EOSC
2163
2164 : create .config dir to save info across Configure sessions
2165 test -d ../.config || mkdir ../.config
2166 cat >../.config/README <<EOF
2167 This directory created by Configure to save information that should
2168 persist across sessions for $package.
2169
2170 You may safely delete it if you wish.
2171 EOF
2172
2173 : See if we are using a devel version and want that
2174 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2175 case "$usedevel" in
2176 $define|true|[yY]*)
2177     usedevel="$define" ;;
2178 *) case "$xversion" in
2179    *[13579])
2180         cat >&4 <<EOH
2181 *** WHOA THERE!!! ***
2182
2183     This is an UNSTABLE DEVELOPMENT release.
2184     The version of this $package distribution is $xversion, that is, odd,
2185     (as opposed to even) and that signifies a development release.
2186     If you want a maintenance release, you want an even-numbered version.
2187
2188     Do ***NOT*** install this into production use.
2189     Data corruption and crashes are possible.
2190
2191     It is most seriously suggested that you do not continue any further
2192     unless you want to help in developing and debugging Perl.
2193
2194     If you *still* want to build perl, you can answer 'y' now,
2195     or pass -Dusedevel to Configure.
2196
2197 EOH
2198         rp='Do you really want to continue?'
2199         dflt='n'
2200         . ./myread
2201         case "$ans" in
2202         [yY]) echo >&4 "Okay, continuing."
2203               usedevel="$define" ;;
2204         *) echo >&4 "Okay, bye."
2205            exit 1
2206            ;;
2207         esac
2208         ;;
2209     esac
2210     usedevel="$undef"
2211     ;;
2212 esac
2213 case "$usedevel" in
2214 $define|true|[yY]*)
2215         case "$versiononly" in
2216         '') versiononly="$define" ;;
2217         esac
2218         case "$installusrbinperl" in
2219         '') installusrbinperl="$undef" ;;
2220         esac
2221         ;;
2222 esac
2223
2224 : general instructions
2225 needman=true
2226 firsttime=true
2227 user=`(logname) 2>/dev/null`
2228 case "$user" in
2229 '') user=`whoami 2>&1`;;
2230 esac
2231 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2232         firsttime=false
2233         echo " "
2234         rp='Would you like to see the instructions?'
2235         dflt=n
2236         . ./myread
2237         case "$ans" in
2238         [yY]*) ;;
2239         *) needman=false;;
2240         esac
2241 fi
2242 if $needman; then
2243         cat <<EOH
2244
2245 This installation shell script will examine your system and ask you questions
2246 to determine how the perl5 package should be installed. If you get
2247 stuck on a question, you may use a ! shell escape to start a subshell or
2248 execute a command.  Many of the questions will have default answers in square
2249 brackets; typing carriage return will give you the default.
2250
2251 On some of the questions which ask for file or directory names you are allowed
2252 to use the ~name construct to specify the login directory belonging to "name",
2253 even if you don't have a shell which knows about that.  Questions where this is
2254 allowed will be marked "(~name ok)".
2255
2256 EOH
2257         rp=''
2258         dflt='Type carriage return to continue'
2259         . ./myread
2260         cat <<'EOH'
2261
2262 The prompter used in this script allows you to use shell variables and
2263 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2264 in the default answer, as if the default line was a set of arguments given to a
2265 script shell.  This means you may also use $* to repeat the whole default line,
2266 so you do not have to re-type everything to add something to the default.
2267
2268 Every time there is a substitution, you will have to confirm.  If there is an
2269 error (e.g. an unmatched backtick), the default answer will remain unchanged
2270 and you will be prompted again.
2271
2272 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2273 the questions and use the computed defaults (or the previous answers if there
2274 was already a config.sh file). Type 'Configure -h' for a list of options.
2275 You may also start interactively and then answer '& -d' at any prompt to turn
2276 on the non-interactive behaviour for the remainder of the execution.
2277
2278 EOH
2279         . ./myread
2280         cat <<EOH
2281
2282 Much effort has been expended to ensure that this shell script will run on any
2283 Unix system.  If despite that it blows up on yours, your best bet is to edit
2284 Configure and run it again.  If you can't run Configure for some reason,
2285 you'll have to generate a config.sh file by hand.  Whatever problems you
2286 have, let me (perlbug@perl.org) know how I blew it.
2287
2288 This installation script affects things in two ways:
2289
2290 1) it may do direct variable substitutions on some of the files included
2291    in this kit.
2292 2) it builds a config.h file for inclusion in C programs.  You may edit
2293    any of these files as the need arises after running this script.
2294
2295 If you make a mistake on a question, there is no easy way to back up to it
2296 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2297 files.  Configure will offer to let you do this before it runs the SH files.
2298
2299 EOH
2300         dflt='Type carriage return to continue'
2301         . ./myread
2302         case "$firsttime" in
2303         true) echo $user >>../.config/instruct;;
2304         esac
2305 fi
2306
2307 : find out where common programs are
2308 echo " "
2309 echo "Locating common programs..." >&4
2310 cat <<EOSC >loc
2311 $startsh
2312 case \$# in
2313 0) exit 1;;
2314 esac
2315 thing=\$1
2316 shift
2317 dflt=\$1
2318 shift
2319 for dir in \$*; do
2320         case "\$thing" in
2321         .)
2322         if test -d \$dir/\$thing; then
2323                 echo \$dir
2324                 exit 0
2325         fi
2326         ;;
2327         *)
2328         for thisthing in \$dir/\$thing; do
2329                 : just loop through to pick last item
2330         done
2331         if test -f \$thisthing; then
2332                 echo \$thisthing
2333                 exit 0
2334         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2335                 echo \$thisthing
2336                 exit 0
2337         elif test -f \$dir/\$thing.exe; then
2338                 if test -n "$DJGPP"; then
2339                         echo \$dir/\$thing.exe
2340                 elif test "$eunicefix" != ":"; then
2341                         : on Eunice apparently
2342                         echo \$dir/\$thing
2343                 fi
2344                 exit 0
2345         fi
2346         ;;
2347         esac
2348 done
2349 echo \$dflt
2350 exit 1
2351 EOSC
2352 chmod +x loc
2353 $eunicefix loc
2354 loclist="
2355 awk
2356 cat
2357 chmod
2358 comm
2359 cp
2360 echo
2361 expr
2362 grep
2363 ls
2364 mkdir
2365 rm
2366 sed
2367 sort
2368 touch
2369 tr
2370 uniq
2371 "
2372 trylist="
2373 ar
2374 bison
2375 byacc
2376 cpp
2377 csh
2378 date
2379 egrep
2380 gmake
2381 gzip
2382 less
2383 ln
2384 make
2385 more
2386 nm
2387 nroff
2388 perl
2389 pg
2390 test
2391 uname
2392 zip
2393 "
2394 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2395 pth="$pth /lib /usr/lib"
2396 for file in $loclist; do
2397         eval xxx=\$$file
2398         case "$xxx" in
2399         /*|?:[\\/]*)
2400                 if test -f "$xxx"; then
2401                         : ok
2402                 else
2403                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2404                         xxx=`./loc $file $file $pth`
2405                 fi
2406                 ;;
2407         '') xxx=`./loc $file $file $pth`;;
2408         *) xxx=`./loc $xxx $xxx $pth`;;
2409         esac
2410         eval $file=$xxx$_exe
2411         eval _$file=$xxx
2412         case "$xxx" in
2413         /*)
2414                 echo $file is in $xxx.
2415                 ;;
2416         ?:[\\/]*)
2417                 echo $file is in $xxx.
2418                 ;;
2419         *)
2420                 echo "I don't know where '$file' is, and my life depends on it." >&4
2421                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2422                 exit 1
2423                 ;;
2424         esac
2425 done
2426 echo " "
2427 echo "Don't worry if any of the following aren't found..."
2428 say=offhand
2429 for file in $trylist; do
2430         eval xxx=\$$file
2431         case "$xxx" in
2432         /*|?:[\\/]*)
2433                 if test -f "$xxx"; then
2434                         : ok
2435                 else
2436                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2437                         xxx=`./loc $file $file $pth`
2438                 fi
2439                 ;;
2440         '') xxx=`./loc $file $file $pth`;;
2441         *) xxx=`./loc $xxx $xxx $pth`;;
2442         esac
2443         eval $file=$xxx$_exe
2444         eval _$file=$xxx
2445         case "$xxx" in
2446         /*)
2447                 echo $file is in $xxx.
2448                 ;;
2449         ?:[\\/]*)
2450                 echo $file is in $xxx.
2451                 ;;
2452         *)
2453                 echo "I don't see $file out there, $say."
2454                 say=either
2455                 ;;
2456         esac
2457 done
2458 case "$egrep" in
2459 egrep)
2460         echo "Substituting grep for egrep."
2461         egrep=$grep
2462         _egrep=$grep
2463         ;;
2464 esac
2465 case "$less" in
2466 '')     ;;
2467 *)      if $less -R </dev/null >/dev/null; then
2468                echo "Substituting less -R for less."
2469                less="$less -R"
2470                _less=$less
2471         fi
2472         ;;
2473 esac
2474 case "$ln" in
2475 ln)
2476         echo "Substituting cp for ln."
2477         ln=$cp
2478         _ln=$cp
2479         ;;
2480 esac
2481 case "$make" in
2482 make)
2483         case "$gmake" in
2484         gmake)
2485         echo "I can't find make or gmake, and my life depends on it." >&4
2486         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2487         exit 1
2488         ;;
2489         esac
2490         ;;
2491 esac
2492 case "$gmake" in
2493 gmake)  ;;
2494 *)      # We can't have osname yet.
2495         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2496                 # Assume that gmake, if found, is definitely GNU make
2497                 # and prefer it over the system make.
2498                 echo "Substituting gmake for make."
2499                 make=$gmake
2500                 _make=$gmake
2501         fi
2502         ;;
2503 esac
2504 case "$test" in
2505 test)
2506         echo "Hopefully test is built into your sh."
2507         ;;
2508 *)
2509         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2510                 echo "Using the test built into your sh."
2511                 test=test
2512                 _test=test
2513         fi
2514         ;;
2515 esac
2516 case "$echo" in
2517 echo)
2518         echo "Hopefully echo is built into your sh."
2519         ;;
2520 '') ;;
2521 *)
2522         echo " "
2523 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2524         $echo $n "hi there$c" >foo1
2525         echo $n "hi there$c" >foo2
2526         if cmp foo1 foo2 >/dev/null 2>&1; then
2527                 echo "They are compatible.  In fact, they may be identical."
2528         else
2529                 case "$n" in
2530                 '-n') n='' c='\c';;
2531                 *) n='-n' c='';;
2532                 esac
2533                 cat <<FOO
2534 They are not compatible!  You are probably running ksh on a non-USG system.
2535 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2536 have echo built in and we may have to run some Bourne shell scripts.  That
2537 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2538
2539 FOO
2540                 $echo $n "The star should be here-->$c"
2541                 $echo "*"
2542         fi
2543         $rm -f foo1 foo2
2544         ;;
2545 esac
2546
2547 # This question was auctioned at YAPC::Europe-2007 in Vienna
2548 # I never promised you could answer it. I only auctioned the question.
2549 cat <<FOO
2550 The following message is sponsored by
2551
2552   Dresden.pm<--The stars should be here.
2553
2554 Dear Perl user, system administrator or package
2555 maintainer, the Perl community sends greetings to
2556 you. Do you (emblematical) greet back [Y/n]? n
2557
2558 FOO
2559
2560 : Check what type of C compiler we use
2561 cat <<EOS >trygcc
2562 $startsh
2563 EOS
2564 cat <<'EOSC' >>trygcc
2565 case "$cc" in
2566 '') ;;
2567 *)  $rm -f try try.*
2568     $cat >try.c <<EOM
2569 int main(int argc, char *argv[]) {
2570   return 0;
2571 }
2572 EOM
2573     if $cc -o try $ccflags $ldflags try.c; then
2574        :
2575     else
2576         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2577         despair=yes
2578         trygcc=yes
2579         case "$cc" in
2580         *gcc*) trygcc=no ;;
2581         esac
2582         # Skip this test because it gives a false match on output like:
2583         #    ./trygcc: line 23: cc: command not found
2584         # case "`$cc -v -c try.c 2>&1`" in
2585         # *gcc*) trygcc=no ;;
2586         # esac
2587         if $test X"$trygcc" = Xyes; then
2588             if gcc -o try -c try.c; then
2589                 echo " "
2590                 echo "You seem to have a working gcc, though." >&4
2591                 # Switching compilers may undo the work of hints files.
2592                 # The most common problem is -D_REENTRANT for threads.
2593                 # This heuristic catches that case, but gets false positives
2594                 # if -Dusethreads was not actually specified.  Better to
2595                 # bail out here with a useful message than fail 
2596                 # mysteriously later. Should we perhaps just try to
2597                 # re-invoke Configure -Dcc=gcc config_args ?
2598                 if $test -f usethreads.cbu; then
2599                         $cat >&4 <<EOM 
2600
2601 *** However, any setting of the C compiler flags (e.g. for thread support)
2602 *** will be lost.  It may be necessary for you to restart Configure and
2603 *** add -Dcc=gcc to your Configure command line.
2604
2605 EOM
2606                         rp="Would you like to go ahead and try gcc anyway?"
2607                         dflt=n
2608                 else
2609                         rp="Would you like to use it?"
2610                         dflt=y
2611                 fi
2612                 if $test -f myread; then
2613                     . ./myread
2614                 else
2615                     if $test -f UU/myread; then
2616                         . ./UU/myread
2617                     else
2618                         echo "Cannot find myread, sorry.  Aborting." >&2
2619                         exit 1
2620                     fi
2621                 fi  
2622                 case "$ans" in
2623                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2624                 esac
2625             fi
2626         fi
2627     fi
2628     $rm -f try try.*
2629     ;;
2630 esac
2631 EOSC
2632
2633 cat <<EOS >checkcc
2634 $startsh
2635 EOS
2636 cat <<'EOSC' >>checkcc
2637 case "$cc" in        
2638 '') ;;
2639 *)  $rm -f try try.*              
2640     $cat >try.c <<EOM
2641 int main(int argc, char *argv[]) {
2642   return 0;
2643 }
2644 EOM
2645     if $cc -o try $ccflags $ldflags try.c; then
2646        :
2647     else
2648         if $test X"$despair" = Xyes; then
2649            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2650         fi
2651         $cat >&4 <<EOM         
2652 You need to find a working C compiler.
2653 Either (purchase and) install the C compiler supplied by your OS vendor,
2654 or for a free C compiler try http://gcc.gnu.org/
2655 I cannot continue any further, aborting.
2656 EOM
2657         exit 1
2658     fi
2659     $rm -f try try.*
2660     ;;
2661 esac
2662 EOSC
2663
2664 : determine whether symbolic links are supported
2665 echo " "
2666 $touch blurfl
2667 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2668         echo "Symbolic links are supported." >&4
2669         lns="$ln -s"
2670 else
2671         echo "Symbolic links are NOT supported." >&4
2672         lns="$ln"
2673 fi
2674 $rm -f blurfl sym
2675
2676 : determine whether symbolic links are supported
2677 echo " "
2678 case "$lns" in
2679 *"ln"*" -s")
2680         echo "Checking how to test for symbolic links..." >&4
2681         $lns blurfl sym
2682         if $test "X$issymlink" = X; then
2683                 case "$newsh" in
2684                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2685                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2686                 esac
2687                 if test $? = 0; then
2688                         issymlink="test -h"
2689                 else
2690                         echo "Your builtin 'test -h' may be broken." >&4
2691                         case "$test" in
2692                         /*)     ;;
2693                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2694                                 for p in $pth
2695                                 do
2696                                         if test -f "$p/$test"; then
2697                                                 test="$p/$test"
2698                                                 break
2699                                         fi
2700                                 done
2701                                 ;;
2702                         esac
2703                         case "$test" in
2704                         /*)
2705                                 echo "Trying external '$test -h'." >&4
2706                                 issymlink="$test -h"
2707                                 if $test ! -h sym >/dev/null 2>&1; then
2708                                         echo "External '$test -h' is broken, too." >&4
2709                                         issymlink=''
2710                                 fi
2711                                 ;;
2712                         *)      issymlink='' ;;
2713                         esac
2714                 fi              
2715         fi
2716         if $test "X$issymlink" = X; then
2717                 if $test -L sym 2>/dev/null; then
2718                         issymlink="$test -L"
2719                         echo "The builtin '$test -L' worked." >&4
2720                 fi
2721         fi
2722         if $test "X$issymlink" != X; then
2723                 echo "You can test for symbolic links with '$issymlink'." >&4
2724         else
2725                 echo "I do not know how you can test for symbolic links." >&4
2726         fi
2727         $rm -f blurfl sym
2728         ;;
2729 *)      echo "No symbolic links, so not testing for their testing..." >&4
2730         ;;
2731 esac
2732 echo " "
2733
2734 : Make symlinks util
2735 case "$mksymlinks" in
2736 $define|true|[yY]*)
2737         case "$src" in
2738         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2739                 exit 1
2740                 ;;
2741         *)      case "$lns:$issymlink" in
2742                 *"ln"*" -s:"*"test -"?)
2743                         echo "Creating the symbolic links..." >&4
2744                         echo "(First creating the subdirectories...)" >&4
2745                         cd ..
2746                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2747                                 read directory
2748                                 test -z "$directory" && break
2749                                 mkdir -p $directory
2750                         done
2751                         # Sanity check 1.
2752                         if test ! -d t/base; then
2753                                 echo "Failed to create the subdirectories.  Aborting." >&4
2754                                 exit 1
2755                         fi
2756                         echo "(Then creating the symlinks...)" >&4
2757                         awk '{print $1}' $src/MANIFEST | while true; do
2758                                 read filename
2759                                 test -z "$filename" && break
2760                                 if test -f $filename; then
2761                                         if $issymlink $filename; then
2762                                                 rm -f $filename
2763                                         fi
2764                                 fi
2765                                 if test -f $filename; then
2766                                         echo "$filename already exists, not symlinking."
2767                                 else
2768                                         ln -s $src/$filename $filename
2769                                 fi
2770                         done
2771                         # Sanity check 2.
2772                         if test ! -f t/base/lex.t; then
2773                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2774                                 exit 1
2775                         fi
2776                         cd UU
2777                         ;;
2778                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2779                         ;;
2780                 esac
2781                 ;;
2782         esac
2783         ;;
2784 esac
2785
2786 : Check for Cross-Compilation
2787 case "$usecrosscompile" in
2788 $define|true|[yY]*)
2789         $echo "Cross-compiling..."
2790         croak=''
2791         case "$cc" in
2792         *-*-gcc) # A cross-compiling gcc, probably.
2793             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2794             ar=$targetarch-ar
2795             # leave out ld, choosing it is more complex
2796             nm=$targetarch-nm
2797             ranlib=$targetarch-ranlib
2798             $echo 'extern int foo;' > try.c
2799             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2800             shift
2801             if $test $# -gt 0; then
2802                 incpth="$incpth $*"
2803                 incpth="`$echo $incpth|$sed 's/^ //'`"
2804                 echo "Guessing incpth '$incpth'." >&4
2805                 for i in $*; do
2806                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2807                     if $test -d $j; then
2808                         libpth="$libpth $j"
2809                     fi
2810                 done   
2811                 libpth="`$echo $libpth|$sed 's/^ //'`"
2812                 echo "Guessing libpth '$libpth'." >&4
2813             fi
2814             $rm -f try.c
2815             ;;
2816         esac
2817         case "$targetarch" in
2818         '') echo "Targetarch not defined." >&4; croak=y ;;
2819         *)  echo "Using targetarch $targetarch." >&4 ;;
2820         esac
2821         case "$incpth" in
2822         '') echo "Incpth not defined." >&4; croak=y ;;
2823         *)  echo "Using incpth '$incpth'." >&4 ;;
2824         esac
2825         case "$libpth" in
2826         '') echo "Libpth not defined." >&4; croak=y ;;
2827         *)  echo "Using libpth '$libpth'." >&4 ;;
2828         esac
2829         case "$usrinc" in
2830         '') for i in $incpth; do
2831                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2832                     usrinc=$i
2833                     echo "Guessing usrinc $usrinc." >&4
2834                     break
2835                 fi
2836             done
2837             case "$usrinc" in
2838             '') echo "Usrinc not defined." >&4; croak=y ;;
2839             esac
2840             ;;
2841         *)  echo "Using usrinc $usrinc." >&4 ;;
2842         esac
2843         case "$targethost" in
2844         '') echo "Targethost not defined." >&4; croak=y ;;
2845         *)  echo "Using targethost $targethost." >&4
2846         esac
2847         locincpth=' '
2848         loclibpth=' '
2849         case "$croak" in
2850         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2851         esac
2852         case "$src" in
2853         /*) run=$src/Cross/run
2854             targetmkdir=$src/Cross/mkdir
2855             to=$src/Cross/to
2856             from=$src/Cross/from
2857             ;;
2858         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2859             run=$pwd/Cross/run
2860             targetmkdir=$pwd/Cross/mkdir
2861             to=$pwd/Cross/to
2862             from=$pwd/Cross/from
2863             ;;
2864         esac
2865         case "$targetrun" in
2866         '') targetrun=ssh ;;
2867         esac
2868         case "$targetto" in
2869         '') targetto=scp ;;
2870         esac
2871         case "$targetfrom" in
2872         '') targetfrom=scp ;;
2873         esac
2874         run=$run-$targetrun
2875         to=$to-$targetto
2876         from=$from-$targetfrom
2877         case "$targetdir" in
2878         '')  targetdir=/tmp
2879              echo "Guessing targetdir $targetdir." >&4
2880              ;;
2881         esac
2882         case "$targetuser" in
2883         '')  targetuser=root
2884              echo "Guessing targetuser $targetuser." >&4
2885              ;;
2886         esac
2887         case "$targetfrom" in
2888         scp)    q=-q ;;
2889         *)      q='' ;;
2890         esac
2891         case "$targetrun" in
2892         ssh|rsh)
2893             cat >$run <<EOF
2894 #!/bin/sh
2895 case "\$1" in
2896 -cwd)
2897   shift
2898   cwd=\$1
2899   shift
2900   ;;
2901 esac
2902 case "\$cwd" in
2903 '') cwd=$targetdir ;;
2904 esac
2905 exe=\$1
2906 shift
2907 if $test ! -f \$exe.xok; then
2908   $to \$exe
2909   $touch \$exe.xok
2910 fi
2911 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2912 EOF
2913             ;;
2914         *)  echo "Unknown targetrun '$targetrun'" >&4
2915             exit 1
2916             ;;
2917         esac
2918         case "$targetmkdir" in
2919         */Cross/mkdir)
2920             cat >$targetmkdir <<EOF
2921 #!/bin/sh
2922 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2923 EOF
2924             $chmod a+rx $targetmkdir
2925             ;;
2926         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2927             exit 1
2928             ;;
2929         esac
2930         case "$targetto" in
2931         scp|rcp)
2932             cat >$to <<EOF
2933 #!/bin/sh
2934 for f in \$@
2935 do
2936   case "\$f" in
2937   /*)
2938     $targetmkdir \`dirname \$f\`
2939     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2940     ;;
2941   *)
2942     $targetmkdir $targetdir/\`dirname \$f\`
2943     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2944     ;;
2945   esac
2946 done
2947 exit 0
2948 EOF
2949             ;;
2950         cp) cat >$to <<EOF
2951 #!/bin/sh
2952 for f in \$@
2953 do
2954   case "\$f" in
2955   /*)
2956     $mkdir -p $targetdir/\`dirname \$f\`
2957     $cp \$f $targetdir/\$f || exit 1
2958     ;;
2959   *)
2960     $targetmkdir $targetdir/\`dirname \$f\`
2961     $cp \$f $targetdir/\$f || exit 1
2962     ;;
2963   esac
2964 done
2965 exit 0
2966 EOF
2967             ;;
2968         *)  echo "Unknown targetto '$targetto'" >&4
2969             exit 1
2970             ;;
2971         esac
2972         case "$targetfrom" in
2973         scp|rcp)
2974           cat >$from <<EOF
2975 #!/bin/sh
2976 for f in \$@
2977 do
2978   $rm -f \$f
2979   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2980 done
2981 exit 0
2982 EOF
2983             ;;
2984         cp) cat >$from <<EOF
2985 #!/bin/sh
2986 for f in \$@
2987 do
2988   $rm -f \$f
2989   cp $targetdir/\$f . || exit 1
2990 done
2991 exit 0
2992 EOF
2993             ;;
2994         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2995             exit 1
2996             ;;
2997         esac
2998         if $test ! -f $run; then
2999             echo "Target 'run' script '$run' not found." >&4
3000         else
3001             $chmod a+rx $run
3002         fi
3003         if $test ! -f $to; then
3004             echo "Target 'to' script '$to' not found." >&4
3005         else
3006             $chmod a+rx $to
3007         fi
3008         if $test ! -f $from; then
3009             echo "Target 'from' script '$from' not found." >&4
3010         else
3011             $chmod a+rx $from
3012         fi
3013         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3014             exit 1
3015         fi
3016         cat >&4 <<EOF
3017 Using '$run' for remote execution,
3018 and '$from' and '$to'
3019 for remote file transfer.
3020 EOF
3021         ;;
3022 *)      run=''
3023         to=:
3024         from=:
3025         usecrosscompile='undef'
3026         targetarch=''
3027         ;;
3028 esac
3029
3030 : see whether [:lower:] and [:upper:] are supported character classes
3031 echo " "
3032 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3033 ABYZ)
3034         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3035         up='[:upper:]'
3036         low='[:lower:]'
3037         ;;
3038 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3039         # (0xd9 and 0xe2), therefore that is a nice testing point.
3040         if test "X$up" = X -o "X$low" = X; then
3041             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3042             rs) up='[A-Z]'
3043                 low='[a-z]'
3044                 ;;
3045             esac
3046         fi
3047         if test "X$up" = X -o "X$low" = X; then
3048             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3049             rs) up='A-Z'
3050                 low='a-z'
3051                 ;;
3052             esac
3053         fi
3054         if test "X$up" = X -o "X$low" = X; then
3055             case "`echo RS | od -x 2>/dev/null`" in
3056             *D9E2*|*d9e2*)
3057                 echo "Hey, this might be EBCDIC." >&4
3058                 if test "X$up" = X -o "X$low" = X; then
3059                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3060                     rs) up='[A-IJ-RS-Z]'
3061                         low='[a-ij-rs-z]'
3062                         ;;
3063                     esac
3064                 fi
3065                 if test "X$up" = X -o "X$low" = X; then
3066                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3067                     rs) up='A-IJ-RS-Z'
3068                         low='a-ij-rs-z'
3069                         ;;
3070                     esac
3071                 fi
3072                 ;;
3073             esac
3074         fi
3075 esac
3076 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3077 rs)
3078     echo "Using $up and $low to convert case." >&4
3079     ;;
3080 *)
3081     echo "I don't know how to translate letters from upper to lower case." >&4
3082     echo "Your tr is not acting any way I know of." >&4
3083     exit 1
3084     ;;
3085 esac
3086 : set up the translation script tr, must be called with ./tr of course
3087 cat >tr <<EOSC
3088 $startsh
3089 case "\$1\$2" in
3090 '[A-Z][a-z]') exec $tr '$up' '$low';;
3091 '[a-z][A-Z]') exec $tr '$low' '$up';;
3092 esac
3093 exec $tr "\$@"
3094 EOSC
3095 chmod +x tr
3096 $eunicefix tr
3097
3098 : Try to determine whether config.sh was made on this system
3099 case "$config_sh" in
3100 '')
3101 myuname=`$uname -a 2>/dev/null`
3102 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3103 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3104 # because the A-Z/a-z are not consecutive.
3105 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3106         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3107 newmyuname="$myuname"
3108 dflt=n
3109 case "$knowitall" in
3110 '')
3111         if test -f ../config.sh; then
3112                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3113                         eval "`grep myuname= ../config.sh`"
3114                 fi
3115                 if test "X$myuname" = "X$newmyuname"; then
3116                         dflt=y
3117                 fi
3118         fi
3119         ;;
3120 *) dflt=y;;
3121 esac
3122
3123 : Get old answers from old config file if Configure was run on the
3124 : same system, otherwise use the hints.
3125 hint=default
3126 cd ..
3127 if test -f config.sh; then
3128         echo " "
3129         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3130         . UU/myread
3131         case "$ans" in
3132         n*|N*) echo "OK, I'll ignore it."
3133                 mv config.sh config.sh.old
3134                 myuname="$newmyuname"
3135                 ;;
3136         *)  echo "Fetching default answers from your old config.sh file..." >&4
3137                 tmp_n="$n"
3138                 tmp_c="$c"
3139                 tmp_sh="$sh"
3140                 . ./config.sh
3141                 cp config.sh UU
3142                 n="$tmp_n"
3143                 c="$tmp_c"
3144                 : Older versions did not always set $sh.  Catch re-use of such
3145                 : an old config.sh.
3146                 case "$sh" in
3147                 '') sh="$tmp_sh" ;;
3148                 esac
3149                 hint=previous
3150                 ;;
3151         esac
3152 fi
3153 . ./UU/checkcc
3154 if test ! -f config.sh; then
3155         $cat <<EOM
3156
3157 First time through, eh?  I have some defaults handy for some systems
3158 that need some extra help getting the Configure answers right:
3159
3160 EOM
3161         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3162         dflt=''
3163         : Half the following guesses are probably wrong... If you have better
3164         : tests or hints, please send them to perlbug@perl.org
3165         : The metaconfig authors would also appreciate a copy...
3166         $test -f /irix && osname=irix
3167         $test -f /xenix && osname=sco_xenix
3168         $test -f /dynix && osname=dynix
3169         $test -f /dnix && osname=dnix
3170         $test -f /lynx.os && osname=lynxos
3171         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3172         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3173         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3174         $test -f /bin/mips && /bin/mips && osname=mips
3175         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3176                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3177         $test -d /usr/apollo/bin && osname=apollo
3178         $test -f /etc/saf/_sactab && osname=svr4
3179         $test -d /usr/include/minix && osname=minix
3180         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3181         if $test -d /MachTen -o -d /MachTen_Folder; then
3182                 osname=machten
3183                 if $test -x /sbin/version; then
3184                         osvers=`/sbin/version | $awk '{print $2}' |
3185                         $sed -e 's/[A-Za-z]$//'`
3186                 elif $test -x /usr/etc/version; then
3187                         osvers=`/usr/etc/version | $awk '{print $2}' |
3188                         $sed -e 's/[A-Za-z]$//'`
3189                 else
3190                         osvers="$2.$3"
3191                 fi
3192         fi
3193
3194         $test -f /sys/posix.dll &&
3195                 $test -f /usr/bin/what &&
3196                 set X `/usr/bin/what /sys/posix.dll` &&
3197                 $test "$3" = UWIN &&
3198                 osname=uwin &&
3199                 osvers="$5"
3200
3201         if $test -f $uname; then
3202                 set X $myuname
3203                 shift
3204
3205                 case "$5" in
3206                 fps*) osname=fps ;;
3207                 mips*)
3208                         case "$4" in
3209                         umips) osname=umips ;;
3210                         *) osname=mips ;;
3211                         esac;;
3212                 [23]100) osname=mips ;;
3213                 next*) osname=next ;;
3214                 i386*)
3215                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3216                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3217                                 osname='sco'
3218                                 osvers=$tmp
3219                         elif $test -f /etc/kconfig; then
3220                                 osname=isc
3221                                 if test "$lns" = "$ln -s"; then
3222                                         osvers=4
3223                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3224                                         osvers=3
3225                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3226                                         osvers=2
3227                                 fi
3228                         fi
3229                         tmp=''
3230                         ;;
3231                 pc*)
3232                         if test -n "$DJGPP"; then
3233                                 osname=dos
3234                                 osvers=djgpp
3235                         fi
3236                         ;;
3237                 esac
3238
3239                 case "$1" in
3240                 aix) osname=aix
3241                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3242                         case "$tmp" in
3243                         # oslevel can fail with:
3244                         # oslevel: Unable to acquire lock.
3245                         *not\ found) osvers="$4"."$3" ;;
3246                         '<3240'|'<>3240') osvers=3.2.0 ;;
3247                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3248                         '=3250'|'>3250') osvers=3.2.5 ;;
3249                         *) osvers=$tmp;;
3250                         esac
3251                         ;;
3252                 bsd386) osname=bsd386
3253                         osvers=`$uname -r`
3254                         ;;
3255                 cygwin*) osname=cygwin
3256                         osvers="$3"
3257                         ;;
3258                 *dc.osx) osname=dcosx
3259                         osvers="$3"
3260                         ;;
3261                 dnix) osname=dnix
3262                         osvers="$3"
3263                         ;;
3264                 domainos) osname=apollo
3265                         osvers="$3"
3266                         ;;
3267                 dgux)   osname=dgux
3268                         osvers="$3"
3269                         ;;
3270                 dragonfly) osname=dragonfly
3271                         osvers="$3"
3272                         ;;
3273                 dynixptx*) osname=dynixptx
3274                         osvers=`echo "$4"|sed 's/^v//'`
3275                         ;;
3276                 freebsd) osname=freebsd
3277                         osvers="$3" ;;
3278                 genix)  osname=genix ;;
3279                 gnu)    osname=gnu
3280                         osvers="$3" ;;
3281                 hp*)    osname=hpux
3282                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3283                         ;;
3284                 irix*)  osname=irix
3285                         case "$3" in
3286                         4*) osvers=4 ;;
3287                         5*) osvers=5 ;;
3288                         *)      osvers="$3" ;;
3289                         esac
3290                         ;;
3291                 linux)  osname=linux
3292                         case "$3" in
3293                         *)      osvers="$3" ;;
3294                         esac
3295                         ;;
3296                 MiNT)   osname=mint
3297                         ;;
3298                 netbsd*) osname=netbsd
3299                         osvers="$3"
3300                         ;;
3301                 news-os) osvers="$3"
3302                         case "$3" in
3303                         4*) osname=newsos4 ;;
3304                         *) osname=newsos ;;
3305                         esac
3306                         ;;
3307                 next*) osname=next ;;
3308                 nonstop-ux) osname=nonstopux ;;
3309                 openbsd) osname=openbsd
3310                         osvers="$3"
3311                         ;;
3312                 os2)    osname=os2
3313                         osvers="$4"
3314                         ;;
3315                 POSIX-BC | posix-bc ) osname=posix-bc
3316                         osvers="$3"
3317                         ;;
3318                 powerux | power_ux | powermax_os | powermaxos | \
3319                 powerunix | power_unix) osname=powerux
3320                         osvers="$3"
3321                         ;;
3322                 qnx) osname=qnx
3323                         osvers="$4"
3324                         ;;
3325                 solaris) osname=solaris
3326                         case "$3" in
3327                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3328                         *)      osvers="$3" ;;
3329                         esac
3330                         ;;
3331                 sunos) osname=sunos
3332                         case "$3" in
3333                         5*) osname=solaris
3334                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3335                         *)      osvers="$3" ;;
3336                         esac
3337                         ;;
3338                 titanos) osname=titanos
3339                         case "$3" in
3340                         1*) osvers=1 ;;
3341                         2*) osvers=2 ;;
3342                         3*) osvers=3 ;;
3343                         4*) osvers=4 ;;
3344                         *)      osvers="$3" ;;
3345                         esac
3346                         ;;
3347                 ultrix) osname=ultrix
3348                         osvers="$3"
3349                         ;;
3350                 osf1|mls+)      case "$5" in
3351                                 alpha)
3352                                         osname=dec_osf
3353                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3354                                         case "$osvers" in
3355                                         [1-9].[0-9]*) ;;
3356                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3357                                         esac
3358                                         ;;
3359                         hp*)    osname=hp_osf1  ;;
3360                         mips)   osname=mips_osf1 ;;
3361                         esac
3362                         ;;
3363                 # UnixWare 7.1.2 is known as Open UNIX 8
3364                 openunix|unixware) osname=svr5
3365                         osvers="$4"
3366                         ;;
3367                 uts)    osname=uts
3368                         osvers="$3"
3369                         ;;
3370                 vos) osvers="$3"
3371                         ;;
3372                 $2) case "$osname" in
3373                         *isc*) ;;
3374                         *freebsd*) ;;
3375                         svr*)
3376                                 : svr4.x or possibly later
3377                                 case "svr$3" in
3378                                 ${osname}*)
3379                                         osname=svr$3
3380                                         osvers=$4
3381                                         ;;
3382                                 esac
3383                                 case "$osname" in
3384                                 svr4.0)
3385                                         : Check for ESIX
3386                                         if test -f /stand/boot ; then
3387                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3388                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3389                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3390                                                         if test -n "$isesix"; then
3391                                                                 osname=esix4
3392                                                         fi
3393                                                 fi
3394                                         fi
3395                                         ;;
3396                                 esac
3397                                 ;;
3398                         *)      if test -f /etc/systemid; then
3399                                         osname=sco
3400                                         set `echo $3 | $sed 's/\./ /g'` $4
3401                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3402                                                 osvers=$1.$2.$3
3403                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3404                                                 osvers=$1.$2
3405                                         elif $test -f $src/hints/sco_$1.sh; then
3406                                                 osvers=$1
3407                                         fi
3408                                 else
3409                                         case "$osname" in
3410                                         '') : Still unknown.  Probably a generic Sys V.
3411                                                 osname="sysv"
3412                                                 osvers="$3"
3413                                                 ;;
3414                                         esac
3415                                 fi
3416                                 ;;
3417                         esac
3418                         ;;
3419                 *)      case "$osname" in
3420                         '') : Still unknown.  Probably a generic BSD.
3421                                 osname="$1"
3422                                 osvers="$3"
3423                                 ;;
3424                         esac
3425                         ;;
3426                 esac
3427         else
3428                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3429                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3430                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3431                                 osname=news_os
3432                         fi
3433                         $rm -f UU/kernel.what
3434                 elif test -d c:/. -o -n "$is_os2" ; then
3435                         set X $myuname
3436                         osname=os2
3437                         osvers="$5"
3438                 fi
3439         fi
3440
3441         case "$targetarch" in
3442         '') ;;
3443         *)  hostarch=$osname
3444             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3445             osvers=''
3446             ;;
3447         esac
3448
3449         : Now look for a hint file osname_osvers, unless one has been
3450         : specified already.
3451         case "$hintfile" in
3452         ''|' ')
3453                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3454                 : Also try without trailing minor version numbers.
3455                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3456                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3457                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3458                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3459                 case "$file" in
3460                 '') dflt=none ;;
3461                 *)  case "$osvers" in
3462                         '') dflt=$file
3463                                 ;;
3464                         *)  if $test -f $src/hints/$file.sh ; then
3465                                         dflt=$file
3466                                 elif $test -f $src/hints/$xfile.sh ; then
3467                                         dflt=$xfile
3468                                 elif $test -f $src/hints/$xxfile.sh ; then
3469                                         dflt=$xxfile
3470                                 elif $test -f $src/hints/$xxxfile.sh ; then
3471                                         dflt=$xxxfile
3472                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3473                                         dflt=$xxxxfile
3474                                 elif $test -f "$src/hints/${osname}.sh" ; then
3475                                         dflt="${osname}"
3476                                 else
3477                                         dflt=none
3478                                 fi
3479                                 ;;
3480                         esac
3481                         ;;
3482                 esac
3483                 if $test -f Policy.sh ; then
3484                         case "$dflt" in
3485                         *Policy*) ;;
3486                         none) dflt="Policy" ;;
3487                         *) dflt="Policy $dflt" ;;
3488                         esac
3489                 fi
3490                 ;;
3491         *)
3492                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3493                 ;;
3494         esac
3495
3496         if $test -f Policy.sh ; then
3497                 $cat <<EOM
3498
3499 There's also a Policy hint file available, which should make the
3500 site-specific (policy) questions easier to answer.
3501 EOM
3502
3503         fi
3504
3505         $cat <<EOM
3506
3507 You may give one or more space-separated answers, or "none" if appropriate.
3508 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3509 previous run of Configure, you may specify it as well as or instead of
3510 OS-specific hints.  If hints are provided for your OS, you should use them:
3511 although Perl can probably be built without hints on many platforms, using
3512 hints often improve performance and may enable features that Configure can't
3513 set up on its own. If there are no hints that match your OS, specify "none";
3514 DO NOT give a wrong version or a wrong OS.
3515
3516 EOM
3517
3518         rp="Which of these apply, if any?"
3519         . UU/myread
3520         tans=$ans
3521         for file in $tans; do
3522                 if $test X$file = XPolicy -a -f Policy.sh; then
3523                         . Policy.sh
3524                         $cat Policy.sh >> UU/config.sh
3525                 elif $test -f $src/hints/$file.sh; then
3526                         . $src/hints/$file.sh
3527                         $cat $src/hints/$file.sh >> UU/config.sh
3528                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3529                         : nothing
3530                 else
3531                         : Give one chance to correct a possible typo.
3532                         echo "$file.sh does not exist"
3533                         dflt=$file
3534                         rp="hint to use instead?"
3535                         . UU/myread
3536                         for file in $ans; do
3537                                 if $test -f "$src/hints/$file.sh"; then
3538                                         . $src/hints/$file.sh
3539                                         $cat $src/hints/$file.sh >> UU/config.sh
3540                                 elif $test X$ans = X -o X$ans = Xnone ; then
3541                                         : nothing
3542                                 else
3543                                         echo "$file.sh does not exist -- ignored."
3544                                 fi
3545                         done
3546                 fi
3547         done
3548
3549         hint=recommended
3550         : Remember our hint file for later.
3551         if $test -f "$src/hints/$file.sh" ; then
3552                 hintfile="$file"
3553         else
3554                 hintfile=''
3555         fi
3556 fi
3557 cd UU
3558 ;;
3559 *)
3560         echo " "
3561         echo "Fetching default answers from $config_sh..." >&4
3562         tmp_n="$n"
3563         tmp_c="$c"
3564         cd ..
3565         cp $config_sh config.sh 2>/dev/null
3566         chmod +w config.sh
3567         . ./config.sh
3568         cd UU
3569         cp ../config.sh .
3570         n="$tmp_n"
3571         c="$tmp_c"
3572         hint=previous
3573         ;;
3574 esac
3575 test "$override" && . ./optdef.sh
3576
3577 : Restore computed paths
3578 for file in $loclist $trylist; do
3579         eval $file="\$_$file"
3580 done
3581
3582 cat << EOM
3583
3584 Configure uses the operating system name and version to set some defaults.
3585 The default value is probably right if the name rings a bell. Otherwise,
3586 since spelling matters for me, either accept the default or answer "none"
3587 to leave it blank.
3588
3589 EOM
3590 case "$osname" in
3591         ''|' ')
3592                 case "$hintfile" in
3593                 ''|' '|none) dflt=none ;;
3594                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3595                 esac
3596                 ;;
3597         *) dflt="$osname" ;;
3598 esac
3599 rp="Operating system name?"
3600 . ./myread
3601 case "$ans" in
3602 none)  osname='' ;;
3603 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3604 esac
3605 echo " "
3606 case "$osvers" in
3607         ''|' ')
3608                 case "$hintfile" in
3609                 ''|' '|none) dflt=none ;;
3610                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3611                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3612                         case "$dflt" in
3613                         ''|' ') dflt=none ;;
3614                         esac
3615                         ;;
3616                 esac
3617                 ;;
3618         *) dflt="$osvers" ;;
3619 esac
3620 rp="Operating system version?"
3621 . ./myread
3622 case "$ans" in
3623 none)  osvers='' ;;
3624 *) osvers="$ans" ;;
3625 esac
3626
3627
3628 . ./posthint.sh
3629
3630 : who configured the system
3631 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3632 case "$cf_by" in
3633 "")
3634         cf_by=`(logname) 2>/dev/null`
3635         case "$cf_by" in
3636         "")
3637                 cf_by=`(whoami) 2>/dev/null`
3638                 case "$cf_by" in
3639                 "") cf_by=unknown ;;
3640                 esac ;;
3641         esac ;;
3642 esac
3643
3644 : decide how portable to be.  Allow command line overrides.
3645 case "$d_portable" in
3646 "$undef") ;;
3647 *)      d_portable="$define" ;;
3648 esac
3649
3650 : set up shell script to do ~ expansion
3651 cat >filexp <<EOSS
3652 $startsh
3653 : expand filename
3654 case "\$1" in
3655  \~/*|\~)
3656         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3657         ;;
3658  \~*)
3659         if $test -f /bin/csh; then
3660                 /bin/csh -f -c "glob \$1"
3661                 failed=\$?
3662                 echo ""
3663                 exit \$failed
3664         else
3665                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3666                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3667                 if $test ! -d "\$dir"; then
3668                         me=\`basename \$0\`
3669                         echo "\$me: can't locate home directory for: \$name" >&2
3670                         exit 1
3671                 fi
3672                 case "\$1" in
3673                 */*)
3674                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3675                         ;;
3676                 *)
3677                         echo \$dir
3678                         ;;
3679                 esac
3680         fi
3681         ;;
3682 *)
3683         echo \$1
3684         ;;
3685 esac
3686 EOSS
3687 chmod +x filexp
3688 $eunicefix filexp
3689
3690 : now set up to get a file name
3691 cat <<EOS >getfile
3692 $startsh
3693 EOS
3694 cat <<'EOSC' >>getfile
3695 tilde=''
3696 fullpath=''
3697 already=''
3698 skip=''
3699 none_ok=''
3700 exp_file=''
3701 nopath_ok=''
3702 orig_rp="$rp"
3703 orig_dflt="$dflt"
3704 case "$gfpth" in
3705 '') gfpth='.' ;;
3706 esac
3707
3708 case "$fn" in
3709 *\(*)
3710         : getfile will accept an answer from the comma-separated list
3711         : enclosed in parentheses even if it does not meet other criteria.
3712         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3713         fn=`echo $fn | sed 's/(.*)//'`
3714         ;;
3715 esac
3716
3717 case "$fn" in
3718 *:*)
3719         loc_file=`expr $fn : '.*:\(.*\)'`
3720         fn=`expr $fn : '\(.*\):.*'`
3721         ;;
3722 esac
3723
3724 case "$fn" in
3725 *~*) tilde=true;;
3726 esac
3727 case "$fn" in
3728 */*) fullpath=true;;
3729 esac
3730 case "$fn" in
3731 *+*) skip=true;;
3732 esac
3733 case "$fn" in
3734 *n*) none_ok=true;;
3735 esac
3736 case "$fn" in
3737 *e*) exp_file=true;;
3738 esac
3739 case "$fn" in
3740 *p*) nopath_ok=true;;
3741 esac
3742
3743 case "$fn" in
3744 *f*) type='File';;
3745 *d*) type='Directory';;
3746 *l*) type='Locate';;
3747 esac
3748
3749 what="$type"
3750 case "$what" in
3751 Locate) what='File';;
3752 esac
3753
3754 case "$exp_file" in
3755 '')
3756         case "$d_portable" in
3757         "$define") ;;
3758         *) exp_file=true;;
3759         esac
3760         ;;
3761 esac
3762
3763 cd ..
3764 while test "$type"; do
3765         redo=''
3766         rp="$orig_rp"
3767         dflt="$orig_dflt"
3768         case "$tilde" in
3769         true) rp="$rp (~name ok)";;
3770         esac
3771         . UU/myread
3772         if test -f UU/getfile.ok && \
3773                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3774         then
3775                 value="$ans"
3776                 ansexp="$ans"
3777                 break
3778         fi
3779         case "$ans" in
3780         none)
3781                 value=''
3782                 ansexp=''
3783                 case "$none_ok" in
3784                 true) type='';;
3785                 esac
3786                 ;;
3787         *)
3788                 case "$tilde" in
3789                 '') value="$ans"
3790                         ansexp="$ans";;
3791                 *)
3792                         value=`UU/filexp $ans`
3793                         case $? in
3794                         0)
3795                                 if test "$ans" != "$value"; then
3796                                         echo "(That expands to $value on this system.)"
3797                                 fi
3798                                 ;;
3799                         *) value="$ans";;
3800                         esac
3801                         ansexp="$value"
3802                         case "$exp_file" in
3803                         '') value="$ans";;
3804                         esac
3805                         ;;
3806                 esac
3807                 case "$fullpath" in
3808                 true)
3809                         case "$ansexp" in
3810                         /*) value="$ansexp" ;;
3811                         [a-zA-Z]:/*) value="$ansexp" ;;
3812                         *)
3813                                 redo=true
3814                                 case "$already" in
3815                                 true)
3816                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3817                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3818                                         ;;
3819                                 *)
3820                                 echo "Please give a full path name, starting with slash." >&4
3821                                         case "$tilde" in
3822                                         true)
3823                                 echo "Note that using ~name is ok provided it expands well." >&4
3824                                                 already=true
3825                                                 ;;
3826                                         esac
3827                                 esac
3828                                 ;;
3829                         esac
3830                         ;;
3831                 esac
3832                 case "$redo" in
3833                 '')
3834                         case "$type" in
3835                         File)
3836                                 for fp in $gfpth; do
3837                                         if test "X$fp" = X.; then
3838                                             pf="$ansexp"
3839                                         else    
3840                                             pf="$fp/$ansexp"
3841                                         fi
3842                                         if test -f "$pf"; then
3843                                                 type=''
3844                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3845                                         then
3846                                                 echo "($value is not a plain file, but that's ok.)"
3847                                                 type=''
3848                                         fi
3849                                         if test X"$type" = X; then
3850                                             value="$pf"
3851                                             break
3852                                         fi
3853                                 done
3854                                 ;;
3855                         Directory)
3856                                 for fp in $gfpth; do
3857                                         if test "X$fp" = X.; then
3858                                             dir="$ans"
3859                                             direxp="$ansexp"
3860                                         else    
3861                                             dir="$fp/$ansexp"
3862                                             direxp="$fp/$ansexp"
3863                                         fi
3864                                         if test -d "$direxp"; then
3865                                                 type=''
3866                                                 value="$dir"
3867                                                 break
3868                                         fi
3869                                 done
3870                                 ;;
3871                         Locate)
3872                                 if test -d "$ansexp"; then
3873                                         echo "(Looking for $loc_file in directory $value.)"
3874                                         value="$value/$loc_file"
3875                                         ansexp="$ansexp/$loc_file"
3876                                 fi
3877                                 if test -f "$ansexp"; then
3878                                         type=''
3879                                 fi
3880                                 case "$nopath_ok" in
3881                                 true)   case "$value" in
3882                                         */*) ;;
3883                                         *)      echo "Assuming $value will be in people's path."
3884                                                 type=''
3885                                                 ;;
3886                                         esac
3887                                         ;;
3888                                 esac
3889                                 ;;
3890                         esac
3891
3892                         case "$skip" in
3893                         true) type='';
3894                         esac
3895
3896                         case "$type" in
3897                         '') ;;
3898                         *)
3899                                 if test "$fastread" = yes; then
3900                                         dflt=y
3901                                 else
3902                                         dflt=n
3903                                 fi
3904                                 rp="$what $value doesn't exist.  Use that name anyway?"
3905                                 . UU/myread
3906                                 dflt=''
3907                                 case "$ans" in
3908                                 y*) type='';;
3909                                 *) echo " ";;
3910                                 esac
3911                                 ;;
3912                         esac
3913                         ;;
3914                 esac
3915                 ;;
3916         esac
3917 done
3918 cd UU
3919 ans="$value"
3920 rp="$orig_rp"
3921 dflt="$orig_dflt"
3922 rm -f getfile.ok
3923 test "X$gfpthkeep" != Xy && gfpth=""
3924 EOSC
3925
3926 : determine root of directory hierarchy where package will be installed.
3927 case "$prefix" in
3928 '')
3929         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3930         ;;
3931 *?/)
3932         dflt=`echo "$prefix" | sed 's/.$//'`
3933         ;;
3934 *)
3935         dflt="$prefix"
3936         ;;
3937 esac
3938 $cat <<EOM
3939
3940 By default, $package will be installed in $dflt/bin, manual pages
3941 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3942 installation directories. Typically this is something like /usr/local.
3943 If you wish to have binaries under /usr/bin but other parts of the
3944 installation under /usr/local, that's ok: you will be prompted
3945 separately for each of the installation directories, the prefix being
3946 only used to set the defaults.
3947
3948 EOM
3949 fn=d~
3950 rp='Installation prefix to use?'
3951 . ./getfile
3952 oldprefix=''
3953 case "$prefix" in
3954 '') ;;
3955 *)
3956         case "$ans" in
3957         "$prefix") ;;
3958         *) oldprefix="$prefix";;
3959         esac
3960         ;;
3961 esac
3962 prefix="$ans"
3963 prefixexp="$ansexp"
3964
3965 : allow them to override the AFS root
3966 case "$afsroot" in
3967 '')     afsroot=/afs ;;
3968 *)      afsroot=$afsroot ;;
3969 esac
3970
3971 : is AFS running?
3972 echo " "
3973 case "$afs" in
3974 $define|true)   afs=true ;;
3975 $undef|false)   afs=false ;;
3976 *)      if $test -d $afsroot; then
3977                 afs=true
3978         else
3979                 afs=false
3980         fi
3981         ;;
3982 esac
3983 if $afs; then
3984         echo "AFS may be running... I'll be extra cautious then..." >&4
3985 else
3986         echo "AFS does not seem to be running..." >&4
3987 fi
3988
3989 : determine installation prefix for where package is to be installed.
3990 if $afs; then 
3991 $cat <<EOM
3992
3993 Since you are running AFS, I need to distinguish the directory in which
3994 files will reside from the directory in which they are installed (and from
3995 which they are presumably copied to the former directory by occult means).
3996
3997 EOM
3998         case "$installprefix" in
3999         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4000         *) dflt="$installprefix";;
4001         esac
4002 else
4003 $cat <<EOM
4004
4005 In some special cases, particularly when building $package for distribution,
4006 it is convenient to distinguish the directory in which files should be
4007 installed from the directory ($prefix) in which they will
4008 eventually reside.  For most users, these two directories are the same.
4009
4010 EOM
4011         case "$installprefix" in
4012         '') dflt=$prefix ;;
4013         *) dflt=$installprefix;;
4014         esac
4015 fi
4016 fn=d~
4017 rp='What installation prefix should I use for installing files?'
4018 . ./getfile
4019 installprefix="$ans"
4020 installprefixexp="$ansexp"
4021
4022 : Perform the prefixexp/installprefixexp correction if necessary
4023 cat <<EOS >installprefix
4024 $startsh
4025 EOS
4026 cat <<'EOSC' >>installprefix
4027 : Change installation prefix, if necessary.
4028 if $test X"$prefix" != X"$installprefix"; then
4029     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4030 else
4031     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4032 fi
4033 EOSC
4034 chmod +x installprefix
4035 $eunicefix installprefix
4036
4037 : Set variables such as privlib and privlibexp from the output of ./getfile
4038 : performing the prefixexp/installprefixexp correction if necessary.
4039 cat <<EOS >setprefixvar
4040 $startsh
4041 EOS
4042 cat <<'EOSC' >>setprefixvar
4043 eval "${prefixvar}=\"\$ans\""
4044 eval "${prefixvar}exp=\"\$ansexp\""
4045 . ./installprefix
4046 EOSC
4047 chmod +x setprefixvar
4048 $eunicefix setprefixvar
4049
4050 : set up the script used to warn in case of inconsistency
4051 cat <<EOS >whoa
4052 $startsh
4053 EOS
4054 cat <<'EOSC' >>whoa
4055 dflt=y
4056 case "$hint" in
4057     recommended)
4058         case "$hintfile" in
4059         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4060                 ;;
4061         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4062                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4063                 ;;
4064         esac
4065         ;;
4066     *)  echo " "
4067         echo "*** WHOA THERE!!! ***" >&4
4068         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4069         ;;
4070 esac
4071 rp="    Keep the $hint value?"
4072 . ./myread
4073 case "$ans" in
4074 y) td=$was; tu=$was;;
4075 esac
4076 EOSC
4077
4078 : function used to set '$1' to '$val'
4079 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4080 case "$val$was" in
4081 $define$undef) . ./whoa; eval "$var=\$td";;
4082 $undef$define) . ./whoa; eval "$var=\$tu";;
4083 *) eval "$var=$val";;
4084 esac'
4085
4086 : get the patchlevel
4087 echo " "
4088 echo "Getting the current patchlevel..." >&4
4089 if $test -r $rsrc/patchlevel.h;then
4090         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4091         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4092         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4093         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4094         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4095         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4096         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4097 else
4098         revision=0
4099         patchlevel=0
4100         subversion=0
4101         api_revision=0
4102         api_version=0
4103         api_subversion=0
4104         perl_patchlevel=0
4105         $echo "(You do not have patchlevel.h.  Eek.)"
4106 fi
4107 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4108 version_patchlevel_string="version $patchlevel subversion $subversion"
4109 case "$perl_patchlevel" in
4110 0|'') ;;
4111 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4112     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4113     ;;
4114 esac
4115
4116 $echo "(You have $package $version_patchlevel_string.)"
4117
4118 case "$osname" in
4119 dos|vms)
4120         : XXX Should be a Configure test for double-dots in filenames.
4121         version=`echo $revision $patchlevel $subversion | \
4122                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4123         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4124                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4125         ;;
4126 *)
4127         version=`echo $revision $patchlevel $subversion | \
4128                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4129         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4130                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4131         ;;
4132 esac
4133 : Special case the 5.005_xx maintenance series, which used 5.005
4134 : without any subversion label as a subdirectory in $sitelib
4135 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4136         api_versionstring='5.005'
4137 fi
4138
4139 : Do we want threads support and if so, what type
4140 case "$usethreads" in
4141 $define|true|[yY]*)     dflt='y';;
4142 *)     # Catch case where user specified ithreads or 5005threads but
4143        # forgot -Dusethreads (A.D. 4/2002)
4144        case "$useithreads$use5005threads" in
4145        *$define*)       dflt='y';;
4146        *)               dflt='n';;
4147        esac
4148        ;;
4149 esac
4150 cat <<EOM
4151
4152 Perl can be built to take advantage of threads on some systems.
4153 To do so, Configure can be run with -Dusethreads.
4154
4155 Note that Perl built with threading support runs slightly slower
4156 and uses more memory than plain Perl. The current implementation
4157 is believed to be stable, but it is fairly new, and so should be
4158 treated with caution.
4159
4160 If this doesn't make any sense to you, just accept the default '$dflt'.
4161 EOM
4162 rp='Build a threading Perl?'
4163 . ./myread
4164 case "$ans" in
4165 y|Y)    val="$define" ;;
4166 *)      val="$undef" ;;
4167 esac
4168 set usethreads
4169 eval $setvar
4170
4171 if $test $patchlevel -lt 9; then
4172     case "$usethreads" in
4173     $define)
4174         $cat <<EOM
4175
4176 Since release 5.6, Perl has had two different threading implementations,
4177 the newer interpreter-based version (ithreads) with one interpreter per
4178 thread, and the older 5.005 version (5005threads).
4179 The 5005threads version is effectively unmaintained and will probably be
4180 removed in Perl 5.10, so there should be no need to build a Perl using it
4181 unless needed for backwards compatibility with some existing 5.005threads
4182 code.
4183
4184 EOM
4185         : Default to ithreads unless overridden on command line or with
4186         : old config.sh
4187         dflt='y'
4188         case "$use5005threads" in
4189                 $define|true|[yY]*) dflt='n';;
4190         esac
4191         case "$useithreads" in
4192                 $undef|false|[nN]*) dflt='n';;
4193         esac
4194         rp='Use the newer interpreter-based ithreads?'
4195         . ./myread
4196         case "$ans" in
4197         y|Y)    val="$define" ;;
4198         *)      val="$undef" ;;
4199         esac
4200         set useithreads
4201         eval $setvar
4202         : Now set use5005threads to the opposite value.
4203         case "$useithreads" in
4204         $define) val="$undef" ;;
4205         *) val="$define" ;;
4206         esac
4207         set use5005threads
4208         eval $setvar
4209         ;;
4210     *)
4211         useithreads="$undef"
4212         use5005threads="$undef"
4213         ;;
4214     esac
4215
4216     case "$useithreads$use5005threads" in
4217     "$define$define")
4218         $cat >&4 <<EOM
4219
4220 You cannot have both the ithreads and the 5.005 threads enabled
4221 at the same time.  Disabling the 5.005 threads since they are
4222 much less stable than the ithreads.
4223
4224 EOM
4225         use5005threads="$undef"
4226         ;;
4227     esac
4228
4229 else
4230 : perl-5.9.x and later
4231
4232     if test X"$usethreads" = "X$define"; then
4233         case "$use5005threads" in
4234             $define|true|[yY]*)
4235                 $cat >&4 <<EOM
4236
4237 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4238
4239 EOM
4240             ;;
4241         esac
4242     fi
4243
4244     use5005threads="$undef"
4245     useithreads="$usethreads"
4246 fi
4247
4248 case "$d_oldpthreads" in
4249 '')     : Configure tests would be welcome here.  For now, assume undef.
4250         val="$undef" ;;
4251 *)      val="$d_oldpthreads" ;;
4252 esac
4253 set d_oldpthreads
4254 eval $setvar
4255
4256
4257 : Look for a hint-file generated 'call-back-unit'.  If the
4258 : user has specified that a threading perl is to be built,
4259 : we may need to set or change some other defaults.
4260 if $test -f usethreads.cbu; then
4261     echo "Your platform has some specific hints regarding threaded builds, using them..."
4262     . ./usethreads.cbu
4263 else
4264     case "$usethreads" in
4265         "$define"|true|[yY]*)
4266                 $cat <<EOM
4267 (Your platform does not have any specific hints for threaded builds.
4268  Assuming POSIX threads, then.)
4269 EOM
4270         ;;
4271     esac
4272 fi
4273
4274 : Check if multiplicity is required
4275 cat <<EOM
4276
4277 Perl can be built so that multiple Perl interpreters can coexist
4278 within the same Perl executable.
4279 EOM
4280
4281 case "$useithreads" in
4282 $define)
4283         cat <<EOM
4284 This multiple interpreter support is required for interpreter-based threads.
4285 EOM
4286         val="$define"
4287         ;;
4288 *)      case "$usemultiplicity" in
4289         $define|true|[yY]*)     dflt='y';;
4290         *) dflt='n';;
4291         esac
4292         echo " "
4293         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4294         rp='Build Perl for multiplicity?'
4295         . ./myread
4296         case "$ans" in
4297         y|Y)    val="$define" ;;
4298         *)      val="$undef" ;;
4299         esac
4300         ;;
4301 esac
4302 set usemultiplicity
4303 eval $setvar
4304
4305 : Check if morebits is requested
4306 case "$usemorebits" in
4307 "$define"|true|[yY]*)
4308         use64bitint="$define"
4309         uselongdouble="$define"
4310         usemorebits="$define"
4311         ;;
4312 *)      usemorebits="$undef"
4313         ;;
4314 esac
4315
4316 : Determine the C compiler to be used
4317 echo " "
4318 case "$cc" in
4319 '') dflt=cc;;
4320 *) dflt="$cc";;
4321 esac
4322 rp="Use which C compiler?"
4323 . ./myread
4324 cc="$ans"
4325
4326 : See whether they have no cc but they do have gcc
4327 . ./trygcc
4328 if $test -f cc.cbu; then
4329     . ./cc.cbu
4330 fi
4331 . ./checkcc
4332
4333 : make some quick guesses about what we are up against
4334 echo " "
4335 $echo $n "Hmm...  $c"
4336 echo exit 1 >bsd
4337 echo exit 1 >usg
4338 echo exit 1 >v7
4339 echo exit 1 >osf1
4340 echo exit 1 >eunice
4341 echo exit 1 >xenix
4342 echo exit 1 >venix
4343 echo exit 1 >os2
4344 d_bsd="$undef"
4345 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4346 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4347 then
4348         echo "Looks kind of like an OSF/1 system, but we'll see..."
4349         echo exit 0 >osf1
4350 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4351         xxx=`./loc addbib blurfl $pth`
4352         if $test -f $xxx; then
4353         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4354                 echo exit 0 >bsd
4355                 echo exit 0 >usg
4356         else
4357                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4358                         echo "Looks kind of like an extended USG system, but we'll see..."
4359                 else
4360                         echo "Looks kind of like a USG system, but we'll see..."
4361                 fi
4362                 echo exit 0 >usg
4363         fi
4364 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4365         echo "Looks kind of like a BSD system, but we'll see..."
4366         d_bsd="$define"
4367         echo exit 0 >bsd
4368 else
4369         echo "Looks kind of like a Version 7 system, but we'll see..."
4370         echo exit 0 >v7
4371 fi
4372 case "$eunicefix" in
4373 *unixtovms*)
4374         $cat <<'EOI'
4375 There is, however, a strange, musty smell in the air that reminds me of
4376 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4377 EOI
4378         echo exit 0 >eunice
4379         d_eunice="$define"
4380 : it so happens the Eunice I know will not run shell scripts in Unix format
4381         ;;
4382 *)
4383         echo " "
4384         echo "Congratulations.  You aren't running Eunice."
4385         d_eunice="$undef"
4386         ;;
4387 esac
4388 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4389 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4390 : semicolon as a patch separator
4391 case "$p_" in
4392 :) ;;
4393 *)
4394         $cat <<'EOI'
4395 I have the feeling something is not exactly right, however...don't tell me...
4396 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4397 (Or you may be running DOS with DJGPP.)
4398 EOI
4399         echo exit 0 >os2
4400         ;;
4401 esac
4402 if test -f /xenix; then
4403         echo "Actually, this looks more like a XENIX system..."
4404         echo exit 0 >xenix
4405         d_xenix="$define"
4406 else
4407         echo " "
4408         echo "It's not Xenix..."
4409         d_xenix="$undef"
4410 fi
4411 chmod +x xenix
4412 $eunicefix xenix
4413 if test -f /venix; then
4414         echo "Actually, this looks more like a VENIX system..."
4415         echo exit 0 >venix
4416 else
4417         echo " "
4418         if ./xenix; then
4419                 : null
4420         else
4421                 echo "Nor is it Venix..."
4422         fi
4423 fi
4424 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4425 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4426 $rm -f foo
4427
4428 : Check if we are using GNU gcc and what its version is
4429 echo " "
4430 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4431 $cat >try.c <<EOM
4432 #include <stdio.h>
4433 int main() {
4434 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4435 #ifdef __VERSION__
4436         printf("%s\n", __VERSION__);
4437 #else
4438         printf("%s\n", "1");
4439 #endif
4440 #endif
4441         return(0);
4442 }
4443 EOM
4444 if $cc -o try $ccflags $ldflags try.c; then
4445         gccversion=`$run ./try`
4446         case "$gccversion" in
4447         '') echo "You are not using GNU cc." ;;
4448         *)  echo "You are using GNU cc $gccversion."
4449             ccname=gcc
4450             ;;
4451         esac
4452 else
4453         echo " "
4454         echo "*** WHOA THERE!!! ***" >&4
4455         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4456         case "$knowitall" in
4457         '')
4458         echo "    You'd better start hunting for one and let me know about it." >&4
4459                 exit 1
4460                 ;;
4461         esac
4462 fi
4463 $rm -f try try.*
4464 case "$gccversion" in
4465 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4466 esac
4467 case "$gccversion" in
4468 '') gccosandvers='' ;;
4469 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4470    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4471    gccshortvers=''
4472    case "$gccosandvers" in
4473    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4474    $osname$osvers) ;; # looking good
4475    $osname*) cat <<EOM >&4
4476
4477 *** WHOA THERE!!! ***
4478
4479     Your gcc has not been compiled for the exact release of
4480     your operating system ($gccosandvers versus $osname$osvers).
4481
4482     In general it is a good idea to keep gcc synchronized with
4483     the operating system because otherwise serious problems
4484     may ensue when trying to compile software, like Perl.
4485
4486     I'm trying to be optimistic here, though, and will continue.
4487     If later during the configuration and build icky compilation
4488     problems appear (headerfile conflicts being the most common
4489     manifestation), I suggest reinstalling the gcc to match
4490     your operating system release.
4491
4492 EOM
4493       ;;
4494    *) gccosandvers='' ;; # failed to parse, better be silent
4495    esac
4496    ;;
4497 esac
4498 case "$ccname" in
4499 '') ccname="$cc" ;;
4500 esac
4501
4502 # gcc 3.* complain about adding -Idirectories that they already know about,
4503 # so we will take those off from locincpth.
4504 case "$gccversion" in
4505 3*)
4506     echo "main(){}">try.c
4507     for incdir in $locincpth; do
4508        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4509              grep '^c[cp]p*[01]: warning: changing search order '`
4510        if test "X$warn" != X; then
4511            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4512        fi
4513     done
4514     $rm -f try try.*
4515 esac
4516
4517 : What should the include directory be ?
4518 echo " "
4519 $echo $n "Hmm...  $c"
4520 dflt='/usr/include'
4521 incpath=''
4522 mips_type=''
4523 if $test -f /bin/mips && /bin/mips; then
4524         echo "Looks like a MIPS system..."
4525         $cat >usr.c <<'EOCP'
4526 #ifdef SYSTYPE_BSD43
4527 /bsd43
4528 #endif
4529 EOCP
4530         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4531                 dflt='/bsd43/usr/include'
4532                 incpath='/bsd43'
4533                 mips_type='BSD 4.3'
4534         else
4535                 mips_type='System V'
4536         fi
4537         $rm -f usr.c usr.out
4538         echo "and you're compiling with the $mips_type compiler and libraries."
4539         xxx_prompt=y
4540         echo "exit 0" >mips
4541 else
4542         echo "Doesn't look like a MIPS system."
4543         xxx_prompt=n
4544         echo "exit 1" >mips
4545 fi
4546 chmod +x mips
4547 $eunicefix mips
4548 case "$usrinc" in
4549 '') ;;
4550 *) dflt="$usrinc";;
4551 esac
4552 case "$xxx_prompt" in
4553 y)      fn=d/
4554         echo " "
4555         rp='Where are the include files you want to use?'
4556         . ./getfile
4557         usrinc="$ans"
4558         ;;
4559 *)      usrinc="$dflt"
4560         ;;
4561 esac
4562
4563 : see how we invoke the C preprocessor
4564 echo " "
4565 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4566 cat <<'EOT' >testcpp.c
4567 #define ABC abc
4568 #define XYZ xyz
4569 ABC.XYZ
4570 EOT
4571 cd ..
4572 if test ! -f cppstdin; then
4573         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4574                 # AIX cc -E doesn't show the absolute headerfile
4575                 # locations but we'll cheat by using the -M flag.
4576                 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
4577         else
4578                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4579         fi
4580 else
4581         echo "Keeping your $hint cppstdin wrapper."
4582 fi
4583 chmod 755 cppstdin
4584 wrapper=`pwd`/cppstdin
4585 ok='false'
4586 cd UU
4587
4588 if $test "X$cppstdin" != "X" && \
4589         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4590         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4591 then
4592         echo "You used to use $cppstdin $cppminus so we'll use that again."
4593         case "$cpprun" in
4594         '') echo "But let's see if we can live without a wrapper..." ;;
4595         *)
4596                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4597                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4598                 then
4599                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4600                         ok='true'
4601                 else
4602                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4603                 fi
4604                 ;;
4605         esac
4606 else
4607         case "$cppstdin" in
4608         '') ;;
4609         *)
4610                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4611                 ;;
4612         esac
4613 fi
4614
4615 if $ok; then
4616         : nothing
4617 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4618         $cc -E <testcpp.c >testcpp.out 2>&1; \
4619         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4620         echo "Yup, it does."
4621         x_cpp="$cc -E"
4622         x_minus='';
4623 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4624         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4625         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4626         echo "Yup, it does."
4627         x_cpp="$cc -E"
4628         x_minus='-';
4629 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4630         $cc -P <testcpp.c >testcpp.out 2>&1; \
4631         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4632         echo "Yipee, that works!"
4633         x_cpp="$cc -P"
4634         x_minus='';
4635 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4636         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4637         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4638         echo "At long last!"
4639         x_cpp="$cc -P"
4640         x_minus='-';
4641 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4642         $cpp <testcpp.c >testcpp.out 2>&1; \
4643         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4644         echo "It works!"
4645         x_cpp="$cpp"
4646         x_minus='';
4647 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4648         $cpp - <testcpp.c >testcpp.out 2>&1; \
4649         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4650         echo "Hooray, it works!  I was beginning to wonder."
4651         x_cpp="$cpp"
4652         x_minus='-';
4653 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4654         $wrapper <testcpp.c >testcpp.out 2>&1; \
4655         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4656         x_cpp="$wrapper"
4657         x_minus=''
4658         echo "Eureka!"
4659 else
4660         dflt=''
4661         rp="No dice.  I can't find a C preprocessor.  Name one:"
4662         . ./myread
4663         x_cpp="$ans"
4664         x_minus=''
4665         $x_cpp <testcpp.c >testcpp.out 2>&1
4666         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4667                 echo "OK, that will do." >&4
4668         else
4669 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4670                 exit 1
4671         fi
4672 fi
4673
4674 case "$ok" in
4675 false)
4676         cppstdin="$x_cpp"
4677         cppminus="$x_minus"
4678         cpprun="$x_cpp"
4679         cpplast="$x_minus"
4680         set X $x_cpp
4681         shift
4682         case "$1" in
4683         "$cpp")
4684                 echo "Perhaps can we force $cc -E using a wrapper..."
4685                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4686                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4687                 then
4688                         echo "Yup, we can."
4689                         cppstdin="$wrapper"
4690                         cppminus='';
4691                 else
4692                         echo "Nope, we'll have to live without it..."
4693                 fi
4694                 ;;
4695         esac
4696         case "$cpprun" in
4697         "$wrapper")
4698                 cpprun=''
4699                 cpplast=''
4700                 ;;
4701         esac
4702         ;;
4703 esac
4704
4705 case "$cppstdin" in
4706 "$wrapper"|'cppstdin') ;;
4707 *) $rm -f $wrapper;;
4708 esac
4709 $rm -f testcpp.c testcpp.out
4710
4711 : Set private lib path
4712 case "$plibpth" in
4713 '') if ./mips; then
4714                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4715         fi;;
4716 esac
4717 case "$libpth" in
4718 ' ') dlist='';;
4719 '') dlist="$loclibpth $plibpth $glibpth";;
4720 *) dlist="$libpth";;
4721 esac
4722
4723 : Now check and see which directories actually exist, avoiding duplicates
4724 libpth=''
4725 for xxx in $dlist
4726 do
4727     if $test -d $xxx; then
4728                 case " $libpth " in
4729                 *" $xxx "*) ;;
4730                 *) libpth="$libpth $xxx";;
4731                 esac
4732     fi
4733 done
4734 $cat <<'EOM'
4735
4736 Some systems have incompatible or broken versions of libraries.  Among
4737 the directories listed in the question below, please remove any you
4738 know not to be holding relevant libraries, and add any that are needed.
4739 Say "none" for none.
4740
4741 EOM
4742 case "$libpth" in
4743 '') dflt='none';;
4744 *)
4745         set X $libpth
4746         shift
4747         dflt=${1+"$@"}
4748         ;;
4749 esac
4750 rp="Directories to use for library searches?"
4751 . ./myread
4752 case "$ans" in
4753 none) libpth=' ';;
4754 *) libpth="$ans";;
4755 esac
4756
4757 : compute shared library extension
4758 case "$so" in
4759 '')
4760         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4761                 dflt='sl'
4762         else
4763                 dflt='so'
4764         fi
4765         ;;
4766 *) dflt="$so";;
4767 esac
4768 $cat <<EOM
4769
4770 On some systems, shared libraries may be available.  Answer 'none' if
4771 you want to suppress searching of shared libraries for the remainder
4772 of this configuration.
4773
4774 EOM
4775 rp='What is the file extension used for shared libraries?'
4776 . ./myread
4777 so="$ans"
4778
4779 : Define several unixisms.
4780 : Hints files or command line option can be used to override them.
4781 : The convoluted testing is in case hints files set either the old
4782 : or the new name.
4783 case "$_exe" in
4784 '')     case "$exe_ext" in
4785         '')     ;;
4786         *)      _exe="$exe_ext" ;;
4787         esac
4788         ;;
4789 esac
4790 case "$_a" in
4791 '')     case "$lib_ext" in
4792     '') _a='.a';;
4793         *)      _a="$lib_ext" ;;
4794         esac
4795         ;;
4796 esac
4797 case "$_o" in
4798 '') case "$obj_ext" in
4799         '')     _o='.o';;
4800         *)      _o="$obj_ext";;
4801         esac
4802         ;;
4803 esac
4804 case "$p_" in
4805 '') case "$path_sep" in
4806         '')     p_=':';;
4807         *)      p_="$path_sep";;
4808         esac
4809         ;;
4810 esac
4811 exe_ext=$_exe
4812 lib_ext=$_a
4813 obj_ext=$_o
4814 path_sep=$p_
4815
4816 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4817
4818 : Which makefile gets called first.  This is used by make depend.
4819 case "$firstmakefile" in
4820 '') firstmakefile='makefile';;
4821 esac
4822
4823 : Check is we will use socks
4824 case "$usesocks" in
4825 $define|true|[yY]*)     dflt='y';;
4826 *) dflt='n';;
4827 esac
4828 cat <<EOM
4829
4830 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4831 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4832 to use the PerlIO abstraction layer, this will be implicitly selected.
4833
4834 If this doesn't make any sense to you, just accept the default '$dflt'.
4835 EOM
4836 rp='Build Perl for SOCKS?'
4837 . ./myread
4838 case "$ans" in
4839 y|Y)    val="$define" ;;
4840 *)      val="$undef" ;;
4841 esac
4842 set usesocks
4843 eval $setvar
4844
4845 : Check for uselongdouble support
4846 case "$ccflags" in
4847 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4848 esac
4849
4850 case "$uselongdouble" in
4851 $define|true|[yY]*)     dflt='y';;
4852 *) dflt='n';;
4853 esac
4854 cat <<EOM
4855
4856 Perl can be built to take advantage of long doubles which
4857 (if available) may give more accuracy and range for floating point numbers.
4858
4859 If this doesn't make any sense to you, just accept the default '$dflt'.
4860 EOM
4861 rp='Try to use long doubles if available?'
4862 . ./myread
4863 case "$ans" in
4864 y|Y)    val="$define"   ;;
4865 *)      val="$undef"    ;;
4866 esac
4867 set uselongdouble
4868 eval $setvar
4869
4870 case "$uselongdouble" in
4871 true|[yY]*) uselongdouble="$define" ;;
4872 esac
4873
4874 : Look for a hint-file generated 'call-back-unit'.  If the
4875 : user has specified that long doubles should be used,
4876 : we may need to set or change some other defaults.
4877 if $test -f uselongdouble.cbu; then
4878     echo "Your platform has some specific hints regarding long doubles, using them..."
4879     . ./uselongdouble.cbu
4880 else
4881     case "$uselongdouble" in
4882         $define)
4883                 $cat <<EOM
4884 (Your platform does not have any specific hints for long doubles.)
4885 EOM
4886         ;;
4887     esac
4888 fi
4889
4890 : Looking for optional libraries
4891 echo " "
4892 echo "Checking for optional libraries..." >&4
4893 case "$libs" in
4894 ' '|'') dflt='';;
4895 *) dflt="$libs";;
4896 esac
4897 case "$libswanted" in
4898 '') libswanted='c_s';;
4899 esac
4900 case "$usesocks" in
4901 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4902 esac
4903 libsfound=''
4904 libsfiles=''
4905 libsdirs=''
4906 libspath=''
4907 for thisdir in $libpth $xlibpth; do
4908   test -d $thisdir && libspath="$libspath $thisdir"
4909 done
4910 for thislib in $libswanted; do
4911         for thisdir in $libspath; do
4912             xxx=''
4913             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4914                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4915                 $test -f "$xxx" && eval $libscheck
4916                 $test -f "$xxx" && libstyle=shared
4917             fi
4918             if test ! -f "$xxx"; then
4919                 xxx=$thisdir/lib$thislib.$so
4920                 $test -f "$xxx" && eval $libscheck
4921                 $test -f "$xxx" && libstyle=shared
4922             fi
4923             if test ! -f "$xxx"; then
4924                 xxx=$thisdir/lib$thislib$_a
4925                 $test -f "$xxx" && eval $libscheck
4926                 $test -f "$xxx" && libstyle=static
4927             fi
4928             if test ! -f "$xxx"; then
4929                 xxx=$thisdir/$thislib$_a
4930                 $test -f "$xxx" && eval $libscheck
4931                 $test -f "$xxx" && libstyle=static
4932             fi
4933             if test ! -f "$xxx"; then
4934                 xxx=$thisdir/lib${thislib}_s$_a
4935                 $test -f "$xxx" && eval $libscheck
4936                 $test -f "$xxx" && libstyle=static
4937                 $test -f "$xxx" && thislib=${thislib}_s
4938             fi
4939             if test ! -f "$xxx"; then
4940                 xxx=$thisdir/Slib$thislib$_a
4941                 $test -f "$xxx" && eval $libscheck
4942                 $test -f "$xxx" && libstyle=static
4943             fi
4944             if $test -f "$xxx"; then
4945                 case "$libstyle" in
4946                 shared) echo "Found -l$thislib (shared)." ;;
4947                 static) echo "Found -l$thislib." ;;
4948                 *)      echo "Found -l$thislib ($libstyle)." ;;
4949                 esac
4950                 case " $dflt " in
4951                 *"-l$thislib "*);;
4952                 *) dflt="$dflt -l$thislib"
4953                    libsfound="$libsfound $xxx"
4954                    yyy=`basename $xxx`
4955                    libsfiles="$libsfiles $yyy"
4956                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4957                    case " $libsdirs " in
4958                    *" $yyy "*) ;;
4959                    *) libsdirs="$libsdirs $yyy" ;;
4960                    esac
4961                    ;;
4962                 esac
4963                 break
4964             fi
4965         done
4966         if $test ! -f "$xxx"; then
4967             echo "No -l$thislib."
4968         fi
4969 done
4970 set X $dflt
4971 shift
4972 dflt="$*"
4973 case "$libs" in
4974 '') dflt="$dflt";;
4975 *) dflt="$libs";;
4976 esac
4977 case "$dflt" in
4978 ' '|'') dflt='none';;
4979 esac
4980
4981 $cat <<EOM
4982
4983 In order to compile $package on your machine, a number of libraries
4984 are usually needed.  Include any other special libraries here as well.
4985 Say "none" for none.  The default list is almost always right.
4986 EOM
4987
4988 echo " "
4989 rp="What libraries to use?"
4990 . ./myread
4991 case "$ans" in
4992 none) libs=' ';;
4993 *) libs="$ans";;
4994 esac
4995
4996 : determine optimization, if desired, or use for debug flag also
4997 case "$optimize" in
4998 ' '|$undef) dflt='none';;
4999 '') dflt='-O';;
5000 *) dflt="$optimize";;
5001 esac
5002 $cat <<EOH
5003
5004 By default, $package compiles with the -O flag to use the optimizer.
5005 Alternately, you might want to use the symbolic debugger, which uses
5006 the -g flag (on traditional Unix systems).  Either flag can be
5007 specified here.  To use neither flag, specify the word "none".
5008
5009 EOH
5010 rp="What optimizer/debugger flag should be used?"
5011 . ./myread
5012 optimize="$ans"
5013 case "$optimize" in
5014 'none') optimize=" ";;
5015 esac
5016
5017 : Check what DEBUGGING is required from the command line
5018 : -DEBUGGING      or -DDEBUGGING or
5019 : -DEBUGGING=both                       = -g + -DDEBUGGING
5020 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5021 : -DEBUGGING=none or -UDEBUGGING        =
5022 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5023 case "$EBUGGING" in
5024 '')     ;;
5025 *)      DEBUGGING=$EBUGGING ;;
5026 esac
5027
5028 case "$DEBUGGING" in
5029 -g|both|$define)
5030     case "$optimize" in
5031         *-g*) ;;
5032         *)    optimize="$optimize -g" ;;
5033     esac ;;
5034 none|$undef)
5035     case "$optimize" in
5036         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5037                 shift
5038                 optimize="$*"
5039                 ;;
5040     esac ;;
5041 esac
5042
5043 dflt=''
5044 case "$DEBUGGING" in
5045 both|$define) dflt='-DDEBUGGING'
5046 esac
5047
5048 : argument order is deliberate, as the flag will start with - which set could
5049 : think is an option
5050 checkccflag='check=$1; flag=$2; callback=$3;
5051 echo " ";
5052 echo "Checking if your compiler accepts $flag" 2>&1;
5053 echo "int main(void) { return 0; }" > gcctest.c;
5054 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5055     echo "Yes, it does." 2>&1;
5056     if $test -s gcctest.out ; then
5057         echo "But your platform does not like it:";
5058         cat gcctest.out;
5059     else
5060         case "$ccflags" in
5061         *$check*)
5062             echo "Leaving current flags $ccflags alone." 2>&1
5063             ;;
5064         *) dflt="$dflt $flag";
5065             eval $callback
5066             ;;
5067         esac
5068     fi
5069 else
5070     echo "Nope, it does not, but that is ok." 2>&1;
5071 fi
5072 '
5073
5074 : We will not override a previous value, but we might want to
5075 : augment a hint file
5076 case "$hint" in
5077 default|recommended)
5078         case "$gccversion" in
5079         1*) dflt="$dflt -fpcc-struct-return" ;;
5080         esac
5081         case "$optimize:$DEBUGGING" in
5082         *-g*:old) dflt="$dflt -DDEBUGGING";;
5083         esac
5084         case "$gccversion" in
5085         2*) if $test -d /etc/conf/kconfig.d &&
5086                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5087                 then
5088                         # Interactive Systems (ISC) POSIX mode.
5089                         dflt="$dflt -posix"
5090                 fi
5091                 ;;
5092         esac
5093         case "$gccversion" in
5094         1*) ;;
5095         2.[0-8]*) ;;
5096         ?*)     set strict-aliasing -fno-strict-aliasing
5097                 eval $checkccflag
5098                 ;;
5099         esac
5100         # For gcc, adding -pipe speeds up compilations for some, but apparently
5101         # some assemblers can't read from stdin.  (It also slows down compilations
5102         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5103         case "$gccversion" in
5104         ?*)     set pipe -pipe
5105                 eval $checkccflag
5106                 ;;
5107         esac
5108
5109         # on x86_64 (at least) we require an extra library (libssp) in the
5110         # link command line. This library is not named, so I infer that it is
5111         # an implementation detail that may change. Hence the safest approach
5112         # is to add the flag to the flags passed to the compiler at link time,
5113         # as that way the compiler can do the right implementation dependant
5114         # thing. (NWC)
5115         case "$gccversion" in
5116         ?*)     set stack-protector -fstack-protector
5117                 eval $checkccflag
5118                 ;;
5119         esac
5120         ;;
5121 esac
5122
5123 case "$mips_type" in
5124 *BSD*|'') inclwanted="$locincpth $usrinc";;
5125 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5126 esac
5127 for thisincl in $inclwanted; do
5128         if $test -d $thisincl; then
5129                 if $test x$thisincl != x$usrinc; then
5130                         case "$dflt" in
5131                         *" -I$thisincl "*);;
5132                         *) dflt="$dflt -I$thisincl ";;
5133                         esac
5134                 fi
5135         fi
5136 done
5137
5138 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5139         xxx=true;
5140 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5141         xxx=true;
5142 else
5143         xxx=false;
5144 fi;
5145 if $xxx; then
5146         case "$dflt" in
5147         *$2*);;
5148         *) dflt="$dflt -D$2";;
5149         esac;
5150 fi'
5151
5152 set signal.h LANGUAGE_C; eval $inctest
5153
5154 case "$usesocks" in
5155 $define)
5156         ccflags="$ccflags -DSOCKS"
5157         ;;
5158 esac
5159
5160 case "$hint" in
5161 default|recommended) dflt="$ccflags $dflt" ;;
5162 *) dflt="$ccflags";;
5163 esac
5164
5165 case "$dflt" in
5166 ''|' ') dflt=none;;
5167 esac
5168
5169 $cat <<EOH
5170
5171 Your C compiler may want other flags.  For this question you should include
5172 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5173 but you should NOT include libraries or ld flags like -lwhatever.  If you
5174 want $package to honor its debug switch, you should include -DDEBUGGING here.
5175 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5176
5177 To use no flags, specify the word "none".
5178
5179 EOH
5180 set X $dflt
5181 shift
5182 dflt=${1+"$@"}
5183 rp="Any additional cc flags?"
5184 . ./myread
5185 case "$ans" in
5186 none) ccflags='';;
5187 *) ccflags="$ans";;
5188 esac
5189
5190 : the following weeds options from ccflags that are of no interest to cpp
5191 case "$cppflags" in
5192 '') cppflags="$ccflags" ;;
5193 *)  cppflags="$cppflags $ccflags" ;;
5194 esac
5195 case "$gccversion" in
5196 1*) cppflags="$cppflags -D__GNUC__"
5197 esac
5198 case "$mips_type" in
5199 '');;
5200 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5201 esac
5202 case "$cppflags" in
5203 '');;
5204 *)
5205         echo " "
5206         echo "Let me guess what the preprocessor flags are..." >&4
5207         set X $cppflags
5208         shift
5209         cppflags=''
5210         $cat >cpp.c <<'EOM'
5211 #define BLURFL foo
5212
5213 BLURFL xx LFRULB
5214 EOM
5215         previous=''
5216         for flag in $*
5217         do
5218                 case "$flag" in
5219                 -*) ftry="$flag";;
5220                 *) ftry="$previous $flag";;
5221                 esac
5222                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5223                         >cpp1.out 2>/dev/null && \
5224                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5225                         >cpp2.out 2>/dev/null && \
5226                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5227                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5228                 then
5229                         cppflags="$cppflags $ftry"
5230                         previous=''
5231                 else
5232                         previous="$flag"
5233                 fi
5234         done
5235         set X $cppflags
5236         shift
5237         cppflags=${1+"$@"}
5238         case "$cppflags" in
5239         *-*)  echo "They appear to be: $cppflags";;
5240         esac
5241         $rm -f cpp.c cpp?.out
5242         ;;
5243 esac
5244
5245 : flags used in final linking phase
5246 case "$ldflags" in
5247 '') if ./venix; then
5248                 dflt='-i -z'
5249         else
5250                 dflt=''
5251         fi
5252         case "$ccflags" in
5253         *-posix*) dflt="$dflt -posix" ;;
5254         esac
5255         ;;
5256 *) dflt="$ldflags";;
5257 esac
5258 # See note above about -fstack-protector
5259 case "$ccflags" in
5260 *-fstack-protector*) 
5261         case "$dflt" in
5262         *-fstack-protector*) ;; # Don't add it again
5263         *) dflt="$dflt -fstack-protector" ;; 
5264         esac
5265         ;;
5266 esac
5267
5268 : Try to guess additional flags to pick up local libraries.
5269 for thislibdir in $libpth; do
5270         case " $loclibpth " in
5271         *" $thislibdir "*)
5272                 case "$dflt " in
5273                 *"-L$thislibdir "*) ;;
5274                 *)  dflt="$dflt -L$thislibdir" ;;
5275                 esac
5276                 ;;
5277         esac
5278 done
5279
5280 case "$dflt" in
5281 '') dflt='none' ;;
5282 esac
5283
5284 $cat <<EOH
5285
5286 Your C linker may need flags.  For this question you should
5287 include -L/whatever and any other flags used by the C linker, but you
5288 should NOT include libraries like -lwhatever.
5289
5290 Make sure you include the appropriate -L/path flags if your C linker
5291 does not normally search all of the directories you specified above,
5292 namely
5293         $libpth
5294 To use no flags, specify the word "none".
5295
5296 EOH
5297
5298 rp="Any additional ld flags (NOT including libraries)?"
5299 . ./myread
5300 case "$ans" in
5301 none) ldflags='';;
5302 *) ldflags="$ans";;
5303 esac
5304 rmlist="$rmlist pdp11"
5305
5306 : coherency check
5307 echo " "
5308 echo "Checking your choice of C compiler and flags for coherency..." >&4
5309 $cat > try.c <<'EOF'
5310 #include <stdio.h>
5311 int main() { printf("Ok\n"); return(0); }
5312 EOF
5313 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5314 shift
5315 $cat >try.msg <<'EOM'
5316 I've tried to compile and run the following simple program:
5317
5318 EOM
5319 $cat try.c >> try.msg
5320
5321 $cat >> try.msg <<EOM
5322
5323 I used the command:
5324
5325         $*
5326         $run ./try
5327
5328 and I got the following output:
5329
5330 EOM
5331 dflt=y
5332 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5333         if $sh -c "$run ./try " >>try.msg 2>&1; then
5334                 xxx=`$run ./try`
5335                 case "$xxx" in
5336                 "Ok") dflt=n ;;
5337                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5338                         case " $libs " in
5339                         *" -lsfio "*)
5340                                 cat >> try.msg <<'EOQS'
5341 If $libs contains -lsfio, and sfio is mis-configured, then it
5342 sometimes (apparently) runs and exits with a 0 status, but with no
5343 output!  It may have to do with sfio's use of _exit vs. exit.
5344
5345 EOQS
5346                                 rp="You have a big problem.  Shall I abort Configure"
5347                                 dflt=y
5348                                 ;;
5349                         esac
5350                         ;;
5351                 esac
5352         else
5353                 echo "The program compiled OK, but exited with status $?." >>try.msg
5354                 rp="You have a problem.  Shall I abort Configure"
5355                 dflt=y
5356         fi
5357 else
5358         echo "I can't compile the test program." >>try.msg
5359         rp="You have a BIG problem.  Shall I abort Configure"
5360         dflt=y
5361 fi
5362 case "$dflt" in
5363 y)
5364         $cat try.msg >&4
5365         case "$knowitall" in
5366         '')
5367                 echo "(The supplied flags or libraries might be incorrect.)"
5368                 ;;
5369         *) dflt=n;;
5370         esac
5371         echo " "
5372         . ./myread
5373         case "$ans" in
5374         n*|N*) ;;
5375         *)      echo "Ok.  Stopping Configure." >&4
5376                 exit 1
5377                 ;;
5378         esac
5379         ;;
5380 n) echo "OK, that should do.";;
5381 esac
5382 $rm_try gcctest gcctest.out
5383
5384 : define a shorthand compile call
5385 compile='
5386 mc_file=$1;
5387 shift;
5388 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5389 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5390 exit 1;
5391 fi;
5392 esac;
5393 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5394 : define a shorthand compile call for compilations that should be ok.
5395 compile_ok='
5396 mc_file=$1;
5397 shift;
5398 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5399
5400 : determine filename position in cpp output
5401 echo " "
5402 echo "Computing filename position in cpp output for #include directives..." >&4
5403 case "$osname" in
5404 vos) testaccess=-e ;;
5405 *)   testaccess=-r ;;
5406 esac
5407 echo '#include <stdio.h>' > foo.c
5408 $cat >fieldn <<EOF
5409 $startsh
5410 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5411 $grep '^[       ]*#.*stdio\.h' | \
5412 while read cline; do
5413         pos=1
5414         set \$cline
5415         while $test \$# -gt 0; do
5416                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5417                         echo "\$pos"
5418                         exit 0
5419                 fi
5420                 shift
5421                 pos=\`expr \$pos + 1\`
5422         done
5423 done
5424 EOF
5425 chmod +x fieldn
5426 fieldn=`./fieldn`
5427 $rm -f foo.c fieldn
5428 case $fieldn in
5429 '') pos='???';;
5430 1) pos=first;;
5431 2) pos=second;;
5432 3) pos=third;;
5433 *) pos="${fieldn}th";;
5434 esac
5435 echo "Your cpp writes the filename in the $pos field of the line."
5436
5437 case "$osname" in
5438 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5439 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5440 *)   cppfilter='' ;;
5441 esac
5442 : locate header file
5443 $cat >findhdr <<EOF
5444 $startsh
5445 wanted=\$1
5446 name=''
5447 for usrincdir in $usrinc
5448 do
5449         if test -f \$usrincdir/\$wanted; then
5450                 echo "\$usrincdir/\$wanted"
5451                 exit 0
5452         fi
5453 done
5454 awkprg='{ print \$$fieldn }'
5455 echo "#include <\$wanted>" > foo\$\$.c
5456 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5457 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5458 while read cline; do
5459         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5460         case "\$name" in
5461         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5462         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5463         *) exit 2;;
5464         esac;
5465 done;
5466 #
5467 # status = 0: grep returned 0 lines, case statement not executed
5468 # status = 1: headerfile found
5469 # status = 2: while loop executed, no headerfile found
5470 #
5471 status=\$?
5472 $rm -f foo\$\$.c;
5473 if test \$status -eq 1; then
5474         exit 0;
5475 fi
5476 exit 1
5477 EOF
5478 chmod +x findhdr
5479
5480 : define an alternate in-header-list? function
5481 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5482 cont=true; xxf="echo \"<\$1> found.\" >&4";
5483 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5484 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5485 esac;
5486 case $# in 4) instead=instead;; *) instead="at last";; esac;
5487 while $test "$cont"; do
5488         xxx=`./findhdr $1`
5489         var=$2; eval "was=\$$2";
5490         if $test "$xxx" && $test -r "$xxx";
5491         then eval $xxf;
5492         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5493                 cont="";
5494         else eval $xxnf;
5495         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5496         set $yyy; shift; shift; yyy=$@;
5497         case $# in 0) cont="";;
5498         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5499                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5500         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5501                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5502         esac;
5503 done;
5504 while $test "$yyy";
5505 do set $yyy; var=$2; eval "was=\$$2";
5506         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5507         set $yyy; shift; shift; yyy=$@;
5508 done'
5509
5510 : see if stdlib is available
5511 set stdlib.h i_stdlib
5512 eval $inhdr
5513
5514 : check for lengths of integral types
5515 echo " "
5516 case "$intsize" in
5517 '')
5518         echo "Checking to see how big your integers are..." >&4
5519         $cat >try.c <<EOCP
5520 #include <stdio.h>
5521 #$i_stdlib I_STDLIB
5522 #ifdef I_STDLIB
5523 #include <stdlib.h>
5524 #endif
5525 int main()
5526 {
5527         printf("intsize=%d;\n", (int)sizeof(int));
5528         printf("longsize=%d;\n", (int)sizeof(long));
5529         printf("shortsize=%d;\n", (int)sizeof(short));
5530         exit(0);
5531 }
5532 EOCP
5533         set try
5534         if eval $compile_ok && $run ./try > /dev/null; then
5535                 eval `$run ./try`
5536                 echo "Your integers are $intsize bytes long."
5537                 echo "Your long integers are $longsize bytes long."
5538                 echo "Your short integers are $shortsize bytes long."
5539         else
5540                 $cat >&4 <<EOM
5541 !
5542 Help! I can't compile and run the intsize test program: please enlighten me!
5543 (This is probably a misconfiguration in your system or libraries, and
5544 you really ought to fix it.  Still, I'll try anyway.)
5545 !
5546 EOM
5547                 dflt=4
5548                 rp="What is the size of an integer (in bytes)?"
5549                 . ./myread
5550                 intsize="$ans"
5551                 dflt=$intsize
5552                 rp="What is the size of a long integer (in bytes)?"
5553                 . ./myread
5554                 longsize="$ans"
5555                 dflt=2
5556                 rp="What is the size of a short integer (in bytes)?"
5557                 . ./myread
5558                 shortsize="$ans"
5559         fi
5560         ;;
5561 esac
5562 $rm_try
5563
5564 : check for long long
5565 echo " "
5566 echo "Checking to see if you have long long..." >&4
5567 echo 'int main() { long long x = 7; return 0; }' > try.c
5568 set try
5569 if eval $compile; then
5570         val="$define"
5571         echo "You have long long."
5572 else
5573         val="$undef"
5574         echo "You do not have long long."
5575 fi
5576 $rm_try
5577 set d_longlong
5578 eval $setvar
5579
5580 : check for length of long long
5581 case "${d_longlong}${longlongsize}" in
5582 $define)
5583         echo " "
5584         echo "Checking to see how big your long longs are..." >&4
5585         $cat >try.c <<'EOCP'
5586 #include <stdio.h>
5587 int main()
5588 {
5589     printf("%d\n", (int)sizeof(long long));
5590     return(0);
5591 }
5592 EOCP
5593         set try
5594         if eval $compile_ok; then
5595                 longlongsize=`$run ./try`
5596                 echo "Your long longs are $longlongsize bytes long."
5597         else
5598                 dflt='8'
5599                 echo " "
5600                 echo "(I can't seem to compile the test program.  Guessing...)"
5601                 rp="What is the size of a long long (in bytes)?"
5602                 . ./myread
5603                 longlongsize="$ans"
5604         fi
5605         if $test "X$longsize" = "X$longlongsize"; then
5606                 echo "(That isn't any different from an ordinary long.)"
5607         fi
5608         ;;
5609 esac
5610 $rm_try
5611
5612 : see if inttypes.h is available
5613 : we want a real compile instead of Inhdr because some systems
5614 : have an inttypes.h which includes non-existent headers
5615 echo " "
5616 $cat >try.c <<EOCP
5617 #include <inttypes.h>
5618 int main() {
5619         static int32_t foo32 = 0x12345678;
5620 }
5621 EOCP
5622 set try
5623 if eval $compile; then
5624         echo "<inttypes.h> found." >&4
5625         val="$define"
5626 else
5627         echo "<inttypes.h> NOT found." >&4
5628         val="$undef"
5629 fi
5630 $rm_try
5631 set i_inttypes
5632 eval $setvar
5633
5634 : check for int64_t
5635 echo " "
5636 echo "Checking to see if you have int64_t..." >&4
5637 $cat >try.c <<EOCP
5638 #include <sys/types.h>
5639 #$i_inttypes I_INTTYPES
5640 #ifdef I_INTTYPES
5641 #include <inttypes.h>
5642 #endif
5643 int main() { int64_t x = 7; }
5644 EOCP
5645 set try
5646 if eval $compile; then
5647         val="$define"
5648         echo "You have int64_t."
5649 else
5650         val="$undef"
5651         echo "You do not have int64_t."
5652 fi
5653 $rm_try
5654 set d_int64_t
5655 eval $setvar
5656
5657 : Check if 64bit ints have a quad type
5658 echo " "
5659 echo "Checking which 64-bit integer type we could use..." >&4
5660
5661 case "$intsize" in
5662 8) val=int
5663    set quadtype
5664    eval $setvar
5665    val='"unsigned int"'
5666    set uquadtype
5667    eval $setvar
5668    quadkind=1
5669    ;;
5670 *) case "$longsize" in
5671    8) val=long
5672       set quadtype
5673       eval $setvar
5674       val='"unsigned long"'
5675       set uquadtype
5676       eval $setvar
5677       quadkind=2
5678       ;;
5679    *) case "$d_longlong:$longlongsize" in
5680       define:8)
5681         val='"long long"'
5682         set quadtype
5683         eval $setvar
5684         val='"unsigned long long"'
5685         set uquadtype
5686         eval $setvar
5687         quadkind=3
5688         ;;
5689       *) case "$d_int64_t" in
5690          define)
5691            val=int64_t
5692            set quadtype
5693            eval $setvar
5694            val=uint64_t
5695            set uquadtype
5696            eval $setvar
5697            quadkind=4
5698            ;;
5699          esac
5700          ;;
5701       esac
5702       ;;
5703    esac
5704    ;;
5705 esac
5706
5707 case "$quadtype" in
5708 '')     echo "Alas, no 64-bit integer types in sight." >&4
5709         d_quad="$undef"
5710         ;;
5711 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5712         d_quad="$define"
5713         ;;
5714 esac
5715
5716 : Do we want 64bit support
5717 case "$uselonglong" in
5718 "$define"|true|[yY]*)
5719         cat <<EOM >&4
5720
5721 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5722 EOM
5723         use64bitint="$define"
5724         ;;
5725 esac
5726 case "$use64bits" in
5727 "$define"|true|[yY]*)
5728         cat <<EOM >&4
5729
5730 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5731 EOM
5732         use64bitint="$define"
5733         ;;
5734 esac
5735 case "$use64bitints" in
5736 "$define"|true|[yY]*)
5737         cat <<EOM >&4
5738
5739 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5740 EOM
5741         use64bitint="$define"
5742         ;;
5743 esac
5744 case "$use64bitsint" in
5745 "$define"|true|[yY]*)
5746         cat <<EOM >&4
5747
5748 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5749 EOM
5750         use64bitint="$define"
5751         ;;
5752 esac
5753 case "$uselonglongs" in
5754 "$define"|true|[yY]*)
5755         cat <<EOM >&4
5756
5757 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5758 EOM
5759         use64bitint="$define"
5760         ;;
5761 esac
5762 case "$use64bitsall" in
5763 "$define"|true|[yY]*)
5764         cat <<EOM >&4
5765
5766 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5767 EOM
5768         use64bitall="$define"
5769         ;;
5770 esac
5771
5772 case "$ccflags" in
5773 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5774 esac
5775 case "$use64bitall" in
5776 "$define"|true|[yY]*) use64bitint="$define" ;;
5777 esac
5778
5779 case "$longsize" in
5780 8) cat <<EOM
5781
5782 You have natively 64-bit long integers.
5783 EOM
5784    val="$define"
5785    ;;
5786 *) case "$use64bitint" in
5787    "$define"|true|[yY]*) dflt='y';;
5788    *) dflt='n';;
5789    esac
5790    case "$d_quad" in
5791    "$define") ;;
5792    *) dflt='n' ;;
5793    esac
5794    cat <<EOM
5795
5796 Perl can be built to take advantage of 64-bit integer types
5797 on some systems.  To do so, Configure can be run with -Duse64bitint.
5798 Choosing this option will most probably introduce binary incompatibilities.
5799
5800 If this doesn't make any sense to you, just accept the default '$dflt'.
5801 (The default has been chosen based on your configuration.)
5802 EOM
5803    rp='Try to use 64-bit integers, if available?'
5804    . ./myread
5805    case "$ans" in
5806    [yY]*) val="$define" ;;
5807    *)     val="$undef"  ;;
5808    esac
5809    ;;
5810 esac
5811 set use64bitint
5812 eval $setvar
5813
5814 case "$use64bitall" in
5815 "$define"|true|[yY]*) dflt='y' ;;
5816 *) case "$longsize" in
5817    8) dflt='y' ;;
5818    *) dflt='n' ;;
5819    esac
5820    ;;
5821 esac
5822 cat <<EOM
5823
5824 You may also choose to try maximal 64-bitness.  It means using as much
5825 64-bitness as possible on the platform.  This in turn means even more
5826 binary incompatibilities.  On the other hand, your platform may not
5827 have any more 64-bitness available than what you already have chosen.
5828
5829 If this doesn't make any sense to you, just accept the default '$dflt'.
5830 (The default has been chosen based on your configuration.)
5831 EOM
5832 rp='Try to use maximal 64-bit support, if available?'
5833 . ./myread
5834 case "$ans" in
5835 [yY]*) val="$define" ;;
5836 *)     val="$undef"  ;;
5837 esac
5838 set use64bitall
5839 eval $setvar
5840 case "$use64bitall" in
5841 "$define")
5842         case "$use64bitint" in
5843         "$undef")
5844                 cat <<EOM
5845
5846 Since you have chosen a maximally 64-bit build, I'm also turning on
5847 the use of 64-bit integers.
5848 EOM
5849                 use64bitint="$define" ;;
5850         esac
5851         ;;
5852 esac
5853
5854 : Look for a hint-file generated 'call-back-unit'.  If the
5855 : user has specified that a 64-bit perl is to be built,
5856 : we may need to set or change some other defaults.
5857 if $test -f use64bitint.cbu; then
5858         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5859         . ./use64bitint.cbu
5860 fi
5861 case "$use64bitint" in
5862 "$define"|true|[yY]*)
5863         case "$longsize" in
5864         4) case "$archname64" in
5865            '') archname64=64int ;;
5866            esac
5867            ;;
5868         esac
5869         ;;
5870 esac
5871
5872 : Look for a hint-file generated 'call-back-unit'.  If the
5873 : user has specified that a maximally 64-bit perl is to be built,
5874 : we may need to set or change some other defaults.
5875 if $test -f use64bitall.cbu; then
5876         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5877         . ./use64bitall.cbu
5878 fi
5879 case "$use64bitall" in
5880 "$define"|true|[yY]*)
5881         case "$longsize" in
5882         4) case "$archname64" in
5883            ''|64int) archname64=64all ;;
5884            esac
5885            ;;
5886         esac
5887         ;;
5888 esac
5889
5890 case "$d_quad:$use64bitint" in
5891 $undef:$define)
5892         cat >&4 <<EOF
5893
5894 *** You have chosen to use 64-bit integers,
5895 *** but none can be found.
5896 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5897 *** Cannot continue, aborting.
5898
5899 EOF
5900         exit 1
5901         ;;
5902 esac
5903
5904 : check for length of double
5905 echo " "
5906 case "$doublesize" in
5907 '')
5908         echo "Checking to see how big your double precision numbers are..." >&4
5909         $cat >try.c <<EOCP
5910 #include <stdio.h>
5911 #$i_stdlib I_STDLIB
5912 #ifdef I_STDLIB
5913 #include <stdlib.h>
5914 #endif
5915 int main()
5916 {
5917     printf("%d\n", (int)sizeof(double));
5918     exit(0);
5919 }
5920 EOCP
5921         set try
5922         if eval $compile_ok; then
5923                 doublesize=`$run ./try`
5924                 echo "Your double is $doublesize bytes long."
5925         else
5926                 dflt='8'
5927                 echo "(I can't seem to compile the test program.  Guessing...)"
5928                 rp="What is the size of a double precision number (in bytes)?"
5929                 . ./myread
5930                 doublesize="$ans"
5931         fi
5932         ;;
5933 esac
5934 $rm_try
5935
5936 : check for long doubles
5937 echo " "
5938 echo "Checking to see if you have long double..." >&4
5939 echo 'int main() { long double x = 7.0; }' > try.c
5940 set try
5941 if eval $compile; then
5942         val="$define"
5943         echo "You have long double."
5944 else
5945         val="$undef"
5946         echo "You do not have long double."
5947 fi
5948 $rm_try
5949 set d_longdbl
5950 eval $setvar
5951
5952 : check for length of long double
5953 case "${d_longdbl}${longdblsize}" in
5954 $define)
5955         echo " "
5956         echo "Checking to see how big your long doubles are..." >&4
5957         $cat >try.c <<'EOCP'
5958 #include <stdio.h>
5959 int main()
5960 {
5961         printf("%d\n", sizeof(long double));
5962 }
5963 EOCP
5964         set try
5965         set try
5966         if eval $compile; then
5967                 longdblsize=`$run ./try`
5968                 echo "Your long doubles are $longdblsize bytes long."
5969         else
5970                 dflt='8'
5971                 echo " "
5972                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5973                 rp="What is the size of a long double (in bytes)?"
5974                 . ./myread
5975                 longdblsize="$ans"
5976         fi
5977         if $test "X$doublesize" = "X$longdblsize"; then
5978                 echo "That isn't any different from an ordinary double."
5979                 echo "I'll keep your setting anyway, but you may see some"
5980                 echo "harmless compilation warnings."
5981         fi
5982         ;;
5983 esac
5984 $rm_try
5985
5986 : determine the architecture name
5987 echo " "
5988 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5989         tarch=`arch`"-$osname"
5990 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5991         if uname -m > tmparch 2>&1 ; then
5992                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5993                         -e 's/$/'"-$osname/" tmparch`
5994         else
5995                 tarch="$osname"
5996         fi
5997         $rm -f tmparch
5998 else
5999         tarch="$osname"
6000 fi
6001 case "$myarchname" in
6002 ''|"$tarch") ;;
6003 *)
6004         echo "(Your architecture name used to be $myarchname.)"
6005         archname=''
6006         ;;
6007 esac
6008 case "$targetarch" in
6009 '') ;;
6010 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6011 esac
6012 myarchname="$tarch"
6013 case "$archname" in
6014 '') dflt="$tarch";;
6015 *) dflt="$archname";;
6016 esac
6017 rp='What is your architecture name'
6018 . ./myread
6019 archname="$ans"
6020 case "$usethreads" in
6021 $define)
6022         echo "Threads selected." >&4
6023         case "$archname" in
6024         *-thread*) echo "...and architecture name already has -thread." >&4
6025                 ;;
6026         *)      archname="$archname-thread"
6027                 echo "...setting architecture name to $archname." >&4
6028                 ;;
6029         esac
6030         ;;
6031 esac
6032 case "$usemultiplicity" in
6033 $define)
6034         echo "Multiplicity selected." >&4
6035         case "$archname" in
6036         *-multi*) echo "...and architecture name already has -multi." >&4
6037                 ;;
6038         *)      archname="$archname-multi"
6039                 echo "...setting architecture name to $archname." >&4
6040                 ;;
6041         esac
6042         ;;
6043 esac
6044 case "$use64bitint$use64bitall" in
6045 *"$define"*)
6046         case "$archname64" in
6047         '')
6048                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6049                 ;;
6050         *)
6051                 case "$use64bitint" in
6052                 "$define") echo "64 bit integers selected." >&4 ;;
6053                 esac
6054                 case "$use64bitall" in
6055                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6056                 esac
6057                 case "$archname" in
6058                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6059                         ;;
6060                 *)      archname="$archname-$archname64"
6061                         echo "...setting architecture name to $archname." >&4
6062                         ;;
6063                 esac
6064                 ;;
6065         esac
6066 esac
6067 case "$uselongdouble" in
6068 $define)
6069         echo "Long doubles selected." >&4
6070         case "$longdblsize" in
6071         $doublesize)
6072                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6073                 ;;
6074         *)
6075                 case "$archname" in
6076                 *-ld*) echo "...and architecture name already has -ld." >&4
6077                         ;;
6078                 *)      archname="$archname-ld"
6079                         echo "...setting architecture name to $archname." >&4
6080                         ;;
6081                 esac
6082                 ;;
6083         esac
6084         ;;
6085 esac
6086 if $test -f archname.cbu; then
6087         echo "Your platform has some specific hints for architecture name, using them..."
6088         . ./archname.cbu
6089 fi
6090
6091 : set the prefixit variable, to compute a suitable default value
6092 prefixit='case "$3" in
6093 ""|none)
6094         case "$oldprefix" in
6095         "") eval "$1=\"\$$2\"";;
6096         *)
6097                 case "$3" in
6098                 "") eval "$1=";;
6099                 none)
6100                         eval "tp=\"\$$2\"";
6101                         case "$tp" in
6102                         ""|" ") eval "$1=\"\$$2\"";;
6103                         *) eval "$1=";;
6104                         esac;;
6105                 esac;;
6106         esac;;
6107 *)
6108         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6109         case "$tp" in
6110         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6111         /*-$oldprefix/*|\~*-$oldprefix/*)
6112                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6113         *) eval "$1=\"\$$2\"";;
6114         esac;;
6115 esac'
6116
6117 : determine installation style
6118 : For now, try to deduce it from prefix unless it is already set.
6119 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6120 case "$installstyle" in
6121 '')     case "$prefix" in
6122                 *perl*) dflt='lib';;
6123                 *) dflt='lib/perl5' ;;
6124         esac
6125         ;;
6126 *)      dflt="$installstyle" ;;
6127 esac
6128 : Probably not worth prompting for this since we prompt for all
6129 : the directories individually, and the prompt would be too long and
6130 : confusing anyway.
6131 installstyle=$dflt
6132
6133 : determine where public executables go
6134 echo " "
6135 set dflt bin bin
6136 eval $prefixit
6137 fn=d~
6138 rp='Pathname where the public executables will reside?'
6139 . ./getfile
6140 if $test "X$ansexp" != "X$binexp"; then
6141         installbin=''
6142 fi
6143 prefixvar=bin
6144 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6145 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6146 :     this via initialinstalllocation
6147 . ./setprefixvar
6148
6149 case "$userelocatableinc" in
6150 $define|true|[yY]*)     dflt='y' ;;
6151 *)                      dflt='n' ;;
6152 esac
6153 cat <<EOM
6154
6155 Would you like to build Perl so that the installation is relocatable, so that
6156 library paths in @INC are determined relative to the path of the perl binary?
6157 This is not advised for system Perl installs, or if you need to run setid
6158 scripts or scripts under taint mode.
6159
6160 If this doesn't make any sense to you, just accept the default '$dflt'.
6161 EOM
6162 rp='Use relocatable @INC?'
6163 . ./myread
6164 case "$ans" in
6165 y|Y)    val="$define" ;;
6166 *)      val="$undef"  ;;
6167 esac
6168 set userelocatableinc
6169 eval $setvar
6170
6171 initialinstalllocation="$binexp"
6172 : Default prefix is now "up one level from where the binaries are"
6173 case "$userelocatableinc" in
6174 $define|true|[yY]*)
6175     bin=".../"
6176     binexp=".../"
6177     prefix=".../.."
6178     prefixexp=".../.."
6179     installprefixexp=".../.."
6180     ;;
6181 esac
6182
6183 : determine where private library files go
6184 : Usual default is /usr/local/lib/perl5/$version.
6185 : Also allow things like /opt/perl/lib/$version, since
6186 : /opt/perl/lib/perl5... would be redundant.
6187 : The default "style" setting is made in installstyle.U
6188 case "$installstyle" in
6189 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6190 *)       set dflt privlib lib/$version ;;
6191 esac
6192 eval $prefixit
6193 $cat <<EOM
6194
6195 There are some auxiliary files for $package that need to be put into a
6196 private library directory that is accessible by everyone.
6197
6198 EOM
6199 fn=$binexp
6200 fn=d~+
6201 rp='Pathname where the private library files will reside?'
6202 . ./getfile
6203 prefixvar=privlib
6204 . ./setprefixvar
6205
6206 : set the prefixup variable, to restore leading tilda escape
6207 prefixup='case "$prefixexp" in
6208 "$prefix") ;;
6209 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6210 esac'
6211
6212 : determine where public architecture dependent libraries go
6213 set archlib archlib
6214 eval $prefixit
6215 : privlib default is /usr/local/lib/$package/$version
6216 : archlib default is /usr/local/lib/$package/$version/$archname
6217 : privlib may have an optional trailing /share.
6218 tdflt=`echo $privlib | $sed 's,/share$,,'`
6219 tdflt=$tdflt/$archname
6220 case "$archlib" in
6221 '')     dflt=$tdflt
6222         ;;
6223 *)      dflt="$archlib"
6224     ;;
6225 esac
6226 $cat <<EOM
6227
6228 $spackage contains architecture-dependent library files.  If you are
6229 sharing libraries in a heterogeneous environment, you might store
6230 these files in a separate location.  Otherwise, you can just include
6231 them with the rest of the public library files.
6232
6233 EOM
6234 fn=$binexp
6235 fn=d+~
6236 rp='Where do you want to put the public architecture-dependent libraries?'
6237 . ./getfile
6238 prefixvar=archlib
6239 . ./setprefixvar
6240 if $test X"$archlib" = X"$privlib"; then
6241         d_archlib="$undef"
6242 else
6243         d_archlib="$define"
6244 fi
6245
6246 : see if setuid scripts can be secure
6247 $cat <<EOM
6248
6249 Some kernels have a bug that prevents setuid #! scripts from being
6250 secure.  Some sites have disabled setuid #! scripts because of this.
6251
6252 First let's decide if your kernel supports secure setuid #! scripts.
6253 (If setuid #! scripts would be secure but have been disabled anyway,
6254 don't say that they are secure if asked.)
6255
6256 EOM
6257
6258 val="$undef"
6259 if $test -d /dev/fd; then
6260         echo "#!$ls" >reflect
6261         chmod +x,u+s reflect
6262         ./reflect >flect 2>&1
6263         if $contains "/dev/fd" flect >/dev/null; then
6264                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6265                 val="$define"
6266         else
6267                 $cat <<EOM
6268 If you are not sure if they are secure, I can check but I'll need a
6269 username and password different from the one you are using right now.
6270 If you don't have such a username or don't want me to test, simply
6271 enter 'none'.
6272
6273 EOM
6274                 rp='Other username to test security of setuid scripts with?'
6275                 dflt='none'
6276                 . ./myread
6277                 case "$ans" in
6278                 n|none)
6279                         case "$d_suidsafe" in
6280                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6281                                 dflt=n;;
6282                         "$undef")
6283                                 echo "Well, the $hint value is *not* secure." >&4
6284                                 dflt=n;;
6285                         *)      echo "Well, the $hint value *is* secure." >&4
6286                                 dflt=y;;
6287                         esac
6288                         ;;
6289                 *)
6290                         $rm -f reflect flect
6291                         echo "#!$ls" >reflect
6292                         chmod +x,u+s reflect
6293                         echo >flect
6294                         chmod a+w flect
6295                         echo '"su" will (probably) prompt you for '"$ans's password."
6296                         su $ans -c './reflect >flect'
6297                         if $contains "/dev/fd" flect >/dev/null; then
6298                                 echo "Okay, it looks like setuid scripts are secure." >&4
6299                                 dflt=y
6300                         else
6301                                 echo "I don't think setuid scripts are secure." >&4
6302                                 dflt=n
6303                         fi
6304                         ;;
6305                 esac
6306                 rp='Does your kernel have *secure* setuid scripts?'
6307                 . ./myread
6308                 case "$ans" in
6309                 [yY]*)  val="$define";;
6310                 *)      val="$undef";;
6311                 esac
6312         fi
6313 else
6314         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6315         echo "(That's for file descriptors, not floppy disks.)"
6316         val="$undef"
6317 fi
6318 set d_suidsafe
6319 eval $setvar
6320
6321 $rm -f reflect flect
6322
6323 : now see if they want to do setuid emulation
6324 if $test $patchlevel -lt 11; then
6325 echo " "
6326 val="$undef"
6327 case "$d_suidsafe" in
6328 "$define")
6329         val="$undef"
6330         echo "No need to emulate SUID scripts since they are secure here." >&4
6331         ;;
6332 *)
6333         $cat <<EOM
6334 Some systems have disabled setuid scripts, especially systems where
6335 setuid scripts cannot be secure.  On systems where setuid scripts have
6336 been disabled, the setuid/setgid bits on scripts are currently
6337 useless.  It is possible for $package to detect those bits and emulate
6338 setuid/setgid in a secure fashion.  This emulation will only work if
6339 setuid scripts have been disabled in your kernel.
6340
6341 EOM
6342         case "$d_dosuid" in
6343         "$define") dflt=y ;;
6344         *) dflt=n ;;
6345         esac
6346         rp="Do you want to do setuid/setgid emulation?"
6347         . ./myread
6348         case "$ans" in
6349         [yY]*)  val="$define";;
6350         *)      val="$undef";;
6351         esac
6352         ;;
6353 esac
6354 set d_dosuid
6355 eval $setvar
6356 else
6357     case "$d_dosuid" in
6358         "$define")
6359         cat >&4 <<EOH
6360
6361 SUID emulation has been removed for 5.12
6362 Please re-run Configure without -Dd_dosuid
6363
6364 EOH
6365         exit 1;
6366         ;;
6367     esac
6368     d_dosuid=undef
6369 fi
6370
6371 : Find perl5.005 or later.
6372 echo "Looking for a previously installed perl5.005 or later... "
6373 case "$perl5" in
6374 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6375                 : Check if this perl is recent and can load a simple module
6376                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6377                         perl5=$tdir/perl
6378                         break;
6379                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6380                         perl5=$tdir/perl5
6381                         break;
6382                 fi
6383         done
6384         ;;
6385 *)      perl5="$perl5"
6386         ;;
6387 esac
6388 case "$perl5" in
6389 '')     echo "None found.  That's ok.";;
6390 *)      echo "Using $perl5." ;;
6391 esac
6392
6393 : Set the siteprefix variables
6394 $cat <<EOM
6395
6396 After $package is installed, you may wish to install various
6397 add-on modules and utilities.  Typically, these add-ons will
6398 be installed under $prefix with the rest
6399 of this package.  However, you may wish to install such add-ons
6400 elsewhere under a different prefix.
6401
6402 If you do not wish to put everything under a single prefix, that's
6403 ok.  You will be prompted for the individual locations; this siteprefix
6404 is only used to suggest the defaults.
6405
6406 The default should be fine for most people.
6407
6408 EOM
6409 fn=d~+
6410 rp='Installation prefix to use for add-on modules and utilities?'
6411 : XXX Here might be another good place for an installstyle setting.
6412 case "$siteprefix" in
6413 '') dflt=$prefix ;;
6414 *)  dflt=$siteprefix ;;
6415 esac
6416 . ./getfile
6417 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6418 oldsiteprefix=''
6419 case "$siteprefix" in
6420 '') ;;
6421 *)      case "$ans" in
6422         "$prefix") ;;
6423         *) oldsiteprefix="$prefix";;
6424         esac
6425         ;;
6426 esac
6427 siteprefix="$ans"
6428 siteprefixexp="$ansexp"
6429
6430 : determine where site specific libraries go.
6431 : Usual default is /usr/local/lib/perl5/site_perl/$version
6432 : The default "style" setting is made in installstyle.U
6433 : XXX No longer works with Prefixit stuff.
6434 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6435 case "$sitelib" in
6436 '') case "$installstyle" in
6437         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6438         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6439         esac
6440         ;;
6441 *)      dflt="$sitelib"
6442         ;;
6443 esac
6444 $cat <<EOM
6445
6446 The installation process will create a directory for
6447 site-specific extensions and modules.  Most users find it convenient
6448 to place all site-specific files in this directory rather than in the
6449 main distribution directory.
6450
6451 EOM
6452 fn=d~+
6453 rp='Pathname for the site-specific library files?'
6454 . ./getfile
6455 prefixvar=sitelib
6456 . ./setprefixvar
6457 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6458
6459 : Determine list of previous versions to include in @INC
6460 $cat > getverlist <<EOPL
6461 #!$perl5 -w
6462 use File::Basename;
6463 \$api_versionstring = "$api_versionstring";
6464 \$version = "$version";
6465 \$stem = "$sitelib_stem";
6466 \$archname = "$archname";
6467 EOPL
6468         $cat >> getverlist <<'EOPL'
6469 # The list found is store twice for each entry: the original name, and
6470 # the binary broken down version as pack "sss", so sorting is easy and
6471 # unambiguous. This will work for all versions that have a maximum of
6472 # three digit groups, separate by '.'s or '_'s. Names are extended with
6473 # ".0.0" to ensure at least three elements for the pack.
6474 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6475
6476 # Can't have leading @ because metaconfig interprets it as a command!
6477 ;@inc_version_list=();
6478 # XXX Redo to do opendir/readdir?
6479 if (-d $stem) {
6480     chdir($stem);
6481     ;@candidates = map {
6482         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6483     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6484 }
6485 else {
6486     ;@candidates = ();
6487 }
6488
6489 ($pversion, $aversion, $vsn5005) = map {
6490     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6491 foreach $d (@candidates) {
6492     if ($d->[1] lt $pversion) {
6493         if ($d->[1] ge $aversion) {
6494             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6495         }
6496         elsif ($d->[1] ge $vsn5005) {
6497             unshift(@inc_version_list, grep { -d } $d->[0]);
6498         }
6499     }
6500     else {
6501         # Skip newer version.  I.e. don't look in
6502         # 5.7.0 if we're installing 5.6.1.
6503     }
6504 }
6505
6506 if (@inc_version_list) {
6507     print join(' ', @inc_version_list);
6508 }
6509 else {
6510     # Blank space to preserve value for next Configure run.
6511     print " ";
6512 }
6513 EOPL
6514 chmod +x getverlist
6515 case "$inc_version_list" in
6516 '')     if test -x "$perl5$exe_ext"; then
6517                 dflt=`$perl5 getverlist`
6518         else
6519                 dflt='none'
6520         fi
6521         ;;
6522 $undef) dflt='none' ;;
6523 *)  eval dflt=\"$inc_version_list\" ;;
6524 esac
6525 case "$dflt" in
6526 ''|' ') dflt=none ;;
6527 esac
6528 case "$dflt" in
6529 5.005) dflt=none ;;
6530 esac
6531 $cat <<EOM
6532
6533 In order to ease the process of upgrading, this version of perl
6534 can be configured to use modules built and installed with earlier
6535 versions of perl that were installed under $prefix.  Specify here
6536 the list of earlier versions that this version of perl should check.
6537 If Configure detected no earlier versions of perl installed under
6538 $prefix, then the list will be empty.  Answer 'none' to tell perl
6539 to not search earlier versions.
6540
6541 The default should almost always be sensible, so if you're not sure,
6542 just accept the default.
6543 EOM
6544
6545 rp='List of earlier versions to include in @INC?'
6546 . ./myread
6547 case "$ans" in
6548 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6549 *) inc_version_list="$ans" ;;
6550 esac
6551 case "$inc_version_list" in
6552 ''|' ')
6553         inc_version_list_init='0'
6554         d_inc_version_list="$undef"
6555         ;;
6556 *)      inc_version_list_init=`echo $inc_version_list |
6557                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6558         d_inc_version_list="$define"
6559         ;;
6560 esac
6561 $rm -f getverlist
6562
6563 : see if malloc/malloc.h has to be included
6564 set malloc/malloc.h i_mallocmalloc
6565 eval $inhdr
6566
6567 : see if this is a malloc.h system
6568 : we want a real compile instead of Inhdr because some systems have a
6569 : malloc.h that just gives a compile error saying to use stdlib.h instead
6570 echo " "
6571 $cat >try.c <<EOCP
6572 #include <stdlib.h>
6573 #include <malloc.h>
6574 #$i_mallocmalloc I_MALLOCMALLOC
6575 #ifdef I_MALLOCMALLOC
6576 # include <malloc/malloc.h>
6577 #endif
6578
6579 int main () { return 0; }
6580 EOCP
6581 set try
6582 if eval $compile; then
6583     echo "<malloc.h> found." >&4
6584     val="$define"
6585 else
6586     echo "<malloc.h> NOT found." >&4
6587     val="$undef"
6588 fi
6589 $rm_try
6590 set i_malloc
6591 eval $setvar
6592
6593 : check for void type
6594 echo " "
6595 echo "Checking to see how well your C compiler groks the void type..." >&4
6596 case "$voidflags" in
6597 '')
6598         $cat >try.c <<EOCP
6599 #$i_stdlib I_STDLIB
6600 #ifdef I_STDLIB
6601 #include <stdlib.h>
6602 #endif
6603 #if TRY & 1
6604 void sub() {
6605 #else
6606 sub() {
6607 #endif
6608         extern void moo();      /* function returning void */
6609         void (*goo)();          /* ptr to func returning void */
6610 #if TRY & 8
6611         void *hue;              /* generic ptr */
6612 #endif
6613 #if TRY & 2
6614         void (*foo[10])();
6615 #endif
6616
6617 #if TRY & 4
6618         if(goo == moo) {
6619                 exit(0);
6620         }
6621 #endif
6622         exit(0);
6623 }
6624 int main() { sub(); }
6625 EOCP
6626         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6627                 voidflags=$defvoidused
6628         echo "Good.  It appears to support void to the level $package wants.">&4
6629                 if $contains warning .out >/dev/null 2>&1; then
6630                         echo "However, you might get some warnings that look like this:"
6631                         $cat .out
6632                 fi
6633         else
6634 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6635                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6636                         echo "It supports 1..."
6637                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6638                                 echo "It also supports 2..."
6639                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6640                                         voidflags=7
6641                                         echo "And it supports 4 but not 8 definitely."
6642                                 else
6643                                         echo "It doesn't support 4..."
6644                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6645                                                 voidflags=11
6646                                                 echo "But it supports 8."
6647                                         else
6648                                                 voidflags=3
6649                                                 echo "Neither does it support 8."
6650                                         fi
6651                                 fi
6652                         else
6653                                 echo "It does not support 2..."
6654                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6655                                         voidflags=13
6656                                         echo "But it supports 4 and 8."
6657                                 else
6658                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6659                                                 voidflags=5
6660                                                 echo "And it supports 4 but has not heard about 8."
6661                                         else
6662                                                 echo "However it supports 8 but not 4."
6663                                         fi
6664                                 fi
6665                         fi
6666                 else
6667                         echo "There is no support at all for void."
6668                         voidflags=0
6669                 fi
6670         fi
6671 esac
6672 case "$voidflags" in
6673 "$defvoidused") ;;
6674 *)      $cat >&4 <<'EOM'
6675   Support flag bits are:
6676     1: basic void declarations.
6677     2: arrays of pointers to functions returning void.
6678     4: operations between pointers to and addresses of void functions.
6679     8: generic void pointers.
6680 EOM
6681         dflt="$voidflags";
6682         rp="Your void support flags add up to what?"
6683         . ./myread
6684         voidflags="$ans"
6685         ;;
6686 esac
6687 $rm_try
6688
6689 : check for length of pointer
6690 echo " "
6691 case "$ptrsize" in
6692 '')
6693         echo "Checking to see how big your pointers are..." >&4
6694         if test "$voidflags" -gt 7; then
6695                 echo '#define VOID_PTR char *' > try.c
6696         else
6697                 echo '#define VOID_PTR void *' > try.c
6698         fi
6699         $cat >>try.c <<EOCP
6700 #include <stdio.h>
6701 #$i_stdlib I_STDLIB
6702 #ifdef I_STDLIB
6703 #include <stdlib.h>
6704 #endif
6705 int main()
6706 {
6707     printf("%d\n", (int)sizeof(VOID_PTR));
6708     exit(0);
6709 }
6710 EOCP
6711         set try
6712         if eval $compile_ok; then
6713                 ptrsize=`$run ./try`
6714                 echo "Your pointers are $ptrsize bytes long."
6715         else
6716                 dflt='4'
6717                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6718                 rp="What is the size of a pointer (in bytes)?"
6719                 . ./myread
6720                 ptrsize="$ans"
6721         fi
6722         ;;
6723 esac
6724 $rm_try
6725 case "$use64bitall" in
6726 "$define"|true|[yY]*)
6727         case "$ptrsize" in
6728         4)      cat <<EOM >&4
6729
6730 *** You have chosen a maximally 64-bit build,
6731 *** but your pointers are only 4 bytes wide.
6732 *** Please rerun Configure without -Duse64bitall.
6733 EOM
6734                 case "$d_quad" in
6735                 define)
6736                         cat <<EOM >&4
6737 *** Since you have quads, you could possibly try with -Duse64bitint.
6738 EOM
6739                         ;;
6740                 esac
6741                 cat <<EOM >&4
6742 *** Cannot continue, aborting.
6743
6744 EOM
6745
6746                 exit 1
6747                 ;;
6748         esac
6749         ;;
6750 esac
6751
6752
6753 : determine whether to use malloc wrapping
6754 echo " "
6755 case "$usemallocwrap" in
6756 [yY]*|true|$define)     dflt='y' ;;
6757 [nN]*|false|$undef)     dflt='n' ;;
6758 *)      case "$usedevel" in
6759         [yY]*|true|$define)     dflt='y' ;;
6760         *) dflt='n' ;;
6761         esac
6762         ;;
6763 esac
6764 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6765 . ./myread
6766 usemallocwrap="$ans"
6767 case "$ans" in
6768 y*|true)
6769         usemallocwrap="$define" ;;
6770 *)
6771         usemallocwrap="$undef" ;;
6772 esac
6773
6774 : determine which malloc to compile in
6775 echo " "
6776 case "$usemymalloc" in
6777 [yY]*|true|$define)     dflt='y' ;;
6778 [nN]*|false|$undef)     dflt='n' ;;
6779 *)      case "$ptrsize" in
6780         4) dflt='y' ;;
6781         *) dflt='n' ;;
6782         esac
6783         if test "$useithreads" = "$define"; then dflt='n'; fi
6784         ;;
6785 esac
6786 rp="Do you wish to attempt to use the malloc that comes with $package?"
6787 . ./myread
6788 usemymalloc="$ans"
6789 case "$ans" in
6790 y*|true)
6791         usemymalloc='y'
6792         mallocsrc='malloc.c'
6793         mallocobj="malloc$_o"
6794         d_mymalloc="$define"
6795         case "$libs" in
6796         *-lmalloc*)
6797                 : Remove malloc from list of libraries to use
6798                 echo "Removing unneeded -lmalloc from library list" >&4
6799                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6800                 shift
6801                 libs="$*"
6802                 echo "libs = $libs" >&4
6803                 ;;
6804         esac
6805         ;;
6806 *)
6807         usemymalloc='n'
6808         mallocsrc=''
6809         mallocobj=''
6810         d_mymalloc="$undef"
6811         ;;
6812 esac
6813
6814 : compute the return types of malloc and free
6815 echo " "
6816 $cat >malloc.c <<END
6817 #$i_malloc I_MALLOC
6818 #$i_stdlib I_STDLIB
6819 #include <stdio.h>
6820 #include <sys/types.h>
6821 #ifdef I_MALLOC
6822 #include <malloc.h>
6823 #endif
6824 #ifdef I_STDLIB
6825 #include <stdlib.h>
6826 #endif
6827 #ifdef TRY_MALLOC
6828 void *malloc();
6829 #endif
6830 #ifdef TRY_FREE
6831 void free();
6832 #endif
6833 END
6834 case "$malloctype" in
6835 '')
6836         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6837                 malloctype='void *'
6838         else
6839                 malloctype='char *'
6840         fi
6841         ;;
6842 esac
6843 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6844
6845 case "$freetype" in
6846 '')
6847         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6848                 freetype='void'
6849         else
6850                 freetype='int'
6851         fi
6852         ;;
6853 esac
6854 echo "Your system uses $freetype free(), it would seem." >&4
6855 $rm -f malloc.[co]
6856 : determine where site specific architecture-dependent libraries go.
6857 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6858 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6859 : sitelib may have an optional trailing /share.
6860 case "$sitearch" in
6861 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6862         dflt="$dflt/$archname"
6863         ;;
6864 *)      dflt="$sitearch"
6865         ;;
6866 esac
6867 set sitearch sitearch none
6868 eval $prefixit
6869 $cat <<EOM
6870
6871 The installation process will also create a directory for
6872 architecture-dependent site-specific extensions and modules.
6873
6874 EOM
6875 fn=d~+
6876 rp='Pathname for the site-specific architecture-dependent library files?'
6877 . ./getfile
6878 prefixvar=sitearch
6879 . ./setprefixvar
6880 if $test X"$sitearch" = X"$sitelib"; then
6881         d_sitearch="$undef"
6882 else
6883         d_sitearch="$define"
6884 fi
6885
6886 : Set the vendorprefix variables
6887 $cat <<EOM
6888
6889 The installation process will also create a directory for
6890 vendor-supplied add-ons.  Vendors who supply perl with their system
6891 may find it convenient to place all vendor-supplied files in this
6892 directory rather than in the main distribution directory.  This will
6893 ease upgrades between binary-compatible maintenance versions of perl.
6894
6895 Of course you may also use these directories in whatever way you see
6896 fit.  For example, you might use them to access modules shared over a
6897 company-wide network.
6898
6899 The default answer should be fine for most people.
6900 This causes further questions about vendor add-ons to be skipped
6901 and no vendor-specific directories will be configured for perl.
6902
6903 EOM
6904 rp='Do you want to configure vendor-specific add-on directories?'
6905 case "$usevendorprefix" in
6906 define|true|[yY]*) dflt=y ;;
6907 *)      : User may have set vendorprefix directly on Configure command line.
6908         case "$vendorprefix" in
6909         ''|' ') dflt=n ;;
6910         *)      dflt=y ;;
6911         esac
6912         ;;
6913 esac
6914 . ./myread
6915 case "$ans" in
6916 [yY]*)  fn=d~+
6917         rp='Installation prefix to use for vendor-supplied add-ons?'
6918         case "$vendorprefix" in
6919         '') dflt='' ;;
6920         *)  dflt=$vendorprefix ;;
6921         esac
6922         . ./getfile
6923         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6924         oldvendorprefix=''
6925         case "$vendorprefix" in
6926         '') ;;
6927         *)      case "$ans" in
6928                 "$prefix") ;;
6929                 *) oldvendorprefix="$prefix";;
6930                 esac
6931                 ;;
6932         esac
6933         usevendorprefix="$define"
6934         vendorprefix="$ans"
6935         vendorprefixexp="$ansexp"
6936         ;;
6937 *)      usevendorprefix="$undef"
6938         vendorprefix=''
6939         vendorprefixexp=''
6940         ;;
6941 esac
6942
6943 : Set the vendorlib variables
6944 case "$vendorprefix" in
6945 '')     d_vendorlib="$undef"
6946         vendorlib=''
6947         vendorlibexp=''
6948         ;;
6949 *)      d_vendorlib="$define"
6950         : determine where vendor-supplied modules go.
6951         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6952         case "$vendorlib" in
6953         '')
6954                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6955                 case "$installstyle" in
6956                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6957                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6958                 esac
6959                 ;;
6960         *)      dflt="$vendorlib"
6961                 ;;
6962         esac
6963         fn=d~+
6964         rp='Pathname for the vendor-supplied library files?'
6965         . ./getfile
6966         vendorlib="$ans"
6967         vendorlibexp="$ansexp"
6968         ;;
6969 esac
6970 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6971 prefixvar=vendorlib
6972 . ./installprefix
6973
6974 : Set the vendorarch variables
6975 case "$vendorprefix" in
6976 '')     d_vendorarch="$undef"
6977         vendorarch=''
6978         vendorarchexp=''
6979         ;;
6980 *)      d_vendorarch="$define"
6981         : determine where vendor-supplied architecture-dependent libraries go.
6982         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6983         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6984         : vendorlib may have an optional trailing /share.
6985         case "$vendorarch" in
6986         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6987                 dflt="$dflt/$archname"
6988                 ;;
6989         *)      dflt="$vendorarch" ;;
6990         esac
6991         fn=d~+
6992         rp='Pathname for vendor-supplied architecture-dependent files?'
6993         . ./getfile
6994         vendorarch="$ans"
6995         vendorarchexp="$ansexp"
6996         ;;
6997 esac
6998 prefixvar=vendorarch
6999 . ./installprefix
7000 if $test X"$vendorarch" = X"$vendorlib"; then
7001         d_vendorarch="$undef"
7002 else
7003         d_vendorarch="$define"
7004 fi
7005
7006 : Final catch-all directories to search
7007 $cat <<EOM
7008
7009 Lastly, you can have perl look in other directories for extensions and
7010 modules in addition to those already specified.
7011 These directories will be searched after 
7012         $sitearch 
7013         $sitelib 
7014 EOM
7015 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7016 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7017 echo ' '
7018 case "$otherlibdirs" in
7019 ''|' ') dflt='none' ;;
7020 *)      dflt="$otherlibdirs" ;;
7021 esac
7022 $cat <<EOM
7023 Enter a colon-separated set of extra paths to include in perl's @INC
7024 search path, or enter 'none' for no extra paths.
7025
7026 EOM
7027
7028 rp='Colon-separated list of additional directories for perl to search?'
7029 . ./myread
7030 case "$ans" in
7031 ' '|''|none)    otherlibdirs=' ' ;;     
7032 *)      otherlibdirs="$ans" ;;
7033 esac
7034 case "$otherlibdirs" in
7035 ' ') val=$undef ;;
7036 *)      val=$define ;;
7037 esac
7038 set d_perl_otherlibdirs
7039 eval $setvar
7040
7041 : Cruising for prototypes
7042 echo " "
7043 echo "Checking out function prototypes..." >&4
7044 $cat >prototype.c <<EOCP
7045 #$i_stdlib I_STDLIB
7046 #ifdef I_STDLIB
7047 #include <stdlib.h>
7048 #endif
7049 int main(int argc, char *argv[]) {
7050         exit(0);}
7051 EOCP
7052 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7053         echo "Your C compiler appears to support function prototypes."
7054         val="$define"
7055 else
7056         echo "Your C compiler doesn't seem to understand function prototypes."
7057         val="$undef"
7058 fi
7059 set prototype
7060 eval $setvar
7061 $rm -f prototype*
7062
7063 : Check if ansi2knr is required
7064 case "$prototype" in
7065 "$define") ;;
7066 *)      ansi2knr='ansi2knr'
7067         echo " "
7068         cat <<EOM >&4
7069
7070 $me:  FATAL ERROR:
7071 This version of $package can only be compiled by a compiler that 
7072 understands function prototypes.  Unfortunately, your C compiler 
7073         $cc $ccflags
7074 doesn't seem to understand them.  Sorry about that.
7075
7076 If GNU cc is available for your system, perhaps you could try that instead.  
7077
7078 Eventually, we hope to support building Perl with pre-ANSI compilers.
7079 If you would like to help in that effort, please contact <perlbug@perl.org>.
7080
7081 Aborting Configure now.
7082 EOM
7083         exit 2
7084         ;;
7085 esac
7086
7087 : DTrace support
7088 dflt_dtrace='/usr/sbin/dtrace'
7089 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7090
7091 cat <<EOM
7092
7093 Perl can be built to support DTrace on platforms that support it.
7094 DTrace is a diagnosis and performance analysis tool from Sun.
7095
7096 If this doesn't make any sense to you, just accept the default '$dflt'.
7097 EOM
7098
7099 while $test 1 ; do
7100         case "$usedtrace" in
7101         $define|true|[yY]*)
7102                 dflt='y'
7103                 ;;
7104         ?*)
7105                 dflt='y'
7106                 dflt_dtrace=$usedtrace
7107                 ;;
7108         *)
7109                 dflt='n'
7110                 ;;
7111         esac
7112
7113         rp='Support DTrace if available?'
7114         . ./myread
7115         case "$ans" in
7116         y|Y)    val="$define" ;;
7117         *)      val="$undef" ;;
7118         esac
7119         set usedtrace
7120         eval $setvar
7121
7122         test "X$usedtrace" != "X$define" && break
7123
7124         echo " "
7125         rp='Where is the dtrace executable?'
7126         dflt=$dflt_dtrace
7127         . ./getfile
7128         val="$ans"
7129         set dtrace
7130         eval $setvar
7131
7132         if $test -f $dtrace
7133         then
7134                 if $dtrace -h -s ../perldtrace.d \
7135                         -o perldtrace.tmp >/dev/null 2>&1 \
7136                         && rm -f perldtrace.tmp
7137                 then
7138                         echo " "
7139                         echo "Good: your $dtrace knows about the -h flag."
7140                 else
7141                         cat >&2 <<EOM
7142
7143 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7144 ***
7145 *** Your installed dtrace doesn't support the -h switch to compile a D
7146 *** program into a C header. Can't continue.
7147
7148 EOM
7149                         exit 1
7150                 fi
7151                 break;
7152         fi
7153
7154         case "$fastread" in
7155         yes)
7156                 cat >&2 <<EOM
7157
7158 *** $me:  Fatal Error:  $dtrace not found.
7159 *** Can't continue.
7160
7161 EOM
7162                 exit 1
7163                 ;;
7164         *)
7165                 echo "*** $dtrace was not found."
7166                 echo " "
7167                 ;;
7168         esac
7169 done
7170
7171 : See if we want extra modules installed
7172 echo " "
7173 case "$extras" in
7174 '') dflt='n';;
7175 *) dflt='y';;
7176 esac
7177 cat <<EOM
7178 Perl can be built with extra modules or bundles of modules which
7179 will be fetched from the CPAN and installed alongside Perl.
7180
7181 Notice that you will need access to the CPAN; either via the Internet,
7182 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7183 be asked later to configure the CPAN.pm module which will in turn do
7184 the installation of the rest of the extra modules or bundles.)
7185
7186 Notice also that if the modules require any external software such as
7187 libraries and headers (the libz library and the zlib.h header for the
7188 Compress::Zlib module, for example) you MUST have any such software
7189 already installed, this configuration process will NOT install such
7190 things for you.
7191
7192 If this doesn't make any sense to you, just accept the default '$dflt'.
7193 EOM
7194 rp='Install any extra modules (y or n)?'
7195 . ./myread
7196 case "$ans" in
7197 y|Y)
7198         cat <<EOM
7199
7200 Please list any extra modules or bundles to be installed from CPAN,
7201 with spaces between the names.  The names can be in any format the
7202 'install' command of CPAN.pm will understand.  (Answer 'none',
7203 without the quotes, to install no extra modules or bundles.)
7204 EOM
7205         rp='Extras?'
7206         dflt="$extras"
7207         . ./myread
7208         extras="$ans"
7209 esac
7210 case "$extras" in
7211 ''|'none')
7212         val=''
7213         $rm -f ../extras.lst
7214         ;;
7215 *)      echo "(Saving the list of extras for later...)"
7216         echo "$extras" > ../extras.lst
7217         val="'$extras'"
7218         ;;
7219 esac
7220 set extras
7221 eval $setvar
7222 echo " "
7223
7224 : determine where html pages for programs go
7225 set html1dir html1dir none
7226 eval $prefixit
7227 $cat <<EOM
7228
7229 If you wish to install html files for programs in $spackage, indicate
7230 the appropriate directory here.  To skip installing html files,
7231 answer "none".
7232 EOM
7233 case "$html1dir" in
7234 ''|none|$undef|' ') dflt=none ;;
7235 *) dflt=$html1dir ;;
7236 esac
7237 fn=dn+~
7238 rp="Directory for the main $spackage html pages?"
7239 . ./getfile
7240 prefixvar=html1dir
7241 . ./setprefixvar
7242 : Use ' ' for none so value is preserved next time through Configure
7243 $test X"$html1dir" = "X" && html1dir=' '
7244
7245 : determine where html pages for libraries and modules go
7246 set html3dir html3dir none
7247 eval $prefixit
7248 $cat <<EOM
7249
7250 If you wish to install html files for modules associated with $spackage,
7251 indicate the appropriate directory here.  To skip installing html files,
7252 answer "none".
7253 EOM
7254 : There is no obvious default.  If they have specified html1dir, then
7255 : try to key off that, possibly changing .../html1 into .../html3.
7256 case "$html3dir" in
7257 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7258 *) dflt=$html3dir ;;
7259 esac
7260 fn=dn+~
7261 rp="Directory for the $spackage module html pages?"
7262 . ./getfile
7263 prefixvar=html3dir
7264 . ./setprefixvar
7265 : Use ' ' for none so value is preserved next time through Configure
7266 $test X"$html3dir" = "X" && html3dir=' '
7267
7268 : determine whether to install perl also as /usr/bin/perl
7269
7270 echo " "
7271 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7272         $cat <<EOM
7273 Many scripts expect perl to be installed as /usr/bin/perl.
7274
7275 If you want to, I can install the perl you are about to compile
7276 as /usr/bin/perl (in addition to $bin/perl).
7277 EOM
7278         if test -f /usr/bin/perl; then
7279             $cat <<EOM
7280
7281 However, please note that because you already have a /usr/bin/perl,
7282 overwriting that with a new Perl would very probably cause problems.
7283 Therefore I'm assuming you don't want to do that (unless you insist).
7284
7285 EOM
7286             case "$installusrbinperl" in
7287             "$define"|[yY]*)    dflt='y';;
7288             *)                  dflt='n';;
7289             esac
7290         else
7291             $cat <<EOM
7292
7293 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7294
7295 EOM
7296             case "$installusrbinperl" in
7297             "$undef"|[nN]*)     dflt='n';;
7298             *)                  dflt='y';;
7299             esac
7300         fi
7301         rp="Do you want to install perl as /usr/bin/perl?"
7302         . ./myread
7303         case "$ans" in
7304         [yY]*)  val="$define";;
7305         *)      val="$undef" ;;
7306         esac
7307 else
7308         val="$undef"
7309 fi
7310 set installusrbinperl
7311 eval $setvar
7312
7313 : Check if we are using the GNU C library
7314 echo " "
7315 echo "Checking for GNU C Library..." >&4
7316 cat >try.c <<'EOCP'
7317 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7318    alone are insufficient to distinguish different versions, such as
7319    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7320    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7321 */
7322 #include <stdio.h>
7323 int main(void)
7324 {
7325 #ifdef __GLIBC__
7326 #   ifdef __GLIBC_MINOR__
7327 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7328 #           include <gnu/libc-version.h>
7329             printf("%s\n",  gnu_get_libc_version());
7330 #       else
7331             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7332 #       endif
7333 #   else
7334         printf("%d\n",  __GLIBC__);
7335 #   endif
7336     return 0;
7337 #else
7338     return 1;
7339 #endif
7340 }
7341 EOCP
7342 set try
7343 if eval $compile_ok && $run ./try > glibc.ver; then
7344         val="$define"
7345         gnulibc_version=`$cat glibc.ver`
7346         echo "You are using the GNU C Library version $gnulibc_version"
7347 else
7348         val="$undef"
7349         gnulibc_version=''
7350         echo "You are not using the GNU C Library"
7351 fi
7352 $rm_try glibc.ver
7353 set d_gnulibc
7354 eval $setvar
7355
7356 : see if nm is to be used to determine whether a symbol is defined or not
7357 case "$usenm" in
7358 '')
7359         dflt=''
7360         case "$d_gnulibc" in
7361         "$define")
7362                 echo " "
7363                 echo "nm probably won't work on the GNU C Library." >&4
7364                 dflt=n
7365                 ;;
7366         esac
7367         case "$dflt" in
7368         '') 
7369                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7370                         echo " "
7371                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7372                         echo "'nm' won't be sufficient on this sytem." >&4
7373                         dflt=n
7374                 fi
7375                 ;;
7376         esac
7377         case "$dflt" in
7378         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7379                 if $test $dflt -gt 20; then
7380                         dflt=y
7381                 else
7382                         dflt=n
7383                 fi
7384                 ;;
7385         esac
7386         ;;
7387 *)
7388         case "$usenm" in
7389         true|$define) dflt=y;;
7390         *) dflt=n;;
7391         esac
7392         ;;
7393 esac
7394 $cat <<EOM
7395
7396 I can use $nm to extract the symbols from your C libraries. This
7397 is a time consuming task which may generate huge output on the disk (up
7398 to 3 megabytes) but that should make the symbols extraction faster. The
7399 alternative is to skip the 'nm' extraction part and to compile a small
7400 test program instead to determine whether each symbol is present. If
7401 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7402 this may be the best solution.
7403
7404 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7405
7406 EOM
7407 rp="Shall I use $nm to extract C symbols from the libraries?"
7408 . ./myread
7409 case "$ans" in
7410 [Nn]*) usenm=false;;
7411 *) usenm=true;;
7412 esac
7413
7414 runnm=$usenm
7415 case "$reuseval" in
7416 true) runnm=false;;
7417 esac
7418
7419 : nm options which may be necessary
7420 case "$nm_opt" in
7421 '') if $test -f /mach_boot; then
7422                 nm_opt=''       # Mach
7423         elif $test -d /usr/ccs/lib; then
7424                 nm_opt='-p'     # Solaris (and SunOS?)
7425         elif $test -f /dgux; then
7426                 nm_opt='-p'     # DG-UX
7427         elif $test -f /lib64/rld; then
7428                 nm_opt='-p'     # 64-bit Irix
7429         else
7430                 nm_opt=''
7431         fi;;
7432 esac
7433
7434 : nm options which may be necessary for shared libraries but illegal
7435 : for archive libraries.  Thank you, Linux.
7436 case "$nm_so_opt" in
7437 '')     case "$myuname" in
7438         *linux*|gnu*)
7439                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7440                         nm_so_opt='--dynamic'
7441                 fi
7442                 ;;
7443         esac
7444         ;;
7445 esac
7446
7447 : Figure out where the libc is located
7448 case "$runnm" in
7449 true)
7450 : get list of predefined functions in a handy place
7451 echo " "
7452 case "$libc" in
7453 '') libc=unknown
7454         case "$libs" in
7455         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7456         esac
7457         ;;
7458 esac
7459 case "$libs" in
7460 '') ;;
7461 *)  for thislib in $libs; do
7462         case "$thislib" in
7463         -lc|-lc_s)
7464                 : Handle C library specially below.
7465                 ;;
7466         -l*)
7467                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7468                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7469                         :
7470                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7471                         :
7472                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7473                         :
7474                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7475                         :
7476                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7477                         :
7478                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7479                         :
7480                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7481                         :
7482                 else
7483                         try=''
7484                 fi
7485                 libnames="$libnames $try"
7486                 ;;
7487         *) libnames="$libnames $thislib" ;;
7488         esac
7489         done
7490         ;;
7491 esac
7492 xxx=normal
7493 case "$libc" in
7494 unknown)
7495         set /lib/libc.$so
7496         for xxx in $libpth; do
7497                 $test -r $1 || set $xxx/libc.$so
7498                 : The messy sed command sorts on library version numbers.
7499                 $test -r $1 || \
7500                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7501                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7502                                 h
7503                                 s/[0-9][0-9]*/0000&/g
7504                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7505                                 G
7506                                 s/\n/ /' | \
7507                          $sort | $sed -e 's/^.* //'`
7508                 eval set \$$#
7509         done
7510         $test -r $1 || set /usr/ccs/lib/libc.$so
7511         $test -r $1 || set /lib/libsys_s$_a
7512         ;;
7513 *)
7514         set blurfl
7515         ;;
7516 esac
7517 if $test -r "$1"; then
7518         echo "Your (shared) C library seems to be in $1."
7519         libc="$1"
7520 elif $test -r /lib/libc && $test -r /lib/clib; then
7521         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7522         xxx=apollo
7523         libc='/lib/clib /lib/libc'
7524         if $test -r /lib/syslib; then
7525                 echo "(Your math library is in /lib/syslib.)"
7526                 libc="$libc /lib/syslib"
7527         fi
7528 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7529         echo "Your C library seems to be in $libc, as you said before."
7530 elif $test -r $incpath/usr/lib/libc$_a; then
7531         libc=$incpath/usr/lib/libc$_a;
7532         echo "Your C library seems to be in $libc.  That's fine."
7533 elif $test -r /lib/libc$_a; then
7534         libc=/lib/libc$_a;
7535         echo "Your C library seems to be in $libc.  You're normal."
7536 else
7537         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7538                 :
7539         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7540                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7541         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7542                 :
7543         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7544                 :
7545         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7546                 :
7547         else
7548                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7549         fi
7550         if $test -r "$tans"; then
7551                 echo "Your C library seems to be in $tans, of all places."
7552                 libc=$tans
7553         else
7554                 libc='blurfl'
7555         fi
7556 fi
7557 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7558         dflt="$libc"
7559         cat <<EOM
7560
7561 If the guess above is wrong (which it might be if you're using a strange
7562 compiler, or your machine supports multiple models), you can override it here.
7563
7564 EOM
7565 else
7566         dflt=''
7567         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7568         cat >&4 <<EOM
7569 I can't seem to find your C library.  I've looked in the following places:
7570
7571 EOM
7572         $sed 's/^/      /' libpath
7573         cat <<EOM
7574
7575 None of these seems to contain your C library. I need to get its name...
7576
7577 EOM
7578 fi
7579 fn=f
7580 rp='Where is your C library?'
7581 . ./getfile
7582 libc="$ans"
7583
7584 echo " "
7585 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7586 set X `cat libnames`
7587 shift
7588 xxx=files
7589 case $# in 1) xxx=file; esac
7590 echo "Extracting names from the following $xxx for later perusal:" >&4
7591 echo " "
7592 $sed 's/^/      /' libnames >&4
7593 echo " "
7594 $echo $n "This may take a while...$c" >&4
7595
7596 for file in $*; do
7597         case $file in
7598         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7599         *) $nm $nm_opt $file 2>/dev/null;;
7600         esac
7601 done >libc.tmp
7602
7603 $echo $n ".$c"
7604 $grep fprintf libc.tmp > libc.ptf
7605 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7606 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7607 xxx='[ADTSIWi]'
7608 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7609         eval $xscan;\
7610         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7611                 eval $xrun
7612 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7613         eval $xscan;\
7614         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7615                 eval $xrun
7616 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7617         eval $xscan;\
7618         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7619                 eval $xrun
7620 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //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.*text.*/\1/p'";\
7625         eval $xscan;\
7626         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7627                 eval $xrun
7628 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7629         eval $xscan;\
7630         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7631                 eval $xrun
7632 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7633                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7634         eval $xscan;\
7635         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7636                 eval $xrun
7637 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7638         eval $xscan;\
7639         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7640                 eval $xrun
7641 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7642         eval $xscan;\
7643         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7644                 eval $xrun
7645 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7646         eval $xscan;\
7647         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7648                 eval $xrun
7649 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7650         eval $xscan;\
7651         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7652                 eval $xrun
7653 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7654         eval $xscan;\
7655         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7656                 eval $xrun
7657 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7658         eval $xscan;\
7659         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7660                 eval $xrun
7661 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7662         eval $xscan;\
7663         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7664                 eval $xrun
7665 else
7666         $nm -p $* 2>/dev/null >libc.tmp
7667         $grep fprintf libc.tmp > libc.ptf
7668         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7669                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7670         then
7671                 nm_opt='-p'
7672                 eval $xrun
7673         else
7674                 echo " "
7675                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7676                 com=''
7677                 if $ar t $libc > libc.tmp && \
7678                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7679                 then
7680                         for thisname in $libnames $libc; do
7681                                 $ar t $thisname >>libc.tmp
7682                         done
7683                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7684                         echo "Ok." >&4
7685                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7686                         for thisname in $libnames $libc; do
7687                                 $ar tv $thisname >>libc.tmp
7688                                 emximp -o tmp.imp $thisname \
7689                                     2>/dev/null && \
7690                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7691                                     < tmp.imp >>libc.tmp
7692                                 $rm -f tmp.imp
7693                         done
7694                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7695                         echo "Ok." >&4
7696                 else
7697                         echo "$ar didn't seem to work right." >&4
7698                         echo "Maybe this is a Cray...trying bld instead..." >&4
7699                         if  bld t $libc | \
7700                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7701                                 $test -s libc.list
7702                         then
7703                                 for thisname in $libnames; do
7704                                         bld t $libnames | \
7705                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7706                                         $ar t $thisname >>libc.tmp
7707                                 done
7708                                 echo "Ok." >&4
7709                         else
7710                                 echo "That didn't work either.  Giving up." >&4
7711                                 exit 1
7712                         fi
7713                 fi
7714         fi
7715 fi
7716 nm_extract="$com"
7717 case "$PASE" in
7718 define)
7719     echo " "
7720     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7721     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7722     ;;
7723 *)  if $test -f /lib/syscalls.exp; then
7724         echo " "
7725         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7726         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7727                 /lib/syscalls.exp >>libc.list
7728     fi
7729     ;;
7730 esac
7731 ;;
7732 esac
7733 $rm -f libnames libpath
7734
7735 : see if dld is available
7736 set dld.h i_dld
7737 eval $inhdr
7738
7739 : Check if we are using C++
7740 echo " "
7741 echo "Checking for C++..." >&4
7742 $cat >try.c <<'EOCP'
7743 #include <stdio.h>
7744 int main(void)
7745 {
7746 #ifdef __cplusplus
7747     return 0;
7748 #else
7749     return 1;
7750 #endif
7751 }
7752 EOCP
7753 set try
7754 if eval $compile_ok && $run ./try; then
7755         val="$define"
7756         echo "You are using a C++ compiler."
7757 else
7758         val="$undef"
7759         echo "You are not using a C++ compiler."
7760 fi
7761 $rm_try cplusplus$$
7762 set d_cplusplus
7763 eval $setvar
7764
7765 : is a C symbol defined?
7766 csym='tlook=$1;
7767 case "$3" in
7768 -v) tf=libc.tmp; tdc="";;
7769 -a) tf=libc.tmp; tdc="[]";;
7770 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7771 esac;
7772 case "$d_cplusplus" in
7773     $define)    extern_C="extern \"C\"" ;;
7774     *)          extern_C="extern"       ;;
7775 esac;
7776 tx=yes;
7777 case "$reuseval-$4" in
7778 true-) ;;
7779 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7780 esac;
7781 case "$tx" in
7782 yes)
7783         tval=false;
7784         if $test "$runnm" = true; then
7785                 if $contains $tlook $tf >/dev/null 2>&1; then
7786                         tval=true;
7787                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7788                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7789                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7790                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7791                         $rm_try;
7792                 fi;
7793         else
7794                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7795                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7796                 $rm_try;
7797         fi;
7798         ;;
7799 *)
7800         case "$tval" in
7801         $define) tval=true;;
7802         *) tval=false;;
7803         esac;
7804         ;;
7805 esac;
7806 eval "$2=$tval"'
7807
7808 : define an is-in-libc? function
7809 inlibc='echo " "; td=$define; tu=$undef;
7810 sym=$1; var=$2; eval "was=\$$2";
7811 tx=yes;
7812 case "$reuseval$was" in
7813 true) ;;
7814 true*) tx=no;;
7815 esac;
7816 case "$tx" in
7817 yes)
7818         set $sym tres -f;
7819         eval $csym;
7820         case "$tres" in
7821         true)
7822                 echo "$sym() found." >&4;
7823                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7824         *)
7825                 echo "$sym() NOT found." >&4;
7826                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7827         esac;;
7828 *)
7829         case "$was" in
7830         $define) echo "$sym() found." >&4;;
7831         *) echo "$sym() NOT found." >&4;;
7832         esac;;
7833 esac'
7834
7835 : see if dlopen exists
7836 xxx_runnm="$runnm"
7837 xxx_ccflags="$ccflags"
7838 runnm=false
7839 : with g++ one needs -shared to get is-in-libc to work for dlopen
7840 case "$gccversion" in
7841 '')     ;;
7842 *)      case "$d_cplusplus" in
7843         "$define") ccflags="$ccflags -shared" ;;
7844         esac
7845         ;;
7846 esac
7847 set dlopen d_dlopen
7848 eval $inlibc
7849 runnm="$xxx_runnm"
7850 ccflags="$xxx_ccflags"
7851
7852 : see if this is a unistd.h system
7853 set unistd.h i_unistd
7854 eval $inhdr
7855
7856 : determine which dynamic loading, if any, to compile in
7857 echo " "
7858 dldir="ext/DynaLoader"
7859 case "$usedl" in
7860 $define|y|true)
7861         dflt='y'
7862         usedl="$define"
7863         ;;
7864 $undef|n|false)
7865         dflt='n'
7866         usedl="$undef"
7867         ;;
7868 *)
7869         dflt='n'
7870         case "$d_dlopen" in
7871             $define) dflt='y' ;;
7872         esac
7873         case "$i_dld" in
7874             $define) dflt='y' ;;
7875         esac
7876         : Does a dl_xxx.xs file exist for this operating system
7877         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7878         ;;
7879 esac
7880 rp="Do you wish to use dynamic loading?"
7881 . ./myread
7882 usedl="$ans"
7883 bin_ELF="$undef"
7884 case "$ans" in
7885 y*) usedl="$define"
7886         case "$dlsrc" in
7887         '')
7888                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7889                         dflt="$dldir/dl_${osname}.xs"
7890                 elif $test "$d_dlopen" = "$define" ; then
7891                         dflt="$dldir/dl_dlopen.xs"
7892                 elif $test "$i_dld" = "$define" ; then
7893                         dflt="$dldir/dl_dld.xs"
7894                 else
7895                         dflt=''
7896                 fi
7897                 ;;
7898         *)      dflt="$dldir/$dlsrc"
7899                 ;;
7900         esac
7901     echo "The following dynamic loading files are available:"
7902         : Can not go over to $dldir because getfile has path hard-coded in.
7903         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7904         rp="Source file to use for dynamic loading"
7905         fn="fne"
7906         gfpth="$src"
7907         . ./getfile
7908         usedl="$define"
7909         : emulate basename
7910         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7911
7912         $cat << EOM
7913
7914 Some systems may require passing special flags to $cc -c to
7915 compile modules that will be used to create a shared library.
7916 To use no flags, say "none".
7917
7918 EOM
7919     case "$cccdlflags" in
7920     '') case "$gccversion" in
7921                 '') case "$osname" in
7922                         hpux)   dflt='+z' ;;
7923                         next)   dflt='none' ;;
7924                         irix*)  dflt='-KPIC' ;;
7925                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7926                         sunos)  dflt='-pic' ;;
7927                         *)      dflt='none' ;;
7928                     esac
7929                         ;;
7930                 *)  case "$osname" in
7931                         darwin) dflt='none' ;;
7932                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7933                         *)      dflt='-fpic' ;;
7934                     esac ;;
7935             esac ;;
7936         ' ') dflt='none' ;;
7937     *)  dflt="$cccdlflags" ;;
7938     esac
7939     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7940     . ./myread
7941     case "$ans" in
7942     none) cccdlflags=' ' ;;
7943     *) cccdlflags="$ans" ;;
7944     esac
7945
7946     cat << EOM
7947
7948 Some systems use ld to create libraries that can be dynamically loaded,
7949 while other systems (such as those using ELF) use $cc.
7950
7951 EOM
7952
7953 : Determine if this is ELF
7954         $cat >try.c <<EOM
7955 /* Test for whether ELF binaries are produced */
7956 #include <fcntl.h>
7957 #$i_stdlib I_STDLIB
7958 #ifdef I_STDLIB
7959 #include <stdlib.h>
7960 #endif
7961 #$i_unistd I_UNISTD
7962 #ifdef I_UNISTD
7963 #include <unistd.h>
7964 #endif
7965 int main() {
7966         char b[4];
7967         int i = open("a.out",O_RDONLY);
7968         if(i == -1)
7969                 exit(1); /* fail */
7970         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7971                 exit(0); /* succeed (yes, it is ELF) */
7972         else
7973                 exit(1); /* fail */
7974 }
7975 EOM
7976         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7977                 bin_ELF="$define"
7978         fi
7979         $rm_try
7980
7981         case "$ld" in
7982         '')     if $test $bin_ELF = "$define"; then
7983                         cat <<EOM
7984 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7985 EOM
7986                         dflt="$cc"
7987                 else
7988                         echo "I'll use ld to build dynamic libraries."
7989                         dflt='ld'
7990                 fi
7991                 ;;
7992         *)      dflt="$ld"
7993                 ;;
7994         esac
7995
7996     rp="What command should be used to create dynamic libraries?"
7997     . ./myread
7998         ld="$ans"
7999
8000     cat << EOM
8001
8002 Some systems may require passing special flags to $ld to create a
8003 library that can be dynamically loaded.  If your ld flags include
8004 -L/other/path options to locate libraries outside your loader's normal
8005 search path, you may need to specify those -L options here as well.  To
8006 use no flags, say "none".
8007
8008 EOM
8009     case "$lddlflags" in
8010     '') case "$osname" in
8011                         beos) dflt='-nostart' ;;
8012                         haiku) dflt='-shared' ;;
8013                         hpux) dflt='-b';
8014                               case "$gccversion" in
8015                               '') dflt="$dflt +vnocompatwarnings" ;;
8016                               esac
8017                               ;;
8018                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8019                         next)  dflt='none' ;;
8020                         solaris) dflt='-G' ;;
8021                         sunos) dflt='-assert nodefinitions' ;;
8022                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8023                 *)     dflt='none' ;;
8024                         esac
8025                         ;;
8026     *) dflt="$lddlflags" ;;
8027     esac
8028
8029         : Try to guess additional flags to pick up local libraries.
8030         : Be careful not to append to a plain 'none'
8031         case "$dflt" in
8032         none) dflt='' ;;
8033         esac
8034         for thisflag in $ldflags; do
8035                 case "$thisflag" in
8036                 -L*|-R*|-Wl,-R*)
8037                         case " $dflt " in
8038                         *" $thisflag "*) ;;
8039                         *) dflt="$dflt $thisflag" ;;
8040                         esac
8041                         ;;
8042                 esac
8043         done
8044
8045         case "$dflt" in
8046         ''|' ') dflt='none' ;;
8047         esac
8048
8049         case "$ldflags" in
8050         *-fstack-protector*)
8051             case "$dflt" in
8052                         *-fstack-protector*) ;; # Don't add it again
8053                         *) dflt="$dflt -fstack-protector" ;; 
8054                 esac
8055                 ;;
8056         esac
8057
8058
8059     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8060     . ./myread
8061     case "$ans" in
8062     none) lddlflags=' ' ;;
8063     *) lddlflags="$ans" ;;
8064     esac
8065
8066         cat <<EOM
8067
8068 Some systems may require passing special flags to $cc to indicate that
8069 the resulting executable will use dynamic linking.  To use no flags,
8070 say "none".
8071
8072 EOM
8073     case "$ccdlflags" in
8074     '') case "$osname" in
8075             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8076             next|sunos) dflt='none' ;;
8077             *)          dflt='none' ;;
8078             esac ;;
8079     ' ')  dflt='none' ;;
8080     *)  dflt="$ccdlflags" ;;
8081     esac
8082     rp="Any special flags to pass to $cc to use dynamic linking?"
8083     . ./myread
8084     case "$ans" in
8085     none) ccdlflags=' ' ;;
8086     *) ccdlflags="$ans" ;;
8087     esac
8088     ;;
8089 *)  usedl="$undef"
8090         ld='ld'
8091     dlsrc='dl_none.xs'
8092     lddlflags=''
8093     ccdlflags=''
8094     ;;
8095 esac
8096
8097 ld_can_script="$undef"
8098 case "$bin_ELF$usedl" in
8099 $define$define)
8100     # Abuse try.h and a.out names for neat cleanup
8101     $cat >try.c <<EOM
8102 void foo() {}
8103 void bar() {}
8104 EOM
8105     $cat >try.h <<EOM
8106 LIBTEST_42 {
8107  global:
8108   foo;
8109  local: *;
8110  };
8111 EOM
8112     if $cc $cccdlflags $ccdlflags $ccflags \
8113            $ldflags $lddlflags -o a.out try.c \
8114            -Wl,--version-script=try.h >/dev/null 2>&1 \
8115        &&  $test -s a.out ; then
8116         echo "ld supports scripting" >&4
8117         ld_can_script="$define"
8118     else
8119         echo "ld does not support scripting" >&4
8120     fi
8121     $rm_try
8122     ;;
8123 esac
8124
8125 : Do we want a shared libperl?
8126 also=''
8127 case "$usedl" in
8128 $undef)
8129         # No dynamic loading being used, so don't bother even to prompt.
8130         useshrplib='false'
8131         ;;
8132 *)      case "$useshrplib" in
8133         '')     case "$osname" in
8134                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8135                         dflt=y
8136                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8137                         ;;
8138                 next*)
8139                         case "$osvers" in
8140                         4*)     dflt=y
8141                                 also='Building a shared libperl is needed for MAB support.'
8142                                 ;;
8143                         *)      dflt=n
8144                                 ;;
8145                         esac
8146                         ;;
8147                 *)      dflt=n
8148                         ;;
8149                 esac
8150                 ;;
8151         $define|true|[Yy]*)
8152                 dflt=y
8153                 ;;
8154         *)      dflt=n
8155                 ;;
8156         esac
8157         $cat << EOM
8158
8159 The perl executable is normally obtained by linking perlmain.c with
8160 libperl${_a}, any static extensions (usually just DynaLoader), and
8161 any other libraries needed on this system (such as -lm, etc.).  Since
8162 your system supports dynamic loading, it is probably possible to build
8163 a shared libperl.$so.  If you will have more than one executable linked
8164 to libperl.$so, this will significantly reduce the size of each
8165 executable, but it may have a noticeable effect on performance.  The
8166 default is probably sensible for your system.
8167 $also
8168
8169 EOM
8170         rp="Build a shared libperl.$so (y/n)"
8171         . ./myread
8172         case "$ans" in
8173         true|$define|[Yy]*)
8174                 useshrplib='true'  ;;
8175         *)      useshrplib='false' ;;
8176         esac
8177         ;;
8178 esac
8179
8180 case "$useshrplib" in
8181 true)
8182         case "$userelocatableinc" in
8183         true|define)
8184                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8185                 echo "See INSTALL for an explanation why that won't work." >&4
8186                 exit 4
8187                 ;;
8188         esac
8189         case "$libperl" in
8190         '')
8191                 # Figure out a good name for libperl.so.  Since it gets stored in
8192                 # a version-specific architecture-dependent library, the version
8193                 # number isn't really that important, except for making cc/ld happy.
8194                 #
8195                 # A name such as libperl.so.10.1
8196                 majmin="libperl.$so.$patchlevel.$subversion"
8197                 # A name such as libperl.so.100
8198                 majonly=`echo $patchlevel $subversion |
8199                         $awk '{printf "%d%02d", $1, $2}'`
8200                 majonly=libperl.$so.$majonly
8201                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8202                 # rely on figuring it out from the naming of libc.
8203                 case "${osname}${osvers}" in
8204                 next4*)
8205                         dflt=libperl.5.$so
8206                         # XXX How handle the --version stuff for MAB?
8207                         ;;
8208                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8209                         dflt=libperl.$so
8210                         ;;
8211                 cygwin*) # ld links now against the dll directly
8212                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8213                         majonly=`echo $patchlevel $subversion |
8214                                 $awk '{printf "%03d%03d", $1, $2}'`
8215                         majonly=cygperl5.$majonly.$so
8216                         dflt=$majmin
8217                         ;;
8218                 *)      # Try to guess based on whether libc has major.minor.
8219                         case "$libc" in
8220                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8221                         *libc.$so.[0-9]*) dflt=$majonly ;;
8222                         *)      dflt=libperl.$so ;;
8223                         esac
8224                         ;;
8225                 esac
8226                 ;;
8227         *)      dflt=$libperl
8228                 ;;
8229         esac
8230         cat << EOM
8231
8232 I need to select a good name for the shared libperl.  If your system uses
8233 library names with major and minor numbers, then you might want something
8234 like $majmin.  Alternatively, if your system uses a single version
8235 number for shared libraries, then you might want to use $majonly.
8236 Or, your system might be quite happy with a simple libperl.$so.
8237
8238 Since the shared libperl will get installed into a version-specific
8239 architecture-dependent directory, the version number of the shared perl
8240 library probably isn't important, so the default should be o.k.
8241
8242 EOM
8243         rp='What name do you want to give to the shared libperl?'
8244         . ./myread
8245         libperl=$ans
8246         echo "Ok, I'll use $libperl"
8247         ;;
8248 *)
8249         libperl="libperl${_a}"
8250         ;;
8251 esac
8252
8253 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8254 case "$shrpdir" in
8255 '') ;;
8256 *)      $cat >&4 <<EOM
8257 WARNING:  Use of the shrpdir variable for the installation location of
8258 the shared $libperl is not supported.  It was never documented and
8259 will not work in this version.  Let me (perlbug@perl.org)
8260 know of any problems this may cause.
8261
8262 EOM
8263         case "$shrpdir" in
8264         "$archlibexp/CORE")
8265                 $cat >&4 <<EOM
8266 But your current setting of $shrpdir is
8267 the default anyway, so it's harmless.
8268 EOM
8269                 ;;
8270         *)
8271                 $cat >&4 <<EOM
8272 Further, your current attempted setting of $shrpdir
8273 conflicts with the value of $archlibexp/CORE
8274 that installperl will use.
8275 EOM
8276                 ;;
8277         esac
8278         ;;
8279 esac
8280
8281 # How will the perl executable find the installed shared $libperl?
8282 # Add $xxx to ccdlflags.
8283 # If we can't figure out a command-line option, use $shrpenv to
8284 # set env LD_RUN_PATH.  The main perl makefile uses this.
8285 shrpdir=$archlibexp/CORE
8286 xxx=''
8287 tmp_shrpenv=''
8288 if "$useshrplib"; then
8289     case "$osname" in
8290         aix)
8291                 # We'll set it in Makefile.SH...
8292                 ;;
8293         solaris)
8294                 xxx="-R $shrpdir"
8295                 ;;
8296         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly)
8297                 xxx="-Wl,-R$shrpdir"
8298                 ;;
8299         bsdos|linux|irix*|dec_osf|gnu*)
8300                 xxx="-Wl,-rpath,$shrpdir"
8301                 ;;
8302         next)
8303                 # next doesn't like the default...
8304                 ;;
8305         beos)
8306                 # beos doesn't like the default, either.
8307                 ;;
8308         haiku)
8309                 # Haiku doesn't like the default, either.
8310                 ;;
8311         hpux*)
8312                 # hpux doesn't like the default, either.
8313                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8314                 ;;
8315         cygwin)
8316                 # cygwin needs only ldlibpth
8317                 ;;
8318         *)
8319                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8320                 ;;
8321         esac
8322         case "$xxx" in
8323         '') ;;
8324         *)
8325                 # Only add $xxx if it isn't already in ccdlflags.
8326                 case " $ccdlflags " in
8327                 *" $xxx "*)     ;;
8328                 *)      ccdlflags="$ccdlflags $xxx"
8329                         cat <<EOM >&4
8330
8331 Adding $xxx to the flags
8332 passed to $ld so that the perl executable will find the
8333 installed shared $libperl.
8334
8335 EOM
8336                         ;;
8337                 esac
8338                 ;;
8339         esac
8340 fi
8341 # Fix ccdlflags in AIX for building external extensions.
8342 # (For building Perl itself bare -bE:perl.exp is needed,
8343 #  Makefile.SH takes care of this.)
8344 case "$osname" in
8345 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8346 esac
8347 # Respect a hint or command-line value.
8348 case "$shrpenv" in
8349 '') shrpenv="$tmp_shrpenv" ;;
8350 esac
8351 case "$ldlibpthname" in
8352 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8353 none)   ldlibpthname='' ;;
8354 esac
8355
8356 : determine where manual pages are on this system
8357 echo " "
8358 case "$sysman" in
8359 '') 
8360         syspath='/usr/share/man/man1 /usr/man/man1'
8361         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8362         syspath="$syspath /usr/man/u_man/man1"
8363         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8364         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8365         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8366         sysman=`./loc . /usr/man/man1 $syspath`
8367         ;;
8368 esac
8369 if $test -d "$sysman"; then
8370         echo "System manual is in $sysman." >&4
8371 else
8372         echo "Could not find manual pages in source form." >&4
8373 fi
8374
8375 : determine where manual pages go
8376 set man1dir man1dir none
8377 eval $prefixit
8378 $cat <<EOM
8379
8380 $spackage has manual pages available in source form.
8381 EOM
8382 case "$nroff" in
8383 nroff)
8384         echo "However, you don't have nroff, so they're probably useless to you."
8385         case "$man1dir" in
8386         '') man1dir="none";;
8387         esac;;
8388 esac
8389 echo "If you don't want the manual sources installed, answer 'none'."
8390 case "$man1dir" in
8391 ' ') dflt=none
8392         ;;
8393 '')
8394         lookpath="$prefixexp/share/man/man1"
8395         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8396         lookpath="$lookpath $prefixexp/man/p_man/man1"
8397         lookpath="$lookpath $prefixexp/man/u_man/man1"
8398         lookpath="$lookpath $prefixexp/man/man.1"
8399         case "$sysman" in
8400         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8401         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8402         esac
8403         set dflt
8404         eval $prefixup
8405         ;;
8406 *)  dflt="$man1dir"
8407         ;;
8408 esac
8409 echo " "
8410 fn=dn+~
8411 rp="Where do the main $spackage manual pages (source) go?"
8412 . ./getfile
8413 if $test "X$man1direxp" != "X$ansexp"; then
8414         installman1dir=''
8415 fi
8416 prefixvar=man1dir
8417 . ./setprefixvar
8418
8419 case "$man1dir" in
8420 '')     man1dir=' '
8421         installman1dir='';;
8422 esac
8423
8424 : What suffix to use on installed man pages
8425
8426 case "$man1dir" in
8427 ' ')
8428         man1ext='0'
8429         ;;
8430 *)
8431         rp="What suffix should be used for the main $spackage man pages?"
8432         case "$man1ext" in
8433         '')     case "$man1dir" in
8434                 *1)  dflt=1 ;;
8435                 *1p) dflt=1p ;;
8436                 *1pm) dflt=1pm ;;
8437                 *l) dflt=l;;
8438                 *n) dflt=n;;
8439                 *o) dflt=o;;
8440                 *p) dflt=p;;
8441                 *C) dflt=C;;
8442                 *L) dflt=L;;
8443                 *L1) dflt=L1;;
8444                 *) dflt=1;;
8445                 esac
8446                 ;;
8447         *)      dflt="$man1ext";;
8448         esac
8449         . ./myread
8450         man1ext="$ans"
8451         ;;
8452 esac
8453
8454 : see if we can have long filenames
8455 echo " "
8456 first=123456789abcdef
8457 $rm -f $first
8458 if (echo hi >$first) 2>/dev/null; then
8459         if $test -f 123456789abcde; then
8460                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8461                 val="$undef"
8462         else
8463                 echo 'You can have filenames longer than 14 characters.'>&4
8464                 val="$define"
8465         fi
8466 else
8467         $cat <<'EOM'
8468 You can't have filenames longer than 14 chars.
8469 You can't even think about them!
8470 EOM
8471         val="$undef"
8472 fi
8473 set d_flexfnam
8474 eval $setvar
8475 $rm -rf 123456789abcde*
8476
8477 : determine where library module manual pages go
8478 set man3dir man3dir none
8479 eval $prefixit
8480 $cat <<EOM
8481
8482 $spackage has manual pages for many of the library modules.
8483 EOM
8484
8485 case "$nroff" in
8486 nroff)
8487         $cat <<'EOM'
8488 However, you don't have nroff, so they're probably useless to you.
8489 EOM
8490         case "$man3dir" in
8491         '') man3dir="none";;
8492         esac;;
8493 esac
8494
8495 case "$d_flexfnam" in
8496 undef)
8497         $cat <<'EOM'
8498 However, your system can't handle the long file names like File::Basename.3.
8499 EOM
8500         case "$man3dir" in
8501         '') man3dir="none";;
8502         esac;;
8503 esac
8504
8505 echo "If you don't want the manual sources installed, answer 'none'."
8506 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8507 case "$man3dir" in
8508 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8509         if $test -d "$privlib/man/man3"; then
8510                 cat <<EOM >&4
8511
8512 WARNING:  Previous versions of perl installed man3 pages into
8513 $privlib/man/man3.  This version will suggest a
8514 new default of $dflt.
8515 EOM
8516                 tdflt=$dflt
8517                 dflt='n'
8518                 rp='Do you wish to preserve the old behavior?(y/n)'
8519                 . ./myread
8520                 case "$ans" in
8521                 y*) dflt="$privlib/man/man3" ;;
8522                 *)  dflt=$tdflt ;;
8523                 esac
8524     fi
8525         ;;
8526 *)      dflt="$man3dir" ;;
8527 esac
8528 case "$dflt" in
8529 ' ') dflt=none ;;
8530 esac
8531 echo " "
8532 fn=dn+~
8533 rp="Where do the $package library man pages (source) go?"
8534 . ./getfile
8535 prefixvar=man3dir
8536 . ./setprefixvar
8537
8538 case "$man3dir" in
8539 '')     man3dir=' '
8540         installman3dir='';;
8541 esac
8542
8543 : What suffix to use on installed man pages
8544 case "$man3dir" in
8545 ' ')
8546         man3ext='0'
8547         ;;
8548 *)
8549         rp="What suffix should be used for the $package library man pages?"
8550         case "$man3ext" in
8551         '')     case "$man3dir" in
8552                 *3)  dflt=3 ;;
8553                 *3p) dflt=3p ;;
8554                 *3pm) dflt=3pm ;;
8555                 *l) dflt=l;;
8556                 *n) dflt=n;;
8557                 *o) dflt=o;;
8558                 *p) dflt=p;;
8559                 *C) dflt=C;;
8560                 *L) dflt=L;;
8561                 *L3) dflt=L3;;
8562                 *) dflt=3;;
8563                 esac
8564                 ;;
8565         *)      dflt="$man3ext";;
8566         esac
8567         . ./myread
8568         man3ext="$ans"
8569         ;;
8570 esac
8571
8572 : see if we have to deal with yellow pages, now NIS.
8573 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8574         if $test -f /usr/etc/nibindd; then
8575                 echo " "
8576                 echo "I'm fairly confident you're on a NeXT."
8577                 echo " "
8578                 rp='Do you get the hosts file via NetInfo?'
8579                 dflt=y
8580                 case "$hostcat" in
8581                 nidump*) ;;
8582                 '') ;;
8583                 *) dflt=n;;
8584                 esac
8585                 . ./myread
8586                 case "$ans" in
8587                 y*) hostcat='nidump hosts .';;
8588                 *)      case "$hostcat" in
8589                         nidump*) hostcat='';;
8590                         esac
8591                         ;;
8592                 esac
8593         fi
8594         case "$hostcat" in
8595         nidump*) ;;
8596         *)
8597                 case "$hostcat" in
8598                 *ypcat*) dflt=y;;
8599                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8600                                 dflt=y
8601                         else
8602                                 dflt=n
8603                         fi;;
8604                 *) dflt=n;;
8605                 esac
8606                 echo " "
8607                 rp='Are you getting the hosts file via yellow pages?'
8608                 . ./myread
8609                 case "$ans" in
8610                 y*) hostcat='ypcat hosts';;
8611                 *) hostcat='cat /etc/hosts';;
8612                 esac
8613                 ;;
8614         esac
8615 fi
8616 case "$hostcat" in
8617 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8618 esac
8619 case "$groupcat" in
8620 '') test -f /etc/group && groupcat='cat /etc/group';;
8621 esac
8622 case "$passcat" in
8623 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8624 esac
8625
8626 : now get the host name
8627 echo " "
8628 echo "Figuring out host name..." >&4
8629 case "$myhostname" in
8630 '') cont=true
8631         echo 'Maybe "hostname" will work...'
8632         if tans=`sh -c hostname 2>&1` ; then
8633                 myhostname=$tans
8634                 phostname=hostname
8635                 cont=''
8636         fi
8637         ;;
8638 *) cont='';;
8639 esac
8640 if $test "$cont"; then
8641         if ./xenix; then
8642                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8643                 if tans=`cat /etc/systemid 2>&1` ; then
8644                         myhostname=$tans
8645                         phostname='cat /etc/systemid'
8646                         echo "Whadyaknow.  Xenix always was a bit strange..."
8647                         cont=''
8648                 fi
8649         elif $test -r /etc/systemid; then
8650                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8651         fi
8652 fi
8653 if $test "$cont"; then
8654         echo 'No, maybe "uuname -l" will work...'
8655         if tans=`sh -c 'uuname -l' 2>&1` ; then
8656                 myhostname=$tans
8657                 phostname='uuname -l'
8658         else
8659                 echo 'Strange.  Maybe "uname -n" will work...'
8660                 if tans=`sh -c 'uname -n' 2>&1` ; then
8661                         myhostname=$tans
8662                         phostname='uname -n'
8663                 else
8664                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8665                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8666                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8667                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8668                         else
8669                                 case "$myhostname" in
8670                                 '') echo "Does this machine have an identity crisis or something?"
8671                                         phostname='';;
8672                                 *)
8673                                         echo "Well, you said $myhostname before..."
8674                                         phostname='echo $myhostname';;
8675                                 esac
8676                         fi
8677                 fi
8678         fi
8679 fi
8680 case "$myhostname" in
8681 '') myhostname=noname ;;
8682 esac
8683 : you do not want to know about this
8684 set $myhostname
8685 myhostname=$1
8686
8687 : verify guess
8688 if $test "$myhostname" ; then
8689         dflt=y
8690         rp='Your host name appears to be "'$myhostname'".'" Right?"
8691         . ./myread
8692         case "$ans" in
8693         y*) ;;
8694         *) myhostname='';;
8695         esac
8696 fi
8697
8698 : bad guess or no guess
8699 while $test "X$myhostname" = X ; do
8700         dflt=''
8701         rp="Please type the (one word) name of your host:"
8702         . ./myread
8703         myhostname="$ans"
8704 done
8705
8706 : translate upper to lower if necessary
8707 case "$myhostname" in
8708 *[A-Z]*)
8709         echo "(Normalizing case in your host name)"
8710         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8711         ;;
8712 esac
8713
8714 case "$myhostname" in
8715 *.*)
8716         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8717         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8718         echo "(Trimming domain name from host name--host name is now $myhostname)"
8719         ;;
8720 *) case "$mydomain" in
8721         '')
8722                 {
8723                         test "X$hostcat" = "Xypcat hosts" &&
8724                         ypmatch "$myhostname" hosts 2>/dev/null |\
8725                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8726                         $test -s hosts
8727                 } || {
8728                         test "X$hostcat" != "X" &&
8729                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8730                                         /[       ]$myhostname[  . ]/p" > hosts
8731                 }
8732                 tmp_re="[       . ]"
8733                 if $test -f hosts; then
8734                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8735                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8736                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8737                                 hosts | $sort | $uniq | \
8738                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8739                         case `$echo X$dflt` in
8740                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8741                                 dflt=.
8742                                 ;;
8743                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8744                                 ;;
8745                         esac
8746                 else
8747                         echo "(I cannot locate a hosts database anywhere)"
8748                         dflt=.
8749                 fi
8750                 case "$dflt" in
8751                 .)
8752                         tans=`./loc resolv.conf X /etc /usr/etc`
8753                         if $test -f "$tans"; then
8754                                 echo "(Attempting domain name extraction from $tans)"
8755                                 dflt=.`$sed -n -e 's/   / /g' \
8756                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8757                                   -e 1q 2>/dev/null`
8758                                 case "$dflt" in
8759                                 .) dflt=.`$sed -n -e 's/        / /g' \
8760                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8761                                      -e 1q 2>/dev/null`
8762                                         ;;
8763                                 esac
8764                         fi
8765                         ;;
8766                 esac
8767                 case "$dflt" in
8768                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8769                         dflt=.`sh -c domainname 2>/dev/null`
8770                         case "$dflt" in
8771                         '') dflt='.';;
8772                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8773                         esac
8774                         ;;
8775                 esac
8776                 case "$dflt$osname" in
8777                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8778                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8779                         ;;
8780                 esac
8781                 case "$dflt" in
8782                 .) echo "(Lost all hope -- silly guess then)"
8783                         dflt='.nonet'
8784                         ;;
8785                 esac
8786                 $rm -f hosts
8787                 ;;
8788         *) dflt="$mydomain";;
8789         esac;;
8790 esac
8791 echo " "
8792 rp="What is your domain name?"
8793 . ./myread
8794 tans="$ans"
8795 case "$ans" in
8796 '') ;;
8797 .*) ;;
8798 *) tans=".$tans";;
8799 esac
8800 mydomain="$tans"
8801
8802 : translate upper to lower if necessary
8803 case "$mydomain" in
8804 *[A-Z]*)
8805         echo "(Normalizing case in your domain name)"
8806         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8807         ;;
8808 esac
8809
8810 : a little sanity check here
8811 case "$phostname" in
8812 '') ;;
8813 *)
8814         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8815         $myhostname$mydomain|$myhostname) ;;
8816         *)
8817                 case "$phostname" in
8818                 sed*)
8819                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8820                         ;;
8821                 *)
8822                         echo "(That doesn't agree with your $phostname command, by the way.)"
8823                         ;;
8824                 esac
8825         ;;
8826         esac
8827         ;;
8828 esac
8829
8830 : determine the e-mail address of the user who is running us
8831 $cat <<EOM
8832
8833 I need to get your e-mail address in Internet format if possible, i.e.
8834 something like user@host.domain. Please answer accurately since I have
8835 no easy means to double check it. The default value provided below
8836 is most probably close to reality but may not be valid from outside
8837 your organization...
8838
8839 EOM
8840 cont=x
8841 while test "$cont"; do
8842         case "$cf_email" in
8843         '') dflt="$cf_by@$myhostname$mydomain";;
8844         *) dflt="$cf_email";;
8845         esac
8846         rp='What is your e-mail address?'
8847         . ./myread
8848         cf_email="$ans"
8849         case "$cf_email" in
8850         *@*.*) cont='' ;;
8851         *)
8852                 rp='Address does not look like an Internet one.  Use it anyway?'
8853                 case "$fastread" in
8854                 yes) dflt=y ;;
8855                 *) dflt=n ;;
8856                 esac
8857                 . ./myread
8858                 case "$ans" in
8859                 y*) cont='' ;;
8860                 *) echo " " ;;
8861                 esac
8862                 ;;
8863         esac
8864 done
8865
8866 : Ask e-mail of administrator
8867 $cat <<EOM
8868
8869 If you or somebody else will be maintaining perl at your site, please
8870 fill in the correct e-mail address here so that they may be contacted
8871 if necessary. Currently, the "perlbug" program included with perl
8872 will send mail to this address in addition to perlbug@perl.org. You may
8873 enter "none" for no administrator.
8874
8875 EOM
8876 case "$perladmin" in
8877 '') dflt="$cf_email";;
8878 *) dflt="$perladmin";;
8879 esac
8880 rp='Perl administrator e-mail address'
8881 . ./myread
8882 perladmin="$ans"
8883
8884 : determine whether to only install version-specific parts.
8885 echo " "
8886 $cat <<EOM
8887 Do you want to install only the version-specific parts of the perl
8888 distribution?  Usually you do *not* want to do this.
8889 EOM
8890 case "$versiononly" in
8891 "$define"|[Yy]*|true) dflt='y' ;;
8892 *) dflt='n';
8893 esac
8894 rp="Do you want to install only the version-specific parts of perl?"
8895 . ./myread
8896 case "$ans" in
8897 [yY]*)  val="$define";;
8898 *)      val="$undef" ;;
8899 esac
8900 set versiononly
8901 eval $setvar
8902
8903 case "$versiononly" in
8904 "$define") inc_version_list=''
8905            inc_version_list_init=0
8906            ;;
8907 esac
8908
8909 : figure out how to guarantee perl startup
8910 : XXX Note that this currently takes advantage of the bug that binexp ignores
8911 :     the Configure -Dinstallprefix setting, which in turn means that under
8912 :     relocatable @INC, initialinstalllocation is what binexp started as.
8913 case "$startperl" in
8914 '')
8915         case "$sharpbang" in
8916         *!)
8917                 $cat <<EOH
8918
8919 I can use the #! construct to start perl on your system. This will
8920 make startup of perl scripts faster, but may cause problems if you
8921 want to share those scripts and perl is not in a standard place
8922 ($initialinstalllocation/perl) on all your platforms. The alternative
8923 is to force a shell by starting the script with a single ':' character.
8924
8925 EOH
8926                 case "$versiononly" in
8927                 "$define")      dflt="$initialinstalllocation/perl$version";;
8928                 *)              dflt="$initialinstalllocation/perl";;
8929                 esac
8930                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8931                 . ./myread
8932                 case "$ans" in
8933                 none)   startperl=": # use perl";;
8934                 *)      startperl="#!$ans"
8935                         if $test 30 -lt `echo "$ans" | wc -c`; then
8936                                 $cat >&4 <<EOM
8937
8938 WARNING:  Some systems limit the #! command to 32 characters.
8939 If you experience difficulty running Perl scripts with #!, try
8940 installing Perl in a directory with a shorter pathname.
8941
8942 EOM
8943                         fi ;;
8944                 esac
8945                 ;;
8946         *) startperl=": # use perl"
8947                 ;;
8948         esac
8949         ;;
8950 esac
8951 echo "I'll use $startperl to start perl scripts."
8952
8953 : figure best path for perl in scripts
8954 case "$perlpath" in
8955 '')
8956         case "$versiononly" in
8957         "$define")      perlpath="$initialinstalllocation/perl$version";;
8958         *)              perlpath="$initialinstalllocation/perl";;
8959         esac
8960         case "$startperl" in
8961         *!*) ;;
8962         *)
8963                 $cat <<EOH
8964
8965 I will use the "eval 'exec'" idiom to start Perl on your system.
8966 I can use the full path of your Perl binary for this purpose, but
8967 doing so may cause problems if you want to share those scripts and
8968 Perl is not always in a standard place ($initialinstalllocation/perl).
8969
8970 EOH
8971                 dflt="$initialinstalllocation/perl"
8972                 rp="What path shall I use in \"eval 'exec'\"?"
8973                 . ./myread
8974                 perlpath="$ans"
8975                 ;;
8976         esac
8977         ;;
8978 esac
8979 case "$startperl" in
8980 *!*)    ;;
8981 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8982 esac
8983
8984 : determine where public executable scripts go
8985 set scriptdir scriptdir
8986 eval $prefixit
8987 case "$scriptdir" in
8988 '')
8989         dflt="$bin"
8990         : guess some guesses
8991         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8992         $test -d /usr/share/bin     && dflt=/usr/share/bin
8993         $test -d /usr/local/script  && dflt=/usr/local/script
8994         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8995         $test -d $prefixexp/script  && dflt=$prefixexp/script
8996         set dflt
8997         eval $prefixup
8998         ;;
8999 *)  dflt="$scriptdir"
9000         ;;
9001 esac
9002 $cat <<EOM
9003
9004 Some installations have a separate directory just for executable scripts so
9005 that they can mount it across multiple architectures but keep the scripts in
9006 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9007 Or you might just lump your scripts in with all your other executables.
9008
9009 EOM
9010 fn=d~
9011 rp='Where do you keep publicly executable scripts?'
9012 . ./getfile
9013 if $test "X$ansexp" != "X$scriptdirexp"; then
9014         installscript=''
9015 fi
9016 installscriptdir=''
9017 prefixvar=scriptdir
9018 . ./setprefixvar
9019 : A little fix up for an irregularly named variable.
9020 installscript="$installscriptdir"
9021
9022 : determine where add-on public executables go
9023 case "$sitebin" in
9024 '')     dflt=$siteprefix/bin ;;
9025 *)      dflt=$sitebin ;;
9026 esac
9027 fn=d~
9028 rp='Pathname where the add-on public executables should be installed?'
9029 . ./getfile
9030 prefixvar=sitebin
9031 . ./setprefixvar
9032
9033 : determine where add-on html pages go
9034 : There is no standard location, so try to copy the previously-selected
9035 : directory structure for the core html pages.
9036 case "$sitehtml1dir" in
9037 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9038 *)     dflt=$sitehtml1dir ;;
9039 esac
9040 case "$dflt" in
9041 ''|' ') dflt=none ;;
9042 esac
9043 fn=dn+~
9044 rp='Pathname where the site-specific html pages should be installed?'
9045 . ./getfile
9046 prefixvar=sitehtml1dir
9047 . ./setprefixvar
9048
9049 : determine where add-on library html pages go
9050 : There is no standard location, so try to copy the previously-selected
9051 : directory structure for the core html pages.
9052 case "$sitehtml3dir" in
9053 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9054 *)     dflt=$sitehtml3dir ;;
9055 esac
9056 case "$dflt" in
9057 ''|' ') dflt=none ;;
9058 esac
9059 fn=dn+~
9060 rp='Pathname where the site-specific library html pages should be installed?'
9061 . ./getfile
9062 prefixvar=sitehtml3dir
9063 . ./setprefixvar
9064
9065 : determine where add-on manual pages go
9066 case "$siteman1dir" in
9067 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9068 *)      dflt=$siteman1dir ;;
9069 esac
9070 case "$dflt" in
9071 ''|' ') dflt=none ;;
9072 esac
9073 fn=dn+~
9074 rp='Pathname where the site-specific manual pages should be installed?'
9075 . ./getfile
9076 prefixvar=siteman1dir
9077 . ./setprefixvar
9078
9079 : determine where add-on library man pages go
9080 case "$siteman3dir" in
9081 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9082 *)      dflt=$siteman3dir ;;
9083 esac
9084 case "$dflt" in
9085 ''|' ') dflt=none ;;
9086 esac
9087 fn=dn+~
9088 rp='Pathname where the site-specific library manual pages should be installed?'
9089 . ./getfile
9090 prefixvar=siteman3dir
9091 . ./setprefixvar
9092
9093 : determine where add-on public executable scripts go
9094 case "$sitescript" in
9095 '')     dflt=$siteprefix/script
9096         $test -d $dflt || dflt=$sitebin ;;
9097 *)  dflt="$sitescript" ;;
9098 esac
9099 fn=d~+
9100 rp='Pathname where add-on public executable scripts should be installed?'
9101 . ./getfile
9102 prefixvar=sitescript
9103 . ./setprefixvar
9104
9105 : Check if faststdio is requested and available
9106 case "$usefaststdio" in
9107 $define|true|[yY]*|'')
9108         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9109         case "$xversion" in
9110         [68])   dflt='y' ;;
9111         *)      dflt='n' ;;
9112         esac
9113         ;;
9114 *) dflt='n';;
9115 esac
9116 cat <<EOM
9117
9118 Perl can be built to use 'fast stdio', which means using the stdio
9119 library but also directly manipulating the stdio buffers to enable
9120 faster I/O.  Using stdio is better for backward compatibility (especially
9121 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9122 interface has been preferred instead of stdio.
9123
9124 If this doesn't make any sense to you, just accept the default '$dflt'.
9125 EOM
9126 rp='Use the "fast stdio" if available?'
9127 . ./myread
9128 case "$ans" in
9129 y|Y)    val="$define" ;;
9130 *)      val="$undef" ;;
9131 esac
9132 set usefaststdio
9133 eval $setvar
9134
9135
9136 : define an is-a-typedef? function
9137 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9138 case "$inclist" in
9139 "") inclist="sys/types.h";;
9140 esac;
9141 eval "varval=\$$var";
9142 case "$varval" in
9143 "")
9144         $rm -f temp.c;
9145         for inc in $inclist; do
9146                 echo "#include <$inc>" >>temp.c;
9147         done;
9148         echo "#ifdef $type" >> temp.c;
9149         echo "printf(\"We have $type\");" >> temp.c;
9150         echo "#endif" >> temp.c;
9151         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9152         if $contains $type temp.E >/dev/null 2>&1; then
9153                 eval "$var=\$type";
9154         else
9155                 eval "$var=\$def";
9156         fi;
9157         $rm -f temp.?;;
9158 *) eval "$var=\$varval";;
9159 esac'
9160
9161 : define an is-a-typedef? function that prompts if the type is not available.
9162 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9163 case "$inclist" in
9164 "") inclist="sys/types.h";;
9165 esac;
9166 eval "varval=\$$var";
9167 case "$varval" in
9168 "")
9169         $rm -f temp.c;
9170         for inc in $inclist; do
9171                 echo "#include <$inc>" >>temp.c;
9172         done;
9173         echo "#ifdef $type" >> temp.c;
9174         echo "printf(\"We have $type\");" >> temp.c;
9175         echo "#endif" >> temp.c;
9176         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9177         echo " " ;
9178         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9179         if $contains $type temp.E >/dev/null 2>&1; then
9180                 echo "$type found." >&4;
9181                 eval "$var=\$type";
9182         else
9183                 echo "$type NOT found." >&4;
9184                 dflt="$def";
9185                 . ./myread ;
9186                 eval "$var=\$ans";
9187         fi;
9188         $rm -f temp.?;;
9189 *) eval "$var=\$varval";;
9190 esac'
9191
9192 : see what type lseek is declared as in the kernel
9193 rp="What is the type used for lseek's offset on this system?"
9194 set off_t lseektype long stdio.h sys/types.h
9195 eval $typedef_ask
9196
9197 echo " "
9198 echo "Checking to see how big your file offsets are..." >&4
9199 $cat >try.c <<EOCP
9200 #include <sys/types.h>
9201 #include <stdio.h>
9202 int main()
9203 {
9204     printf("%d\n", (int)sizeof($lseektype));
9205     return(0);
9206 }
9207 EOCP
9208 set try
9209 if eval $compile_ok; then
9210         lseeksize=`$run ./try`
9211         echo "Your file offsets are $lseeksize bytes long."
9212 else
9213         dflt=$longsize
9214         echo " "
9215         echo "(I can't seem to compile the test program.  Guessing...)"
9216         rp="What is the size of your file offsets (in bytes)?"
9217         . ./myread
9218         lseeksize="$ans"
9219 fi
9220 $rm_try
9221
9222 : see what type file positions are declared as in the library
9223 rp="What is the type for file position used by fsetpos()?"
9224 set fpos_t fpostype long stdio.h sys/types.h
9225 eval $typedef_ask
9226
9227 : Check size for Fpos_t
9228 echo " "
9229 case "$fpostype" in
9230 *_t) zzz="$fpostype"    ;;
9231 *)   zzz="fpos_t"       ;;
9232 esac
9233 echo "Checking the size of $zzz..." >&4
9234 cat > try.c <<EOCP
9235 #include <sys/types.h>
9236 #include <stdio.h>
9237 #$i_stdlib I_STDLIB
9238 #ifdef I_STDLIB
9239 #include <stdlib.h>
9240 #endif
9241 int main() {
9242     printf("%d\n", (int)sizeof($fpostype));
9243     exit(0);
9244 }
9245 EOCP
9246 set try
9247 if eval $compile_ok; then
9248         yyy=`$run ./try`
9249         case "$yyy" in
9250         '')     fpossize=4
9251                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9252                 ;;
9253         *)      fpossize=$yyy
9254                 echo "Your $zzz is $fpossize bytes long."
9255                 ;;
9256         esac
9257 else
9258         dflt="$longsize"
9259         echo " " >&4
9260         echo "(I can't compile the test program.  Guessing...)" >&4
9261         rp="What is the size of your file positions (in bytes)?"
9262         . ./myread
9263         fpossize="$ans"
9264 fi
9265
9266 : Check for large file support
9267 # Backward compatibility (uselfs is deprecated).
9268 case "$uselfs" in
9269 "$define"|true|[yY]*)
9270         cat <<EOM >&4
9271
9272 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9273 EOM
9274         uselargefiles="$define"
9275         ;;
9276 esac
9277
9278 case "$lseeksize:$fpossize" in
9279 8:8) cat <<EOM
9280
9281 You can have files larger than 2 gigabytes.
9282 EOM
9283    val="$define" ;;
9284 *)    case "$uselargefiles" in
9285    "$undef"|false|[nN]*) dflt='n' ;;
9286    *)   dflt='y' ;;
9287    esac
9288    cat <<EOM
9289
9290 Perl can be built to understand large files (files larger than 2 gigabytes)
9291 on some systems.  To do so, Configure can be run with -Duselargefiles.
9292
9293 If this doesn't make any sense to you, just accept the default '$dflt'.
9294 EOM
9295    rp='Try to understand large files, if available?'
9296    . ./myread
9297    case "$ans" in
9298    y|Y)         val="$define" ;;
9299    *)           val="$undef"  ;;
9300    esac
9301    ;;
9302 esac
9303 set uselargefiles
9304 eval $setvar
9305 : Look for a hint-file generated 'call-back-unit'.  If the
9306 : user has specified that a large files perl is to be built,
9307 : we may need to set or change some other defaults.
9308 if $test -f uselargefiles.cbu; then
9309         echo "Your platform has some specific hints regarding large file builds, using them..."
9310         . ./uselargefiles.cbu
9311 fi
9312 case "$uselargefiles" in
9313 "$define")
9314         if $test -f uselargefiles.cbu; then
9315                 echo " "
9316                 echo "Rechecking to see how big your file offsets are..." >&4
9317                 $cat >try.c <<EOCP
9318 #include <sys/types.h>
9319 #include <stdio.h>
9320 int main()
9321 {
9322     printf("%d\n", (int)sizeof($lseektype));
9323     return(0);
9324 }
9325 EOCP
9326                 set try
9327                 if eval $compile_ok; then
9328                         lseeksize=`$run ./try`
9329                         $echo "Your file offsets are now $lseeksize bytes long."
9330                 else
9331                         dflt="$lseeksize"
9332                         echo " "
9333                         echo "(I can't seem to compile the test program.  Guessing...)"
9334                         rp="What is the size of your file offsets (in bytes)?"
9335                         . ./myread
9336                         lseeksize="$ans"
9337                 fi
9338                 case "$fpostype" in
9339                 *_t) zzz="$fpostype"    ;;
9340                 *)   zzz="fpos_t"       ;;
9341                 esac
9342                 $echo $n "Rechecking the size of $zzz...$c" >&4
9343                 $cat > try.c <<EOCP
9344 #include <sys/types.h>
9345 #include <stdio.h>
9346 #$i_stdlib I_STDLIB
9347 #ifdef I_STDLIB
9348 #include <stdlib.h>
9349 #endif
9350 int main() {
9351     printf("%d\n", (int)sizeof($fpostype));
9352     return(0);
9353 }
9354 EOCP
9355                 set try
9356                 if eval $compile_ok; then
9357                         yyy=`$run ./try`
9358                         dflt="$lseeksize"
9359                         case "$yyy" in
9360                         '')     echo " "
9361                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9362                                 ;;
9363                         *)      fpossize=$yyy
9364                                 echo " $fpossize bytes." >&4
9365                                 ;;
9366                         esac
9367                 else
9368                         dflt="$fpossize"
9369                         echo " "
9370                         echo "(I can't compile the test program.  Guessing...)" >&4
9371                         rp="What is the size of your file positions (in bytes)?"
9372                         . ./myread
9373                         fpossize="$ans"
9374                 fi
9375                 $rm_try
9376         fi
9377         ;;
9378 esac
9379
9380 : Check if we want perlio
9381 useperlio="$define"
9382
9383 : Set the vendorbin variables
9384 case "$vendorprefix" in
9385 '')     d_vendorbin="$undef"
9386         vendorbin=''
9387         vendorbinexp=''
9388         ;;
9389 *)      d_vendorbin="$define"
9390         : determine where vendor-supplied executables go.
9391         case "$vendorbin" in
9392         '') dflt=$vendorprefix/bin ;;
9393         *)      dflt="$vendorbin" ;;
9394         esac
9395         fn=d~+
9396         rp='Pathname for the vendor-supplied executables directory?'
9397         . ./getfile
9398         vendorbin="$ans"
9399         vendorbinexp="$ansexp"
9400         ;;
9401 esac
9402 prefixvar=vendorbin
9403 . ./installprefix
9404
9405 : Set the vendorhtml1dir variables
9406 case "$vendorprefix" in
9407 '')     vendorhtml1dir=''
9408         vendorhtml1direxp=''
9409         ;;
9410 *)      : determine where vendor-supplied html pages go.
9411         : There is no standard location, so try to copy the previously-selected
9412         : directory structure for the core html pages.
9413         : XXX Better default suggestions would be welcome.
9414         case "$vendorhtml1dir" in
9415         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9416         *)      dflt=$vendorhtml1dir ;;
9417         esac
9418         case "$dflt" in
9419         ''|' ') dflt=none ;;
9420         esac
9421         fn=dn+~
9422         rp='Pathname for the vendor-supplied html pages?'
9423         . ./getfile
9424         vendorhtml1dir="$ans"
9425         vendorhtml1direxp="$ansexp"
9426         ;;
9427 esac
9428 : Use ' ' for none so value is preserved next time through Configure
9429 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9430 prefixvar=vendorhtml1dir
9431 . ./installprefix
9432
9433 : Set the vendorhtml3dir variables
9434 case "$vendorprefix" in
9435 '')     vendorhtml3dir=''
9436         vendorhtml3direxp=''
9437         ;;
9438 *)      : determine where vendor-supplied module html pages go.
9439         : There is no standard location, so try to copy the previously-selected
9440         : directory structure for the core html pages.
9441         : XXX Better default suggestions would be welcome.
9442         case "$vendorhtml3dir" in
9443         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9444         *)      dflt=$vendorhtml3dir ;;
9445         esac
9446         case "$dflt" in
9447         ''|' ') dflt=none ;;
9448         esac
9449         fn=dn+~
9450         rp='Pathname for the vendor-supplied html pages?'
9451         . ./getfile
9452         vendorhtml3dir="$ans"
9453         vendorhtml3direxp="$ansexp"
9454         ;;
9455 esac
9456 : Use ' ' for none so value is preserved next time through Configure
9457 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9458 prefixvar=vendorhtml3dir
9459 . ./installprefix
9460
9461 : Set the vendorman1dir variables
9462 case "$vendorprefix" in
9463 '')     vendorman1dir=''
9464         vendorman1direxp=''
9465         ;;
9466 *)      : determine where vendor-supplied manual pages go.
9467         case "$vendorman1dir" in
9468         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9469         *)      dflt=$vendorman1dir ;;
9470         esac
9471         case "$dflt" in
9472         ''|' ') dflt=none ;;
9473         esac
9474         fn=nd~+
9475         rp='Pathname for the vendor-supplied manual section 1 pages?'
9476         . ./getfile
9477         vendorman1dir="$ans"
9478         vendorman1direxp="$ansexp"
9479         ;;
9480 esac
9481 : Use ' ' for none so value is preserved next time through Configure
9482 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9483 prefixvar=vendorman1dir
9484 . ./installprefix
9485
9486 : Set the vendorman3dir variables
9487 case "$vendorprefix" in
9488 '')     vendorman3dir=''
9489         vendorman3direxp=''
9490         ;;
9491 *)      : determine where vendor-supplied module manual pages go.
9492         case "$vendorman3dir" in
9493         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9494         *)      dflt=$vendorman3dir ;;
9495         esac
9496         case "$dflt" in
9497         ''|' ') dflt=none ;;
9498         esac
9499         fn=nd~+
9500         rp='Pathname for the vendor-supplied manual section 3 pages?'
9501         . ./getfile
9502         vendorman3dir="$ans"
9503         vendorman3direxp="$ansexp"
9504         ;;
9505 esac
9506 : Use ' ' for none so value is preserved next time through Configure
9507 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9508 prefixvar=vendorman3dir
9509 . ./installprefix
9510
9511 : Set the vendorscript variables
9512 case "$vendorprefix" in
9513 '')     d_vendorscript="$undef"
9514         vendorscript=''
9515         vendorscriptexp=''
9516         ;;
9517 *)      d_vendorscript="$define"
9518         : determine where vendor-supplied scripts go.
9519         case "$vendorscript" in
9520         '')     dflt=$vendorprefix/script
9521                 $test -d $dflt || dflt=$vendorbin ;;
9522         *)  dflt="$vendorscript" ;;
9523         esac
9524         $cat <<EOM
9525
9526 The installation process will create a directory for
9527 vendor-supplied scripts.
9528
9529 EOM
9530         fn=d~+
9531         rp='Pathname for the vendor-supplied scripts directory?'
9532         . ./getfile
9533         vendorscript="$ans"
9534         vendorscriptexp="$ansexp"
9535         ;;
9536 esac
9537 prefixvar=vendorscript
9538 . ./installprefix
9539
9540 : script used to emit important warnings
9541 cat >warn <<EOS
9542 $startsh
9543 if test \$# -gt 0; then
9544         echo "\$@" >msg
9545 else
9546         cat >msg
9547 fi
9548 echo "*** WARNING:" >&4
9549 sed -e 's/^/*** /' <msg >&4
9550 echo "*** " >&4
9551 cat msg >>config.msg
9552 echo " " >>config.msg
9553 rm -f msg
9554 EOS
9555 chmod +x warn
9556 $eunicefix warn
9557
9558 : see which of string.h or strings.h is needed
9559 echo " "
9560 strings=`./findhdr string.h`
9561 if $test "$strings" && $test -r "$strings"; then
9562         echo "Using <string.h> instead of <strings.h>." >&4
9563         val="$define"
9564 else
9565         val="$undef"
9566         strings=`./findhdr strings.h`
9567         if $test "$strings" && $test -r "$strings"; then
9568                 echo "Using <strings.h> instead of <string.h>." >&4
9569         else
9570                 ./warn "No string header found -- You'll surely have problems."
9571         fi
9572 fi
9573 set i_string
9574 eval $setvar
9575 case "$i_string" in
9576 "$undef") strings=`./findhdr strings.h`;;
9577 *)        strings=`./findhdr string.h`;;
9578 esac
9579
9580 : see if qgcvt exists
9581 set qgcvt d_qgcvt
9582 eval $inlibc
9583
9584 : Check print/scan long double stuff
9585 echo " "
9586
9587 if $test X"$d_longdbl" = X"$define"; then
9588
9589 echo "Checking how to print long doubles..." >&4
9590
9591 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9592         $cat >try.c <<'EOCP'
9593 #include <sys/types.h>
9594 #include <stdio.h>
9595 int main() {
9596   double d = 123.456;
9597   printf("%.3f\n", d);
9598 }
9599 EOCP
9600         set try
9601         if eval $compile; then
9602                 yyy=`$run ./try`
9603                 case "$yyy" in
9604                 123.456)
9605                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9606                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9607                         echo "We will use %f."
9608                         ;;
9609                 esac
9610         fi
9611 fi
9612
9613 if $test X"$sPRIfldbl" = X; then
9614         $cat >try.c <<'EOCP'
9615 #include <sys/types.h>
9616 #include <stdio.h>
9617 int main() {
9618   long double d = 123.456;
9619   printf("%.3Lf\n", d);
9620 }
9621 EOCP
9622         set try
9623         if eval $compile; then
9624                 yyy=`$run ./try`
9625                 case "$yyy" in
9626                 123.456)
9627                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9628                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9629                         echo "We will use %Lf."
9630                         ;;
9631                 esac
9632         fi
9633 fi
9634
9635 if $test X"$sPRIfldbl" = X; then
9636         $cat >try.c <<'EOCP'
9637 #include <sys/types.h>
9638 #include <stdio.h>
9639 int main() {
9640   long double d = 123.456;
9641   printf("%.3llf\n", d);
9642 }
9643 EOCP
9644         set try
9645         if eval $compile; then
9646                 yyy=`$run ./try`
9647                 case "$yyy" in
9648                 123.456)
9649                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9650                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9651                         echo "We will use %llf."
9652                         ;;
9653                 esac
9654         fi
9655 fi
9656
9657 if $test X"$sPRIfldbl" = X; then
9658         $cat >try.c <<'EOCP'
9659 #include <sys/types.h>
9660 #include <stdio.h>
9661 int main() {
9662   long double d = 123.456;
9663   printf("%.3lf\n", d);
9664 }
9665 EOCP
9666         set try
9667         if eval $compile; then
9668                 yyy=`$run ./try`
9669                 case "$yyy" in
9670                 123.456)
9671                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9672                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9673                         echo "We will use %lf."
9674                         ;;
9675                 esac
9676         fi
9677 fi
9678
9679 if $test X"$sPRIfldbl" = X; then
9680         echo "Cannot figure out how to print long doubles." >&4
9681 else
9682         sSCNfldbl=$sPRIfldbl    # expect consistency
9683 fi
9684
9685 $rm_try
9686
9687 fi # d_longdbl
9688
9689 case "$sPRIfldbl" in
9690 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9691         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9692         d_SCNfldbl="$undef";
9693         ;;
9694 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9695         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9696         d_SCNfldbl="$define";
9697         ;;
9698 esac
9699
9700 : Check how to convert floats to strings.
9701
9702 if test "X$d_Gconvert" = X; then
9703
9704 echo " "
9705 echo "Checking for an efficient way to convert floats to strings."
9706 echo " " > try.c
9707 case "$uselongdouble" in
9708 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9709 esac
9710 case "$d_longdbl" in
9711 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9712 esac
9713 case "$d_PRIgldbl" in
9714 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9715 esac
9716 $cat >>try.c <<EOP
9717 #ifdef TRY_gconvert
9718 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9719 char *myname = "gconvert";
9720 #endif
9721 #ifdef TRY_gcvt
9722 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9723 char *myname = "gcvt";
9724 #endif
9725 #ifdef TRY_qgcvt
9726 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9727 char *myname = "qgcvt";
9728 #define DOUBLETYPE long double
9729 #endif
9730 #ifdef TRY_sprintf
9731 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9732 #ifdef HAS_PRIgldbl
9733 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9734 #else
9735 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9736 #endif
9737 #else
9738 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9739 #endif
9740 char *myname = "sprintf";
9741 #endif
9742
9743 #ifndef DOUBLETYPE
9744 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9745 #define DOUBLETYPE long double
9746 #else
9747 #define DOUBLETYPE double
9748 #endif
9749 #endif
9750
9751 #include <stdio.h>
9752
9753 #$i_stdlib I_STDLIB
9754 #ifdef I_STDLIB
9755 #include <stdlib.h>
9756 #endif
9757 #$i_string I_STRING
9758 #ifdef I_STRING
9759 #  include <string.h>
9760 #else
9761 #  include <strings.h>
9762 #endif
9763
9764 int checkit(char *expect, char *got)
9765 {
9766     if (strcmp(expect, got)) {
9767                 printf("%s oddity:  Expected %s, got %s\n",
9768                         myname, expect, got);
9769                 exit(1);
9770         }
9771 }
9772
9773 int main()
9774 {
9775         char buf[64];
9776         buf[63] = '\0';
9777
9778         /* This must be 1st test on (which?) platform */
9779         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9780         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9781         checkit("0.1", buf);
9782
9783         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9784         checkit("0.01", buf);
9785
9786         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9787         checkit("0.001", buf);
9788
9789         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9790         checkit("0.0001", buf);
9791
9792         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9793         if (strlen(buf) > 5)
9794             checkit("9e-005", buf); /* for Microsoft ?? */
9795         else
9796             checkit("9e-05", buf);
9797
9798         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9799         checkit("1", buf);
9800
9801         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9802         checkit("1.1", buf);
9803
9804         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9805         checkit("1.01", buf);
9806
9807         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9808         checkit("1.001", buf);
9809
9810         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9811         checkit("1.0001", buf);
9812
9813         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9814         checkit("1.00001", buf);
9815
9816         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9817         checkit("1.000001", buf);
9818
9819         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9820         checkit("0", buf);
9821
9822         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9823         checkit("-1", buf);
9824
9825         /* Some Linux gcvt's give 1.e+5 here. */
9826         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9827         checkit("100000", buf);
9828
9829         /* Some Linux gcvt's give -1.e+5 here. */
9830         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9831         checkit("-100000", buf);
9832
9833         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9834         checkit("123.456", buf);
9835
9836         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9837         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9838         /* 34 should be enough to scare even long double
9839          * places into using the e notation. */
9840         if (strlen(buf) > 5)
9841             checkit("1e+034", buf); /* for Microsoft */
9842         else
9843             checkit("1e+34", buf);
9844
9845         /* For Perl, if you add additional tests here, also add them to
9846          * t/base/num.t for benefit of platforms not using Configure or
9847          * overriding d_Gconvert */
9848
9849         exit(0);
9850 }
9851 EOP
9852 : first add preferred functions to our list
9853 xxx_list=""
9854 for xxx_convert in $gconvert_preference; do
9855     case $xxx_convert in
9856     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9857     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9858     esac
9859 done
9860 : then add any others
9861 for xxx_convert in gconvert gcvt sprintf; do
9862     case "$xxx_list" in
9863     *$xxx_convert*) ;;
9864     *) xxx_list="$xxx_list $xxx_convert" ;;
9865     esac
9866 done
9867
9868 case "$d_longdbl$uselongdouble" in
9869 "$define$define")
9870     : again, add preferred functions to our list first
9871     xxx_ld_list=""
9872     for xxx_convert in $gconvert_ld_preference; do
9873         case $xxx_convert in
9874         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9875         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9876         esac
9877     done
9878     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9879     for xxx_convert in qgcvt sprintf $xxx_list; do
9880         case "$xxx_ld_list" in
9881         $xxx_convert*|*" $xxx_convert"*) ;;
9882         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9883         esac
9884     done
9885     : if sprintf cannot do long doubles, move it to the end
9886     if test "$d_PRIgldbl" != "$define"; then
9887         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9888     fi
9889     : if no qgcvt, remove it
9890     if test "$d_qgcvt" != "$define"; then
9891         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9892     fi
9893     : use the ld_list
9894     xxx_list="$xxx_ld_list"
9895     ;;
9896 esac
9897
9898 for xxx_convert in $xxx_list; do
9899         echo "Trying $xxx_convert..."
9900         $rm -f try try$_o core
9901         set try -DTRY_$xxx_convert
9902         if eval $compile; then
9903                 echo "$xxx_convert() found." >&4
9904                 if $run ./try; then
9905                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9906                         break;
9907                 else
9908                         echo "...But $xxx_convert didn't work as I expected."
9909                         xxx_convert=''
9910                 fi
9911         else
9912                 echo "$xxx_convert NOT found." >&4
9913         fi
9914 done
9915
9916 if test X$xxx_convert = X; then
9917     echo "*** WHOA THERE!!! ***" >&4
9918     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9919     xxx_convert=sprintf
9920 fi
9921
9922 case "$xxx_convert" in
9923 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9924 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9925 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9926 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9927    "$define$define$define")
9928       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9929    "$define$define$undef")
9930       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9931    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9932    esac
9933    ;;
9934 esac
9935
9936 fi
9937 $rm_try
9938
9939 : see if _fwalk exists
9940 set fwalk d__fwalk
9941 eval $inlibc
9942
9943 : Initialize h_fcntl
9944 h_fcntl=false
9945
9946 : Initialize h_sysfile
9947 h_sysfile=false
9948
9949 : access call always available on UNIX
9950 set access d_access
9951 eval $inlibc
9952
9953 : locate the flags for 'access()'
9954 case "$d_access" in
9955 "$define")
9956         echo " "
9957         $cat >access.c <<EOCP
9958 #include <sys/types.h>
9959 #ifdef I_FCNTL
9960 #include <fcntl.h>
9961 #endif
9962 #ifdef I_SYS_FILE
9963 #include <sys/file.h>
9964 #endif
9965 #ifdef I_UNISTD
9966 #include <unistd.h>
9967 #endif
9968 #$i_stdlib I_STDLIB
9969 #ifdef I_STDLIB
9970 #include <stdlib.h>
9971 #endif
9972 int main() {
9973         exit(R_OK);
9974 }
9975 EOCP
9976         : check sys/file.h first, no particular reason here
9977         if $test `./findhdr sys/file.h` && \
9978                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9979                 h_sysfile=true;
9980                 echo "<sys/file.h> defines the *_OK access constants." >&4
9981         elif $test `./findhdr fcntl.h` && \
9982                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9983                 h_fcntl=true;
9984                 echo "<fcntl.h> defines the *_OK access constants." >&4
9985         elif $test `./findhdr unistd.h` && \
9986                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9987                 echo "<unistd.h> defines the *_OK access constants." >&4
9988         else
9989                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9990         fi
9991         ;;
9992 esac
9993 $rm -f access*
9994
9995 : see if accessx exists
9996 set accessx d_accessx
9997 eval $inlibc
9998
9999 : see if aintl exists
10000 set aintl d_aintl
10001 eval $inlibc
10002
10003 : see if alarm exists
10004 set alarm d_alarm
10005 eval $inlibc
10006
10007 : see if 64bit time functions exists
10008
10009 set ctime64 d_ctime64
10010 eval $inlibc
10011
10012 set localtime64 d_localtime64
10013 eval $inlibc
10014
10015 set gmtime64 d_gmtime64
10016 eval $inlibc
10017
10018 set mktime64 d_mktime64
10019 eval $inlibc
10020
10021 set difftime64 d_difftime64
10022 eval $inlibc
10023
10024 set asctime64 d_asctime64
10025 eval $inlibc
10026
10027 : see if POSIX threads are available
10028 set pthread.h i_pthread
10029 eval $inhdr
10030
10031 : define a function to check prototypes
10032 $cat > protochk <<EOSH
10033 $startsh
10034 cc="$cc"
10035 optimize="$optimize"
10036 ccflags="$ccflags"
10037 prototype="$prototype"
10038 define="$define"
10039 rm_try="$rm_try"
10040 usethreads=$usethreads
10041 i_pthread=$i_pthread
10042 pthread_h_first=$pthread_h_first
10043 EOSH
10044
10045 $cat >> protochk <<'EOSH'
10046
10047 $rm_try
10048 foo="$1"
10049 shift
10050 while test $# -ge 2; do
10051         case "$1" in
10052                 $define) echo "#include <$2>" >> try.c ;;
10053                 literal) echo "$2" >> try.c ;;
10054         esac
10055     # Extra magic for the benefit of systems that need pthread.h
10056     # to be included early to correctly detect threadsafe functions.
10057     # Such functions must guarantee themselves, though, that the usethreads
10058     # and i_pthread have been defined, before calling protochk.
10059     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10060         echo "#include <pthread.h>" >> try.c
10061         pthread_h_done=yes
10062     fi
10063     shift 2
10064 done
10065 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10066 cat >> try.c <<'EOCP'
10067 #ifdef CAN_PROTOTYPE
10068 #define _(args) args
10069 #else
10070 #define _(args) ()
10071 #endif
10072 EOCP
10073 echo "$foo" >> try.c
10074 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10075 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10076 status=$?
10077 $rm_try
10078 exit $status
10079 EOSH
10080 chmod +x protochk
10081 $eunicefix protochk
10082
10083 : Define hasproto macro for Configure internal use
10084 hasproto='varname=$1; func=$2; shift; shift;
10085 while $test $# -ge 2; do
10086         case "$1" in
10087         $define) echo "#include <$2>";;
10088         esac ;
10089     shift 2;
10090 done > try.c;
10091 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10092 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10093         echo "$func() prototype found.";
10094         val="$define";
10095 else
10096         echo "$func() prototype NOT found.";
10097         val="$undef";
10098 fi;
10099 set $varname;
10100 eval $setvar;
10101 $rm_try tryout.c'
10102
10103 : see if sys/types.h has to be included
10104 set sys/types.h i_systypes
10105 eval $inhdr
10106
10107 : see if sys/select.h has to be included
10108 set sys/select.h i_sysselct
10109 eval $inhdr
10110
10111 : Define hasfield macro for Configure internal use
10112 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10113 while $test $# -ge 2; do
10114         case "$1" in
10115         $define) echo "#include <$2>";;
10116         esac ;
10117     shift 2;
10118 done > try.c;
10119 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10120 set try;
10121 if eval $compile; then
10122         val="$define";
10123 else
10124         val="$undef";
10125 fi;
10126 set $varname;
10127 eval $setvar;
10128 $rm_try'
10129
10130 : see if we should include time.h, sys/time.h, or both
10131 echo " "
10132 if test "X$timeincl" = X; then
10133         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10134         $echo $n "I'm now running the test program...$c"
10135         $cat >try.c <<EOCP
10136 #include <sys/types.h>
10137 #ifdef I_TIME
10138 #include <time.h>
10139 #endif
10140 #ifdef I_SYSTIME
10141 #ifdef SYSTIMEKERNEL
10142 #define KERNEL
10143 #endif
10144 #include <sys/time.h>
10145 #endif
10146 #ifdef I_SYSSELECT
10147 #include <sys/select.h>
10148 #endif
10149 #$i_stdlib I_STDLIB
10150 #ifdef I_STDLIB
10151 #include <stdlib.h>
10152 #endif
10153 int main()
10154 {
10155         struct tm foo;
10156 #ifdef S_TIMEVAL
10157         struct timeval bar;
10158 #endif
10159 #ifdef S_TIMEZONE
10160         struct timezone tzp;
10161 #endif
10162         if (foo.tm_sec == foo.tm_sec)
10163                 exit(0);
10164 #ifdef S_TIMEVAL
10165         if (bar.tv_sec == bar.tv_sec)
10166                 exit(0);
10167 #endif
10168         exit(1);
10169 }
10170 EOCP
10171         flags=''
10172         for s_timezone in '-DS_TIMEZONE' ''; do
10173         sysselect=''
10174         for s_timeval in '-DS_TIMEVAL' ''; do
10175         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10176         for i_time in '' '-DI_TIME'; do
10177         for i_systime in '-DI_SYSTIME' ''; do
10178                 case "$flags" in
10179                 '') $echo $n ".$c"
10180                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10181                         if eval $compile; then
10182                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10183                                 shift
10184                                 flags="$*"
10185                                 echo " "
10186                                 $echo $n "Succeeded with $flags$c"
10187                         fi
10188                         ;;
10189                 esac
10190         done
10191         done
10192         done
10193         done
10194         done
10195         timeincl=''
10196         echo " "
10197         case "$flags" in
10198         *SYSTIMEKERNEL*) i_systimek="$define"
10199                 timeincl=`./findhdr sys/time.h`
10200                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10201         *) i_systimek="$undef";;
10202         esac
10203         case "$flags" in
10204         *I_TIME*) i_time="$define"
10205                 timeincl=`./findhdr time.h`" $timeincl"
10206                 echo "We'll include <time.h>." >&4;;
10207         *) i_time="$undef";;
10208         esac
10209         case "$flags" in
10210         *I_SYSTIME*) i_systime="$define"
10211                 timeincl=`./findhdr sys/time.h`" $timeincl"
10212                 echo "We'll include <sys/time.h>." >&4;;
10213         *) i_systime="$undef";;
10214         esac
10215         $rm_try
10216 fi
10217 : see if struct tm knows about tm_zone
10218 case "$i_systime$i_time" in
10219 *$define*)
10220         echo " "
10221         echo "Checking to see if your struct tm has tm_zone field..." >&4
10222         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10223         eval $hasfield
10224         ;;
10225 *)      val="$undef"
10226         set d_tm_tm_zone
10227         eval $setvar
10228         ;;
10229 esac
10230 case "$d_tm_tm_zone" in
10231 "$define")      echo "Yes, it does."   ;;
10232 *)              echo "No, it doesn't." ;;
10233 esac
10234 : see if struct tm knows about tm_gmtoff
10235 case "$i_systime$i_time" in
10236 *$define*)
10237         echo " "
10238         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10239         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10240         eval $hasfield
10241         ;;
10242 *)      val="$undef"
10243         set d_tm_tm_gmtoff
10244         eval $setvar
10245         ;;
10246 esac
10247 case "$d_tm_tm_gmtoff" in
10248 "$define")      echo "Yes, it does."   ;;
10249 *)              echo "No, it doesn't." ;;
10250 esac
10251
10252 : see if asctime_r exists
10253 set asctime_r d_asctime_r
10254 eval $inlibc
10255 case "$d_asctime_r" in
10256 "$define")
10257         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10258         case "$d_asctime_r_proto:$usethreads" in
10259         ":define")      d_asctime_r_proto=define
10260                 set d_asctime_r_proto asctime_r $hdrs
10261                 eval $hasproto ;;
10262         *)      ;;
10263         esac
10264         case "$d_asctime_r_proto" in
10265         define)
10266         case "$asctime_r_proto" in
10267         ''|0) try='char* asctime_r(const struct tm*, char*);'
10268         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10269         esac
10270         case "$asctime_r_proto" in
10271         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10272         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10273         esac
10274         case "$asctime_r_proto" in
10275         ''|0) try='int asctime_r(const struct tm*, char*);'
10276         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10277         esac
10278         case "$asctime_r_proto" in
10279         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10280         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10281         esac
10282         case "$asctime_r_proto" in
10283         ''|0)   d_asctime_r=undef
10284                 asctime_r_proto=0
10285                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10286         * )     case "$asctime_r_proto" in
10287                 REENTRANT_PROTO*) ;;
10288                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10289                 esac
10290                 echo "Prototype: $try" ;;
10291         esac
10292         ;;
10293         *)      case "$usethreads" in
10294                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10295                 esac
10296                 d_asctime_r=undef
10297                 asctime_r_proto=0
10298                 ;;
10299         esac
10300         ;;
10301 *)      asctime_r_proto=0
10302         ;;
10303 esac
10304
10305 : see if atolf exists
10306 set atolf d_atolf
10307 eval $inlibc
10308
10309 : see if atoll exists
10310 set atoll d_atoll
10311 eval $inlibc
10312
10313 : Look for GCC-style attribute format
10314 case "$d_attribute_format" in
10315 '')
10316 echo " "
10317 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10318 $cat >attrib.c <<'EOCP'
10319 #include <stdio.h>
10320 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10321 EOCP
10322 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10323         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10324                 echo "Your C compiler doesn't support __attribute__((format))."
10325                 val="$undef"
10326         else
10327                 echo "Your C compiler supports __attribute__((format))."
10328                 val="$define"
10329         fi
10330 else
10331         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10332         val="$undef"
10333 fi
10334 ;;
10335 *) val="$d_attribute_format" ;;
10336 esac
10337 set d_attribute_format
10338 eval $setvar
10339 $rm -f attrib*
10340
10341 : Look for GCC-style attribute format with null format allowed
10342 case "$d_printf_format_null" in
10343 '') case "$d_attribute_format" in
10344     $define)
10345         echo " "
10346         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10347 $cat >attrib.c <<EOCP
10348 #include <stdio.h>
10349 #$i_stdlib I_STDLIB
10350 #ifdef I_STDLIB
10351 #include <stdlib.h>
10352 #endif
10353 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10354 int null_printf (char* pat,...) { return (int)pat; }
10355 int main () { exit(null_printf(NULL)); }
10356 EOCP
10357         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10358             : run the executable in case it produces a run-time warning
10359             if $run ./attrib >>attrib.out 2>&1; then
10360                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10361                     echo "Your C compiler doesn't allow __printf__ format to be null."
10362                     val="$undef"
10363                 else
10364                     echo "Your C compiler allows __printf__ format to be null."
10365                     val="$define"
10366                 fi
10367             else
10368             echo "Your C compiler executable failed with __printf__ format null."
10369             val="$undef"
10370         fi
10371     else
10372         echo "Your C compiler fails with __printf__ format null."
10373         val="$undef"
10374     fi
10375     ;;
10376     *)  val="$undef" ;;
10377     esac
10378 ;;
10379 *)  val="$d_printf_format_null" ;;
10380 esac
10381 set d_printf_format_null
10382 eval $setvar
10383 $rm -f attrib*
10384
10385 : Look for GCC-style attribute malloc
10386 case "$d_attribute_malloc" in
10387 '')
10388 echo " "
10389 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10390 $cat >attrib.c <<'EOCP'
10391 #include <stdio.h>
10392 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10393 EOCP
10394 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10395         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10396                 echo "Your C compiler doesn't support __attribute__((malloc))."
10397                 val="$undef"
10398         else
10399                 echo "Your C compiler supports __attribute__((malloc))."
10400                 val="$define"
10401         fi
10402 else
10403         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10404         val="$undef"
10405 fi
10406 ;;
10407 *) val="$d_attribute_malloc" ;;
10408 esac
10409 set d_attribute_malloc
10410 eval $setvar
10411 $rm -f attrib*
10412
10413 : Look for GCC-style attribute nonnull
10414 case "$d_attribute_nonnull" in
10415 '')
10416 echo " "
10417 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10418 $cat >attrib.c <<'EOCP'
10419 #include <stdio.h>
10420 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10421 EOCP
10422 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10423         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10424                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10425                 val="$undef"
10426         else
10427                 echo "Your C compiler supports __attribute__((nonnull))."
10428                 val="$define"
10429         fi
10430 else
10431         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10432         val="$undef"
10433 fi
10434 ;;
10435 *) val="$d_attribute_nonnull" ;;
10436 esac
10437 set d_attribute_nonnull
10438 eval $setvar
10439 $rm -f attrib*
10440
10441 : Look for GCC-style attribute noreturn
10442 case "$d_attribute_noreturn" in
10443 '')
10444 echo " "
10445 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10446 $cat >attrib.c <<'EOCP'
10447 #include <stdio.h>
10448 void fall_over_dead( void ) __attribute__((noreturn));
10449 EOCP
10450 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10451         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10452                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10453                 val="$undef"
10454         else
10455                 echo "Your C compiler supports __attribute__((noreturn))."
10456                 val="$define"
10457         fi
10458 else
10459         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10460         val="$undef"
10461 fi
10462 ;;
10463 *) val="$d_attribute_noreturn" ;;
10464 esac
10465 set d_attribute_noreturn
10466 eval $setvar
10467 $rm -f attrib*
10468
10469 : Look for GCC-style attribute pure
10470 case "$d_attribute_pure" in
10471 '')
10472 echo " "
10473 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10474 $cat >attrib.c <<'EOCP'
10475 #include <stdio.h>
10476 int square( int n ) __attribute__((pure));
10477 EOCP
10478 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10479         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10480                 echo "Your C compiler doesn't support __attribute__((pure))."
10481                 val="$undef"
10482         else
10483                 echo "Your C compiler supports __attribute__((pure))."
10484                 val="$define"
10485         fi
10486 else
10487         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10488         val="$undef"
10489 fi
10490 ;;
10491 *) val="$d_attribute_pure" ;;
10492 esac
10493 set d_attribute_pure
10494 eval $setvar
10495 $rm -f attrib*
10496
10497 : Look for GCC-style attribute unused
10498 case "$d_attribute_unused" in
10499 '')
10500 echo " "
10501 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10502 $cat >attrib.c <<'EOCP'
10503 #include <stdio.h>
10504 int do_something( int dummy __attribute__((unused)), int n );
10505 EOCP
10506 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10507         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10508                 echo "Your C compiler doesn't support __attribute__((unused))."
10509                 val="$undef"
10510         else
10511                 echo "Your C compiler supports __attribute__((unused))."
10512                 val="$define"
10513         fi
10514 else
10515         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10516         val="$undef"
10517 fi
10518 ;;
10519 *) val="$d_attribute_unused" ;;
10520 esac
10521 set d_attribute_unused
10522 eval $setvar
10523 $rm -f attrib*
10524
10525 : Look for GCC-style attribute deprecated
10526 case "$d_attribute_deprecated" in
10527 '')
10528 echo " "
10529 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10530 $cat >attrib.c <<'EOCP'
10531 #include <stdio.h>
10532 int I_am_deprecated(void) __attribute__((deprecated));
10533 EOCP
10534 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10535         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10536                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10537                 val="$undef"
10538         else
10539                 echo "Your C compiler supports __attribute__((deprecated))."
10540                 val="$define"
10541         fi
10542 else
10543         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10544         val="$undef"
10545 fi
10546 ;;
10547 *) val="$d_attribute_deprecated" ;;
10548 esac
10549 set d_attribute_deprecated
10550 eval $setvar
10551 $rm -f attrib*
10552
10553 : Look for GCC-style attribute warn_unused_result
10554 case "$d_attribute_warn_unused_result" in
10555 '')
10556 echo " "
10557 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10558 $cat >attrib.c <<'EOCP'
10559 #include <stdio.h>
10560 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10561 EOCP
10562 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10563         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10564                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10565                 val="$undef"
10566         else
10567                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10568                 val="$define"
10569         fi
10570 else
10571         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10572         val="$undef"
10573 fi
10574 ;;
10575 *) val="$d_attribute_warn_unused_result" ;;
10576 esac
10577 set d_attribute_warn_unused_result
10578 eval $setvar
10579 $rm -f attrib*
10580
10581 : see if bcmp exists
10582 set bcmp d_bcmp
10583 eval $inlibc
10584
10585 : see if bcopy exists
10586 set bcopy d_bcopy
10587 eval $inlibc
10588
10589 : see if getpgrp exists
10590 set getpgrp d_getpgrp
10591 eval $inlibc
10592
10593 case "$d_getpgrp" in
10594 "$define")
10595         echo " "
10596         echo "Checking to see which flavor of getpgrp is in use..."
10597         $cat >try.c <<EOP
10598 #$i_unistd I_UNISTD
10599 #include <sys/types.h>
10600 #ifdef I_UNISTD
10601 #  include <unistd.h>
10602 #endif
10603 #$i_stdlib I_STDLIB
10604 #ifdef I_STDLIB
10605 #include <stdlib.h>
10606 #endif
10607 int main()
10608 {
10609         if (getuid() == 0) {
10610                 printf("(I see you are running Configure as super-user...)\n");
10611                 setuid(1);
10612         }
10613 #ifdef TRY_BSD_PGRP
10614         if (getpgrp(1) == 0)
10615                 exit(0);
10616 #else
10617         if (getpgrp() > 0)
10618                 exit(0);
10619 #endif
10620         exit(1);
10621 }
10622 EOP
10623         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10624                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10625                 val="$define"
10626         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10627                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10628                 val="$undef"
10629         else
10630                 echo "I can't seem to compile and run the test program."
10631                 if ./usg; then
10632                         xxx="a USG one, i.e. you use getpgrp()."
10633                 else
10634                         # SVR4 systems can appear rather BSD-ish.
10635                         case "$i_unistd" in
10636                         $undef)
10637                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10638                                 val="$define"
10639                                 ;;
10640                         $define)
10641                                 xxx="probably a USG one, i.e. you use getpgrp()."
10642                                 val="$undef"
10643                                 ;;
10644                         esac
10645                 fi
10646                 echo "Assuming your getpgrp is $xxx" >&4
10647         fi
10648         ;;
10649 *) val="$undef";;
10650 esac
10651 set d_bsdgetpgrp
10652 eval $setvar
10653 $rm_try
10654
10655 : see if setpgrp exists
10656 set setpgrp d_setpgrp
10657 eval $inlibc
10658
10659 case "$d_setpgrp" in
10660 "$define")
10661         echo " "
10662         echo "Checking to see which flavor of setpgrp is in use..."
10663         $cat >try.c <<EOP
10664 #$i_unistd I_UNISTD
10665 #include <sys/types.h>
10666 #ifdef I_UNISTD
10667 #  include <unistd.h>
10668 #endif
10669 #$i_stdlib I_STDLIB
10670 #ifdef I_STDLIB
10671 #include <stdlib.h>
10672 #endif
10673 int main()
10674 {
10675         if (getuid() == 0) {
10676                 printf("(I see you are running Configure as super-user...)\n");
10677                 setuid(1);
10678         }
10679 #ifdef TRY_BSD_PGRP
10680         if (-1 == setpgrp(1, 1))
10681                 exit(0);
10682 #else
10683         if (setpgrp() != -1)
10684                 exit(0);
10685 #endif
10686         exit(1);
10687 }
10688 EOP
10689         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10690                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10691                 val="$define"
10692         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10693                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10694                 val="$undef"
10695         else
10696                 echo "(I can't seem to compile and run the test program.)"
10697                 if ./usg; then
10698                         xxx="a USG one, i.e. you use setpgrp()."
10699                 else
10700                         # SVR4 systems can appear rather BSD-ish.
10701                         case "$i_unistd" in
10702                         $undef)
10703                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10704                                 val="$define"
10705                                 ;;
10706                         $define)
10707                                 xxx="probably a USG one, i.e. you use setpgrp()."
10708                                 val="$undef"
10709                                 ;;
10710                         esac
10711                 fi
10712                 echo "Assuming your setpgrp is $xxx" >&4
10713         fi
10714         ;;
10715 *) val="$undef";;
10716 esac
10717 set d_bsdsetpgrp
10718 eval $setvar
10719 $rm_try
10720
10721 : Look for GCC-style __builtin_choose_expr
10722 case "$d_builtin_choose_expr" in
10723 '')
10724     echo " "
10725     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10726     $cat >try.c <<'EOCP'
10727 #include <assert.h>
10728 #include <stdlib.h>
10729 #include <stdio.h>
10730
10731 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10732
10733 int main(void) {
10734     assert( SYRINX(1) == 2112 );
10735     assert( SYRINX(1) != 5150 );
10736     assert( SYRINX(0) == 5150 );
10737     assert( SYRINX(0) != 2112 );
10738     puts( "All good!" );
10739     exit(0);
10740 }
10741
10742 EOCP
10743     set try
10744     if eval $compile && $run ./try; then
10745         echo "Your C compiler supports __builtin_choose_expr."
10746         val="$define"
10747     else
10748         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10749         val="$undef"
10750     fi
10751 ;;
10752 *) val="$d_builtin_choose_expr" ;;
10753 esac
10754
10755 set d_builtin_choose_expr
10756 eval $setvar
10757 $rm_try
10758
10759 : Look for GCC-style __builtin_expect
10760 case "$d_builtin_expect" in
10761 '')
10762     echo " "
10763     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10764     $cat >try.c <<'EOCP'
10765 int main(void) {
10766     int n = 50;
10767     if ( __builtin_expect(n, 0) ) n = 1;
10768     /* Remember shell exit code truth is 0, C truth is non-zero */
10769     return !(n == 1);
10770 }
10771 EOCP
10772     set try
10773     if eval $compile && $run ./try; then
10774         echo "Your C compiler supports __builtin_expect."
10775         val="$define"
10776     else
10777         echo "Your C compiler doesn't seem to understand __builtin_expect."
10778         val="$undef"
10779     fi
10780     ;;
10781 *) val="$d_builtin_expect" ;;
10782 esac
10783
10784 set d_builtin_expect
10785 eval $setvar
10786 $rm_try
10787
10788 : see if bzero exists
10789 set bzero d_bzero
10790 eval $inlibc
10791
10792 : see if stdarg is available
10793 echo " "
10794 if $test `./findhdr stdarg.h`; then
10795         echo "<stdarg.h> found." >&4
10796         valstd="$define"
10797 else
10798         echo "<stdarg.h> NOT found." >&4
10799         valstd="$undef"
10800 fi
10801
10802 : see if varags is available
10803 echo " "
10804 if $test `./findhdr varargs.h`; then
10805         echo "<varargs.h> found." >&4
10806 else
10807         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10808 fi
10809
10810 : set up the varargs testing programs
10811 $cat > varargs.c <<EOP
10812 #ifdef I_STDARG
10813 #include <stdarg.h>
10814 #endif
10815 #ifdef I_VARARGS
10816 #include <varargs.h>
10817 #endif
10818
10819 #ifdef I_STDARG
10820 int f(char *p, ...)
10821 #else
10822 int f(va_alist)
10823 va_dcl
10824 #endif
10825 {
10826         va_list ap;
10827 #ifndef I_STDARG
10828         char *p;
10829 #endif
10830 #ifdef I_STDARG
10831         va_start(ap,p);
10832 #else
10833         va_start(ap);
10834         p = va_arg(ap, char *);
10835 #endif
10836         va_end(ap);
10837         return 0;
10838 }
10839 EOP
10840 $cat > varargs <<EOP
10841 $startsh
10842 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10843         echo "true"
10844 else
10845         echo "false"
10846 fi
10847 $rm -f varargs$_o
10848 EOP
10849 chmod +x varargs
10850
10851 : now check which varargs header should be included
10852 echo " "
10853 i_varhdr=''
10854 case "$valstd" in
10855 "$define")
10856         if `./varargs I_STDARG`; then
10857                 val='stdarg.h'
10858         elif `./varargs I_VARARGS`; then
10859                 val='varargs.h'
10860         fi
10861         ;;
10862 *)
10863         if `./varargs I_VARARGS`; then
10864                 val='varargs.h'
10865         fi
10866         ;;
10867 esac
10868 case "$val" in
10869 '')
10870 echo "I could not find the definition for va_dcl... You have problems..." >&4
10871         val="$undef"; set i_stdarg; eval $setvar
10872         val="$undef"; set i_varargs; eval $setvar
10873         ;;
10874 *)
10875         set i_varhdr
10876         eval $setvar
10877         case "$i_varhdr" in
10878         stdarg.h)
10879                 val="$define"; set i_stdarg; eval $setvar
10880                 val="$undef"; set i_varargs; eval $setvar
10881                 ;;
10882         varargs.h)
10883                 val="$undef"; set i_stdarg; eval $setvar
10884                 val="$define"; set i_varargs; eval $setvar
10885                 ;;
10886         esac
10887         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10888 esac
10889 $rm -f varargs*
10890
10891 : see if the Compiler supports C99 variadic macros
10892 case "$i_stdarg$i_stdlib" in
10893     "$define$define")
10894     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10895     $cat >try.c <<EOCP
10896 #include <stdio.h>
10897 #include <stdarg.h>
10898
10899 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10900
10901 int main() {
10902   char buf[20];
10903   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10904   puts(buf);
10905   return 0;
10906 }
10907 EOCP
10908     set try
10909     if eval $compile && $run ./try 2>&1 >/dev/null; then
10910         case "`$run ./try`" in
10911             "123 456 789")
10912             echo "You have C99 variadic macros." >&4
10913             d_c99_variadic_macros="$define"
10914             ;;
10915             *)
10916             echo "You don't have functional C99 variadic macros." >&4
10917             d_c99_variadic_macros="$undef"
10918             ;;
10919         esac
10920     else
10921         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10922         d_c99_variadic_macros="$undef"
10923     fi
10924     $rm_try
10925     ;;
10926     *)
10927     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10928     d_c99_variadic_macros="$undef"
10929     ;;
10930 esac
10931
10932 : see if signal is declared as pointer to function returning int or void
10933 echo " "
10934 xxx=`./findhdr signal.h`
10935 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10936 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10937         echo "You have int (*signal())() instead of void." >&4
10938         val="$undef"
10939 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10940         echo "You have void (*signal())()." >&4
10941         val="$define"
10942 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10943         echo "You have int (*signal())() instead of void." >&4
10944         val="$undef"
10945 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10946         echo "You have void (*signal())()." >&4
10947         val="$define"
10948 else
10949         case "$d_voidsig" in
10950         '')
10951         echo "I can't determine whether signal handler returns void or int..." >&4
10952                 dflt=void
10953                 rp="What type does your signal handler return?"
10954                 . ./myread
10955                 case "$ans" in
10956                 v*) val="$define";;
10957                 *) val="$undef";;
10958                 esac;;
10959         "$define")
10960                 echo "As you already told me, signal handler returns void." >&4
10961                 val="$define"
10962                 ;;
10963         *)      echo "As you already told me, signal handler returns int." >&4
10964                 val="$undef"
10965                 ;;
10966         esac
10967 fi
10968 set d_voidsig
10969 eval $setvar
10970 case "$d_voidsig" in
10971 "$define") signal_t="void";;
10972 *) signal_t="int";;
10973 esac
10974 $rm -f $$.tmp
10975
10976 : check for ability to cast large floats to 32-bit ints.
10977 echo " "
10978 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10979 if $test "$intsize" -ge 4; then
10980         xxx=int
10981 else
10982         xxx=long
10983 fi
10984 $cat >try.c <<EOCP
10985 #include <stdio.h>
10986 #$i_stdlib I_STDLIB
10987 #ifdef I_STDLIB
10988 #include <stdlib.h>
10989 #endif
10990 #include <sys/types.h>
10991 #include <signal.h>
10992 $signal_t blech(int s) { exit(3); }
10993 int main()
10994 {
10995         $xxx i32;
10996         double f, g;
10997         int result = 0;
10998         char str[16];
10999         signal(SIGFPE, blech);
11000
11001         /* Don't let compiler optimize the test away.  Store the number
11002            in a writable string for gcc to pass to sscanf under HP-UX.
11003         */
11004         sprintf(str, "2147483647");
11005         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11006         g = 10 * f;
11007         i32  = ($xxx) g;
11008
11009         /* x86 processors will probably give 0x8000 0000, which is a
11010            sign change.  We don't want that.  We want to mimic SPARC
11011            behavior here, which is to preserve the sign and give
11012            back 0x7fff ffff.
11013         */
11014         if (i32 != ($xxx) f)
11015                 result |= 1;
11016         exit(result);
11017 }
11018 EOCP
11019 set try
11020 if eval $compile_ok; then
11021         $run ./try
11022         yyy=$?
11023 else
11024         echo "(I can't seem to compile the test program--assuming it can't)"
11025         yyy=1
11026 fi
11027 case "$yyy" in
11028 0)      val="$define"
11029         echo "Yup, it can."
11030         ;;
11031 *)      val="$undef"
11032         echo "Nope, it can't."
11033         ;;
11034 esac
11035 set d_casti32
11036 eval $setvar
11037 $rm_try
11038
11039 : check for ability to cast negative floats to unsigned
11040 echo " "
11041 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11042 $cat >try.c <<EOCP
11043 #include <stdio.h>
11044 #$i_stdlib I_STDLIB
11045 #ifdef I_STDLIB
11046 #include <stdlib.h>
11047 #endif
11048 #include <sys/types.h>
11049 #include <signal.h>
11050 $signal_t blech(int s) { exit(7); }
11051 $signal_t blech_in_list(int s) { exit(4); }
11052 unsigned long dummy_long(unsigned long p) { return p; }
11053 unsigned int dummy_int(unsigned int p) { return p; }
11054 unsigned short dummy_short(unsigned short p) { return p; }
11055 int main()
11056 {
11057         double f;
11058         unsigned long along;
11059         unsigned int aint;
11060         unsigned short ashort;
11061         int result = 0;
11062         char str[16];
11063
11064         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11065            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11066            optimized the whole file away
11067         */
11068         /* Store the number in a writable string for gcc to pass to
11069            sscanf under HP-UX.
11070         */
11071         sprintf(str, "-123");
11072         sscanf(str, "%lf", &f);  /* f = -123.; */
11073
11074         signal(SIGFPE, blech);
11075         along = (unsigned long)f;
11076         aint = (unsigned int)f;
11077         ashort = (unsigned short)f;
11078         if (along != (unsigned long)-123)
11079                 result |= 1;
11080         if (aint != (unsigned int)-123)
11081                 result |= 1;
11082         if (ashort != (unsigned short)-123)
11083                 result |= 1;
11084         sprintf(str, "1073741824.");
11085         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11086         f = f + f;
11087         along = 0;
11088         along = (unsigned long)f;
11089         if (along != 0x80000000)
11090                 result |= 2;
11091         f -= 1.;
11092         along = 0;
11093         along = (unsigned long)f;
11094         if (along != 0x7fffffff)
11095                 result |= 1;
11096         f += 2.;
11097         along = 0;
11098         along = (unsigned long)f;
11099         if (along != 0x80000001)
11100                 result |= 2;
11101         if (result)
11102                 exit(result);
11103         signal(SIGFPE, blech_in_list);
11104         sprintf(str, "123.");
11105         sscanf(str, "%lf", &f);  /* f = 123.; */
11106         along = dummy_long((unsigned long)f);
11107         aint = dummy_int((unsigned int)f);
11108         ashort = dummy_short((unsigned short)f);
11109         if (along != (unsigned long)123)
11110                 result |= 4;
11111         if (aint != (unsigned int)123)
11112                 result |= 4;
11113         if (ashort != (unsigned short)123)
11114                 result |= 4;
11115         exit(result);
11116
11117 }
11118 EOCP
11119 set try
11120 if eval $compile_ok; then
11121         $run ./try
11122         castflags=$?
11123 else
11124         echo "(I can't seem to compile the test program--assuming it can't)"
11125         castflags=7
11126 fi
11127 case "$castflags" in
11128 0)      val="$define"
11129         echo "Yup, it can."
11130         ;;
11131 *)      val="$undef"
11132         echo "Nope, it can't."
11133         ;;
11134 esac
11135 set d_castneg
11136 eval $setvar
11137 $rm_try
11138
11139 : see if vprintf exists
11140 echo " "
11141 if set vprintf val -f d_vprintf; eval $csym; $val; then
11142         echo 'vprintf() found.' >&4
11143         val="$define"
11144         $cat >try.c <<EOF
11145 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11146 #$i_varargs I_VARARGS
11147
11148 #$i_stdlib I_STDLIB
11149 #$i_unistd I_UNISTD
11150
11151 #ifdef I_STDARG
11152 #  include <stdarg.h>
11153 #else /* I_VARARGS */
11154 #  include <varargs.h>
11155 #endif
11156
11157 #ifdef I_UNISTD
11158 #  include <unistd.h>
11159 #endif
11160
11161 #ifdef I_STDLIB
11162 #  include <stdlib.h>
11163 #endif
11164
11165 #include <stdio.h> /* vsprintf prototype */
11166
11167 #ifdef I_STDARG
11168 void xxx(int n, ...)
11169 {
11170     va_list args;
11171     char buf[10];
11172     va_start(args, n);
11173     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11174 }
11175 int main() { xxx(1, "foo"); }
11176
11177 #else /* I_VARARGS */
11178
11179 xxx(va_alist)
11180 va_dcl
11181 {
11182     va_list args;
11183     char buf[10];
11184     va_start(args);
11185     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11186 }
11187 int main() { xxx("foo"); }
11188
11189 #endif
11190
11191 EOF
11192         set try
11193         if eval $compile_ok; then
11194                 if $run ./try; then
11195                         echo "Your vsprintf() returns (int)." >&4
11196                         val2="$undef"
11197                 else
11198                         echo "Your vsprintf() returns (char*)." >&4
11199                         val2="$define"
11200                 fi
11201         else
11202                 echo 'I am unable to compile the vsprintf() test program.' >&4
11203                 # We shouldn't get here.  If we do, assume the standard signature,
11204                 # not the old BSD one.
11205                 echo 'Guessing that vsprintf() returns (int).' >&4
11206                 val2="$undef"
11207         fi
11208 else
11209         echo 'vprintf() NOT found.' >&4
11210         val="$undef"
11211         val2="$undef"
11212 fi
11213 $rm_try
11214 set d_vprintf
11215 eval $setvar
11216 val=$val2
11217 set d_charvspr
11218 eval $setvar
11219
11220 : see if chown exists
11221 set chown d_chown
11222 eval $inlibc
11223
11224 : see if chroot exists
11225 set chroot d_chroot
11226 eval $inlibc
11227
11228 : see if chsize exists
11229 set chsize d_chsize
11230 eval $inlibc
11231
11232 : see if class exists
11233 set class d_class
11234 eval $inlibc
11235
11236 : see if clearenv exists
11237 set clearenv d_clearenv
11238 eval $inlibc
11239
11240 : Define hasstruct macro for Configure internal use
11241 hasstruct='varname=$1; struct=$2; shift; shift;
11242 while $test $# -ge 2; do
11243         case "$1" in
11244         $define) echo "#include <$2>";;
11245         esac ;
11246     shift 2;
11247 done > try.c;
11248 echo "int main () { struct $struct foo; }" >> try.c;
11249 set try;
11250 if eval $compile; then
11251         val="$define";
11252 else
11253         val="$undef";
11254 fi;
11255 set $varname;
11256 eval $setvar;
11257 $rm_try'
11258
11259 : see whether socket exists
11260 socketlib=''
11261 sockethdr=''
11262 echo " "
11263 $echo $n "Hmm... $c" >&4
11264 if set socket val -f d_socket; eval $csym; $val; then
11265         echo "Looks like you have Berkeley networking support." >&4
11266         d_socket="$define"
11267         if set setsockopt val -f; eval $csym; $val; then
11268                 d_oldsock="$undef"
11269         else
11270                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11271                 d_oldsock="$define"
11272         fi
11273 else
11274         if $contains socklib libc.list >/dev/null 2>&1; then
11275                 echo "Looks like you have Berkeley networking support." >&4
11276                 d_socket="$define"
11277                 : we will have to assume that it supports the 4.2 BSD interface
11278                 d_oldsock="$undef"
11279         else
11280                 echo "You don't have Berkeley networking in libc$_a..." >&4
11281                 if test "X$d_socket" = "X$define"; then
11282                    echo "...but you seem to believe that you have sockets." >&4
11283                 else
11284                         for net in net socket
11285                         do
11286                                 if test -f /usr/lib/lib$net$_a; then
11287                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11288                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11289                                         if $contains socket libc.list >/dev/null 2>&1; then
11290                                                 d_socket="$define"
11291                                                 socketlib="-l$net"
11292                                                 case "$net" in
11293                                                 net)
11294                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11295                                                         sockethdr="-I/usr/netinclude"
11296                                                         ;;
11297                                                 esac
11298                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11299                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11300                                                         d_oldsock="$undef"
11301                                                 else
11302                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11303                                                         d_oldsock="$define"
11304                                                 fi
11305                                                 break
11306                                         fi
11307                                 fi
11308                         done
11309                         if test "X$d_socket" != "X$define"; then
11310                            echo "or anywhere else I see." >&4
11311                            d_socket="$undef"
11312                            d_oldsock="$undef"
11313                         fi
11314                 fi
11315         fi
11316 fi
11317
11318 : see if socketpair exists
11319 set socketpair d_sockpair
11320 eval $inlibc
11321
11322
11323 echo " "
11324 echo "Checking the availability sa_len in the sock struct ..." >&4
11325 $cat >try.c <<EOF
11326 #include <sys/types.h>
11327 #include <sys/socket.h>
11328 int main() {
11329 struct sockaddr sa;
11330 return (sa.sa_len);
11331 }
11332 EOF
11333 val="$undef"
11334 set try; if eval $compile; then
11335         val="$define"
11336 fi
11337 set d_sockaddr_sa_len; eval $setvar
11338 $rm_try
11339
11340 echo " "
11341 echo "Checking the availability struct sockaddr_in6 ..." >&4
11342 $cat >try.c <<EOF
11343 #include <sys/types.h>
11344 #include <sys/socket.h>
11345 #include <netinet/in.h>
11346 int main() {
11347 struct sockaddr_in6 sin6;
11348 return (sin6.sin6_family);
11349 }
11350 EOF
11351 val="$undef"
11352 set try; if eval $compile; then
11353         val="$define"
11354 fi
11355 set d_sockaddr_in6; eval $setvar
11356 $rm_try
11357
11358 echo " "
11359 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11360 $cat >try.c <<EOF
11361 #include <sys/types.h>
11362 #include <sys/socket.h>
11363 #include <netinet/in.h>
11364 int main() {
11365 struct sockaddr_in6 sin6;
11366 return (sin6.sin6_scope_id);
11367 }
11368 EOF
11369 val="$undef"
11370 set try; if eval $compile; then
11371         val="$define"
11372 fi
11373 set d_sin6_scope_id; eval $setvar
11374 $rm_try
11375
11376 echo " "
11377 echo "Checking the availability struct ip_mreq ..." >&4
11378 $cat >try.c <<EOF
11379 #include <sys/types.h>
11380 #include <sys/socket.h>
11381 #include <netinet/in.h>
11382 int main() {
11383 struct ip_mreq mreq;
11384 return (mreq.imr_multiaddr.s_addr);
11385 }
11386 EOF
11387 val="$undef"
11388 set try; if eval $compile; then
11389        val="$define"
11390 fi
11391 set d_ip_mreq; eval $setvar
11392 $rm_try
11393
11394 echo " "
11395 echo "Checking the availability struct ip_mreq_source ..." >&4
11396 $cat >try.c <<EOF
11397 #include <sys/types.h>
11398 #include <sys/socket.h>
11399 #include <netinet/in.h>
11400 int main() {
11401 struct ip_mreq_source mreq;
11402 return (mreq.imr_multiaddr.s_addr);
11403 }
11404 EOF
11405 val="$undef"
11406 set try; if eval $compile; then
11407        val="$define"
11408 fi
11409 set d_ip_mreq_source; eval $setvar
11410 $rm_try
11411
11412 echo " "
11413 echo "Checking the availability struct ipv6_mreq ..." >&4
11414 $cat >try.c <<EOF
11415 #include <sys/types.h>
11416 #include <sys/socket.h>
11417 #include <netinet/in.h>
11418 int main() {
11419 struct ipv6_mreq mreq;
11420 return (mreq.ipv6mr_interface);
11421 }
11422 EOF
11423 val="$undef"
11424 set try; if eval $compile; then
11425         val="$define"
11426 fi
11427 set d_ipv6_mreq; eval $setvar
11428 $rm_try
11429
11430 echo " "
11431 echo "Checking the availability struct ipv6_mreq_source ..." >&4
11432 $cat >try.c <<EOF
11433 #include <sys/types.h>
11434 #include <sys/socket.h>
11435 #include <netinet/in.h>
11436 int main() {
11437 struct ipv6_mreq_source mreq;
11438 return (mreq.imr_multiaddr.s_addr);
11439 }
11440 EOF
11441 val="$undef"
11442 set try; if eval $compile; then
11443        val="$define"
11444 fi
11445 set d_ipv6_mreq_source; eval $setvar
11446 $rm_try
11447
11448 echo " "
11449 echo "Checking the availability of certain socket constants..." >&4
11450 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11451         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11452         $cat >try.c <<EOF
11453 #include <sys/types.h>
11454 #include <sys/socket.h>
11455 int main() {
11456     int i = $ENUM;
11457 }
11458 EOF
11459         val="$undef"
11460         set try; if eval $compile; then
11461                 val="$define"
11462         fi
11463         set d_${enum}; eval $setvar
11464         $rm_try
11465 done
11466
11467 : see if this is a sys/uio.h system
11468 set sys/uio.h i_sysuio
11469 eval $inhdr
11470
11471 : Check for cmsghdr support
11472 echo " "
11473 echo "Checking to see if your system supports struct cmsghdr..." >&4
11474 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11475 eval $hasstruct
11476 case "$d_cmsghdr_s" in
11477 "$define")      echo "Yes, it does."   ;;
11478 *)              echo "No, it doesn't." ;;
11479 esac
11480
11481
11482 : check for const keyword
11483 echo " "
11484 echo 'Checking to see if your C compiler knows about "const"...' >&4
11485 $cat >const.c <<'EOCP'
11486 typedef struct spug { int drokk; } spug;
11487 int main()
11488 {
11489         const char *foo;
11490         const spug y = { 0 };
11491 }
11492 EOCP
11493 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11494         val="$define"
11495         echo "Yup, it does."
11496 else
11497         val="$undef"
11498         echo "Nope, it doesn't."
11499 fi
11500 set d_const
11501 eval $setvar
11502
11503 : see if copysignl exists
11504 set copysignl d_copysignl
11505 eval $inlibc
11506
11507 : see if crypt exists
11508 echo " "
11509 set crypt d_crypt
11510 eval $inlibc
11511 case "$d_crypt" in
11512 $define) cryptlib='' ;;
11513 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11514                 echo 'crypt() found.' >&4
11515                 val="$define"
11516                 cryptlib=''
11517         else
11518                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11519                 if $test -z "$cryptlib"; then
11520                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11521                 else
11522                         cryptlib=-lcrypt
11523                 fi
11524                 if $test -z "$cryptlib"; then
11525                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11526                 else
11527                         cryptlib=-lcrypt
11528                 fi
11529                 if $test -z "$cryptlib"; then
11530                         cryptlib=`./loc libcrypt$_a "" $libpth`
11531                 else
11532                         cryptlib=-lcrypt
11533                 fi
11534                 if $test -z "$cryptlib"; then
11535                         echo 'crypt() NOT found.' >&4
11536                         val="$undef"
11537                 else
11538                         val="$define"
11539                 fi
11540         fi
11541         set d_crypt
11542         eval $setvar
11543         ;;
11544 esac
11545
11546 : see if this is a crypt.h system
11547 set crypt.h i_crypt
11548 eval $inhdr
11549
11550 : see if crypt_r exists
11551 set crypt_r d_crypt_r
11552 eval $inlibc
11553 case "$d_crypt_r" in
11554 "$define")
11555         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11556         case "$d_crypt_r_proto:$usethreads" in
11557         ":define")      d_crypt_r_proto=define
11558                 set d_crypt_r_proto crypt_r $hdrs
11559                 eval $hasproto ;;
11560         *)      ;;
11561         esac
11562         case "$d_crypt_r_proto" in
11563         define)
11564         case "$crypt_r_proto" in
11565         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11566         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11567         esac
11568         case "$crypt_r_proto" in
11569         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11570         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11571         esac
11572         case "$crypt_r_proto" in
11573         ''|0)   d_crypt_r=undef
11574                 crypt_r_proto=0
11575                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11576         * )     case "$crypt_r_proto" in
11577                 REENTRANT_PROTO*) ;;
11578                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11579                 esac
11580                 echo "Prototype: $try" ;;
11581         esac
11582         ;;
11583         *)      case "$usethreads" in
11584                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11585                 esac
11586                 d_crypt_r=undef
11587                 crypt_r_proto=0
11588                 ;;
11589         esac
11590         ;;
11591 *)      crypt_r_proto=0
11592         ;;
11593 esac
11594
11595 : get csh whereabouts
11596 case "$csh" in
11597 'csh') val="$undef" ;;
11598 *) val="$define" ;;
11599 esac
11600 set d_csh
11601 eval $setvar
11602 : Respect a hint or command line value for full_csh.
11603 case "$full_csh" in
11604 '') full_csh=$csh ;;
11605 esac
11606
11607 : see if ctermid exists
11608 set ctermid d_ctermid
11609 eval $inlibc
11610
11611 : see if ctermid_r exists
11612 set ctermid_r d_ctermid_r
11613 eval $inlibc
11614 case "$d_ctermid_r" in
11615 "$define")
11616         hdrs="$i_systypes sys/types.h define stdio.h "
11617         case "$d_ctermid_r_proto:$usethreads" in
11618         ":define")      d_ctermid_r_proto=define
11619                 set d_ctermid_r_proto ctermid_r $hdrs
11620                 eval $hasproto ;;
11621         *)      ;;
11622         esac
11623         case "$d_ctermid_r_proto" in
11624         define)
11625         case "$ctermid_r_proto" in
11626         ''|0) try='char* ctermid_r(char*);'
11627         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11628         esac
11629         case "$ctermid_r_proto" in
11630         ''|0)   d_ctermid_r=undef
11631                 ctermid_r_proto=0
11632                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11633         * )     case "$ctermid_r_proto" in
11634                 REENTRANT_PROTO*) ;;
11635                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11636                 esac
11637                 echo "Prototype: $try" ;;
11638         esac
11639         ;;
11640         *)      case "$usethreads" in
11641                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11642                 esac
11643                 d_ctermid_r=undef
11644                 ctermid_r_proto=0
11645                 ;;
11646         esac
11647         ;;
11648 *)      ctermid_r_proto=0
11649         ;;
11650 esac
11651
11652 : see if ctime_r exists
11653 set ctime_r d_ctime_r
11654 eval $inlibc
11655 case "$d_ctime_r" in
11656 "$define")
11657         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11658         case "$d_ctime_r_proto:$usethreads" in
11659         ":define")      d_ctime_r_proto=define
11660                 set d_ctime_r_proto ctime_r $hdrs
11661                 eval $hasproto ;;
11662         *)      ;;
11663         esac
11664         case "$d_ctime_r_proto" in
11665         define)
11666         case "$ctime_r_proto" in
11667         ''|0) try='char* ctime_r(const time_t*, char*);'
11668         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11669         esac
11670         case "$ctime_r_proto" in
11671         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11672         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11673         esac
11674         case "$ctime_r_proto" in
11675         ''|0) try='int ctime_r(const time_t*, char*);'
11676         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11677         esac
11678         case "$ctime_r_proto" in
11679         ''|0) try='int ctime_r(const time_t*, char*, int);'
11680         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11681         esac
11682         case "$ctime_r_proto" in
11683         ''|0)   d_ctime_r=undef
11684                 ctime_r_proto=0
11685                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11686         * )     case "$ctime_r_proto" in
11687                 REENTRANT_PROTO*) ;;
11688                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11689                 esac
11690                 echo "Prototype: $try" ;;
11691         esac
11692         ;;
11693         *)      case "$usethreads" in
11694                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11695                 esac
11696                 d_ctime_r=undef
11697                 ctime_r_proto=0
11698                 ;;
11699         esac
11700         ;;
11701 *)      ctime_r_proto=0
11702         ;;
11703 esac
11704
11705 : see if cuserid exists
11706 set cuserid d_cuserid
11707 eval $inlibc
11708
11709 : see if this is a limits.h system
11710 set limits.h i_limits
11711 eval $inhdr
11712
11713 : see if this is a float.h system
11714 set float.h i_float
11715 eval $inhdr
11716
11717 : See if number of significant digits in a double precision number is known
11718 echo " "
11719 $cat >dbl_dig.c <<EOM
11720 #$i_limits I_LIMITS
11721 #$i_float I_FLOAT
11722 #ifdef I_LIMITS
11723 #include <limits.h>
11724 #endif
11725 #ifdef I_FLOAT
11726 #include <float.h>
11727 #endif
11728 #ifdef DBL_DIG
11729 printf("Contains DBL_DIG");
11730 #endif
11731 EOM
11732 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11733 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11734         echo "DBL_DIG found." >&4
11735         val="$define"
11736 else
11737         echo "DBL_DIG NOT found." >&4
11738         val="$undef"
11739 fi
11740 $rm -f dbl_dig.?
11741 set d_dbl_dig
11742 eval $setvar
11743
11744 : see if dbm.h is available
11745 : see if dbmclose exists
11746 set dbmclose d_dbmclose
11747 eval $inlibc
11748
11749 case "$d_dbmclose" in
11750 $define)
11751         set dbm.h i_dbm
11752         eval $inhdr
11753         case "$i_dbm" in
11754         $define)
11755                 val="$undef"
11756                 set i_rpcsvcdbm
11757                 eval $setvar
11758                 ;;
11759         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11760                 eval $inhdr
11761                 ;;
11762         esac
11763         ;;
11764 *)      echo "We won't be including <dbm.h>"
11765         val="$undef"
11766         set i_dbm
11767         eval $setvar
11768         val="$undef"
11769         set i_rpcsvcdbm
11770         eval $setvar
11771         ;;
11772 esac
11773
11774 : see if prototype for dbminit is available
11775 echo " "
11776 set d_dbminitproto dbminit $i_dbm dbm.h
11777 eval $hasproto
11778
11779 : see if difftime exists
11780 set difftime d_difftime
11781 eval $inlibc
11782
11783 : see if this is a dirent system
11784 echo " "
11785 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11786         val="$define"
11787         echo "<dirent.h> found." >&4
11788 else
11789         val="$undef"
11790         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11791                 echo "<sys/dir.h> found." >&4
11792                 echo " "
11793         else
11794                 xinc=`./findhdr sys/ndir.h`
11795         fi
11796         echo "<dirent.h> NOT found." >&4
11797 fi
11798 set i_dirent
11799 eval $setvar
11800
11801 : Look for type of directory structure.
11802 echo " "
11803 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11804
11805 case "$direntrytype" in
11806 ''|' ')
11807         case "$i_dirent" in
11808         $define) guess1='struct dirent' ;;
11809         *) guess1='struct direct'  ;;
11810         esac
11811         ;;
11812 *)      guess1="$direntrytype"
11813         ;;
11814 esac
11815
11816 case "$guess1" in
11817 'struct dirent') guess2='struct direct' ;;
11818 *) guess2='struct dirent' ;;
11819 esac
11820
11821 if $contains "$guess1" try.c >/dev/null 2>&1; then
11822         direntrytype="$guess1"
11823         echo "Your directory entries are $direntrytype." >&4
11824 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11825         direntrytype="$guess2"
11826         echo "Your directory entries seem to be $direntrytype." >&4
11827 else
11828         echo "I don't recognize your system's directory entries." >&4
11829         rp="What type is used for directory entries on this system?"
11830         dflt="$guess1"
11831         . ./myread
11832         direntrytype="$ans"
11833 fi
11834 $rm_try
11835
11836 : see if the directory entry stores field length
11837 echo " "
11838 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11839 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11840         echo "Good, your directory entry keeps length information in d_namlen." >&4
11841         val="$define"
11842 else
11843         echo "Your directory entry does not know about the d_namlen field." >&4
11844         val="$undef"
11845 fi
11846 set d_dirnamlen
11847 eval $setvar
11848 $rm_try
11849
11850 : Look for DIR.dd_fd
11851 case "$i_dirent" in
11852 "$define")
11853     echo "Checking to see if DIR has a dd_fd member variable" >&4
11854     $cat >try.c <<EOCP
11855 #$i_stdlib I_STDLIB
11856 #ifdef I_STDLIB
11857 #include <stdlib.h>
11858 #endif
11859 #include <dirent.h>
11860
11861 int main() {
11862     DIR dir;
11863     dir.dd_fd = 1;
11864     return 0;
11865 }
11866 EOCP
11867     val=$undef
11868     set try
11869     if eval $compile; then
11870         echo "Yes, it does."
11871         val="$define"
11872     else
11873         echo "No, it does not."
11874         val="$undef"
11875     fi
11876     ;;
11877 *)
11878     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11879     val="$undef"
11880     ;;
11881 esac
11882 set d_dir_dd_fd
11883 eval $setvar
11884 $rm_try
11885
11886 : see if this is an sysdir system
11887 set sys/dir.h i_sysdir
11888 eval $inhdr
11889
11890 : see if this is an sysndir system
11891 set sys/ndir.h i_sysndir
11892 eval $inhdr
11893
11894 : Look for dirfd
11895 echo " "
11896 $cat >dirfd.c <<EOM
11897 #include <stdio.h>
11898 #$i_stdlib I_STDLIB
11899 #ifdef I_STDLIB
11900 #include <stdlib.h>
11901 #endif
11902 #$i_dirent I_DIRENT             /**/
11903 #$i_sysdir I_SYS_DIR            /**/
11904 #$i_sysndir I_SYS_NDIR          /**/
11905 #$i_systypes I_SYS_TYPES        /**/
11906 #if defined(I_SYS_TYPES)
11907 #include <sys/types.h>
11908 #endif
11909 #if defined(I_DIRENT)
11910 #include <dirent.h>
11911 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11912 #include <sys/dir.h>
11913 #endif
11914 #else
11915 #ifdef I_SYS_NDIR
11916 #include <sys/ndir.h>
11917 #else
11918 #ifdef I_SYS_DIR
11919 #ifdef hp9000s500
11920 #include <ndir.h>       /* may be wrong in the future */
11921 #else
11922 #include <sys/dir.h>
11923 #endif
11924 #endif
11925 #endif
11926 #endif 
11927 int main() {
11928         DIR *dirp = opendir(".");
11929         if (dirfd(dirp) >= 0)
11930                 exit(0);
11931         else
11932                 exit(1);
11933 }
11934 EOM
11935 val=$undef
11936 set dirfd
11937 if eval $compile; then
11938         val="$define"
11939 fi
11940 case "$val" in
11941 $define)        echo "dirfd() found." >&4       ;;
11942 *)              echo "dirfd() NOT found." >&4   ;;
11943 esac
11944 set d_dirfd
11945 eval $setvar
11946 $rm -f dirfd*
11947
11948 : see if dlerror exists
11949 xxx_runnm="$runnm"
11950 runnm=false
11951 set dlerror d_dlerror
11952 eval $inlibc
11953 runnm="$xxx_runnm"
11954
11955 : see if dlfcn is available
11956 set dlfcn.h i_dlfcn
11957 eval $inhdr
11958
11959 : Check what extension to use for shared libs
11960 case "$usedl" in
11961 $define|y|true)
11962         $cat << EOM
11963
11964 On a few systems, the dynamically loaded modules that perl generates and uses
11965 will need a different extension than shared libs. The default will probably
11966 be appropriate.
11967
11968 EOM
11969         case "$dlext" in
11970         '')     dflt="$so" ;;
11971         *)      dflt="$dlext" ;;
11972         esac
11973         rp='What is the extension of dynamically loaded modules'
11974         . ./myread
11975         dlext="$ans"
11976         ;;
11977 *)
11978         dlext="none"
11979         ;;
11980 esac
11981
11982 : Check if dlsym need a leading underscore
11983 echo " "
11984 val="$undef"
11985
11986 case "$dlsrc" in
11987 dl_dlopen.xs)
11988         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11989         $cat >dyna.c <<'EOM'
11990 fred () { }
11991 EOM
11992
11993 $cat >fred.c<<EOM
11994
11995 #include <stdio.h>
11996 #$i_stdlib I_STDLIB
11997 #ifdef I_STDLIB
11998 #include <stdlib.h>
11999 #endif
12000 #$i_dlfcn I_DLFCN
12001 #ifdef I_DLFCN
12002 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12003 #else
12004 #include <sys/types.h>
12005 #include <nlist.h>
12006 #include <link.h>
12007 #endif
12008
12009 extern int fred() ;
12010
12011 int main()
12012 {
12013     void * handle ;
12014     void * symbol ;
12015 #ifndef RTLD_LAZY
12016     int mode = 1 ;
12017 #else
12018     int mode = RTLD_LAZY ;
12019 #endif
12020     handle = dlopen("./dyna.$dlext", mode) ;
12021     if (handle == NULL) {
12022         printf ("1\n") ;
12023         fflush (stdout) ;
12024         exit(0);
12025     }
12026     symbol = dlsym(handle, "fred") ;
12027     if (symbol == NULL) {
12028         /* try putting a leading underscore */
12029         symbol = dlsym(handle, "_fred") ;
12030         if (symbol == NULL) {
12031             printf ("2\n") ;
12032             fflush (stdout) ;
12033             exit(0);
12034         }
12035         printf ("3\n") ;
12036     }
12037     else
12038         printf ("4\n") ;
12039     fflush (stdout) ;
12040     exit(0);
12041 }
12042 EOM
12043         : Call the object file tmp-dyna.o in case dlext=o.
12044         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12045                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12046                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12047                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12048                 xxx=`$run ./fred`
12049                 case $xxx in
12050                 1)      echo "Test program failed using dlopen." >&4
12051                         echo "Perhaps you should not use dynamic loading." >&4;;
12052                 2)      echo "Test program failed using dlsym." >&4
12053                         echo "Perhaps you should not use dynamic loading." >&4;;
12054                 3)      echo "dlsym needs a leading underscore" >&4
12055                         val="$define" ;;
12056                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12057                 esac
12058         else
12059                 echo "I can't compile and run the test program." >&4
12060                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12061         fi
12062         ;;
12063 esac
12064
12065 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12066
12067 set d_dlsymun
12068 eval $setvar
12069
12070 : see if drand48_r exists
12071 set drand48_r d_drand48_r
12072 eval $inlibc
12073 case "$d_drand48_r" in
12074 "$define")
12075         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12076         case "$d_drand48_r_proto:$usethreads" in
12077         ":define")      d_drand48_r_proto=define
12078                 set d_drand48_r_proto drand48_r $hdrs
12079                 eval $hasproto ;;
12080         *)      ;;
12081         esac
12082         case "$d_drand48_r_proto" in
12083         define)
12084         case "$drand48_r_proto" in
12085         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12086         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12087         esac
12088         case "$drand48_r_proto" in
12089         ''|0)   d_drand48_r=undef
12090                 drand48_r_proto=0
12091                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12092         * )     case "$drand48_r_proto" in
12093                 REENTRANT_PROTO*) ;;
12094                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12095                 esac
12096                 echo "Prototype: $try" ;;
12097         esac
12098         ;;
12099         *)      case "$usethreads" in
12100                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12101                 esac
12102                 d_drand48_r=undef
12103                 drand48_r_proto=0
12104                 ;;
12105         esac
12106         ;;
12107 *)      drand48_r_proto=0
12108         ;;
12109 esac
12110
12111 : see if prototype for drand48 is available
12112 echo " "
12113 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12114 eval $hasproto
12115
12116 : see if dup2 exists
12117 set dup2 d_dup2
12118 eval $inlibc
12119
12120 : see if eaccess exists
12121 set eaccess d_eaccess
12122 eval $inlibc
12123
12124 : see if endgrent exists
12125 set endgrent d_endgrent
12126 eval $inlibc
12127
12128 : see if this is an grp system
12129 set grp.h i_grp
12130 eval $inhdr
12131
12132 case "$i_grp" in
12133 $define)
12134         xxx=`./findhdr grp.h`
12135         $cppstdin $cppflags $cppminus < $xxx >$$.h
12136
12137         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12138                 val="$define"
12139         else
12140                 val="$undef"
12141         fi
12142         set d_grpasswd
12143         eval $setvar
12144
12145         $rm -f $$.h
12146         ;;
12147 *)
12148         val="$undef";
12149         set d_grpasswd; eval $setvar
12150         ;;
12151 esac
12152
12153 : see if endgrent_r exists
12154 set endgrent_r d_endgrent_r
12155 eval $inlibc
12156 case "$d_endgrent_r" in
12157 "$define")
12158         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12159         case "$d_endgrent_r_proto:$usethreads" in
12160         ":define")      d_endgrent_r_proto=define
12161                 set d_endgrent_r_proto endgrent_r $hdrs
12162                 eval $hasproto ;;
12163         *)      ;;
12164         esac
12165         case "$d_endgrent_r_proto" in
12166         define)
12167         case "$endgrent_r_proto" in
12168         ''|0) try='int endgrent_r(FILE**);'
12169         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12170         esac
12171         case "$endgrent_r_proto" in
12172         ''|0) try='void endgrent_r(FILE**);'
12173         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12174         esac
12175         case "$endgrent_r_proto" in
12176         ''|0)   d_endgrent_r=undef
12177                 endgrent_r_proto=0
12178                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12179         * )     case "$endgrent_r_proto" in
12180                 REENTRANT_PROTO*) ;;
12181                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12182                 esac
12183                 echo "Prototype: $try" ;;
12184         esac
12185         ;;
12186         *)      case "$usethreads" in
12187                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12188                 esac
12189                 d_endgrent_r=undef
12190                 endgrent_r_proto=0
12191                 ;;
12192         esac
12193         ;;
12194 *)      endgrent_r_proto=0
12195         ;;
12196 esac
12197
12198 : see if endhostent exists
12199 set endhostent d_endhent
12200 eval $inlibc
12201
12202 : see if this is a netdb.h system
12203 set netdb.h i_netdb
12204 eval $inhdr
12205
12206 : see if endhostent_r exists
12207 set endhostent_r d_endhostent_r
12208 eval $inlibc
12209 case "$d_endhostent_r" in
12210 "$define")
12211         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12212         case "$d_endhostent_r_proto:$usethreads" in
12213         ":define")      d_endhostent_r_proto=define
12214                 set d_endhostent_r_proto endhostent_r $hdrs
12215                 eval $hasproto ;;
12216         *)      ;;
12217         esac
12218         case "$d_endhostent_r_proto" in
12219         define)
12220         case "$endhostent_r_proto" in
12221         ''|0) try='int endhostent_r(struct hostent_data*);'
12222         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12223         esac
12224         case "$endhostent_r_proto" in
12225         ''|0) try='void endhostent_r(struct hostent_data*);'
12226         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12227         esac
12228         case "$endhostent_r_proto" in
12229         ''|0)   d_endhostent_r=undef
12230                 endhostent_r_proto=0
12231                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12232         * )     case "$endhostent_r_proto" in
12233                 REENTRANT_PROTO*) ;;
12234                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12235                 esac
12236                 echo "Prototype: $try" ;;
12237         esac
12238         ;;
12239         *)      case "$usethreads" in
12240                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12241                 esac
12242                 d_endhostent_r=undef
12243                 endhostent_r_proto=0
12244                 ;;
12245         esac
12246         ;;
12247 *)      endhostent_r_proto=0
12248         ;;
12249 esac
12250
12251 : see if endnetent exists
12252 set endnetent d_endnent
12253 eval $inlibc
12254
12255 : see if endnetent_r exists
12256 set endnetent_r d_endnetent_r
12257 eval $inlibc
12258 case "$d_endnetent_r" in
12259 "$define")
12260         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12261         case "$d_endnetent_r_proto:$usethreads" in
12262         ":define")      d_endnetent_r_proto=define
12263                 set d_endnetent_r_proto endnetent_r $hdrs
12264                 eval $hasproto ;;
12265         *)      ;;
12266         esac
12267         case "$d_endnetent_r_proto" in
12268         define)
12269         case "$endnetent_r_proto" in
12270         ''|0) try='int endnetent_r(struct netent_data*);'
12271         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12272         esac
12273         case "$endnetent_r_proto" in
12274         ''|0) try='void endnetent_r(struct netent_data*);'
12275         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12276         esac
12277         case "$endnetent_r_proto" in
12278         ''|0)   d_endnetent_r=undef
12279                 endnetent_r_proto=0
12280                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12281         * )     case "$endnetent_r_proto" in
12282                 REENTRANT_PROTO*) ;;
12283                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12284                 esac
12285                 echo "Prototype: $try" ;;
12286         esac
12287         ;;
12288         *)      case "$usethreads" in
12289                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12290                 esac
12291                 d_endnetent_r=undef
12292                 endnetent_r_proto=0
12293                 ;;
12294         esac
12295         ;;
12296 *)      endnetent_r_proto=0
12297         ;;
12298 esac
12299
12300 : see if endprotoent exists
12301 set endprotoent d_endpent
12302 eval $inlibc
12303
12304 : see if endprotoent_r exists
12305 set endprotoent_r d_endprotoent_r
12306 eval $inlibc
12307 case "$d_endprotoent_r" in
12308 "$define")
12309         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12310         case "$d_endprotoent_r_proto:$usethreads" in
12311         ":define")      d_endprotoent_r_proto=define
12312                 set d_endprotoent_r_proto endprotoent_r $hdrs
12313                 eval $hasproto ;;
12314         *)      ;;
12315         esac
12316         case "$d_endprotoent_r_proto" in
12317         define)
12318         case "$endprotoent_r_proto" in
12319         ''|0) try='int endprotoent_r(struct protoent_data*);'
12320         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12321         esac
12322         case "$endprotoent_r_proto" in
12323         ''|0) try='void endprotoent_r(struct protoent_data*);'
12324         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12325         esac
12326         case "$endprotoent_r_proto" in
12327         ''|0)   d_endprotoent_r=undef
12328                 endprotoent_r_proto=0
12329                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12330         * )     case "$endprotoent_r_proto" in
12331                 REENTRANT_PROTO*) ;;
12332                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12333                 esac
12334                 echo "Prototype: $try" ;;
12335         esac
12336         ;;
12337         *)      case "$usethreads" in
12338                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12339                 esac
12340                 d_endprotoent_r=undef
12341                 endprotoent_r_proto=0
12342                 ;;
12343         esac
12344         ;;
12345 *)      endprotoent_r_proto=0
12346         ;;
12347 esac
12348
12349 : see if endpwent exists
12350 set endpwent d_endpwent
12351 eval $inlibc
12352
12353 : see if this is a pwd.h system
12354 set pwd.h i_pwd
12355 eval $inhdr
12356
12357 case "$i_pwd" in
12358 $define)
12359         xxx=`./findhdr pwd.h`
12360         $cppstdin $cppflags $cppminus < $xxx >$$.h
12361
12362         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12363                 val="$define"
12364         else
12365                 val="$undef"
12366         fi
12367         set d_pwquota
12368         eval $setvar
12369
12370         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12371                 val="$define"
12372         else
12373                 val="$undef"
12374         fi
12375         set d_pwage
12376         eval $setvar
12377
12378         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12379                 val="$define"
12380         else
12381                 val="$undef"
12382         fi
12383         set d_pwchange
12384         eval $setvar
12385
12386         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12387                 val="$define"
12388         else
12389                 val="$undef"
12390         fi
12391         set d_pwclass
12392         eval $setvar
12393
12394         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12395                 val="$define"
12396         else
12397                 val="$undef"
12398         fi
12399         set d_pwexpire
12400         eval $setvar
12401
12402         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12403                 val="$define"
12404         else
12405                 val="$undef"
12406         fi
12407         set d_pwcomment
12408         eval $setvar
12409
12410         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12411                 val="$define"
12412         else
12413                 val="$undef"
12414         fi
12415         set d_pwgecos
12416         eval $setvar
12417
12418         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12419                 val="$define"
12420         else
12421                 val="$undef"
12422         fi
12423         set d_pwpasswd
12424         eval $setvar
12425
12426         $rm -f $$.h
12427         ;;
12428 *)
12429         val="$undef"; 
12430         set d_pwquota; eval $setvar
12431         set d_pwage; eval $setvar
12432         set d_pwchange; eval $setvar
12433         set d_pwclass; eval $setvar
12434         set d_pwexpire; eval $setvar
12435         set d_pwcomment; eval $setvar
12436         set d_pwgecos; eval $setvar
12437         set d_pwpasswd; eval $setvar
12438         ;;
12439 esac
12440
12441 : see if endpwent_r exists
12442 set endpwent_r d_endpwent_r
12443 eval $inlibc
12444 case "$d_endpwent_r" in
12445 "$define")
12446         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12447         case "$d_endpwent_r_proto:$usethreads" in
12448         ":define")      d_endpwent_r_proto=define
12449                 set d_endpwent_r_proto endpwent_r $hdrs
12450                 eval $hasproto ;;
12451         *)      ;;
12452         esac
12453         case "$d_endpwent_r_proto" in
12454         define)
12455         case "$endpwent_r_proto" in
12456         ''|0) try='int endpwent_r(FILE**);'
12457         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12458         esac
12459         case "$endpwent_r_proto" in
12460         ''|0) try='void endpwent_r(FILE**);'
12461         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12462         esac
12463         case "$endpwent_r_proto" in
12464         ''|0)   d_endpwent_r=undef
12465                 endpwent_r_proto=0
12466                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12467         * )     case "$endpwent_r_proto" in
12468                 REENTRANT_PROTO*) ;;
12469                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12470                 esac
12471                 echo "Prototype: $try" ;;
12472         esac
12473         ;;
12474         *)      case "$usethreads" in
12475                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12476                 esac
12477                 d_endpwent_r=undef
12478                 endpwent_r_proto=0
12479                 ;;
12480         esac
12481         ;;
12482 *)      endpwent_r_proto=0
12483         ;;
12484 esac
12485
12486 : see if endservent exists
12487 set endservent d_endsent
12488 eval $inlibc
12489
12490 : see if endservent_r exists
12491 set endservent_r d_endservent_r
12492 eval $inlibc
12493 case "$d_endservent_r" in
12494 "$define")
12495         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12496         case "$d_endservent_r_proto:$usethreads" in
12497         ":define")      d_endservent_r_proto=define
12498                 set d_endservent_r_proto endservent_r $hdrs
12499                 eval $hasproto ;;
12500         *)      ;;
12501         esac
12502         case "$d_endservent_r_proto" in
12503         define)
12504         case "$endservent_r_proto" in
12505         ''|0) try='int endservent_r(struct servent_data*);'
12506         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12507         esac
12508         case "$endservent_r_proto" in
12509         ''|0) try='void endservent_r(struct servent_data*);'
12510         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12511         esac
12512         case "$endservent_r_proto" in
12513         ''|0)   d_endservent_r=undef
12514                 endservent_r_proto=0
12515                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12516         * )     case "$endservent_r_proto" in
12517                 REENTRANT_PROTO*) ;;
12518                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12519                 esac
12520                 echo "Prototype: $try" ;;
12521         esac
12522         ;;
12523         *)      case "$usethreads" in
12524                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12525                 esac
12526                 d_endservent_r=undef
12527                 endservent_r_proto=0
12528                 ;;
12529         esac
12530         ;;
12531 *)      endservent_r_proto=0
12532         ;;
12533 esac
12534
12535 : Locate the flags for 'open()'
12536 echo " "
12537 $cat >try.c <<EOCP
12538 #include <sys/types.h>
12539 #ifdef I_FCNTL
12540 #include <fcntl.h>
12541 #endif
12542 #ifdef I_SYS_FILE
12543 #include <sys/file.h>
12544 #endif
12545 #$i_stdlib I_STDLIB
12546 #ifdef I_STDLIB
12547 #include <stdlib.h>
12548 #endif
12549 int main() {
12550         if(O_RDONLY);
12551 #ifdef O_TRUNC
12552         exit(0);
12553 #else
12554         exit(1);
12555 #endif
12556 }
12557 EOCP
12558 : check sys/file.h first to get FREAD on Sun
12559 if $test `./findhdr sys/file.h` && \
12560                 set try -DI_SYS_FILE && eval $compile; then
12561         h_sysfile=true;
12562         echo "<sys/file.h> defines the O_* constants..." >&4
12563         if $run ./try; then
12564                 echo "and you have the 3 argument form of open()." >&4
12565                 val="$define"
12566         else
12567                 echo "but not the 3 argument form of open().  Oh, well." >&4
12568                 val="$undef"
12569         fi
12570 elif $test `./findhdr fcntl.h` && \
12571                 set try -DI_FCNTL && eval $compile; then
12572         h_fcntl=true;
12573         echo "<fcntl.h> defines the O_* constants..." >&4
12574         if $run ./try; then
12575                 echo "and you have the 3 argument form of open()." >&4
12576                 val="$define"
12577         else
12578                 echo "but not the 3 argument form of open().  Oh, well." >&4
12579                 val="$undef"
12580         fi
12581 else
12582         val="$undef"
12583         echo "I can't find the O_* constant definitions!  You got problems." >&4
12584 fi
12585 set d_open3
12586 eval $setvar
12587 $rm_try
12588
12589 : see if this is a sys/file.h system
12590 val=''
12591 set sys/file.h val
12592 eval $inhdr
12593
12594 : do we need to include sys/file.h ?
12595 case "$val" in
12596 "$define")
12597         echo " "
12598         if $h_sysfile; then
12599                 val="$define"
12600                 echo "We'll be including <sys/file.h>." >&4
12601         else
12602                 val="$undef"
12603                 echo "We won't be including <sys/file.h>." >&4
12604         fi
12605         ;;
12606 *)
12607         h_sysfile=false
12608         ;;
12609 esac
12610 set i_sysfile
12611 eval $setvar
12612
12613 : see if fcntl.h is there
12614 val=''
12615 set fcntl.h val
12616 eval $inhdr
12617
12618 : see if we can include fcntl.h
12619 case "$val" in
12620 "$define")
12621         echo " "
12622         if $h_fcntl; then
12623                 val="$define"
12624                 echo "We'll be including <fcntl.h>." >&4
12625         else
12626                 val="$undef"
12627                 if $h_sysfile; then
12628         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12629                 else
12630                         echo "We won't be including <fcntl.h>." >&4
12631                 fi
12632         fi
12633         ;;
12634 *)
12635         h_fcntl=false
12636         val="$undef"
12637         ;;
12638 esac
12639 set i_fcntl
12640 eval $setvar
12641
12642 : see if fork exists
12643 set fork d_fork
12644 eval $inlibc
12645
12646 : see if pipe exists
12647 set pipe d_pipe
12648 eval $inlibc
12649
12650 : check for non-blocking I/O stuff
12651 case "$h_sysfile" in
12652 true) echo "#include <sys/file.h>" > head.c;;
12653 *)
12654        case "$h_fcntl" in
12655        true) echo "#include <fcntl.h>" > head.c;;
12656        *) echo "#include <sys/fcntl.h>" > head.c;;
12657        esac
12658        ;;
12659 esac
12660 echo " "
12661 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12662 case "$o_nonblock" in
12663 '')
12664         $cat head.c > try.c
12665         $cat >>try.c <<EOCP
12666 #include <stdio.h>
12667 #$i_stdlib I_STDLIB
12668 #ifdef I_STDLIB
12669 #include <stdlib.h>
12670 #endif
12671 #$i_fcntl I_FCNTL
12672 #ifdef I_FCNTL
12673 #include <fcntl.h>
12674 #endif
12675 int main() {
12676 #ifdef O_NONBLOCK
12677         printf("O_NONBLOCK\n");
12678         exit(0);
12679 #endif
12680 #ifdef O_NDELAY
12681         printf("O_NDELAY\n");
12682         exit(0);
12683 #endif
12684 #ifdef FNDELAY
12685         printf("FNDELAY\n");
12686         exit(0);
12687 #endif
12688         exit(0);
12689 }
12690 EOCP
12691         set try
12692         if eval $compile_ok; then
12693                 o_nonblock=`$run ./try`
12694                 case "$o_nonblock" in
12695                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12696                 *) echo "Seems like we can use $o_nonblock.";;
12697                 esac
12698         else
12699                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12700         fi
12701         ;;
12702 *) echo "Using $hint value $o_nonblock.";;
12703 esac
12704 $rm_try
12705
12706 echo " "
12707 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12708 case "$eagain" in
12709 '')
12710         case "$d_fork:$d_pipe" in
12711         define:define)
12712         $cat head.c > try.c
12713         $cat >>try.c <<EOCP
12714 #include <errno.h>
12715 #include <sys/types.h>
12716 #include <signal.h>
12717 #include <stdio.h>
12718 #$i_stdlib I_STDLIB
12719 #ifdef I_STDLIB
12720 #include <stdlib.h>
12721 #endif
12722 #$i_fcntl I_FCNTL
12723 #ifdef I_FCNTL
12724 #include <fcntl.h>
12725 #endif
12726 #define MY_O_NONBLOCK $o_nonblock
12727 #ifndef errno  /* XXX need better Configure test */
12728 extern int errno;
12729 #endif
12730 #$i_unistd I_UNISTD
12731 #ifdef I_UNISTD
12732 #include <unistd.h>
12733 #endif
12734 #$i_string I_STRING
12735 #ifdef I_STRING
12736 #include <string.h>
12737 #else
12738 #include <strings.h>
12739 #endif
12740 $signal_t blech(int x) { exit(3); }
12741 EOCP
12742         $cat >> try.c <<'EOCP'
12743 int main()
12744 {
12745         int pd[2];
12746         int pu[2];
12747         char buf[1];
12748         char string[100];
12749
12750         pipe(pd);       /* Down: child -> parent */
12751         pipe(pu);       /* Up: parent -> child */
12752         if (0 != fork()) {
12753                 int ret;
12754                 close(pd[1]);   /* Parent reads from pd[0] */
12755                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12756 #ifdef F_SETFL
12757                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12758                         exit(1);
12759 #else
12760                 exit(4);
12761 #endif
12762                 signal(SIGALRM, blech);
12763                 alarm(5);
12764                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12765                         exit(2);
12766                 sprintf(string, "%d\n", ret);
12767                 write(2, string, strlen(string));
12768                 alarm(0);
12769 #ifdef EAGAIN
12770                 if (errno == EAGAIN) {
12771                         printf("EAGAIN\n");
12772                         goto ok;
12773                 }
12774 #endif
12775 #ifdef EWOULDBLOCK
12776                 if (errno == EWOULDBLOCK)
12777                         printf("EWOULDBLOCK\n");
12778 #endif
12779         ok:
12780                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12781                 sleep(2);                               /* Give it time to close our pipe */
12782                 alarm(5);
12783                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12784                 alarm(0);
12785                 sprintf(string, "%d\n", ret);
12786                 write(4, string, strlen(string));
12787                 exit(0);
12788         }
12789
12790         close(pd[0]);                   /* We write to pd[1] */
12791         close(pu[1]);                   /* We read from pu[0] */
12792         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12793         close(pd[1]);                   /* Pipe pd is now fully closed! */
12794         exit(0);                                /* Bye bye, thank you for playing! */
12795 }
12796 EOCP
12797         set try
12798         if eval $compile_ok; then
12799                 echo "$startsh" >mtry
12800                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12801                 chmod +x mtry
12802                 ./mtry >/dev/null 2>&1
12803                 case $? in
12804                 0) eagain=`$cat try.out`;;
12805                 1) echo "Could not perform non-blocking setting!";;
12806                 2) echo "I did a successful read() for something that was not there!";;
12807                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12808                 4) echo "Could not find F_SETFL!";;
12809                 *) echo "Something terribly wrong happened during testing.";;
12810                 esac
12811                 rd_nodata=`$cat try.ret`
12812                 echo "A read() system call with no data present returns $rd_nodata."
12813                 case "$rd_nodata" in
12814                 0|-1) ;;
12815                 *)
12816                         echo "(That's peculiar, fixing that to be -1.)"
12817                         rd_nodata=-1
12818                         ;;
12819                 esac
12820                 case "$eagain" in
12821                 '')
12822                         echo "Forcing errno EAGAIN on read() with no data available."
12823                         eagain=EAGAIN
12824                         ;;
12825                 *)
12826                         echo "Your read() sets errno to $eagain when no data is available."
12827                         ;;
12828                 esac
12829                 status=`$cat try.err`
12830                 case "$status" in
12831                 0) echo "And it correctly returns 0 to signal EOF.";;
12832                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12833                 *) echo "However, your read() returns '$status' on EOF??";;
12834                 esac
12835                 val="$define"
12836                 if test "$status" = "$rd_nodata"; then
12837                         echo "WARNING: you can't distinguish between EOF and no data!"
12838                         val="$undef"
12839                 fi
12840         else
12841                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12842                 eagain=EAGAIN
12843         fi
12844         ;;
12845         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12846                 eagain=EAGAIN
12847                 val="$define"
12848                 ;;
12849         esac
12850         set d_eofnblk
12851         eval $setvar
12852         ;;
12853 *)
12854         echo "Using $hint value $eagain."
12855         echo "Your read() returns $rd_nodata when no data is present."
12856         case "$d_eofnblk" in
12857         "$define") echo "And you can see EOF because read() returns 0.";;
12858         "$undef") echo "But you can't see EOF status from read() returned value.";;
12859         *)
12860                 echo "(Assuming you can't see EOF status from read anyway.)"
12861                 d_eofnblk=$undef
12862                 ;;
12863         esac
12864         ;;
12865 esac
12866 $rm_try head.c mtry
12867
12868 : see if _ptr and _cnt from stdio act std
12869 echo " "
12870
12871 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12872         echo "(Looks like you have stdio.h from BSD.)"
12873         case "$stdio_ptr" in
12874         '') stdio_ptr='((fp)->_p)'
12875                 ptr_lval=$define
12876                 ;;
12877         *)      ptr_lval=$d_stdio_ptr_lval;;
12878         esac
12879         case "$stdio_cnt" in
12880         '') stdio_cnt='((fp)->_r)'
12881                 cnt_lval=$define
12882                 ;;
12883         *)      cnt_lval=$d_stdio_cnt_lval;;
12884         esac
12885         case "$stdio_base" in
12886         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12887         esac
12888         case "$stdio_bufsiz" in
12889         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12890         esac
12891 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12892         echo "(Looks like you have stdio.h from Linux.)"
12893         case "$stdio_ptr" in
12894         '') stdio_ptr='((fp)->_IO_read_ptr)'
12895                 ptr_lval=$define
12896                 ;;
12897         *)      ptr_lval=$d_stdio_ptr_lval;;
12898         esac
12899         case "$stdio_cnt" in
12900         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12901                 cnt_lval=$undef
12902                 ;;
12903         *)      cnt_lval=$d_stdio_cnt_lval;;
12904         esac
12905         case "$stdio_base" in
12906         '') stdio_base='((fp)->_IO_read_base)';;
12907         esac
12908         case "$stdio_bufsiz" in
12909         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12910         esac
12911 else
12912         case "$stdio_ptr" in
12913         '') stdio_ptr='((fp)->_ptr)'
12914                 ptr_lval=$define
12915                 ;;
12916         *)      ptr_lval=$d_stdio_ptr_lval;;
12917         esac
12918         case "$stdio_cnt" in
12919         '') stdio_cnt='((fp)->_cnt)'
12920                 cnt_lval=$define
12921                 ;;
12922         *)      cnt_lval=$d_stdio_cnt_lval;;
12923         esac
12924         case "$stdio_base" in
12925         '') stdio_base='((fp)->_base)';;
12926         esac
12927         case "$stdio_bufsiz" in
12928         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12929         esac
12930 fi
12931
12932 : test whether _ptr and _cnt really work
12933 echo "Checking how std your stdio is..." >&4
12934 $cat >try.c <<EOP
12935 #include <stdio.h>
12936 #$i_stdlib I_STDLIB
12937 #ifdef I_STDLIB
12938 #include <stdlib.h>
12939 #endif
12940 #define FILE_ptr(fp)    $stdio_ptr
12941 #define FILE_cnt(fp)    $stdio_cnt
12942 int main() {
12943         FILE *fp = fopen("try.c", "r");
12944         char c = getc(fp);
12945         if (
12946                 18 <= FILE_cnt(fp) &&
12947                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12948         )
12949                 exit(0);
12950         exit(1);
12951 }
12952 EOP
12953 val="$undef"
12954 set try
12955 if eval $compile && $to try.c; then
12956         if $run ./try; then
12957                 echo "Your stdio acts pretty std."
12958                 val="$define"
12959         else
12960                 echo "Your stdio isn't very std."
12961         fi
12962 else
12963         echo "Your stdio doesn't appear very std."
12964 fi
12965 $rm_try
12966
12967 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12968 # direct buffer manipulation no longer works.  The Configure tests
12969 # should be changed to correctly detect this, but until then,
12970 # the following check should at least let perl compile and run.
12971 # (This quick fix should be updated before 5.8.1.)
12972 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12973 # A. Dougherty, June 3, 2002.
12974 case "$d_gnulibc" in
12975 $define)
12976         case "$gnulibc_version" in
12977         2.[01]*)  ;;
12978         2.2) ;;
12979         2.2.[0-9]) ;;
12980         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12981                 val="$undef"
12982                 ;;
12983         esac
12984         ;;
12985 esac
12986 set d_stdstdio
12987 eval $setvar
12988
12989 : Can _ptr be used as an lvalue?
12990 case "$d_stdstdio$ptr_lval" in
12991 $define$define) val=$define ;;
12992 *) val=$undef ;;
12993 esac
12994 set d_stdio_ptr_lval
12995 eval $setvar
12996
12997 : Can _cnt be used as an lvalue?
12998 case "$d_stdstdio$cnt_lval" in
12999 $define$define) val=$define ;;
13000 *) val=$undef ;;
13001 esac
13002 set d_stdio_cnt_lval
13003 eval $setvar
13004
13005
13006 : test whether setting _ptr sets _cnt as a side effect
13007 d_stdio_ptr_lval_sets_cnt="$undef"
13008 d_stdio_ptr_lval_nochange_cnt="$undef"
13009 case "$d_stdio_ptr_lval$d_stdstdio" in
13010 $define$define)
13011         echo "Checking to see what happens if we set the stdio ptr..." >&4
13012 $cat >try.c <<EOP
13013 #include <stdio.h>
13014 /* Can we scream? */
13015 /* Eat dust sed :-) */
13016 /* In the buffer space, no one can hear you scream. */
13017 #$i_stdlib I_STDLIB
13018 #ifdef I_STDLIB
13019 #include <stdlib.h>
13020 #endif
13021 #define FILE_ptr(fp)    $stdio_ptr
13022 #define FILE_cnt(fp)    $stdio_cnt
13023 #include <sys/types.h>
13024 int main() {
13025         FILE *fp = fopen("try.c", "r");
13026         int c;
13027         char *ptr;
13028         size_t cnt;
13029         if (!fp) {
13030             puts("Fail even to read");
13031             exit(1);
13032         }
13033         c = getc(fp); /* Read away the first # */
13034         if (c == EOF) {
13035             puts("Fail even to read");
13036             exit(1);
13037         }
13038         if (!(
13039                 18 <= FILE_cnt(fp) &&
13040                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13041         )) {
13042                 puts("Fail even to read");
13043                 exit (1);
13044         }
13045         ptr = (char*) FILE_ptr(fp);
13046         cnt = (size_t)FILE_cnt(fp);
13047
13048         FILE_ptr(fp) += 42;
13049
13050         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13051                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13052                 exit (1);
13053         }
13054         if (FILE_cnt(fp) <= 20) {
13055                 printf ("Fail (<20 chars to test)");
13056                 exit (1);
13057         }
13058         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13059                 puts("Fail compare");
13060                 exit (1);
13061         }
13062         if (cnt == FILE_cnt(fp)) {
13063                 puts("Pass_unchanged");
13064                 exit (0);
13065         }
13066         if (FILE_cnt(fp) == (cnt - 42)) {
13067                 puts("Pass_changed");
13068                 exit (0);
13069         }
13070         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13071         return 1;
13072
13073 }
13074 EOP
13075         set try
13076         if eval $compile && $to try.c; then
13077                 case `$run ./try` in
13078                 Pass_changed)
13079                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13080                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13081                 Pass_unchanged)
13082                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13083                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13084                 Fail*)
13085                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13086                 *)
13087                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13088         esac
13089         else
13090                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13091         fi
13092         $rm_try
13093         ;;
13094 esac
13095
13096 : see if _base is also standard
13097 val="$undef"
13098 case "$d_stdstdio" in
13099 $define)
13100         $cat >try.c <<EOP
13101 #include <stdio.h>
13102 #$i_stdlib I_STDLIB
13103 #ifdef I_STDLIB
13104 #include <stdlib.h>
13105 #endif
13106 #define FILE_base(fp)   $stdio_base
13107 #define FILE_bufsiz(fp) $stdio_bufsiz
13108 int main() {
13109         FILE *fp = fopen("try.c", "r");
13110         char c = getc(fp);
13111         if (
13112                 19 <= FILE_bufsiz(fp) &&
13113                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13114         )
13115                 exit(0);
13116         exit(1);
13117 }
13118 EOP
13119         set try
13120         if eval $compile && $to try.c; then
13121                 if $run ./try; then
13122                         echo "And its _base field acts std."
13123                         val="$define"
13124                 else
13125                         echo "But its _base field isn't std."
13126                 fi
13127         else
13128                 echo "However, it seems to be lacking the _base field."
13129         fi
13130         $rm_try
13131         ;;
13132 esac
13133 set d_stdiobase
13134 eval $setvar
13135
13136 : see if fast_stdio exists
13137 val="$undef"
13138 case "$d_stdstdio:$d_stdio_ptr_lval" in
13139 "$define:$define")
13140         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13141         *$define*)
13142                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13143                 val="$define"
13144                 ;;
13145         esac
13146         ;;
13147 esac
13148 set d_faststdio
13149 eval $setvar
13150
13151
13152
13153 : see if fchdir exists
13154 set fchdir d_fchdir
13155 eval $inlibc
13156
13157 : see if fchmod exists
13158 set fchmod d_fchmod
13159 eval $inlibc
13160
13161 : see if fchown exists
13162 set fchown d_fchown
13163 eval $inlibc
13164
13165 : see if this is an fcntl system
13166 set fcntl d_fcntl
13167 eval $inlibc
13168
13169 : See if fcntl-based locking works.
13170 echo " "
13171 $cat >try.c <<EOCP
13172 #$i_stdlib I_STDLIB
13173 #ifdef I_STDLIB
13174 #include <stdlib.h>
13175 #endif
13176 #include <unistd.h>
13177 #include <fcntl.h>
13178 #include <signal.h>
13179 $signal_t blech(int x) { exit(3); }
13180 int main() {
13181 #if defined(F_SETLK) && defined(F_SETLKW)
13182      struct flock flock;
13183      int retval, fd;
13184      fd = open("try.c", O_RDONLY);
13185      flock.l_type = F_RDLCK;
13186      flock.l_whence = SEEK_SET;
13187      flock.l_start = flock.l_len = 0;
13188      signal(SIGALRM, blech);
13189      alarm(10);
13190      retval = fcntl(fd, F_SETLK, &flock);
13191      close(fd);
13192      (retval < 0 ? exit(2) : exit(0));
13193 #else
13194      exit(2);
13195 #endif
13196 }
13197 EOCP
13198 echo "Checking if fcntl-based file locking works... "
13199 case "$d_fcntl" in
13200 "$define")
13201         set try
13202         if eval $compile_ok; then
13203                 if $run ./try; then
13204                         echo "Yes, it seems to work."
13205                         val="$define"
13206                 else
13207                         echo "Nope, it didn't work."
13208                         val="$undef"
13209                         case "$?" in
13210                         3) $cat >&4 <<EOM
13211 ***
13212 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13213 *** This is (almost) impossible.
13214 *** If your NFS lock daemons are not feeling well, something like
13215 *** this may happen, please investigate.  Cannot continue, aborting.
13216 ***
13217 EOM
13218                                 exit 1
13219                                 ;;
13220                         esac
13221                 fi
13222         else
13223                 echo "I'm unable to compile the test program, so I'll assume not."
13224                 val="$undef"
13225         fi
13226         ;;
13227 *) val="$undef";
13228         echo "Nope, since you don't even have fcntl()."
13229         ;;
13230 esac
13231 set d_fcntl_can_lock
13232 eval $setvar
13233 $rm_try
13234
13235 : check for fd_set items
13236 $cat <<EOM
13237
13238 Checking to see how well your C compiler handles fd_set and friends ...
13239 EOM
13240 $cat >try.c <<EOCP
13241 #$i_stdlib I_STDLIB
13242 #ifdef I_STDLIB
13243 #include <stdlib.h>
13244 #endif
13245 #$i_systime I_SYS_TIME
13246 #$i_sysselct I_SYS_SELECT
13247 #$d_socket HAS_SOCKET
13248 #include <sys/types.h>
13249 #ifdef HAS_SOCKET
13250 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13251 #endif
13252 #ifdef I_SYS_TIME
13253 #include <sys/time.h>
13254 #endif
13255 #ifdef I_SYS_SELECT
13256 #include <sys/select.h>
13257 #endif
13258 int main() {
13259         fd_set fds;
13260
13261 #ifdef TRYBITS
13262         if(fds.fds_bits);
13263 #endif
13264
13265 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13266         exit(0);
13267 #else
13268         exit(1);
13269 #endif
13270 }
13271 EOCP
13272 set try -DTRYBITS
13273 if eval $compile; then
13274         d_fds_bits="$define"
13275         d_fd_set="$define"
13276         echo "Well, your system knows about the normal fd_set typedef..." >&4
13277         if $run ./try; then
13278                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13279                 d_fd_macros="$define"
13280         else
13281                 $cat >&4 <<'EOM'
13282 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13283 EOM
13284                 d_fd_macros="$undef"
13285         fi
13286 else
13287         $cat <<'EOM'
13288 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13289 EOM
13290         set try
13291         if eval $compile; then
13292                 d_fds_bits="$undef"
13293                 d_fd_set="$define"
13294                 echo "Well, your system has some sort of fd_set available..." >&4
13295                 if $run ./try; then
13296                         echo "and you have the normal fd_set macros." >&4
13297                         d_fd_macros="$define"
13298                 else
13299                         $cat <<'EOM'
13300 but not the normal fd_set macros!  Gross!  More work for me...
13301 EOM
13302                         d_fd_macros="$undef"
13303                 fi
13304         else
13305         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13306                 d_fd_set="$undef"
13307                 d_fds_bits="$undef"
13308                 d_fd_macros="$undef"
13309         fi
13310 fi
13311 $rm_try
13312
13313 : see if fgetpos exists
13314 set fgetpos d_fgetpos
13315 eval $inlibc
13316
13317 : see if finite exists
13318 set finite d_finite
13319 eval $inlibc
13320
13321 : see if finitel exists
13322 set finitel d_finitel
13323 eval $inlibc
13324
13325 : see if flock exists
13326 set flock d_flock
13327 eval $inlibc
13328
13329 : see if prototype for flock is available
13330 echo " "
13331 set d_flockproto flock $i_sysfile sys/file.h
13332 eval $hasproto
13333
13334 : see if fp_class exists
13335 set fp_class d_fp_class
13336 eval $inlibc
13337
13338 : see if pathconf exists
13339 set pathconf d_pathconf
13340 eval $inlibc
13341
13342 : see if fpathconf exists
13343 set fpathconf d_fpathconf
13344 eval $inlibc
13345
13346 : see if fpclass exists
13347 set fpclass d_fpclass
13348 eval $inlibc
13349
13350 : see if fpclassify exists
13351 set fpclassify d_fpclassify
13352 eval $inlibc
13353
13354 : see if fpclassl exists
13355 set fpclassl d_fpclassl
13356 eval $inlibc
13357
13358 : check for fpos64_t
13359 echo " "
13360 echo "Checking to see if you have fpos64_t..." >&4
13361 $cat >try.c <<EOCP
13362 #include <stdio.h>
13363 int main() { fpos64_t x = 7; }
13364 EOCP
13365 set try
13366 if eval $compile; then
13367         val="$define"
13368         echo "You have fpos64_t."
13369 else
13370         val="$undef"
13371         echo "You do not have fpos64_t."
13372         case "$fpossize" in
13373         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13374         esac
13375 fi
13376 $rm_try
13377 set d_fpos64_t
13378 eval $setvar
13379
13380 : see if frexpl exists
13381 set frexpl d_frexpl
13382 eval $inlibc
13383
13384 : see if this is a sys/param system
13385 set sys/param.h i_sysparam
13386 eval $inhdr
13387
13388 : see if this is a sys/mount.h system
13389 set sys/mount.h i_sysmount
13390 eval $inhdr
13391
13392 : Check for fs_data_s
13393 echo " "
13394 echo "Checking to see if your system supports struct fs_data..." >&4
13395 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13396 eval $hasstruct
13397 case "$d_fs_data_s" in
13398 "$define")      echo "Yes, it does."   ;;
13399 *)              echo "No, it doesn't." ;;
13400 esac
13401
13402 : see if fseeko exists
13403 set fseeko d_fseeko
13404 eval $inlibc
13405 case "$longsize" in
13406 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13407 esac
13408
13409 : see if fsetpos exists
13410 set fsetpos d_fsetpos
13411 eval $inlibc
13412
13413 : see if fstatfs exists
13414 set fstatfs d_fstatfs
13415 eval $inlibc
13416
13417 : see if statvfs exists
13418 set statvfs d_statvfs
13419 eval $inlibc
13420
13421 : see if fstatvfs exists
13422 set fstatvfs d_fstatvfs
13423 eval $inlibc
13424
13425
13426 : see if fsync exists
13427 set fsync d_fsync
13428 eval $inlibc
13429
13430 : see if ftello exists
13431 set ftello d_ftello
13432 eval $inlibc
13433 case "$longsize" in
13434 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13435 esac
13436
13437 : check for a working futimes
13438 d_futimes="$undef"
13439 echo " "
13440 echo "Checking if you have a working futimes()" >&4
13441 $cat >try.c <<EOCP
13442 #include <stdio.h>
13443 #include <sys/time.h>
13444 #include <errno.h>
13445 #include <fcntl.h>
13446
13447 int main ()
13448 {
13449     int fd, rv;
13450     fd = open ("try.c", O_RDWR);
13451     if (-1 == fd) exit (1);
13452     rv = futimes (fd, NULL);
13453     exit (rv == -1 ? errno : 0);
13454 }
13455 EOCP
13456 set try
13457 if eval $compile; then
13458     `$run ./try`
13459     rc=$?
13460     case "$rc" in
13461         0)  echo "Yes, you have" >&4
13462             d_futimes="$define"
13463             ;;
13464         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13465             ;;
13466     esac
13467 else
13468     echo "No, it does not (probably harmless)" >&4
13469 fi
13470 $rm_try
13471
13472 : see if ndbm.h is available
13473 set ndbm.h i_ndbm
13474 eval $inhdr
13475 : Compatibility location for RedHat 7.1
13476 set gdbm/ndbm.h i_gdbmndbm
13477 eval $inhdr
13478 : Compatibility location for Debian 4.0
13479 set gdbm-ndbm.h i_gdbm_ndbm
13480 eval $inhdr
13481
13482 val="$undef"
13483 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13484         : see if dbm_open exists
13485         set dbm_open d_dbm_open
13486         eval $inlibc
13487         case "$d_dbm_open" in
13488         $undef)
13489                 i_ndbm="$undef"
13490                 i_gdbmndbm="$undef"
13491                 i_gdbm_ndbm="$undef"
13492                 echo "We won't be including <ndbm.h>"
13493                 val="$undef"
13494                 ;;
13495         *) val="$define"
13496            ;;
13497         esac
13498 fi
13499 set d_ndbm
13500 eval $setvar
13501
13502 ndbm_hdr_protochk='name=$1; hdr=$2;
13503 eval "ihdr=\$""i_$name";
13504 val="$undef";
13505 if $test "$ihdr" = "$define"; then
13506         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13507         case "$d_cplusplus" in
13508         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13509         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13510         esac;
13511         case "$val" in
13512         $define) $echo "Your <$hdr> seems to have prototypes";;
13513         *) $echo "Your <$hdr> does not seem to have prototypes";;
13514         esac;
13515 fi;
13516 set "d_${name}_h_uses_prototypes";
13517 eval $setvar'
13518
13519 set ndbm ndbm.h
13520 eval $ndbm_hdr_protochk
13521 set gdbmndbm gdbm/ndbm.h
13522 eval $ndbm_hdr_protochk
13523 set gdbm_ndbm gdbm-ndbm.h
13524 eval $ndbm_hdr_protochk
13525
13526 : see if getaddrinfo exists
13527 set getaddrinfo d_getaddrinfo
13528 eval $inlibc
13529
13530 : see if getcwd exists
13531 set getcwd d_getcwd
13532 eval $inlibc
13533
13534 : see if getespwnam exists
13535 set getespwnam d_getespwnam
13536 eval $inlibc
13537
13538 : see if getfsstat exists
13539 set getfsstat d_getfsstat
13540 eval $inlibc
13541
13542 : see if getgrent exists
13543 set getgrent d_getgrent
13544 eval $inlibc
13545
13546 : see if getgrent_r exists
13547 set getgrent_r d_getgrent_r
13548 eval $inlibc
13549 case "$d_getgrent_r" in
13550 "$define")
13551         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13552         case "$d_getgrent_r_proto:$usethreads" in
13553         ":define")      d_getgrent_r_proto=define
13554                 set d_getgrent_r_proto getgrent_r $hdrs
13555                 eval $hasproto ;;
13556         *)      ;;
13557         esac
13558         case "$d_getgrent_r_proto" in
13559         define)
13560         case "$getgrent_r_proto" in
13561         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13562         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13563         esac
13564         case "$getgrent_r_proto" in
13565         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13566         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13567         esac
13568         case "$getgrent_r_proto" in
13569         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13570         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13571         esac
13572         case "$getgrent_r_proto" in
13573         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13574         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13575         esac
13576         case "$getgrent_r_proto" in
13577         ''|0) try='int getgrent_r(struct group*, char*, int);'
13578         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13579         esac
13580         case "$getgrent_r_proto" in
13581         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13582         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13583         esac
13584         case "$getgrent_r_proto" in
13585         ''|0)   d_getgrent_r=undef
13586                 getgrent_r_proto=0
13587                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13588         * )     case "$getgrent_r_proto" in
13589                 REENTRANT_PROTO*) ;;
13590                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13591                 esac
13592                 echo "Prototype: $try" ;;
13593         esac
13594         ;;
13595         *)      case "$usethreads" in
13596                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13597                 esac
13598                 d_getgrent_r=undef
13599                 getgrent_r_proto=0
13600                 ;;
13601         esac
13602         ;;
13603 *)      getgrent_r_proto=0
13604         ;;
13605 esac
13606
13607 : see if getgrgid_r exists
13608 set getgrgid_r d_getgrgid_r
13609 eval $inlibc
13610 case "$d_getgrgid_r" in
13611 "$define")
13612         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13613         case "$d_getgrgid_r_proto:$usethreads" in
13614         ":define")      d_getgrgid_r_proto=define
13615                 set d_getgrgid_r_proto getgrgid_r $hdrs
13616                 eval $hasproto ;;
13617         *)      ;;
13618         esac
13619         case "$d_getgrgid_r_proto" in
13620         define)
13621         case "$getgrgid_r_proto" in
13622         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13623         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13624         esac
13625         case "$getgrgid_r_proto" in
13626         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13627         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13628         esac
13629         case "$getgrgid_r_proto" in
13630         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13631         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13632         esac
13633         case "$getgrgid_r_proto" in
13634         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13635         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13636         esac
13637         case "$getgrgid_r_proto" in
13638         ''|0)   d_getgrgid_r=undef
13639                 getgrgid_r_proto=0
13640                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13641         * )     case "$getgrgid_r_proto" in
13642                 REENTRANT_PROTO*) ;;
13643                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13644                 esac
13645                 echo "Prototype: $try" ;;
13646         esac
13647         ;;
13648         *)      case "$usethreads" in
13649                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13650                 esac
13651                 d_getgrgid_r=undef
13652                 getgrgid_r_proto=0
13653                 ;;
13654         esac
13655         ;;
13656 *)      getgrgid_r_proto=0
13657         ;;
13658 esac
13659
13660 : see if getgrnam_r exists
13661 set getgrnam_r d_getgrnam_r
13662 eval $inlibc
13663 case "$d_getgrnam_r" in
13664 "$define")
13665         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13666         case "$d_getgrnam_r_proto:$usethreads" in
13667         ":define")      d_getgrnam_r_proto=define
13668                 set d_getgrnam_r_proto getgrnam_r $hdrs
13669                 eval $hasproto ;;
13670         *)      ;;
13671         esac
13672         case "$d_getgrnam_r_proto" in
13673         define)
13674         case "$getgrnam_r_proto" in
13675         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13676         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13677         esac
13678         case "$getgrnam_r_proto" in
13679         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13680         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13681         esac
13682         case "$getgrnam_r_proto" in
13683         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13684         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13685         esac
13686         case "$getgrnam_r_proto" in
13687         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13688         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13689         esac
13690         case "$getgrnam_r_proto" in
13691         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13692         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13693         esac
13694         case "$getgrnam_r_proto" in
13695         ''|0)   d_getgrnam_r=undef
13696                 getgrnam_r_proto=0
13697                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13698         * )     case "$getgrnam_r_proto" in
13699                 REENTRANT_PROTO*) ;;
13700                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13701                 esac
13702                 echo "Prototype: $try" ;;
13703         esac
13704         ;;
13705         *)      case "$usethreads" in
13706                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13707                 esac
13708                 d_getgrnam_r=undef
13709                 getgrnam_r_proto=0
13710                 ;;
13711         esac
13712         ;;
13713 *)      getgrnam_r_proto=0
13714         ;;
13715 esac
13716
13717 : see if gethostbyaddr exists
13718 set gethostbyaddr d_gethbyaddr
13719 eval $inlibc
13720
13721 : see if gethostbyname exists
13722 set gethostbyname d_gethbyname
13723 eval $inlibc
13724
13725 : see if gethostent exists
13726 set gethostent d_gethent
13727 eval $inlibc
13728
13729 : see how we will look up host name
13730 echo " "
13731 call=''
13732 if set gethostname val -f d_gethname; eval $csym; $val; then
13733         echo 'gethostname() found.' >&4
13734         d_gethname="$define"
13735         call=gethostname
13736 fi
13737 if set uname val -f d_uname; eval $csym; $val; then
13738         if ./xenix; then
13739                 $cat <<'EOM'
13740 uname() was found, but you're running xenix, and older versions of xenix
13741 have a broken uname(). If you don't really know whether your xenix is old
13742 enough to have a broken system call, use the default answer.
13743
13744 EOM
13745                 dflt=y
13746                 case "$d_uname" in
13747                 "$define") dflt=n;;
13748                 esac
13749                 rp='Is your uname() broken?'
13750                 . ./myread
13751                 case "$ans" in
13752                 n*) d_uname="$define"; call=uname;;
13753                 esac
13754         else
13755                 echo 'uname() found.' >&4
13756                 d_uname="$define"
13757                 case "$call" in
13758                 '') call=uname ;;
13759                 esac
13760         fi
13761 fi
13762 case "$d_gethname" in
13763 '') d_gethname="$undef";;
13764 esac
13765 case "$d_uname" in
13766 '') d_uname="$undef";;
13767 esac
13768 case "$d_uname$d_gethname" in
13769 *define*)
13770         dflt=n
13771         cat <<EOM
13772
13773 Every now and then someone has a $call() that lies about the hostname
13774 but can't be fixed for political or economic reasons.  If you wish, I can
13775 pretend $call() isn't there and maybe compute hostname at run-time
13776 thanks to the '$phostname' command.
13777
13778 EOM
13779         rp="Shall I ignore $call() from now on?"
13780         . ./myread
13781         case "$ans" in
13782         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13783         esac;;
13784 esac
13785 case "$phostname" in
13786 '') aphostname='';;
13787 *) case "$aphostname" in
13788         /*) ;;
13789         *) set X $phostname
13790                 shift
13791                 file=$1
13792                 shift
13793                 file=`./loc $file $file $pth`
13794                 aphostname=`echo $file $*`
13795                 ;;
13796         esac
13797         ;;
13798 esac
13799 case "$d_uname$d_gethname" in
13800 *define*) ;;
13801 *)
13802         case "$phostname" in
13803         '')
13804                 echo "There will be no way for $package to get your hostname." >&4;;
13805         *)
13806         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13807                 ;;
13808         esac;;
13809 esac
13810 case "$d_phostname" in
13811 '') d_phostname="$undef";;
13812 esac
13813
13814 : see if gethostbyaddr_r exists
13815 set gethostbyaddr_r d_gethostbyaddr_r
13816 eval $inlibc
13817 case "$d_gethostbyaddr_r" in
13818 "$define")
13819         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13820         case "$d_gethostbyaddr_r_proto:$usethreads" in
13821         ":define")      d_gethostbyaddr_r_proto=define
13822                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13823                 eval $hasproto ;;
13824         *)      ;;
13825         esac
13826         case "$d_gethostbyaddr_r_proto" in
13827         define)
13828         case "$gethostbyaddr_r_proto" in
13829         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13830         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13831         esac
13832         case "$gethostbyaddr_r_proto" in
13833         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13834         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13835         esac
13836         case "$gethostbyaddr_r_proto" in
13837         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13838         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13839         esac
13840         case "$gethostbyaddr_r_proto" in
13841         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13842         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13843         esac
13844         case "$gethostbyaddr_r_proto" in
13845         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13846         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13847         esac
13848         case "$gethostbyaddr_r_proto" in
13849         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13850         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13851         esac
13852         case "$gethostbyaddr_r_proto" in
13853         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13854         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13855         esac
13856         case "$gethostbyaddr_r_proto" in
13857         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13858         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13859         esac
13860         case "$gethostbyaddr_r_proto" in
13861         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13862         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13863         esac
13864         case "$gethostbyaddr_r_proto" in
13865         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13866         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13867         esac
13868         case "$gethostbyaddr_r_proto" in
13869         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13870         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13871         esac
13872         case "$gethostbyaddr_r_proto" in
13873         ''|0)   d_gethostbyaddr_r=undef
13874                 gethostbyaddr_r_proto=0
13875                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13876         * )     case "$gethostbyaddr_r_proto" in
13877                 REENTRANT_PROTO*) ;;
13878                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13879                 esac
13880                 echo "Prototype: $try" ;;
13881         esac
13882         ;;
13883         *)      case "$usethreads" in
13884                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13885                 esac
13886                 d_gethostbyaddr_r=undef
13887                 gethostbyaddr_r_proto=0
13888                 ;;
13889         esac
13890         ;;
13891 *)      gethostbyaddr_r_proto=0
13892         ;;
13893 esac
13894
13895 : see if gethostbyname_r exists
13896 set gethostbyname_r d_gethostbyname_r
13897 eval $inlibc
13898 case "$d_gethostbyname_r" in
13899 "$define")
13900         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13901         case "$d_gethostbyname_r_proto:$usethreads" in
13902         ":define")      d_gethostbyname_r_proto=define
13903                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13904                 eval $hasproto ;;
13905         *)      ;;
13906         esac
13907         case "$d_gethostbyname_r_proto" in
13908         define)
13909         case "$gethostbyname_r_proto" in
13910         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13911         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13912         esac
13913         case "$gethostbyname_r_proto" in
13914         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13915         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13916         esac
13917         case "$gethostbyname_r_proto" in
13918         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13919         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13920         esac
13921         case "$gethostbyname_r_proto" in
13922         ''|0)   d_gethostbyname_r=undef
13923                 gethostbyname_r_proto=0
13924                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13925         * )     case "$gethostbyname_r_proto" in
13926                 REENTRANT_PROTO*) ;;
13927                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13928                 esac
13929                 echo "Prototype: $try" ;;
13930         esac
13931         ;;
13932         *)      case "$usethreads" in
13933                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13934                 esac
13935                 d_gethostbyname_r=undef
13936                 gethostbyname_r_proto=0
13937                 ;;
13938         esac
13939         ;;
13940 *)      gethostbyname_r_proto=0
13941         ;;
13942 esac
13943
13944 : see if gethostent_r exists
13945 set gethostent_r d_gethostent_r
13946 eval $inlibc
13947 case "$d_gethostent_r" in
13948 "$define")
13949         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13950         case "$d_gethostent_r_proto:$usethreads" in
13951         ":define")      d_gethostent_r_proto=define
13952                 set d_gethostent_r_proto gethostent_r $hdrs
13953                 eval $hasproto ;;
13954         *)      ;;
13955         esac
13956         case "$d_gethostent_r_proto" in
13957         define)
13958         case "$gethostent_r_proto" in
13959         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13960         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13961         esac
13962         case "$gethostent_r_proto" in
13963         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13964         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13965         esac
13966         case "$gethostent_r_proto" in
13967         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13968         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13969         esac
13970         case "$gethostent_r_proto" in
13971         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13972         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13973         esac
13974         case "$gethostent_r_proto" in
13975         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13976         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13977         esac
13978         case "$gethostent_r_proto" in
13979         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13980         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13981         esac
13982         case "$gethostent_r_proto" in
13983         ''|0)   d_gethostent_r=undef
13984                 gethostent_r_proto=0
13985                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13986         * )     case "$gethostent_r_proto" in
13987                 REENTRANT_PROTO*) ;;
13988                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13989                 esac
13990                 echo "Prototype: $try" ;;
13991         esac
13992         ;;
13993         *)      case "$usethreads" in
13994                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13995                 esac
13996                 d_gethostent_r=undef
13997                 gethostent_r_proto=0
13998                 ;;
13999         esac
14000         ;;
14001 *)      gethostent_r_proto=0
14002         ;;
14003 esac
14004
14005 : see if prototypes for various gethostxxx netdb.h functions are available
14006 echo " "
14007 set d_gethostprotos gethostent $i_netdb netdb.h
14008 eval $hasproto
14009
14010 : see if getitimer exists
14011 set getitimer d_getitimer
14012 eval $inlibc
14013
14014 : see if getlogin exists
14015 set getlogin d_getlogin
14016 eval $inlibc
14017
14018 : see if getlogin_r exists
14019 set getlogin_r d_getlogin_r
14020 eval $inlibc
14021 case "$d_getlogin_r" in
14022 "$define")
14023         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14024         case "$d_getlogin_r_proto:$usethreads" in
14025         ":define")      d_getlogin_r_proto=define
14026                 set d_getlogin_r_proto getlogin_r $hdrs
14027                 eval $hasproto ;;
14028         *)      ;;
14029         esac
14030         case "$d_getlogin_r_proto" in
14031         define)
14032         case "$getlogin_r_proto" in
14033         ''|0) try='int getlogin_r(char*, size_t);'
14034         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14035         esac
14036         case "$getlogin_r_proto" in
14037         ''|0) try='int getlogin_r(char*, int);'
14038         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14039         esac
14040         case "$getlogin_r_proto" in
14041         ''|0) try='char* getlogin_r(char*, size_t);'
14042         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14043         esac
14044         case "$getlogin_r_proto" in
14045         ''|0) try='char* getlogin_r(char*, int);'
14046         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14047         esac
14048         case "$getlogin_r_proto" in
14049         ''|0)   d_getlogin_r=undef
14050                 getlogin_r_proto=0
14051                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14052         * )     case "$getlogin_r_proto" in
14053                 REENTRANT_PROTO*) ;;
14054                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14055                 esac
14056                 echo "Prototype: $try" ;;
14057         esac
14058         ;;
14059         *)      case "$usethreads" in
14060                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14061                 esac
14062                 d_getlogin_r=undef
14063                 getlogin_r_proto=0
14064                 ;;
14065         esac
14066         ;;
14067 *)      getlogin_r_proto=0
14068         ;;
14069 esac
14070
14071 : see if getmnt exists
14072 set getmnt d_getmnt
14073 eval $inlibc
14074
14075 : see if getmntent exists
14076 set getmntent d_getmntent
14077 eval $inlibc
14078
14079 : see if getnameinfo exists
14080 set getnameinfo d_getnameinfo
14081 eval $inlibc
14082
14083 : see if getnetbyaddr exists
14084 set getnetbyaddr d_getnbyaddr
14085 eval $inlibc
14086
14087 : see if getnetbyname exists
14088 set getnetbyname d_getnbyname
14089 eval $inlibc
14090
14091 : see if getnetent exists
14092 set getnetent d_getnent
14093 eval $inlibc
14094
14095 : see if getnetbyaddr_r exists
14096 set getnetbyaddr_r d_getnetbyaddr_r
14097 eval $inlibc
14098 case "$d_getnetbyaddr_r" in
14099 "$define")
14100         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14101         case "$d_getnetbyaddr_r_proto:$usethreads" in
14102         ":define")      d_getnetbyaddr_r_proto=define
14103                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14104                 eval $hasproto ;;
14105         *)      ;;
14106         esac
14107         case "$d_getnetbyaddr_r_proto" in
14108         define)
14109         case "$getnetbyaddr_r_proto" in
14110         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14111         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14112         esac
14113         case "$getnetbyaddr_r_proto" in
14114         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14115         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14116         esac
14117         case "$getnetbyaddr_r_proto" in
14118         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14119         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14120         esac
14121         case "$getnetbyaddr_r_proto" in
14122         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14123         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14124         esac
14125         case "$getnetbyaddr_r_proto" in
14126         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14127         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14128         esac
14129         case "$getnetbyaddr_r_proto" in
14130         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14131         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14132         esac
14133         case "$getnetbyaddr_r_proto" in
14134         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14135         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14136         esac
14137         case "$getnetbyaddr_r_proto" in
14138         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14139         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14140         esac
14141         case "$getnetbyaddr_r_proto" in
14142         ''|0)   d_getnetbyaddr_r=undef
14143                 getnetbyaddr_r_proto=0
14144                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14145         * )     case "$getnetbyaddr_r_proto" in
14146                 REENTRANT_PROTO*) ;;
14147                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14148                 esac
14149                 echo "Prototype: $try" ;;
14150         esac
14151         ;;
14152         *)      case "$usethreads" in
14153                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14154                 esac
14155                 d_getnetbyaddr_r=undef
14156                 getnetbyaddr_r_proto=0
14157                 ;;
14158         esac
14159         ;;
14160 *)      getnetbyaddr_r_proto=0
14161         ;;
14162 esac
14163
14164 : see if getnetbyname_r exists
14165 set getnetbyname_r d_getnetbyname_r
14166 eval $inlibc
14167 case "$d_getnetbyname_r" in
14168 "$define")
14169         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14170         case "$d_getnetbyname_r_proto:$usethreads" in
14171         ":define")      d_getnetbyname_r_proto=define
14172                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14173                 eval $hasproto ;;
14174         *)      ;;
14175         esac
14176         case "$d_getnetbyname_r_proto" in
14177         define)
14178         case "$getnetbyname_r_proto" in
14179         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14180         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14181         esac
14182         case "$getnetbyname_r_proto" in
14183         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14184         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14185         esac
14186         case "$getnetbyname_r_proto" in
14187         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14188         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14189         esac
14190         case "$getnetbyname_r_proto" in
14191         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14192         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14193         esac
14194         case "$getnetbyname_r_proto" in
14195         ''|0)   d_getnetbyname_r=undef
14196                 getnetbyname_r_proto=0
14197                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14198         * )     case "$getnetbyname_r_proto" in
14199                 REENTRANT_PROTO*) ;;
14200                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14201                 esac
14202                 echo "Prototype: $try" ;;
14203         esac
14204         ;;
14205         *)      case "$usethreads" in
14206                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14207                 esac
14208                 d_getnetbyname_r=undef
14209                 getnetbyname_r_proto=0
14210                 ;;
14211         esac
14212         ;;
14213 *)      getnetbyname_r_proto=0
14214         ;;
14215 esac
14216
14217 : see if getnetent_r exists
14218 set getnetent_r d_getnetent_r
14219 eval $inlibc
14220 case "$d_getnetent_r" in
14221 "$define")
14222         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14223         case "$d_getnetent_r_proto:$usethreads" in
14224         ":define")      d_getnetent_r_proto=define
14225                 set d_getnetent_r_proto getnetent_r $hdrs
14226                 eval $hasproto ;;
14227         *)      ;;
14228         esac
14229         case "$d_getnetent_r_proto" in
14230         define)
14231         case "$getnetent_r_proto" in
14232         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14233         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14234         esac
14235         case "$getnetent_r_proto" in
14236         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14237         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14238         esac
14239         case "$getnetent_r_proto" in
14240         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14241         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14242         esac
14243         case "$getnetent_r_proto" in
14244         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14245         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14246         esac
14247         case "$getnetent_r_proto" in
14248         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14249         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14250         esac
14251         case "$getnetent_r_proto" in
14252         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14253         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14254         esac
14255         case "$getnetent_r_proto" in
14256         ''|0)   d_getnetent_r=undef
14257                 getnetent_r_proto=0
14258                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14259         * )     case "$getnetent_r_proto" in
14260                 REENTRANT_PROTO*) ;;
14261                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14262                 esac
14263                 echo "Prototype: $try" ;;
14264         esac
14265         ;;
14266         *)      case "$usethreads" in
14267                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14268                 esac
14269                 d_getnetent_r=undef
14270                 getnetent_r_proto=0
14271                 ;;
14272         esac
14273         ;;
14274 *)      getnetent_r_proto=0
14275         ;;
14276 esac
14277
14278 : see if prototypes for various getnetxxx netdb.h functions are available
14279 echo " "
14280 set d_getnetprotos getnetent $i_netdb netdb.h
14281 eval $hasproto
14282
14283 : see if getpagesize exists
14284 set getpagesize d_getpagsz
14285 eval $inlibc
14286
14287 : Optional checks for getprotobyname and getprotobynumber
14288
14289 : see if getprotobyname exists
14290 set getprotobyname d_getpbyname
14291 eval $inlibc
14292
14293 : see if getprotobynumber exists
14294 set getprotobynumber d_getpbynumber
14295 eval $inlibc
14296
14297 : see if getprotoent exists
14298 set getprotoent d_getpent
14299 eval $inlibc
14300
14301 : see if getpgid exists
14302 set getpgid d_getpgid
14303 eval $inlibc
14304
14305 : see if getpgrp2 exists
14306 set getpgrp2 d_getpgrp2
14307 eval $inlibc
14308
14309 : see if getppid exists
14310 set getppid d_getppid
14311 eval $inlibc
14312
14313 : see if getpriority exists
14314 set getpriority d_getprior
14315 eval $inlibc
14316
14317 : see if getprotobyname_r exists
14318 set getprotobyname_r d_getprotobyname_r
14319 eval $inlibc
14320 case "$d_getprotobyname_r" in
14321 "$define")
14322         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14323         case "$d_getprotobyname_r_proto:$usethreads" in
14324         ":define")      d_getprotobyname_r_proto=define
14325                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14326                 eval $hasproto ;;
14327         *)      ;;
14328         esac
14329         case "$d_getprotobyname_r_proto" in
14330         define)
14331         case "$getprotobyname_r_proto" in
14332         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14333         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14334         esac
14335         case "$getprotobyname_r_proto" in
14336         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14337         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14338         esac
14339         case "$getprotobyname_r_proto" in
14340         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14341         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14342         esac
14343         case "$getprotobyname_r_proto" in
14344         ''|0)   d_getprotobyname_r=undef
14345                 getprotobyname_r_proto=0
14346                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14347         * )     case "$getprotobyname_r_proto" in
14348                 REENTRANT_PROTO*) ;;
14349                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14350                 esac
14351                 echo "Prototype: $try" ;;
14352         esac
14353         ;;
14354         *)      case "$usethreads" in
14355                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14356                 esac
14357                 d_getprotobyname_r=undef
14358                 getprotobyname_r_proto=0
14359                 ;;
14360         esac
14361         ;;
14362 *)      getprotobyname_r_proto=0
14363         ;;
14364 esac
14365
14366 : see if getprotobynumber_r exists
14367 set getprotobynumber_r d_getprotobynumber_r
14368 eval $inlibc
14369 case "$d_getprotobynumber_r" in
14370 "$define")
14371         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14372         case "$d_getprotobynumber_r_proto:$usethreads" in
14373         ":define")      d_getprotobynumber_r_proto=define
14374                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14375                 eval $hasproto ;;
14376         *)      ;;
14377         esac
14378         case "$d_getprotobynumber_r_proto" in
14379         define)
14380         case "$getprotobynumber_r_proto" in
14381         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14382         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14383         esac
14384         case "$getprotobynumber_r_proto" in
14385         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14386         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14387         esac
14388         case "$getprotobynumber_r_proto" in
14389         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14390         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14391         esac
14392         case "$getprotobynumber_r_proto" in
14393         ''|0)   d_getprotobynumber_r=undef
14394                 getprotobynumber_r_proto=0
14395                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14396         * )     case "$getprotobynumber_r_proto" in
14397                 REENTRANT_PROTO*) ;;
14398                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14399                 esac
14400                 echo "Prototype: $try" ;;
14401         esac
14402         ;;
14403         *)      case "$usethreads" in
14404                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14405                 esac
14406                 d_getprotobynumber_r=undef
14407                 getprotobynumber_r_proto=0
14408                 ;;
14409         esac
14410         ;;
14411 *)      getprotobynumber_r_proto=0
14412         ;;
14413 esac
14414
14415 : see if getprotoent_r exists
14416 set getprotoent_r d_getprotoent_r
14417 eval $inlibc
14418 case "$d_getprotoent_r" in
14419 "$define")
14420         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14421         case "$d_getprotoent_r_proto:$usethreads" in
14422         ":define")      d_getprotoent_r_proto=define
14423                 set d_getprotoent_r_proto getprotoent_r $hdrs
14424                 eval $hasproto ;;
14425         *)      ;;
14426         esac
14427         case "$d_getprotoent_r_proto" in
14428         define)
14429         case "$getprotoent_r_proto" in
14430         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14431         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14432         esac
14433         case "$getprotoent_r_proto" in
14434         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14435         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14436         esac
14437         case "$getprotoent_r_proto" in
14438         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14439         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14440         esac
14441         case "$getprotoent_r_proto" in
14442         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14443         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14444         esac
14445         case "$getprotoent_r_proto" in
14446         ''|0)   d_getprotoent_r=undef
14447                 getprotoent_r_proto=0
14448                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14449         * )     case "$getprotoent_r_proto" in
14450                 REENTRANT_PROTO*) ;;
14451                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14452                 esac
14453                 echo "Prototype: $try" ;;
14454         esac
14455         ;;
14456         *)      case "$usethreads" in
14457                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14458                 esac
14459                 d_getprotoent_r=undef
14460                 getprotoent_r_proto=0
14461                 ;;
14462         esac
14463         ;;
14464 *)      getprotoent_r_proto=0
14465         ;;
14466 esac
14467
14468 : see if prototypes for various getprotoxxx netdb.h functions are available
14469 echo " "
14470 set d_getprotoprotos getprotoent $i_netdb netdb.h
14471 eval $hasproto
14472
14473 : see if getprpwnam exists
14474 set getprpwnam d_getprpwnam
14475 eval $inlibc
14476
14477 : see if getpwent exists
14478 set getpwent d_getpwent
14479 eval $inlibc
14480
14481 : see if getpwent_r exists
14482 set getpwent_r d_getpwent_r
14483 eval $inlibc
14484 case "$d_getpwent_r" in
14485 "$define")
14486         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14487         case "$d_getpwent_r_proto:$usethreads" in
14488         ":define")      d_getpwent_r_proto=define
14489                 set d_getpwent_r_proto getpwent_r $hdrs
14490                 eval $hasproto ;;
14491         *)      ;;
14492         esac
14493         case "$d_getpwent_r_proto" in
14494         define)
14495         case "$getpwent_r_proto" in
14496         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14497         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14498         esac
14499         case "$getpwent_r_proto" in
14500         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14501         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14502         esac
14503         case "$getpwent_r_proto" in
14504         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14505         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14506         esac
14507         case "$getpwent_r_proto" in
14508         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14509         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14510         esac
14511         case "$getpwent_r_proto" in
14512         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14513         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14514         esac
14515         case "$getpwent_r_proto" in
14516         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14517         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14518         esac
14519         case "$getpwent_r_proto" in
14520         ''|0)   d_getpwent_r=undef
14521                 getpwent_r_proto=0
14522                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14523         * )     case "$getpwent_r_proto" in
14524                 REENTRANT_PROTO*) ;;
14525                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14526                 esac
14527                 echo "Prototype: $try" ;;
14528         esac
14529         ;;
14530         *)      case "$usethreads" in
14531                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14532                 esac
14533                 d_getpwent_r=undef
14534                 getpwent_r_proto=0
14535                 ;;
14536         esac
14537         ;;
14538 *)      getpwent_r_proto=0
14539         ;;
14540 esac
14541
14542 : see if getpwnam_r exists
14543 set getpwnam_r d_getpwnam_r
14544 eval $inlibc
14545 case "$d_getpwnam_r" in
14546 "$define")
14547         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14548         case "$d_getpwnam_r_proto:$usethreads" in
14549         ":define")      d_getpwnam_r_proto=define
14550                 set d_getpwnam_r_proto getpwnam_r $hdrs
14551                 eval $hasproto ;;
14552         *)      ;;
14553         esac
14554         case "$d_getpwnam_r_proto" in
14555         define)
14556         case "$getpwnam_r_proto" in
14557         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14558         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14559         esac
14560         case "$getpwnam_r_proto" in
14561         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14562         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14563         esac
14564         case "$getpwnam_r_proto" in
14565         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14566         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14567         esac
14568         case "$getpwnam_r_proto" in
14569         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14570         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14571         esac
14572         case "$getpwnam_r_proto" in
14573         ''|0)   d_getpwnam_r=undef
14574                 getpwnam_r_proto=0
14575                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14576         * )     case "$getpwnam_r_proto" in
14577                 REENTRANT_PROTO*) ;;
14578                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14579                 esac
14580                 echo "Prototype: $try" ;;
14581         esac
14582         ;;
14583         *)      case "$usethreads" in
14584                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14585                 esac
14586                 d_getpwnam_r=undef
14587                 getpwnam_r_proto=0
14588                 ;;
14589         esac
14590         ;;
14591 *)      getpwnam_r_proto=0
14592         ;;
14593 esac
14594
14595 : see if getpwuid_r exists
14596 set getpwuid_r d_getpwuid_r
14597 eval $inlibc
14598 case "$d_getpwuid_r" in
14599 "$define")
14600         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14601         case "$d_getpwuid_r_proto:$usethreads" in
14602         ":define")      d_getpwuid_r_proto=define
14603                 set d_getpwuid_r_proto getpwuid_r $hdrs
14604                 eval $hasproto ;;
14605         *)      ;;
14606         esac
14607         case "$d_getpwuid_r_proto" in
14608         define)
14609         case "$getpwuid_r_proto" in
14610         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14611         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14612         esac
14613         case "$getpwuid_r_proto" in
14614         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14615         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14616         esac
14617         case "$getpwuid_r_proto" in
14618         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14619         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14620         esac
14621         case "$getpwuid_r_proto" in
14622         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14623         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14624         esac
14625         case "$getpwuid_r_proto" in
14626         ''|0)   d_getpwuid_r=undef
14627                 getpwuid_r_proto=0
14628                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14629         * )     case "$getpwuid_r_proto" in
14630                 REENTRANT_PROTO*) ;;
14631                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14632                 esac
14633                 echo "Prototype: $try" ;;
14634         esac
14635         ;;
14636         *)      case "$usethreads" in
14637                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14638                 esac
14639                 d_getpwuid_r=undef
14640                 getpwuid_r_proto=0
14641                 ;;
14642         esac
14643         ;;
14644 *)      getpwuid_r_proto=0
14645         ;;
14646 esac
14647
14648 : Optional checks for getsbyname and getsbyport
14649
14650 : see if getservbyname exists
14651 set getservbyname d_getsbyname
14652 eval $inlibc
14653
14654 : see if getservbyport exists
14655 set getservbyport d_getsbyport
14656 eval $inlibc
14657
14658 : see if getservent exists
14659 set getservent d_getsent
14660 eval $inlibc
14661
14662 : see if getservbyname_r exists
14663 set getservbyname_r d_getservbyname_r
14664 eval $inlibc
14665 case "$d_getservbyname_r" in
14666 "$define")
14667         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14668         case "$d_getservbyname_r_proto:$usethreads" in
14669         ":define")      d_getservbyname_r_proto=define
14670                 set d_getservbyname_r_proto getservbyname_r $hdrs
14671                 eval $hasproto ;;
14672         *)      ;;
14673         esac
14674         case "$d_getservbyname_r_proto" in
14675         define)
14676         case "$getservbyname_r_proto" in
14677         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14678         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14679         esac
14680         case "$getservbyname_r_proto" in
14681         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14682         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14683         esac
14684         case "$getservbyname_r_proto" in
14685         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14686         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14687         esac
14688         case "$getservbyname_r_proto" in
14689         ''|0)   d_getservbyname_r=undef
14690                 getservbyname_r_proto=0
14691                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14692         * )     case "$getservbyname_r_proto" in
14693                 REENTRANT_PROTO*) ;;
14694                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14695                 esac
14696                 echo "Prototype: $try" ;;
14697         esac
14698         ;;
14699         *)      case "$usethreads" in
14700                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14701                 esac
14702                 d_getservbyname_r=undef
14703                 getservbyname_r_proto=0
14704                 ;;
14705         esac
14706         ;;
14707 *)      getservbyname_r_proto=0
14708         ;;
14709 esac
14710
14711 : see if getservbyport_r exists
14712 set getservbyport_r d_getservbyport_r
14713 eval $inlibc
14714 case "$d_getservbyport_r" in
14715 "$define")
14716         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14717         case "$d_getservbyport_r_proto:$usethreads" in
14718         ":define")      d_getservbyport_r_proto=define
14719                 set d_getservbyport_r_proto getservbyport_r $hdrs
14720                 eval $hasproto ;;
14721         *)      ;;
14722         esac
14723         case "$d_getservbyport_r_proto" in
14724         define)
14725         case "$getservbyport_r_proto" in
14726         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14727         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14728         esac
14729         case "$getservbyport_r_proto" in
14730         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14731         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14732         esac
14733         case "$getservbyport_r_proto" in
14734         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14735         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14736         esac
14737         case "$getservbyport_r_proto" in
14738         ''|0)   d_getservbyport_r=undef
14739                 getservbyport_r_proto=0
14740                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14741         * )     case "$getservbyport_r_proto" in
14742                 REENTRANT_PROTO*) ;;
14743                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14744                 esac
14745                 echo "Prototype: $try" ;;
14746         esac
14747         ;;
14748         *)      case "$usethreads" in
14749                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14750                 esac
14751                 d_getservbyport_r=undef
14752                 getservbyport_r_proto=0
14753                 ;;
14754         esac
14755         ;;
14756 *)      getservbyport_r_proto=0
14757         ;;
14758 esac
14759
14760 : see if getservent_r exists
14761 set getservent_r d_getservent_r
14762 eval $inlibc
14763 case "$d_getservent_r" in
14764 "$define")
14765         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14766         case "$d_getservent_r_proto:$usethreads" in
14767         ":define")      d_getservent_r_proto=define
14768                 set d_getservent_r_proto getservent_r $hdrs
14769                 eval $hasproto ;;
14770         *)      ;;
14771         esac
14772         case "$d_getservent_r_proto" in
14773         define)
14774         case "$getservent_r_proto" in
14775         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14776         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14777         esac
14778         case "$getservent_r_proto" in
14779         ''|0) try='int getservent_r(struct servent*, char*, int);'
14780         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14781         esac
14782         case "$getservent_r_proto" in
14783         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14784         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14785         esac
14786         case "$getservent_r_proto" in
14787         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14788         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14789         esac
14790         case "$getservent_r_proto" in
14791         ''|0)   d_getservent_r=undef
14792                 getservent_r_proto=0
14793                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14794         * )     case "$getservent_r_proto" in
14795                 REENTRANT_PROTO*) ;;
14796                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14797                 esac
14798                 echo "Prototype: $try" ;;
14799         esac
14800         ;;
14801         *)      case "$usethreads" in
14802                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14803                 esac
14804                 d_getservent_r=undef
14805                 getservent_r_proto=0
14806                 ;;
14807         esac
14808         ;;
14809 *)      getservent_r_proto=0
14810         ;;
14811 esac
14812
14813 : see if prototypes for various getservxxx netdb.h functions are available
14814 echo " "
14815 set d_getservprotos getservent $i_netdb netdb.h
14816 eval $hasproto
14817
14818 : see if getspnam exists
14819 set getspnam d_getspnam
14820 eval $inlibc
14821
14822 : see if this is a shadow.h system
14823 set shadow.h i_shadow
14824 eval $inhdr
14825
14826 : see if getspnam_r exists
14827 set getspnam_r d_getspnam_r
14828 eval $inlibc
14829 case "$d_getspnam_r" in
14830 "$define")
14831         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14832         case "$d_getspnam_r_proto:$usethreads" in
14833         ":define")      d_getspnam_r_proto=define
14834                 set d_getspnam_r_proto getspnam_r $hdrs
14835                 eval $hasproto ;;
14836         *)      ;;
14837         esac
14838         case "$d_getspnam_r_proto" in
14839         define)
14840         case "$getspnam_r_proto" in
14841         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14842         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14843         esac
14844         case "$getspnam_r_proto" in
14845         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14846         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14847         esac
14848         case "$getspnam_r_proto" in
14849         ''|0)   d_getspnam_r=undef
14850                 getspnam_r_proto=0
14851                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14852         * )     case "$getspnam_r_proto" in
14853                 REENTRANT_PROTO*) ;;
14854                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14855                 esac
14856                 echo "Prototype: $try" ;;
14857         esac
14858         ;;
14859         *)      case "$usethreads" in
14860                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14861                 esac
14862                 d_getspnam_r=undef
14863                 getspnam_r_proto=0
14864                 ;;
14865         esac
14866         ;;
14867 *)      getspnam_r_proto=0
14868         ;;
14869 esac
14870
14871 : see if gettimeofday or ftime exists
14872 set gettimeofday d_gettimeod
14873 eval $inlibc
14874 case "$d_gettimeod" in
14875 "$undef")
14876         set ftime d_ftime 
14877         eval $inlibc
14878         ;;
14879 *)
14880         val="$undef"; set d_ftime; eval $setvar
14881         ;;
14882 esac
14883 case "$d_gettimeod$d_ftime" in
14884 "$undef$undef")
14885         echo " "
14886         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14887         ;;
14888 esac
14889
14890 : see if gmtime_r exists
14891 set gmtime_r d_gmtime_r
14892 eval $inlibc
14893 case "$d_gmtime_r" in
14894 "$define")
14895         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14896         case "$d_gmtime_r_proto:$usethreads" in
14897         ":define")      d_gmtime_r_proto=define
14898                 set d_gmtime_r_proto gmtime_r $hdrs
14899                 eval $hasproto ;;
14900         *)      ;;
14901         esac
14902         case "$d_gmtime_r_proto" in
14903         define)
14904         case "$gmtime_r_proto" in
14905         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14906         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14907         esac
14908         case "$gmtime_r_proto" in
14909         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14910         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14911         esac
14912         case "$gmtime_r_proto" in
14913         ''|0)   d_gmtime_r=undef
14914                 gmtime_r_proto=0
14915                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14916         * )     case "$gmtime_r_proto" in
14917                 REENTRANT_PROTO*) ;;
14918                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14919                 esac
14920                 echo "Prototype: $try" ;;
14921         esac
14922         ;;
14923         *)      case "$usethreads" in
14924                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14925                 esac
14926                 d_gmtime_r=undef
14927                 gmtime_r_proto=0
14928                 ;;
14929         esac
14930         ;;
14931 *)      gmtime_r_proto=0
14932         ;;
14933 esac
14934
14935 : see if hasmntopt exists
14936 set hasmntopt d_hasmntopt
14937 eval $inlibc
14938
14939 : see if this is a netinet/in.h or sys/in.h system
14940 set netinet/in.h i_niin sys/in.h i_sysin
14941 eval $inhdr
14942
14943 : see if arpa/inet.h has to be included
14944 set arpa/inet.h i_arpainet
14945 eval $inhdr
14946
14947 : see if htonl --and friends-- exists
14948 val=''
14949 set htonl val
14950 eval $inlibc
14951
14952 : Maybe they are macros.
14953 case "$val" in
14954 $undef)
14955         $cat >htonl.c <<EOM
14956 #include <stdio.h>
14957 #include <sys/types.h>
14958 #$i_niin I_NETINET_IN
14959 #$i_sysin I_SYS_IN
14960 #$i_arpainet I_ARPA_INET
14961 #ifdef I_NETINET_IN
14962 #include <netinet/in.h>
14963 #endif
14964 #ifdef I_SYS_IN
14965 #include <sys/in.h>
14966 #endif
14967 #ifdef I_ARPA_INET
14968 #include <arpa/inet.h>
14969 #endif
14970 #ifdef htonl
14971 printf("Defined as a macro.");
14972 #endif
14973 EOM
14974         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14975         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14976                 val="$define"
14977                 echo "But it seems to be defined as a macro." >&4
14978         fi
14979         $rm -f htonl.?
14980         ;;
14981 esac
14982 set d_htonl
14983 eval $setvar
14984
14985 : see if ilogbl exists
14986 set ilogbl d_ilogbl
14987 eval $inlibc
14988
14989 : index or strchr
14990 echo " "
14991 if set index val -f; eval $csym; $val; then
14992         if set strchr val -f d_strchr; eval $csym; $val; then
14993                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14994                         val="$define"
14995                         vali="$undef"
14996                         echo "strchr() found." >&4
14997                 else
14998                         val="$undef"
14999                         vali="$define"
15000                         echo "index() found." >&4
15001                 fi
15002         else
15003                 val="$undef"
15004                 vali="$define"
15005                 echo "index() found." >&4
15006         fi
15007 else
15008         if set strchr val -f d_strchr; eval $csym; $val; then
15009                 val="$define"
15010                 vali="$undef"
15011                 echo "strchr() found." >&4
15012         else
15013                 echo "No index() or strchr() found!" >&4
15014                 val="$undef"
15015                 vali="$undef"
15016         fi
15017 fi
15018 set d_strchr; eval $setvar
15019 val="$vali"
15020 set d_index; eval $setvar
15021
15022 : check whether inet_aton exists
15023 set inet_aton d_inetaton
15024 eval $inlibc
15025
15026 : see if inet_ntop exists
15027 set inet_ntop d_inetntop
15028 eval $inlibc
15029
15030 : see if inet_pton exists
15031 set inet_pton d_inetpton
15032 eval $inlibc
15033
15034 : Look for isascii
15035 echo " "
15036 $cat >isascii.c <<EOCP
15037 #include <stdio.h>
15038 #include <ctype.h>
15039 #$i_stdlib I_STDLIB
15040 #ifdef I_STDLIB
15041 #include <stdlib.h>
15042 #endif
15043 int main() {
15044         int c = 'A';
15045         if (isascii(c))
15046                 exit(0);
15047         else
15048                 exit(1);
15049 }
15050 EOCP
15051 set isascii
15052 if eval $compile; then
15053         echo "isascii() found." >&4
15054         val="$define"
15055 else
15056         echo "isascii() NOT found." >&4
15057         val="$undef"
15058 fi
15059 set d_isascii
15060 eval $setvar
15061 $rm -f isascii*
15062
15063 : Look for isblank
15064 echo " "
15065 $cat >isblank.c <<'EOCP'
15066 #include <stdio.h>
15067 #include <ctype.h>
15068 int main() {
15069         int c = ' ';
15070         if (isblank(c))
15071                 return 0 ;
15072         else
15073                 return 1 ;
15074 }
15075 EOCP
15076 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15077         echo "isblank() found." >&4
15078         val="$define"
15079 else
15080         echo "isblank() NOT found." >&4
15081         val="$undef"
15082 fi
15083 set d_isblank
15084 eval $setvar
15085 $rm -f isblank*
15086
15087 : see if isfinite exists
15088 set isfinite d_isfinite
15089 eval $inlibc
15090
15091 : see if isinf exists
15092 set isinf d_isinf
15093 eval $inlibc
15094
15095 : see if isnan exists
15096 set isnan d_isnan
15097 eval $inlibc
15098
15099 : see if isnanl exists
15100 set isnanl d_isnanl
15101 eval $inlibc
15102
15103 : see if killpg exists
15104 set killpg d_killpg
15105 eval $inlibc
15106
15107 : see if lchown exists
15108 echo " "
15109 $cat > try.c <<'EOCP'
15110 /* System header to define __stub macros and hopefully few prototypes,
15111     which can conflict with char lchown(); below.  */
15112 #include <assert.h>
15113 /* Override any gcc2 internal prototype to avoid an error.  */
15114 /* We use char because int might match the return type of a gcc2
15115    builtin and then its argument prototype would still apply.  */
15116 char lchown();
15117 int main() {
15118     /*  The GNU C library defines this for functions which it implements
15119         to always fail with ENOSYS.  Some functions are actually named
15120         something starting with __ and the normal name is an alias.  */
15121 #if defined (__stub_lchown) || defined (__stub___lchown)
15122 choke me
15123 #else
15124 lchown();
15125 #endif
15126 ; return 0; }
15127 EOCP
15128 set try
15129 if eval $compile; then
15130     $echo "lchown() found." >&4
15131     val="$define"
15132 else
15133     $echo "lchown() NOT found." >&4
15134     val="$undef"
15135 fi
15136 set d_lchown
15137 eval $setvar
15138
15139 : See if number of significant digits in a double precision number is known
15140 echo " "
15141 $cat >ldbl_dig.c <<EOM
15142 #$i_limits I_LIMITS
15143 #$i_float I_FLOAT
15144 #ifdef I_LIMITS
15145 #include <limits.h>
15146 #endif
15147 #ifdef I_FLOAT
15148 #include <float.h>
15149 #endif
15150 #ifdef LDBL_DIG
15151 printf("Contains LDBL_DIG");
15152 #endif
15153 EOM
15154 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15155 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15156         echo "LDBL_DIG found." >&4
15157         val="$define"
15158 else
15159         echo "LDBL_DIG NOT found." >&4
15160         val="$undef"
15161 fi
15162 $rm -f ldbl_dig.?
15163 set d_ldbl_dig
15164 eval $setvar
15165
15166 : see if this is a math.h system
15167 set math.h i_math
15168 eval $inhdr
15169
15170 : check to see if math.h defines _LIB_VERSION
15171 d_libm_lib_version="$undef"
15172 case $i_math in
15173     $define)
15174         echo " "
15175         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15176         $cat >try.c <<EOCP
15177 #include <unistd.h>
15178 #include <math.h>
15179 int main (int argc, char *argv[])
15180 {
15181     printf ("%d\n", _LIB_VERSION);
15182     return (0);
15183     } /* main */
15184 EOCP
15185         set try
15186         if eval $compile; then
15187             foo=`$run ./try`
15188             echo "Yes, it does ($foo)" >&4
15189             d_libm_lib_version="$define"
15190         else
15191             echo "No, it does not (probably harmless)" >&4
15192             fi
15193         $rm_try
15194         ;;
15195
15196     esac
15197
15198 : see if link exists
15199 set link d_link
15200 eval $inlibc
15201
15202 : see if localtime_r exists
15203 set localtime_r d_localtime_r
15204 eval $inlibc
15205 case "$d_localtime_r" in
15206 "$define")
15207         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15208         case "$d_localtime_r_proto:$usethreads" in
15209         ":define")      d_localtime_r_proto=define
15210                 set d_localtime_r_proto localtime_r $hdrs
15211                 eval $hasproto ;;
15212         *)      ;;
15213         esac
15214         case "$d_localtime_r_proto" in
15215         define)
15216         case "$localtime_r_proto" in
15217         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15218         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15219         esac
15220         case "$localtime_r_proto" in
15221         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15222         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15223         esac
15224         case "$localtime_r_proto" in
15225         ''|0)   d_localtime_r=undef
15226                 localtime_r_proto=0
15227                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15228         * )     case "$localtime_r_proto" in
15229                 REENTRANT_PROTO*) ;;
15230                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15231                 esac
15232                 echo "Prototype: $try" ;;
15233         esac
15234         ;;
15235         *)      case "$usethreads" in
15236                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15237                 esac
15238                 d_localtime_r=undef
15239                 localtime_r_proto=0
15240                 ;;
15241         esac
15242         ;;
15243 *)      localtime_r_proto=0
15244         ;;
15245 esac
15246
15247 : see if localtime_r calls tzset
15248 case "$localtime_r_proto" in
15249 REENTRANT_PROTO*)
15250         $cat >try.c <<EOCP
15251 /*  Does our libc's localtime_r call tzset ?
15252  *  return 0 if so, 1 otherwise.
15253  */
15254 #$i_systypes    I_SYS_TYPES
15255 #$i_unistd      I_UNISTD
15256 #$i_time        I_TIME
15257 #$i_stdlib      I_STDLIB
15258 #$i_string      I_STRING
15259 #$i_malloc      I_MALLOC
15260 #ifdef I_SYS_TYPES
15261 #  include <sys/types.h>
15262 #endif
15263 #ifdef I_UNISTD
15264 #  include <unistd.h>
15265 #endif
15266 #ifdef I_TIME
15267 #  include <time.h>
15268 #endif
15269 #ifdef I_STDLIB
15270 #include <stdlib.h>
15271 #endif
15272 #ifdef I_STRING
15273 #  include <string.h>
15274 #else
15275 #  include <strings.h>
15276 #endif
15277 #ifdef I_MALLOC
15278 #  include <malloc.h>
15279 #endif
15280 int main()
15281 {
15282     time_t t = time(0L);
15283     char w_tz[]="TZ" "=GMT+5",
15284          e_tz[]="TZ" "=GMT-5",
15285         *tz_e = (char*)malloc(16),
15286         *tz_w = (char*)malloc(16);
15287     struct tm tm_e, tm_w;
15288     memset(&tm_e,'\0',sizeof(struct tm));
15289     memset(&tm_w,'\0',sizeof(struct tm));
15290     strcpy(tz_e,e_tz);
15291     strcpy(tz_w,w_tz);
15292
15293     putenv(tz_e);
15294     localtime_r(&t, &tm_e);
15295
15296     putenv(tz_w);
15297     localtime_r(&t, &tm_w);
15298
15299     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15300         return 1;
15301     return 0;
15302 }
15303 EOCP
15304         set try
15305         if eval $compile; then
15306             if $run ./try; then
15307                 d_localtime_r_needs_tzset=undef;
15308             else
15309                 d_localtime_r_needs_tzset=define;
15310             fi;
15311         else
15312             d_localtime_r_needs_tzset=undef;
15313         fi;
15314      ;;
15315   *)
15316      d_localtime_r_needs_tzset=undef;
15317      ;;
15318 esac
15319 $rm_try
15320
15321 : see if localeconv exists
15322 set localeconv d_locconv
15323 eval $inlibc
15324
15325 : see if lockf exists
15326 set lockf d_lockf
15327 eval $inlibc
15328
15329 : see if prototype for lseek is available
15330 echo " "
15331 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15332 eval $hasproto
15333
15334 : see if lstat exists
15335 set lstat d_lstat
15336 eval $inlibc
15337
15338 : see if madvise exists
15339 set madvise d_madvise
15340 eval $inlibc
15341
15342 : see if malloc_size exists
15343 set malloc_size d_malloc_size
15344 eval $inlibc
15345
15346 : see if malloc_size_good exists
15347 set malloc_good_size d_malloc_good_size
15348 eval $inlibc
15349
15350 : see if mblen exists
15351 set mblen d_mblen
15352 eval $inlibc
15353
15354 : see if mbstowcs exists
15355 set mbstowcs d_mbstowcs
15356 eval $inlibc
15357
15358 : see if mbtowc exists
15359 set mbtowc d_mbtowc
15360 eval $inlibc
15361
15362 : see if memchr exists
15363 set memchr d_memchr
15364 eval $inlibc
15365
15366 : see if memcmp exists
15367 set memcmp d_memcmp
15368 eval $inlibc
15369
15370 : see if memcpy exists
15371 set memcpy d_memcpy
15372 eval $inlibc
15373
15374 : see if memmove exists
15375 set memmove d_memmove
15376 eval $inlibc
15377
15378 : see if memset exists
15379 set memset d_memset
15380 eval $inlibc
15381
15382 : see if mkdir exists
15383 set mkdir d_mkdir
15384 eval $inlibc
15385
15386 : see if mkdtemp exists
15387 set mkdtemp d_mkdtemp
15388 eval $inlibc
15389
15390 : see if mkfifo exists
15391 set mkfifo d_mkfifo
15392 eval $inlibc
15393
15394 : see if mkstemp exists
15395 set mkstemp d_mkstemp
15396 eval $inlibc
15397
15398 : see if mkstemps exists
15399 set mkstemps d_mkstemps
15400 eval $inlibc
15401
15402 : see if mktime exists
15403 set mktime d_mktime
15404 eval $inlibc
15405
15406 : see if this is a sys/mman.h system
15407 set sys/mman.h i_sysmman
15408 eval $inhdr
15409
15410 : see if mmap exists
15411 set mmap d_mmap
15412 eval $inlibc
15413 : see what shmat returns
15414 : default to something harmless
15415 mmaptype='void *'
15416 case "$i_sysmman$d_mmap" in
15417 "$define$define")
15418         $cat >mmap.c <<'END'
15419 #include <sys/mman.h>
15420 void *mmap();
15421 END
15422         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15423                 mmaptype='void *'
15424         else
15425                 mmaptype='caddr_t'
15426         fi
15427         echo "and it returns ($mmaptype)." >&4
15428         ;;
15429 esac
15430
15431
15432
15433 : see if sqrtl exists
15434 set sqrtl d_sqrtl
15435 eval $inlibc
15436
15437 : see if scalbnl exists
15438 set scalbnl d_scalbnl
15439 eval $inlibc
15440
15441 : see if modfl exists
15442 set modfl d_modfl
15443 eval $inlibc
15444
15445 : see if prototype for modfl is available
15446 echo " "
15447 set d_modflproto modfl $i_math math.h
15448 eval $hasproto
15449
15450 d_modfl_pow32_bug="$undef"
15451
15452 case "$d_longdbl$d_modfl" in
15453 $define$define)
15454         $cat <<EOM
15455 Checking to see whether your modfl() is okay for large values...
15456 EOM
15457 $cat >try.c <<EOCP
15458 #include <math.h>
15459 #include <stdio.h>
15460 EOCP
15461 if $test "X$d_modflproto" != "X$define"; then
15462         $cat >>try.c <<EOCP
15463 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15464 long double modfl (long double, long double *);
15465 EOCP
15466 fi
15467 $cat >>try.c <<EOCP
15468 int main() {
15469     long double nv = 4294967303.15;
15470     long double v, w;
15471     v = modfl(nv, &w);
15472 #ifdef __GLIBC__
15473     printf("glibc");
15474 #endif
15475     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15476     return 0;
15477 }
15478 EOCP
15479         case "$osname:$gccversion" in
15480         aix:)   saveccflags="$ccflags"
15481                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15482         esac
15483         set try
15484         if eval $compile; then
15485                 foo=`$run ./try`
15486                 case "$foo" in
15487                 *" 4294967303.150000 1.150000 4294967302.000000")
15488                         echo >&4 "Your modfl() is broken for large values."
15489                         d_modfl_pow32_bug="$define"
15490                         case "$foo" in
15491                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15492                         ;;
15493                         esac
15494                         ;;
15495                 *" 4294967303.150000 0.150000 4294967303.000000")
15496                         echo >&4 "Your modfl() seems okay for large values."
15497                         ;;
15498                 *)      echo >&4 "I don't understand your modfl() at all."
15499                         d_modfl="$undef"
15500                         ;;
15501                 esac
15502                 $rm_try
15503         else
15504                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15505                 d_modfl="$undef"
15506         fi
15507         case "$osname:$gccversion" in
15508         aix:)   ccflags="$saveccflags" ;; # restore
15509         esac
15510         ;;
15511 esac
15512
15513 if $test "$uselongdouble" = "$define"; then
15514     message=""
15515     if $test "$d_sqrtl" != "$define"; then
15516         message="$message sqrtl"
15517     fi
15518     if $test "$d_modfl" != "$define"; then
15519         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15520             echo "You have both aintl and copysignl, so I can emulate modfl."
15521         else
15522             message="$message modfl"
15523         fi
15524     fi
15525     if $test "$d_frexpl" != "$define"; then
15526         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15527             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15528         else
15529             message="$message frexpl"
15530         fi
15531     fi
15532
15533     if $test "$message" != ""; then
15534         $cat <<EOM >&4
15535
15536 *** You requested the use of long doubles but you do not seem to have
15537 *** the following mathematical functions needed for long double support:
15538 ***    $message
15539 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15540 *** Cannot continue, aborting.
15541
15542 EOM
15543
15544         exit 1
15545     fi
15546 fi
15547
15548 : see if mprotect exists
15549 set mprotect d_mprotect
15550 eval $inlibc
15551
15552 : see if msgctl exists
15553 set msgctl d_msgctl
15554 eval $inlibc
15555
15556 : see if msgget exists
15557 set msgget d_msgget
15558 eval $inlibc
15559
15560 : see if msgsnd exists
15561 set msgsnd d_msgsnd
15562 eval $inlibc
15563
15564 : see if msgrcv exists
15565 set msgrcv d_msgrcv
15566 eval $inlibc
15567
15568 : see how much of the 'msg*(2)' library is present.
15569 h_msg=true
15570 echo " "
15571 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15572 *"$undef"*) h_msg=false;;
15573 esac
15574 case "$osname" in
15575 freebsd)
15576     case "`ipcs 2>&1`" in
15577     "SVID messages"*"not configured"*)
15578         echo "Your $osname does not have the msg*(2) configured." >&4
15579         h_msg=false
15580         val="$undef"
15581         set msgctl d_msgctl
15582         eval $setvar
15583         set msgget d_msgget
15584         eval $setvar
15585         set msgsnd d_msgsnd
15586         eval $setvar
15587         set msgrcv d_msgrcv
15588         eval $setvar
15589         ;;
15590     esac
15591     ;;
15592 esac
15593 : we could also check for sys/ipc.h ...
15594 if $h_msg && $test `./findhdr sys/msg.h`; then
15595         echo "You have the full msg*(2) library." >&4
15596         val="$define"
15597 else
15598         echo "You don't have the full msg*(2) library." >&4
15599         val="$undef"
15600 fi
15601 set d_msg
15602 eval $setvar
15603
15604 : Check for msghdr_s
15605 echo " "
15606 echo "Checking to see if your system supports struct msghdr..." >&4
15607 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15608 eval $hasstruct
15609 case "$d_msghdr_s" in
15610 "$define")      echo "Yes, it does."   ;;
15611 *)              echo "No, it doesn't." ;;
15612 esac
15613
15614
15615 : see if msync exists
15616 set msync d_msync
15617 eval $inlibc
15618
15619 : see if munmap exists
15620 set munmap d_munmap
15621 eval $inlibc
15622
15623 : see if nice exists
15624 set nice d_nice
15625 eval $inlibc
15626
15627 : see if this is a langinfo.h system
15628 set langinfo.h i_langinfo
15629 eval $inhdr
15630
15631 : see if nl_langinfo exists
15632 set nl_langinfo d_nl_langinfo
15633 eval $inlibc
15634
15635 : check for volatile keyword
15636 echo " "
15637 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15638 $cat >try.c <<'EOCP'
15639 int main()
15640 {
15641         typedef struct _goo_struct goo_struct;
15642         goo_struct * volatile goo = ((goo_struct *)0);
15643         struct _goo_struct {
15644                 long long_int;
15645                 int reg_int;
15646                 char char_var;
15647         };
15648         typedef unsigned short foo_t;
15649         char *volatile foo;
15650         volatile int bar;
15651         volatile foo_t blech;
15652         foo = foo;
15653 }
15654 EOCP
15655 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15656         val="$define"
15657         echo "Yup, it does."
15658 else
15659         val="$undef"
15660         echo "Nope, it doesn't."
15661 fi
15662 set d_volatile
15663 eval $setvar
15664 $rm_try
15665
15666 : Check basic sizes
15667 echo " "
15668 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15669
15670 case "$use64bitint:$d_quad:$quadtype" in
15671 define:define:?*)
15672         ivtype="$quadtype"
15673         uvtype="$uquadtype"
15674         ivsize=8
15675         uvsize=8
15676         ;;
15677 *)      ivtype="long"
15678         uvtype="unsigned long"
15679         ivsize=$longsize
15680         uvsize=$longsize
15681         ;;
15682 esac
15683
15684 case "$uselongdouble:$d_longdbl" in
15685 define:define)
15686         nvtype="long double"
15687         nvsize=$longdblsize
15688         ;;
15689 *)      nvtype=double
15690         nvsize=$doublesize
15691         ;;
15692 esac
15693
15694 $echo "(IV will be "$ivtype", $ivsize bytes)"
15695 $echo "(UV will be "$uvtype", $uvsize bytes)"
15696 $echo "(NV will be "$nvtype", $nvsize bytes)"
15697
15698 $cat >try.c <<EOCP
15699 #$i_inttypes I_INTTYPES
15700 #ifdef I_INTTYPES
15701 #include <inttypes.h>
15702 #endif
15703 #include <stdio.h>
15704 int main() {
15705 #ifdef INT8
15706    int8_t i =  INT8_MAX;
15707   uint8_t u = UINT8_MAX;
15708   printf("int8_t\n");
15709 #endif
15710 #ifdef INT16
15711    int16_t i =  INT16_MAX;
15712   uint16_t i = UINT16_MAX;
15713   printf("int16_t\n");
15714 #endif
15715 #ifdef INT32
15716    int32_t i =  INT32_MAX;
15717   uint32_t u = UINT32_MAX;
15718   printf("int32_t\n");
15719 #endif
15720 }
15721 EOCP
15722
15723 i8type="signed char"
15724 u8type="unsigned char"
15725 i8size=1
15726 u8size=1
15727
15728 case "$i16type" in
15729 '')     case "$shortsize" in
15730         2)      i16type=short
15731                 u16type="unsigned short"
15732                 i16size=$shortsize
15733                 u16size=$shortsize
15734                 ;;
15735         esac
15736         ;;
15737 esac
15738 case "$i16type" in
15739 '')     set try -DINT16
15740         if eval $compile; then
15741                 case "`$run ./try`" in
15742                 int16_t)
15743                         i16type=int16_t
15744                         u16type=uint16_t
15745                         i16size=2
15746                         u16size=2
15747                         ;;
15748                 esac
15749         fi
15750         ;;
15751 esac
15752 case "$i16type" in
15753 '')     if $test $shortsize -ge 2; then
15754                 i16type=short
15755                 u16type="unsigned short"
15756                 i16size=$shortsize
15757                 u16size=$shortsize
15758         fi
15759         ;;
15760 esac
15761
15762 case "$i32type" in
15763 '')     case "$longsize" in
15764         4)      i32type=long
15765                 u32type="unsigned long"
15766                 i32size=$longsize
15767                 u32size=$longsize
15768                 ;;
15769         *)      case "$intsize" in
15770                 4)      i32type=int
15771                         u32type="unsigned int"
15772                         i32size=$intsize
15773                         u32size=$intsize
15774                         ;;
15775                 esac
15776                 ;;
15777         esac
15778         ;;
15779 esac
15780 case "$i32type" in
15781 '')     set try -DINT32
15782         if eval $compile; then
15783                 case "`$run ./try`" in
15784                 int32_t)
15785                         i32type=int32_t
15786                         u32type=uint32_t
15787                         i32size=4
15788                         u32size=4
15789                         ;;
15790                 esac
15791         fi
15792         ;;
15793 esac
15794 case "$i32type" in
15795 '')     if $test $intsize -ge 4; then
15796                 i32type=int
15797                 u32type="unsigned int"
15798                 i32size=$intsize
15799                 u32size=$intsize
15800         fi
15801         ;;
15802 esac
15803
15804 case "$i64type" in
15805 '')     case "$d_quad:$quadtype" in
15806         define:?*)
15807                 i64type="$quadtype"
15808                 u64type="$uquadtype"
15809                 i64size=8
15810                 u64size=8
15811                 ;;
15812         esac
15813         ;;
15814 esac
15815
15816 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15817 : volatile so that the compiler has to store it out to memory.
15818 if test X"$d_volatile" = X"$define"; then
15819         volatile=volatile
15820 fi
15821 $cat <<EOP >try.c
15822 #include <stdio.h>
15823 #$i_stdlib I_STDLIB
15824 #ifdef I_STDLIB
15825 #include <stdlib.h>
15826 #endif
15827 #include <sys/types.h>
15828 #include <signal.h>
15829 #ifdef SIGFPE
15830 $volatile int bletched = 0;
15831 $signal_t blech(int s) { bletched = 1; }
15832 #endif
15833 int main() {
15834     $uvtype u = 0;
15835     $nvtype d;
15836     int     n = 8 * $uvsize;
15837     int     i;
15838 #ifdef SIGFPE
15839     signal(SIGFPE, blech);
15840 #endif
15841
15842     for (i = 0; i < n; i++) {
15843       u = u << 1 | ($uvtype)1;
15844       d = ($nvtype)u;
15845       if (($uvtype)d != u)
15846         break;
15847       if (d <= 0)
15848         break;
15849       d = ($nvtype)(u - 1);
15850       if (($uvtype)d != (u - 1))
15851         break;
15852 #ifdef SIGFPE
15853       if (bletched)
15854         break;
15855 #endif
15856     }
15857     printf("%d\n", ((i == n) ? -n : i));
15858     exit(0);
15859 }
15860 EOP
15861 set try
15862
15863 d_nv_preserves_uv="$undef"
15864 if eval $compile; then
15865         nv_preserves_uv_bits="`$run ./try`"
15866 fi
15867 case "$nv_preserves_uv_bits" in
15868 \-[1-9]*)
15869         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15870         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15871         d_nv_preserves_uv="$define"
15872         ;;
15873 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15874         d_nv_preserves_uv="$undef" ;;
15875 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15876         nv_preserves_uv_bits="0" ;;
15877 esac
15878 $rm_try
15879
15880 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15881 : volatile so that the compiler has to store it out to memory.
15882 if test X"$d_volatile" = X"$define"; then
15883         volatile=volatile
15884 fi
15885 $cat <<EOP >try.c
15886 #include <stdio.h>
15887
15888 typedef $nvtype NV;
15889
15890 int
15891 main() {
15892   NV value = 2;
15893   int count = 1;
15894
15895   while(count < 256) {
15896     $volatile NV up = value + 1.0;
15897     $volatile NV negated = -value;
15898     $volatile NV down = negated - 1.0;
15899     $volatile NV got_up = up - value;
15900     int up_good = got_up == 1.0;
15901     int got_down = down - negated;
15902     int down_good = got_down == -1.0;
15903
15904     if (down_good != up_good) {
15905       fprintf(stderr,
15906               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15907               up_good, (double) got_up, down_good, (double) got_down,
15908               count, (double) value);
15909       return 1;
15910     }
15911     if (!up_good) {
15912       while (1) {
15913         if (count > 8) {
15914           count -= 8;
15915           fputs("256.0", stdout);
15916         } else {
15917           count--;
15918           fputs("2.0", stdout);
15919         }
15920         if (!count) {
15921           puts("");
15922           return 0;
15923         }
15924         fputs("*", stdout);
15925       }
15926     }
15927     value *= 2;
15928     ++count;
15929   }
15930   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15931           count, (double) value);
15932   return 1;
15933 }
15934 EOP
15935 set try
15936
15937 nv_overflows_integers_at='0'
15938 if eval $compile; then
15939     xxx="`$run ./try`"
15940     case "$?" in
15941         0)
15942             case "$xxx" in
15943                 2*)  cat >&4 <<EOM
15944 The largest integer your NVs can preserve is equal to $xxx
15945 EOM
15946                     nv_overflows_integers_at="$xxx"
15947                     ;;
15948                 *)  cat >&4 <<EOM
15949 Cannot determine the largest integer value your NVs can hold, unexpected output
15950 '$xxx'
15951 EOM
15952                     ;;
15953             esac
15954             ;;
15955         *)  cat >&4 <<EOM
15956 Cannot determine the largest integer value your NVs can hold
15957 EOM
15958             ;;
15959     esac
15960 fi
15961 $rm_try
15962
15963 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15964 : volatile so that the compiler has to store it out to memory.
15965 if test X"$d_volatile" = X"$define"; then
15966         volatile=volatile
15967 fi
15968 $cat <<EOP >try.c
15969 #include <stdio.h>
15970 #$i_stdlib I_STDLIB
15971 #ifdef I_STDLIB
15972 #include <stdlib.h>
15973 #endif
15974 #$i_string I_STRING
15975 #ifdef I_STRING
15976 #  include <string.h>
15977 #else
15978 #  include <strings.h>
15979 #endif
15980 #include <sys/types.h>
15981 #include <signal.h>
15982 #ifdef SIGFPE
15983 $volatile int bletched = 0;
15984 $signal_t blech(int s) { bletched = 1; }
15985 #endif
15986
15987 int checkit($nvtype d, char *where) {
15988     unsigned char *p = (char *)&d;
15989     unsigned char *end = p + sizeof(d);
15990     int fail = 0;
15991
15992     while (p < end)
15993         fail += *p++;
15994
15995     if (!fail)
15996         return 0;
15997
15998     p = (char *)&d;
15999     printf("No - %s: 0x", where);
16000     while (p < end)
16001         printf ("%02X", *p++);
16002     printf("\n");
16003     return 1;
16004 }
16005
16006 int main(int argc, char **argv) {
16007     $nvtype d = 0.0;
16008     int fail = 0;
16009     fail += checkit(d, "0.0");
16010
16011     /* The compiler shouldn't be assuming that bletched is 0  */
16012     d = bletched;
16013
16014     fail += checkit(d, "bleched");
16015
16016 #ifdef SIGFPE
16017     signal(SIGFPE, blech);
16018 #endif
16019
16020     /* Paranoia - the compiler should have no way of knowing that ANSI says
16021        that argv[argc] will always be NULL.  Actually, if it did assume this it
16022        would be buggy, as this is C and main() can be called from elsewhere in
16023        the program.  */
16024     d = argv[argc] ? 1 : 0;
16025
16026     if (d) {
16027         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16028     }
16029
16030     fail += checkit(d, "ternary");
16031
16032     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16033
16034     if (d != 0.0) {
16035         printf("No - memset doesn't give 0.0\n");
16036         /* This might just blow up:  */
16037         printf("(gives %g)\n", d);
16038         return 1;
16039     }
16040
16041 #ifdef SIGFPE
16042     if (bletched) {
16043         printf("No - something bleched\n");
16044         return 1;
16045     }
16046 #endif
16047     if (fail) {
16048       printf("No - %d fail(s)\n", fail);
16049       return 1;
16050     }
16051     printf("Yes\n");
16052     return 0;
16053 }
16054 EOP
16055 set try
16056
16057 d_nv_zero_is_allbits_zero="$undef"
16058 if eval $compile; then
16059     xxx="`$run ./try`"
16060     case "$?" in
16061         0)
16062             case "$xxx" in
16063                 Yes)  cat >&4 <<EOM
16064 0.0 is represented as all bits zero in memory
16065 EOM
16066                     d_nv_zero_is_allbits_zero="$define"
16067                     ;;
16068                 *)  cat >&4 <<EOM
16069 0.0 is not represented as all bits zero in memory
16070 EOM
16071                     d_nv_zero_is_allbits_zero="$undef"
16072                     ;;
16073             esac
16074             ;;
16075         *)  cat >&4 <<EOM
16076 0.0 is not represented as all bits zero in memory
16077 EOM
16078             d_nv_zero_is_allbits_zero="$undef"
16079             ;;
16080     esac
16081 fi
16082 $rm_try
16083
16084 : check for off64_t
16085 echo " "
16086 echo "Checking to see if you have off64_t..." >&4
16087 $cat >try.c <<EOCP
16088 #include <sys/types.h>
16089 #include <unistd.h>
16090 int main() { off64_t x = 7; }
16091 EOCP
16092 set try
16093 if eval $compile; then
16094         val="$define"
16095         echo "You have off64_t."
16096 else
16097         val="$undef"
16098         echo "You do not have off64_t."
16099         case "$lseeksize" in
16100         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16101         esac
16102 fi
16103 $rm_try
16104 set d_off64_t
16105 eval $setvar
16106
16107 : how to create joinable pthreads
16108 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16109         echo " "
16110         echo "Checking what constant to use for creating joinable pthreads..." >&4
16111         $cat >try.c <<'EOCP'
16112 #include <pthread.h>
16113 int main() {
16114     int detachstate = JOINABLE;
16115 }
16116 EOCP
16117         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16118         if eval $compile; then
16119                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16120                 val="$undef" # Yes, undef.
16121                 set d_old_pthread_create_joinable
16122                 eval $setvar
16123                 val=""
16124                 set old_pthread_create_joinable
16125                 eval $setvar
16126         else
16127                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16128                 if eval $compile; then
16129                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16130                         val="$define"
16131                         set d_old_pthread_create_joinable
16132                         eval $setvar
16133                         val=PTHREAD_CREATE_UNDETACHED
16134                         set old_pthread_create_joinable
16135                         eval $setvar
16136                 else
16137                         set try -DJOINABLE=__UNDETACHED
16138                         if eval $compile; then
16139                                 echo "You seem to use __UNDETACHED." >&4
16140                                 val="$define"
16141                                 set d_old_pthread_create_joinable
16142                                 eval $setvar
16143                                 val=__UNDETACHED
16144                                 set old_pthread_create_joinable
16145                                 eval $setvar
16146                         else
16147                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16148                                 val="$define"
16149                                 set d_old_pthread_create_joinable
16150                                 eval $setvar
16151                                 val=0
16152                                 set old_pthread_create_joinable
16153                                 eval $setvar
16154                         fi
16155                 fi
16156         fi
16157         $rm_try
16158 else
16159     d_old_pthread_create_joinable="$undef"
16160     old_pthread_create_joinable=""
16161 fi
16162
16163 : see if pause exists
16164 set pause d_pause
16165 eval $inlibc
16166
16167 : see if poll exists
16168 set poll d_poll
16169 eval $inlibc
16170
16171 : see if prctl exists
16172 set prctl d_prctl
16173 eval $inlibc
16174
16175 : see if prctl supports PR_SET_NAME
16176 d_prctl_set_name=$undef
16177 case $d_prctl in
16178     $define)
16179         $cat >try.c <<EOM
16180 #include <sys/prctl.h>
16181
16182 int main (int argc, char *argv[])
16183 {
16184     return (prctl (PR_SET_NAME, "Test"));
16185     } /* main */
16186 EOM
16187         set try
16188         if eval $compile_ok && $run ./try; then
16189             echo "Your prctl (PR_SET_NAME, ...) works"
16190             d_prctl_set_name=$define
16191             fi
16192         $rm_try
16193         ;;
16194     esac
16195
16196 : see if readlink exists
16197 set readlink d_readlink
16198 eval $inlibc
16199
16200 : Check if exe is symlink to abs path of executing program
16201 echo " "
16202 procselfexe=''
16203 val="$undef"
16204 case "$d_readlink" in
16205     "$define")
16206         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16207         : more tidy to avoid an extra level of symlink
16208         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16209         while test $# -gt 0; do
16210             type=$1; try=$2
16211             shift; shift
16212             if $issymlink $try; then
16213                 $ls -l $try > reflect
16214                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16215                     echo "You have $type-like $try."
16216                     procselfexe='"'$try'"'
16217                     val="$define"
16218                     : This will break out of the loop
16219                     set X; shift
16220                 fi
16221             fi
16222         done
16223         ;;
16224 esac
16225 $rm -f reflect
16226 set d_procselfexe
16227 eval $setvar
16228
16229 : backward compatibility for d_hvfork
16230 if test X$d_hvfork != X; then
16231         d_vfork="$d_hvfork"
16232         d_hvfork=''
16233 fi
16234 : see if there is a vfork
16235 val=''
16236 set vfork val
16237 eval $inlibc
16238
16239 d_pseudofork=$undef
16240
16241 : Ok, but do we want to use it. vfork is reportedly unreliable in
16242 : perl on Solaris 2.x, and probably elsewhere.
16243 case "$val" in
16244 $define)
16245         echo " "
16246         case "$usevfork" in
16247         false) dflt='n';;
16248         *) dflt='y';;
16249         esac
16250         cat <<'EOM'
16251
16252 Perl can only use a vfork() that doesn't suffer from strict
16253 restrictions on calling functions or modifying global data in
16254 the child.  For example, glibc-2.1 contains such a vfork()
16255 that is unsuitable.  If your system provides a proper fork()
16256 call, chances are that you do NOT want perl to use vfork().
16257
16258 EOM
16259         rp="Do you still want to use vfork()?"
16260         . ./myread
16261         case "$ans" in
16262         y|Y) ;;
16263         *)
16264                 echo "Ok, we won't use vfork()."
16265                 val="$undef"
16266                 ;;
16267         esac
16268         ;;
16269 esac
16270 set d_vfork
16271 eval $setvar
16272 case "$d_vfork" in
16273 $define) usevfork='true';;
16274 *) usevfork='false';;
16275 esac
16276
16277 : see whether the pthread_atfork exists
16278 $cat >try.c <<EOP
16279 #include <pthread.h>
16280 #include <stdio.h>
16281 int main() {
16282 #ifdef  PTHREAD_ATFORK
16283         pthread_atfork(NULL,NULL,NULL);
16284 #endif
16285 }
16286 EOP
16287
16288 : see if pthread_atfork exists
16289 set try -DPTHREAD_ATFORK
16290 if eval $compile; then
16291     val="$define"
16292 else
16293     val="$undef"
16294 fi
16295 case "$usethreads" in
16296 $define)
16297         case "$val" in
16298         $define) echo 'pthread_atfork found.' >&4        ;;
16299         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16300         esac
16301 esac
16302 set d_pthread_atfork
16303 eval $setvar
16304
16305 : see if pthread_attr_setscope exists
16306 set pthread_attr_setscope d_pthread_attr_setscope
16307 eval $inlibc
16308
16309 : see whether the various POSIXish _yields exist
16310 $cat >try.c <<EOP
16311 #include <pthread.h>
16312 #include <stdio.h>
16313 int main() {
16314 #ifdef SCHED_YIELD
16315         sched_yield();
16316 #else
16317 #ifdef PTHREAD_YIELD
16318         pthread_yield();
16319 #else
16320 #ifdef PTHREAD_YIELD_NULL
16321         pthread_yield(NULL);
16322 #endif
16323 #endif
16324 #endif
16325 }
16326 EOP
16327 : see if sched_yield exists
16328 set try -DSCHED_YIELD
16329 if eval $compile; then
16330     val="$define"
16331     sched_yield='sched_yield()'
16332 else
16333     val="$undef"
16334 fi
16335 case "$usethreads" in
16336 $define)
16337         case "$val" in
16338         $define) echo 'sched_yield() found.' >&4        ;;
16339         *)       echo 'sched_yield() NOT found.' >&4    ;;
16340         esac
16341 esac
16342 set d_sched_yield
16343 eval $setvar
16344
16345 : see if pthread_yield exists
16346 set try -DPTHREAD_YIELD
16347 if eval $compile; then
16348     val="$define"
16349     case "$sched_yield" in
16350     '') sched_yield='pthread_yield()' ;;
16351     esac
16352 else
16353     set try -DPTHREAD_YIELD_NULL
16354     if eval $compile; then
16355         val="$define"
16356         case "$sched_yield" in
16357         '') sched_yield='pthread_yield(NULL)' ;;
16358         esac
16359     else
16360         val="$undef"
16361     fi
16362 fi
16363 case "$usethreads" in
16364 $define)
16365         case "$val" in
16366         $define) echo 'pthread_yield() found.' >&4      ;;
16367         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16368         esac
16369         ;;
16370 esac
16371 set d_pthread_yield
16372 eval $setvar
16373 case "$sched_yield" in
16374 '') sched_yield=undef ;;
16375 esac
16376 $rm_try
16377
16378 : see if random_r exists
16379 set random_r d_random_r
16380 eval $inlibc
16381 case "$d_random_r" in
16382 "$define")
16383         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16384         case "$d_random_r_proto:$usethreads" in
16385         ":define")      d_random_r_proto=define
16386                 set d_random_r_proto random_r $hdrs
16387                 eval $hasproto ;;
16388         *)      ;;
16389         esac
16390         case "$d_random_r_proto" in
16391         define)
16392         case "$random_r_proto" in
16393         ''|0) try='int random_r(int*, struct random_data*);'
16394         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16395         esac
16396         case "$random_r_proto" in
16397         ''|0) try='int random_r(long*, struct random_data*);'
16398         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16399         esac
16400         case "$random_r_proto" in
16401         ''|0) try='int random_r(struct random_data*, int32_t*);'
16402         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16403         esac
16404         case "$random_r_proto" in
16405         ''|0)   d_random_r=undef
16406                 random_r_proto=0
16407                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16408         * )     case "$random_r_proto" in
16409                 REENTRANT_PROTO*) ;;
16410                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16411                 esac
16412                 echo "Prototype: $try" ;;
16413         esac
16414         ;;
16415         *)      case "$usethreads" in
16416                 define) echo "random_r has no prototype, not using it." >&4 ;;
16417                 esac
16418                 d_random_r=undef
16419                 random_r_proto=0
16420                 ;;
16421         esac
16422         ;;
16423 *)      random_r_proto=0
16424         ;;
16425 esac
16426
16427 : see if readdir and friends exist
16428 set readdir d_readdir
16429 eval $inlibc
16430 set seekdir d_seekdir
16431 eval $inlibc
16432 set telldir d_telldir
16433 eval $inlibc
16434 set rewinddir d_rewinddir
16435 eval $inlibc
16436
16437 : see if readdir64_r exists
16438 set readdir64_r d_readdir64_r
16439 eval $inlibc
16440 case "$d_readdir64_r" in
16441 "$define")
16442         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16443         case "$d_readdir64_r_proto:$usethreads" in
16444         ":define")      d_readdir64_r_proto=define
16445                 set d_readdir64_r_proto readdir64_r $hdrs
16446                 eval $hasproto ;;
16447         *)      ;;
16448         esac
16449         case "$d_readdir64_r_proto" in
16450         define)
16451         case "$readdir64_r_proto" in
16452         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16453         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16454         esac
16455         case "$readdir64_r_proto" in
16456         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16457         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16458         esac
16459         case "$readdir64_r_proto" in
16460         ''|0)   d_readdir64_r=undef
16461                 readdir64_r_proto=0
16462                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16463         * )     case "$readdir64_r_proto" in
16464                 REENTRANT_PROTO*) ;;
16465                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16466                 esac
16467                 echo "Prototype: $try" ;;
16468         esac
16469         ;;
16470         *)      case "$usethreads" in
16471                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16472                 esac
16473                 d_readdir64_r=undef
16474                 readdir64_r_proto=0
16475                 ;;
16476         esac
16477         ;;
16478 *)      readdir64_r_proto=0
16479         ;;
16480 esac
16481
16482 : see if readdir_r exists
16483 set readdir_r d_readdir_r
16484 eval $inlibc
16485 case "$d_readdir_r" in
16486 "$define")
16487         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16488         case "$d_readdir_r_proto:$usethreads" in
16489         ":define")      d_readdir_r_proto=define
16490                 set d_readdir_r_proto readdir_r $hdrs
16491                 eval $hasproto ;;
16492         *)      ;;
16493         esac
16494         case "$d_readdir_r_proto" in
16495         define)
16496         case "$readdir_r_proto" in
16497         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16498         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16499         esac
16500         case "$readdir_r_proto" in
16501         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16502         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16503         esac
16504         case "$readdir_r_proto" in
16505         ''|0)   d_readdir_r=undef
16506                 readdir_r_proto=0
16507                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16508         * )     case "$readdir_r_proto" in
16509                 REENTRANT_PROTO*) ;;
16510                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16511                 esac
16512                 echo "Prototype: $try" ;;
16513         esac
16514         ;;
16515         *)      case "$usethreads" in
16516                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16517                 esac
16518                 d_readdir_r=undef
16519                 readdir_r_proto=0
16520                 ;;
16521         esac
16522         ;;
16523 *)      readdir_r_proto=0
16524         ;;
16525 esac
16526
16527 : see if readv exists
16528 set readv d_readv
16529 eval $inlibc
16530
16531 : see if recvmsg exists
16532 set recvmsg d_recvmsg
16533 eval $inlibc
16534
16535 : see if rename exists
16536 set rename d_rename
16537 eval $inlibc
16538
16539 : see if rmdir exists
16540 set rmdir d_rmdir
16541 eval $inlibc
16542
16543 : see if memory.h is available.
16544 val=''
16545 set memory.h val
16546 eval $inhdr
16547
16548 : See if it conflicts with string.h
16549 case "$val" in
16550 $define)
16551         case "$strings" in
16552         '') ;;
16553         *)
16554                 $cppstdin $cppflags $cppminus < $strings > mem.h
16555                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16556                         echo " "
16557                         echo "We won't be including <memory.h>."
16558                         val="$undef"
16559                 fi
16560                 $rm -f mem.h
16561                 ;;
16562         esac
16563 esac
16564 set i_memory
16565 eval $setvar
16566
16567 : can bcopy handle overlapping blocks?
16568 echo " "
16569 val="$undef"
16570 case "$d_memmove" in
16571 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16572 *)      case "$d_bcopy" in
16573         "$define")
16574                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16575                 $cat >try.c <<EOCP
16576 #$i_memory I_MEMORY
16577 #$i_stdlib I_STDLIB
16578 #$i_string I_STRING
16579 #$i_unistd I_UNISTD
16580 EOCP
16581         $cat >>try.c <<'EOCP'
16582 #include <stdio.h>
16583 #ifdef I_MEMORY
16584 #  include <memory.h>
16585 #endif
16586 #ifdef I_STDLIB
16587 #  include <stdlib.h>
16588 #endif
16589 #ifdef I_STRING
16590 #  include <string.h>
16591 #else
16592 #  include <strings.h>
16593 #endif
16594 #ifdef I_UNISTD
16595 #  include <unistd.h>  /* Needed for NetBSD */
16596 #endif
16597 int main()
16598 {
16599 char buf[128], abc[128];
16600 char *b;
16601 int len;
16602 int off;
16603 int align;
16604
16605 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16606    try to store the string in read-only memory. */
16607 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16608
16609 for (align = 7; align >= 0; align--) {
16610         for (len = 36; len; len--) {
16611                 b = buf+align;
16612                 bcopy(abc, b, len);
16613                 for (off = 1; off <= len; off++) {
16614                         bcopy(b, b+off, len);
16615                         bcopy(b+off, b, len);
16616                         if (bcmp(b, abc, len))
16617                                 exit(1);
16618                 }
16619         }
16620 }
16621 exit(0);
16622 }
16623 EOCP
16624                 set try
16625                 if eval $compile_ok; then
16626                         if $run ./try 2>/dev/null; then
16627                                 echo "Yes, it can."
16628                                 val="$define"
16629                         else
16630                                 echo "It can't, sorry."
16631                         fi
16632                 else
16633                         echo "(I can't compile the test program, so we'll assume not...)"
16634                 fi
16635                 ;;
16636         esac
16637         $rm_try
16638         ;;
16639 esac
16640 set d_safebcpy
16641 eval $setvar
16642
16643 : can memcpy handle overlapping blocks?
16644 echo " "
16645 val="$undef"
16646 case "$d_memmove" in
16647 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16648 *)      case "$d_memcpy" in
16649         "$define")
16650                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16651                 $cat >try.c <<EOCP
16652 #$i_memory I_MEMORY
16653 #$i_stdlib I_STDLIB
16654 #$i_string I_STRING
16655 #$i_unistd I_UNISTD
16656 EOCP
16657         $cat >>try.c <<'EOCP'
16658 #include <stdio.h>
16659 #ifdef I_MEMORY
16660 #  include <memory.h>
16661 #endif
16662 #ifdef I_STDLIB
16663 #  include <stdlib.h>
16664 #endif
16665 #ifdef I_STRING
16666 #  include <string.h>
16667 #else
16668 #  include <strings.h>
16669 #endif
16670 #ifdef I_UNISTD
16671 #  include <unistd.h>  /* Needed for NetBSD */
16672 #endif
16673 int main()
16674 {
16675 char buf[128], abc[128];
16676 char *b;
16677 int len;
16678 int off;
16679 int align;
16680
16681 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16682    try to store the string in read-only memory. */
16683 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16684
16685 for (align = 7; align >= 0; align--) {
16686         for (len = 36; len; len--) {
16687                 b = buf+align;
16688                 memcpy(b, abc, len);
16689                 for (off = 1; off <= len; off++) {
16690                         memcpy(b+off, b, len);
16691                         memcpy(b, b+off, len);
16692                         if (memcmp(b, abc, len))
16693                                 exit(1);
16694                 }
16695         }
16696 }
16697 exit(0);
16698 }
16699 EOCP
16700                 set try
16701                 if eval $compile_ok; then
16702                         if $run ./try 2>/dev/null; then
16703                                 echo "Yes, it can."
16704                                 val="$define"
16705                         else
16706                                 echo "It can't, sorry."
16707                         fi
16708                 else
16709                         echo "(I can't compile the test program, so we'll assume not...)"
16710                 fi
16711                 ;;
16712         esac
16713         $rm_try
16714         ;;
16715 esac
16716 set d_safemcpy
16717 eval $setvar
16718
16719 : can memcmp be trusted to compare relative magnitude?
16720 val="$undef"
16721 case "$d_memcmp" in
16722 "$define")
16723         echo " "
16724         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16725         $cat >try.c <<EOCP
16726 #$i_memory I_MEMORY
16727 #$i_stdlib I_STDLIB
16728 #$i_string I_STRING
16729 #$i_unistd I_UNISTD
16730 EOCP
16731         $cat >>try.c <<'EOCP'
16732 #include <stdio.h>
16733 #ifdef I_MEMORY
16734 #  include <memory.h>
16735 #endif
16736 #ifdef I_STDLIB
16737 #  include <stdlib.h>
16738 #endif
16739 #ifdef I_STRING
16740 #  include <string.h>
16741 #else
16742 #  include <strings.h>
16743 #endif
16744 #ifdef I_UNISTD
16745 #  include <unistd.h>  /* Needed for NetBSD */
16746 #endif
16747 int main()
16748 {
16749 char a = -1;
16750 char b = 0;
16751 if ((a < b) && memcmp(&a, &b, 1) < 0)
16752         exit(1);
16753 exit(0);
16754 }
16755 EOCP
16756         set try
16757         if eval $compile_ok; then
16758                 if $run ./try 2>/dev/null; then
16759                         echo "Yes, it can."
16760                         val="$define"
16761                 else
16762                         echo "No, it can't (it uses signed chars)."
16763                 fi
16764         else
16765                 echo "(I can't compile the test program, so we'll assume not...)"
16766         fi
16767         ;;
16768 esac
16769 $rm_try
16770 set d_sanemcmp
16771 eval $setvar
16772
16773 : see if prototype for sbrk is available
16774 echo " "
16775 set d_sbrkproto sbrk $i_unistd unistd.h
16776 eval $hasproto
16777
16778 : see if select exists
16779 set select d_select
16780 eval $inlibc
16781
16782 : see if semctl exists
16783 set semctl d_semctl
16784 eval $inlibc
16785
16786 : see if semget exists
16787 set semget d_semget
16788 eval $inlibc
16789
16790 : see if semop exists
16791 set semop d_semop
16792 eval $inlibc
16793
16794 : see how much of the 'sem*(2)' library is present.
16795 h_sem=true
16796 echo " "
16797 case "$d_semctl$d_semget$d_semop" in
16798 *"$undef"*) h_sem=false;;
16799 esac
16800 case "$osname" in
16801 freebsd)
16802     case "`ipcs 2>&1`" in
16803     "SVID messages"*"not configured"*)
16804         echo "Your $osname does not have the sem*(2) configured." >&4
16805         h_sem=false
16806         val="$undef"
16807         set semctl d_semctl
16808         eval $setvar
16809         set semget d_semget
16810         eval $setvar
16811         set semop d_semop
16812         eval $setvar
16813         ;;
16814     esac
16815     ;;
16816 esac
16817 : we could also check for sys/ipc.h ...
16818 if $h_sem && $test `./findhdr sys/sem.h`; then
16819         echo "You have the full sem*(2) library." >&4
16820         val="$define"
16821 else
16822         echo "You don't have the full sem*(2) library." >&4
16823         val="$undef"
16824 fi
16825 set d_sem
16826 eval $setvar
16827
16828 : see whether sys/sem.h defines union semun
16829 echo " "
16830 $cat > try.c <<'END'
16831 #include <sys/types.h>
16832 #include <sys/ipc.h>
16833 #include <sys/sem.h>
16834 int main () { union semun semun; semun.buf = 0; }
16835 END
16836 set try
16837 if eval $compile; then
16838     echo "You have union semun in <sys/sem.h>." >&4
16839     val="$define"
16840 else
16841     echo "You do not have union semun in <sys/sem.h>." >&4
16842     val="$undef"
16843 fi
16844 $rm_try
16845 set d_union_semun
16846 eval $setvar
16847
16848 : see how to do semctl IPC_STAT
16849 case "$d_sem" in
16850 $define)
16851     echo " "
16852     $cat > tryh.h <<END
16853 #ifndef S_IRUSR
16854 #   ifdef S_IREAD
16855 #       define S_IRUSR S_IREAD
16856 #       define S_IWUSR S_IWRITE
16857 #       define S_IXUSR S_IEXEC
16858 #   else
16859 #       define S_IRUSR 0400
16860 #       define S_IWUSR 0200
16861 #       define S_IXUSR 0100
16862 #   endif
16863 #   define S_IRGRP (S_IRUSR>>3)
16864 #   define S_IWGRP (S_IWUSR>>3)
16865 #   define S_IXGRP (S_IXUSR>>3)
16866 #   define S_IROTH (S_IRUSR>>6)
16867 #   define S_IWOTH (S_IWUSR>>6)
16868 #   define S_IXOTH (S_IXUSR>>6)
16869 #endif
16870 #ifndef S_IRWXU
16871 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16872 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16873 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16874 #endif
16875 END
16876     : see whether semctl IPC_STAT can use union semun
16877     case "$d_semctl_semun" in
16878     '')
16879       val="$undef"
16880       $cat > try.c <<END
16881 #include <sys/types.h>
16882 #include <sys/ipc.h>
16883 #include <sys/sem.h>
16884 #include <sys/stat.h>
16885 #include <stdio.h>
16886 #include <errno.h>
16887 #include "tryh.h"
16888 #ifndef errno
16889 extern int errno;
16890 #endif
16891 #$d_union_semun HAS_UNION_SEMUN
16892 int main() {
16893     union semun
16894 #ifndef HAS_UNION_SEMUN
16895     {
16896         int val;
16897         struct semid_ds *buf;
16898         unsigned short *array;
16899     }
16900 #endif
16901     arg;
16902     int sem, st;
16903
16904 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16905     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16906     if (sem > -1) {
16907         struct semid_ds argbuf;
16908         arg.buf = &argbuf;
16909 #       ifdef IPC_STAT
16910         st = semctl(sem, 0, IPC_STAT, arg);
16911         if (st == 0)
16912             printf("semun\n");
16913         else
16914 #       endif /* IPC_STAT */
16915             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16916 #       ifdef IPC_RMID
16917         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16918 #       endif /* IPC_RMID */
16919             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16920     } else
16921 #endif /* IPC_PRIVATE && ... */
16922         printf("semget failed: errno = %d\n", errno);
16923   return 0;
16924 }
16925 END
16926       set try
16927       if eval $compile; then
16928           xxx=`$run ./try`
16929           case "$xxx" in
16930           semun) val="$define" ;;
16931           esac
16932       fi
16933       $rm_try
16934       set d_semctl_semun
16935       eval $setvar
16936       ;;
16937     esac
16938     case "$d_semctl_semun" in
16939     $define)
16940         echo "You can use union semun for semctl IPC_STAT." >&4
16941         also='also'
16942         ;;
16943     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16944         also=''
16945         ;;
16946     esac
16947
16948     : see whether semctl IPC_STAT can use struct semid_ds pointer
16949     case "$d_semctl_semid_ds" in
16950     '')
16951       val="$undef"
16952       $cat > try.c <<'END'
16953 #include <sys/types.h>
16954 #include <sys/ipc.h>
16955 #include <sys/sem.h>
16956 #include <sys/stat.h>
16957 #include "tryh.h"
16958 #include <stdio.h>
16959 #include <errno.h>
16960 #ifndef errno
16961 extern int errno;
16962 #endif
16963 int main() {
16964     struct semid_ds arg;
16965     int sem, st;
16966
16967 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16968     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16969     if (sem > -1) {
16970 #       ifdef IPC_STAT
16971         st = semctl(sem, 0, IPC_STAT, &arg);
16972         if (st == 0)
16973             printf("semid_ds\n");
16974         else
16975 #       endif /* IPC_STAT */
16976             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16977 #       ifdef IPC_RMID
16978         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16979 #       endif /* IPC_RMID */
16980             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16981     } else
16982 #endif /* IPC_PRIVATE && ... */
16983         printf("semget failed: errno = %d\n", errno);
16984
16985     return 0;
16986 }
16987 END
16988       set try
16989       if eval $compile; then
16990           xxx=`$run ./try`
16991           case "$xxx" in
16992           semid_ds) val="$define" ;;
16993           esac
16994       fi
16995       $rm_try
16996       set d_semctl_semid_ds
16997       eval $setvar
16998       ;;
16999     esac
17000     case "$d_semctl_semid_ds" in
17001     $define)
17002         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17003         ;;
17004     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17005         ;;
17006     esac
17007     ;;
17008 *)  val="$undef"
17009
17010     # We do not have the full sem*(2) library, so assume we can not
17011     # use either.
17012
17013     set d_semctl_semun
17014     eval $setvar
17015
17016     set d_semctl_semid_ds
17017     eval $setvar
17018     ;;
17019 esac
17020 $rm_try tryh.h
17021
17022 : see if sendmsg exists
17023 set sendmsg d_sendmsg
17024 eval $inlibc
17025
17026 : see if setegid exists
17027 set setegid d_setegid
17028 eval $inlibc
17029
17030 : see if seteuid exists
17031 set seteuid d_seteuid
17032 eval $inlibc
17033
17034 : see if setgrent exists
17035 set setgrent d_setgrent
17036 eval $inlibc
17037
17038 : see if setgrent_r exists
17039 set setgrent_r d_setgrent_r
17040 eval $inlibc
17041 case "$d_setgrent_r" in
17042 "$define")
17043         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17044         case "$d_setgrent_r_proto:$usethreads" in
17045         ":define")      d_setgrent_r_proto=define
17046                 set d_setgrent_r_proto setgrent_r $hdrs
17047                 eval $hasproto ;;
17048         *)      ;;
17049         esac
17050         case "$d_setgrent_r_proto" in
17051         define)
17052         case "$setgrent_r_proto" in
17053         ''|0) try='int setgrent_r(FILE**);'
17054         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17055         esac
17056         case "$setgrent_r_proto" in
17057         ''|0) try='void setgrent_r(FILE**);'
17058         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17059         esac
17060         case "$setgrent_r_proto" in
17061         ''|0)   d_setgrent_r=undef
17062                 setgrent_r_proto=0
17063                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17064         * )     case "$setgrent_r_proto" in
17065                 REENTRANT_PROTO*) ;;
17066                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17067                 esac
17068                 echo "Prototype: $try" ;;
17069         esac
17070         ;;
17071         *)      case "$usethreads" in
17072                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17073                 esac
17074                 d_setgrent_r=undef
17075                 setgrent_r_proto=0
17076                 ;;
17077         esac
17078         ;;
17079 *)      setgrent_r_proto=0
17080         ;;
17081 esac
17082
17083 : see if sethostent exists
17084 set sethostent d_sethent
17085 eval $inlibc
17086
17087 : see if sethostent_r exists
17088 set sethostent_r d_sethostent_r
17089 eval $inlibc
17090 case "$d_sethostent_r" in
17091 "$define")
17092         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17093         case "$d_sethostent_r_proto:$usethreads" in
17094         ":define")      d_sethostent_r_proto=define
17095                 set d_sethostent_r_proto sethostent_r $hdrs
17096                 eval $hasproto ;;
17097         *)      ;;
17098         esac
17099         case "$d_sethostent_r_proto" in
17100         define)
17101         case "$sethostent_r_proto" in
17102         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17103         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17104         esac
17105         case "$sethostent_r_proto" in
17106         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17107         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17108         esac
17109         case "$sethostent_r_proto" in
17110         ''|0)   d_sethostent_r=undef
17111                 sethostent_r_proto=0
17112                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17113         * )     case "$sethostent_r_proto" in
17114                 REENTRANT_PROTO*) ;;
17115                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17116                 esac
17117                 echo "Prototype: $try" ;;
17118         esac
17119         ;;
17120         *)      case "$usethreads" in
17121                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17122                 esac
17123                 d_sethostent_r=undef
17124                 sethostent_r_proto=0
17125                 ;;
17126         esac
17127         ;;
17128 *)      sethostent_r_proto=0
17129         ;;
17130 esac
17131
17132 : see if setitimer exists
17133 set setitimer d_setitimer
17134 eval $inlibc
17135
17136 : see if setlinebuf exists
17137 set setlinebuf d_setlinebuf
17138 eval $inlibc
17139
17140 : see if setlocale exists
17141 set setlocale d_setlocale
17142 eval $inlibc
17143
17144 : see if locale.h is available
17145 set locale.h i_locale
17146 eval $inhdr
17147
17148 : see if setlocale_r exists
17149 set setlocale_r d_setlocale_r
17150 eval $inlibc
17151 case "$d_setlocale_r" in
17152 "$define")
17153         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17154         case "$d_setlocale_r_proto:$usethreads" in
17155         ":define")      d_setlocale_r_proto=define
17156                 set d_setlocale_r_proto setlocale_r $hdrs
17157                 eval $hasproto ;;
17158         *)      ;;
17159         esac
17160         case "$d_setlocale_r_proto" in
17161         define)
17162         case "$setlocale_r_proto" in
17163         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17164         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17165         esac
17166         case "$setlocale_r_proto" in
17167         ''|0)   d_setlocale_r=undef
17168                 setlocale_r_proto=0
17169                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17170         * )     case "$setlocale_r_proto" in
17171                 REENTRANT_PROTO*) ;;
17172                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17173                 esac
17174                 echo "Prototype: $try" ;;
17175         esac
17176         ;;
17177         *)      case "$usethreads" in
17178                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17179                 esac
17180                 d_setlocale_r=undef
17181                 setlocale_r_proto=0
17182                 ;;
17183         esac
17184         ;;
17185 *)      setlocale_r_proto=0
17186         ;;
17187 esac
17188
17189 : see if setnetent exists
17190 set setnetent d_setnent
17191 eval $inlibc
17192
17193 : see if setnetent_r exists
17194 set setnetent_r d_setnetent_r
17195 eval $inlibc
17196 case "$d_setnetent_r" in
17197 "$define")
17198         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17199         case "$d_setnetent_r_proto:$usethreads" in
17200         ":define")      d_setnetent_r_proto=define
17201                 set d_setnetent_r_proto setnetent_r $hdrs
17202                 eval $hasproto ;;
17203         *)      ;;
17204         esac
17205         case "$d_setnetent_r_proto" in
17206         define)
17207         case "$setnetent_r_proto" in
17208         ''|0) try='int setnetent_r(int, struct netent_data*);'
17209         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17210         esac
17211         case "$setnetent_r_proto" in
17212         ''|0) try='void setnetent_r(int, struct netent_data*);'
17213         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17214         esac
17215         case "$setnetent_r_proto" in
17216         ''|0)   d_setnetent_r=undef
17217                 setnetent_r_proto=0
17218                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17219         * )     case "$setnetent_r_proto" in
17220                 REENTRANT_PROTO*) ;;
17221                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17222                 esac
17223                 echo "Prototype: $try" ;;
17224         esac
17225         ;;
17226         *)      case "$usethreads" in
17227                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17228                 esac
17229                 d_setnetent_r=undef
17230                 setnetent_r_proto=0
17231                 ;;
17232         esac
17233         ;;
17234 *)      setnetent_r_proto=0
17235         ;;
17236 esac
17237
17238 : see if setprotoent exists
17239 set setprotoent d_setpent
17240 eval $inlibc
17241
17242 : see if setpgid exists
17243 set setpgid d_setpgid
17244 eval $inlibc
17245
17246 : see if setpgrp2 exists
17247 set setpgrp2 d_setpgrp2
17248 eval $inlibc
17249
17250 : see if setpriority exists
17251 set setpriority d_setprior
17252 eval $inlibc
17253
17254 : see if setproctitle exists
17255 set setproctitle d_setproctitle
17256 eval $inlibc
17257
17258 : see if setprotoent_r exists
17259 set setprotoent_r d_setprotoent_r
17260 eval $inlibc
17261 case "$d_setprotoent_r" in
17262 "$define")
17263         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17264         case "$d_setprotoent_r_proto:$usethreads" in
17265         ":define")      d_setprotoent_r_proto=define
17266                 set d_setprotoent_r_proto setprotoent_r $hdrs
17267                 eval $hasproto ;;
17268         *)      ;;
17269         esac
17270         case "$d_setprotoent_r_proto" in
17271         define)
17272         case "$setprotoent_r_proto" in
17273         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17274         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17275         esac
17276         case "$setprotoent_r_proto" in
17277         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17278         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17279         esac
17280         case "$setprotoent_r_proto" in
17281         ''|0)   d_setprotoent_r=undef
17282                 setprotoent_r_proto=0
17283                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17284         * )     case "$setprotoent_r_proto" in
17285                 REENTRANT_PROTO*) ;;
17286                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17287                 esac
17288                 echo "Prototype: $try" ;;
17289         esac
17290         ;;
17291         *)      case "$usethreads" in
17292                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17293                 esac
17294                 d_setprotoent_r=undef
17295                 setprotoent_r_proto=0
17296                 ;;
17297         esac
17298         ;;
17299 *)      setprotoent_r_proto=0
17300         ;;
17301 esac
17302
17303 : see if setpwent exists
17304 set setpwent d_setpwent
17305 eval $inlibc
17306
17307 : see if setpwent_r exists
17308 set setpwent_r d_setpwent_r
17309 eval $inlibc
17310 case "$d_setpwent_r" in
17311 "$define")
17312         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17313         case "$d_setpwent_r_proto:$usethreads" in
17314         ":define")      d_setpwent_r_proto=define
17315                 set d_setpwent_r_proto setpwent_r $hdrs
17316                 eval $hasproto ;;
17317         *)      ;;
17318         esac
17319         case "$d_setpwent_r_proto" in
17320         define)
17321         case "$setpwent_r_proto" in
17322         ''|0) try='int setpwent_r(FILE**);'
17323         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17324         esac
17325         case "$setpwent_r_proto" in
17326         ''|0) try='void setpwent_r(FILE**);'
17327         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17328         esac
17329         case "$setpwent_r_proto" in
17330         ''|0)   d_setpwent_r=undef
17331                 setpwent_r_proto=0
17332                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17333         * )     case "$setpwent_r_proto" in
17334                 REENTRANT_PROTO*) ;;
17335                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17336                 esac
17337                 echo "Prototype: $try" ;;
17338         esac
17339         ;;
17340         *)      case "$usethreads" in
17341                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17342                 esac
17343                 d_setpwent_r=undef
17344                 setpwent_r_proto=0
17345                 ;;
17346         esac
17347         ;;
17348 *)      setpwent_r_proto=0
17349         ;;
17350 esac
17351
17352 : see if setregid exists
17353 set setregid d_setregid
17354 eval $inlibc
17355 set setresgid d_setresgid
17356 eval $inlibc
17357
17358 : see if setreuid exists
17359 set setreuid d_setreuid
17360 eval $inlibc
17361 set setresuid d_setresuid
17362 eval $inlibc
17363
17364 : see if setrgid exists
17365 set setrgid d_setrgid
17366 eval $inlibc
17367
17368 : see if setruid exists
17369 set setruid d_setruid
17370 eval $inlibc
17371
17372 : see if setservent exists
17373 set setservent d_setsent
17374 eval $inlibc
17375
17376 : see if setservent_r exists
17377 set setservent_r d_setservent_r
17378 eval $inlibc
17379 case "$d_setservent_r" in
17380 "$define")
17381         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17382         case "$d_setservent_r_proto:$usethreads" in
17383         ":define")      d_setservent_r_proto=define
17384                 set d_setservent_r_proto setservent_r $hdrs
17385                 eval $hasproto ;;
17386         *)      ;;
17387         esac
17388         case "$d_setservent_r_proto" in
17389         define)
17390         case "$setservent_r_proto" in
17391         ''|0) try='int setservent_r(int, struct servent_data*);'
17392         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17393         esac
17394         case "$setservent_r_proto" in
17395         ''|0) try='void setservent_r(int, struct servent_data*);'
17396         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17397         esac
17398         case "$setservent_r_proto" in
17399         ''|0)   d_setservent_r=undef
17400                 setservent_r_proto=0
17401                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17402         * )     case "$setservent_r_proto" in
17403                 REENTRANT_PROTO*) ;;
17404                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17405                 esac
17406                 echo "Prototype: $try" ;;
17407         esac
17408         ;;
17409         *)      case "$usethreads" in
17410                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17411                 esac
17412                 d_setservent_r=undef
17413                 setservent_r_proto=0
17414                 ;;
17415         esac
17416         ;;
17417 *)      setservent_r_proto=0
17418         ;;
17419 esac
17420
17421 : see if setsid exists
17422 set setsid d_setsid
17423 eval $inlibc
17424
17425 : see if setvbuf exists
17426 set setvbuf d_setvbuf
17427 eval $inlibc
17428
17429 : see if sfio.h is available
17430 set sfio.h i_sfio
17431 eval $inhdr
17432
17433 : see if sfio library is available
17434 case "$i_sfio" in
17435 $define)
17436         val=''
17437         set sfreserve val
17438         eval $inlibc
17439         ;;
17440 *)
17441         val="$undef"
17442         ;;
17443 esac
17444 : Ok, but do we want to use it.
17445 case "$val" in
17446 $define)
17447         case "$usesfio" in
17448         true|$define|[yY]*) dflt='y';;
17449         *) dflt='n';;
17450         esac
17451         echo "$package can use the sfio library, but it is experimental."
17452         rp="You seem to have sfio available, do you want to try using it?"
17453         . ./myread
17454         case "$ans" in
17455         y|Y)    echo "Ok, turning on sfio then."
17456                 val="$define"
17457                 ;;
17458         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17459                 val="$undef"
17460                 ;;
17461         esac
17462         ;;
17463 *)      case "$usesfio" in
17464         true|$define|[yY]*)
17465                 echo "Sorry, cannot find sfio on this machine." >&4
17466                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17467                 val="$undef"
17468                 ;;
17469         esac
17470         ;;
17471 esac
17472 set d_sfio
17473 eval $setvar
17474 case "$d_sfio" in
17475 $define) usesfio='true';;
17476 *) usesfio='false';;
17477 esac
17478 case "$d_sfio" in
17479 $define) ;;
17480 *)      : Remove sfio from list of libraries to use
17481         case "$libs" in
17482         *-lsfio*)
17483                 echo "Removing unneeded -lsfio from library list" >&4
17484                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17485                 shift
17486                 libs="$*"
17487                 echo "libs = $libs" >&4
17488                 ;;
17489         esac
17490 ;;
17491 esac
17492
17493
17494 : see if shmctl exists
17495 set shmctl d_shmctl
17496 eval $inlibc
17497
17498 : see if shmget exists
17499 set shmget d_shmget
17500 eval $inlibc
17501
17502 : see if shmat exists
17503 set shmat d_shmat
17504 eval $inlibc
17505 : see what shmat returns
17506 case "$d_shmat" in
17507 "$define")
17508         $cat >shmat.c <<'END'
17509 #include <sys/shm.h>
17510 void *shmat();
17511 END
17512         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17513                 shmattype='void *'
17514         else
17515                 shmattype='char *'
17516         fi
17517         echo "and it returns ($shmattype)." >&4
17518         : see if a prototype for shmat is available
17519         xxx=`./findhdr sys/shm.h`
17520         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17521         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17522                 val="$define"
17523         else
17524                 val="$undef"
17525         fi
17526         $rm -f shmat.[co]
17527         ;;
17528 *)
17529         val="$undef"
17530         ;;
17531 esac
17532 set d_shmatprototype
17533 eval $setvar
17534
17535 : see if shmdt exists
17536 set shmdt d_shmdt
17537 eval $inlibc
17538
17539 : see how much of the 'shm*(2)' library is present.
17540 h_shm=true
17541 echo " "
17542 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17543 *"$undef"*) h_shm=false;;
17544 esac
17545 case "$osname" in
17546 freebsd)
17547     case "`ipcs 2>&1`" in
17548     "SVID shared memory"*"not configured"*)
17549         echo "Your $osname does not have the shm*(2) configured." >&4
17550         h_shm=false
17551         val="$undef"
17552         set shmctl d_shmctl
17553         evat $setvar
17554         set shmget d_shmget
17555         evat $setvar
17556         set shmat d_shmat
17557         evat $setvar
17558         set shmdt d_shmdt
17559         evat $setvar
17560         ;;
17561     esac
17562     ;;
17563 esac
17564 : we could also check for sys/ipc.h ...
17565 if $h_shm && $test `./findhdr sys/shm.h`; then
17566         echo "You have the full shm*(2) library." >&4
17567         val="$define"
17568 else
17569         echo "You don't have the full shm*(2) library." >&4
17570         val="$undef"
17571 fi
17572 set d_shm
17573 eval $setvar
17574
17575 : see if we have sigaction
17576 echo " "
17577 if set sigaction val -f d_sigaction; eval $csym; $val; then
17578         echo 'sigaction() found.' >&4
17579         $cat > try.c <<EOP
17580 #include <stdio.h>
17581 #include <sys/types.h>
17582 #include <signal.h>
17583 #$i_stdlib I_STDLIB
17584 #ifdef I_STDLIB
17585 #include <stdlib.h>
17586 #endif
17587 int main()
17588 {
17589     struct sigaction act, oact;
17590     act.sa_flags = 0;
17591     oact.sa_handler = 0;
17592     /* so that act and oact are used */
17593     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17594 }
17595 EOP
17596         set try
17597         if eval $compile_ok; then
17598                 val="$define"
17599         else
17600                 echo "But you don't seem to have a useable struct sigaction." >&4
17601                 val="$undef"
17602         fi
17603 else
17604         echo 'sigaction NOT found.' >&4
17605         val="$undef"
17606 fi
17607 set d_sigaction; eval $setvar
17608 $rm_try
17609
17610 : see if this is a sunmath.h system
17611 set sunmath.h i_sunmath
17612 eval $inhdr
17613
17614 : see if signbit exists
17615 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17616 $cat >try.c <<EOCP
17617 #$i_math I_MATH
17618 #$i_sunmath I_SUNMATH
17619 #ifdef I_MATH
17620 #  include <math.h>
17621 #endif
17622 #ifdef I_SUNMATH  /* Solaris special math library */
17623 #  include <sunmath.h>
17624 #endif
17625 #define NV $nvtype
17626 int main(int argc, char **argv)
17627 {
17628     NV x = 0.0;
17629     NV y = -0.0;
17630     if ((signbit(x) == 0) && (signbit(y) != 0))
17631         return 0;
17632     else
17633         return 1;
17634 }
17635 EOCP
17636 val="$undef"
17637 set try
17638 if eval $compile; then
17639     if $run ./try; then
17640         $echo "Yes." >&4
17641         val="$define"
17642     else
17643         $echo "Signbit seems to be available, but doesn't work as I expected."
17644         $echo "I won't use it." >&4
17645         val="$undef"
17646     fi
17647 else
17648     $echo "Nope." >&4
17649     dflt="$undef"
17650 fi
17651 set d_signbit
17652 eval $setvar
17653 $rm_try
17654
17655 : see if sigprocmask exists
17656 set sigprocmask d_sigprocmask
17657 eval $inlibc
17658
17659 : see if sigsetjmp exists
17660 echo " "
17661 case "$d_sigsetjmp" in
17662 '')
17663         $cat >try.c <<EOP
17664 #include <setjmp.h>
17665 #$i_stdlib I_STDLIB
17666 #ifdef I_STDLIB
17667 #include <stdlib.h>
17668 #endif
17669 sigjmp_buf env;
17670 int set = 1;
17671 int main()
17672 {
17673         if (sigsetjmp(env,1))
17674                 exit(set);
17675         set = 0;
17676         siglongjmp(env, 1);
17677         exit(1);
17678 }
17679 EOP
17680         set try
17681         if eval $compile; then
17682                 if $run ./try >/dev/null 2>&1; then
17683                         echo "POSIX sigsetjmp found." >&4
17684                         val="$define"
17685                 else
17686                         $cat >&4 <<EOM
17687 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17688 I'll ignore them.
17689 EOM
17690                         val="$undef"
17691                 fi
17692         else
17693                 echo "sigsetjmp not found." >&4
17694                 val="$undef"
17695         fi
17696         ;;
17697 *) val="$d_sigsetjmp"
17698         case "$d_sigsetjmp" in
17699         $define) echo "POSIX sigsetjmp found." >&4;;
17700         $undef) echo "sigsetjmp not found." >&4;;
17701         esac
17702         ;;
17703 esac
17704 set d_sigsetjmp
17705 eval $setvar
17706 $rm_try
17707
17708 : see if snprintf exists
17709 set snprintf d_snprintf
17710 eval $inlibc
17711
17712 : see if vsnprintf exists
17713 set vsnprintf d_vsnprintf
17714 eval $inlibc
17715
17716 case "$d_snprintf-$d_vsnprintf" in
17717 "$define-$define")
17718     $cat <<EOM
17719 Checking whether your snprintf() and vsnprintf() work okay...
17720 EOM
17721     $cat >try.c <<'EOCP'
17722 /* v?snprintf testing logic courtesy of Russ Allbery.
17723  * According to C99:
17724  * - if the buffer is too short it still must be \0-terminated
17725  * - if the buffer is too short the potentially required length
17726  *   must be returned and not -1
17727  * - if the buffer is NULL the potentially required length
17728  *   must be returned and not -1 or core dump
17729  */
17730 #include <stdio.h>
17731 #include <stdarg.h>
17732
17733 char buf[2];
17734
17735 int test (char *format, ...)
17736 {
17737     va_list args;
17738     int count;
17739
17740     va_start (args, format);
17741     count = vsnprintf (buf, sizeof buf, format, args);
17742     va_end (args);
17743     return count;
17744 }
17745
17746 int main ()
17747 {
17748     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17749              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17750 }
17751 EOCP
17752     set try
17753     if eval $compile; then
17754         `$run ./try`
17755         case "$?" in
17756         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17757         *) cat <<EOM >&4
17758 Your snprintf() and snprintf() don't seem to be working okay.
17759 EOM
17760            d_snprintf="$undef"
17761            d_vsnprintf="$undef"
17762            ;;
17763         esac
17764     else
17765         echo "(I can't seem to compile the test program--assuming they don't)"
17766         d_snprintf="$undef"
17767         d_vsnprintf="$undef"
17768     fi
17769     $rm_try
17770     ;;
17771 esac
17772
17773 : see if sockatmark exists
17774 set sockatmark d_sockatmark
17775 eval $inlibc
17776
17777 : see if prototype for sockatmark is available
17778 echo " "
17779 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17780 eval $hasproto
17781
17782 : see if socks5_init exists
17783 set socks5_init d_socks5_init
17784 eval $inlibc
17785
17786 : see if sprintf returns the length of the string in the buffer as per ANSI
17787 $echo "Checking whether sprintf returns the length of the string..." >&4
17788 $cat <<EOP >try.c
17789 #include <stdio.h>
17790 #$i_stdlib I_STDLIB
17791 #ifdef I_STDLIB
17792 #include <stdlib.h>
17793 #endif
17794 #$i_string I_STRING
17795 #ifdef I_STRING
17796 #  include <string.h>
17797 #else
17798 #  include <strings.h>
17799 #endif
17800 #$i_math I_MATH
17801 #ifdef I_MATH
17802 #include <math.h>
17803 #endif
17804
17805 char buffer[256];
17806
17807 int check (size_t expect, int test) {
17808   size_t got = strlen(buffer);
17809   if (expect == got)
17810     return 0;
17811
17812   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17813        test, buffer);
17814   exit (test);
17815 }
17816
17817 int main(int argc, char **argv) {
17818   int test = 0;
17819
17820   check(sprintf(buffer, ""), ++test);
17821   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17822   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17823
17824   return 0;
17825 }
17826 EOP
17827 set try
17828
17829 if eval $compile; then
17830     xxx="`$run ./try`"
17831     case "$?" in
17832         0) cat >&4 <<EOM
17833 sprintf returns the length of the string (as ANSI says it should)
17834 EOM
17835         d_sprintf_returns_strlen="$define"
17836         ;;
17837         *) cat >&4 <<EOM
17838 sprintf does not return the length of the string (how old is this system?)
17839 EOM
17840         d_sprintf_returns_strlen="$undef"
17841         ;;
17842     esac
17843 else
17844     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17845     d_sprintf_returns_strlen="$undef"
17846 fi
17847 $rm_try
17848
17849 : see if srand48_r exists
17850 set srand48_r d_srand48_r
17851 eval $inlibc
17852 case "$d_srand48_r" in
17853 "$define")
17854         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17855         case "$d_srand48_r_proto:$usethreads" in
17856         ":define")      d_srand48_r_proto=define
17857                 set d_srand48_r_proto srand48_r $hdrs
17858                 eval $hasproto ;;
17859         *)      ;;
17860         esac
17861         case "$d_srand48_r_proto" in
17862         define)
17863         case "$srand48_r_proto" in
17864         ''|0) try='int srand48_r(long, struct drand48_data*);'
17865         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17866         esac
17867         case "$srand48_r_proto" in
17868         ''|0)   d_srand48_r=undef
17869                 srand48_r_proto=0
17870                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17871         * )     case "$srand48_r_proto" in
17872                 REENTRANT_PROTO*) ;;
17873                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17874                 esac
17875                 echo "Prototype: $try" ;;
17876         esac
17877         ;;
17878         *)      case "$usethreads" in
17879                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17880                 esac
17881                 d_srand48_r=undef
17882                 srand48_r_proto=0
17883                 ;;
17884         esac
17885         ;;
17886 *)      srand48_r_proto=0
17887         ;;
17888 esac
17889
17890 : see if srandom_r exists
17891 set srandom_r d_srandom_r
17892 eval $inlibc
17893 case "$d_srandom_r" in
17894 "$define")
17895         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17896         case "$d_srandom_r_proto:$usethreads" in
17897         ":define")      d_srandom_r_proto=define
17898                 set d_srandom_r_proto srandom_r $hdrs
17899                 eval $hasproto ;;
17900         *)      ;;
17901         esac
17902         case "$d_srandom_r_proto" in
17903         define)
17904         case "$srandom_r_proto" in
17905         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17906         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17907         esac
17908         case "$srandom_r_proto" in
17909         ''|0)   d_srandom_r=undef
17910                 srandom_r_proto=0
17911                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17912         * )     case "$srandom_r_proto" in
17913                 REENTRANT_PROTO*) ;;
17914                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17915                 esac
17916                 echo "Prototype: $try" ;;
17917         esac
17918         ;;
17919         *)      case "$usethreads" in
17920                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17921                 esac
17922                 d_srandom_r=undef
17923                 srandom_r_proto=0
17924                 ;;
17925         esac
17926         ;;
17927 *)      srandom_r_proto=0
17928         ;;
17929 esac
17930
17931 : see if prototype for setresgid is available
17932 echo " "
17933 set d_sresgproto setresgid $i_unistd unistd.h
17934 eval $hasproto
17935
17936 : see if prototype for setresuid is available
17937 echo " "
17938 set d_sresuproto setresuid $i_unistd unistd.h
17939 eval $hasproto
17940
17941 : see if sys/stat.h is available
17942 set sys/stat.h i_sysstat
17943 eval $inhdr
17944
17945 : see if stat knows about block sizes
17946 echo " "
17947 echo "Checking to see if your struct stat has st_blocks field..." >&4
17948 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17949 eval $hasfield
17950
17951 : see if this is a sys/vfs.h system
17952 set sys/vfs.h i_sysvfs
17953 eval $inhdr
17954
17955 : see if this is a sys/statfs.h system
17956 set sys/statfs.h i_sysstatfs
17957 eval $inhdr
17958
17959 : Check for statfs_s
17960 echo " "
17961 echo "Checking to see if your system supports struct statfs..." >&4
17962 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
17963 eval $hasstruct
17964 case "$d_statfs_s" in
17965 "$define")      echo "Yes, it does."   ;;
17966 *)              echo "No, it doesn't." ;;
17967 esac
17968
17969
17970 : see if struct statfs knows about f_flags
17971 case "$d_statfs_s" in
17972 define)
17973         echo " "
17974         echo "Checking to see if your struct statfs has f_flags field..." >&4
17975         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
17976         eval $hasfield
17977         ;;
17978 *)      val="$undef"
17979         set d_statfs_f_flags
17980         eval $setvar
17981         ;;
17982 esac
17983 case "$d_statfs_f_flags" in
17984 "$define")      echo "Yes, it does."   ;;
17985 *)              echo "No, it doesn't." ;;
17986 esac
17987
17988 : see what flavor, if any, of static inline is supported
17989 echo " "
17990 echo "Checking to see if your system supports static inline..."
17991 $cat > try.c <<'EOCP'
17992 #include <stdlib.h>
17993 extern int f_via_a(int x);
17994 extern int f_via_b(int x);
17995 int main(int argc, char **argv)
17996 {
17997     int y;
17998
17999     y = f_via_a(0);
18000 #ifdef USE_B
18001     y = f_via_b(0);
18002 #endif
18003     if (y == 42) {
18004         return EXIT_SUCCESS;
18005     }
18006     else {
18007         return EXIT_FAILURE;
18008     }
18009 }
18010 EOCP
18011 $cat > a.c <<'EOCP'
18012 static INLINE int f(int x) {
18013     int y;
18014     y = x + 42;
18015     return y;
18016 }
18017
18018 int f_via_a(int x)
18019 {
18020     return f(x);
18021 }
18022 EOCP
18023 $cat > b.c <<'EOCP'
18024 extern int f(int x);
18025
18026 int f_via_b(int x)
18027 {
18028     return f(x);
18029 }
18030 EOCP
18031
18032 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18033 case "$perl_static_inline" in
18034 '')     # Check the various possibilities, and break out on success.
18035         # For gcc, prefer __inline__, which will still permit 
18036         # cflags.SH to add in -ansi.
18037         case "$gccversion" in
18038                 '') xxx="inline __inline__ __inline _inline";;
18039                 *)  xxx="__inline__ inline __inline _inline";;
18040         esac
18041         for inline in $xxx; do
18042                 set try -DINLINE=$inline a.c
18043                 if eval $compile && $run ./try; then
18044                         # Now make sure there is no external linkage of static
18045                         # functions
18046                         set try -DINLINE=$inline -DUSE_B a.c b.c
18047                         if eval $compile && $run ./try; then
18048                                 $echo "Your compiler supports static $inline, " >&4
18049                                 $echo "but it also creates an external definition," >&4
18050                                 $echo "so I won't use it." >&4
18051                                 val=$undef
18052                         else
18053                                 $echo "Your compiler supports static $inline." >&4
18054                                 val=$define
18055                                 perl_static_inline="static $inline";
18056                                 break;
18057                         fi
18058                 else
18059                         $echo "Your compiler does NOT support static $inline." >&4
18060                         val="$undef"
18061                 fi
18062         done
18063         ;;
18064 *inline*) # Some variant of inline exists.
18065         echo "Keeping your $hint value of $perl_static_inline."
18066         val=$define
18067         ;;
18068 static)  # No inline capabilities
18069         echo "Keeping your $hint value of $perl_static_inline."
18070         val=$undef
18071         ;;
18072 *)  # Unrecognized previous value -- blindly trust the supplied
18073         # value and hope it makes sense.  Use old value for
18074         # d_static_inline, if there is one.
18075         echo "Keeping your $hint value of $perl_static_inline."
18076         case "$d_static_inline" in
18077                 '') val=$define ;;
18078                 *)  val=$d_static_inline ;;
18079         esac
18080         ;;
18081 esac
18082 # Fallback to plain 'static' if nothing worked.
18083 case "$perl_static_inline" in
18084 '')
18085         perl_static_inline="static"
18086         val=$undef
18087         ;;
18088 esac
18089 set d_static_inline
18090 eval $setvar
18091 $rm -f a.[co] b.[co]
18092 $rm_try
18093
18094 : Check stream access
18095 $cat >&4 <<EOM
18096 Checking how to access stdio streams by file descriptor number...
18097 EOM
18098 case "$stdio_stream_array" in
18099 '')     $cat >try.c <<EOCP
18100 #include <stdio.h>
18101 int main() {
18102   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18103     printf("yes\n");
18104 }
18105 EOCP
18106         for s in _iob __iob __sF
18107         do
18108                 set try -DSTDIO_STREAM_ARRAY=$s
18109                 if eval $compile; then
18110                         case "`$run ./try`" in
18111                         yes)    stdio_stream_array=$s; break ;;
18112                         esac
18113                 fi
18114         done
18115         $rm_try
18116 esac
18117 case "$stdio_stream_array" in
18118 '')     $cat >&4 <<EOM
18119 I can't figure out how to access stdio streams by file descriptor number.
18120 EOM
18121         d_stdio_stream_array="$undef"
18122         ;;
18123 *)      $cat >&4 <<EOM
18124 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18125 EOM
18126         d_stdio_stream_array="$define"
18127         ;;
18128 esac
18129
18130 : see if strcoll exists
18131 set strcoll d_strcoll
18132 eval $inlibc
18133
18134 : check for structure copying
18135 echo " "
18136 echo "Checking to see if your C compiler can copy structs..." >&4
18137 $cat >try.c <<'EOCP'
18138 int main()
18139 {
18140         struct blurfl {
18141                 int dyick;
18142         } foo, bar;
18143
18144         foo = bar;
18145 }
18146 EOCP
18147 if $cc -c try.c >/dev/null 2>&1 ; then
18148         val="$define"
18149         echo "Yup, it can."
18150 else
18151         val="$undef"
18152         echo "Nope, it can't."
18153 fi
18154 set d_strctcpy
18155 eval $setvar
18156 $rm_try
18157
18158 : see if strerror and/or sys_errlist[] exist
18159 echo " "
18160 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18161     if set strerror val -f d_strerror; eval $csym; $val; then
18162                 echo 'strerror() found.' >&4
18163                 d_strerror="$define"
18164                 d_strerrm='strerror(e)'
18165                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18166                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
18167                         d_syserrlst="$define"
18168                 else
18169                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
18170                         d_syserrlst="$undef"
18171                 fi
18172     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18173                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18174                 echo 'strerror() found in string header.' >&4
18175                 d_strerror="$define"
18176                 d_strerrm='strerror(e)'
18177                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18178                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18179                                 d_syserrlst="$define"
18180                 else
18181                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18182                         d_syserrlst="$undef"
18183                 fi
18184     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18185                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18186                 d_strerror="$undef"
18187                 d_syserrlst="$define"
18188                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18189     else
18190                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18191                 d_strerror="$undef"
18192                 d_syserrlst="$undef"
18193                 d_strerrm='"unknown"'
18194     fi
18195 fi
18196
18197 : see if strerror_r exists
18198 set strerror_r d_strerror_r
18199 eval $inlibc
18200 case "$d_strerror_r" in
18201 "$define")
18202         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18203         case "$d_strerror_r_proto:$usethreads" in
18204         ":define")      d_strerror_r_proto=define
18205                 set d_strerror_r_proto strerror_r $hdrs
18206                 eval $hasproto ;;
18207         *)      ;;
18208         esac
18209         case "$d_strerror_r_proto" in
18210         define)
18211         case "$strerror_r_proto" in
18212         ''|0) try='int strerror_r(int, char*, size_t);'
18213         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18214         esac
18215         case "$strerror_r_proto" in
18216         ''|0) try='int strerror_r(int, char*, int);'
18217         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18218         esac
18219         case "$strerror_r_proto" in
18220         ''|0) try='char* strerror_r(int, char*, size_t);'
18221         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18222         esac
18223         case "$strerror_r_proto" in
18224         ''|0)   d_strerror_r=undef
18225                 strerror_r_proto=0
18226                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18227         * )     case "$strerror_r_proto" in
18228                 REENTRANT_PROTO*) ;;
18229                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18230                 esac
18231                 echo "Prototype: $try" ;;
18232         esac
18233         ;;
18234         *)      case "$usethreads" in
18235                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18236                 esac
18237                 d_strerror_r=undef
18238                 strerror_r_proto=0
18239                 ;;
18240         esac
18241         ;;
18242 *)      strerror_r_proto=0
18243         ;;
18244 esac
18245
18246 : see if strftime exists
18247 set strftime d_strftime
18248 eval $inlibc
18249
18250 : see if strlcat exists
18251 set strlcat d_strlcat
18252 eval $inlibc
18253
18254 : see if strlcpy exists
18255 set strlcpy d_strlcpy
18256 eval $inlibc
18257
18258 : see if strtod exists
18259 set strtod d_strtod
18260 eval $inlibc
18261
18262 : see if strtol exists
18263 set strtol d_strtol
18264 eval $inlibc
18265
18266 : see if strtold exists
18267 set strtold d_strtold
18268 eval $inlibc
18269
18270 : see if strtoll exists
18271 set strtoll d_strtoll
18272 eval $inlibc
18273
18274 case "$d_longlong-$d_strtoll" in
18275 "$define-$define")
18276         $cat <<EOM
18277 Checking whether your strtoll() works okay...
18278 EOM
18279         $cat >try.c <<'EOCP'
18280 #include <errno.h>
18281 #ifdef __hpux
18282 #define strtoll __strtoll
18283 #endif
18284 #ifdef __EMX__
18285 #define strtoll _strtoll
18286 #endif
18287 #include <stdio.h>
18288 extern long long int strtoll(char *s, char **, int);
18289 static int bad = 0;
18290 int check(char *s, long long ell, int een) {
18291         long long gll;
18292         errno = 0;
18293         gll = strtoll(s, 0, 10);
18294         if (!((gll == ell) && (errno == een)))
18295                 bad++;
18296 }
18297 int main() {
18298         check(" 1",                                      1LL, 0);
18299         check(" 0",                                      0LL, 0);
18300         check("-1",                                     -1LL, 0);
18301         check("-9223372036854775808", -9223372036854775808LL, 0);
18302         check("-9223372036854775808", -9223372036854775808LL, 0);
18303         check(" 9223372036854775807",  9223372036854775807LL, 0);
18304         check("-9223372036854775808", -9223372036854775808LL, 0);
18305         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18306         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18307         if (!bad)
18308                 printf("ok\n");
18309 }
18310 EOCP
18311         set try
18312         if eval $compile; then
18313                 yyy=`$run ./try`
18314                 case "$yyy" in
18315                 ok) echo "Your strtoll() seems to be working okay." ;;
18316                 *) cat <<EOM >&4
18317 Your strtoll() doesn't seem to be working okay.
18318 EOM
18319                    d_strtoll="$undef"
18320                    ;;
18321                 esac
18322         else
18323                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18324                 d_strtoll="$undef"
18325         fi
18326         ;;
18327 esac
18328
18329 : see if strtoq exists
18330 set strtoq d_strtoq
18331 eval $inlibc
18332
18333 : see if strtoul exists
18334 set strtoul d_strtoul
18335 eval $inlibc
18336
18337 case "$d_strtoul" in
18338 "$define")
18339         $cat <<EOM
18340 Checking whether your strtoul() works okay...
18341 EOM
18342         $cat >try.c <<'EOCP'
18343 #include <errno.h>
18344 #include <stdio.h>
18345 extern unsigned long int strtoul(char *s, char **, int);
18346 static int bad = 0;
18347 void check(char *s, unsigned long eul, int een) {
18348         unsigned long gul;
18349         errno = 0;
18350         gul = strtoul(s, 0, 10);
18351         if (!((gul == eul) && (errno == een)))
18352                 bad++;
18353 }
18354 int main() {
18355         check(" 1", 1L, 0);
18356         check(" 0", 0L, 0);
18357 EOCP
18358         case "$longsize" in
18359         8)
18360             $cat >>try.c <<'EOCP'
18361         check("18446744073709551615", 18446744073709551615UL, 0);
18362         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18363 #if 0 /* strtoul() for /^-/ strings is undefined. */
18364         check("-1", 18446744073709551615UL, 0);
18365         check("-18446744073709551614", 2, 0);
18366         check("-18446744073709551615", 1, 0);
18367         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18368         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18369 #endif
18370 EOCP
18371                 ;;
18372         4)
18373                     $cat >>try.c <<'EOCP'
18374         check("4294967295", 4294967295UL, 0);
18375         check("4294967296", 4294967295UL, ERANGE);
18376 #if 0 /* strtoul() for /^-/ strings is undefined. */
18377         check("-1", 4294967295UL, 0);
18378         check("-4294967294", 2, 0);
18379         check("-4294967295", 1, 0);
18380         check("-4294967296", 4294967295UL, ERANGE);
18381         check("-4294967297", 4294967295UL, ERANGE);
18382 #endif
18383 EOCP
18384                 ;;
18385         *)
18386 : Should we write these tests to be more portable by sprintf-ing
18387 : ~0 and then manipulating that char string as input for strtol?
18388                 ;;
18389         esac
18390         $cat >>try.c <<'EOCP'
18391         if (!bad)
18392                 printf("ok\n");
18393         return 0;
18394 }
18395 EOCP
18396         set try
18397         if eval $compile; then
18398                 case "`$run ./try`" in
18399                 ok) echo "Your strtoul() seems to be working okay." ;;
18400                 *) cat <<EOM >&4
18401 Your strtoul() doesn't seem to be working okay.
18402 EOM
18403                    d_strtoul="$undef"
18404                    ;;
18405                 esac
18406         else
18407                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18408                 d_strtoul="$undef"
18409         fi
18410         ;;
18411 esac
18412
18413 : see if strtoull exists
18414 set strtoull d_strtoull
18415 eval $inlibc
18416
18417 case "$d_longlong-$d_strtoull" in
18418 "$define-$define")
18419         $cat <<EOM
18420 Checking whether your strtoull() works okay...
18421 EOM
18422         $cat >try.c <<'EOCP'
18423 #include <errno.h>
18424 #ifdef __hpux
18425 #define strtoull __strtoull
18426 #endif
18427 #include <stdio.h>
18428 extern unsigned long long int strtoull(char *s, char **, int);
18429 static int bad = 0;
18430 int check(char *s, long long eull, int een) {
18431         long long gull;
18432         errno = 0;
18433         gull = strtoull(s, 0, 10);
18434         if (!((gull == eull) && (errno == een)))
18435                 bad++;
18436 }
18437 int main() {
18438         check(" 1",                                        1LL, 0);
18439         check(" 0",                                        0LL, 0);
18440         check("18446744073709551615",  18446744073709551615ULL, 0);
18441         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18442 #if 0 /* strtoull() for /^-/ strings is undefined. */
18443         check("-1",                    18446744073709551615ULL, 0);
18444         check("-18446744073709551614",                     2LL, 0);
18445         check("-18446744073709551615",                     1LL, 0);
18446         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18447         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18448 #endif
18449         if (!bad)
18450                 printf("ok\n");
18451 }
18452 EOCP
18453         set try
18454         if eval $compile; then
18455                 case "`$run ./try`" in
18456                 ok) echo "Your strtoull() seems to be working okay." ;;
18457                 *) cat <<EOM >&4
18458 Your strtoull() doesn't seem to be working okay.
18459 EOM
18460                    d_strtoull="$undef"
18461                    ;;
18462                 esac
18463         else
18464                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18465                 d_strtoull="$undef"
18466         fi
18467         ;;
18468 esac
18469
18470 : see if strtouq exists
18471 set strtouq d_strtouq
18472 eval $inlibc
18473
18474 case "$d_strtouq" in
18475 "$define")
18476         $cat <<EOM
18477 Checking whether your strtouq() works okay...
18478 EOM
18479         $cat >try.c <<'EOCP'
18480 #include <errno.h>
18481 #include <stdio.h>
18482 extern unsigned long long int strtouq(char *s, char **, int);
18483 static int bad = 0;
18484 void check(char *s, unsigned long long eull, int een) {
18485         unsigned long long gull;
18486         errno = 0;
18487         gull = strtouq(s, 0, 10);
18488         if (!((gull == eull) && (errno == een)))
18489                 bad++;
18490 }
18491 int main() {
18492         check(" 1",                                        1LL, 0);
18493         check(" 0",                                        0LL, 0);
18494         check("18446744073709551615",  18446744073709551615ULL, 0);
18495         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18496 #if 0 /* strtouq() for /^-/ strings is undefined. */
18497         check("-1",                    18446744073709551615ULL, 0);
18498         check("-18446744073709551614",                     2LL, 0);
18499         check("-18446744073709551615",                     1LL, 0);
18500         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18501         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18502 #endif
18503         if (!bad)
18504                 printf("ok\n");
18505         return 0;
18506 }
18507 EOCP
18508         set try
18509         if eval $compile; then
18510                 case "`$run ./try`" in
18511                 ok) echo "Your strtouq() seems to be working okay." ;;
18512                 *) cat <<EOM >&4
18513 Your strtouq() doesn't seem to be working okay.
18514 EOM
18515                    d_strtouq="$undef"
18516                    ;;
18517                 esac
18518         else
18519                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18520                 d_strtouq="$undef"
18521         fi
18522         ;;
18523 esac
18524
18525 : see if strxfrm exists
18526 set strxfrm d_strxfrm
18527 eval $inlibc
18528
18529 : see if symlink exists
18530 set symlink d_symlink
18531 eval $inlibc
18532
18533 : see if syscall exists
18534 set syscall d_syscall
18535 eval $inlibc
18536
18537 : see if prototype for syscall is available
18538 echo " "
18539 set d_syscallproto syscall $i_unistd unistd.h
18540 eval $hasproto
18541
18542 : see if sysconf exists
18543 set sysconf d_sysconf
18544 eval $inlibc
18545
18546 : see if system exists
18547 set system d_system
18548 eval $inlibc
18549
18550 : see if tcgetpgrp exists
18551 set tcgetpgrp d_tcgetpgrp
18552 eval $inlibc
18553
18554 : see if tcsetpgrp exists
18555 set tcsetpgrp d_tcsetpgrp
18556 eval $inlibc
18557
18558 : see if prototype for telldir is available
18559 echo " "
18560 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18561 eval $hasproto
18562
18563 : see if time exists
18564 echo " "
18565 if test "X$d_time" = X -o X"$timetype" = X; then
18566     if set time val -f d_time; eval $csym; $val; then
18567                 echo 'time() found.' >&4
18568                 val="$define"
18569                 rp="What is the type returned by time() on this system?"
18570                 set time_t timetype long stdio.h sys/types.h
18571                 eval $typedef_ask
18572     else
18573                 echo 'time() not found, hope that will do.' >&4
18574                 val="$undef"
18575                 timetype='int';
18576     fi
18577     set d_time
18578     eval $setvar
18579 fi
18580
18581 : see if timegm exists
18582 set timegm d_timegm
18583 eval $inlibc
18584
18585 : see if this is a sys/times.h system
18586 set sys/times.h i_systimes
18587 eval $inhdr
18588
18589 : see if times exists
18590 echo " "
18591 if set times val -f d_times; eval $csym; $val; then
18592         echo 'times() found.' >&4
18593         d_times="$define"
18594         inc=''
18595         case "$i_systimes" in
18596         "$define") inc='sys/times.h';;
18597         esac
18598         rp="What is the type returned by times() on this system?"
18599         set clock_t clocktype long stdio.h sys/types.h $inc
18600         eval $typedef_ask
18601 else
18602         echo 'times() NOT found, hope that will do.' >&4
18603         d_times="$undef"
18604         clocktype='int'
18605 fi
18606
18607 : see if tmpnam_r exists
18608 set tmpnam_r d_tmpnam_r
18609 eval $inlibc
18610 case "$d_tmpnam_r" in
18611 "$define")
18612         hdrs="$i_systypes sys/types.h define stdio.h "
18613         case "$d_tmpnam_r_proto:$usethreads" in
18614         ":define")      d_tmpnam_r_proto=define
18615                 set d_tmpnam_r_proto tmpnam_r $hdrs
18616                 eval $hasproto ;;
18617         *)      ;;
18618         esac
18619         case "$d_tmpnam_r_proto" in
18620         define)
18621         case "$tmpnam_r_proto" in
18622         ''|0) try='char* tmpnam_r(char*);'
18623         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18624         esac
18625         case "$tmpnam_r_proto" in
18626         ''|0)   d_tmpnam_r=undef
18627                 tmpnam_r_proto=0
18628                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18629         * )     case "$tmpnam_r_proto" in
18630                 REENTRANT_PROTO*) ;;
18631                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18632                 esac
18633                 echo "Prototype: $try" ;;
18634         esac
18635         ;;
18636         *)      case "$usethreads" in
18637                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18638                 esac
18639                 d_tmpnam_r=undef
18640                 tmpnam_r_proto=0
18641                 ;;
18642         esac
18643         ;;
18644 *)      tmpnam_r_proto=0
18645         ;;
18646 esac
18647
18648 : see if truncate exists
18649 set truncate d_truncate
18650 eval $inlibc
18651
18652 : see if ttyname_r exists
18653 set ttyname_r d_ttyname_r
18654 eval $inlibc
18655 case "$d_ttyname_r" in
18656 "$define")
18657         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18658         case "$d_ttyname_r_proto:$usethreads" in
18659         ":define")      d_ttyname_r_proto=define
18660                 set d_ttyname_r_proto ttyname_r $hdrs
18661                 eval $hasproto ;;
18662         *)      ;;
18663         esac
18664         case "$d_ttyname_r_proto" in
18665         define)
18666         case "$ttyname_r_proto" in
18667         ''|0) try='int ttyname_r(int, char*, size_t);'
18668         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18669         esac
18670         case "$ttyname_r_proto" in
18671         ''|0) try='int ttyname_r(int, char*, int);'
18672         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18673         esac
18674         case "$ttyname_r_proto" in
18675         ''|0) try='char* ttyname_r(int, char*, int);'
18676         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18677         esac
18678         case "$ttyname_r_proto" in
18679         ''|0)   d_ttyname_r=undef
18680                 ttyname_r_proto=0
18681                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18682         * )     case "$ttyname_r_proto" in
18683                 REENTRANT_PROTO*) ;;
18684                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18685                 esac
18686                 echo "Prototype: $try" ;;
18687         esac
18688         ;;
18689         *)      case "$usethreads" in
18690                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18691                 esac
18692                 d_ttyname_r=undef
18693                 ttyname_r_proto=0
18694                 ;;
18695         esac
18696         ;;
18697 *)      ttyname_r_proto=0
18698         ;;
18699 esac
18700
18701 : see if tzname[] exists
18702 echo " "
18703 if set tzname val -a d_tzname; eval $csym; $val; then
18704         val="$define"
18705         echo 'tzname[] found.' >&4
18706 else
18707         val="$undef"
18708         echo 'tzname[] NOT found.' >&4
18709 fi
18710 set d_tzname
18711 eval $setvar
18712
18713 : Check if is a multiplatform env
18714 case "$osname" in
18715 next|rhapsody|darwin) multiarch="$define" ;;
18716 esac
18717 case "$multiarch" in
18718 ''|[nN]*) multiarch="$undef" ;;
18719 esac
18720
18721 : check for ordering of bytes in a UV
18722 echo " "
18723 case "$usecrosscompile$multiarch" in
18724 *$define*)
18725         $cat <<EOM
18726 You seem to be either cross-compiling or doing a multiarchitecture build,
18727 skipping the byteorder check.
18728
18729 EOM
18730         byteorder='ffff'
18731         ;;
18732 *)
18733         case "$byteorder" in
18734         '')
18735                 $cat <<'EOM'
18736 In the following, larger digits indicate more significance.  A big-endian
18737 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18738 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18739 machines may have weird orders like 3412.  A Cray will report 87654321,
18740 an Alpha will report 12345678. If the test program works the default is
18741 probably right.
18742 I'm now running the test program...
18743 EOM
18744                 $cat >try.c <<EOCP
18745 #include <stdio.h>
18746 #$i_stdlib I_STDLIB
18747 #ifdef I_STDLIB
18748 #include <stdlib.h>
18749 #endif
18750 #include <sys/types.h>
18751 typedef $uvtype UV;
18752 int main()
18753 {
18754         int i;
18755         union {
18756                 UV l;
18757                 char c[$uvsize];
18758         } u;
18759
18760         if ($uvsize > 4)
18761                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18762         else
18763                 u.l = (UV)0x04030201;
18764         for (i = 0; i < $uvsize; i++)
18765                 printf("%c", u.c[i]+'0');
18766         printf("\n");
18767         exit(0);
18768 }
18769 EOCP
18770                 xxx_prompt=y
18771                 set try
18772                 if eval $compile && $run ./try > /dev/null; then
18773                         dflt=`$run ./try`
18774                         case "$dflt" in
18775                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18776                                 echo "(The test program ran ok.)"
18777                                 echo "byteorder=$dflt"
18778                                 xxx_prompt=n
18779                         ;;
18780                         ????|????????) echo "(The test program ran ok.)" ;;
18781                         *) echo "(The test program didn't run right for some reason.)" ;;
18782                         esac
18783                 else
18784                         dflt='4321'
18785                         cat <<'EOM'
18786 (I can't seem to compile the test program.  Guessing big-endian...)
18787 EOM
18788                 fi
18789                 case "$xxx_prompt" in
18790                 y)
18791                         rp="What is the order of bytes in $uvtype?"
18792                         . ./myread
18793                         byteorder="$ans"
18794                         ;;
18795                 *)      byteorder=$dflt
18796                         ;;
18797                 esac
18798                 ;;
18799         esac
18800         $rm_try
18801         ;;
18802 esac
18803
18804 : Checking 32bit alignedness
18805 $cat <<EOM
18806
18807 Checking to see whether you can access character data unalignedly...
18808 EOM
18809 case "$d_u32align" in
18810 '')   $cat >try.c <<EOCP
18811 #include <stdio.h>
18812 #$i_stdlib I_STDLIB
18813 #ifdef I_STDLIB
18814 #include <stdlib.h>
18815 #endif
18816 #define U32 $u32type
18817 #define BYTEORDER 0x$byteorder
18818 #define U8 $u8type
18819 #include <signal.h>
18820 #ifdef SIGBUS
18821 $signal_t bletch(int s) { exit(4); }
18822 #endif
18823 int main() {
18824 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18825     volatile U8 buf[8];
18826     volatile U32 *up;
18827     int i;
18828
18829     if (sizeof(U32) != 4) {
18830         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18831         exit(1);
18832     }
18833
18834     fflush(stdout);
18835
18836 #ifdef SIGBUS
18837     signal(SIGBUS, bletch);
18838 #endif
18839
18840     buf[0] = 0;
18841     buf[1] = 0;
18842     buf[2] = 0;
18843     buf[3] = 1;
18844     buf[4] = 0;
18845     buf[5] = 0;
18846     buf[6] = 0;
18847     buf[7] = 1;
18848
18849     for (i = 0; i < 4; i++) {
18850         up = (U32*)(buf + i);
18851         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18852                (*up == 1 << (8*(3-i)))  /* little-endian */
18853               )
18854            )
18855         {
18856             printf("read failed (%x)\n", *up);
18857             exit(2);
18858         }
18859     }
18860
18861     /* write test */
18862     for (i = 0; i < 4; i++) {
18863         up = (U32*)(buf + i);
18864         *up = 0xBeef;
18865         if (*up != 0xBeef) {
18866             printf("write failed (%x)\n", *up);
18867             exit(3);
18868         }
18869     }
18870
18871     exit(0);
18872 #else
18873     printf("1\n");
18874     exit(1);
18875 #endif
18876     return 0;
18877 }
18878 EOCP
18879 set try
18880 if eval $compile_ok; then
18881         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18882         $run ./try 2>&1 >/dev/null
18883         case "$?" in
18884         0)      cat >&4 <<EOM
18885 You can access character data pretty unalignedly.
18886 EOM
18887                 d_u32align="$undef"
18888                 ;;
18889         *)      cat >&4 <<EOM
18890 It seems that you must access character data in an aligned manner.
18891 EOM
18892                 d_u32align="$define"
18893                 ;;
18894         esac
18895 else
18896         rp='Can you access character data at unaligned addresses?'
18897         dflt='n'
18898         . ./myread
18899         case "$ans" in
18900         [yY]*)  d_u32align="$undef"  ;;
18901         *)      d_u32align="$define" ;;
18902         esac
18903 fi
18904 $rm_try
18905 ;;
18906 esac
18907
18908 : see if ualarm exists
18909 set ualarm d_ualarm
18910 eval $inlibc
18911
18912 : see if umask exists
18913 set umask d_umask
18914 eval $inlibc
18915
18916 : see if unordered exists
18917 set unordered d_unordered
18918 eval $inlibc
18919
18920 : see if unsetenv exists
18921 set unsetenv d_unsetenv
18922 eval $inlibc
18923
18924 : see if usleep exists
18925 set usleep d_usleep
18926 eval $inlibc
18927
18928 : see if prototype for usleep is available
18929 echo " "
18930 set d_usleepproto usleep $i_unistd unistd.h
18931 eval $hasproto
18932
18933 : see if ustat exists
18934 set ustat d_ustat
18935 eval $inlibc
18936
18937 : see if closedir exists
18938 set closedir d_closedir
18939 eval $inlibc
18940
18941 case "$d_closedir" in
18942 "$define")
18943         echo " "
18944         echo "Checking whether closedir() returns a status..." >&4
18945         cat > try.c <<EOM
18946 #$i_dirent I_DIRENT             /**/
18947 #$i_sysdir I_SYS_DIR            /**/
18948 #$i_sysndir I_SYS_NDIR          /**/
18949 #$i_systypes I_SYS_TYPES        /**/
18950
18951 #if defined(I_SYS_TYPES)
18952 #include <sys/types.h>
18953 #endif
18954 #if defined(I_DIRENT)
18955 #include <dirent.h>
18956 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18957 #include <sys/dir.h>
18958 #endif
18959 #else
18960 #ifdef I_SYS_NDIR
18961 #include <sys/ndir.h>
18962 #else
18963 #ifdef I_SYS_DIR
18964 #ifdef hp9000s500
18965 #include <ndir.h>       /* may be wrong in the future */
18966 #else
18967 #include <sys/dir.h>
18968 #endif
18969 #endif
18970 #endif
18971 #endif
18972 int main() { return closedir(opendir(".")); }
18973 EOM
18974         set try
18975         if eval $compile_ok; then
18976                 if $run ./try > /dev/null 2>&1 ; then
18977                         echo "Yes, it does."
18978                         val="$undef"
18979                 else
18980                         echo "No, it doesn't."
18981                         val="$define"
18982                 fi
18983         else
18984                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18985                 val="$define"
18986         fi
18987         ;;
18988 *)
18989         val="$undef";
18990         ;;
18991 esac
18992 set d_void_closedir
18993 eval $setvar
18994 $rm_try
18995
18996 : see if there is a wait4
18997 set wait4 d_wait4
18998 eval $inlibc
18999
19000 : see if waitpid exists
19001 set waitpid d_waitpid
19002 eval $inlibc
19003
19004 : see if wcstombs exists
19005 set wcstombs d_wcstombs
19006 eval $inlibc
19007
19008 : see if wctomb exists
19009 set wctomb d_wctomb
19010 eval $inlibc
19011
19012 : see if writev exists
19013 set writev d_writev
19014 eval $inlibc
19015
19016 : preserve RCS keywords in files with variable substitution, grrr
19017 Date='$Date'
19018 Id='$Id'
19019 Log='$Log'
19020 RCSfile='$RCSfile'
19021 Revision='$Revision'
19022
19023 : check for alignment requirements
19024 echo " "
19025 case "$usecrosscompile" in
19026 *$define*)
19027         $cat <<EOM
19028 You seem to be cross-compiling.  Skipping the memory alignment check.
19029
19030 EOM
19031         case "$alignbytes" in
19032         '') alignbytes=8 ;;
19033         esac
19034         ;;
19035 *)
19036         case "$alignbytes" in
19037         '') echo "Checking alignment constraints..." >&4
19038                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
19039                         $cat >try.c <<'EOCP'
19040 typedef long double NV;
19041 EOCP
19042                 else
19043                         $cat >try.c <<'EOCP'
19044 typedef double NV;
19045 EOCP
19046                 fi
19047                 $cat >>try.c <<'EOCP'
19048 #include <stdio.h>
19049 struct foobar {
19050         char foo;
19051         NV bar;
19052 } try_algn;
19053 int main()
19054 {
19055     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19056     return(0);
19057 }
19058 EOCP
19059                 set try
19060                 if eval $compile_ok; then
19061                         dflt=`$run ./try`
19062                 else
19063                         dflt='8'
19064                         echo "(I can't seem to compile the test program...)"
19065                 fi
19066                 case "$multiarch" in
19067                 *$define*)
19068                         : The usual safe value is 8, but Darwin with -Duselongdouble
19069                         : needs 16.  Hence, we will take 8 as a minimum, but allow
19070                         : Configure to pick a larger value if needed.
19071                         if $test "$dflt" -lt 8; then
19072                             dflt='8'
19073                                 echo "Setting alignment to 8 for multiarch support.">&4
19074                         fi
19075                         ;;
19076                 esac
19077                 ;;
19078         *) dflt="$alignbytes"
19079                 ;;
19080         esac
19081         rp="Doubles must be aligned on a how-many-byte boundary?"
19082         . ./myread
19083         alignbytes="$ans"
19084         $rm_try
19085         ;;
19086 esac
19087
19088
19089 : set the base revision
19090 baserev=5.0
19091
19092 : length of character in bytes. Is always 1, otherwise it isnt C
19093 : This used to be a test using sizeof
19094 charsize=1
19095
19096 : Check for the number of bits in a character
19097 case "$charbits" in
19098 '')     echo "Checking how long a character is (in bits)..." >&4
19099         $cat >try.c <<EOCP
19100 #include <stdio.h>
19101 int main ()
19102 {
19103     int n;
19104     unsigned char c;
19105     for (c = 1, n = 0; c; c <<= 1, n++) ;
19106     printf ("%d\n", n);
19107     return (0);
19108     }
19109 EOCP
19110         set try
19111         if eval $compile_ok; then
19112                 dflt=`$run ./try`
19113         else
19114                 dflt='8'
19115                 echo "(I can't seem to compile the test program.  Guessing...)"
19116         fi
19117         ;;
19118 *)
19119         dflt="$charbits"
19120         ;;
19121 esac
19122 rp="What is the length of a character (in bits)?"
19123 . ./myread
19124 charbits="$ans"
19125 $rm_try
19126 case "$charbits" in
19127 8)      ;;
19128 *)      cat >&4 << EOM
19129 Your system has an unsigned character size of $charbits bits, which
19130 is rather unusual (normally it is 8 bits).  Perl likely will not work
19131 correctly on your system, with subtle bugs in various places.
19132 EOM
19133         rp='Do you really want to continue?'
19134         dflt='n'
19135         . ./myread
19136         case "$ans" in
19137                 [yY])   echo >&4 "Okay, continuing."    ;;
19138                 *)      exit 1                          ;;
19139         esac
19140 esac
19141
19142 : how do we concatenate cpp tokens here?
19143 echo " "
19144 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19145 $cat >cpp_stuff.c <<'EOCP'
19146 #define RCAT(a,b)a/**/b
19147 #define ACAT(a,b)a ## b
19148 RCAT(Rei,ser)
19149 ACAT(Cir,cus)
19150 EOCP
19151 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19152 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19153         echo "Oh!  Smells like ANSI's been here." >&4
19154         echo "We can catify or stringify, separately or together!"
19155         cpp_stuff=42
19156 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19157         echo "Ah, yes!  The good old days!" >&4
19158         echo "However, in the good old days we don't know how to stringify and"
19159         echo "catify at the same time."
19160         cpp_stuff=1
19161 else
19162         $cat >&4 <<EOM
19163 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19164 You're going to have to edit the values of CAT[2-5] in config.h...
19165 EOM
19166         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19167 fi
19168 $rm -f cpp_stuff.*
19169
19170 : see if this is a db.h system
19171 set db.h i_db
19172 eval $inhdr
19173
19174 case "$i_db" in
19175 $define)
19176         : Check db version.
19177         echo " "
19178         echo "Checking Berkeley DB version ..." >&4
19179         $cat >try.c <<EOCP
19180 #$d_const HASCONST
19181 #ifndef HASCONST
19182 #define const
19183 #endif
19184 #include <sys/types.h>
19185 #include <stdio.h>
19186 #$i_stdlib I_STDLIB
19187 #ifdef I_STDLIB
19188 #include <stdlib.h>
19189 #endif
19190 #include <db.h>
19191 int main(int argc, char *argv[])
19192 {
19193 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19194     int Major, Minor, Patch ;
19195     unsigned long Version ;
19196     (void)db_version(&Major, &Minor, &Patch) ;
19197     if (argc == 2) {
19198         printf("%d %d %d %d %d %d\n",
19199                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19200                Major, Minor, Patch);
19201         exit(0);
19202     }
19203     printf("You have Berkeley DB Version 2 or greater.\n");
19204
19205     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19206                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19207     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19208                 Major, Minor, Patch) ;
19209
19210     /* check that db.h & libdb are compatible */
19211     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19212         printf("db.h and libdb are incompatible.\n") ;
19213         exit(3);
19214     }
19215
19216     printf("db.h and libdb are compatible.\n") ;
19217
19218     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19219                 + DB_VERSION_PATCH ;
19220
19221     /* needs to be >= 2.3.4 */
19222     if (Version < 2003004) {
19223     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19224         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19225         exit(2);
19226     }
19227
19228     exit(0);
19229 #else
19230 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19231     if (argc == 2) {
19232         printf("1 0 0\n");
19233         exit(0);
19234     }
19235     printf("You have Berkeley DB Version 1.\n");
19236     exit(0);    /* DB version < 2: the coast is clear. */
19237 #else
19238     exit(1);    /* <db.h> not Berkeley DB? */
19239 #endif
19240 #endif
19241 }
19242 EOCP
19243         set try
19244         if eval $compile_ok && $run ./try; then
19245                 echo 'Looks OK.' >&4
19246                 set `$run ./try 1`
19247                 db_version_major=$1
19248                 db_version_minor=$2
19249                 db_version_patch=$3
19250         else
19251                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19252                 i_db=$undef
19253                 case " $libs " in
19254                 *"-ldb "*)
19255                         : Remove db from list of libraries to use
19256                         echo "Removing unusable -ldb from library list" >&4
19257                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19258                         shift
19259                         libs="$*"
19260                         echo "libs = $libs" >&4
19261                         ;;
19262                 esac
19263         fi
19264         $rm_try
19265         ;;
19266 esac
19267
19268 case "$i_db" in
19269 define)
19270         : Check the return type needed for hash
19271         echo " "
19272         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19273         $cat >try.c <<EOCP
19274 #$d_const HASCONST
19275 #ifndef HASCONST
19276 #define const
19277 #endif
19278 #include <sys/types.h>
19279 #include <db.h>
19280
19281 #ifndef DB_VERSION_MAJOR
19282 u_int32_t hash_cb (ptr, size)
19283 const void *ptr;
19284 size_t size;
19285 {
19286 }
19287 HASHINFO info;
19288 int main()
19289 {
19290         info.hash = hash_cb;
19291 }
19292 #endif
19293 EOCP
19294         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19295                 if $contains warning try.out >>/dev/null 2>&1 ; then
19296                         db_hashtype='int'
19297                 else
19298                         db_hashtype='u_int32_t'
19299                 fi
19300         else
19301                 : XXX Maybe we should just give up here.
19302                 db_hashtype=u_int32_t
19303                 $cat try.out >&4
19304                 echo "Help:  I can't seem to compile the db test program." >&4
19305                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19306         fi
19307         $rm_try
19308         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19309         ;;
19310 *)      db_hashtype=u_int32_t
19311         ;;
19312 esac
19313 case "$i_db" in
19314 define)
19315         : Check the return type needed for prefix
19316         echo " "
19317         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19318         cat >try.c <<EOCP
19319 #$d_const HASCONST
19320 #ifndef HASCONST
19321 #define const
19322 #endif
19323 #include <sys/types.h>
19324 #include <db.h>
19325
19326 #ifndef DB_VERSION_MAJOR
19327 size_t prefix_cb (key1, key2)
19328 const DBT *key1;
19329 const DBT *key2;
19330 {
19331 }
19332 BTREEINFO info;
19333 int main()
19334 {
19335         info.prefix = prefix_cb;
19336 }
19337 #endif
19338 EOCP
19339         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19340                 if $contains warning try.out >>/dev/null 2>&1 ; then
19341                         db_prefixtype='int'
19342                 else
19343                         db_prefixtype='size_t'
19344                 fi
19345         else
19346                 db_prefixtype='size_t'
19347                 : XXX Maybe we should just give up here.
19348                 $cat try.out >&4
19349                 echo "Help:  I can't seem to compile the db test program." >&4
19350                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19351         fi
19352         $rm_try
19353         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19354         ;;
19355 *)      db_prefixtype='size_t'
19356         ;;
19357 esac
19358
19359 : How can we generate normalized random numbers ?
19360 echo " "
19361 echo "Looking for a random number function..." >&4
19362 case "$randfunc" in
19363 '')
19364         if set drand48 val -f; eval $csym; $val; then
19365                 dflt="drand48"
19366                 echo "Good, found drand48()." >&4
19367         elif set random val -f; eval $csym; $val; then
19368                 dflt="random"
19369                 echo "OK, found random()." >&4
19370         else
19371                 dflt="rand"
19372                 echo "Yick, looks like I have to use rand()." >&4
19373         fi
19374         echo " "
19375         ;;
19376 *)
19377         dflt="$randfunc"
19378         ;;
19379 esac
19380 cont=true
19381
19382 case "$ccflags" in
19383 *-Dmy_rand=*|*-Dmy_srand=*)
19384         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19385         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19386         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19387         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19388         ;;
19389 esac
19390
19391 while $test "$cont"; do
19392         rp="Use which function to generate random numbers?"
19393         . ./myread
19394         if $test "$ans" = "$dflt"; then
19395                 : null
19396         else
19397                 randbits=''
19398         fi
19399         randfunc="$ans"
19400         if set $ans val -f; eval $csym; $val; then
19401                 cont=''
19402         else
19403                 dflt=y
19404                 rp="I cannot find function $ans. Use that name anyway?"
19405                 . ./myread
19406                 dflt=rand
19407                 case "$ans" in
19408                         [yY]*) cont='';;
19409                 esac
19410         fi
19411         case "$cont" in
19412         '')
19413                 case "$randfunc" in
19414                 drand48)
19415                         drand01="drand48()"
19416                         seedfunc="srand48"
19417                         randbits=48
19418                         randseedtype=long
19419                         ;;
19420                 rand|random)
19421                         case "$randbits" in
19422                         '')
19423 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19424                                 $cat >try.c <<EOCP
19425 #$i_unistd I_UNISTD
19426 #$i_stdlib I_STDLIB
19427 #include <stdio.h>
19428 #ifdef I_UNISTD
19429 #  include <unistd.h>
19430 #endif
19431 #ifdef I_STDLIB
19432 #  include <stdlib.h>
19433 #endif
19434 int main()
19435 {
19436         register int i;
19437         register unsigned long tmp;
19438         register unsigned long max = 0L;
19439
19440         for (i = 1000; i; i--) {
19441                 tmp = (unsigned long) $randfunc();
19442                 if (tmp > max) max = tmp;
19443         }
19444         for (i = 0; max; i++)
19445                 max /= 2;
19446         printf("%d\n",i);
19447 }
19448 EOCP
19449                                 set try
19450                                 if eval $compile_ok; then
19451                                         dflt=`try`
19452                                 else
19453                                         dflt='?'
19454                                         echo "(I can't seem to compile the test program...)"
19455                                 fi
19456                                 ;;
19457                         *)
19458                                 dflt="$randbits"
19459                                 ;;
19460                         esac
19461                         rp="How many bits does your $randfunc() function produce?"
19462                         . ./myread
19463                         randbits="$ans"
19464                         $rm_try
19465                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19466                         seedfunc="s$randfunc"
19467                         randseedtype=unsigned
19468                         ;;
19469                 *)
19470                         dflt="31"
19471                         rp="How many bits does your $randfunc() function produce?"
19472                         . ./myread
19473                         randbits="$ans"
19474                         seedfunc="s$randfunc"
19475                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19476                         if set $seedfunc val -f; eval $csym; $val; then
19477                                 echo "(Using $seedfunc() to seed random generator)"
19478                         else
19479                                 echo "(Warning: no $seedfunc() to seed random generator)"
19480                                 seedfunc=rand
19481                         fi
19482                         randseedtype=unsigned
19483                         ;;
19484                 esac
19485                 ;;
19486         esac
19487 done
19488
19489 : Determine if this is an EBCDIC system
19490 echo " "
19491 echo "Determining whether or not we are on an EBCDIC system..." >&4
19492 $cat >try.c <<'EOM'
19493 int main()
19494 {
19495   if ('M'==0xd4) return 0;
19496   return 1;
19497 }
19498 EOM
19499
19500 val=$undef
19501 set try
19502 if eval $compile_ok; then
19503         if $run ./try; then
19504                 echo "You seem to speak EBCDIC." >&4
19505                 val="$define"
19506         else
19507                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19508         fi
19509 else
19510         echo "I'm unable to compile the test program." >&4
19511         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19512 fi
19513 $rm_try
19514 set ebcdic
19515 eval $setvar
19516
19517 : Check how to flush
19518 echo " "
19519 $cat >&4 <<EOM
19520 Checking how to flush all pending stdio output...
19521 EOM
19522 # I only know how to find the first 32 possibly open files on SunOS.
19523 # See also hints/sunos_4_1.sh and util.c  --AD
19524 case "$osname" in
19525 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19526 esac
19527 $cat >>try.c <<EOCP
19528 #include <stdio.h>
19529 #$i_stdlib I_STDLIB
19530 #ifdef I_STDLIB
19531 #include <stdlib.h>
19532 #endif
19533 #$i_unistd I_UNISTD
19534 #ifdef I_UNISTD
19535 # include <unistd.h>
19536 #endif
19537 #$d_sysconf HAS_SYSCONF
19538 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19539 #ifdef HAS_STDIO_STREAM_ARRAY
19540 # define STDIO_STREAM_ARRAY $stdio_stream_array
19541 #endif
19542 int main() {
19543   FILE* p;
19544   unlink("try.out");
19545   p = fopen("try.out", "w");
19546 #ifdef TRY_FPUTC
19547   fputc('x', p);
19548 #else
19549 # ifdef TRY_FPRINTF
19550   fprintf(p, "x");
19551 # endif
19552 #endif
19553 #ifdef TRY_FFLUSH_NULL
19554   fflush(NULL);
19555 #endif
19556 #ifdef TRY_FFLUSH_ALL
19557   {
19558     long open_max = -1;
19559 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19560     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19561 # else
19562 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19563     open_max = sysconf(_SC_OPEN_MAX);
19564 #  else
19565 #   ifdef FOPEN_MAX
19566     open_max = FOPEN_MAX;
19567 #   else
19568 #    ifdef OPEN_MAX
19569     open_max = OPEN_MAX;
19570 #    else
19571 #     ifdef _NFILE
19572     open_max = _NFILE;
19573 #     endif
19574 #    endif
19575 #   endif
19576 #  endif
19577 # endif
19578 # ifdef HAS_STDIO_STREAM_ARRAY
19579     if (open_max > 0) {
19580       long i;
19581       for (i = 0; i < open_max; i++)
19582             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19583                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19584                 STDIO_STREAM_ARRAY[i]._flag)
19585                 fflush(&STDIO_STREAM_ARRAY[i]);
19586     }
19587   }
19588 # endif
19589 #endif
19590   _exit(42);
19591 }
19592 EOCP
19593 : first we have to find out how _not_ to flush
19594 $to try.c
19595 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19596     output=''
19597     set try -DTRY_FPUTC
19598     if eval $compile; then
19599             $run ./try 2>/dev/null
19600             code="$?"
19601             $from try.out
19602             if $test ! -s try.out -a "X$code" = X42; then
19603                 output=-DTRY_FPUTC
19604             fi
19605     fi
19606     case "$output" in
19607     '')
19608             set try -DTRY_FPRINTF
19609             if eval $compile; then
19610                     $run ./try 2>/dev/null
19611                     code="$?"
19612                     $from try.out
19613                     if $test ! -s try.out -a "X$code" = X42; then
19614                         output=-DTRY_FPRINTF
19615                     fi
19616             fi
19617         ;;
19618     esac
19619 fi
19620 : check for fflush NULL behaviour
19621 case "$fflushNULL" in
19622 '')     set try -DTRY_FFLUSH_NULL $output
19623         if eval $compile; then
19624                 $run ./try 2>/dev/null
19625                 code="$?"
19626                 $from try.out
19627                 if $test -s try.out -a "X$code" = X42; then
19628                         fflushNULL="`$cat try.out`"
19629                 else
19630                         if $test "X$code" != X42; then
19631                                 $cat >&4 <<EOM
19632 (If this test failed, don't worry, we'll try another method shortly.)
19633 EOM
19634                         fi
19635                 fi
19636         fi
19637         $rm -f core try.core core.try.*
19638         case "$fflushNULL" in
19639         x)      $cat >&4 <<EOM
19640 Your fflush(NULL) works okay for output streams.
19641 Let's see if it clobbers input pipes...
19642 EOM
19643 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19644 # bug that improperly flushes the input end of pipes.  So we avoid the
19645 # autoflush on fork/system/exec support for now. :-(
19646 $cat >tryp.c <<EOCP
19647 #include <stdio.h>
19648 int
19649 main(int argc, char **argv)
19650 {
19651     char buf[1024];
19652     int i;
19653     char *bp = buf;
19654     while (1) {
19655         while ((i = getc(stdin)) != -1
19656                && (*bp++ = i) != '\n'
19657                && bp < &buf[1024])
19658         /* DO NOTHING */ ;
19659         *bp = '\0';
19660         fprintf(stdout, "%s", buf);
19661         fflush(NULL);
19662         if (i == -1)
19663             return 0;
19664         bp = buf;
19665     }
19666 }
19667 EOCP
19668                 fflushNULL="$define"
19669                 set tryp
19670                 if eval $compile; then
19671                     $rm -f tryp.out
19672                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19673                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19674                        $cat >&4 <<EOM
19675 fflush(NULL) seems to behave okay with input streams.
19676 EOM
19677                         fflushNULL="$define"
19678                     else
19679                         $cat >&4 <<EOM
19680 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19681 EOM
19682                         fflushNULL="$undef"
19683                     fi
19684                 fi
19685                 $rm -f core tryp.c tryp.core core.tryp.*
19686                 ;;
19687         '')     $cat >&4 <<EOM
19688 Your fflush(NULL) isn't working (contrary to ANSI C).
19689 EOM
19690                 fflushNULL="$undef"
19691                 ;;
19692         *)      $cat >&4 <<EOM
19693 Cannot figure out whether your fflush(NULL) works or not.
19694 I'm assuming it doesn't (contrary to ANSI C).
19695 EOM
19696                 fflushNULL="$undef"
19697                 ;;
19698         esac
19699         ;;
19700 $define|true|[yY]*)
19701         fflushNULL="$define"
19702         ;;
19703 *)
19704         fflushNULL="$undef"
19705         ;;
19706 esac
19707 : check explicit looping only if NULL did not work, and if the pipe
19708 : bug does not show up on an explicit flush too
19709 case "$fflushNULL" in
19710 "$undef")
19711         $cat >tryp.c <<EOCP
19712 #include <stdio.h>
19713 int
19714 main(int argc, char **argv)
19715 {
19716     char buf[1024];
19717     int i;
19718     char *bp = buf;
19719     while (1) {
19720         while ((i = getc(stdin)) != -1
19721                && (*bp++ = i) != '\n'
19722                && bp < &buf[1024])
19723         /* DO NOTHING */ ;
19724         *bp = '\0';
19725         fprintf(stdout, "%s", buf);
19726         fflush(stdin);
19727         if (i == -1)
19728             return 0;
19729         bp = buf;
19730     }
19731 }
19732 EOCP
19733         set tryp
19734         if eval $compile; then
19735             $rm -f tryp.out
19736             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19737             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19738                $cat >&4 <<EOM
19739 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19740 EOM
19741                 : now check for fflushall behaviour
19742                 case "$fflushall" in
19743                 '')     set try -DTRY_FFLUSH_ALL $output
19744                         if eval $compile; then
19745                                 $cat >&4 <<EOM
19746 (Now testing the other method--but note that this also may fail.)
19747 EOM
19748                                 $run ./try 2>/dev/null
19749                                 code=$?
19750                                 $from try.out
19751                                 if $test -s try.out -a "X$code" = X42; then
19752                                         fflushall="`$cat try.out`"
19753                                 fi
19754                         fi
19755                         $rm_try
19756                         case "$fflushall" in
19757                         x)      $cat >&4 <<EOM
19758 Whew. Flushing explicitly all the stdio streams works.
19759 EOM
19760                                 fflushall="$define"
19761                                 ;;
19762                         '')     $cat >&4 <<EOM
19763 Sigh. Flushing explicitly all the stdio streams doesn't work.
19764 EOM
19765                                 fflushall="$undef"
19766                                 ;;
19767                         *)      $cat >&4 <<EOM
19768 Cannot figure out whether flushing stdio streams explicitly works or not.
19769 I'm assuming it doesn't.
19770 EOM
19771                                 fflushall="$undef"
19772                                 ;;
19773                         esac
19774                         ;;
19775                 "$define"|true|[yY]*)
19776                         fflushall="$define"
19777                         ;;
19778                 *)
19779                         fflushall="$undef"
19780                         ;;
19781                 esac
19782             else
19783                 $cat >&4 <<EOM
19784 All is futile.  Even fflush(stdin) clobbers input pipes!
19785 EOM
19786                 fflushall="$undef"
19787             fi
19788         else
19789             fflushall="$undef"
19790         fi
19791         $rm -f core tryp.c tryp.core core.tryp.*
19792         ;;
19793 *)      fflushall="$undef"
19794         ;;
19795 esac
19796
19797 case "$fflushNULL$fflushall" in
19798 undefundef)
19799         $cat <<EOM
19800 OK, I give up.  I cannot figure out how to flush pending stdio output.
19801 We won't be flushing handles at all before fork/exec/popen.
19802 EOM
19803         ;;
19804 esac
19805 $rm_try tryp
19806
19807 : Store the full pathname to the ar program for use in the C program
19808 : Respect a hint or command line value for full_ar.
19809 case "$full_ar" in
19810 '') full_ar=$ar ;;
19811 esac
19812
19813 : Store the full pathname to the sed program for use in the C program
19814 full_sed=$sed
19815
19816 : see what type gids are declared as in the kernel
19817 echo " "
19818 echo "Looking for the type for group ids returned by getgid()."
19819 set gid_t gidtype xxx stdio.h sys/types.h
19820 eval $typedef
19821 case "$gidtype" in
19822 xxx)
19823         xxx=`./findhdr sys/user.h`
19824         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19825         case $1 in
19826         unsigned) dflt="$1 $2" ;;
19827         *) dflt="$1" ;;
19828         esac
19829         ;;
19830 *) dflt="$gidtype";;
19831 esac
19832 case "$gidtype" in
19833 gid_t) echo "gid_t found." ;;
19834 *)      rp="What is the type for group ids returned by getgid()?"
19835         . ./myread
19836         gidtype="$ans"
19837         ;;
19838 esac
19839
19840 : Check the size of GID
19841 echo " "
19842 case "$gidtype" in
19843 *_t) zzz="$gidtype"     ;;
19844 *)   zzz="gid"          ;;
19845 esac
19846 echo "Checking the size of $zzz..." >&4
19847 cat > try.c <<EOCP
19848 #include <sys/types.h>
19849 #include <stdio.h>
19850 #$i_stdlib I_STDLIB
19851 #ifdef I_STDLIB
19852 #include <stdlib.h>
19853 #endif
19854 int main() {
19855     printf("%d\n", (int)sizeof($gidtype));
19856     exit(0);
19857 }
19858 EOCP
19859 set try
19860 if eval $compile_ok; then
19861         yyy=`$run ./try`
19862         case "$yyy" in
19863         '')     gidsize=4
19864                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19865                 ;;
19866         *)      gidsize=$yyy
19867                 echo "Your $zzz is $gidsize bytes long."
19868                 ;;
19869         esac
19870 else
19871         gidsize=4
19872         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19873 fi
19874
19875
19876 : Check if GID is signed
19877 echo " "
19878 case "$gidtype" in
19879 *_t) zzz="$gidtype"     ;;
19880 *)   zzz="gid"          ;;
19881 esac
19882 echo "Checking the sign of $zzz..." >&4
19883 cat > try.c <<EOCP
19884 #include <sys/types.h>
19885 #include <stdio.h>
19886 int main() {
19887         $gidtype foo = -1;
19888         if (foo < 0)
19889                 printf("-1\n");
19890         else
19891                 printf("1\n");
19892 }
19893 EOCP
19894 set try
19895 if eval $compile; then
19896         yyy=`$run ./try`
19897         case "$yyy" in
19898         '')     gidsign=1
19899                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19900                 ;;
19901         *)      gidsign=$yyy
19902                 case "$gidsign" in
19903                  1) echo "Your $zzz is unsigned." ;;
19904                 -1) echo "Your $zzz is signed."   ;;
19905                 esac
19906                 ;;
19907         esac
19908 else
19909         gidsign=1
19910         echo "(I can't compile the test program--guessing unsigned.)" >&4
19911 fi
19912
19913
19914 : Check 64bit sizes
19915 echo " "
19916
19917 if $test X"$quadtype" != X; then
19918
19919 echo "Checking how to print 64-bit integers..." >&4
19920
19921 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19922         $cat >try.c <<'EOCP'
19923 #include <sys/types.h>
19924 #include <stdio.h>
19925 int main() {
19926   int q = 12345678901;
19927   printf("%ld\n", q);
19928 }
19929 EOCP
19930         set try
19931         if eval $compile; then
19932                 yyy=`$run ./try`
19933                 case "$yyy" in
19934                 12345678901)
19935                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19936                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19937                         echo "We will use %d."
19938                         ;;
19939                 esac
19940         fi
19941 fi
19942
19943 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19944         $cat >try.c <<'EOCP'
19945 #include <sys/types.h>
19946 #include <stdio.h>
19947 int main() {
19948   long q = 12345678901;
19949   printf("%ld\n", q);
19950 }
19951 EOCP
19952         set try
19953         if eval $compile; then
19954                 yyy=`$run ./try`
19955                 case "$yyy" in
19956                 12345678901)
19957                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19958                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19959                         echo "We will use %ld."
19960                         ;;
19961                 esac
19962         fi
19963 fi
19964
19965 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19966         $cat >try.c <<'EOCP'
19967 #include <sys/types.h>
19968 #include <inttypes.h>
19969 #include <stdio.h>
19970 int main() {
19971   int64_t q = 12345678901;
19972   printf("%" PRId64 "\n", q);
19973 }
19974 EOCP
19975         set try
19976         if eval $compile; then
19977                 yyy=`$run ./try`
19978                 case "$yyy" in
19979                 12345678901)
19980                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19981                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19982                         echo "We will use the C9X style."
19983                         ;;
19984                 esac
19985         fi
19986 fi
19987
19988 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19989         $cat >try.c <<EOCP
19990 #include <sys/types.h>
19991 #include <stdio.h>
19992 int main() {
19993   $quadtype q = 12345678901;
19994   printf("%Ld\n", q);
19995 }
19996 EOCP
19997         set try
19998         if eval $compile; then
19999                 yyy=`$run ./try`
20000                 case "$yyy" in
20001                 12345678901)
20002                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20003                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20004                         echo "We will use %Ld."
20005                         ;;
20006                 esac
20007         fi
20008 fi
20009
20010 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20011         $cat >try.c <<'EOCP'
20012 #include <sys/types.h>
20013 #include <stdio.h>
20014 int main() {
20015   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20016   printf("%lld\n", q);
20017 }
20018 EOCP
20019         set try
20020         if eval $compile; then
20021                 yyy=`$run ./try`
20022                 case "$yyy" in
20023                 12345678901)
20024                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20025                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20026                         echo "We will use the %lld style."
20027                         ;;
20028                 esac
20029         fi
20030 fi
20031
20032 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20033         $cat >try.c <<EOCP
20034 #include <sys/types.h>
20035 #include <stdio.h>
20036 int main() {
20037   $quadtype q = 12345678901;
20038   printf("%qd\n", q);
20039 }
20040 EOCP
20041         set try
20042         if eval $compile; then
20043                 yyy=`$run ./try`
20044                 case "$yyy" in
20045                 12345678901)
20046                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20047                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20048                         echo "We will use %qd."
20049                         ;;
20050                 esac
20051         fi
20052 fi
20053
20054 if $test X"$sPRId64" = X; then
20055         echo "Cannot figure out how to print 64-bit integers." >&4
20056 fi
20057 $rm_try
20058
20059 fi
20060
20061 case "$sPRId64" in
20062 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20063         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20064         ;;
20065 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20066         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20067         ;;
20068 esac
20069
20070 : Check format strings for internal types
20071 echo " "
20072 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20073
20074 if $test X"$ivsize" = X8; then
20075         ivdformat="$sPRId64"
20076         uvuformat="$sPRIu64"
20077         uvoformat="$sPRIo64"
20078         uvxformat="$sPRIx64"
20079         uvXUformat="$sPRIXU64"
20080 else
20081         if $test X"$ivsize" = X"$longsize"; then
20082                 ivdformat='"ld"'
20083                 uvuformat='"lu"'
20084                 uvoformat='"lo"'
20085                 uvxformat='"lx"'
20086                 uvXUformat='"lX"'
20087         else
20088                 if $test X"$ivsize" = X"$intsize"; then
20089                         ivdformat='"d"'
20090                         uvuformat='"u"'
20091                         uvoformat='"o"'
20092                         uvxformat='"x"'
20093                         uvXUformat='"X"'
20094                 else
20095                         : far out
20096                         if $test X"$ivsize" = X"$shortsize"; then
20097                                 ivdformat='"hd"'
20098                                 uvuformat='"hu"'
20099                                 uvoformat='"ho"'
20100                                 uvxformat='"hx"'
20101                                 uvXUformat='"hX"'
20102                         fi
20103                 fi
20104         fi
20105 fi
20106
20107 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20108         nveformat="$sPRIeldbl"
20109         nvfformat="$sPRIfldbl"
20110         nvgformat="$sPRIgldbl"
20111         nvEUformat="$sPRIEUldbl"
20112         nvFUformat="$sPRIFUldbl"
20113         nvGUformat="$sPRIGUldbl"
20114 else
20115         nveformat='"e"'
20116         nvfformat='"f"'
20117         nvgformat='"g"'
20118         nvEUformat='"E"'
20119         nvFUformat='"F"'
20120         nvGUformat='"G"'
20121 fi
20122
20123 case "$ivdformat" in
20124 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20125     exit 1
20126     ;;
20127 esac
20128
20129 : Check format string for GID
20130
20131 echo " "
20132 $echo "Checking the format string to be used for gids..." >&4
20133
20134 case "$gidsign" in
20135 -1)     if $test X"$gidsize" = X"$ivsize"; then
20136                 gidformat="$ivdformat"
20137         else
20138                 if $test X"$gidsize" = X"$longsize"; then
20139                         gidformat='"ld"'
20140                 else
20141                         if $test X"$gidsize" = X"$intsize"; then
20142                                 gidformat='"d"'
20143                         else
20144                                 if $test X"$gidsize" = X"$shortsize"; then
20145                                         gidformat='"hd"'
20146                                 fi
20147                         fi
20148                 fi
20149         fi
20150         ;;
20151 *)      if $test X"$gidsize" = X"$uvsize"; then
20152                 gidformat="$uvuformat"
20153         else
20154                 if $test X"$gidsize" = X"$longsize"; then
20155                         gidformat='"lu"'
20156                 else
20157                         if $test X"$gidsize" = X"$intsize"; then
20158                                 gidformat='"u"'
20159                         else
20160                                 if $test X"$gidsize" = X"$shortsize"; then
20161                                         gidformat='"hu"'
20162                                 fi
20163                         fi
20164                 fi
20165         fi
20166         ;;
20167 esac
20168
20169 : see if getgroups exists
20170 set getgroups d_getgrps
20171 eval $inlibc
20172
20173 : see if setgroups exists
20174 set setgroups d_setgrps
20175 eval $inlibc
20176
20177 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20178 echo " "
20179 case "$d_getgrps$d_setgrps" in
20180 *define*)
20181         case "$groupstype" in
20182         '') dflt="$gidtype" ;;
20183         *)  dflt="$groupstype" ;;
20184         esac
20185         $cat <<EOM
20186 What type of pointer is the second argument to getgroups() and setgroups()?
20187 Usually this is the same as group ids, $gidtype, but not always.
20188
20189 EOM
20190         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20191         . ./myread
20192         groupstype="$ans"
20193         ;;
20194 *)  groupstype="$gidtype";;
20195 esac
20196
20197 : MAD = Misc Attribute Definition
20198
20199 if $test $patchlevel -lt 9; then
20200 : MAD is not available in 5.8.x or earlier.
20201     ans=n;
20202 else
20203     case "$mad" in
20204     $define|true|[yY]*) dflt='y' ;;
20205     *)                  dflt='n' ;;
20206     esac
20207     cat <<EOM
20208
20209 Would you like to build with Misc Attribute Decoration? This is development
20210 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20211 overhead on the interpreter.
20212
20213 If this doesn't make any sense to you, just accept the default '$dflt'.
20214 EOM
20215     rp='Build Perl with MAD?'
20216     . ./myread
20217 fi
20218 case "$ans" in
20219 y|Y)    val="$define"
20220         madlyh='madly.h madly.act madly.tab'
20221         madlysrc='madly.c'
20222         madlyobj="madly$_o" ;;
20223 *)      val="$undef"
20224         madlyh=''
20225         madlysrc=''
20226         madlyobj='' ;;
20227 esac
20228 set mad
20229 eval $setvar
20230
20231 : check whether make sets MAKE
20232 echo " "
20233 echo "Checking if your $make program sets \$(MAKE)..." >&4
20234 case "$make_set_make" in
20235 '')
20236         $sed 's/^X //' > testmake.mak << 'EOF'
20237 Xall:
20238 X       @echo 'maketemp="$(MAKE)"'
20239 EOF
20240         case "`$make -f testmake.mak 2>/dev/null`" in
20241         *maketemp=*) make_set_make='#' ;;
20242         *)      make_set_make="MAKE=$make" ;;
20243         esac
20244         $rm -f testmake.mak
20245         ;;
20246 esac
20247 case "$make_set_make" in
20248 '#') echo "Yup, it does.";;
20249 *) echo "Nope, it doesn't.";;
20250 esac
20251
20252 : see what type is used for mode_t
20253 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20254 set mode_t modetype int stdio.h sys/types.h
20255 eval $typedef_ask
20256
20257 : see if we need va_copy
20258 echo " "
20259 case "$i_stdarg" in
20260 "$define")
20261         $cat >try.c <<EOCP
20262 #include <stdarg.h>
20263 #include <stdio.h>
20264 #$i_stdlib I_STDLIB
20265 #ifdef I_STDLIB
20266 #include <stdlib.h>
20267 #endif
20268 #include <signal.h>
20269
20270 int
20271 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20272 {
20273   return vfprintf(f, fmt, *valp);
20274 }
20275
20276 int
20277 myvfprintf(FILE *f, const  char *fmt, va_list val)
20278 {
20279   return ivfprintf(f, fmt, &val);
20280 }
20281
20282 int
20283 myprintf(char *fmt, ...)
20284 {
20285   va_list val;
20286   va_start(val, fmt);
20287   return myvfprintf(stdout, fmt, val);
20288 }
20289
20290 int
20291 main(int ac, char **av)
20292 {
20293   signal(SIGSEGV, exit);
20294
20295   myprintf("%s%cs all right, then\n", "that", '\'');
20296   exit(0);
20297 }
20298 EOCP
20299         set try
20300         if eval $compile && $run ./try 2>&1 >/dev/null; then
20301                 case "`$run ./try`" in
20302                 "that's all right, then")
20303                         okay=yes
20304                         ;;
20305                 esac
20306         fi
20307         case "$okay" in
20308         yes)    echo "It seems that you don't need va_copy()." >&4
20309                 need_va_copy="$undef"
20310                 ;;
20311         *)      echo "It seems that va_copy() or similar will be needed." >&4
20312                 need_va_copy="$define"
20313                 ;;
20314         esac
20315         $rm_try
20316         ;;
20317 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20318         ;;
20319 esac
20320
20321 : see what type is used for size_t
20322 rp="What is the type used for the length parameter for string functions?"
20323 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20324 eval $typedef_ask
20325
20326 : check for type of arguments to gethostbyaddr. 
20327 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20328         case "$d_gethbyaddr" in
20329         $define)
20330                 $cat <<EOM
20331
20332 Checking to see what type of arguments are accepted by gethostbyaddr().
20333 EOM
20334                 hdrs="$define sys/types.h
20335                         $d_socket sys/socket.h 
20336                         $i_niin netinet/in.h 
20337                         $i_netdb netdb.h
20338                         $i_unistd unistd.h"
20339                 : The first arg can 'char *' or 'void *'
20340                 : The second arg is some of integral type
20341                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20342                         for yyy in size_t long int; do
20343                                 case "$netdb_host_type" in
20344                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20345                                         if ./protochk "$try" $hdrs; then
20346                                                 echo "Your system accepts $xxx for the first arg."
20347                                                 echo "...and $yyy for the second arg."
20348                                                 netdb_host_type="$xxx"
20349                                                 netdb_hlen_type="$yyy"
20350                                         fi
20351                                         ;;
20352                                 esac
20353                         done
20354                 done
20355                 : In case none of those worked, prompt the user.
20356                 case "$netdb_host_type" in
20357                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20358                         dflt='char *'
20359                         . ./myread
20360                         netdb_host_type=$ans
20361                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20362                         dflt="$sizetype"
20363                         . ./myread
20364                         netdb_hlen_type=$ans
20365                         ;;
20366                 esac
20367                 ;;
20368         *)      : no gethostbyaddr, so pick harmless defaults
20369                 netdb_host_type='char *'
20370                 netdb_hlen_type="$sizetype"
20371                 ;;
20372         esac
20373         # Remove the "const" if needed. -- but then we'll have a 
20374         # prototype clash!
20375         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20376 fi
20377
20378 : check for type of argument to gethostbyname. 
20379 if test "X$netdb_name_type" = X ; then
20380         case "$d_gethbyname" in
20381         $define)
20382                 $cat <<EOM
20383
20384 Checking to see what type of argument is accepted by gethostbyname().
20385 EOM
20386                 hdrs="$define sys/types.h
20387                         $d_socket sys/socket.h 
20388                         $i_niin netinet/in.h 
20389                         $i_netdb netdb.h
20390                         $i_unistd unistd.h"
20391                 for xxx in "const char *" "char *"; do
20392                         case "$netdb_name_type" in
20393                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20394                                 if ./protochk "$try" $hdrs; then
20395                                         echo "Your system accepts $xxx."
20396                                         netdb_name_type="$xxx"
20397                                 fi
20398                                 ;;
20399                         esac
20400                 done
20401                 : In case none of those worked, prompt the user.
20402                 case "$netdb_name_type" in
20403                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20404                         dflt='char *'
20405                         . ./myread
20406                         netdb_name_type=$ans
20407                         ;;
20408                 esac
20409                 ;;
20410         *)      : no gethostbyname, so pick harmless default
20411                 netdb_name_type='char *'
20412                 ;;
20413         esac
20414 fi
20415
20416 : check for type of 1st argument to getnetbyaddr. 
20417 if test "X$netdb_net_type" = X ; then
20418         case "$d_getnbyaddr" in
20419         $define)
20420                 $cat <<EOM
20421
20422 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20423 EOM
20424                 hdrs="$define sys/types.h
20425                         $d_socket sys/socket.h 
20426                         $i_niin netinet/in.h 
20427                         $i_netdb netdb.h
20428                         $i_unistd unistd.h"
20429                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20430                         case "$netdb_net_type" in
20431                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20432                                 if ./protochk "$try" $hdrs; then
20433                                         echo "Your system accepts $xxx."
20434                                         netdb_net_type="$xxx"
20435                                 fi
20436                                 ;;
20437                         esac
20438                 done
20439                 : In case none of those worked, prompt the user.
20440                 case "$netdb_net_type" in
20441                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20442                         dflt='long'
20443                         . ./myread
20444                         netdb_net_type=$ans
20445                         ;;
20446                 esac
20447                 ;;
20448         *)      : no getnetbyaddr, so pick harmless default
20449                 netdb_net_type='long'
20450                 ;;
20451         esac
20452 fi
20453 : locate the preferred pager for this system
20454 fn=f/
20455 case "$pager" in
20456 '')
20457         dflt=''
20458         case "$pg" in
20459         /*) dflt=$pg;;
20460         [a-zA-Z]:/*) dflt=$pg;;
20461         esac
20462         case "$more" in
20463         /*) dflt=$more;;
20464         [a-zA-Z]:/*) dflt=$more;;
20465         esac
20466         case "$less" in
20467         /*) dflt=$less;;
20468         [a-zA-Z]:/*) dflt=$less;;
20469         esac
20470         case "$dflt" in
20471         '') dflt=/usr/ucb/more;;
20472         esac
20473         ;;
20474 *)      dflt="$pager"
20475         ;;
20476 esac
20477 fn="f/($dflt)"
20478 echo " "
20479 rp='What pager is used on your system?'
20480 . ./getfile
20481 pager="$ans"
20482
20483 : see what type pids are declared as in the kernel
20484 rp="What is the type of process ids on this system?"
20485 set pid_t pidtype int stdio.h sys/types.h
20486 eval $typedef_ask
20487
20488 : see if ar generates random libraries by itself
20489 echo " "
20490 echo "Checking how to generate random libraries on your machine..." >&4
20491 echo 'int bar1() { return bar2(); }' > bar1.c
20492 echo 'int bar2() { return 2; }' > bar2.c
20493 $cat > foo.c <<EOP
20494 #$i_stdlib I_STDLIB
20495 #ifdef I_STDLIB
20496 #include <stdlib.h>
20497 #endif
20498 int main() { printf("%d\n", bar1()); exit(0); }
20499 EOP
20500 $cc $ccflags -c bar1.c >/dev/null 2>&1
20501 $cc $ccflags -c bar2.c >/dev/null 2>&1
20502 $cc $ccflags -c foo.c >/dev/null 2>&1
20503 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20504 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20505         $run ./foobar >/dev/null 2>&1; then
20506         echo "$ar appears to generate random libraries itself."
20507         orderlib=false
20508         if [ "X$ranlib" = "X" ]; then
20509             ranlib=":"
20510         fi
20511 elif $ar s bar$_a >/dev/null 2>&1 &&
20512         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20513         $run ./foobar >/dev/null 2>&1; then
20514                 echo "a table of contents needs to be added with '$ar s'."
20515                 orderlib=false
20516                 ranlib="$ar s"
20517 elif $ar ts bar$_a >/dev/null 2>&1 &&
20518         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20519         $run ./foobar >/dev/null 2>&1; then
20520                 echo "a table of contents needs to be added with '$ar ts'."
20521                 orderlib=false
20522                 ranlib="$ar ts"
20523 else
20524         case "$ranlib" in
20525         :) ranlib='';;
20526         '')
20527                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20528                 $test -f $ranlib || ranlib=''
20529                 ;;
20530         esac
20531         if $test -n "$ranlib"; then
20532                 echo "your system has '$ranlib'; we'll use that."
20533                 orderlib=false
20534         else
20535                 echo "your system doesn't seem to support random libraries"
20536                 echo "so we'll use lorder and tsort to order the libraries."
20537                 orderlib=true
20538                 ranlib=":"
20539         fi
20540 fi
20541 $rm -f foo* bar*
20542
20543 : see if this is a values.h system
20544 set values.h i_values
20545 eval $inhdr
20546
20547 : Check the max offset that gmtime and localtime accept
20548 echo "Checking max offsets that gmtime () accepts"
20549
20550 case $i_values in
20551     define) yyy="#include <values.h>" ;;
20552     *)      yyy="" ;;
20553     esac
20554
20555 case "$sGMTIME_min/$sGMTIME_max" in
20556     0/0|/)
20557         $cat >try.c <<EOCP
20558 #include <sys/types.h>
20559 #include <stdio.h>
20560 #include <time.h>
20561 $yyy
20562
20563 int i;
20564 struct tm *tmp;
20565 time_t pt;
20566
20567 void gm_check (time_t t, int min_year, int max_year)
20568 {
20569     tmp = gmtime (&t);
20570     if ( tmp == NULL ||
20571         /* Check tm_year overflow */
20572          tmp->tm_year < min_year || tmp->tm_year > max_year)
20573         tmp = NULL;
20574     else
20575         pt = t;
20576     } /* gm_check */
20577
20578 int check_max ()
20579 {
20580     tmp = NULL;
20581     pt  = 0;
20582 #ifdef MAXLONG
20583     gm_check (MAXLONG, 69, 0x7fffffff);
20584 #endif
20585     if (tmp == NULL || tmp->tm_year < 0) {
20586         for (i = 63; i >= 0; i--) {
20587             time_t x = pt | ((time_t)1 << i);
20588             if (x < 0 || x < pt) continue;
20589             gm_check (x, 69, 0x7fffffff);
20590             }
20591         }
20592     printf ("sGMTIME_max=%ld\n", pt);
20593     return (0);
20594     } /* check_max */
20595
20596 int check_min ()
20597 {
20598     tmp = NULL;
20599     pt  = 0;
20600 #ifdef MINLONG
20601     gm_check (MINLONG, -1900, 70);
20602 #endif
20603     if (tmp == NULL) {
20604         for (i = 36; i >= 0; i--) {
20605             time_t x = pt - ((time_t)1 << i);
20606             if (x > 0) continue;
20607             gm_check (x, -1900, 70);
20608             }
20609         }
20610     printf ("sGMTIME_min=%ld\n", pt);
20611     return (0);
20612     } /* check_min */
20613
20614 int main (int argc, char *argv[])
20615 {
20616     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20617     check_max ();
20618     check_min ();
20619     return (0);
20620     } /* main */
20621 EOCP
20622         set try
20623         if eval $compile; then
20624             eval `$run ./try`
20625         else
20626             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20627             fi
20628         $rm_try
20629         ;;
20630     esac
20631
20632 echo "Checking max offsets that localtime () accepts"
20633
20634 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20635     0/0|/)
20636         $cat >try.c <<EOCP
20637 #include <sys/types.h>
20638 #include <stdio.h>
20639 #include <time.h>
20640 $yyy
20641
20642 int i;
20643 struct tm *tmp;
20644 time_t pt;
20645
20646 void local_check (time_t t, int min_year, int max_year)
20647 {
20648     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20649         tmp = NULL;
20650     else
20651         tmp = localtime (&t);
20652     if ( tmp == NULL ||
20653         /* Check tm_year overflow */
20654          tmp->tm_year < min_year || tmp->tm_year > max_year)
20655         tmp = NULL;
20656     else
20657         pt = t;
20658     } /* local_check */
20659
20660 int check_max ()
20661 {
20662     tmp = NULL;
20663     pt  = 0;
20664 #ifdef MAXLONG
20665     local_check (MAXLONG, 69, 0x7fffffff);
20666 #endif
20667     if (tmp == NULL || tmp->tm_year < 0) {
20668         for (i = 63; i >= 0; i--) {
20669             time_t x = pt | ((time_t)1 << i);
20670             if (x < 0 || x < pt) continue;
20671             local_check (x, 69, 0x7fffffff);
20672             }
20673         }
20674     printf ("sLOCALTIME_max=%ld\n", pt);
20675     return (0);
20676    } /* check_max */
20677
20678 int check_min ()
20679 {
20680     tmp = NULL;
20681     pt  = 0;
20682 #ifdef MINLONG
20683     local_check (MINLONG, -1900, 70);
20684 #endif
20685     if (tmp == NULL) {
20686         for (i = 36; i >= 0; i--) {
20687             time_t x = pt - ((time_t)1 << i);
20688             if (x > 0) continue;
20689             local_check (x, -1900, 70);
20690             }
20691         }
20692     printf ("sLOCALTIME_min=%ld\n", pt);
20693     return (0);
20694     } /* check_min */
20695
20696 int main (int argc, char *argv[])
20697 {
20698     check_max ();
20699     check_min ();
20700     return (0);
20701     } /* main */
20702 EOCP
20703         set try
20704         if eval $compile; then
20705             eval `$run ./try`
20706         else
20707             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20708             fi
20709         $rm_try
20710         ;;
20711     esac
20712
20713 : check for type of arguments to select.
20714 case "$selecttype" in
20715 '') case "$d_select" in
20716         $define)
20717                 echo " "
20718                 $cat <<EOM
20719 Checking to see what type of arguments are accepted by select().
20720 EOM
20721                 hdrs="$define sys/types.h
20722                         $i_systime sys/time.h
20723                         $i_sysselct sys/select.h
20724                         $d_socket sys/socket.h"
20725                 : The first arg can be int, unsigned, or size_t
20726                 : The last arg may or may not be 'const'
20727                 val=''
20728                 : void pointer has been seen but using that
20729                 : breaks the selectminbits test
20730                 for xxx in 'fd_set *' 'int *'; do
20731                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20732                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20733                                         case "$val" in
20734                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20735                                                 if ./protochk "$try" $hdrs; then
20736                                                         echo "Your system accepts $xxx."
20737                                                         val="$xxx"
20738                                                 fi
20739                                                 ;;
20740                                         esac
20741                                 done
20742                         done
20743                 done
20744                 case "$val" in
20745                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20746                         case "$d_fd_set" in
20747                                 $define) dflt="fd_set *" ;;
20748                                 *)              dflt="int *" ;;
20749                         esac
20750                         . ./myread
20751                         val=$ans
20752                         ;;
20753                 esac
20754                 selecttype="$val"
20755                 ;;
20756         *)      : no select, so pick a harmless default
20757                 selecttype='int *'
20758                 ;;
20759         esac
20760         ;;
20761 esac
20762
20763 : check for the select 'width'
20764 case "$selectminbits" in
20765 '') safebits=`expr $ptrsize \* 8`
20766     case "$d_select" in
20767         $define)
20768                 $cat <<EOM
20769
20770 Checking to see on how many bits at a time your select() operates...
20771 EOM
20772                 $cat >try.c <<EOCP
20773 #include <sys/types.h>
20774 #$i_time I_TIME
20775 #$i_systime I_SYS_TIME
20776 #$i_systimek I_SYS_TIME_KERNEL
20777 #ifdef I_TIME
20778 #   include <time.h>
20779 #endif
20780 #ifdef I_SYS_TIME
20781 #   ifdef I_SYS_TIME_KERNEL
20782 #       define KERNEL
20783 #   endif
20784 #   include <sys/time.h>
20785 #   ifdef I_SYS_TIME_KERNEL
20786 #       undef KERNEL
20787 #   endif
20788 #endif
20789 #$i_sysselct I_SYS_SELECT
20790 #ifdef I_SYS_SELECT
20791 #include <sys/select.h>
20792 #endif
20793 #$d_socket HAS_SOCKET
20794 #ifdef HAS_SOCKET
20795 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20796 #endif
20797 #include <stdio.h>
20798 #$i_stdlib I_STDLIB
20799 #ifdef I_STDLIB
20800 #include <stdlib.h>
20801 #endif
20802 $selecttype b;
20803 #define S sizeof(*(b))
20804 #define MINBITS 64
20805 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20806 #define NBITS  (NBYTES * 8)
20807 int main() {
20808     char *s = (char *)malloc(NBYTES);
20809     struct timeval t;
20810     int i;
20811     FILE* fp;
20812     int fd;
20813
20814     if (!s)
20815         exit(1);
20816     fclose(stdin);
20817     fp = fopen("try.c", "r");
20818     if (fp == 0)
20819       exit(2);
20820     fd = fileno(fp);
20821     if (fd < 0)
20822       exit(3);
20823     b = ($selecttype)s;
20824     for (i = 0; i < NBITS; i++)
20825         FD_SET(i, b);
20826     t.tv_sec  = 0;
20827     t.tv_usec = 0;
20828     select(fd + 1, b, 0, 0, &t);
20829     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20830     free(s);
20831     printf("%d\n", i + 1);
20832     return 0;
20833 }
20834 EOCP
20835                 set try
20836                 if eval $compile_ok; then
20837                         selectminbits=`$run ./try`
20838                         case "$selectminbits" in
20839                         '')     cat >&4 <<EOM
20840 Cannot figure out on how many bits at a time your select() operates.
20841 I'll play safe and guess it is $safebits bits.
20842 EOM
20843                                 selectminbits=$safebits
20844                                 bits="$safebits bits"
20845                                 ;;
20846                         1)      bits="1 bit" ;;
20847                         *)      bits="$selectminbits bits" ;;
20848                         esac
20849                         echo "Your select() operates on $bits at a time." >&4
20850                 else
20851                         rp='What is the minimum number of bits your select() operates on?'
20852                         case "$byteorder" in
20853                         12345678)       dflt=64 ;;
20854                         1234)           dflt=32 ;;
20855                         *)              dflt=1  ;;
20856                         esac
20857                         . ./myread
20858                         val=$ans
20859                         selectminbits="$val"
20860                 fi
20861                 $rm_try
20862                 ;;
20863         *)      : no select, so pick a harmless default
20864                 selectminbits=$safebits
20865                 ;;
20866         esac
20867         ;;
20868 esac
20869
20870 : Trace out the files included by signal.h, then look for SIGxxx names.
20871 if [ "X$fieldn" = X ]; then
20872         : Just make some guesses.  We check them later.
20873         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20874 else
20875         xxx=`echo '#include <signal.h>' |
20876         $cppstdin $cppminus $cppflags 2>/dev/null |
20877         $grep '^[       ]*#.*include' |
20878         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20879                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20880 fi
20881 xxxfiles=''
20882 for xx in $xxx /dev/null ; do
20883         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20884 done
20885 case "$xxxfiles" in
20886 '')     xxxfiles=`./findhdr signal.h` ;;
20887 esac
20888 xxx=`awk '
20889 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20890         print substr($2, 4, 20)
20891 }
20892 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20893         print substr($3, 4, 20)
20894 }' $xxxfiles`
20895 : Append some common names just in case the awk scan failed.
20896 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20897 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20898 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20899 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20900 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20901
20902 : generate a few handy files for later
20903 $cat > signal.c <<EOCP
20904 #include <sys/types.h>
20905 #include <signal.h>
20906 #$i_stdlib I_STDLIB
20907 #ifdef I_STDLIB
20908 #include <stdlib.h>
20909 #endif
20910 #include <stdio.h>
20911 int main() {
20912
20913 /* Strange style to avoid deeply-nested #if/#else/#endif */
20914 #ifndef NSIG
20915 #  ifdef _NSIG
20916 #    define NSIG (_NSIG)
20917 #  endif
20918 #endif
20919
20920 #ifndef NSIG
20921 #  ifdef SIGMAX
20922 #    define NSIG (SIGMAX+1)
20923 #  endif
20924 #endif
20925
20926 #ifndef NSIG
20927 #  ifdef SIG_MAX
20928 #    define NSIG (SIG_MAX+1)
20929 #  endif
20930 #endif
20931
20932 #ifndef NSIG
20933 #  ifdef _SIG_MAX
20934 #    define NSIG (_SIG_MAX+1)
20935 #  endif
20936 #endif
20937
20938 #ifndef NSIG
20939 #  ifdef MAXSIG
20940 #    define NSIG (MAXSIG+1)
20941 #  endif
20942 #endif
20943
20944 #ifndef NSIG
20945 #  ifdef MAX_SIG
20946 #    define NSIG (MAX_SIG+1)
20947 #  endif
20948 #endif
20949
20950 #ifndef NSIG
20951 #  ifdef SIGARRAYSIZE
20952 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20953 #  endif
20954 #endif
20955
20956 #ifndef NSIG
20957 #  ifdef _sys_nsig
20958 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20959 #  endif
20960 #endif
20961
20962 /* Default to some arbitrary number that's big enough to get most
20963    of the common signals.
20964 */
20965 #ifndef NSIG
20966 #    define NSIG 50
20967 #endif
20968
20969 printf("NSIG %d\n", NSIG);
20970
20971 #ifndef JUST_NSIG
20972
20973 EOCP
20974
20975 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20976 {
20977         printf "#ifdef SIG"; printf $1; printf "\n"
20978         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20979         printf $1; printf ");\n"
20980         printf "#endif\n"
20981 }
20982 END {
20983         printf "#endif /* JUST_NSIG */\n";
20984         printf "exit(0);\n}\n";
20985 }
20986 ' >>signal.c
20987 $cat >signal.awk <<'EOP'
20988 BEGIN { ndups = 0 }
20989 $1 ~ /^NSIG$/ { nsig = $2 }
20990 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20991     if ($2 > maxsig) { maxsig = $2 }
20992     if (sig_name[$2]) {
20993         dup_name[ndups] = $1
20994         dup_num[ndups] = $2
20995         ndups++
20996     }
20997     else {
20998         sig_name[$2] = $1
20999         sig_num[$2] = $2
21000     }
21001 }
21002 END {
21003     if (nsig == 0) {
21004         nsig = maxsig + 1
21005     }
21006     printf("NSIG %d\n", nsig);
21007     for (n = 1; n < nsig; n++) {
21008         if (sig_name[n]) {
21009             printf("%s %d\n", sig_name[n], sig_num[n])
21010         }
21011         else {
21012             printf("NUM%d %d\n", n, n)
21013         }
21014     }
21015     for (n = 0; n < ndups; n++) {
21016         printf("%s %d\n", dup_name[n], dup_num[n])
21017     }
21018 }
21019 EOP
21020 $cat >signal_cmd <<EOS
21021 $startsh
21022 if $test -s signal.lst; then
21023     echo "Using your existing signal.lst file"
21024         exit 0
21025 fi
21026 xxx="$xxx"
21027 EOS
21028 $cat >>signal_cmd <<'EOS'
21029
21030 set signal
21031 if eval $compile_ok; then
21032         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21033                 $uniq | $awk -f signal.awk >signal.lst
21034 else
21035         echo "(I can't seem be able to compile the whole test program)" >&4
21036         echo "(I'll try it in little pieces.)" >&4
21037         set signal -DJUST_NSIG
21038         if eval $compile_ok; then
21039                 $run ./signal$_exe > signal.nsg
21040                 $cat signal.nsg
21041         else
21042                 echo "I can't seem to figure out how many signals you have." >&4
21043                 echo "Guessing 50." >&4
21044                 echo 'NSIG 50' > signal.nsg
21045         fi
21046         : Now look at all the signal names, one at a time.
21047         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21048                 $cat > signal.c <<EOCP
21049 #include <sys/types.h>
21050 #include <signal.h>
21051 #include <stdio.h>
21052 int main() {
21053 printf("$xx %d\n", SIG${xx});
21054 return 0;
21055 }
21056 EOCP
21057                 set signal
21058                 if eval $compile; then
21059                         echo "SIG${xx} found."
21060                         $run ./signal$_exe  >> signal.ls1
21061                 else
21062                         echo "SIG${xx} NOT found."
21063                 fi
21064         done
21065         if $test -s signal.ls1; then
21066                 $cat signal.nsg signal.ls1 |
21067                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21068         fi
21069
21070 fi
21071 if $test -s signal.lst; then
21072         :
21073 else
21074         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21075         echo 'kill -l' >signal
21076         set X `csh -f <signal`
21077         $rm -f signal
21078         shift
21079         case $# in
21080         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21081         esac
21082         echo $@ | $tr ' ' $trnl | \
21083             $awk '{ printf "%s %d\n", $1, ++s; }
21084                   END { printf "NSIG %d\n", ++s }' >signal.lst
21085 fi
21086 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21087 EOS
21088 chmod a+x signal_cmd
21089 $eunicefix signal_cmd
21090
21091 : generate list of signal names
21092 echo " "
21093 case "$sig_name_init" in
21094 '') doinit=yes ;;
21095 *)  case "$sig_num_init" in
21096     ''|*,*) doinit=yes ;;
21097     esac ;;
21098 esac
21099 case "$doinit" in
21100 yes)
21101         echo "Generating a list of signal names and numbers..." >&4
21102         . ./signal_cmd
21103         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21104         sig_name=`$awk 'BEGIN { printf "ZERO " }
21105                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21106         sig_num=`$awk  'BEGIN { printf "0 " }
21107                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21108         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21109                              !/^NSIG/   { printf "\"%s\", ", $1 }
21110                              END        { printf "0\n" }' signal.lst`
21111         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21112                              !/^NSIG/   { printf "%d, ", $2}
21113                              END        { printf "0\n"}' signal.lst`
21114         ;;
21115 esac
21116 echo "The following $sig_count signals are available:"
21117 echo " "
21118 echo $sig_name | $awk \
21119 'BEGIN { linelen = 0 }
21120 {
21121         for (i = 1; i <= NF; i++) {
21122                 name = "SIG" $i " "
21123                 linelen = linelen + length(name)
21124                 if (linelen > 70) {
21125                         printf "\n"
21126                         linelen = length(name)
21127                 }
21128                 printf "%s", name
21129         }
21130         printf "\n"
21131 }'
21132 sig_size=`echo $sig_name | awk '{print NF}'`
21133 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21134
21135 : Check size of size
21136 echo " "
21137 case "$sizetype" in
21138 *_t) zzz="$sizetype"    ;;
21139 *)   zzz="filesize"     ;;
21140 esac
21141 echo "Checking the size of $zzz..." >&4
21142 cat > try.c <<EOCP
21143 #include <sys/types.h>
21144 #include <stdio.h>
21145 #$i_stdlib I_STDLIB
21146 #ifdef I_STDLIB
21147 #include <stdlib.h>
21148 #endif
21149 int main() {
21150     printf("%d\n", (int)sizeof($sizetype));
21151     exit(0);
21152 }
21153 EOCP
21154 set try
21155 if eval $compile_ok; then
21156         yyy=`$run ./try`
21157         case "$yyy" in
21158         '')     sizesize=4
21159                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21160                 ;;
21161         *)      sizesize=$yyy
21162                 echo "Your $zzz size is $sizesize bytes."
21163                 ;;
21164         esac
21165 else
21166         sizesize=4
21167         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21168 fi
21169
21170
21171 : check for socklen_t
21172 echo " "
21173 echo "Checking to see if you have socklen_t..." >&4
21174 $cat >try.c <<EOCP
21175 #include <sys/types.h>
21176 #$d_socket HAS_SOCKET
21177 #ifdef HAS_SOCKET
21178 #include <sys/socket.h>
21179 #endif
21180 int main() { socklen_t x = 16; }
21181 EOCP
21182 set try
21183 if eval $compile; then
21184         val="$define"
21185         echo "You have socklen_t."
21186 else
21187         val="$undef"
21188         echo "You do not have socklen_t."
21189         case "$sizetype" in
21190         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21191         esac
21192 fi
21193 $rm_try
21194 set d_socklen_t
21195 eval $setvar
21196
21197 : see if this is a socks.h system
21198 set socks.h i_socks
21199 eval $inhdr
21200
21201 : check for type of the size argument to socket calls
21202 case "$d_socket" in
21203 "$define")
21204         $cat <<EOM
21205
21206 Checking to see what type is the last argument of accept().
21207 EOM
21208         yyy=''
21209         case "$d_socklen_t" in
21210         "$define") yyy="$yyy socklen_t"
21211         esac
21212         yyy="$yyy $sizetype int long unsigned"
21213         for xxx in $yyy; do
21214                 case "$socksizetype" in
21215                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21216                         case "$usesocks" in
21217                         "$define")
21218                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21219                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21220                                         socksizetype="$xxx"
21221                                 fi
21222                                 ;;
21223                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21224                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21225                                         socksizetype="$xxx"
21226                                 fi
21227                                 ;;
21228                         esac
21229                         ;;
21230                 esac
21231         done
21232 : In case none of those worked, prompt the user.
21233         case "$socksizetype" in
21234         '')     rp='What is the type for socket address structure sizes?'
21235                 dflt='int'
21236                 . ./myread
21237                 socksizetype=$ans
21238                 ;;
21239         esac
21240         ;;
21241 *)      : no sockets, so pick relatively harmless default
21242         socksizetype='int'
21243         ;;
21244 esac
21245
21246 : see what type is used for signed size_t
21247 set ssize_t ssizetype int stdio.h sys/types.h
21248 eval $typedef
21249 dflt="$ssizetype"
21250 $cat > try.c <<EOM
21251 #include <stdio.h>
21252 #$i_stdlib I_STDLIB
21253 #ifdef I_STDLIB
21254 #include <stdlib.h>
21255 #endif
21256 #include <sys/types.h>
21257 #define Size_t $sizetype
21258 #define SSize_t $dflt
21259 int main()
21260 {
21261         if (sizeof(Size_t) == sizeof(SSize_t))
21262                 printf("$dflt\n");
21263         else if (sizeof(Size_t) == sizeof(int))
21264                 printf("int\n");
21265         else
21266                 printf("long\n");
21267         exit(0);
21268 }
21269 EOM
21270 echo " "
21271 set try
21272 if eval $compile_ok && $run ./try > /dev/null; then
21273         ssizetype=`$run ./try`
21274         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21275 else
21276         $cat >&4 <<EOM
21277 Help! I can't compile and run the ssize_t test program: please enlighten me!
21278 (This is probably a misconfiguration in your system or libraries, and
21279 you really ought to fix it.  Still, I'll try anyway.)
21280
21281 I need a type that is the same size as $sizetype, but is guaranteed to
21282 be signed.  Common values are ssize_t, int and long.
21283
21284 EOM
21285         rp="What signed type is the same size as $sizetype?"
21286         . ./myread
21287         ssizetype="$ans"
21288 fi
21289 $rm_try
21290
21291 : Check the size of st_ino
21292 $echo " "
21293 $echo "Checking the size of st_ino..." >&4
21294 $cat > try.c <<EOCP
21295 #include <sys/stat.h>
21296 #include <stdio.h>
21297 #$i_stdlib I_STDLIB
21298 #ifdef I_STDLIB
21299 #include <stdlib.h>
21300 #endif
21301 int main() {
21302     struct stat st;
21303     printf("%d\n", (int)sizeof(st.st_ino));
21304     exit(0);
21305 }
21306 EOCP
21307 set try
21308 if eval $compile_ok; then
21309         val=`$run ./try`
21310         case "$val" in
21311         '')     st_ino_size=4
21312                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21313                 ;;
21314         *)      st_ino_size=$val
21315                 $echo "Your st_ino is $st_ino_size bytes long."
21316                 ;;
21317         esac
21318 else
21319         st_ino_size=4
21320         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21321 fi
21322 $rm_try
21323
21324 : Check if st_ino is signed
21325 $echo " "
21326 $echo "Checking the sign of st_ino..." >&4
21327 $cat > try.c <<EOCP
21328 #include <sys/stat.h>
21329 #include <stdio.h>
21330 int main() {
21331         struct stat foo;
21332         foo.st_ino = -1;
21333         if (foo.st_ino < 0)
21334                 printf("-1\n");
21335         else
21336                 printf("1\n");
21337 }
21338 EOCP
21339 set try
21340 if eval $compile; then
21341         val=`$run ./try`
21342         case "$val" in
21343         '')     st_ino_sign=1
21344                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21345                 ;;
21346         *)      st_ino_sign=$val
21347                 case "$st_ino_sign" in
21348                  1) $echo "Your st_ino is unsigned." ;;
21349                 -1) $echo "Your st_ino is signed."   ;;
21350                 esac
21351                 ;;
21352         esac
21353 else
21354         st_ino_sign=1
21355         $echo "(I can't compile the test program--guessing unsigned.)" >&4
21356 fi
21357 $rm_try
21358
21359 : see what type of char stdio uses.
21360 echo " "
21361 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21362 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21363         echo "Your stdio uses unsigned chars." >&4
21364         stdchar="unsigned char"
21365 else
21366         echo "Your stdio uses signed chars." >&4
21367         stdchar="char"
21368 fi
21369 $rm -f stdioh
21370
21371 : see what type uids are declared as in the kernel
21372 echo " "
21373 echo "Looking for the type for user ids returned by getuid()."
21374 set uid_t uidtype xxx stdio.h sys/types.h
21375 eval $typedef
21376 case "$uidtype" in
21377 xxx)
21378         xxx=`./findhdr sys/user.h`
21379         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21380         case $1 in
21381         unsigned) dflt="$1 $2" ;;
21382         *) dflt="$1" ;;
21383         esac
21384         ;;
21385 *) dflt="$uidtype";;
21386 esac
21387 case "$uidtype" in
21388 uid_t)  echo "uid_t found." ;;
21389 *)      rp="What is the type for user ids returned by getuid()?"
21390         . ./myread
21391         uidtype="$ans"
21392         ;;
21393 esac
21394
21395 : Check size of UID
21396 echo " "
21397 case "$uidtype" in
21398 *_t) zzz="$uidtype"     ;;
21399 *)   zzz="uid"          ;;
21400 esac
21401 echo "Checking the size of $zzz..." >&4
21402 cat > try.c <<EOCP
21403 #include <sys/types.h>
21404 #include <stdio.h>
21405 #$i_stdlib I_STDLIB
21406 #ifdef I_STDLIB
21407 #include <stdlib.h>
21408 #endif
21409 int main() {
21410     printf("%d\n", (int)sizeof($uidtype));
21411     exit(0);
21412 }
21413 EOCP
21414 set try
21415 if eval $compile_ok; then
21416         yyy=`$run ./try`
21417         case "$yyy" in
21418         '')     uidsize=4
21419                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21420                 ;;
21421         *)      uidsize=$yyy
21422                 echo "Your $zzz is $uidsize bytes long."
21423                 ;;
21424         esac
21425 else
21426         uidsize=4
21427         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21428 fi
21429
21430 : Check if UID is signed
21431 echo " "
21432 case "$uidtype" in
21433 *_t) zzz="$uidtype"     ;;
21434 *)   zzz="uid"          ;;
21435 esac
21436 echo "Checking the sign of $zzz..." >&4
21437 cat > try.c <<EOCP
21438 #include <sys/types.h>
21439 #include <stdio.h>
21440 int main() {
21441         $uidtype foo = -1;
21442         if (foo < 0)
21443                 printf("-1\n");
21444         else
21445                 printf("1\n");
21446 }
21447 EOCP
21448 set try
21449 if eval $compile; then
21450         yyy=`$run ./try`
21451         case "$yyy" in
21452         '')     uidsign=1
21453                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21454                 ;;
21455         *)      uidsign=$yyy
21456                 case "$uidsign" in
21457                  1) echo "Your $zzz is unsigned." ;;
21458                 -1) echo "Your $zzz is signed."   ;;
21459                 esac
21460                 ;;
21461         esac
21462 else
21463         uidsign=1
21464         echo "(I can't compile the test program--guessing unsigned.)" >&4
21465 fi
21466
21467
21468 : Check format string for UID
21469 echo " "
21470 $echo "Checking the format string to be used for uids..." >&4
21471
21472 case "$uidsign" in
21473 -1)     if $test X"$uidsize" = X"$ivsize"; then
21474                 uidformat="$ivdformat"
21475         else
21476                 if $test X"$uidsize" = X"$longsize"; then
21477                         uidformat='"ld"'
21478                 else
21479                         if $test X"$uidsize" = X"$intsize"; then
21480                                 uidformat='"d"'
21481                         else
21482                                 if $test X"$uidsize" = X"$shortsize"; then
21483                                         uidformat='"hd"'
21484                                 fi
21485                         fi
21486                 fi
21487         fi
21488         ;;
21489 *)      if $test X"$uidsize" = X"$uvsize"; then
21490                 uidformat="$uvuformat"
21491         else
21492                 if $test X"$uidsize" = X"$longsize"; then
21493                         uidformat='"lu"'
21494                 else
21495                         if $test X"$uidsize" = X"$intsize"; then
21496                                 uidformat='"u"'
21497                         else
21498                                 if $test X"$uidsize" = X"$shortsize"; then
21499                                         uidformat='"hu"'
21500                                 fi
21501                         fi
21502                 fi
21503         fi
21504         ;;
21505 esac
21506
21507 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21508 echo " "
21509 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21510 $cat >try.c <<'EOM'
21511 /* Intentionally a long probe as I'd like to sanity check that the exact
21512    approach is going to work, as thinking it will work, but only having it
21513    part working at runtime is worse than not having it.  */
21514
21515 #include <sys/types.h>
21516 #include <sys/sysctl.h>
21517 #include <sys/param.h>
21518 #include <stdio.h>
21519 #include <string.h>
21520 #include <stdlib.h>
21521 #include <unistd.h>
21522
21523 int
21524 main(int argc, char **argv) {
21525     char *buffer;
21526     char *argv_leaf = strrchr(argv[0], '/');
21527     char *buffer_leaf;
21528     size_t size = 0;
21529     int mib[4];
21530
21531     mib[0] = CTL_KERN;
21532     mib[1] = KERN_PROC;
21533     mib[2] = KERN_PROC_PATHNAME;
21534     mib[3] = -1;
21535
21536     if (!argv_leaf) {
21537         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21538         return 1;
21539     }
21540
21541     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21542         perror("sysctl");
21543         return 2;
21544     }
21545
21546     if (size < strlen(argv_leaf) + 1) {
21547         fprintf(stderr, "size %lu is too short for a path\n",
21548                 (unsigned long) size);
21549         return 3;
21550     }
21551
21552     if (size > MAXPATHLEN * MAXPATHLEN) {
21553         fprintf(stderr, "size %lu is too long for a path\n",
21554                 (unsigned long) size);
21555         return 4;
21556     }
21557
21558     buffer = malloc(size);
21559     if (!buffer) {
21560         perror("malloc");
21561         return 5;
21562     }
21563
21564     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21565         perror("sysctl");
21566         return 6;
21567     }
21568
21569     if (strlen(buffer) + 1 != size) {
21570         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21571                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21572         return 7;
21573     }
21574
21575
21576     if (*buffer != '/') {
21577         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21578         return 8;
21579     }
21580
21581     if (strstr(buffer, "/./")) {
21582         fprintf(stderr, "Contains /./: '%s'\n", buffer);
21583         return 9;
21584     }
21585
21586     if (strstr(buffer, "/../")) {
21587         fprintf(stderr, "Contains /../: '%s'\n", buffer);
21588         return 10;
21589     }
21590
21591     buffer_leaf = strrchr(buffer, '/');
21592     if (strcmp(buffer_leaf, argv_leaf) != 0) {
21593         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21594         return 11;
21595     }
21596
21597     free(buffer);
21598
21599     return 0;
21600 }
21601 EOM
21602
21603 val=$undef
21604 set try
21605 if eval $compile; then
21606         if $run ./try; then
21607                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21608                 val="$define"
21609         else
21610                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21611                 val="$undef"
21612         fi
21613 else
21614         echo "I'm unable to compile the test program." >&4
21615         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21616         val="$undef"
21617 fi
21618 $rm_try
21619 set usekernprocpathname
21620 eval $setvar
21621
21622 : Determine if we can use _NSGetExecutablePath to find executing program
21623 echo " "
21624 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21625 $cat >try.c <<'EOM'
21626 /* Intentionally a long probe as I'd like to sanity check that the exact
21627    approach is going to work, as thinking it will work, but only having it
21628    part working at runtime is worse than not having it.  */
21629 #include <mach-o/dyld.h>
21630 #include <stdio.h>
21631 #include <stdlib.h>
21632 #include <sys/param.h>
21633 #include <string.h>
21634
21635 int
21636 main(int argc, char **argv) {
21637     char buf[1];
21638     uint32_t size = sizeof(buf);
21639     int result;
21640     char *buffer;
21641     char *tidied;
21642     char *argv_leaf = strrchr(argv[0], '/');
21643     char *tidied_leaf;
21644
21645     if (!argv_leaf) {
21646         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21647         return 1;
21648     }
21649
21650     _NSGetExecutablePath(buf, &size);
21651     if (size > MAXPATHLEN * MAXPATHLEN) {
21652         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21653                 (unsigned int) size);
21654         return 2;
21655     }
21656
21657     buffer = malloc(size);
21658     if (!buffer) {
21659         perror("malloc");
21660         return 3;
21661     }
21662
21663     result = _NSGetExecutablePath(buffer, &size);
21664     if (result != 0) {
21665         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21666                 result, (unsigned int) size);
21667         return 4;
21668     }
21669
21670     tidied = realpath(buffer, NULL);
21671     if (!tidied) {
21672         perror("realpath");
21673         return 5;
21674     }
21675
21676     free(buffer);
21677
21678     if (*tidied != '/') {
21679         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21680         return 6;
21681     }
21682
21683     if (strstr(tidied, "/./")) {
21684         fprintf(stderr, "Contains /./: '%s'\n", tidied);
21685         return 7;
21686     }
21687
21688     if (strstr(tidied, "/../")) {
21689         fprintf(stderr, "Contains /../: '%s'\n", tidied);
21690         return 8;
21691     }
21692
21693     tidied_leaf = strrchr(tidied, '/');
21694     if (strcmp(tidied_leaf, argv_leaf) != 0) {
21695         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21696         return 9;
21697     }
21698
21699     free(tidied);
21700
21701     return 0;
21702 }
21703 EOM
21704
21705 val=$undef
21706 set try
21707 if eval $compile; then
21708         if $run ./try; then
21709                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21710                 val="$define"
21711         else
21712                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21713         fi
21714 else
21715         echo "I'm unable to compile the test program." >&4
21716         echo "I'll assume no _NSGetExecutablePath here." >&4
21717 fi
21718 $rm_try
21719 set usensgetexecutablepath
21720 eval $setvar
21721
21722 : Check if site customization support was requested
21723 case "$usesitecustomize" in
21724     $define|true|[Yy]*)
21725         usesitecustomize="$define"
21726         ;;
21727     *)
21728         usesitecustomize="$undef"
21729         ;;
21730     esac
21731
21732 : see if prototypes support variable argument declarations
21733 echo " "
21734 case "$prototype$i_stdarg" in
21735 $define$define)
21736         echo "It appears we'll be able to prototype varargs functions." >&4
21737         val="$define"
21738         ;;
21739 *)
21740         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21741         val="$undef"
21742         ;;
21743 esac
21744 set vaproto
21745 eval $setvar
21746
21747 : determine compiler compiler
21748 case "$yacc" in
21749 '')
21750         dflt=yacc;;
21751 *)
21752         dflt="$yacc";;
21753 esac
21754 echo " "
21755 comp='yacc'
21756 if $test -f "$byacc$_exe"; then
21757         dflt="$byacc"
21758         comp="byacc or $comp"
21759 fi
21760 if $test -f "$bison$_exe"; then
21761         comp="$comp or bison -y"
21762 fi
21763 rp="Which compiler compiler ($comp) shall I use?"
21764 . ./myread
21765 yacc="$ans"
21766 case "$yacc" in
21767 *bis*)
21768         case "$yacc" in
21769         *-y*) ;;
21770         *)
21771                 yacc="$yacc -y"
21772                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21773                 ;;
21774         esac
21775         ;;
21776 esac
21777
21778 : see if this is a assert.h system
21779 set assert.h i_assert
21780 eval $inhdr
21781
21782 : see if this is a fp.h system
21783 set fp.h i_fp
21784 eval $inhdr
21785
21786 : see if this is a fp_class.h system
21787 set fp_class.h i_fp_class
21788 eval $inhdr
21789
21790 : see if gdbm.h is available
21791 set gdbm.h t_gdbm
21792 eval $inhdr
21793 case "$t_gdbm" in
21794 $define)
21795         : see if gdbm_open exists
21796         set gdbm_open d_gdbm_open
21797         eval $inlibc
21798         case "$d_gdbm_open" in
21799         $undef)
21800                 t_gdbm="$undef"
21801                 echo "We won't be including <gdbm.h>"
21802                 ;;
21803         esac
21804         ;;
21805 esac
21806 val="$t_gdbm"
21807 set i_gdbm
21808 eval $setvar
21809
21810 : see if this is a ieeefp.h system
21811 case "$i_ieeefp" in
21812 '' ) set ieeefp.h i_ieeefp
21813      eval $inhdr
21814      ;;
21815 esac
21816
21817 : see if this is a libutil.h system
21818 set libutil.h i_libutil
21819 eval $inhdr
21820
21821 : see if mach cthreads are available
21822 if test "X$usethreads" = "X$define"; then
21823         set mach/cthreads.h i_machcthr
21824         eval $inhdr
21825 else
21826         i_machcthr="$undef"
21827 fi
21828
21829 : see if this is a mntent.h system
21830 set mntent.h i_mntent
21831 eval $inhdr
21832
21833 : see if net/errno.h is available
21834 val=''
21835 set net/errno.h val
21836 eval $inhdr
21837
21838 : Unfortunately, it causes problems on some systems.  Arrgh.
21839 case "$val" in
21840 $define)
21841         cat > try.c <<'EOM'
21842 #include <stdio.h>
21843 #include <errno.h>
21844 #include <net/errno.h>
21845 int func()
21846 {
21847         return ENOTSOCK;
21848 }
21849 EOM
21850         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21851                 echo "We'll be including <net/errno.h>." >&4
21852         else
21853                 echo "We won't be including <net/errno.h>." >&4
21854                 val="$undef"
21855         fi
21856         $rm_try
21857         ;;
21858 esac
21859 set i_neterrno
21860 eval $setvar
21861
21862 : see if netinet/tcp.h is available
21863 set netinet/tcp.h i_netinettcp
21864 eval $inhdr
21865
21866 : see if this is a poll.h system
21867 set poll.h i_poll
21868 eval $inhdr
21869
21870 : see if this is a prot.h system
21871 set prot.h i_prot
21872 eval $inhdr
21873
21874 : Preprocessor symbols
21875 echo " "
21876 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21877 $cat <<'EOSH' > Cppsym.know
21878 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21879 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21880 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21881 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21882 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21883 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21884 bull c cadmus clipper CMU COFF COMPILER_VERSION
21885 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21886 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21887 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21888 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21889 GLIBC GLIBC_MINOR
21890 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21891 H3050R H3050RX hbullx20 hcx host_mips
21892 hp200 hp300 hp700 HP700 hp800 hp9000
21893 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21894 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21895 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21896 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21897 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21898 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21899 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21900 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21901 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21902 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21903 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21904 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21905 MATH_HAS_NO_SIDE_EFFECTS
21906 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21907 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21908 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21909 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21910 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21911 NetBSD news1500 news1700 news1800 news1900 news3700
21912 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21913 ns32016 ns32332 ns32k nsc32000
21914 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21915 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21916 pc532 pdp11 PGC PIC plexus PORTAR posix
21917 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21918 POSIX_C_SOURCE POSIX_SOURCE POWER
21919 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21920 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21921 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21922 sony sony_news sonyrisc sparc sparclite spectrum
21923 stardent stdc STDC_EXT stratos sun sun3 sun386
21924 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21925 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21926 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21927 sysV68 sysV88 Tek4132 Tek4300 titan
21928 TM3200 TM5400 TM5600
21929 tower tower32 tower32_200 tower32_600 tower32_700
21930 tower32_800 tower32_850 tss
21931 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21932 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21933 unix UNIX95 UNIX99 unixpc unos
21934 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21935 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21936 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21937 USGr4 USGr4_2
21938 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21939 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21940 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21941 z8000
21942 EOSH
21943 # Maybe put other stuff here too.
21944 cat <<EOSH >>Cppsym.know
21945 $osname
21946 EOSH
21947 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21948 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21949 $cat Cppsym.know > Cppsym.c
21950 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21951 $rm -f Cppsym.a Cppsym.b Cppsym.c
21952 cat <<EOSH > Cppsym
21953 $startsh
21954 if $test \$# -gt 0; then
21955     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21956     if $test -s Cppsym.got; then
21957         $rm -f Cppsym.got
21958         exit 0
21959     fi
21960     $rm -f Cppsym.got
21961     exit 1
21962 else
21963     $tr " " "$trnl" | ./Cppsym.try
21964     exit 0
21965 fi
21966 EOSH
21967 chmod +x Cppsym
21968 $eunicefix Cppsym
21969 cat <<EOSH > Cppsym.try
21970 $startsh
21971 cat <<'EOCP' > try.c
21972 #include <stdio.h>
21973 #if cpp_stuff == 1
21974 #define STRINGIFY(a)    "a"
21975 #endif
21976 #if cpp_stuff == 42
21977 #define StGiFy(a)  #a
21978 #define STRINGIFY(a)    StGiFy(a)
21979 #endif
21980 #if $cpp_stuff != 1 && $cpp_stuff != 42
21981 #   include "Bletch: How does this C preprocessor stringify macros?"
21982 #endif
21983 int main() {
21984 EOCP
21985 $awk \\
21986 EOSH
21987 cat <<'EOSH' >> Cppsym.try
21988 'length($1) > 0 {
21989     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21990     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21991     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21992     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21993 }'       >> try.c
21994 echo 'return 0;}' >> try.c
21995 EOSH
21996 cat <<EOSH >> Cppsym.try
21997 ccflags="$ccflags"
21998 case "$osname-$gccversion" in
21999 irix-) ccflags="\$ccflags -woff 1178" ;;
22000 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22001 esac
22002 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
22003 EOSH
22004 chmod +x Cppsym.try
22005 $eunicefix Cppsym.try
22006 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22007 : Add in any linux cpp "predefined macros":
22008 case "$osname::$gccversion" in
22009   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22010     tHdrH=_tmpHdr
22011     rm -f $tHdrH'.h' $tHdrH
22012     touch $tHdrH'.h'
22013     # Filter out macro arguments, such as Linux's __INT8_C(c)
22014     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22015        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22016        if [ -s $tHdrH'_cppsym.real' ]; then
22017           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22018        fi
22019     fi
22020     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22021   ;;
22022 esac
22023 : now check the C compiler for additional symbols
22024 postprocess_cc_v=''
22025 case "$osname" in
22026 aix) postprocess_cc_v="|$tr , ' '" ;;
22027 esac
22028 $cat >ccsym <<EOS
22029 $startsh
22030 $cat >tmp.c <<EOF
22031 extern int foo;
22032 EOF
22033 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22034 do
22035         case "\$i" in
22036         -D*) echo "\$i" | $sed 's/^-D//';;
22037         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22038         esac
22039 done
22040 $rm_try
22041 EOS
22042 postprocess_cc_v=''
22043 chmod +x ccsym
22044 $eunicefix ccsym
22045 ./ccsym > ccsym1.raw
22046 if $test -s ccsym1.raw; then
22047        $sort ccsym1.raw | $uniq >ccsym.raw
22048 else
22049        mv ccsym1.raw ccsym.raw
22050 fi
22051
22052 $awk '/\=/ { print $0; next }
22053         { print $0"=1" }' ccsym.raw >ccsym.list
22054 $comm -13 Cppsym.true ccsym.list >ccsym.own
22055 $comm -12 Cppsym.true ccsym.list >ccsym.com
22056 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22057 also=''
22058 if $test -z ccsym.raw; then
22059         echo "Your C compiler doesn't seem to define any symbols!" >&4
22060         echo " "
22061         echo "However, your C preprocessor defines the following symbols:"
22062         $cat Cppsym.true
22063         ccsymbols=''
22064         cppsymbols=`$cat Cppsym.true`
22065         cppsymbols=`echo $cppsymbols`
22066         cppccsymbols="$cppsymbols"
22067 else
22068         if $test -s ccsym.com; then
22069                 echo "Your C compiler and pre-processor define these symbols:"
22070                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22071                 also='also '
22072                 symbols='ones'
22073                 cppccsymbols=`$cat ccsym.com`
22074                 cppccsymbols=`echo $cppccsymbols`
22075                 $test "$silent" || sleep 1
22076         fi
22077         if $test -s ccsym.cpp; then
22078                 $test "$also" && echo " "
22079                 echo "Your C pre-processor ${also}defines the following symbols:"
22080                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22081                 also='further '
22082                 cppsymbols=`$cat ccsym.cpp`
22083                 cppsymbols=`echo $cppsymbols`
22084                 $test "$silent" || sleep 1
22085         fi
22086         if $test -s ccsym.own; then
22087                 $test "$also" && echo " "
22088                 echo "Your C compiler ${also}defines the following cpp symbols:"
22089                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22090                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22091                 ccsymbols=`$cat ccsym.own`
22092                 ccsymbols=`echo $ccsymbols`
22093                 $test "$silent" || sleep 1
22094         fi
22095 fi
22096
22097 : see if this is a termio system
22098 val="$undef"
22099 val2="$undef"
22100 val3="$undef"
22101 if $test `./findhdr termios.h`; then
22102         set tcsetattr i_termios
22103         eval $inlibc
22104         val3="$i_termios"
22105 fi
22106 echo " "
22107 case "$val3" in
22108 "$define") echo "You have POSIX termios.h... good!" >&4;;
22109 *) if ./Cppsym pyr; then
22110                 case "`/bin/universe`" in
22111                 ucb) if $test `./findhdr sgtty.h`; then
22112                                 val2="$define"
22113                                 echo "<sgtty.h> found." >&4
22114                         else
22115                                 echo "System is pyramid with BSD universe."
22116                                 ./warn "<sgtty.h> not found--you could have problems."
22117                         fi;;
22118                 *) if $test `./findhdr termio.h`; then
22119                                 val="$define"
22120                                 echo "<termio.h> found." >&4
22121                         else
22122                                 echo "System is pyramid with USG universe."
22123                                 ./warn "<termio.h> not found--you could have problems."
22124                         fi;;
22125                 esac
22126         elif ./usg; then
22127                 if $test `./findhdr termio.h`; then
22128                         echo "<termio.h> found." >&4
22129                         val="$define"
22130                 elif $test `./findhdr sgtty.h`; then
22131                         echo "<sgtty.h> found." >&4
22132                         val2="$define"
22133                 else
22134                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
22135                 fi
22136         else
22137                 if $test `./findhdr sgtty.h`; then
22138                         echo "<sgtty.h> found." >&4
22139                         val2="$define"
22140                 elif $test `./findhdr termio.h`; then
22141                         echo "<termio.h> found." >&4
22142                         val="$define"
22143                 else
22144                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22145                 fi
22146         fi;;
22147 esac
22148 set i_termio; eval $setvar
22149 val=$val2; set i_sgtty; eval $setvar
22150 val=$val3; set i_termios; eval $setvar
22151
22152 : see if stdbool is available
22153 : we want a real compile instead of Inhdr because some Solaris systems
22154 : have stdbool.h, but it can only be used if the compiler indicates it
22155 : is sufficiently c99-compliant.
22156 echo " "
22157 $cat >try.c <<EOCP
22158 #include <stdio.h>
22159 #include <stdbool.h>
22160 int func(bool x)
22161 {
22162     return x ? 1 : 0;
22163 }
22164 int main(int argc, char **argv)
22165 {
22166     return func(0);
22167 }
22168 EOCP
22169 set try
22170 if eval $compile; then
22171         echo "<stdbool.h> found." >&4
22172         val="$define"
22173 else
22174         echo "<stdbool.h> NOT found." >&4
22175         val="$undef"
22176 fi
22177 $rm_try
22178 set i_stdbool
22179 eval $setvar
22180
22181 : see if stddef is available
22182 set stddef.h i_stddef
22183 eval $inhdr
22184
22185 : see if sys/access.h is available
22186 set sys/access.h i_sysaccess
22187 eval $inhdr
22188
22189 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22190 set sys/filio.h i_sysfilio
22191 eval $inhdr
22192 echo " "
22193 if $test `./findhdr sys/ioctl.h`; then
22194         val="$define"
22195         echo '<sys/ioctl.h> found.' >&4
22196 else
22197         val="$undef"
22198         if $test $i_sysfilio = "$define"; then
22199             echo '<sys/ioctl.h> NOT found.' >&4
22200         else
22201                 $test $i_sgtty = "$define" && xxx="sgtty.h"
22202                 $test $i_termio = "$define" && xxx="termio.h"
22203                 $test $i_termios = "$define" && xxx="termios.h"
22204 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22205         fi
22206 fi
22207 set i_sysioctl
22208 eval $setvar
22209
22210 : see if socket ioctl defs are in sys/sockio.h
22211 echo " "
22212 xxx=`./findhdr sys/sockio.h`
22213 if $test "$xxx"; then
22214         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22215                 val="$define"
22216                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22217         else
22218                 val="$undef"
22219                 echo "No socket ioctls found in <sys/sockio.h>." >&4
22220         fi
22221 else
22222         val="$undef"
22223         $cat <<EOM
22224 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22225 EOM
22226 fi
22227 set i_syssockio
22228 eval $setvar
22229
22230 : see if this is a syslog.h system
22231 set syslog.h i_syslog
22232 eval $inhdr
22233
22234 : see if this is a sys/mode.h system
22235 set sys/mode.h i_sysmode
22236 eval $inhdr
22237
22238 : see if there is a sys/poll.h file
22239 set sys/poll.h i_syspoll
22240 eval $inhdr
22241
22242 : see if sys/resource.h has to be included
22243 set sys/resource.h i_sysresrc
22244 eval $inhdr
22245
22246 : see if sys/security.h is available
22247 set sys/security.h i_syssecrt
22248 eval $inhdr
22249
22250 : see if this is a sys/statvfs.h system
22251 set sys/statvfs.h i_sysstatvfs
22252 eval $inhdr
22253
22254 : see if this is a sys/un.h system
22255 set sys/un.h i_sysun
22256 eval $inhdr
22257
22258 : see if this is a sys/utsname.h system
22259 set sys/utsname.h i_sysutsname
22260 eval $inhdr
22261
22262 : see if this is a syswait system
22263 set sys/wait.h i_syswait
22264 eval $inhdr
22265
22266 : see if this is a ustat.h system
22267 set ustat.h i_ustat
22268 eval $inhdr
22269
22270 : see if this is an utime system
22271 set utime.h i_utime
22272 eval $inhdr
22273
22274 : see if this is a vfork system
22275 case "$d_vfork" in
22276 "$define")
22277         set vfork.h i_vfork
22278         eval $inhdr
22279         ;;
22280 *)
22281         i_vfork="$undef"
22282         ;;
22283 esac
22284
22285 : Check extensions
22286 echo " "
22287 echo "Looking for extensions..." >&4
22288 : If we are using the old config.sh, known_extensions may contain
22289 : old or inaccurate or duplicate values.
22290 known_extensions=''
22291 nonxs_extensions=''
22292 : We do not use find because it might not be available.
22293 : We do not just use MANIFEST because the user may have dropped
22294 : some additional extensions into the source tree and expect them
22295 : to be built.
22296
22297 : Function to recursively find available extensions, ignoring DynaLoader
22298 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22299 : In 5.10.1 and later, extensions are stored in directories
22300 : like File-Glob instead of the older File/Glob/.
22301 find_extensions='
22302     for xxx in *; do
22303         case "$xxx" in
22304             DynaLoader|dynaload) ;;
22305             *)
22306             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22307             leaf=`echo $xxx | $sed -e s/.*-//`;
22308             if $test -d File; then
22309                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
22310                     known_extensions="$known_extensions $1$this_ext";
22311                 elif $test -f $xxx/Makefile.PL; then
22312                     nonxs_extensions="$nonxs_extensions $1$this_ext";
22313                 else
22314                     if $test -d $xxx -a $# -lt 10; then
22315                         set $1$xxx/ $*;
22316                         cd "$xxx";
22317                         eval $find_extensions;
22318                         cd ..;
22319                         shift;
22320                     fi;
22321                 fi;
22322             else
22323                 echo " $known_extensions $nonxs_extensions" > $$.tmp;
22324                 if $contains " $this_ext " $$.tmp; then
22325                     echo >&4;
22326                     echo "Duplicate directories detected for extension $xxx" >&4;
22327                     echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22328                     case "$knowitall" in
22329                     "") dflt=y;;
22330                     *) dflt=n;;
22331                     esac;
22332                     . ../UU/myread;
22333                     case "$ans" in
22334                     n*|N*) ;;
22335                     *) echo >&4;
22336                        echo "Ok.  Stopping Configure." >&4;
22337                        echo "Please remove the duplicate directory (eg using git clean) and then re-run Configure" >&4;
22338                         exit 1;;
22339                     esac;
22340                     echo "Ok.  You will need to correct config.sh before running make." >&4;
22341                 fi;
22342                 $ls -1 $xxx > $$.tmp;
22343                 if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
22344                     known_extensions="$known_extensions $this_ext";
22345                 elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
22346                     known_extensions="$known_extensions $this_ext";
22347                 elif $test -d $xxx; then
22348                     nonxs_extensions="$nonxs_extensions $this_ext";
22349                 fi;
22350                 $rm -f $$.tmp;
22351             fi
22352             ;;
22353         esac;
22354     done'
22355 tdir=`pwd`
22356 cd "$rsrc/cpan"
22357 set X
22358 shift
22359 eval $find_extensions
22360 cd "$rsrc/dist"
22361 set X
22362 shift
22363 eval $find_extensions
22364 cd "$rsrc/ext"
22365 set X
22366 shift
22367 eval $find_extensions
22368 if $test -d File-Glob; then
22369     : All ext/ flattened
22370 else
22371     # Special case:  Add in modules that nest beyond the first level.
22372     # Currently threads/shared and Hash/Util/FieldHash, since they are
22373     # not picked up by the recursive find above (and adding in general
22374     # recursive finding breaks SDBM_File/sdbm).
22375     # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
22376     known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
22377 fi
22378 set X $known_extensions
22379 shift
22380 known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22381 set X $nonxs_extensions
22382 shift
22383 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22384 cd "$tdir"
22385
22386 : Now see which are supported on this system.
22387 avail_ext=''
22388 for xxx in $known_extensions ; do
22389         case "$xxx" in
22390         DB_File|db_file)
22391                 case "$i_db" in
22392                 $define) avail_ext="$avail_ext $xxx" ;;
22393                 esac
22394                 ;;
22395         GDBM_File|gdbm_fil)
22396                 case "$i_gdbm" in
22397                 $define) avail_ext="$avail_ext $xxx" ;;
22398                 esac
22399                 ;;
22400         I18N/Langinfo|i18n_lan)
22401                 case "$i_langinfo$d_nl_langinfo" in
22402                 $define$define) avail_ext="$avail_ext $xxx" ;;
22403                 esac
22404                 ;;
22405         IPC/SysV|ipc/sysv)
22406                 : XXX Do we need a useipcsysv variable here
22407                 case "${d_msg}${d_sem}${d_shm}" in
22408                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22409                 esac
22410                 ;;
22411         NDBM_File|ndbm_fil)
22412                 case "$d_ndbm" in
22413                 $define)
22414                     case "$osname-$use64bitint" in
22415                     hpux-define)
22416                         case "$libs" in
22417                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22418                         esac
22419                         ;;
22420                     *) avail_ext="$avail_ext $xxx" ;;
22421                     esac
22422                     ;;
22423                 esac
22424                 ;;
22425         ODBM_File|odbm_fil)
22426                 case "${i_dbm}${i_rpcsvcdbm}" in
22427                 *"${define}"*)
22428                     case "$d_cplusplus" in
22429                     define) ;; # delete as a function name will not work
22430                     *)  case "$osname-$use64bitint" in
22431                         hpux-define)
22432                             case "$libs" in
22433                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22434                             esac
22435                             ;;
22436                         *) avail_ext="$avail_ext $xxx" ;;
22437                         esac
22438                         ;;
22439                     esac
22440                     ;;
22441                 esac
22442                 ;;
22443         Opcode|opcode)
22444                 case "$useopcode" in
22445                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22446                 esac
22447                 ;;
22448         POSIX|posix)
22449                 case "$useposix" in
22450                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22451                 esac
22452                 ;;
22453         Socket|socket)
22454                 case "$d_socket" in
22455                 true|$define|y)
22456                     case "$osname" in
22457                     beos) ;; # not unless BONE
22458                     *) avail_ext="$avail_ext $xxx" ;;
22459                     esac
22460                     ;;
22461                 esac
22462                 ;;
22463         Sys/Syslog|sys/syslog)
22464                 : XXX syslog requires socket
22465                 case "$d_socket" in
22466                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22467                 esac
22468                 ;;
22469         Thread|thread)
22470                 case "$usethreads" in
22471                 true|$define|y)
22472                         case "$use5005threads" in
22473                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22474                         esac
22475                 esac
22476                 ;;
22477         threads|threads/shared)
22478                 # threads and threads::shared are special cases.
22479                 # To stop people from asking "Perl 5.8.0 was supposed
22480                 # to have this new fancy threads implementation but my
22481                 # perl doesn't have it" and from people trying to
22482                 # (re)install the threads module using CPAN.pm and
22483                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22484                 # the threads.pm and threads/shared.pm will always be
22485                 # there, croaking informatively ("you need to rebuild
22486                 # all of Perl with threads, sorry") when threads haven't
22487                 # been compiled in.
22488                 # --jhi
22489                 avail_ext="$avail_ext $xxx"
22490                 ;;
22491         VMS*)
22492                 ;;
22493         Win32*)
22494                 case "$osname" in
22495                 cygwin) avail_ext="$avail_ext $xxx" ;;
22496                 esac
22497                 ;;
22498         XS/APItest|xs/apitest)
22499                 # This is just for testing.  Skip it unless we have dynamic loading.
22500
22501                 case "$usedl" in
22502                 $define) avail_ext="$avail_ext $xxx" ;;
22503                 esac
22504                 ;;
22505         XS/Typemap|xs/typemap)
22506                 # This is just for testing.  Skip it unless we have dynamic loading.
22507                 case "$usedl" in
22508                 $define) avail_ext="$avail_ext $xxx" ;;
22509                 esac
22510                 ;;
22511         *)      avail_ext="$avail_ext $xxx"
22512                 ;;
22513         esac
22514 done
22515
22516 set X $avail_ext
22517 shift
22518 avail_ext="$*"
22519
22520 case "$onlyextensions" in
22521 '') ;;
22522 *)  keepextensions=''
22523     echo "You have requested that only certain extensions be included..." >&4
22524     for i in $onlyextensions; do
22525         case " $avail_ext " in
22526         *" $i "*)
22527             echo "Keeping extension $i."
22528             keepextensions="$keepextensions $i"
22529             ;;
22530         *) echo "Ignoring extension $i." ;;
22531         esac
22532     done
22533     avail_ext="$keepextensions"
22534     ;;
22535 esac
22536
22537 case "$noextensions" in
22538 '') ;;
22539 *)  keepextensions=''
22540     echo "You have requested that certain extensions be ignored..." >&4
22541     for i in $avail_ext; do
22542         case " $noextensions " in
22543         *" $i "*) echo "Ignoring extension $i." ;;
22544         *) echo "Keeping extension $i.";
22545            keepextensions="$keepextensions $i"
22546            ;;
22547         esac
22548     done
22549     avail_ext="$keepextensions"
22550     ;;
22551 esac
22552
22553 : Now see which nonxs extensions are supported on this system.
22554 : For now assume all are.
22555 nonxs_ext=''
22556 for xxx in $nonxs_extensions ; do
22557         case "$xxx" in
22558         *)      nonxs_ext="$nonxs_ext $xxx"
22559                 ;;
22560         esac
22561 done
22562
22563 set X $nonxs_ext
22564 shift
22565 nonxs_ext="$*"
22566
22567 case $usedl in
22568 $define)
22569         $cat <<EOM
22570 A number of extensions are supplied with $package.  You may choose to
22571 compile these extensions for dynamic loading (the default), compile
22572 them into the $package executable (static loading), or not include
22573 them at all.  Answer "none" to include no extensions.
22574 Note that DynaLoader is always built and need not be mentioned here.
22575
22576 EOM
22577         case "$dynamic_ext" in
22578         '')
22579                 : Exclude those listed in static_ext
22580                 dflt=''
22581                 for xxx in $avail_ext; do
22582                         case " $static_ext " in
22583                         *" $xxx "*) ;;
22584                         *) dflt="$dflt $xxx" ;;
22585                         esac
22586                 done
22587                 set X $dflt
22588                 shift
22589                 dflt="$*"
22590                 ;;
22591         *)      dflt="$dynamic_ext"
22592                 # Perhaps we are reusing an old out-of-date config.sh.
22593                 case "$hint" in
22594                 previous)
22595                         if test X"$dynamic_ext" != X"$avail_ext"; then
22596                                 $cat <<EOM
22597 NOTICE:  Your previous config.sh list may be incorrect.
22598 The extensions now available to you are
22599         ${avail_ext}
22600 but the default list from your previous config.sh is
22601         ${dynamic_ext}
22602
22603 EOM
22604                         fi
22605                         ;;
22606                 esac
22607                 ;;
22608         esac
22609         case "$dflt" in
22610         '')     dflt=none;;
22611         esac
22612         rp="What extensions do you wish to load dynamically?"
22613         . ./myread
22614         case "$ans" in
22615         none) dynamic_ext=' ' ;;
22616         *) dynamic_ext="$ans" ;;
22617         esac
22618
22619         case "$static_ext" in
22620         '')
22621                 : Exclude those already listed in dynamic linking
22622                 dflt=''
22623                 for xxx in $avail_ext; do
22624                         case " $dynamic_ext " in
22625                         *" $xxx "*) ;;
22626                         *) dflt="$dflt $xxx" ;;
22627                         esac
22628                 done
22629                 set X $dflt
22630                 shift
22631                 dflt="$*"
22632                 ;;
22633         *)  dflt="$static_ext"
22634                 ;;
22635         esac
22636
22637         case "$dflt" in
22638         '')     dflt=none;;
22639         esac
22640         rp="What extensions do you wish to load statically?"
22641         . ./myread
22642         case "$ans" in
22643         none) static_ext=' ' ;;
22644         *) static_ext="$ans" ;;
22645         esac
22646         ;;
22647 *)
22648         $cat <<EOM
22649 A number of extensions are supplied with $package.  Answer "none"
22650 to include no extensions.
22651 Note that DynaLoader is always built and need not be mentioned here.
22652
22653 EOM
22654         case "$static_ext" in
22655         '') dflt="$avail_ext" ;;
22656         *)      dflt="$static_ext"
22657                 # Perhaps we are reusing an old out-of-date config.sh.
22658                 case "$hint" in
22659                 previous)
22660                         if test X"$static_ext" != X"$avail_ext"; then
22661                                 $cat <<EOM
22662 NOTICE:  Your previous config.sh list may be incorrect.
22663 The extensions now available to you are
22664         ${avail_ext}
22665 but the default list from your previous config.sh is
22666         ${static_ext}
22667
22668 EOM
22669                         fi
22670                         ;;
22671                 esac
22672                 ;;
22673         esac
22674         : Exclude those that are not xs extensions
22675         case "$dflt" in
22676         '')     dflt=none;;
22677         esac
22678         rp="What extensions do you wish to include?"
22679         . ./myread
22680         case "$ans" in
22681         none) static_ext=' ' ;;
22682         *) static_ext="$ans" ;;
22683         esac
22684         ;;
22685 esac
22686 #
22687 # Encode is a special case.  If we are building Encode as a static
22688 # extension, we need to explicitly list its subextensions as well.
22689 # For other nested extensions, this is handled automatically by
22690 # the appropriate Makefile.PL.
22691 case " $static_ext " in
22692         *" Encode "*) # Add the subextensions of Encode
22693         cd "$rsrc/cpan"
22694         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22695                 static_ext="$static_ext Encode/$xxx"
22696         done
22697         cd "$tdir"
22698         ;;
22699 esac
22700
22701 set X $dynamic_ext $static_ext $nonxs_ext
22702 shift
22703 extensions="$*"
22704
22705 # Sanity check:  We require an extension suitable for use with
22706 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22707 # should show up as failures in the test suite, but it's helpful to
22708 # catch them now.) The 'extensions' list is normally sorted
22709 # alphabetically, so we need to accept either
22710 #    DB_File ... Fcntl ... IO  ....
22711 # or something like
22712 #    Fcntl ... NDBM_File ... IO  ....
22713 case " $extensions"  in
22714 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22715 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22716 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22717 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22718    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22719    ;;
22720 esac
22721
22722 : Remove libraries needed only for extensions
22723 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22724 : The exception is SunOS 4.x, which needs them.
22725 case "${osname}X${osvers}" in
22726 sunos*X4*)
22727     perllibs="$libs"
22728     ;;
22729 *) case "$usedl" in
22730     $define|true|[yY]*)
22731             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
22732             shift
22733             perllibs="$*"
22734             ;;
22735     *)  perllibs="$libs"
22736             ;;
22737     esac
22738     ;;
22739 esac
22740
22741 : Remove build directory name from cppstdin so it can be used from
22742 : either the present location or the final installed location.
22743 echo " "
22744 : Get out of the UU directory to get correct path name.
22745 cd ..
22746 case "$cppstdin" in
22747 `pwd`/cppstdin)
22748         echo "Stripping down cppstdin path name"
22749         cppstdin=cppstdin
22750         ;;
22751 esac
22752 cd UU
22753
22754 : end of configuration questions
22755 echo " "
22756 echo "End of configuration questions."
22757 echo " "
22758
22759 : back to where it started
22760 if test -d ../UU; then
22761         cd ..
22762 fi
22763
22764 : configuration may be unconditionally patched via a 'config.arch' file
22765 if $test -f config.arch; then
22766         echo "I see a config.arch file, loading it." >&4
22767         . ./config.arch
22768 fi
22769
22770 : configuration may be patched via a 'config.over' file
22771 if $test -f config.over; then
22772         echo " "
22773         dflt=y
22774         rp='I see a config.over file.  Do you wish to load it?'
22775         . UU/myread
22776         case "$ans" in
22777         n*) echo "OK, I'll ignore it.";;
22778         *)      . ./config.over
22779                 echo "Configuration override changes have been loaded."
22780                 ;;
22781         esac
22782 fi
22783
22784 : in case they want portability, strip down executable paths
22785 case "$d_portable" in
22786 "$define")
22787         echo " "
22788         echo "Stripping down executable paths..." >&4
22789         for file in $loclist $trylist; do
22790                 eval temp=\$$file
22791                 eval $file=`basename $temp`
22792         done
22793         ;;
22794 esac
22795
22796 : create config.sh file
22797 echo " "
22798 echo "Creating config.sh..." >&4
22799 $spitshell <<EOT >config.sh
22800 $startsh
22801 #
22802 # This file was produced by running the Configure script. It holds all the
22803 # definitions figured out by Configure. Should you modify one of these values,
22804 # do not forget to propagate your changes by running "Configure -der". You may
22805 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22806 #
22807
22808 # Package name      : $package
22809 # Source directory  : $src
22810 # Configuration time: $cf_time
22811 # Configured by     : $cf_by
22812 # Target system     : $myuname
22813
22814 EOT
22815 : Add in command line options if available
22816 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22817
22818 $spitshell <<EOT >>config.sh
22819
22820 Author='$Author'
22821 Date='$Date'
22822 Header='$Header'
22823 Id='$Id'
22824 Locker='$Locker'
22825 Log='$Log'
22826 RCSfile='$RCSfile'
22827 Revision='$Revision'
22828 Source='$Source'
22829 State='$State'
22830 _a='$_a'
22831 _exe='$_exe'
22832 _o='$_o'
22833 afs='$afs'
22834 afsroot='$afsroot'
22835 alignbytes='$alignbytes'
22836 ansi2knr='$ansi2knr'
22837 aphostname='$aphostname'
22838 api_revision='$api_revision'
22839 api_subversion='$api_subversion'
22840 api_version='$api_version'
22841 api_versionstring='$api_versionstring'
22842 ar='$ar'
22843 archlib='$archlib'
22844 archlibexp='$archlibexp'
22845 archname64='$archname64'
22846 archname='$archname'
22847 archobjs='$archobjs'
22848 asctime_r_proto='$asctime_r_proto'
22849 awk='$awk'
22850 baserev='$baserev'
22851 bash='$bash'
22852 bin='$bin'
22853 bin_ELF='$bin_ELF'
22854 binexp='$binexp'
22855 bison='$bison'
22856 byacc='$byacc'
22857 byteorder='$byteorder'
22858 c='$c'
22859 castflags='$castflags'
22860 cat='$cat'
22861 cc='$cc'
22862 cccdlflags='$cccdlflags'
22863 ccdlflags='$ccdlflags'
22864 ccflags='$ccflags'
22865 ccflags_uselargefiles='$ccflags_uselargefiles'
22866 ccname='$ccname'
22867 ccsymbols='$ccsymbols'
22868 ccversion='$ccversion'
22869 cf_by='$cf_by'
22870 cf_email='$cf_email'
22871 cf_time='$cf_time'
22872 charbits='$charbits'
22873 charsize='$charsize'
22874 chgrp='$chgrp'
22875 chmod='$chmod'
22876 chown='$chown'
22877 clocktype='$clocktype'
22878 comm='$comm'
22879 compress='$compress'
22880 contains='$contains'
22881 cp='$cp'
22882 cpio='$cpio'
22883 cpp='$cpp'
22884 cpp_stuff='$cpp_stuff'
22885 cppccsymbols='$cppccsymbols'
22886 cppflags='$cppflags'
22887 cpplast='$cpplast'
22888 cppminus='$cppminus'
22889 cpprun='$cpprun'
22890 cppstdin='$cppstdin'
22891 cppsymbols='$cppsymbols'
22892 crypt_r_proto='$crypt_r_proto'
22893 cryptlib='$cryptlib'
22894 csh='$csh'
22895 ctermid_r_proto='$ctermid_r_proto'
22896 ctime_r_proto='$ctime_r_proto'
22897 d_Gconvert='$d_Gconvert'
22898 d_PRIEUldbl='$d_PRIEUldbl'
22899 d_PRIFUldbl='$d_PRIFUldbl'
22900 d_PRIGUldbl='$d_PRIGUldbl'
22901 d_PRIXU64='$d_PRIXU64'
22902 d_PRId64='$d_PRId64'
22903 d_PRIeldbl='$d_PRIeldbl'
22904 d_PRIfldbl='$d_PRIfldbl'
22905 d_PRIgldbl='$d_PRIgldbl'
22906 d_PRIi64='$d_PRIi64'
22907 d_PRIo64='$d_PRIo64'
22908 d_PRIu64='$d_PRIu64'
22909 d_PRIx64='$d_PRIx64'
22910 d_SCNfldbl='$d_SCNfldbl'
22911 d__fwalk='$d__fwalk'
22912 d_access='$d_access'
22913 d_accessx='$d_accessx'
22914 d_aintl='$d_aintl'
22915 d_alarm='$d_alarm'
22916 d_archlib='$d_archlib'
22917 d_asctime64='$d_asctime64'
22918 d_asctime_r='$d_asctime_r'
22919 d_atolf='$d_atolf'
22920 d_atoll='$d_atoll'
22921 d_attribute_deprecated='$d_attribute_deprecated'
22922 d_attribute_format='$d_attribute_format'
22923 d_attribute_malloc='$d_attribute_malloc'
22924 d_attribute_nonnull='$d_attribute_nonnull'
22925 d_attribute_noreturn='$d_attribute_noreturn'
22926 d_attribute_pure='$d_attribute_pure'
22927 d_attribute_unused='$d_attribute_unused'
22928 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22929 d_bcmp='$d_bcmp'
22930 d_bcopy='$d_bcopy'
22931 d_bsd='$d_bsd'
22932 d_bsdgetpgrp='$d_bsdgetpgrp'
22933 d_bsdsetpgrp='$d_bsdsetpgrp'
22934 d_builtin_choose_expr='$d_builtin_choose_expr'
22935 d_builtin_expect='$d_builtin_expect'
22936 d_bzero='$d_bzero'
22937 d_c99_variadic_macros='$d_c99_variadic_macros'
22938 d_casti32='$d_casti32'
22939 d_castneg='$d_castneg'
22940 d_charvspr='$d_charvspr'
22941 d_chown='$d_chown'
22942 d_chroot='$d_chroot'
22943 d_chsize='$d_chsize'
22944 d_class='$d_class'
22945 d_clearenv='$d_clearenv'
22946 d_closedir='$d_closedir'
22947 d_cmsghdr_s='$d_cmsghdr_s'
22948 d_const='$d_const'
22949 d_copysignl='$d_copysignl'
22950 d_cplusplus='$d_cplusplus'
22951 d_crypt='$d_crypt'
22952 d_crypt_r='$d_crypt_r'
22953 d_csh='$d_csh'
22954 d_ctermid='$d_ctermid'
22955 d_ctermid_r='$d_ctermid_r'
22956 d_ctime64='$d_ctime64'
22957 d_ctime_r='$d_ctime_r'
22958 d_cuserid='$d_cuserid'
22959 d_dbl_dig='$d_dbl_dig'
22960 d_dbminitproto='$d_dbminitproto'
22961 d_difftime64='$d_difftime64'
22962 d_difftime='$d_difftime'
22963 d_dir_dd_fd='$d_dir_dd_fd'
22964 d_dirfd='$d_dirfd'
22965 d_dirnamlen='$d_dirnamlen'
22966 d_dlerror='$d_dlerror'
22967 d_dlopen='$d_dlopen'
22968 d_dlsymun='$d_dlsymun'
22969 d_dosuid='$d_dosuid'
22970 d_drand48_r='$d_drand48_r'
22971 d_drand48proto='$d_drand48proto'
22972 d_dup2='$d_dup2'
22973 d_eaccess='$d_eaccess'
22974 d_endgrent='$d_endgrent'
22975 d_endgrent_r='$d_endgrent_r'
22976 d_endhent='$d_endhent'
22977 d_endhostent_r='$d_endhostent_r'
22978 d_endnent='$d_endnent'
22979 d_endnetent_r='$d_endnetent_r'
22980 d_endpent='$d_endpent'
22981 d_endprotoent_r='$d_endprotoent_r'
22982 d_endpwent='$d_endpwent'
22983 d_endpwent_r='$d_endpwent_r'
22984 d_endsent='$d_endsent'
22985 d_endservent_r='$d_endservent_r'
22986 d_eofnblk='$d_eofnblk'
22987 d_eunice='$d_eunice'
22988 d_faststdio='$d_faststdio'
22989 d_fchdir='$d_fchdir'
22990 d_fchmod='$d_fchmod'
22991 d_fchown='$d_fchown'
22992 d_fcntl='$d_fcntl'
22993 d_fcntl_can_lock='$d_fcntl_can_lock'
22994 d_fd_macros='$d_fd_macros'
22995 d_fd_set='$d_fd_set'
22996 d_fds_bits='$d_fds_bits'
22997 d_fgetpos='$d_fgetpos'
22998 d_finite='$d_finite'
22999 d_finitel='$d_finitel'
23000 d_flexfnam='$d_flexfnam'
23001 d_flock='$d_flock'
23002 d_flockproto='$d_flockproto'
23003 d_fork='$d_fork'
23004 d_fp_class='$d_fp_class'
23005 d_fpathconf='$d_fpathconf'
23006 d_fpclass='$d_fpclass'
23007 d_fpclassify='$d_fpclassify'
23008 d_fpclassl='$d_fpclassl'
23009 d_fpos64_t='$d_fpos64_t'
23010 d_frexpl='$d_frexpl'
23011 d_fs_data_s='$d_fs_data_s'
23012 d_fseeko='$d_fseeko'
23013 d_fsetpos='$d_fsetpos'
23014 d_fstatfs='$d_fstatfs'
23015 d_fstatvfs='$d_fstatvfs'
23016 d_fsync='$d_fsync'
23017 d_ftello='$d_ftello'
23018 d_ftime='$d_ftime'
23019 d_futimes='$d_futimes'
23020 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23021 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23022 d_getaddrinfo='$d_getaddrinfo'
23023 d_getcwd='$d_getcwd'
23024 d_getespwnam='$d_getespwnam'
23025 d_getfsstat='$d_getfsstat'
23026 d_getgrent='$d_getgrent'
23027 d_getgrent_r='$d_getgrent_r'
23028 d_getgrgid_r='$d_getgrgid_r'
23029 d_getgrnam_r='$d_getgrnam_r'
23030 d_getgrps='$d_getgrps'
23031 d_gethbyaddr='$d_gethbyaddr'
23032 d_gethbyname='$d_gethbyname'
23033 d_gethent='$d_gethent'
23034 d_gethname='$d_gethname'
23035 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23036 d_gethostbyname_r='$d_gethostbyname_r'
23037 d_gethostent_r='$d_gethostent_r'
23038 d_gethostprotos='$d_gethostprotos'
23039 d_getitimer='$d_getitimer'
23040 d_getlogin='$d_getlogin'
23041 d_getlogin_r='$d_getlogin_r'
23042 d_getmnt='$d_getmnt'
23043 d_getmntent='$d_getmntent'
23044 d_getnameinfo='$d_getnameinfo'
23045 d_getnbyaddr='$d_getnbyaddr'
23046 d_getnbyname='$d_getnbyname'
23047 d_getnent='$d_getnent'
23048 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23049 d_getnetbyname_r='$d_getnetbyname_r'
23050 d_getnetent_r='$d_getnetent_r'
23051 d_getnetprotos='$d_getnetprotos'
23052 d_getpagsz='$d_getpagsz'
23053 d_getpbyname='$d_getpbyname'
23054 d_getpbynumber='$d_getpbynumber'
23055 d_getpent='$d_getpent'
23056 d_getpgid='$d_getpgid'
23057 d_getpgrp2='$d_getpgrp2'
23058 d_getpgrp='$d_getpgrp'
23059 d_getppid='$d_getppid'
23060 d_getprior='$d_getprior'
23061 d_getprotobyname_r='$d_getprotobyname_r'
23062 d_getprotobynumber_r='$d_getprotobynumber_r'
23063 d_getprotoent_r='$d_getprotoent_r'
23064 d_getprotoprotos='$d_getprotoprotos'
23065 d_getprpwnam='$d_getprpwnam'
23066 d_getpwent='$d_getpwent'
23067 d_getpwent_r='$d_getpwent_r'
23068 d_getpwnam_r='$d_getpwnam_r'
23069 d_getpwuid_r='$d_getpwuid_r'
23070 d_getsbyname='$d_getsbyname'
23071 d_getsbyport='$d_getsbyport'
23072 d_getsent='$d_getsent'
23073 d_getservbyname_r='$d_getservbyname_r'
23074 d_getservbyport_r='$d_getservbyport_r'
23075 d_getservent_r='$d_getservent_r'
23076 d_getservprotos='$d_getservprotos'
23077 d_getspnam='$d_getspnam'
23078 d_getspnam_r='$d_getspnam_r'
23079 d_gettimeod='$d_gettimeod'
23080 d_gmtime64='$d_gmtime64'
23081 d_gmtime_r='$d_gmtime_r'
23082 d_gnulibc='$d_gnulibc'
23083 d_grpasswd='$d_grpasswd'
23084 d_hasmntopt='$d_hasmntopt'
23085 d_htonl='$d_htonl'
23086 d_ilogbl='$d_ilogbl'
23087 d_inc_version_list='$d_inc_version_list'
23088 d_index='$d_index'
23089 d_inetaton='$d_inetaton'
23090 d_inetntop='$d_inetntop'
23091 d_inetpton='$d_inetpton'
23092 d_int64_t='$d_int64_t'
23093 d_ip_mreq='$d_ip_mreq'
23094 d_ip_mreq_source='$d_ip_mreq_source'
23095 d_ipv6_mreq='$d_ipv6_mreq'
23096 d_ipv6_mreq_source='$d_ipv6_mreq_source'
23097 d_isascii='$d_isascii'
23098 d_isblank='$d_isblank'
23099 d_isfinite='$d_isfinite'
23100 d_isinf='$d_isinf'
23101 d_isnan='$d_isnan'
23102 d_isnanl='$d_isnanl'
23103 d_killpg='$d_killpg'
23104 d_lchown='$d_lchown'
23105 d_ldbl_dig='$d_ldbl_dig'
23106 d_libm_lib_version='$d_libm_lib_version'
23107 d_link='$d_link'
23108 d_localtime64='$d_localtime64'
23109 d_localtime_r='$d_localtime_r'
23110 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
23111 d_locconv='$d_locconv'
23112 d_lockf='$d_lockf'
23113 d_longdbl='$d_longdbl'
23114 d_longlong='$d_longlong'
23115 d_lseekproto='$d_lseekproto'
23116 d_lstat='$d_lstat'
23117 d_madvise='$d_madvise'
23118 d_malloc_good_size='$d_malloc_good_size'
23119 d_malloc_size='$d_malloc_size'
23120 d_mblen='$d_mblen'
23121 d_mbstowcs='$d_mbstowcs'
23122 d_mbtowc='$d_mbtowc'
23123 d_memchr='$d_memchr'
23124 d_memcmp='$d_memcmp'
23125 d_memcpy='$d_memcpy'
23126 d_memmove='$d_memmove'
23127 d_memset='$d_memset'
23128 d_mkdir='$d_mkdir'
23129 d_mkdtemp='$d_mkdtemp'
23130 d_mkfifo='$d_mkfifo'
23131 d_mkstemp='$d_mkstemp'
23132 d_mkstemps='$d_mkstemps'
23133 d_mktime64='$d_mktime64'
23134 d_mktime='$d_mktime'
23135 d_mmap='$d_mmap'
23136 d_modfl='$d_modfl'
23137 d_modfl_pow32_bug='$d_modfl_pow32_bug'
23138 d_modflproto='$d_modflproto'
23139 d_mprotect='$d_mprotect'
23140 d_msg='$d_msg'
23141 d_msg_ctrunc='$d_msg_ctrunc'
23142 d_msg_dontroute='$d_msg_dontroute'
23143 d_msg_oob='$d_msg_oob'
23144 d_msg_peek='$d_msg_peek'
23145 d_msg_proxy='$d_msg_proxy'
23146 d_msgctl='$d_msgctl'
23147 d_msgget='$d_msgget'
23148 d_msghdr_s='$d_msghdr_s'
23149 d_msgrcv='$d_msgrcv'
23150 d_msgsnd='$d_msgsnd'
23151 d_msync='$d_msync'
23152 d_munmap='$d_munmap'
23153 d_mymalloc='$d_mymalloc'
23154 d_ndbm='$d_ndbm'
23155 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
23156 d_nice='$d_nice'
23157 d_nl_langinfo='$d_nl_langinfo'
23158 d_nv_preserves_uv='$d_nv_preserves_uv'
23159 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
23160 d_off64_t='$d_off64_t'
23161 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23162 d_oldpthreads='$d_oldpthreads'
23163 d_oldsock='$d_oldsock'
23164 d_open3='$d_open3'
23165 d_pathconf='$d_pathconf'
23166 d_pause='$d_pause'
23167 d_perl_otherlibdirs='$d_perl_otherlibdirs'
23168 d_phostname='$d_phostname'
23169 d_pipe='$d_pipe'
23170 d_poll='$d_poll'
23171 d_portable='$d_portable'
23172 d_prctl='$d_prctl'
23173 d_prctl_set_name='$d_prctl_set_name'
23174 d_printf_format_null='$d_printf_format_null'
23175 d_procselfexe='$d_procselfexe'
23176 d_pseudofork='$d_pseudofork'
23177 d_pthread_atfork='$d_pthread_atfork'
23178 d_pthread_attr_setscope='$d_pthread_attr_setscope'
23179 d_pthread_yield='$d_pthread_yield'
23180 d_pwage='$d_pwage'
23181 d_pwchange='$d_pwchange'
23182 d_pwclass='$d_pwclass'
23183 d_pwcomment='$d_pwcomment'
23184 d_pwexpire='$d_pwexpire'
23185 d_pwgecos='$d_pwgecos'
23186 d_pwpasswd='$d_pwpasswd'
23187 d_pwquota='$d_pwquota'
23188 d_qgcvt='$d_qgcvt'
23189 d_quad='$d_quad'
23190 d_random_r='$d_random_r'
23191 d_readdir64_r='$d_readdir64_r'
23192 d_readdir='$d_readdir'
23193 d_readdir_r='$d_readdir_r'
23194 d_readlink='$d_readlink'
23195 d_readv='$d_readv'
23196 d_recvmsg='$d_recvmsg'
23197 d_rename='$d_rename'
23198 d_rewinddir='$d_rewinddir'
23199 d_rmdir='$d_rmdir'
23200 d_safebcpy='$d_safebcpy'
23201 d_safemcpy='$d_safemcpy'
23202 d_sanemcmp='$d_sanemcmp'
23203 d_sbrkproto='$d_sbrkproto'
23204 d_scalbnl='$d_scalbnl'
23205 d_sched_yield='$d_sched_yield'
23206 d_scm_rights='$d_scm_rights'
23207 d_seekdir='$d_seekdir'
23208 d_select='$d_select'
23209 d_sem='$d_sem'
23210 d_semctl='$d_semctl'
23211 d_semctl_semid_ds='$d_semctl_semid_ds'
23212 d_semctl_semun='$d_semctl_semun'
23213 d_semget='$d_semget'
23214 d_semop='$d_semop'
23215 d_sendmsg='$d_sendmsg'
23216 d_setegid='$d_setegid'
23217 d_seteuid='$d_seteuid'
23218 d_setgrent='$d_setgrent'
23219 d_setgrent_r='$d_setgrent_r'
23220 d_setgrps='$d_setgrps'
23221 d_sethent='$d_sethent'
23222 d_sethostent_r='$d_sethostent_r'
23223 d_setitimer='$d_setitimer'
23224 d_setlinebuf='$d_setlinebuf'
23225 d_setlocale='$d_setlocale'
23226 d_setlocale_r='$d_setlocale_r'
23227 d_setnent='$d_setnent'
23228 d_setnetent_r='$d_setnetent_r'
23229 d_setpent='$d_setpent'
23230 d_setpgid='$d_setpgid'
23231 d_setpgrp2='$d_setpgrp2'
23232 d_setpgrp='$d_setpgrp'
23233 d_setprior='$d_setprior'
23234 d_setproctitle='$d_setproctitle'
23235 d_setprotoent_r='$d_setprotoent_r'
23236 d_setpwent='$d_setpwent'
23237 d_setpwent_r='$d_setpwent_r'
23238 d_setregid='$d_setregid'
23239 d_setresgid='$d_setresgid'
23240 d_setresuid='$d_setresuid'
23241 d_setreuid='$d_setreuid'
23242 d_setrgid='$d_setrgid'
23243 d_setruid='$d_setruid'
23244 d_setsent='$d_setsent'
23245 d_setservent_r='$d_setservent_r'
23246 d_setsid='$d_setsid'
23247 d_setvbuf='$d_setvbuf'
23248 d_sfio='$d_sfio'
23249 d_shm='$d_shm'
23250 d_shmat='$d_shmat'
23251 d_shmatprototype='$d_shmatprototype'
23252 d_shmctl='$d_shmctl'
23253 d_shmdt='$d_shmdt'
23254 d_shmget='$d_shmget'
23255 d_sigaction='$d_sigaction'
23256 d_signbit='$d_signbit'
23257 d_sigprocmask='$d_sigprocmask'
23258 d_sigsetjmp='$d_sigsetjmp'
23259 d_sin6_scope_id='$d_sin6_scope_id'
23260 d_sitearch='$d_sitearch'
23261 d_snprintf='$d_snprintf'
23262 d_sockaddr_in6='$d_sockaddr_in6'
23263 d_sockaddr_sa_len='$d_sockaddr_sa_len'
23264 d_sockatmark='$d_sockatmark'
23265 d_sockatmarkproto='$d_sockatmarkproto'
23266 d_socket='$d_socket'
23267 d_socklen_t='$d_socklen_t'
23268 d_sockpair='$d_sockpair'
23269 d_socks5_init='$d_socks5_init'
23270 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23271 d_sqrtl='$d_sqrtl'
23272 d_srand48_r='$d_srand48_r'
23273 d_srandom_r='$d_srandom_r'
23274 d_sresgproto='$d_sresgproto'
23275 d_sresuproto='$d_sresuproto'
23276 d_statblks='$d_statblks'
23277 d_statfs_f_flags='$d_statfs_f_flags'
23278 d_statfs_s='$d_statfs_s'
23279 d_static_inline='$d_static_inline'
23280 d_statvfs='$d_statvfs'
23281 d_stdio_cnt_lval='$d_stdio_cnt_lval'
23282 d_stdio_ptr_lval='$d_stdio_ptr_lval'
23283 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23284 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23285 d_stdio_stream_array='$d_stdio_stream_array'
23286 d_stdiobase='$d_stdiobase'
23287 d_stdstdio='$d_stdstdio'
23288 d_strchr='$d_strchr'
23289 d_strcoll='$d_strcoll'
23290 d_strctcpy='$d_strctcpy'
23291 d_strerrm='$d_strerrm'
23292 d_strerror='$d_strerror'
23293 d_strerror_r='$d_strerror_r'
23294 d_strftime='$d_strftime'
23295 d_strlcat='$d_strlcat'
23296 d_strlcpy='$d_strlcpy'
23297 d_strtod='$d_strtod'
23298 d_strtol='$d_strtol'
23299 d_strtold='$d_strtold'
23300 d_strtoll='$d_strtoll'
23301 d_strtoq='$d_strtoq'
23302 d_strtoul='$d_strtoul'
23303 d_strtoull='$d_strtoull'
23304 d_strtouq='$d_strtouq'
23305 d_strxfrm='$d_strxfrm'
23306 d_suidsafe='$d_suidsafe'
23307 d_symlink='$d_symlink'
23308 d_syscall='$d_syscall'
23309 d_syscallproto='$d_syscallproto'
23310 d_sysconf='$d_sysconf'
23311 d_sysernlst='$d_sysernlst'
23312 d_syserrlst='$d_syserrlst'
23313 d_system='$d_system'
23314 d_tcgetpgrp='$d_tcgetpgrp'
23315 d_tcsetpgrp='$d_tcsetpgrp'
23316 d_telldir='$d_telldir'
23317 d_telldirproto='$d_telldirproto'
23318 d_time='$d_time'
23319 d_timegm='$d_timegm'
23320 d_times='$d_times'
23321 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23322 d_tm_tm_zone='$d_tm_tm_zone'
23323 d_tmpnam_r='$d_tmpnam_r'
23324 d_truncate='$d_truncate'
23325 d_ttyname_r='$d_ttyname_r'
23326 d_tzname='$d_tzname'
23327 d_u32align='$d_u32align'
23328 d_ualarm='$d_ualarm'
23329 d_umask='$d_umask'
23330 d_uname='$d_uname'
23331 d_union_semun='$d_union_semun'
23332 d_unordered='$d_unordered'
23333 d_unsetenv='$d_unsetenv'
23334 d_usleep='$d_usleep'
23335 d_usleepproto='$d_usleepproto'
23336 d_ustat='$d_ustat'
23337 d_vendorarch='$d_vendorarch'
23338 d_vendorbin='$d_vendorbin'
23339 d_vendorlib='$d_vendorlib'
23340 d_vendorscript='$d_vendorscript'
23341 d_vfork='$d_vfork'
23342 d_void_closedir='$d_void_closedir'
23343 d_voidsig='$d_voidsig'
23344 d_voidtty='$d_voidtty'
23345 d_volatile='$d_volatile'
23346 d_vprintf='$d_vprintf'
23347 d_vsnprintf='$d_vsnprintf'
23348 d_wait4='$d_wait4'
23349 d_waitpid='$d_waitpid'
23350 d_wcstombs='$d_wcstombs'
23351 d_wctomb='$d_wctomb'
23352 d_writev='$d_writev'
23353 d_xenix='$d_xenix'
23354 date='$date'
23355 db_hashtype='$db_hashtype'
23356 db_prefixtype='$db_prefixtype'
23357 db_version_major='$db_version_major'
23358 db_version_minor='$db_version_minor'
23359 db_version_patch='$db_version_patch'
23360 defvoidused='$defvoidused'
23361 direntrytype='$direntrytype'
23362 dlext='$dlext'
23363 dlsrc='$dlsrc'
23364 doublesize='$doublesize'
23365 drand01='$drand01'
23366 drand48_r_proto='$drand48_r_proto'
23367 dtrace='$dtrace'
23368 dynamic_ext='$dynamic_ext'
23369 eagain='$eagain'
23370 ebcdic='$ebcdic'
23371 echo='$echo'
23372 egrep='$egrep'
23373 emacs='$emacs'
23374 endgrent_r_proto='$endgrent_r_proto'
23375 endhostent_r_proto='$endhostent_r_proto'
23376 endnetent_r_proto='$endnetent_r_proto'
23377 endprotoent_r_proto='$endprotoent_r_proto'
23378 endpwent_r_proto='$endpwent_r_proto'
23379 endservent_r_proto='$endservent_r_proto'
23380 eunicefix='$eunicefix'
23381 exe_ext='$exe_ext'
23382 expr='$expr'
23383 extensions='$extensions'
23384 extern_C='$extern_C'
23385 extras='$extras'
23386 fflushNULL='$fflushNULL'
23387 fflushall='$fflushall'
23388 find='$find'
23389 firstmakefile='$firstmakefile'
23390 flex='$flex'
23391 fpossize='$fpossize'
23392 fpostype='$fpostype'
23393 freetype='$freetype'
23394 from='$from'
23395 full_ar='$full_ar'
23396 full_csh='$full_csh'
23397 full_sed='$full_sed'
23398 gccansipedantic='$gccansipedantic'
23399 gccosandvers='$gccosandvers'
23400 gccversion='$gccversion'
23401 getgrent_r_proto='$getgrent_r_proto'
23402 getgrgid_r_proto='$getgrgid_r_proto'
23403 getgrnam_r_proto='$getgrnam_r_proto'
23404 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23405 gethostbyname_r_proto='$gethostbyname_r_proto'
23406 gethostent_r_proto='$gethostent_r_proto'
23407 getlogin_r_proto='$getlogin_r_proto'
23408 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23409 getnetbyname_r_proto='$getnetbyname_r_proto'
23410 getnetent_r_proto='$getnetent_r_proto'
23411 getprotobyname_r_proto='$getprotobyname_r_proto'
23412 getprotobynumber_r_proto='$getprotobynumber_r_proto'
23413 getprotoent_r_proto='$getprotoent_r_proto'
23414 getpwent_r_proto='$getpwent_r_proto'
23415 getpwnam_r_proto='$getpwnam_r_proto'
23416 getpwuid_r_proto='$getpwuid_r_proto'
23417 getservbyname_r_proto='$getservbyname_r_proto'
23418 getservbyport_r_proto='$getservbyport_r_proto'
23419 getservent_r_proto='$getservent_r_proto'
23420 getspnam_r_proto='$getspnam_r_proto'
23421 gidformat='$gidformat'
23422 gidsign='$gidsign'
23423 gidsize='$gidsize'
23424 gidtype='$gidtype'
23425 glibpth='$glibpth'
23426 gmake='$gmake'
23427 gmtime_r_proto='$gmtime_r_proto'
23428 gnulibc_version='$gnulibc_version'
23429 grep='$grep'
23430 groupcat='$groupcat'
23431 groupstype='$groupstype'
23432 gzip='$gzip'
23433 h_fcntl='$h_fcntl'
23434 h_sysfile='$h_sysfile'
23435 hint='$hint'
23436 hostcat='$hostcat'
23437 html1dir='$html1dir'
23438 html1direxp='$html1direxp'
23439 html3dir='$html3dir'
23440 html3direxp='$html3direxp'
23441 i16size='$i16size'
23442 i16type='$i16type'
23443 i32size='$i32size'
23444 i32type='$i32type'
23445 i64size='$i64size'
23446 i64type='$i64type'
23447 i8size='$i8size'
23448 i8type='$i8type'
23449 i_arpainet='$i_arpainet'
23450 i_assert='$i_assert'
23451 i_bsdioctl='$i_bsdioctl'
23452 i_crypt='$i_crypt'
23453 i_db='$i_db'
23454 i_dbm='$i_dbm'
23455 i_dirent='$i_dirent'
23456 i_dld='$i_dld'
23457 i_dlfcn='$i_dlfcn'
23458 i_fcntl='$i_fcntl'
23459 i_float='$i_float'
23460 i_fp='$i_fp'
23461 i_fp_class='$i_fp_class'
23462 i_gdbm='$i_gdbm'
23463 i_gdbm_ndbm='$i_gdbm_ndbm'
23464 i_gdbmndbm='$i_gdbmndbm'
23465 i_grp='$i_grp'
23466 i_ieeefp='$i_ieeefp'
23467 i_inttypes='$i_inttypes'
23468 i_langinfo='$i_langinfo'
23469 i_libutil='$i_libutil'
23470 i_limits='$i_limits'
23471 i_locale='$i_locale'
23472 i_machcthr='$i_machcthr'
23473 i_malloc='$i_malloc'
23474 i_mallocmalloc='$i_mallocmalloc'
23475 i_math='$i_math'
23476 i_memory='$i_memory'
23477 i_mntent='$i_mntent'
23478 i_ndbm='$i_ndbm'
23479 i_netdb='$i_netdb'
23480 i_neterrno='$i_neterrno'
23481 i_netinettcp='$i_netinettcp'
23482 i_niin='$i_niin'
23483 i_poll='$i_poll'
23484 i_prot='$i_prot'
23485 i_pthread='$i_pthread'
23486 i_pwd='$i_pwd'
23487 i_rpcsvcdbm='$i_rpcsvcdbm'
23488 i_sfio='$i_sfio'
23489 i_sgtty='$i_sgtty'
23490 i_shadow='$i_shadow'
23491 i_socks='$i_socks'
23492 i_stdarg='$i_stdarg'
23493 i_stdbool='$i_stdbool'
23494 i_stddef='$i_stddef'
23495 i_stdlib='$i_stdlib'
23496 i_string='$i_string'
23497 i_sunmath='$i_sunmath'
23498 i_sysaccess='$i_sysaccess'
23499 i_sysdir='$i_sysdir'
23500 i_sysfile='$i_sysfile'
23501 i_sysfilio='$i_sysfilio'
23502 i_sysin='$i_sysin'
23503 i_sysioctl='$i_sysioctl'
23504 i_syslog='$i_syslog'
23505 i_sysmman='$i_sysmman'
23506 i_sysmode='$i_sysmode'
23507 i_sysmount='$i_sysmount'
23508 i_sysndir='$i_sysndir'
23509 i_sysparam='$i_sysparam'
23510 i_syspoll='$i_syspoll'
23511 i_sysresrc='$i_sysresrc'
23512 i_syssecrt='$i_syssecrt'
23513 i_sysselct='$i_sysselct'
23514 i_syssockio='$i_syssockio'
23515 i_sysstat='$i_sysstat'
23516 i_sysstatfs='$i_sysstatfs'
23517 i_sysstatvfs='$i_sysstatvfs'
23518 i_systime='$i_systime'
23519 i_systimek='$i_systimek'
23520 i_systimes='$i_systimes'
23521 i_systypes='$i_systypes'
23522 i_sysuio='$i_sysuio'
23523 i_sysun='$i_sysun'
23524 i_sysutsname='$i_sysutsname'
23525 i_sysvfs='$i_sysvfs'
23526 i_syswait='$i_syswait'
23527 i_termio='$i_termio'
23528 i_termios='$i_termios'
23529 i_time='$i_time'
23530 i_unistd='$i_unistd'
23531 i_ustat='$i_ustat'
23532 i_utime='$i_utime'
23533 i_values='$i_values'
23534 i_varargs='$i_varargs'
23535 i_varhdr='$i_varhdr'
23536 i_vfork='$i_vfork'
23537 ignore_versioned_solibs='$ignore_versioned_solibs'
23538 inc_version_list='$inc_version_list'
23539 inc_version_list_init='$inc_version_list_init'
23540 incpath='$incpath'
23541 inews='$inews'
23542 initialinstalllocation='$initialinstalllocation'
23543 installarchlib='$installarchlib'
23544 installbin='$installbin'
23545 installhtml1dir='$installhtml1dir'
23546 installhtml3dir='$installhtml3dir'
23547 installman1dir='$installman1dir'
23548 installman3dir='$installman3dir'
23549 installprefix='$installprefix'
23550 installprefixexp='$installprefixexp'
23551 installprivlib='$installprivlib'
23552 installscript='$installscript'
23553 installsitearch='$installsitearch'
23554 installsitebin='$installsitebin'
23555 installsitehtml1dir='$installsitehtml1dir'
23556 installsitehtml3dir='$installsitehtml3dir'
23557 installsitelib='$installsitelib'
23558 installsiteman1dir='$installsiteman1dir'
23559 installsiteman3dir='$installsiteman3dir'
23560 installsitescript='$installsitescript'
23561 installstyle='$installstyle'
23562 installusrbinperl='$installusrbinperl'
23563 installvendorarch='$installvendorarch'
23564 installvendorbin='$installvendorbin'
23565 installvendorhtml1dir='$installvendorhtml1dir'
23566 installvendorhtml3dir='$installvendorhtml3dir'
23567 installvendorlib='$installvendorlib'
23568 installvendorman1dir='$installvendorman1dir'
23569 installvendorman3dir='$installvendorman3dir'
23570 installvendorscript='$installvendorscript'
23571 intsize='$intsize'
23572 issymlink='$issymlink'
23573 ivdformat='$ivdformat'
23574 ivsize='$ivsize'
23575 ivtype='$ivtype'
23576 known_extensions='$known_extensions'
23577 ksh='$ksh'
23578 ld='$ld'
23579 ld_can_script='$ld_can_script'
23580 lddlflags='$lddlflags'
23581 ldflags='$ldflags'
23582 ldflags_uselargefiles='$ldflags_uselargefiles'
23583 ldlibpthname='$ldlibpthname'
23584 less='$less'
23585 lib_ext='$lib_ext'
23586 libc='$libc'
23587 libperl='$libperl'
23588 libpth='$libpth'
23589 libs='$libs'
23590 libsdirs='$libsdirs'
23591 libsfiles='$libsfiles'
23592 libsfound='$libsfound'
23593 libspath='$libspath'
23594 libswanted='$libswanted'
23595 libswanted_uselargefiles='$libswanted_uselargefiles'
23596 line='$line'
23597 lint='$lint'
23598 lkflags='$lkflags'
23599 ln='$ln'
23600 lns='$lns'
23601 localtime_r_proto='$localtime_r_proto'
23602 locincpth='$locincpth'
23603 loclibpth='$loclibpth'
23604 longdblsize='$longdblsize'
23605 longlongsize='$longlongsize'
23606 longsize='$longsize'
23607 lp='$lp'
23608 lpr='$lpr'
23609 ls='$ls'
23610 lseeksize='$lseeksize'
23611 lseektype='$lseektype'
23612 mad='$mad'
23613 madlyh='$madlyh'
23614 madlyobj='$madlyobj'
23615 madlysrc='$madlysrc'
23616 mail='$mail'
23617 mailx='$mailx'
23618 make='$make'
23619 make_set_make='$make_set_make'
23620 mallocobj='$mallocobj'
23621 mallocsrc='$mallocsrc'
23622 malloctype='$malloctype'
23623 man1dir='$man1dir'
23624 man1direxp='$man1direxp'
23625 man1ext='$man1ext'
23626 man3dir='$man3dir'
23627 man3direxp='$man3direxp'
23628 man3ext='$man3ext'
23629 mips_type='$mips_type'
23630 mistrustnm='$mistrustnm'
23631 mkdir='$mkdir'
23632 mmaptype='$mmaptype'
23633 modetype='$modetype'
23634 more='$more'
23635 multiarch='$multiarch'
23636 mv='$mv'
23637 myarchname='$myarchname'
23638 mydomain='$mydomain'
23639 myhostname='$myhostname'
23640 myuname='$myuname'
23641 n='$n'
23642 need_va_copy='$need_va_copy'
23643 netdb_hlen_type='$netdb_hlen_type'
23644 netdb_host_type='$netdb_host_type'
23645 netdb_name_type='$netdb_name_type'
23646 netdb_net_type='$netdb_net_type'
23647 nm='$nm'
23648 nm_opt='$nm_opt'
23649 nm_so_opt='$nm_so_opt'
23650 nonxs_ext='$nonxs_ext'
23651 nroff='$nroff'
23652 nvEUformat='$nvEUformat'
23653 nvFUformat='$nvFUformat'
23654 nvGUformat='$nvGUformat'
23655 nv_overflows_integers_at='$nv_overflows_integers_at'
23656 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23657 nveformat='$nveformat'
23658 nvfformat='$nvfformat'
23659 nvgformat='$nvgformat'
23660 nvsize='$nvsize'
23661 nvtype='$nvtype'
23662 o_nonblock='$o_nonblock'
23663 obj_ext='$obj_ext'
23664 old_pthread_create_joinable='$old_pthread_create_joinable'
23665 optimize='$optimize'
23666 orderlib='$orderlib'
23667 osname='$osname'
23668 osvers='$osvers'
23669 otherlibdirs='$otherlibdirs'
23670 package='$package'
23671 pager='$pager'
23672 passcat='$passcat'
23673 patchlevel='$patchlevel'
23674 path_sep='$path_sep'
23675 perl5='$perl5'
23676 perl='$perl'
23677 perl_patchlevel='$perl_patchlevel'
23678 perl_static_inline='$perl_static_inline'
23679 perladmin='$perladmin'
23680 perllibs='$perllibs'
23681 perlpath='$perlpath'
23682 pg='$pg'
23683 phostname='$phostname'
23684 pidtype='$pidtype'
23685 plibpth='$plibpth'
23686 pmake='$pmake'
23687 pr='$pr'
23688 prefix='$prefix'
23689 prefixexp='$prefixexp'
23690 privlib='$privlib'
23691 privlibexp='$privlibexp'
23692 procselfexe='$procselfexe'
23693 prototype='$prototype'
23694 ptrsize='$ptrsize'
23695 quadkind='$quadkind'
23696 quadtype='$quadtype'
23697 randbits='$randbits'
23698 randfunc='$randfunc'
23699 random_r_proto='$random_r_proto'
23700 randseedtype='$randseedtype'
23701 ranlib='$ranlib'
23702 rd_nodata='$rd_nodata'
23703 readdir64_r_proto='$readdir64_r_proto'
23704 readdir_r_proto='$readdir_r_proto'
23705 revision='$revision'
23706 rm='$rm'
23707 rm_try='$rm_try'
23708 rmail='$rmail'
23709 run='$run'
23710 runnm='$runnm'
23711 sGMTIME_max='$sGMTIME_max'
23712 sGMTIME_min='$sGMTIME_min'
23713 sLOCALTIME_max='$sLOCALTIME_max'
23714 sLOCALTIME_min='$sLOCALTIME_min'
23715 sPRIEUldbl='$sPRIEUldbl'
23716 sPRIFUldbl='$sPRIFUldbl'
23717 sPRIGUldbl='$sPRIGUldbl'
23718 sPRIXU64='$sPRIXU64'
23719 sPRId64='$sPRId64'
23720 sPRIeldbl='$sPRIeldbl'
23721 sPRIfldbl='$sPRIfldbl'
23722 sPRIgldbl='$sPRIgldbl'
23723 sPRIi64='$sPRIi64'
23724 sPRIo64='$sPRIo64'
23725 sPRIu64='$sPRIu64'
23726 sPRIx64='$sPRIx64'
23727 sSCNfldbl='$sSCNfldbl'
23728 sched_yield='$sched_yield'
23729 scriptdir='$scriptdir'
23730 scriptdirexp='$scriptdirexp'
23731 sed='$sed'
23732 seedfunc='$seedfunc'
23733 selectminbits='$selectminbits'
23734 selecttype='$selecttype'
23735 sendmail='$sendmail'
23736 setgrent_r_proto='$setgrent_r_proto'
23737 sethostent_r_proto='$sethostent_r_proto'
23738 setlocale_r_proto='$setlocale_r_proto'
23739 setnetent_r_proto='$setnetent_r_proto'
23740 setprotoent_r_proto='$setprotoent_r_proto'
23741 setpwent_r_proto='$setpwent_r_proto'
23742 setservent_r_proto='$setservent_r_proto'
23743 sh='$sh'
23744 shar='$shar'
23745 sharpbang='$sharpbang'
23746 shmattype='$shmattype'
23747 shortsize='$shortsize'
23748 shrpenv='$shrpenv'
23749 shsharp='$shsharp'
23750 sig_count='$sig_count'
23751 sig_name='$sig_name'
23752 sig_name_init='$sig_name_init'
23753 sig_num='$sig_num'
23754 sig_num_init='$sig_num_init'
23755 sig_size='$sig_size'
23756 signal_t='$signal_t'
23757 sitearch='$sitearch'
23758 sitearchexp='$sitearchexp'
23759 sitebin='$sitebin'
23760 sitebinexp='$sitebinexp'
23761 sitehtml1dir='$sitehtml1dir'
23762 sitehtml1direxp='$sitehtml1direxp'
23763 sitehtml3dir='$sitehtml3dir'
23764 sitehtml3direxp='$sitehtml3direxp'
23765 sitelib='$sitelib'
23766 sitelib_stem='$sitelib_stem'
23767 sitelibexp='$sitelibexp'
23768 siteman1dir='$siteman1dir'
23769 siteman1direxp='$siteman1direxp'
23770 siteman3dir='$siteman3dir'
23771 siteman3direxp='$siteman3direxp'
23772 siteprefix='$siteprefix'
23773 siteprefixexp='$siteprefixexp'
23774 sitescript='$sitescript'
23775 sitescriptexp='$sitescriptexp'
23776 sizesize='$sizesize'
23777 sizetype='$sizetype'
23778 sleep='$sleep'
23779 smail='$smail'
23780 so='$so'
23781 sockethdr='$sockethdr'
23782 socketlib='$socketlib'
23783 socksizetype='$socksizetype'
23784 sort='$sort'
23785 spackage='$spackage'
23786 spitshell='$spitshell'
23787 srand48_r_proto='$srand48_r_proto'
23788 srandom_r_proto='$srandom_r_proto'
23789 src='$src'
23790 ssizetype='$ssizetype'
23791 st_ino_sign='$st_ino_sign'
23792 st_ino_size='$st_ino_size'
23793 startperl='$startperl'
23794 startsh='$startsh'
23795 static_ext='$static_ext'
23796 stdchar='$stdchar'
23797 stdio_base='$stdio_base'
23798 stdio_bufsiz='$stdio_bufsiz'
23799 stdio_cnt='$stdio_cnt'
23800 stdio_filbuf='$stdio_filbuf'
23801 stdio_ptr='$stdio_ptr'
23802 stdio_stream_array='$stdio_stream_array'
23803 strerror_r_proto='$strerror_r_proto'
23804 strings='$strings'
23805 submit='$submit'
23806 subversion='$subversion'
23807 sysman='$sysman'
23808 tail='$tail'
23809 tar='$tar'
23810 targetarch='$targetarch'
23811 tbl='$tbl'
23812 tee='$tee'
23813 test='$test'
23814 timeincl='$timeincl'
23815 timetype='$timetype'
23816 tmpnam_r_proto='$tmpnam_r_proto'
23817 to='$to'
23818 touch='$touch'
23819 tr='$tr'
23820 trnl='$trnl'
23821 troff='$troff'
23822 ttyname_r_proto='$ttyname_r_proto'
23823 u16size='$u16size'
23824 u16type='$u16type'
23825 u32size='$u32size'
23826 u32type='$u32type'
23827 u64size='$u64size'
23828 u64type='$u64type'
23829 u8size='$u8size'
23830 u8type='$u8type'
23831 uidformat='$uidformat'
23832 uidsign='$uidsign'
23833 uidsize='$uidsize'
23834 uidtype='$uidtype'
23835 uname='$uname'
23836 uniq='$uniq'
23837 uquadtype='$uquadtype'
23838 use5005threads='$use5005threads'
23839 use64bitall='$use64bitall'
23840 use64bitint='$use64bitint'
23841 usecrosscompile='$usecrosscompile'
23842 usedevel='$usedevel'
23843 usedl='$usedl'
23844 usedtrace='$usedtrace'
23845 usefaststdio='$usefaststdio'
23846 useithreads='$useithreads'
23847 usekernprocpathname='$usekernprocpathname'
23848 uselargefiles='$uselargefiles'
23849 uselongdouble='$uselongdouble'
23850 usemallocwrap='$usemallocwrap'
23851 usemorebits='$usemorebits'
23852 usemultiplicity='$usemultiplicity'
23853 usemymalloc='$usemymalloc'
23854 usenm='$usenm'
23855 usensgetexecutablepath='$usensgetexecutablepath'
23856 useopcode='$useopcode'
23857 useperlio='$useperlio'
23858 useposix='$useposix'
23859 usereentrant='$usereentrant'
23860 userelocatableinc='$userelocatableinc'
23861 usesfio='$usesfio'
23862 useshrplib='$useshrplib'
23863 usesitecustomize='$usesitecustomize'
23864 usesocks='$usesocks'
23865 usethreads='$usethreads'
23866 usevendorprefix='$usevendorprefix'
23867 usevfork='$usevfork'
23868 usrinc='$usrinc'
23869 uuname='$uuname'
23870 uvXUformat='$uvXUformat'
23871 uvoformat='$uvoformat'
23872 uvsize='$uvsize'
23873 uvtype='$uvtype'
23874 uvuformat='$uvuformat'
23875 uvxformat='$uvxformat'
23876 vaproto='$vaproto'
23877 vendorarch='$vendorarch'
23878 vendorarchexp='$vendorarchexp'
23879 vendorbin='$vendorbin'
23880 vendorbinexp='$vendorbinexp'
23881 vendorhtml1dir='$vendorhtml1dir'
23882 vendorhtml1direxp='$vendorhtml1direxp'
23883 vendorhtml3dir='$vendorhtml3dir'
23884 vendorhtml3direxp='$vendorhtml3direxp'
23885 vendorlib='$vendorlib'
23886 vendorlib_stem='$vendorlib_stem'
23887 vendorlibexp='$vendorlibexp'
23888 vendorman1dir='$vendorman1dir'
23889 vendorman1direxp='$vendorman1direxp'
23890 vendorman3dir='$vendorman3dir'
23891 vendorman3direxp='$vendorman3direxp'
23892 vendorprefix='$vendorprefix'
23893 vendorprefixexp='$vendorprefixexp'
23894 vendorscript='$vendorscript'
23895 vendorscriptexp='$vendorscriptexp'
23896 version='$version'
23897 version_patchlevel_string='$version_patchlevel_string'
23898 versiononly='$versiononly'
23899 vi='$vi'
23900 voidflags='$voidflags'
23901 xlibpth='$xlibpth'
23902 yacc='$yacc'
23903 yaccflags='$yaccflags'
23904 zcat='$zcat'
23905 zip='$zip'
23906 EOT
23907
23908 : add special variables
23909 $test -f $src/patchlevel.h && \
23910 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23911 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23912 echo "PERL_CONFIG_SH=true" >>config.sh
23913
23914 : propagate old symbols
23915 if $test -f UU/config.sh; then
23916         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23917         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23918                 config.sh config.sh UU/oldconfig.sh |\
23919                 $sort | $uniq -u >UU/oldsyms
23920         set X `$cat UU/oldsyms`
23921         shift
23922         case $# in
23923         0) ;;
23924         *)
23925                 $cat <<EOM
23926 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23927 EOM
23928                 echo ": Variables propagated from previous config.sh file." >>config.sh
23929                 for sym in `$cat UU/oldsyms`; do
23930                         echo "    Propagating $hint variable "'$'"$sym..."
23931                         eval 'tmp="$'"${sym}"'"'
23932                         echo "$tmp" | \
23933                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23934                 done
23935                 ;;
23936         esac
23937 fi
23938
23939 : Finish up by extracting the .SH files
23940 case "$alldone" in
23941 exit)
23942         $rm -rf UU
23943         echo "Extraction done."
23944         exit 0
23945         ;;
23946 cont)
23947         ;;
23948 '')
23949         dflt=''
23950         nostick=true
23951         $cat <<EOM
23952
23953 If you'd like to make any changes to the config.sh file before I begin
23954 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23955
23956 EOM
23957         rp="Press return or use a shell escape to edit config.sh:"
23958         . UU/myread
23959         nostick=''
23960         case "$ans" in
23961         '') ;;
23962         *) : in case they cannot read
23963                 sh 1>&4 -c "$ans";;
23964         esac
23965         ;;
23966 esac
23967
23968 : if this fails, just run all the .SH files by hand
23969 . ./config.sh
23970
23971 echo " "
23972 exec 1>&4
23973 pwd=`pwd`
23974 . ./UU/extract
23975 cd "$pwd"
23976
23977 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23978         dflt=y
23979         case "$silent" in
23980         true) ;;
23981         *)
23982                 $cat <<EOM
23983
23984 Now you need to generate make dependencies by running "$make depend".
23985 You might prefer to run it in background: "$make depend > makedepend.out &"
23986 It can take a while, so you might not want to run it right now.
23987
23988 EOM
23989                 ;;
23990         esac
23991         rp="Run $make depend now?"
23992         . UU/myread
23993         case "$ans" in
23994         y*)
23995                 $make depend && echo "Now you must run '$make'."
23996                 ;;
23997         *)
23998                 echo "You must run '$make depend' then '$make'."
23999                 ;;
24000         esac
24001 elif test -f [Mm]akefile; then
24002         echo " "
24003         echo "Now you must run a $make."
24004 else
24005         echo "Configure done."
24006 fi
24007
24008 if $test -f Policy.sh; then
24009     $cat <<EOM
24010
24011 If you compile $package on a different machine or from a different object
24012 directory, copy the Policy.sh file from this object directory to the
24013 new one before you run Configure -- this will help you with most of
24014 the policy defaults.
24015
24016 EOM
24017 fi
24018 if $test -f config.msg; then
24019     echo "Hmm.  I also noted the following information while running:"
24020     echo " "
24021     $cat config.msg >&4
24022     $rm -f config.msg
24023 fi
24024 $rm -f kit*isdone ark*isdone
24025 $rm -rf UU
24026
24027 : End of Configure
24028