This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update CPAN tracking version of ExtUtils::ParseXS
[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 Jul 31 12:11:29 CEST 2011 [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_isfinite=''
569 d_isinf=''
570 d_isnan=''
571 d_isnanl=''
572 d_killpg=''
573 d_lchown=''
574 d_ldbl_dig=''
575 d_libm_lib_version=''
576 d_link=''
577 d_localtime_r=''
578 d_localtime_r_needs_tzset=''
579 localtime_r_proto=''
580 d_locconv=''
581 d_lockf=''
582 d_longdbl=''
583 longdblsize=''
584 d_longlong=''
585 longlongsize=''
586 d_lseekproto=''
587 d_lstat=''
588 d_madvise=''
589 d_malloc_good_size=''
590 d_malloc_size=''
591 d_mblen=''
592 d_mbstowcs=''
593 d_mbtowc=''
594 d_memchr=''
595 d_memcmp=''
596 d_memcpy=''
597 d_memmove=''
598 d_memset=''
599 d_mkdir=''
600 d_mkdtemp=''
601 d_mkfifo=''
602 d_mkstemp=''
603 d_mkstemps=''
604 d_mktime=''
605 d_mmap=''
606 mmaptype=''
607 d_modfl=''
608 d_modfl_pow32_bug=''
609 d_modflproto=''
610 d_mprotect=''
611 d_msg=''
612 d_msgctl=''
613 d_msgget=''
614 d_msghdr_s=''
615 d_msgrcv=''
616 d_msgsnd=''
617 d_msync=''
618 d_munmap=''
619 d_nice=''
620 d_nl_langinfo=''
621 d_off64_t=''
622 d_open3=''
623 d_fpathconf=''
624 d_pathconf=''
625 d_pause=''
626 d_pipe=''
627 d_poll=''
628 d_portable=''
629 d_prctl=''
630 d_prctl_set_name=''
631 d_procselfexe=''
632 procselfexe=''
633 d_old_pthread_create_joinable=''
634 old_pthread_create_joinable=''
635 d_pthread_atfork=''
636 d_pthread_attr_setscope=''
637 d_pthread_yield=''
638 d_sched_yield=''
639 sched_yield=''
640 d_qgcvt=''
641 d_random_r=''
642 random_r_proto=''
643 d_readdir64_r=''
644 readdir64_r_proto=''
645 d_readdir=''
646 d_rewinddir=''
647 d_seekdir=''
648 d_telldir=''
649 d_readdir_r=''
650 readdir_r_proto=''
651 d_readlink=''
652 d_readv=''
653 d_recvmsg=''
654 d_rename=''
655 d_rmdir=''
656 d_safebcpy=''
657 d_safemcpy=''
658 d_sanemcmp=''
659 d_sbrkproto=''
660 d_scalbnl=''
661 d_select=''
662 d_sem=''
663 d_semctl=''
664 d_semget=''
665 d_semop=''
666 d_sendmsg=''
667 d_setegid=''
668 d_seteuid=''
669 d_setgrent=''
670 d_setgrent_r=''
671 setgrent_r_proto=''
672 d_setgrps=''
673 d_sethent=''
674 d_sethostent_r=''
675 sethostent_r_proto=''
676 d_setitimer=''
677 d_setlinebuf=''
678 d_setlocale=''
679 d_setlocale_r=''
680 setlocale_r_proto=''
681 d_setnent=''
682 d_setnetent_r=''
683 setnetent_r_proto=''
684 d_setpent=''
685 d_setpgid=''
686 d_setpgrp2=''
687 d_bsdsetpgrp=''
688 d_setpgrp=''
689 d_setprior=''
690 d_setproctitle=''
691 d_setprotoent_r=''
692 setprotoent_r_proto=''
693 d_setpwent=''
694 d_setpwent_r=''
695 setpwent_r_proto=''
696 d_setregid=''
697 d_setresgid=''
698 d_setresuid=''
699 d_setreuid=''
700 d_setrgid=''
701 d_setruid=''
702 d_setsent=''
703 d_setservent_r=''
704 setservent_r_proto=''
705 d_setsid=''
706 d_setvbuf=''
707 d_sfio=''
708 usesfio=''
709 d_shm=''
710 d_shmat=''
711 d_shmatprototype=''
712 shmattype=''
713 d_shmctl=''
714 d_shmdt=''
715 d_shmget=''
716 d_sigaction=''
717 d_signbit=''
718 d_sigprocmask=''
719 d_sigsetjmp=''
720 usesitecustomize=''
721 d_snprintf=''
722 d_vsnprintf=''
723 d_sockatmark=''
724 d_sockatmarkproto=''
725 d_msg_ctrunc=''
726 d_msg_dontroute=''
727 d_msg_oob=''
728 d_msg_peek=''
729 d_msg_proxy=''
730 d_oldsock=''
731 d_scm_rights=''
732 d_sin6_scope_id=''
733 d_sockaddr_sa_len=''
734 d_socket=''
735 d_sockpair=''
736 sockethdr=''
737 socketlib=''
738 d_socklen_t=''
739 d_socks5_init=''
740 d_sprintf_returns_strlen=''
741 d_sqrtl=''
742 d_srand48_r=''
743 srand48_r_proto=''
744 d_srandom_r=''
745 srandom_r_proto=''
746 d_sresgproto=''
747 d_sresuproto=''
748 d_statblks=''
749 d_statfs_f_flags=''
750 d_statfs_s=''
751 d_static_inline=''
752 perl_static_inline=''
753 d_fstatvfs=''
754 d_statvfs=''
755 d_stdio_cnt_lval=''
756 d_stdio_ptr_lval=''
757 d_stdio_ptr_lval_nochange_cnt=''
758 d_stdio_ptr_lval_sets_cnt=''
759 d_stdiobase=''
760 d_stdstdio=''
761 stdio_base=''
762 stdio_bufsiz=''
763 stdio_cnt=''
764 stdio_filbuf=''
765 stdio_ptr=''
766 d_index=''
767 d_strchr=''
768 d_strcoll=''
769 d_strctcpy=''
770 d_strerrm=''
771 d_strerror=''
772 d_sysernlst=''
773 d_syserrlst=''
774 d_strerror_r=''
775 strerror_r_proto=''
776 d_strftime=''
777 d_strlcat=''
778 d_strlcpy=''
779 d_strtod=''
780 d_strtol=''
781 d_strtold=''
782 d_strtoll=''
783 d_strtoq=''
784 d_strtoul=''
785 d_strtoull=''
786 d_strtouq=''
787 d_strxfrm=''
788 d_symlink=''
789 d_syscall=''
790 d_syscallproto=''
791 d_sysconf=''
792 d_system=''
793 d_tcgetpgrp=''
794 d_tcsetpgrp=''
795 d_telldirproto=''
796 d_time=''
797 timetype=''
798 d_asctime64=''
799 d_ctime64=''
800 d_difftime64=''
801 d_gmtime64=''
802 d_localtime64=''
803 d_mktime64=''
804 d_timegm=''
805 clocktype=''
806 d_times=''
807 d_tmpnam_r=''
808 tmpnam_r_proto=''
809 d_truncate=''
810 d_ttyname_r=''
811 ttyname_r_proto=''
812 d_tzname=''
813 d_u32align=''
814 d_ualarm=''
815 d_umask=''
816 d_semctl_semid_ds=''
817 d_semctl_semun=''
818 d_union_semun=''
819 d_unordered=''
820 d_unsetenv=''
821 d_usleep=''
822 d_usleepproto=''
823 d_ustat=''
824 d_pseudofork=''
825 d_vfork=''
826 usevfork=''
827 d_voidsig=''
828 signal_t=''
829 d_volatile=''
830 d_charvspr=''
831 d_vprintf=''
832 d_wait4=''
833 d_waitpid=''
834 d_wcstombs=''
835 d_wctomb=''
836 d_writev=''
837 dlext=''
838 bin_ELF=''
839 cccdlflags=''
840 ccdlflags=''
841 dlsrc=''
842 ld=''
843 lddlflags=''
844 usedl=''
845 doublesize=''
846 ebcdic=''
847 fflushNULL=''
848 fflushall=''
849 fpossize=''
850 fpostype=''
851 gccansipedantic=''
852 gccosandvers=''
853 gccversion=''
854 gidformat=''
855 gidsign=''
856 gidsize=''
857 gidtype=''
858 groupstype=''
859 h_fcntl=''
860 h_sysfile=''
861 html1dir=''
862 html1direxp=''
863 installhtml1dir=''
864 html3dir=''
865 html3direxp=''
866 installhtml3dir=''
867 i_arpainet=''
868 i_assert=''
869 i_crypt=''
870 db_hashtype=''
871 db_prefixtype=''
872 db_version_major=''
873 db_version_minor=''
874 db_version_patch=''
875 i_db=''
876 i_dbm=''
877 i_rpcsvcdbm=''
878 d_dirnamlen=''
879 direntrytype=''
880 i_dirent=''
881 i_dld=''
882 i_dlfcn=''
883 i_fcntl=''
884 i_float=''
885 i_fp=''
886 i_fp_class=''
887 i_gdbm=''
888 d_grpasswd=''
889 i_grp=''
890 i_ieeefp=''
891 i_inttypes=''
892 i_langinfo=''
893 i_libutil=''
894 i_limits=''
895 i_locale=''
896 i_machcthr=''
897 i_malloc=''
898 i_mallocmalloc=''
899 i_math=''
900 i_memory=''
901 i_mntent=''
902 d_gdbm_ndbm_h_uses_prototypes=''
903 d_gdbmndbm_h_uses_prototypes=''
904 d_ndbm=''
905 d_ndbm_h_uses_prototypes=''
906 i_gdbm_ndbm=''
907 i_gdbmndbm=''
908 i_ndbm=''
909 i_netdb=''
910 i_neterrno=''
911 i_netinettcp=''
912 i_niin=''
913 i_sysin=''
914 i_poll=''
915 i_prot=''
916 i_pthread=''
917 d_pwage=''
918 d_pwchange=''
919 d_pwclass=''
920 d_pwcomment=''
921 d_pwexpire=''
922 d_pwgecos=''
923 d_pwpasswd=''
924 d_pwquota=''
925 i_pwd=''
926 i_sfio=''
927 i_shadow=''
928 i_socks=''
929 i_stddef=''
930 i_stdlib=''
931 i_string=''
932 strings=''
933 i_sunmath=''
934 i_sysaccess=''
935 i_sysdir=''
936 i_sysfile=''
937 d_voidtty=''
938 i_bsdioctl=''
939 i_sysfilio=''
940 i_sysioctl=''
941 i_syssockio=''
942 i_syslog=''
943 i_sysmman=''
944 i_sysmode=''
945 i_sysmount=''
946 i_sysndir=''
947 i_sysparam=''
948 i_syspoll=''
949 i_sysresrc=''
950 i_syssecrt=''
951 i_sysselct=''
952 i_sysstat=''
953 i_sysstatfs=''
954 i_sysstatvfs=''
955 i_systimes=''
956 i_systypes=''
957 i_sysuio=''
958 i_sysun=''
959 i_sysutsname=''
960 i_sysvfs=''
961 i_syswait=''
962 i_sgtty=''
963 i_termio=''
964 i_termios=''
965 d_tm_tm_gmtoff=''
966 d_tm_tm_zone=''
967 i_systime=''
968 i_systimek=''
969 i_time=''
970 timeincl=''
971 i_unistd=''
972 i_ustat=''
973 i_utime=''
974 i_values=''
975 i_stdarg=''
976 i_varargs=''
977 i_varhdr=''
978 i_vfork=''
979 d_inc_version_list=''
980 inc_version_list=''
981 inc_version_list_init=''
982 installprefix=''
983 installprefixexp=''
984 installstyle=''
985 installusrbinperl=''
986 intsize=''
987 longsize=''
988 shortsize=''
989 issymlink=''
990 libc=''
991 ldlibpthname=''
992 libperl=''
993 shrpenv=''
994 useshrplib=''
995 glibpth=''
996 libpth=''
997 loclibpth=''
998 plibpth=''
999 xlibpth=''
1000 ignore_versioned_solibs=''
1001 libs=''
1002 libsdirs=''
1003 libsfiles=''
1004 libsfound=''
1005 libspath=''
1006 lns=''
1007 d_PRIEUldbl=''
1008 d_PRIFUldbl=''
1009 d_PRIGUldbl=''
1010 d_PRIeldbl=''
1011 d_PRIfldbl=''
1012 d_PRIgldbl=''
1013 d_SCNfldbl=''
1014 sPRIEUldbl=''
1015 sPRIFUldbl=''
1016 sPRIGUldbl=''
1017 sPRIeldbl=''
1018 sPRIfldbl=''
1019 sPRIgldbl=''
1020 sSCNfldbl=''
1021 lseeksize=''
1022 lseektype=''
1023 mad=''
1024 madlyh=''
1025 madlyobj=''
1026 madlysrc=''
1027 make_set_make=''
1028 d_mymalloc=''
1029 freetype=''
1030 mallocobj=''
1031 mallocsrc=''
1032 malloctype=''
1033 usemallocwrap=''
1034 usemymalloc=''
1035 installman1dir=''
1036 man1dir=''
1037 man1direxp=''
1038 man1ext=''
1039 installman3dir=''
1040 man3dir=''
1041 man3direxp=''
1042 man3ext=''
1043 modetype=''
1044 multiarch=''
1045 mydomain=''
1046 myhostname=''
1047 phostname=''
1048 c=''
1049 n=''
1050 d_eofnblk=''
1051 eagain=''
1052 o_nonblock=''
1053 rd_nodata=''
1054 need_va_copy=''
1055 netdb_hlen_type=''
1056 netdb_host_type=''
1057 netdb_name_type=''
1058 netdb_net_type=''
1059 groupcat=''
1060 hostcat=''
1061 passcat=''
1062 orderlib=''
1063 ranlib=''
1064 d_perl_otherlibdirs=''
1065 otherlibdirs=''
1066 package=''
1067 spackage=''
1068 pager=''
1069 api_revision=''
1070 api_subversion=''
1071 api_version=''
1072 api_versionstring=''
1073 patchlevel=''
1074 perl_patchlevel=''
1075 revision=''
1076 subversion=''
1077 version=''
1078 version_patchlevel_string=''
1079 perl5=''
1080 perladmin=''
1081 perlpath=''
1082 d_nv_preserves_uv=''
1083 d_nv_zero_is_allbits_zero=''
1084 i16size=''
1085 i16type=''
1086 i32size=''
1087 i32type=''
1088 i64size=''
1089 i64type=''
1090 i8size=''
1091 i8type=''
1092 ivsize=''
1093 ivtype=''
1094 nv_overflows_integers_at=''
1095 nv_preserves_uv_bits=''
1096 nvsize=''
1097 nvtype=''
1098 u16size=''
1099 u16type=''
1100 u32size=''
1101 u32type=''
1102 u64size=''
1103 u64type=''
1104 u8size=''
1105 u8type=''
1106 uvsize=''
1107 uvtype=''
1108 ivdformat=''
1109 nvEUformat=''
1110 nvFUformat=''
1111 nvGUformat=''
1112 nveformat=''
1113 nvfformat=''
1114 nvgformat=''
1115 uvXUformat=''
1116 uvoformat=''
1117 uvuformat=''
1118 uvxformat=''
1119 pidtype=''
1120 prefix=''
1121 prefixexp=''
1122 installprivlib=''
1123 privlib=''
1124 privlibexp=''
1125 prototype=''
1126 ptrsize=''
1127 d_PRIXU64=''
1128 d_PRId64=''
1129 d_PRIi64=''
1130 d_PRIo64=''
1131 d_PRIu64=''
1132 d_PRIx64=''
1133 sPRIXU64=''
1134 sPRId64=''
1135 sPRIi64=''
1136 sPRIo64=''
1137 sPRIu64=''
1138 sPRIx64=''
1139 d_quad=''
1140 quadkind=''
1141 quadtype=''
1142 uquadtype=''
1143 drand01=''
1144 randbits=''
1145 randfunc=''
1146 randseedtype=''
1147 seedfunc=''
1148 installscript=''
1149 scriptdir=''
1150 scriptdirexp=''
1151 selectminbits=''
1152 selecttype=''
1153 sh=''
1154 sig_count=''
1155 sig_name=''
1156 sig_name_init=''
1157 sig_num=''
1158 sig_num_init=''
1159 sig_size=''
1160 d_sitearch=''
1161 installsitearch=''
1162 sitearch=''
1163 sitearchexp=''
1164 installsitebin=''
1165 sitebin=''
1166 sitebinexp=''
1167 installsitehtml1dir=''
1168 sitehtml1dir=''
1169 sitehtml1direxp=''
1170 installsitehtml3dir=''
1171 sitehtml3dir=''
1172 sitehtml3direxp=''
1173 installsitelib=''
1174 sitelib=''
1175 sitelib_stem=''
1176 sitelibexp=''
1177 installsiteman1dir=''
1178 siteman1dir=''
1179 siteman1direxp=''
1180 installsiteman3dir=''
1181 siteman3dir=''
1182 siteman3direxp=''
1183 siteprefix=''
1184 siteprefixexp=''
1185 installsitescript=''
1186 sitescript=''
1187 sitescriptexp=''
1188 sizesize=''
1189 sizetype=''
1190 so=''
1191 socksizetype=''
1192 sharpbang=''
1193 shsharp=''
1194 spitshell=''
1195 src=''
1196 ssizetype=''
1197 st_ino_sign=''
1198 st_ino_size=''
1199 startperl=''
1200 startsh=''
1201 stdchar=''
1202 d_stdio_stream_array=''
1203 stdio_stream_array=''
1204 sysman=''
1205 sGMTIME_max=''
1206 sGMTIME_min=''
1207 sLOCALTIME_max=''
1208 sLOCALTIME_min=''
1209 trnl=''
1210 uidformat=''
1211 uidsign=''
1212 uidsize=''
1213 uidtype=''
1214 archname64=''
1215 use64bitall=''
1216 use64bitint=''
1217 dtrace=''
1218 usedtrace=''
1219 usefaststdio=''
1220 ccflags_uselargefiles=''
1221 ldflags_uselargefiles=''
1222 libswanted_uselargefiles=''
1223 uselargefiles=''
1224 uselongdouble=''
1225 usemorebits=''
1226 usemultiplicity=''
1227 nm_opt=''
1228 nm_so_opt=''
1229 runnm=''
1230 usenm=''
1231 useperlio=''
1232 usesocks=''
1233 d_oldpthreads=''
1234 use5005threads=''
1235 useithreads=''
1236 usereentrant=''
1237 usethreads=''
1238 incpath=''
1239 mips_type=''
1240 usrinc=''
1241 vaproto=''
1242 d_vendorarch=''
1243 installvendorarch=''
1244 vendorarch=''
1245 vendorarchexp=''
1246 d_vendorbin=''
1247 installvendorbin=''
1248 vendorbin=''
1249 vendorbinexp=''
1250 installvendorhtml1dir=''
1251 vendorhtml1dir=''
1252 vendorhtml1direxp=''
1253 installvendorhtml3dir=''
1254 vendorhtml3dir=''
1255 vendorhtml3direxp=''
1256 d_vendorlib=''
1257 installvendorlib=''
1258 vendorlib=''
1259 vendorlib_stem=''
1260 vendorlibexp=''
1261 installvendorman1dir=''
1262 vendorman1dir=''
1263 vendorman1direxp=''
1264 installvendorman3dir=''
1265 vendorman3dir=''
1266 vendorman3direxp=''
1267 usevendorprefix=''
1268 vendorprefix=''
1269 vendorprefixexp=''
1270 d_vendorscript=''
1271 installvendorscript=''
1272 vendorscript=''
1273 vendorscriptexp=''
1274 versiononly=''
1275 defvoidused=''
1276 voidflags=''
1277 yacc=''
1278 yaccflags=''
1279 CONFIG=''
1280
1281 : Detect odd OSs
1282 define='define'
1283 undef='undef'
1284 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1285 rmlist=''
1286
1287 : We must find out about Eunice early
1288 eunicefix=':'
1289 if test -f /etc/unixtovms; then
1290         eunicefix=/etc/unixtovms
1291 fi
1292 if test -f /etc/unixtovms.exe; then
1293         eunicefix=/etc/unixtovms.exe
1294 fi
1295
1296 : Set executable suffix now -- needed before hints available
1297 if test -f "/libs/version.library"; then
1298 : Amiga OS
1299     _exe=""
1300 elif test -f "/system/gnu_library/bin/ar.pm"; then
1301 : Stratus VOS
1302     _exe=".pm"
1303 elif test -n "$DJGPP"; then
1304 : DOS DJGPP
1305     _exe=".exe"
1306 elif test -d c:/. -o -n "$is_os2" ; then
1307 : OS/2 or cygwin
1308     _exe=".exe"
1309 fi
1310
1311 groupstype=''
1312 i_whoami=''
1313 archname=''
1314 : Possible local include directories to search.
1315 : Set locincpth to "" in a hint file to defeat local include searches.
1316 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1317 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1318 :
1319 : no include file wanted by default
1320 inclwanted=''
1321
1322 : Enable -DEBUGGING and -DDEBUGGING from the command line
1323 EBUGGING=''
1324 DEBUGGING=''
1325
1326 : set usethreads on the Configure command line to enable threads.
1327 usereentrant='undef'
1328 : Trailing extension.  Override this in a hint file, if needed.
1329 : Extra object files, if any, needed on this platform.
1330 archobjs=''
1331 libnames=''
1332 : change the next line if compiling for Xenix/286 on Xenix/386
1333 xlibpth='/usr/lib/386 /lib/386'
1334 : Possible local library directories to search.
1335 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1336 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1337
1338 : general looking path for locating libraries
1339 glibpth="/lib /usr/lib $xlibpth"
1340 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1341 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1342 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1343 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1344
1345 : Private path used by Configure to find libraries.  Its value
1346 : is prepended to libpth. This variable takes care of special
1347 : machines, like the mips.  Usually, it should be empty.
1348 plibpth=''
1349
1350 : default library list
1351 libswanted=''
1352 : some systems want to use only the non-versioned libso:s
1353 ignore_versioned_solibs=''
1354 : full support for void wanted by default
1355 defvoidused=15
1356
1357 ccname=''
1358 ccversion=''
1359 perllibs=''
1360 : set useposix=false in your hint file to disable the POSIX extension.
1361 useposix=true
1362 : set useopcode=false in your hint file to disable the Opcode extension.
1363 useopcode=true
1364 archname64=''
1365 ccflags_uselargefiles=''
1366 ldflags_uselargefiles=''
1367 libswanted_uselargefiles=''
1368 : set usemultiplicity on the Configure command line to enable multiplicity.
1369 : set usesocks on the Configure command line to enable socks.
1370 : List of libraries we want.
1371 : If anyone needs extra -lxxx, put those in a hint file.
1372 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1373 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1374 : We probably want to search /usr/shlib before most other libraries.
1375 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1376 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1377 glibpth="/usr/shlib $glibpth"
1378 : Do not use vfork unless overridden by a hint file.
1379 usevfork=false
1380
1381 : Find the basic shell for Bourne shell scripts
1382 case "$sh" in
1383 '')
1384         case "$SYSTYPE" in
1385         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1386         *) xxx='/bin/sh';;
1387         esac
1388         if test -f "$xxx"; then
1389                 sh="$xxx"
1390         else
1391                 : Build up a list and do a single loop so we can 'break' out.
1392                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1393                 for xxx in sh bash ksh pdksh ash; do
1394                         for p in $pth; do
1395                                 try="$try ${p}/${xxx}"
1396                         done
1397                 done
1398                 for xxx in $try; do
1399                         if test -f "$xxx"; then
1400                                 sh="$xxx";
1401                                 break
1402                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1403                                 sh="$xxx";
1404                                 break
1405                         elif test -f "$xxx.exe"; then
1406                                 sh="$xxx";
1407                                 break
1408                         fi
1409                 done
1410         fi
1411         ;;
1412 esac
1413
1414 case "$sh" in
1415 '')     cat >&2 <<EOM
1416 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1417
1418 Usually it's in /bin/sh.  How did you even get this far?
1419 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1420 we'll try to straighten this all out.
1421 EOM
1422         exit 1
1423         ;;
1424 esac
1425
1426 : see if sh knows # comments
1427 if `$sh -c '#' >/dev/null 2>&1`; then
1428         shsharp=true
1429         spitshell=cat
1430         xcat=/bin/cat
1431         test -f $xcat$_exe || xcat=/usr/bin/cat
1432         if test ! -f $xcat$_exe; then
1433                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1434                         if test -f $p/cat$_exe; then
1435                                 xcat=$p/cat
1436                                 break
1437                         fi
1438                 done
1439                 if test ! -f $xcat$_exe; then
1440                         echo "Can't find cat anywhere!"
1441                         exit 1
1442                 fi
1443         fi
1444         echo "#!$xcat" >sharp
1445         $eunicefix sharp
1446         chmod +x sharp
1447         ./sharp > today 2>/dev/null
1448         if test -s today; then
1449                 sharpbang='#!'
1450         else
1451                 echo "#! $xcat" > sharp
1452                 $eunicefix sharp
1453                 chmod +x sharp
1454                 ./sharp > today 2>/dev/null
1455                 if test -s today; then
1456                         sharpbang='#! '
1457                 else
1458                         sharpbang=': use '
1459                 fi
1460         fi
1461 else
1462         echo " "
1463         echo "Your $sh doesn't grok # comments--I will strip them later on."
1464         shsharp=false
1465         cd ..
1466         echo "exec grep -v '^[  ]*#'" >spitshell
1467         chmod +x spitshell
1468         $eunicefix spitshell
1469         spitshell=`pwd`/spitshell
1470         cd UU
1471         echo "I presume that if # doesn't work, #! won't work either!"
1472         sharpbang=': use '
1473 fi
1474 rm -f sharp today
1475
1476 : figure out how to guarantee sh startup
1477 case "$startsh" in
1478 '') startsh=${sharpbang}${sh} ;;
1479 *)
1480 esac
1481 cat >sharp <<EOSS
1482 $startsh
1483 set abc
1484 test "$?abc" != 1
1485 EOSS
1486
1487 chmod +x sharp
1488 $eunicefix sharp
1489 if ./sharp; then
1490         : echo "Yup, it does."
1491 else
1492         echo "Hmm... '$startsh' does not guarantee sh startup..."
1493         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1494 fi
1495 rm -f sharp
1496
1497 : Save command line options in file UU/cmdline.opt for later use in
1498 : generating config.sh.
1499 cat > cmdline.opt <<EOSH
1500 : Configure command line arguments.
1501 config_arg0='$0'
1502 config_args='$*'
1503 config_argc=$#
1504 EOSH
1505 argn=1
1506 args_exp=''
1507 args_sep=''
1508 for arg in "$@"; do
1509         cat >>cmdline.opt <<EOSH
1510 config_arg$argn='$arg'
1511 EOSH
1512         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1513 $arg
1514 EOC
1515         arg_exp=`cat cmdl.opt`
1516         args_exp="$args_exp$args_sep'$arg_exp'"
1517         argn=`expr $argn + 1`
1518         args_sep=' '
1519 done
1520 rm -f cmdl.opt
1521
1522 : produce awk script to parse command line options
1523 cat >options.awk <<'EOF'
1524 BEGIN {
1525         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1526
1527         len = length(optstr);
1528         for (i = 1; i <= len; i++) {
1529                 c = substr(optstr, i, 1);
1530                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1531                 if (a == ":") {
1532                         arg[c] = 1;
1533                         i++;
1534                 }
1535                 opt[c] = 1;
1536         }
1537 }
1538 {
1539         expect = 0;
1540         str = $0;
1541         if (substr(str, 1, 1) != "-") {
1542                 printf("'%s'\n", str);
1543                 next;
1544         }
1545         len = length($0);
1546         for (i = 2; i <= len; i++) {
1547                 c = substr(str, i, 1);
1548                 if (!opt[c]) {
1549                         printf("-%s\n", substr(str, i));
1550                         next;
1551                 }
1552                 printf("-%s\n", c);
1553                 if (arg[c]) {
1554                         if (i < len)
1555                                 printf("'%s'\n", substr(str, i + 1));
1556                         else
1557                                 expect = 1;
1558                         next;
1559                 }
1560         }
1561 }
1562 END {
1563         if (expect)
1564                 print "?";
1565 }
1566 EOF
1567
1568 : process the command line options
1569 set X `for arg in "$@"; do echo "X$arg"; done |
1570         sed -e s/X// | awk -f options.awk`
1571 eval "set $*"
1572 shift
1573 rm -f options.awk
1574
1575 : set up default values
1576 fastread=''
1577 reuseval=false
1578 config_sh=''
1579 alldone=''
1580 error=''
1581 silent=''
1582 extractsh=''
1583 override=''
1584 knowitall=''
1585 rm -f optdef.sh posthint.sh
1586 cat >optdef.sh <<EOS
1587 $startsh
1588 EOS
1589
1590
1591 : option parsing
1592 while test $# -gt 0; do
1593         case "$1" in
1594         -d) shift; fastread=yes;;
1595         -e) shift; alldone=cont;;
1596         -f)
1597                 shift
1598                 cd ..
1599                 if test -r "$1"; then
1600                         config_sh="$1"
1601                 else
1602                         echo "$me: cannot read config file $1." >&2
1603                         error=true
1604                 fi
1605                 cd UU
1606                 shift;;
1607         --help|\
1608         -h) shift; error=true;;
1609         -r) shift; reuseval=true;;
1610         -s) shift; silent=true; realsilent=true;;
1611         -E) shift; alldone=exit;;
1612         -K) shift; knowitall=true;;
1613         -O) shift; override=true;;
1614         -S) shift; silent=true; extractsh=true;;
1615         -D)
1616                 shift
1617                 case "$1" in
1618                 *=)
1619                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1620                         echo "$me: ignoring -D $1" >&2
1621                         ;;
1622                 *=*) echo "$1" | \
1623                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1624                 *) echo "$1='define'" >> optdef.sh;;
1625                 esac
1626                 shift
1627                 ;;
1628         -U)
1629                 shift
1630                 case "$1" in
1631                 *=) echo "$1" >> optdef.sh;;
1632                 *=*)
1633                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1634                         echo "$me: ignoring -U $1" >&2
1635                         ;;
1636                 *) echo "$1='undef'" >> optdef.sh;;
1637                 esac
1638                 shift
1639                 ;;
1640         -A)
1641             shift
1642             xxx=''
1643             yyy="$1"
1644             zzz=''
1645             uuu=undef
1646             case "$yyy" in
1647             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1648                  case "$zzz" in
1649                  *:*) zzz='' ;;
1650                  *)   xxx=append
1651                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1652                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1653                  esac
1654                  ;;
1655             esac
1656             case "$xxx" in
1657             '')  case "$yyy" in
1658                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1659                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1660                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1661                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1662                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1663                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1664                  esac
1665                  ;;
1666             esac
1667             case "$xxx" in
1668             append)
1669                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1670             clear)
1671                 echo "$yyy=''"                  >> posthint.sh ;;
1672             define)
1673                 case "$zzz" in
1674                 '') zzz=define ;;
1675                 esac
1676                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1677             eval)
1678                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1679             prepend)
1680                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1681             undef)
1682                 case "$zzz" in
1683                 '') zzz="$uuu" ;;
1684                 esac
1685                 echo "$yyy=$zzz"                >> posthint.sh ;;
1686             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1687             esac
1688             shift
1689             ;;
1690         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1691             exit 0;;
1692         --) break;;
1693         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1694         *) break;;
1695         esac
1696 done
1697
1698 case "$error" in
1699 true)
1700         cat >&2 <<EOM
1701 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1702                  [-U symbol] [-U symbol=] [-A command:symbol...]
1703   -d : use defaults for all answers.
1704   -e : go on without questioning past the production of config.sh.
1705   -f : specify an alternate default configuration file.
1706   -h : print this help message and exit (with an error status).
1707   -r : reuse C symbols value if possible (skips costly nm extraction).
1708   -s : silent mode, only echoes questions and essential information.
1709   -D : define symbol to have some value:
1710          -D symbol         symbol gets the value 'define'
1711          -D symbol=value   symbol gets the value 'value'
1712        common used examples (see INSTALL for more info):
1713          -Duse64bitint            use 64bit integers
1714          -Duse64bitall            use 64bit integers and pointers
1715          -Dusethreads             use thread support
1716          -Dinc_version_list=none  do not include older perl trees in @INC
1717          -DEBUGGING=none          DEBUGGING options
1718          -Dcc=gcc                 choose your compiler
1719          -Dprefix=/opt/perl5      choose your destination
1720   -E : stop at the end of questions, after having produced config.sh.
1721   -K : do not use unless you know what you are doing.
1722   -O : let -D and -U override definitions from loaded configuration file.
1723   -S : perform variable substitutions on all .SH files (can mix with -f)
1724   -U : undefine symbol:
1725          -U symbol    symbol gets the value 'undef'
1726          -U symbol=   symbol gets completely empty
1727        e.g.:  -Uversiononly
1728   -A : manipulate symbol after the platform specific hints have been applied:
1729          -A append:symbol=value   append value to symbol
1730          -A symbol=value          like append:, but with a separating space
1731          -A define:symbol=value   define symbol to have value
1732          -A clear:symbol          define symbol to be ''
1733          -A define:symbol         define symbol to be 'define'
1734          -A eval:symbol=value     define symbol to be eval of value
1735          -A prepend:symbol=value  prepend value to symbol
1736          -A undef:symbol          define symbol to be 'undef'
1737          -A undef:symbol=         define symbol to be ''
1738        e.g.:  -A prepend:libswanted='cl pthread '
1739               -A ccflags=-DSOME_MACRO
1740   -V : print version number and exit (with a zero status).
1741 EOM
1742         exit 1
1743         ;;
1744 esac
1745
1746 : Sanity checks
1747 case "$fastread$alldone" in
1748 yescont|yesexit) ;;
1749 *)
1750         case "$extractsh" in
1751         true) ;;
1752         *)
1753                 if test ! -t 0; then
1754                         echo "Say 'sh Configure', not 'sh <Configure'"
1755                         exit 1
1756                 fi
1757                 ;;
1758         esac
1759         ;;
1760 esac
1761
1762 exec 4>&1
1763 case "$silent" in
1764 true) exec 1>/dev/null;;
1765 esac
1766
1767 : run the defines and the undefines, if any, but leave the file out there...
1768 touch optdef.sh
1769 . ./optdef.sh
1770 : create the posthint manipulation script and leave the file out there...
1771 touch posthint.sh
1772
1773 : set package name
1774 package='perl5'
1775 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1776 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1777 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1778 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1779 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1780 esac
1781
1782 : Some greps do not return status, grrr.
1783 echo "grimblepritz" >grimble
1784 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1785         contains=contains
1786 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1787         contains=grep
1788 else
1789         contains=contains
1790 fi
1791 rm -f grimble
1792 : the following should work in any shell
1793 case "$contains" in
1794 contains*)
1795         echo " "
1796         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1797         cat >contains <<'EOSS'
1798 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1799 EOSS
1800 chmod +x contains
1801 esac
1802
1803 : Find the path to the source tree
1804 case "$src" in
1805 '') case "$0" in
1806     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1807          case "$src" in
1808          /*)    ;;
1809          .)     ;;
1810          *)     src=`cd ../$src && pwd` ;;
1811          esac
1812          ;;
1813     *)   src='.';;
1814     esac;;
1815 esac
1816 case "$src" in
1817 '')     src=/
1818         rsrc=/
1819         ;;
1820 /*)     rsrc="$src";;
1821 *)      rsrc="../$src";;
1822 esac
1823 if test -f $rsrc/Configure && \
1824         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1825 then
1826    : found it, so we are ok.
1827 else
1828         rsrc=''
1829         for src in . .. ../.. ../../.. ../../../..; do
1830                 if test -f ../$src/Configure && \
1831                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1832                 then
1833                         rsrc=../$src
1834                         break
1835                 fi
1836         done
1837 fi
1838 case "$rsrc" in
1839 '')
1840         cat <<EOM >&4
1841
1842 Sorry, I can't seem to locate the source dir for $package.  Please start
1843 Configure with an explicit path -- i.e. /some/path/Configure.
1844
1845 EOM
1846         exit 1
1847         ;;
1848 ../.)   rsrc='..';;
1849 *)
1850         echo " "
1851         echo "Sources for $package found in \"$src\"." >&4
1852         ;;
1853 esac
1854
1855 : script used to extract .SH files with variable substitutions
1856 cat >extract <<'EOS'
1857 PERL_CONFIG_SH=true
1858 echo "Doing variable substitutions on .SH files..."
1859 if test -f MANIFEST; then
1860         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1861 else
1862         echo "(Looking for .SH files under the source directory.)"
1863         set x `(cd "$src"; find . -name "*.SH" -print)`
1864 fi
1865 shift
1866 case $# in
1867 0) set x `(cd "$src"; echo *.SH)`; shift;;
1868 esac
1869 if test ! -f "$src/$1"; then
1870         shift
1871 fi
1872 mkdir_p='
1873 name=$1;
1874 create="";
1875 while test $name; do
1876         if test ! -d "$name"; then
1877                 create="$name $create";
1878                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1879                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1880         else
1881                 name="";
1882         fi;
1883 done;
1884 for file in $create; do
1885         mkdir $file;
1886 done
1887 '
1888 for file in $*; do
1889         case "$src" in
1890         ".")
1891                 case "$file" in
1892                 */*)
1893                         dir=`expr X$file : 'X\(.*\)/'`
1894                         file=`expr X$file : 'X.*/\(.*\)'`
1895                         (cd "$dir" && . ./$file)
1896                         ;;
1897                 *)
1898                         . ./$file
1899                         ;;
1900                 esac
1901                 ;;
1902         *)
1903                 case "$file" in
1904                 */*)
1905                         dir=`expr X$file : 'X\(.*\)/'`
1906                         file=`expr X$file : 'X.*/\(.*\)'`
1907                         (set x $dir; shift; eval $mkdir_p)
1908                         sh <"$src/$dir/$file"
1909                         ;;
1910                 *)
1911                         sh <"$src/$file"
1912                         ;;
1913                 esac
1914                 ;;
1915         esac
1916 done
1917 if test -f "$src/config_h.SH"; then
1918         if test ! -f config.h; then
1919         : oops, they left it out of MANIFEST, probably, so do it anyway.
1920         . "$src/config_h.SH"
1921         fi
1922 fi
1923 EOS
1924
1925 : extract files and exit if asked to do so
1926 case "$extractsh" in
1927 true)
1928         case "$realsilent" in
1929         true) ;;
1930         *) exec 1>&4;;
1931         esac
1932         case "$config_sh" in
1933         '') config_sh='config.sh';;
1934         esac
1935         echo " "
1936         echo "Fetching answers from $config_sh..."
1937         cd ..
1938         . $config_sh
1939         test "$override" && . ./optdef.sh
1940         echo " "
1941         . UU/extract
1942         rm -rf UU
1943         echo "Extraction done."
1944         exit 0
1945         ;;
1946 esac
1947
1948 : Eunice requires " " instead of "", can you believe it
1949 echo " "
1950 : Here we go...
1951 echo "Beginning of configuration questions for $package."
1952
1953 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1954
1955 : first determine how to suppress newline on echo command
1956 echo " "
1957 echo "Checking echo to see how to suppress newlines..."
1958 (echo "hi there\c" ; echo " ") >.echotmp
1959 if $contains c .echotmp >/dev/null 2>&1 ; then
1960         echo "...using -n."
1961         n='-n'
1962         c=''
1963 else
1964         cat <<'EOM'
1965 ...using \c
1966 EOM
1967         n=''
1968         c='\c'
1969 fi
1970 echo $n "The star should be here-->$c"
1971 echo '*'
1972 rm -f .echotmp
1973
1974 : Now test for existence of everything in MANIFEST
1975 echo " "
1976 if test -f "$rsrc/MANIFEST"; then
1977         echo "First let's make sure your kit is complete.  Checking..." >&4
1978         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1979                 (split -l 50 2>/dev/null || split -50)
1980         rm -f missing
1981         tmppwd=`pwd`
1982         for filelist in x??; do
1983                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1984                         >/dev/null 2>>"$tmppwd/missing")
1985         done
1986         if test -s missing; then
1987                 cat missing >&4
1988                 cat >&4 <<'EOM'
1989
1990 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1991
1992 You have the option of continuing the configuration process, despite the
1993 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1994 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1995 and contact the author (perlbug@perl.org).
1996
1997 EOM
1998                 echo $n "Continue? [n] $c" >&4
1999                 read ans
2000                 case "$ans" in
2001                 y*)
2002                         echo "Continuing..." >&4
2003                         rm -f missing
2004                         ;;
2005                 *)
2006                         echo "ABORTING..." >&4
2007                         kill $$
2008                         ;;
2009                 esac
2010         else
2011                 echo "Looks good..."
2012         fi
2013 else
2014         echo "There is no MANIFEST file.  I hope your kit is complete !"
2015 fi
2016 rm -f missing x??
2017
2018 : Find the appropriate value for a newline for tr
2019 echo " "
2020 if test -n "$DJGPP"; then
2021        trnl='\012'
2022 fi
2023 if test X"$trnl" = X; then
2024         case "`echo foo|tr '\n' x 2>/dev/null`" in
2025         foox) trnl='\n' ;;
2026         esac
2027 fi
2028 if test X"$trnl" = X; then
2029         case "`echo foo|tr '\012' x 2>/dev/null`" in
2030         foox) trnl='\012' ;;
2031         esac
2032 fi
2033 if test X"$trnl" = X; then
2034        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2035        fooxy) trnl='\n\r' ;;
2036        esac
2037 fi
2038 if test X"$trnl" = X; then
2039         cat <<EOM >&2
2040
2041 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2042
2043 EOM
2044         exit 1
2045 fi
2046
2047 : compute the number of columns on the terminal for proper question formatting
2048 case "$COLUMNS" in
2049 '') COLUMNS='80';;
2050 esac
2051
2052 : set up the echo used in my read
2053 myecho="case \"\$xxxm\" in
2054 '') echo $n \"\$rp $c\" >&4;;
2055 *) case \"\$rp\" in
2056         '') echo $n \"[\$xxxm] $c\";;
2057         *)
2058                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2059                         echo \"\$rp\" >&4
2060                         echo $n \"[\$xxxm] $c\" >&4
2061                 else
2062                         echo $n \"\$rp [\$xxxm] $c\" >&4
2063                 fi
2064                 ;;
2065         esac;;
2066 esac"
2067
2068 : now set up to do reads with possible shell escape and default assignment
2069 cat <<EOSC >myread
2070 $startsh
2071 xxxm=\$dflt
2072 $myecho
2073 ans='!'
2074 case "\$fastread" in
2075 yes) case "\$dflt" in
2076         '') ;;
2077         *) ans='';
2078                 case "\$silent-\$rp" in
2079                 true-) ;;
2080                 *) echo " " >&4;;
2081                 esac;;
2082         esac;;
2083 *) case "\$silent" in
2084         true) case "\$rp" in
2085                 '') ans='';;
2086                 esac;;
2087         esac;;
2088 esac
2089 while expr "X\$ans" : "X!" >/dev/null; do
2090         read answ
2091         set x \$xxxm
2092         shift
2093         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2094         case  "\$answ" in
2095         "!")
2096                 sh 1>&4
2097                 echo " "
2098                 $myecho
2099                 ;;
2100         !*)
2101                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2102                 shift
2103                 sh 1>&4 -c "\$*"
2104                 echo " "
2105                 $myecho
2106                 ;;
2107         "\$ans")
2108                 case "\$ans" in
2109                 \\&*)
2110                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2111                         shift
2112                         case "\$1" in
2113                         -d)
2114                                 fastread=yes
2115                                 echo "(OK, I'll run with -d after this question.)" >&4
2116                                 ;;
2117                         -*)
2118                                 echo "*** Sorry, \$1 not supported yet." >&4
2119                                 ;;
2120                         esac
2121                         $myecho
2122                         ans=!
2123                         ;;
2124                 esac;;
2125         *)
2126                 case "\$aok" in
2127                 y)
2128                         echo "*** Substitution done -- please confirm."
2129                         xxxm="\$ans"
2130                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2131                         xxxm="\$ans"
2132                         ans=!
2133                         ;;
2134                 *)
2135                         echo "*** Error -- try again."
2136                         ans=!
2137                         ;;
2138                 esac
2139                 $myecho
2140                 ;;
2141         esac
2142         case "\$ans\$xxxm\$nostick" in
2143         '')
2144                 ans=!
2145                 $myecho
2146                 ;;
2147         esac
2148 done
2149 case "\$ans" in
2150 '') ans="\$xxxm";;
2151 esac
2152 EOSC
2153
2154 : create .config dir to save info across Configure sessions
2155 test -d ../.config || mkdir ../.config
2156 cat >../.config/README <<EOF
2157 This directory created by Configure to save information that should
2158 persist across sessions for $package.
2159
2160 You may safely delete it if you wish.
2161 EOF
2162
2163 : See if we are using a devel version and want that
2164 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2165 case "$usedevel" in
2166 $define|true|[yY]*)
2167     usedevel="$define" ;;
2168 *) case "$xversion" in
2169    *[13579])
2170         cat >&4 <<EOH
2171 *** WHOA THERE!!! ***
2172
2173     This is an UNSTABLE DEVELOPMENT release.
2174     The version of this $package distribution is $xversion, that is, odd,
2175     (as opposed to even) and that signifies a development release.
2176     If you want a maintenance release, you want an even-numbered version.
2177
2178     Do ***NOT*** install this into production use.
2179     Data corruption and crashes are possible.
2180
2181     It is most seriously suggested that you do not continue any further
2182     unless you want to help in developing and debugging Perl.
2183
2184     If you *still* want to build perl, you can answer 'y' now,
2185     or pass -Dusedevel to Configure.
2186
2187 EOH
2188         rp='Do you really want to continue?'
2189         dflt='n'
2190         . ./myread
2191         case "$ans" in
2192         [yY]) echo >&4 "Okay, continuing."
2193               usedevel="$define" ;;
2194         *) echo >&4 "Okay, bye."
2195            exit 1
2196            ;;
2197         esac
2198         ;;
2199     esac
2200     usedevel="$undef"
2201     ;;
2202 esac
2203 case "$usedevel" in
2204 $define|true|[yY]*)
2205         case "$versiononly" in
2206         '') versiononly="$define" ;;
2207         esac
2208         case "$installusrbinperl" in
2209         '') installusrbinperl="$undef" ;;
2210         esac
2211         ;;
2212 esac
2213
2214 : general instructions
2215 needman=true
2216 firsttime=true
2217 user=`(logname) 2>/dev/null`
2218 case "$user" in
2219 '') user=`whoami 2>&1`;;
2220 esac
2221 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2222         firsttime=false
2223         echo " "
2224         rp='Would you like to see the instructions?'
2225         dflt=n
2226         . ./myread
2227         case "$ans" in
2228         [yY]*) ;;
2229         *) needman=false;;
2230         esac
2231 fi
2232 if $needman; then
2233         cat <<EOH
2234
2235 This installation shell script will examine your system and ask you questions
2236 to determine how the perl5 package should be installed. If you get
2237 stuck on a question, you may use a ! shell escape to start a subshell or
2238 execute a command.  Many of the questions will have default answers in square
2239 brackets; typing carriage return will give you the default.
2240
2241 On some of the questions which ask for file or directory names you are allowed
2242 to use the ~name construct to specify the login directory belonging to "name",
2243 even if you don't have a shell which knows about that.  Questions where this is
2244 allowed will be marked "(~name ok)".
2245
2246 EOH
2247         rp=''
2248         dflt='Type carriage return to continue'
2249         . ./myread
2250         cat <<'EOH'
2251
2252 The prompter used in this script allows you to use shell variables and
2253 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2254 in the default answer, as if the default line was a set of arguments given to a
2255 script shell.  This means you may also use $* to repeat the whole default line,
2256 so you do not have to re-type everything to add something to the default.
2257
2258 Every time there is a substitution, you will have to confirm.  If there is an
2259 error (e.g. an unmatched backtick), the default answer will remain unchanged
2260 and you will be prompted again.
2261
2262 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2263 the questions and use the computed defaults (or the previous answers if there
2264 was already a config.sh file). Type 'Configure -h' for a list of options.
2265 You may also start interactively and then answer '& -d' at any prompt to turn
2266 on the non-interactive behaviour for the remainder of the execution.
2267
2268 EOH
2269         . ./myread
2270         cat <<EOH
2271
2272 Much effort has been expended to ensure that this shell script will run on any
2273 Unix system.  If despite that it blows up on yours, your best bet is to edit
2274 Configure and run it again.  If you can't run Configure for some reason,
2275 you'll have to generate a config.sh file by hand.  Whatever problems you
2276 have, let me (perlbug@perl.org) know how I blew it.
2277
2278 This installation script affects things in two ways:
2279
2280 1) it may do direct variable substitutions on some of the files included
2281    in this kit.
2282 2) it builds a config.h file for inclusion in C programs.  You may edit
2283    any of these files as the need arises after running this script.
2284
2285 If you make a mistake on a question, there is no easy way to back up to it
2286 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2287 files.  Configure will offer to let you do this before it runs the SH files.
2288
2289 EOH
2290         dflt='Type carriage return to continue'
2291         . ./myread
2292         case "$firsttime" in
2293         true) echo $user >>../.config/instruct;;
2294         esac
2295 fi
2296
2297 : find out where common programs are
2298 echo " "
2299 echo "Locating common programs..." >&4
2300 cat <<EOSC >loc
2301 $startsh
2302 case \$# in
2303 0) exit 1;;
2304 esac
2305 thing=\$1
2306 shift
2307 dflt=\$1
2308 shift
2309 for dir in \$*; do
2310         case "\$thing" in
2311         .)
2312         if test -d \$dir/\$thing; then
2313                 echo \$dir
2314                 exit 0
2315         fi
2316         ;;
2317         *)
2318         for thisthing in \$dir/\$thing; do
2319                 : just loop through to pick last item
2320         done
2321         if test -f \$thisthing; then
2322                 echo \$thisthing
2323                 exit 0
2324         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2325                 echo \$thisthing
2326                 exit 0
2327         elif test -f \$dir/\$thing.exe; then
2328                 if test -n "$DJGPP"; then
2329                         echo \$dir/\$thing.exe
2330                 elif test "$eunicefix" != ":"; then
2331                         : on Eunice apparently
2332                         echo \$dir/\$thing
2333                 fi
2334                 exit 0
2335         fi
2336         ;;
2337         esac
2338 done
2339 echo \$dflt
2340 exit 1
2341 EOSC
2342 chmod +x loc
2343 $eunicefix loc
2344 loclist="
2345 awk
2346 cat
2347 chmod
2348 comm
2349 cp
2350 echo
2351 expr
2352 grep
2353 ls
2354 mkdir
2355 rm
2356 sed
2357 sort
2358 touch
2359 tr
2360 uniq
2361 "
2362 trylist="
2363 ar
2364 bison
2365 byacc
2366 cpp
2367 csh
2368 date
2369 egrep
2370 gmake
2371 gzip
2372 less
2373 ln
2374 make
2375 more
2376 nm
2377 nroff
2378 perl
2379 pg
2380 test
2381 uname
2382 zip
2383 "
2384 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2385 pth="$pth /lib /usr/lib"
2386 for file in $loclist; do
2387         eval xxx=\$$file
2388         case "$xxx" in
2389         /*|?:[\\/]*)
2390                 if test -f "$xxx"; then
2391                         : ok
2392                 else
2393                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2394                         xxx=`./loc $file $file $pth`
2395                 fi
2396                 ;;
2397         '') xxx=`./loc $file $file $pth`;;
2398         *) xxx=`./loc $xxx $xxx $pth`;;
2399         esac
2400         eval $file=$xxx$_exe
2401         eval _$file=$xxx
2402         case "$xxx" in
2403         /*)
2404                 echo $file is in $xxx.
2405                 ;;
2406         ?:[\\/]*)
2407                 echo $file is in $xxx.
2408                 ;;
2409         *)
2410                 echo "I don't know where '$file' is, and my life depends on it." >&4
2411                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2412                 exit 1
2413                 ;;
2414         esac
2415 done
2416 echo " "
2417 echo "Don't worry if any of the following aren't found..."
2418 say=offhand
2419 for file in $trylist; do
2420         eval xxx=\$$file
2421         case "$xxx" in
2422         /*|?:[\\/]*)
2423                 if test -f "$xxx"; then
2424                         : ok
2425                 else
2426                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2427                         xxx=`./loc $file $file $pth`
2428                 fi
2429                 ;;
2430         '') xxx=`./loc $file $file $pth`;;
2431         *) xxx=`./loc $xxx $xxx $pth`;;
2432         esac
2433         eval $file=$xxx$_exe
2434         eval _$file=$xxx
2435         case "$xxx" in
2436         /*)
2437                 echo $file is in $xxx.
2438                 ;;
2439         ?:[\\/]*)
2440                 echo $file is in $xxx.
2441                 ;;
2442         *)
2443                 echo "I don't see $file out there, $say."
2444                 say=either
2445                 ;;
2446         esac
2447 done
2448 case "$egrep" in
2449 egrep)
2450         echo "Substituting grep for egrep."
2451         egrep=$grep
2452         _egrep=$grep
2453         ;;
2454 esac
2455 case "$less" in
2456 '')     ;;
2457 *)      if $less -R </dev/null >/dev/null; then
2458                echo "Substituting less -R for less."
2459                less="$less -R"
2460                _less=$less
2461         fi
2462         ;;
2463 esac
2464 case "$ln" in
2465 ln)
2466         echo "Substituting cp for ln."
2467         ln=$cp
2468         _ln=$cp
2469         ;;
2470 esac
2471 case "$make" in
2472 make)
2473         case "$gmake" in
2474         gmake)
2475         echo "I can't find make or gmake, and my life depends on it." >&4
2476         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2477         exit 1
2478         ;;
2479         esac
2480         ;;
2481 esac
2482 case "$gmake" in
2483 gmake)  ;;
2484 *)      # We can't have osname yet.
2485         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2486                 # Assume that gmake, if found, is definitely GNU make
2487                 # and prefer it over the system make.
2488                 echo "Substituting gmake for make."
2489                 make=$gmake
2490                 _make=$gmake
2491         fi
2492         ;;
2493 esac
2494 case "$test" in
2495 test)
2496         echo "Hopefully test is built into your sh."
2497         ;;
2498 *)
2499         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2500                 echo "Using the test built into your sh."
2501                 test=test
2502                 _test=test
2503         fi
2504         ;;
2505 esac
2506 case "$echo" in
2507 echo)
2508         echo "Hopefully echo is built into your sh."
2509         ;;
2510 '') ;;
2511 *)
2512         echo " "
2513 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2514         $echo $n "hi there$c" >foo1
2515         echo $n "hi there$c" >foo2
2516         if cmp foo1 foo2 >/dev/null 2>&1; then
2517                 echo "They are compatible.  In fact, they may be identical."
2518         else
2519                 case "$n" in
2520                 '-n') n='' c='\c';;
2521                 *) n='-n' c='';;
2522                 esac
2523                 cat <<FOO
2524 They are not compatible!  You are probably running ksh on a non-USG system.
2525 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2526 have echo built in and we may have to run some Bourne shell scripts.  That
2527 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2528
2529 FOO
2530                 $echo $n "The star should be here-->$c"
2531                 $echo "*"
2532         fi
2533         $rm -f foo1 foo2
2534         ;;
2535 esac
2536
2537 # This question was auctioned at YAPC::Europe-2007 in Vienna
2538 # I never promised you could answer it. I only auctioned the question.
2539 cat <<FOO
2540 The following message is sponsored by
2541
2542   Dresden.pm<--The stars should be here.
2543
2544 Dear Perl user, system administrator or package
2545 maintainer, the Perl community sends greetings to
2546 you. Do you (emblematical) greet back [Y/n]? n
2547
2548 FOO
2549
2550 : Check what type of C compiler we use
2551 cat <<EOS >trygcc
2552 $startsh
2553 EOS
2554 cat <<'EOSC' >>trygcc
2555 case "$cc" in
2556 '') ;;
2557 *)  $rm -f try try.*
2558     $cat >try.c <<EOM
2559 int main(int argc, char *argv[]) {
2560   return 0;
2561 }
2562 EOM
2563     if $cc -o try $ccflags $ldflags try.c; then
2564        :
2565     else
2566         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2567         despair=yes
2568         trygcc=yes
2569         case "$cc" in
2570         *gcc*) trygcc=no ;;
2571         esac
2572         # Skip this test because it gives a false match on output like:
2573         #    ./trygcc: line 23: cc: command not found
2574         # case "`$cc -v -c try.c 2>&1`" in
2575         # *gcc*) trygcc=no ;;
2576         # esac
2577         if $test X"$trygcc" = Xyes; then
2578             if gcc -o try -c try.c; then
2579                 echo " "
2580                 echo "You seem to have a working gcc, though." >&4
2581                 # Switching compilers may undo the work of hints files.
2582                 # The most common problem is -D_REENTRANT for threads.
2583                 # This heuristic catches that case, but gets false positives
2584                 # if -Dusethreads was not actually specified.  Better to
2585                 # bail out here with a useful message than fail 
2586                 # mysteriously later. Should we perhaps just try to
2587                 # re-invoke Configure -Dcc=gcc config_args ?
2588                 if $test -f usethreads.cbu; then
2589                         $cat >&4 <<EOM 
2590
2591 *** However, any setting of the C compiler flags (e.g. for thread support)
2592 *** will be lost.  It may be necessary for you to restart Configure and
2593 *** add -Dcc=gcc to your Configure command line.
2594
2595 EOM
2596                         rp="Would you like to go ahead and try gcc anyway?"
2597                         dflt=n
2598                 else
2599                         rp="Would you like to use it?"
2600                         dflt=y
2601                 fi
2602                 if $test -f myread; then
2603                     . ./myread
2604                 else
2605                     if $test -f UU/myread; then
2606                         . ./UU/myread
2607                     else
2608                         echo "Cannot find myread, sorry.  Aborting." >&2
2609                         exit 1
2610                     fi
2611                 fi  
2612                 case "$ans" in
2613                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2614                 esac
2615             fi
2616         fi
2617     fi
2618     $rm -f try try.*
2619     ;;
2620 esac
2621 EOSC
2622
2623 cat <<EOS >checkcc
2624 $startsh
2625 EOS
2626 cat <<'EOSC' >>checkcc
2627 case "$cc" in        
2628 '') ;;
2629 *)  $rm -f try try.*              
2630     $cat >try.c <<EOM
2631 int main(int argc, char *argv[]) {
2632   return 0;
2633 }
2634 EOM
2635     if $cc -o try $ccflags $ldflags try.c; then
2636        :
2637     else
2638         if $test X"$despair" = Xyes; then
2639            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2640         fi
2641         $cat >&4 <<EOM         
2642 You need to find a working C compiler.
2643 Either (purchase and) install the C compiler supplied by your OS vendor,
2644 or for a free C compiler try http://gcc.gnu.org/
2645 I cannot continue any further, aborting.
2646 EOM
2647         exit 1
2648     fi
2649     $rm -f try try.*
2650     ;;
2651 esac
2652 EOSC
2653
2654 : determine whether symbolic links are supported
2655 echo " "
2656 $touch blurfl
2657 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2658         echo "Symbolic links are supported." >&4
2659         lns="$ln -s"
2660 else
2661         echo "Symbolic links are NOT supported." >&4
2662         lns="$ln"
2663 fi
2664 $rm -f blurfl sym
2665
2666 : determine whether symbolic links are supported
2667 echo " "
2668 case "$lns" in
2669 *"ln"*" -s")
2670         echo "Checking how to test for symbolic links..." >&4
2671         $lns blurfl sym
2672         if $test "X$issymlink" = X; then
2673                 case "$newsh" in
2674                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2675                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2676                 esac
2677                 if test $? = 0; then
2678                         issymlink="test -h"
2679                 else
2680                         echo "Your builtin 'test -h' may be broken." >&4
2681                         case "$test" in
2682                         /*)     ;;
2683                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2684                                 for p in $pth
2685                                 do
2686                                         if test -f "$p/$test"; then
2687                                                 test="$p/$test"
2688                                                 break
2689                                         fi
2690                                 done
2691                                 ;;
2692                         esac
2693                         case "$test" in
2694                         /*)
2695                                 echo "Trying external '$test -h'." >&4
2696                                 issymlink="$test -h"
2697                                 if $test ! -h sym >/dev/null 2>&1; then
2698                                         echo "External '$test -h' is broken, too." >&4
2699                                         issymlink=''
2700                                 fi
2701                                 ;;
2702                         *)      issymlink='' ;;
2703                         esac
2704                 fi              
2705         fi
2706         if $test "X$issymlink" = X; then
2707                 if $test -L sym 2>/dev/null; then
2708                         issymlink="$test -L"
2709                         echo "The builtin '$test -L' worked." >&4
2710                 fi
2711         fi
2712         if $test "X$issymlink" != X; then
2713                 echo "You can test for symbolic links with '$issymlink'." >&4
2714         else
2715                 echo "I do not know how you can test for symbolic links." >&4
2716         fi
2717         $rm -f blurfl sym
2718         ;;
2719 *)      echo "No symbolic links, so not testing for their testing..." >&4
2720         ;;
2721 esac
2722 echo " "
2723
2724 : Make symlinks util
2725 case "$mksymlinks" in
2726 $define|true|[yY]*)
2727         case "$src" in
2728         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2729                 exit 1
2730                 ;;
2731         *)      case "$lns:$issymlink" in
2732                 *"ln"*" -s:"*"test -"?)
2733                         echo "Creating the symbolic links..." >&4
2734                         echo "(First creating the subdirectories...)" >&4
2735                         cd ..
2736                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2737                                 read directory
2738                                 test -z "$directory" && break
2739                                 mkdir -p $directory
2740                         done
2741                         # Sanity check 1.
2742                         if test ! -d t/base; then
2743                                 echo "Failed to create the subdirectories.  Aborting." >&4
2744                                 exit 1
2745                         fi
2746                         echo "(Then creating the symlinks...)" >&4
2747                         awk '{print $1}' $src/MANIFEST | while true; do
2748                                 read filename
2749                                 test -z "$filename" && break
2750                                 if test -f $filename; then
2751                                         if $issymlink $filename; then
2752                                                 rm -f $filename
2753                                         fi
2754                                 fi
2755                                 if test -f $filename; then
2756                                         echo "$filename already exists, not symlinking."
2757                                 else
2758                                         ln -s $src/$filename $filename
2759                                 fi
2760                         done
2761                         # Sanity check 2.
2762                         if test ! -f t/base/lex.t; then
2763                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2764                                 exit 1
2765                         fi
2766                         cd UU
2767                         ;;
2768                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2769                         ;;
2770                 esac
2771                 ;;
2772         esac
2773         ;;
2774 esac
2775
2776 : Check for Cross-Compilation
2777 case "$usecrosscompile" in
2778 $define|true|[yY]*)
2779         $echo "Cross-compiling..."
2780         croak=''
2781         case "$cc" in
2782         *-*-gcc) # A cross-compiling gcc, probably.
2783             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2784             ar=$targetarch-ar
2785             # leave out ld, choosing it is more complex
2786             nm=$targetarch-nm
2787             ranlib=$targetarch-ranlib
2788             $echo 'extern int foo;' > try.c
2789             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2790             shift
2791             if $test $# -gt 0; then
2792                 incpth="$incpth $*"
2793                 incpth="`$echo $incpth|$sed 's/^ //'`"
2794                 echo "Guessing incpth '$incpth'." >&4
2795                 for i in $*; do
2796                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2797                     if $test -d $j; then
2798                         libpth="$libpth $j"
2799                     fi
2800                 done   
2801                 libpth="`$echo $libpth|$sed 's/^ //'`"
2802                 echo "Guessing libpth '$libpth'." >&4
2803             fi
2804             $rm -f try.c
2805             ;;
2806         esac
2807         case "$targetarch" in
2808         '') echo "Targetarch not defined." >&4; croak=y ;;
2809         *)  echo "Using targetarch $targetarch." >&4 ;;
2810         esac
2811         case "$incpth" in
2812         '') echo "Incpth not defined." >&4; croak=y ;;
2813         *)  echo "Using incpth '$incpth'." >&4 ;;
2814         esac
2815         case "$libpth" in
2816         '') echo "Libpth not defined." >&4; croak=y ;;
2817         *)  echo "Using libpth '$libpth'." >&4 ;;
2818         esac
2819         case "$usrinc" in
2820         '') for i in $incpth; do
2821                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2822                     usrinc=$i
2823                     echo "Guessing usrinc $usrinc." >&4
2824                     break
2825                 fi
2826             done
2827             case "$usrinc" in
2828             '') echo "Usrinc not defined." >&4; croak=y ;;
2829             esac
2830             ;;
2831         *)  echo "Using usrinc $usrinc." >&4 ;;
2832         esac
2833         case "$targethost" in
2834         '') echo "Targethost not defined." >&4; croak=y ;;
2835         *)  echo "Using targethost $targethost." >&4
2836         esac
2837         locincpth=' '
2838         loclibpth=' '
2839         case "$croak" in
2840         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2841         esac
2842         case "$src" in
2843         /*) run=$src/Cross/run
2844             targetmkdir=$src/Cross/mkdir
2845             to=$src/Cross/to
2846             from=$src/Cross/from
2847             ;;
2848         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2849             run=$pwd/Cross/run
2850             targetmkdir=$pwd/Cross/mkdir
2851             to=$pwd/Cross/to
2852             from=$pwd/Cross/from
2853             ;;
2854         esac
2855         case "$targetrun" in
2856         '') targetrun=ssh ;;
2857         esac
2858         case "$targetto" in
2859         '') targetto=scp ;;
2860         esac
2861         case "$targetfrom" in
2862         '') targetfrom=scp ;;
2863         esac
2864         run=$run-$targetrun
2865         to=$to-$targetto
2866         from=$from-$targetfrom
2867         case "$targetdir" in
2868         '')  targetdir=/tmp
2869              echo "Guessing targetdir $targetdir." >&4
2870              ;;
2871         esac
2872         case "$targetuser" in
2873         '')  targetuser=root
2874              echo "Guessing targetuser $targetuser." >&4
2875              ;;
2876         esac
2877         case "$targetfrom" in
2878         scp)    q=-q ;;
2879         *)      q='' ;;
2880         esac
2881         case "$targetrun" in
2882         ssh|rsh)
2883             cat >$run <<EOF
2884 #!/bin/sh
2885 case "\$1" in
2886 -cwd)
2887   shift
2888   cwd=\$1
2889   shift
2890   ;;
2891 esac
2892 case "\$cwd" in
2893 '') cwd=$targetdir ;;
2894 esac
2895 exe=\$1
2896 shift
2897 if $test ! -f \$exe.xok; then
2898   $to \$exe
2899   $touch \$exe.xok
2900 fi
2901 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2902 EOF
2903             ;;
2904         *)  echo "Unknown targetrun '$targetrun'" >&4
2905             exit 1
2906             ;;
2907         esac
2908         case "$targetmkdir" in
2909         */Cross/mkdir)
2910             cat >$targetmkdir <<EOF
2911 #!/bin/sh
2912 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2913 EOF
2914             $chmod a+rx $targetmkdir
2915             ;;
2916         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2917             exit 1
2918             ;;
2919         esac
2920         case "$targetto" in
2921         scp|rcp)
2922             cat >$to <<EOF
2923 #!/bin/sh
2924 for f in \$@
2925 do
2926   case "\$f" in
2927   /*)
2928     $targetmkdir \`dirname \$f\`
2929     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2930     ;;
2931   *)
2932     $targetmkdir $targetdir/\`dirname \$f\`
2933     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2934     ;;
2935   esac
2936 done
2937 exit 0
2938 EOF
2939             ;;
2940         cp) cat >$to <<EOF
2941 #!/bin/sh
2942 for f in \$@
2943 do
2944   case "\$f" in
2945   /*)
2946     $mkdir -p $targetdir/\`dirname \$f\`
2947     $cp \$f $targetdir/\$f || exit 1
2948     ;;
2949   *)
2950     $targetmkdir $targetdir/\`dirname \$f\`
2951     $cp \$f $targetdir/\$f || exit 1
2952     ;;
2953   esac
2954 done
2955 exit 0
2956 EOF
2957             ;;
2958         *)  echo "Unknown targetto '$targetto'" >&4
2959             exit 1
2960             ;;
2961         esac
2962         case "$targetfrom" in
2963         scp|rcp)
2964           cat >$from <<EOF
2965 #!/bin/sh
2966 for f in \$@
2967 do
2968   $rm -f \$f
2969   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2970 done
2971 exit 0
2972 EOF
2973             ;;
2974         cp) cat >$from <<EOF
2975 #!/bin/sh
2976 for f in \$@
2977 do
2978   $rm -f \$f
2979   cp $targetdir/\$f . || exit 1
2980 done
2981 exit 0
2982 EOF
2983             ;;
2984         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2985             exit 1
2986             ;;
2987         esac
2988         if $test ! -f $run; then
2989             echo "Target 'run' script '$run' not found." >&4
2990         else
2991             $chmod a+rx $run
2992         fi
2993         if $test ! -f $to; then
2994             echo "Target 'to' script '$to' not found." >&4
2995         else
2996             $chmod a+rx $to
2997         fi
2998         if $test ! -f $from; then
2999             echo "Target 'from' script '$from' not found." >&4
3000         else
3001             $chmod a+rx $from
3002         fi
3003         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3004             exit 1
3005         fi
3006         cat >&4 <<EOF
3007 Using '$run' for remote execution,
3008 and '$from' and '$to'
3009 for remote file transfer.
3010 EOF
3011         ;;
3012 *)      run=''
3013         to=:
3014         from=:
3015         usecrosscompile='undef'
3016         targetarch=''
3017         ;;
3018 esac
3019
3020 : see whether [:lower:] and [:upper:] are supported character classes
3021 echo " "
3022 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3023 ABYZ)
3024         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3025         up='[:upper:]'
3026         low='[:lower:]'
3027         ;;
3028 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3029         # (0xd9 and 0xe2), therefore that is a nice testing point.
3030         if test "X$up" = X -o "X$low" = X; then
3031             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3032             rs) up='[A-Z]'
3033                 low='[a-z]'
3034                 ;;
3035             esac
3036         fi
3037         if test "X$up" = X -o "X$low" = X; then
3038             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3039             rs) up='A-Z'
3040                 low='a-z'
3041                 ;;
3042             esac
3043         fi
3044         if test "X$up" = X -o "X$low" = X; then
3045             case "`echo RS | od -x 2>/dev/null`" in
3046             *D9E2*|*d9e2*)
3047                 echo "Hey, this might be EBCDIC." >&4
3048                 if test "X$up" = X -o "X$low" = X; then
3049                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3050                     rs) up='[A-IJ-RS-Z]'
3051                         low='[a-ij-rs-z]'
3052                         ;;
3053                     esac
3054                 fi
3055                 if test "X$up" = X -o "X$low" = X; then
3056                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3057                     rs) up='A-IJ-RS-Z'
3058                         low='a-ij-rs-z'
3059                         ;;
3060                     esac
3061                 fi
3062                 ;;
3063             esac
3064         fi
3065 esac
3066 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3067 rs)
3068     echo "Using $up and $low to convert case." >&4
3069     ;;
3070 *)
3071     echo "I don't know how to translate letters from upper to lower case." >&4
3072     echo "Your tr is not acting any way I know of." >&4
3073     exit 1
3074     ;;
3075 esac
3076 : set up the translation script tr, must be called with ./tr of course
3077 cat >tr <<EOSC
3078 $startsh
3079 case "\$1\$2" in
3080 '[A-Z][a-z]') exec $tr '$up' '$low';;
3081 '[a-z][A-Z]') exec $tr '$low' '$up';;
3082 esac
3083 exec $tr "\$@"
3084 EOSC
3085 chmod +x tr
3086 $eunicefix tr
3087
3088 : Try to determine whether config.sh was made on this system
3089 case "$config_sh" in
3090 '')
3091 myuname=`$uname -a 2>/dev/null`
3092 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3093 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3094 # because the A-Z/a-z are not consecutive.
3095 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3096         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3097 newmyuname="$myuname"
3098 dflt=n
3099 case "$knowitall" in
3100 '')
3101         if test -f ../config.sh; then
3102                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3103                         eval "`grep myuname= ../config.sh`"
3104                 fi
3105                 if test "X$myuname" = "X$newmyuname"; then
3106                         dflt=y
3107                 fi
3108         fi
3109         ;;
3110 *) dflt=y;;
3111 esac
3112
3113 : Get old answers from old config file if Configure was run on the
3114 : same system, otherwise use the hints.
3115 hint=default
3116 cd ..
3117 if test -f config.sh; then
3118         echo " "
3119         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3120         . UU/myread
3121         case "$ans" in
3122         n*|N*) echo "OK, I'll ignore it."
3123                 mv config.sh config.sh.old
3124                 myuname="$newmyuname"
3125                 ;;
3126         *)  echo "Fetching default answers from your old config.sh file..." >&4
3127                 tmp_n="$n"
3128                 tmp_c="$c"
3129                 tmp_sh="$sh"
3130                 . ./config.sh
3131                 cp config.sh UU
3132                 n="$tmp_n"
3133                 c="$tmp_c"
3134                 : Older versions did not always set $sh.  Catch re-use of such
3135                 : an old config.sh.
3136                 case "$sh" in
3137                 '') sh="$tmp_sh" ;;
3138                 esac
3139                 hint=previous
3140                 ;;
3141         esac
3142 fi
3143 . ./UU/checkcc
3144 if test ! -f config.sh; then
3145         $cat <<EOM
3146
3147 First time through, eh?  I have some defaults handy for some systems
3148 that need some extra help getting the Configure answers right:
3149
3150 EOM
3151         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3152         dflt=''
3153         : Half the following guesses are probably wrong... If you have better
3154         : tests or hints, please send them to perlbug@perl.org
3155         : The metaconfig authors would also appreciate a copy...
3156         $test -f /irix && osname=irix
3157         $test -f /xenix && osname=sco_xenix
3158         $test -f /dynix && osname=dynix
3159         $test -f /dnix && osname=dnix
3160         $test -f /lynx.os && osname=lynxos
3161         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3162         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3163         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3164         $test -f /bin/mips && /bin/mips && osname=mips
3165         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3166                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3167         $test -d /usr/apollo/bin && osname=apollo
3168         $test -f /etc/saf/_sactab && osname=svr4
3169         $test -d /usr/include/minix && osname=minix
3170         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3171         if $test -d /MachTen -o -d /MachTen_Folder; then
3172                 osname=machten
3173                 if $test -x /sbin/version; then
3174                         osvers=`/sbin/version | $awk '{print $2}' |
3175                         $sed -e 's/[A-Za-z]$//'`
3176                 elif $test -x /usr/etc/version; then
3177                         osvers=`/usr/etc/version | $awk '{print $2}' |
3178                         $sed -e 's/[A-Za-z]$//'`
3179                 else
3180                         osvers="$2.$3"
3181                 fi
3182         fi
3183
3184         $test -f /sys/posix.dll &&
3185                 $test -f /usr/bin/what &&
3186                 set X `/usr/bin/what /sys/posix.dll` &&
3187                 $test "$3" = UWIN &&
3188                 osname=uwin &&
3189                 osvers="$5"
3190
3191         if $test -f $uname; then
3192                 set X $myuname
3193                 shift
3194
3195                 case "$5" in
3196                 fps*) osname=fps ;;
3197                 mips*)
3198                         case "$4" in
3199                         umips) osname=umips ;;
3200                         *) osname=mips ;;
3201                         esac;;
3202                 [23]100) osname=mips ;;
3203                 next*) osname=next ;;
3204                 i386*)
3205                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3206                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3207                                 osname='sco'
3208                                 osvers=$tmp
3209                         elif $test -f /etc/kconfig; then
3210                                 osname=isc
3211                                 if test "$lns" = "$ln -s"; then
3212                                         osvers=4
3213                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3214                                         osvers=3
3215                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3216                                         osvers=2
3217                                 fi
3218                         fi
3219                         tmp=''
3220                         ;;
3221                 pc*)
3222                         if test -n "$DJGPP"; then
3223                                 osname=dos
3224                                 osvers=djgpp
3225                         fi
3226                         ;;
3227                 esac
3228
3229                 case "$1" in
3230                 aix) osname=aix
3231                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3232                         case "$tmp" in
3233                         # oslevel can fail with:
3234                         # oslevel: Unable to acquire lock.
3235                         *not\ found) osvers="$4"."$3" ;;
3236                         '<3240'|'<>3240') osvers=3.2.0 ;;
3237                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3238                         '=3250'|'>3250') osvers=3.2.5 ;;
3239                         *) osvers=$tmp;;
3240                         esac
3241                         ;;
3242                 bsd386) osname=bsd386
3243                         osvers=`$uname -r`
3244                         ;;
3245                 cygwin*) osname=cygwin
3246                         osvers="$3"
3247                         ;;
3248                 *dc.osx) osname=dcosx
3249                         osvers="$3"
3250                         ;;
3251                 dnix) osname=dnix
3252                         osvers="$3"
3253                         ;;
3254                 domainos) osname=apollo
3255                         osvers="$3"
3256                         ;;
3257                 dgux)   osname=dgux
3258                         osvers="$3"
3259                         ;;
3260                 dragonfly) osname=dragonfly
3261                         osvers="$3"
3262                         ;;
3263                 dynixptx*) osname=dynixptx
3264                         osvers=`echo "$4"|sed 's/^v//'`
3265                         ;;
3266                 freebsd) osname=freebsd
3267                         osvers="$3" ;;
3268                 genix)  osname=genix ;;
3269                 gnu)    osname=gnu
3270                         osvers="$3" ;;
3271                 hp*)    osname=hpux
3272                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3273                         ;;
3274                 irix*)  osname=irix
3275                         case "$3" in
3276                         4*) osvers=4 ;;
3277                         5*) osvers=5 ;;
3278                         *)      osvers="$3" ;;
3279                         esac
3280                         ;;
3281                 linux)  osname=linux
3282                         case "$3" in
3283                         *)      osvers="$3" ;;
3284                         esac
3285                         ;;
3286                 MiNT)   osname=mint
3287                         ;;
3288                 netbsd*) osname=netbsd
3289                         osvers="$3"
3290                         ;;
3291                 news-os) osvers="$3"
3292                         case "$3" in
3293                         4*) osname=newsos4 ;;
3294                         *) osname=newsos ;;
3295                         esac
3296                         ;;
3297                 next*) osname=next ;;
3298                 nonstop-ux) osname=nonstopux ;;
3299                 openbsd) osname=openbsd
3300                         osvers="$3"
3301                         ;;
3302                 os2)    osname=os2
3303                         osvers="$4"
3304                         ;;
3305                 POSIX-BC | posix-bc ) osname=posix-bc
3306                         osvers="$3"
3307                         ;;
3308                 powerux | power_ux | powermax_os | powermaxos | \
3309                 powerunix | power_unix) osname=powerux
3310                         osvers="$3"
3311                         ;;
3312                 qnx) osname=qnx
3313                         osvers="$4"
3314                         ;;
3315                 solaris) osname=solaris
3316                         case "$3" in
3317                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3318                         *)      osvers="$3" ;;
3319                         esac
3320                         ;;
3321                 sunos) osname=sunos
3322                         case "$3" in
3323                         5*) osname=solaris
3324                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3325                         *)      osvers="$3" ;;
3326                         esac
3327                         ;;
3328                 titanos) osname=titanos
3329                         case "$3" in
3330                         1*) osvers=1 ;;
3331                         2*) osvers=2 ;;
3332                         3*) osvers=3 ;;
3333                         4*) osvers=4 ;;
3334                         *)      osvers="$3" ;;
3335                         esac
3336                         ;;
3337                 ultrix) osname=ultrix
3338                         osvers="$3"
3339                         ;;
3340                 osf1|mls+)      case "$5" in
3341                                 alpha)
3342                                         osname=dec_osf
3343                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3344                                         case "$osvers" in
3345                                         [1-9].[0-9]*) ;;
3346                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3347                                         esac
3348                                         ;;
3349                         hp*)    osname=hp_osf1  ;;
3350                         mips)   osname=mips_osf1 ;;
3351                         esac
3352                         ;;
3353                 # UnixWare 7.1.2 is known as Open UNIX 8
3354                 openunix|unixware) osname=svr5
3355                         osvers="$4"
3356                         ;;
3357                 uts)    osname=uts
3358                         osvers="$3"
3359                         ;;
3360                 vos) osvers="$3"
3361                         ;;
3362                 $2) case "$osname" in
3363                         *isc*) ;;
3364                         *freebsd*) ;;
3365                         svr*)
3366                                 : svr4.x or possibly later
3367                                 case "svr$3" in
3368                                 ${osname}*)
3369                                         osname=svr$3
3370                                         osvers=$4
3371                                         ;;
3372                                 esac
3373                                 case "$osname" in
3374                                 svr4.0)
3375                                         : Check for ESIX
3376                                         if test -f /stand/boot ; then
3377                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3378                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3379                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3380                                                         if test -n "$isesix"; then
3381                                                                 osname=esix4
3382                                                         fi
3383                                                 fi
3384                                         fi
3385                                         ;;
3386                                 esac
3387                                 ;;
3388                         *)      if test -f /etc/systemid; then
3389                                         osname=sco
3390                                         set `echo $3 | $sed 's/\./ /g'` $4
3391                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3392                                                 osvers=$1.$2.$3
3393                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3394                                                 osvers=$1.$2
3395                                         elif $test -f $src/hints/sco_$1.sh; then
3396                                                 osvers=$1
3397                                         fi
3398                                 else
3399                                         case "$osname" in
3400                                         '') : Still unknown.  Probably a generic Sys V.
3401                                                 osname="sysv"
3402                                                 osvers="$3"
3403                                                 ;;
3404                                         esac
3405                                 fi
3406                                 ;;
3407                         esac
3408                         ;;
3409                 *)      case "$osname" in
3410                         '') : Still unknown.  Probably a generic BSD.
3411                                 osname="$1"
3412                                 osvers="$3"
3413                                 ;;
3414                         esac
3415                         ;;
3416                 esac
3417         else
3418                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3419                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3420                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3421                                 osname=news_os
3422                         fi
3423                         $rm -f UU/kernel.what
3424                 elif test -d c:/. -o -n "$is_os2" ; then
3425                         set X $myuname
3426                         osname=os2
3427                         osvers="$5"
3428                 fi
3429         fi
3430
3431         case "$targetarch" in
3432         '') ;;
3433         *)  hostarch=$osname
3434             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3435             osvers=''
3436             ;;
3437         esac
3438
3439         : Now look for a hint file osname_osvers, unless one has been
3440         : specified already.
3441         case "$hintfile" in
3442         ''|' ')
3443                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3444                 : Also try without trailing minor version numbers.
3445                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3446                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3447                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3448                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3449                 case "$file" in
3450                 '') dflt=none ;;
3451                 *)  case "$osvers" in
3452                         '') dflt=$file
3453                                 ;;
3454                         *)  if $test -f $src/hints/$file.sh ; then
3455                                         dflt=$file
3456                                 elif $test -f $src/hints/$xfile.sh ; then
3457                                         dflt=$xfile
3458                                 elif $test -f $src/hints/$xxfile.sh ; then
3459                                         dflt=$xxfile
3460                                 elif $test -f $src/hints/$xxxfile.sh ; then
3461                                         dflt=$xxxfile
3462                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3463                                         dflt=$xxxxfile
3464                                 elif $test -f "$src/hints/${osname}.sh" ; then
3465                                         dflt="${osname}"
3466                                 else
3467                                         dflt=none
3468                                 fi
3469                                 ;;
3470                         esac
3471                         ;;
3472                 esac
3473                 if $test -f Policy.sh ; then
3474                         case "$dflt" in
3475                         *Policy*) ;;
3476                         none) dflt="Policy" ;;
3477                         *) dflt="Policy $dflt" ;;
3478                         esac
3479                 fi
3480                 ;;
3481         *)
3482                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3483                 ;;
3484         esac
3485
3486         if $test -f Policy.sh ; then
3487                 $cat <<EOM
3488
3489 There's also a Policy hint file available, which should make the
3490 site-specific (policy) questions easier to answer.
3491 EOM
3492
3493         fi
3494
3495         $cat <<EOM
3496
3497 You may give one or more space-separated answers, or "none" if appropriate.
3498 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3499 previous run of Configure, you may specify it as well as or instead of
3500 OS-specific hints.  If hints are provided for your OS, you should use them:
3501 although Perl can probably be built without hints on many platforms, using
3502 hints often improve performance and may enable features that Configure can't
3503 set up on its own. If there are no hints that match your OS, specify "none";
3504 DO NOT give a wrong version or a wrong OS.
3505
3506 EOM
3507
3508         rp="Which of these apply, if any?"
3509         . UU/myread
3510         tans=$ans
3511         for file in $tans; do
3512                 if $test X$file = XPolicy -a -f Policy.sh; then
3513                         . Policy.sh
3514                         $cat Policy.sh >> UU/config.sh
3515                 elif $test -f $src/hints/$file.sh; then
3516                         . $src/hints/$file.sh
3517                         $cat $src/hints/$file.sh >> UU/config.sh
3518                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3519                         : nothing
3520                 else
3521                         : Give one chance to correct a possible typo.
3522                         echo "$file.sh does not exist"
3523                         dflt=$file
3524                         rp="hint to use instead?"
3525                         . UU/myread
3526                         for file in $ans; do
3527                                 if $test -f "$src/hints/$file.sh"; then
3528                                         . $src/hints/$file.sh
3529                                         $cat $src/hints/$file.sh >> UU/config.sh
3530                                 elif $test X$ans = X -o X$ans = Xnone ; then
3531                                         : nothing
3532                                 else
3533                                         echo "$file.sh does not exist -- ignored."
3534                                 fi
3535                         done
3536                 fi
3537         done
3538
3539         hint=recommended
3540         : Remember our hint file for later.
3541         if $test -f "$src/hints/$file.sh" ; then
3542                 hintfile="$file"
3543         else
3544                 hintfile=''
3545         fi
3546 fi
3547 cd UU
3548 ;;
3549 *)
3550         echo " "
3551         echo "Fetching default answers from $config_sh..." >&4
3552         tmp_n="$n"
3553         tmp_c="$c"
3554         cd ..
3555         cp $config_sh config.sh 2>/dev/null
3556         chmod +w config.sh
3557         . ./config.sh
3558         cd UU
3559         cp ../config.sh .
3560         n="$tmp_n"
3561         c="$tmp_c"
3562         hint=previous
3563         ;;
3564 esac
3565 test "$override" && . ./optdef.sh
3566
3567 : Restore computed paths
3568 for file in $loclist $trylist; do
3569         eval $file="\$_$file"
3570 done
3571
3572 cat << EOM
3573
3574 Configure uses the operating system name and version to set some defaults.
3575 The default value is probably right if the name rings a bell. Otherwise,
3576 since spelling matters for me, either accept the default or answer "none"
3577 to leave it blank.
3578
3579 EOM
3580 case "$osname" in
3581         ''|' ')
3582                 case "$hintfile" in
3583                 ''|' '|none) dflt=none ;;
3584                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3585                 esac
3586                 ;;
3587         *) dflt="$osname" ;;
3588 esac
3589 rp="Operating system name?"
3590 . ./myread
3591 case "$ans" in
3592 none)  osname='' ;;
3593 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3594 esac
3595 echo " "
3596 case "$osvers" in
3597         ''|' ')
3598                 case "$hintfile" in
3599                 ''|' '|none) dflt=none ;;
3600                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3601                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3602                         case "$dflt" in
3603                         ''|' ') dflt=none ;;
3604                         esac
3605                         ;;
3606                 esac
3607                 ;;
3608         *) dflt="$osvers" ;;
3609 esac
3610 rp="Operating system version?"
3611 . ./myread
3612 case "$ans" in
3613 none)  osvers='' ;;
3614 *) osvers="$ans" ;;
3615 esac
3616
3617
3618 . ./posthint.sh
3619
3620 : who configured the system
3621 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3622 case "$cf_by" in
3623 "")
3624         cf_by=`(logname) 2>/dev/null`
3625         case "$cf_by" in
3626         "")
3627                 cf_by=`(whoami) 2>/dev/null`
3628                 case "$cf_by" in
3629                 "") cf_by=unknown ;;
3630                 esac ;;
3631         esac ;;
3632 esac
3633
3634 : decide how portable to be.  Allow command line overrides.
3635 case "$d_portable" in
3636 "$undef") ;;
3637 *)      d_portable="$define" ;;
3638 esac
3639
3640 : set up shell script to do ~ expansion
3641 cat >filexp <<EOSS
3642 $startsh
3643 : expand filename
3644 case "\$1" in
3645  \~/*|\~)
3646         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3647         ;;
3648  \~*)
3649         if $test -f /bin/csh; then
3650                 /bin/csh -f -c "glob \$1"
3651                 failed=\$?
3652                 echo ""
3653                 exit \$failed
3654         else
3655                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3656                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3657                 if $test ! -d "\$dir"; then
3658                         me=\`basename \$0\`
3659                         echo "\$me: can't locate home directory for: \$name" >&2
3660                         exit 1
3661                 fi
3662                 case "\$1" in
3663                 */*)
3664                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3665                         ;;
3666                 *)
3667                         echo \$dir
3668                         ;;
3669                 esac
3670         fi
3671         ;;
3672 *)
3673         echo \$1
3674         ;;
3675 esac
3676 EOSS
3677 chmod +x filexp
3678 $eunicefix filexp
3679
3680 : now set up to get a file name
3681 cat <<EOS >getfile
3682 $startsh
3683 EOS
3684 cat <<'EOSC' >>getfile
3685 tilde=''
3686 fullpath=''
3687 already=''
3688 skip=''
3689 none_ok=''
3690 exp_file=''
3691 nopath_ok=''
3692 orig_rp="$rp"
3693 orig_dflt="$dflt"
3694 case "$gfpth" in
3695 '') gfpth='.' ;;
3696 esac
3697
3698 case "$fn" in
3699 *\(*)
3700         : getfile will accept an answer from the comma-separated list
3701         : enclosed in parentheses even if it does not meet other criteria.
3702         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3703         fn=`echo $fn | sed 's/(.*)//'`
3704         ;;
3705 esac
3706
3707 case "$fn" in
3708 *:*)
3709         loc_file=`expr $fn : '.*:\(.*\)'`
3710         fn=`expr $fn : '\(.*\):.*'`
3711         ;;
3712 esac
3713
3714 case "$fn" in
3715 *~*) tilde=true;;
3716 esac
3717 case "$fn" in
3718 */*) fullpath=true;;
3719 esac
3720 case "$fn" in
3721 *+*) skip=true;;
3722 esac
3723 case "$fn" in
3724 *n*) none_ok=true;;
3725 esac
3726 case "$fn" in
3727 *e*) exp_file=true;;
3728 esac
3729 case "$fn" in
3730 *p*) nopath_ok=true;;
3731 esac
3732
3733 case "$fn" in
3734 *f*) type='File';;
3735 *d*) type='Directory';;
3736 *l*) type='Locate';;
3737 esac
3738
3739 what="$type"
3740 case "$what" in
3741 Locate) what='File';;
3742 esac
3743
3744 case "$exp_file" in
3745 '')
3746         case "$d_portable" in
3747         "$define") ;;
3748         *) exp_file=true;;
3749         esac
3750         ;;
3751 esac
3752
3753 cd ..
3754 while test "$type"; do
3755         redo=''
3756         rp="$orig_rp"
3757         dflt="$orig_dflt"
3758         case "$tilde" in
3759         true) rp="$rp (~name ok)";;
3760         esac
3761         . UU/myread
3762         if test -f UU/getfile.ok && \
3763                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3764         then
3765                 value="$ans"
3766                 ansexp="$ans"
3767                 break
3768         fi
3769         case "$ans" in
3770         none)
3771                 value=''
3772                 ansexp=''
3773                 case "$none_ok" in
3774                 true) type='';;
3775                 esac
3776                 ;;
3777         *)
3778                 case "$tilde" in
3779                 '') value="$ans"
3780                         ansexp="$ans";;
3781                 *)
3782                         value=`UU/filexp $ans`
3783                         case $? in
3784                         0)
3785                                 if test "$ans" != "$value"; then
3786                                         echo "(That expands to $value on this system.)"
3787                                 fi
3788                                 ;;
3789                         *) value="$ans";;
3790                         esac
3791                         ansexp="$value"
3792                         case "$exp_file" in
3793                         '') value="$ans";;
3794                         esac
3795                         ;;
3796                 esac
3797                 case "$fullpath" in
3798                 true)
3799                         case "$ansexp" in
3800                         /*) value="$ansexp" ;;
3801                         [a-zA-Z]:/*) value="$ansexp" ;;
3802                         *)
3803                                 redo=true
3804                                 case "$already" in
3805                                 true)
3806                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3807                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3808                                         ;;
3809                                 *)
3810                                 echo "Please give a full path name, starting with slash." >&4
3811                                         case "$tilde" in
3812                                         true)
3813                                 echo "Note that using ~name is ok provided it expands well." >&4
3814                                                 already=true
3815                                                 ;;
3816                                         esac
3817                                 esac
3818                                 ;;
3819                         esac
3820                         ;;
3821                 esac
3822                 case "$redo" in
3823                 '')
3824                         case "$type" in
3825                         File)
3826                                 for fp in $gfpth; do
3827                                         if test "X$fp" = X.; then
3828                                             pf="$ansexp"
3829                                         else    
3830                                             pf="$fp/$ansexp"
3831                                         fi
3832                                         if test -f "$pf"; then
3833                                                 type=''
3834                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3835                                         then
3836                                                 echo "($value is not a plain file, but that's ok.)"
3837                                                 type=''
3838                                         fi
3839                                         if test X"$type" = X; then
3840                                             value="$pf"
3841                                             break
3842                                         fi
3843                                 done
3844                                 ;;
3845                         Directory)
3846                                 for fp in $gfpth; do
3847                                         if test "X$fp" = X.; then
3848                                             dir="$ans"
3849                                             direxp="$ansexp"
3850                                         else    
3851                                             dir="$fp/$ansexp"
3852                                             direxp="$fp/$ansexp"
3853                                         fi
3854                                         if test -d "$direxp"; then
3855                                                 type=''
3856                                                 value="$dir"
3857                                                 break
3858                                         fi
3859                                 done
3860                                 ;;
3861                         Locate)
3862                                 if test -d "$ansexp"; then
3863                                         echo "(Looking for $loc_file in directory $value.)"
3864                                         value="$value/$loc_file"
3865                                         ansexp="$ansexp/$loc_file"
3866                                 fi
3867                                 if test -f "$ansexp"; then
3868                                         type=''
3869                                 fi
3870                                 case "$nopath_ok" in
3871                                 true)   case "$value" in
3872                                         */*) ;;
3873                                         *)      echo "Assuming $value will be in people's path."
3874                                                 type=''
3875                                                 ;;
3876                                         esac
3877                                         ;;
3878                                 esac
3879                                 ;;
3880                         esac
3881
3882                         case "$skip" in
3883                         true) type='';
3884                         esac
3885
3886                         case "$type" in
3887                         '') ;;
3888                         *)
3889                                 if test "$fastread" = yes; then
3890                                         dflt=y
3891                                 else
3892                                         dflt=n
3893                                 fi
3894                                 rp="$what $value doesn't exist.  Use that name anyway?"
3895                                 . UU/myread
3896                                 dflt=''
3897                                 case "$ans" in
3898                                 y*) type='';;
3899                                 *) echo " ";;
3900                                 esac
3901                                 ;;
3902                         esac
3903                         ;;
3904                 esac
3905                 ;;
3906         esac
3907 done
3908 cd UU
3909 ans="$value"
3910 rp="$orig_rp"
3911 dflt="$orig_dflt"
3912 rm -f getfile.ok
3913 test "X$gfpthkeep" != Xy && gfpth=""
3914 EOSC
3915
3916 : determine root of directory hierarchy where package will be installed.
3917 case "$prefix" in
3918 '')
3919         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3920         ;;
3921 *?/)
3922         dflt=`echo "$prefix" | sed 's/.$//'`
3923         ;;
3924 *)
3925         dflt="$prefix"
3926         ;;
3927 esac
3928 $cat <<EOM
3929
3930 By default, $package will be installed in $dflt/bin, manual pages
3931 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3932 installation directories. Typically this is something like /usr/local.
3933 If you wish to have binaries under /usr/bin but other parts of the
3934 installation under /usr/local, that's ok: you will be prompted
3935 separately for each of the installation directories, the prefix being
3936 only used to set the defaults.
3937
3938 EOM
3939 fn=d~
3940 rp='Installation prefix to use?'
3941 . ./getfile
3942 oldprefix=''
3943 case "$prefix" in
3944 '') ;;
3945 *)
3946         case "$ans" in
3947         "$prefix") ;;
3948         *) oldprefix="$prefix";;
3949         esac
3950         ;;
3951 esac
3952 prefix="$ans"
3953 prefixexp="$ansexp"
3954
3955 : allow them to override the AFS root
3956 case "$afsroot" in
3957 '')     afsroot=/afs ;;
3958 *)      afsroot=$afsroot ;;
3959 esac
3960
3961 : is AFS running?
3962 echo " "
3963 case "$afs" in
3964 $define|true)   afs=true ;;
3965 $undef|false)   afs=false ;;
3966 *)      if $test -d $afsroot; then
3967                 afs=true
3968         else
3969                 afs=false
3970         fi
3971         ;;
3972 esac
3973 if $afs; then
3974         echo "AFS may be running... I'll be extra cautious then..." >&4
3975 else
3976         echo "AFS does not seem to be running..." >&4
3977 fi
3978
3979 : determine installation prefix for where package is to be installed.
3980 if $afs; then 
3981 $cat <<EOM
3982
3983 Since you are running AFS, I need to distinguish the directory in which
3984 files will reside from the directory in which they are installed (and from
3985 which they are presumably copied to the former directory by occult means).
3986
3987 EOM
3988         case "$installprefix" in
3989         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3990         *) dflt="$installprefix";;
3991         esac
3992 else
3993 $cat <<EOM
3994
3995 In some special cases, particularly when building $package for distribution,
3996 it is convenient to distinguish the directory in which files should be
3997 installed from the directory ($prefix) in which they will
3998 eventually reside.  For most users, these two directories are the same.
3999
4000 EOM
4001         case "$installprefix" in
4002         '') dflt=$prefix ;;
4003         *) dflt=$installprefix;;
4004         esac
4005 fi
4006 fn=d~
4007 rp='What installation prefix should I use for installing files?'
4008 . ./getfile
4009 installprefix="$ans"
4010 installprefixexp="$ansexp"
4011
4012 : Perform the prefixexp/installprefixexp correction if necessary
4013 cat <<EOS >installprefix
4014 $startsh
4015 EOS
4016 cat <<'EOSC' >>installprefix
4017 : Change installation prefix, if necessary.
4018 if $test X"$prefix" != X"$installprefix"; then
4019     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4020 else
4021     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4022 fi
4023 EOSC
4024 chmod +x installprefix
4025 $eunicefix installprefix
4026
4027 : Set variables such as privlib and privlibexp from the output of ./getfile
4028 : performing the prefixexp/installprefixexp correction if necessary.
4029 cat <<EOS >setprefixvar
4030 $startsh
4031 EOS
4032 cat <<'EOSC' >>setprefixvar
4033 eval "${prefixvar}=\"\$ans\""
4034 eval "${prefixvar}exp=\"\$ansexp\""
4035 . ./installprefix
4036 EOSC
4037 chmod +x setprefixvar
4038 $eunicefix setprefixvar
4039
4040 : set up the script used to warn in case of inconsistency
4041 cat <<EOS >whoa
4042 $startsh
4043 EOS
4044 cat <<'EOSC' >>whoa
4045 dflt=y
4046 case "$hint" in
4047     recommended)
4048         case "$hintfile" in
4049         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4050                 ;;
4051         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4052                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4053                 ;;
4054         esac
4055         ;;
4056     *)  echo " "
4057         echo "*** WHOA THERE!!! ***" >&4
4058         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4059         ;;
4060 esac
4061 rp="    Keep the $hint value?"
4062 . ./myread
4063 case "$ans" in
4064 y) td=$was; tu=$was;;
4065 esac
4066 EOSC
4067
4068 : function used to set '$1' to '$val'
4069 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4070 case "$val$was" in
4071 $define$undef) . ./whoa; eval "$var=\$td";;
4072 $undef$define) . ./whoa; eval "$var=\$tu";;
4073 *) eval "$var=$val";;
4074 esac'
4075
4076 : get the patchlevel
4077 echo " "
4078 echo "Getting the current patchlevel..." >&4
4079 if $test -r $rsrc/patchlevel.h;then
4080         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4081         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4082         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4083         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4084         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4085         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4086         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4087 else
4088         revision=0
4089         patchlevel=0
4090         subversion=0
4091         api_revision=0
4092         api_version=0
4093         api_subversion=0
4094         perl_patchlevel=0
4095         $echo "(You do not have patchlevel.h.  Eek.)"
4096 fi
4097 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4098 version_patchlevel_string="version $patchlevel subversion $subversion"
4099 case "$perl_patchlevel" in
4100 0|'') ;;
4101 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4102     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4103     ;;
4104 esac
4105
4106 $echo "(You have $package $version_patchlevel_string.)"
4107
4108 case "$osname" in
4109 dos|vms)
4110         : XXX Should be a Configure test for double-dots in filenames.
4111         version=`echo $revision $patchlevel $subversion | \
4112                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4113         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4114                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4115         ;;
4116 *)
4117         version=`echo $revision $patchlevel $subversion | \
4118                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4119         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4120                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4121         ;;
4122 esac
4123 : Special case the 5.005_xx maintenance series, which used 5.005
4124 : without any subversion label as a subdirectory in $sitelib
4125 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4126         api_versionstring='5.005'
4127 fi
4128
4129 : Do we want threads support and if so, what type
4130 case "$usethreads" in
4131 $define|true|[yY]*)     dflt='y';;
4132 *)     # Catch case where user specified ithreads or 5005threads but
4133        # forgot -Dusethreads (A.D. 4/2002)
4134        case "$useithreads$use5005threads" in
4135        *$define*)       dflt='y';;
4136        *)               dflt='n';;
4137        esac
4138        ;;
4139 esac
4140 cat <<EOM
4141
4142 Perl can be built to take advantage of threads on some systems.
4143 To do so, Configure can be run with -Dusethreads.
4144
4145 Note that Perl built with threading support runs slightly slower
4146 and uses more memory than plain Perl. The current implementation
4147 is believed to be stable, but it is fairly new, and so should be
4148 treated with caution.
4149
4150 If this doesn't make any sense to you, just accept the default '$dflt'.
4151 EOM
4152 rp='Build a threading Perl?'
4153 . ./myread
4154 case "$ans" in
4155 y|Y)    val="$define" ;;
4156 *)      val="$undef" ;;
4157 esac
4158 set usethreads
4159 eval $setvar
4160
4161 if $test $patchlevel -lt 9; then
4162     case "$usethreads" in
4163     $define)
4164         $cat <<EOM
4165
4166 Since release 5.6, Perl has had two different threading implementations,
4167 the newer interpreter-based version (ithreads) with one interpreter per
4168 thread, and the older 5.005 version (5005threads).
4169 The 5005threads version is effectively unmaintained and will probably be
4170 removed in Perl 5.10, so there should be no need to build a Perl using it
4171 unless needed for backwards compatibility with some existing 5.005threads
4172 code.
4173
4174 EOM
4175         : Default to ithreads unless overridden on command line or with
4176         : old config.sh
4177         dflt='y'
4178         case "$use5005threads" in
4179                 $define|true|[yY]*) dflt='n';;
4180         esac
4181         case "$useithreads" in
4182                 $undef|false|[nN]*) dflt='n';;
4183         esac
4184         rp='Use the newer interpreter-based ithreads?'
4185         . ./myread
4186         case "$ans" in
4187         y|Y)    val="$define" ;;
4188         *)      val="$undef" ;;
4189         esac
4190         set useithreads
4191         eval $setvar
4192         : Now set use5005threads to the opposite value.
4193         case "$useithreads" in
4194         $define) val="$undef" ;;
4195         *) val="$define" ;;
4196         esac
4197         set use5005threads
4198         eval $setvar
4199         ;;
4200     *)
4201         useithreads="$undef"
4202         use5005threads="$undef"
4203         ;;
4204     esac
4205
4206     case "$useithreads$use5005threads" in
4207     "$define$define")
4208         $cat >&4 <<EOM
4209
4210 You cannot have both the ithreads and the 5.005 threads enabled
4211 at the same time.  Disabling the 5.005 threads since they are
4212 much less stable than the ithreads.
4213
4214 EOM
4215         use5005threads="$undef"
4216         ;;
4217     esac
4218
4219 else
4220 : perl-5.9.x and later
4221
4222     if test X"$usethreads" = "X$define"; then
4223         case "$use5005threads" in
4224             $define|true|[yY]*)
4225                 $cat >&4 <<EOM
4226
4227 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4228
4229 EOM
4230             ;;
4231         esac
4232     fi
4233
4234     use5005threads="$undef"
4235     useithreads="$usethreads"
4236 fi
4237
4238 case "$d_oldpthreads" in
4239 '')     : Configure tests would be welcome here.  For now, assume undef.
4240         val="$undef" ;;
4241 *)      val="$d_oldpthreads" ;;
4242 esac
4243 set d_oldpthreads
4244 eval $setvar
4245
4246
4247 : Look for a hint-file generated 'call-back-unit'.  If the
4248 : user has specified that a threading perl is to be built,
4249 : we may need to set or change some other defaults.
4250 if $test -f usethreads.cbu; then
4251     echo "Your platform has some specific hints regarding threaded builds, using them..."
4252     . ./usethreads.cbu
4253 else
4254     case "$usethreads" in
4255         "$define"|true|[yY]*)
4256                 $cat <<EOM
4257 (Your platform does not have any specific hints for threaded builds.
4258  Assuming POSIX threads, then.)
4259 EOM
4260         ;;
4261     esac
4262 fi
4263
4264 : Check if multiplicity is required
4265 cat <<EOM
4266
4267 Perl can be built so that multiple Perl interpreters can coexist
4268 within the same Perl executable.
4269 EOM
4270
4271 case "$useithreads" in
4272 $define)
4273         cat <<EOM
4274 This multiple interpreter support is required for interpreter-based threads.
4275 EOM
4276         val="$define"
4277         ;;
4278 *)      case "$usemultiplicity" in
4279         $define|true|[yY]*)     dflt='y';;
4280         *) dflt='n';;
4281         esac
4282         echo " "
4283         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4284         rp='Build Perl for multiplicity?'
4285         . ./myread
4286         case "$ans" in
4287         y|Y)    val="$define" ;;
4288         *)      val="$undef" ;;
4289         esac
4290         ;;
4291 esac
4292 set usemultiplicity
4293 eval $setvar
4294
4295 : Check if morebits is requested
4296 case "$usemorebits" in
4297 "$define"|true|[yY]*)
4298         use64bitint="$define"
4299         uselongdouble="$define"
4300         usemorebits="$define"
4301         ;;
4302 *)      usemorebits="$undef"
4303         ;;
4304 esac
4305
4306 : Determine the C compiler to be used
4307 echo " "
4308 case "$cc" in
4309 '') dflt=cc;;
4310 *) dflt="$cc";;
4311 esac
4312 rp="Use which C compiler?"
4313 . ./myread
4314 cc="$ans"
4315
4316 : See whether they have no cc but they do have gcc
4317 . ./trygcc
4318 if $test -f cc.cbu; then
4319     . ./cc.cbu
4320 fi
4321 . ./checkcc
4322
4323 : make some quick guesses about what we are up against
4324 echo " "
4325 $echo $n "Hmm...  $c"
4326 echo exit 1 >bsd
4327 echo exit 1 >usg
4328 echo exit 1 >v7
4329 echo exit 1 >osf1
4330 echo exit 1 >eunice
4331 echo exit 1 >xenix
4332 echo exit 1 >venix
4333 echo exit 1 >os2
4334 d_bsd="$undef"
4335 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4336 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4337 then
4338         echo "Looks kind of like an OSF/1 system, but we'll see..."
4339         echo exit 0 >osf1
4340 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4341         xxx=`./loc addbib blurfl $pth`
4342         if $test -f $xxx; then
4343         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4344                 echo exit 0 >bsd
4345                 echo exit 0 >usg
4346         else
4347                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4348                         echo "Looks kind of like an extended USG system, but we'll see..."
4349                 else
4350                         echo "Looks kind of like a USG system, but we'll see..."
4351                 fi
4352                 echo exit 0 >usg
4353         fi
4354 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4355         echo "Looks kind of like a BSD system, but we'll see..."
4356         d_bsd="$define"
4357         echo exit 0 >bsd
4358 else
4359         echo "Looks kind of like a Version 7 system, but we'll see..."
4360         echo exit 0 >v7
4361 fi
4362 case "$eunicefix" in
4363 *unixtovms*)
4364         $cat <<'EOI'
4365 There is, however, a strange, musty smell in the air that reminds me of
4366 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4367 EOI
4368         echo exit 0 >eunice
4369         d_eunice="$define"
4370 : it so happens the Eunice I know will not run shell scripts in Unix format
4371         ;;
4372 *)
4373         echo " "
4374         echo "Congratulations.  You aren't running Eunice."
4375         d_eunice="$undef"
4376         ;;
4377 esac
4378 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4379 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4380 : semicolon as a patch separator
4381 case "$p_" in
4382 :) ;;
4383 *)
4384         $cat <<'EOI'
4385 I have the feeling something is not exactly right, however...don't tell me...
4386 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4387 (Or you may be running DOS with DJGPP.)
4388 EOI
4389         echo exit 0 >os2
4390         ;;
4391 esac
4392 if test -f /xenix; then
4393         echo "Actually, this looks more like a XENIX system..."
4394         echo exit 0 >xenix
4395         d_xenix="$define"
4396 else
4397         echo " "
4398         echo "It's not Xenix..."
4399         d_xenix="$undef"
4400 fi
4401 chmod +x xenix
4402 $eunicefix xenix
4403 if test -f /venix; then
4404         echo "Actually, this looks more like a VENIX system..."
4405         echo exit 0 >venix
4406 else
4407         echo " "
4408         if ./xenix; then
4409                 : null
4410         else
4411                 echo "Nor is it Venix..."
4412         fi
4413 fi
4414 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4415 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4416 $rm -f foo
4417
4418 : Check if we are using GNU gcc and what its version is
4419 echo " "
4420 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4421 $cat >try.c <<EOM
4422 #include <stdio.h>
4423 int main() {
4424 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4425 #ifdef __VERSION__
4426         printf("%s\n", __VERSION__);
4427 #else
4428         printf("%s\n", "1");
4429 #endif
4430 #endif
4431         return(0);
4432 }
4433 EOM
4434 if $cc -o try $ccflags $ldflags try.c; then
4435         gccversion=`$run ./try`
4436         case "$gccversion" in
4437         '') echo "You are not using GNU cc." ;;
4438         *)  echo "You are using GNU cc $gccversion."
4439             ccname=gcc
4440             ;;
4441         esac
4442 else
4443         echo " "
4444         echo "*** WHOA THERE!!! ***" >&4
4445         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4446         case "$knowitall" in
4447         '')
4448         echo "    You'd better start hunting for one and let me know about it." >&4
4449                 exit 1
4450                 ;;
4451         esac
4452 fi
4453 $rm -f try try.*
4454 case "$gccversion" in
4455 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4456 esac
4457 case "$gccversion" in
4458 '') gccosandvers='' ;;
4459 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4460    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4461    gccshortvers=''
4462    case "$gccosandvers" in
4463    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4464    $osname$osvers) ;; # looking good
4465    $osname*) cat <<EOM >&4
4466
4467 *** WHOA THERE!!! ***
4468
4469     Your gcc has not been compiled for the exact release of
4470     your operating system ($gccosandvers versus $osname$osvers).
4471
4472     In general it is a good idea to keep gcc synchronized with
4473     the operating system because otherwise serious problems
4474     may ensue when trying to compile software, like Perl.
4475
4476     I'm trying to be optimistic here, though, and will continue.
4477     If later during the configuration and build icky compilation
4478     problems appear (headerfile conflicts being the most common
4479     manifestation), I suggest reinstalling the gcc to match
4480     your operating system release.
4481
4482 EOM
4483       ;;
4484    *) gccosandvers='' ;; # failed to parse, better be silent
4485    esac
4486    ;;
4487 esac
4488 case "$ccname" in
4489 '') ccname="$cc" ;;
4490 esac
4491
4492 # gcc 3.* complain about adding -Idirectories that they already know about,
4493 # so we will take those off from locincpth.
4494 case "$gccversion" in
4495 3*)
4496     echo "main(){}">try.c
4497     for incdir in $locincpth; do
4498        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4499              grep '^c[cp]p*[01]: warning: changing search order '`
4500        if test "X$warn" != X; then
4501            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4502        fi
4503     done
4504     $rm -f try try.*
4505 esac
4506
4507 : What should the include directory be ?
4508 echo " "
4509 $echo $n "Hmm...  $c"
4510 dflt='/usr/include'
4511 incpath=''
4512 mips_type=''
4513 if $test -f /bin/mips && /bin/mips; then
4514         echo "Looks like a MIPS system..."
4515         $cat >usr.c <<'EOCP'
4516 #ifdef SYSTYPE_BSD43
4517 /bsd43
4518 #endif
4519 EOCP
4520         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4521                 dflt='/bsd43/usr/include'
4522                 incpath='/bsd43'
4523                 mips_type='BSD 4.3'
4524         else
4525                 mips_type='System V'
4526         fi
4527         $rm -f usr.c usr.out
4528         echo "and you're compiling with the $mips_type compiler and libraries."
4529         xxx_prompt=y
4530         echo "exit 0" >mips
4531 else
4532         echo "Doesn't look like a MIPS system."
4533         xxx_prompt=n
4534         echo "exit 1" >mips
4535 fi
4536 chmod +x mips
4537 $eunicefix mips
4538 case "$usrinc" in
4539 '') ;;
4540 *) dflt="$usrinc";;
4541 esac
4542 case "$xxx_prompt" in
4543 y)      fn=d/
4544         echo " "
4545         rp='Where are the include files you want to use?'
4546         . ./getfile
4547         usrinc="$ans"
4548         ;;
4549 *)      usrinc="$dflt"
4550         ;;
4551 esac
4552
4553 : see how we invoke the C preprocessor
4554 echo " "
4555 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4556 cat <<'EOT' >testcpp.c
4557 #define ABC abc
4558 #define XYZ xyz
4559 ABC.XYZ
4560 EOT
4561 cd ..
4562 if test ! -f cppstdin; then
4563         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4564                 # AIX cc -E doesn't show the absolute headerfile
4565                 # locations but we'll cheat by using the -M flag.
4566                 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
4567         else
4568                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4569         fi
4570 else
4571         echo "Keeping your $hint cppstdin wrapper."
4572 fi
4573 chmod 755 cppstdin
4574 wrapper=`pwd`/cppstdin
4575 ok='false'
4576 cd UU
4577
4578 if $test "X$cppstdin" != "X" && \
4579         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4580         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4581 then
4582         echo "You used to use $cppstdin $cppminus so we'll use that again."
4583         case "$cpprun" in
4584         '') echo "But let's see if we can live without a wrapper..." ;;
4585         *)
4586                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4587                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4588                 then
4589                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4590                         ok='true'
4591                 else
4592                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4593                 fi
4594                 ;;
4595         esac
4596 else
4597         case "$cppstdin" in
4598         '') ;;
4599         *)
4600                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4601                 ;;
4602         esac
4603 fi
4604
4605 if $ok; then
4606         : nothing
4607 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4608         $cc -E <testcpp.c >testcpp.out 2>&1; \
4609         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4610         echo "Yup, it does."
4611         x_cpp="$cc -E"
4612         x_minus='';
4613 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4614         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4615         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4616         echo "Yup, it does."
4617         x_cpp="$cc -E"
4618         x_minus='-';
4619 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4620         $cc -P <testcpp.c >testcpp.out 2>&1; \
4621         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4622         echo "Yipee, that works!"
4623         x_cpp="$cc -P"
4624         x_minus='';
4625 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4626         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4627         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4628         echo "At long last!"
4629         x_cpp="$cc -P"
4630         x_minus='-';
4631 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4632         $cpp <testcpp.c >testcpp.out 2>&1; \
4633         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4634         echo "It works!"
4635         x_cpp="$cpp"
4636         x_minus='';
4637 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4638         $cpp - <testcpp.c >testcpp.out 2>&1; \
4639         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4640         echo "Hooray, it works!  I was beginning to wonder."
4641         x_cpp="$cpp"
4642         x_minus='-';
4643 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4644         $wrapper <testcpp.c >testcpp.out 2>&1; \
4645         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4646         x_cpp="$wrapper"
4647         x_minus=''
4648         echo "Eureka!"
4649 else
4650         dflt=''
4651         rp="No dice.  I can't find a C preprocessor.  Name one:"
4652         . ./myread
4653         x_cpp="$ans"
4654         x_minus=''
4655         $x_cpp <testcpp.c >testcpp.out 2>&1
4656         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4657                 echo "OK, that will do." >&4
4658         else
4659 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4660                 exit 1
4661         fi
4662 fi
4663
4664 case "$ok" in
4665 false)
4666         cppstdin="$x_cpp"
4667         cppminus="$x_minus"
4668         cpprun="$x_cpp"
4669         cpplast="$x_minus"
4670         set X $x_cpp
4671         shift
4672         case "$1" in
4673         "$cpp")
4674                 echo "Perhaps can we force $cc -E using a wrapper..."
4675                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4676                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4677                 then
4678                         echo "Yup, we can."
4679                         cppstdin="$wrapper"
4680                         cppminus='';
4681                 else
4682                         echo "Nope, we'll have to live without it..."
4683                 fi
4684                 ;;
4685         esac
4686         case "$cpprun" in
4687         "$wrapper")
4688                 cpprun=''
4689                 cpplast=''
4690                 ;;
4691         esac
4692         ;;
4693 esac
4694
4695 case "$cppstdin" in
4696 "$wrapper"|'cppstdin') ;;
4697 *) $rm -f $wrapper;;
4698 esac
4699 $rm -f testcpp.c testcpp.out
4700
4701 : Set private lib path
4702 case "$plibpth" in
4703 '') if ./mips; then
4704                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4705         fi;;
4706 esac
4707 case "$libpth" in
4708 ' ') dlist='';;
4709 '') dlist="$loclibpth $plibpth $glibpth";;
4710 *) dlist="$libpth";;
4711 esac
4712
4713 : Now check and see which directories actually exist, avoiding duplicates
4714 libpth=''
4715 for xxx in $dlist
4716 do
4717     if $test -d $xxx; then
4718                 case " $libpth " in
4719                 *" $xxx "*) ;;
4720                 *) libpth="$libpth $xxx";;
4721                 esac
4722     fi
4723 done
4724 $cat <<'EOM'
4725
4726 Some systems have incompatible or broken versions of libraries.  Among
4727 the directories listed in the question below, please remove any you
4728 know not to be holding relevant libraries, and add any that are needed.
4729 Say "none" for none.
4730
4731 EOM
4732 case "$libpth" in
4733 '') dflt='none';;
4734 *)
4735         set X $libpth
4736         shift
4737         dflt=${1+"$@"}
4738         ;;
4739 esac
4740 rp="Directories to use for library searches?"
4741 . ./myread
4742 case "$ans" in
4743 none) libpth=' ';;
4744 *) libpth="$ans";;
4745 esac
4746
4747 : compute shared library extension
4748 case "$so" in
4749 '')
4750         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4751                 dflt='sl'
4752         else
4753                 dflt='so'
4754         fi
4755         ;;
4756 *) dflt="$so";;
4757 esac
4758 $cat <<EOM
4759
4760 On some systems, shared libraries may be available.  Answer 'none' if
4761 you want to suppress searching of shared libraries for the remainder
4762 of this configuration.
4763
4764 EOM
4765 rp='What is the file extension used for shared libraries?'
4766 . ./myread
4767 so="$ans"
4768
4769 : Define several unixisms.
4770 : Hints files or command line option can be used to override them.
4771 : The convoluted testing is in case hints files set either the old
4772 : or the new name.
4773 case "$_exe" in
4774 '')     case "$exe_ext" in
4775         '')     ;;
4776         *)      _exe="$exe_ext" ;;
4777         esac
4778         ;;
4779 esac
4780 case "$_a" in
4781 '')     case "$lib_ext" in
4782     '') _a='.a';;
4783         *)      _a="$lib_ext" ;;
4784         esac
4785         ;;
4786 esac
4787 case "$_o" in
4788 '') case "$obj_ext" in
4789         '')     _o='.o';;
4790         *)      _o="$obj_ext";;
4791         esac
4792         ;;
4793 esac
4794 case "$p_" in
4795 '') case "$path_sep" in
4796         '')     p_=':';;
4797         *)      p_="$path_sep";;
4798         esac
4799         ;;
4800 esac
4801 exe_ext=$_exe
4802 lib_ext=$_a
4803 obj_ext=$_o
4804 path_sep=$p_
4805
4806 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4807
4808 : Which makefile gets called first.  This is used by make depend.
4809 case "$firstmakefile" in
4810 '') firstmakefile='makefile';;
4811 esac
4812
4813 : Check is we will use socks
4814 case "$usesocks" in
4815 $define|true|[yY]*)     dflt='y';;
4816 *) dflt='n';;
4817 esac
4818 cat <<EOM
4819
4820 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4821 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4822 to use the PerlIO abstraction layer, this will be implicitly selected.
4823
4824 If this doesn't make any sense to you, just accept the default '$dflt'.
4825 EOM
4826 rp='Build Perl for SOCKS?'
4827 . ./myread
4828 case "$ans" in
4829 y|Y)    val="$define" ;;
4830 *)      val="$undef" ;;
4831 esac
4832 set usesocks
4833 eval $setvar
4834
4835 : Check for uselongdouble support
4836 case "$ccflags" in
4837 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4838 esac
4839
4840 case "$uselongdouble" in
4841 $define|true|[yY]*)     dflt='y';;
4842 *) dflt='n';;
4843 esac
4844 cat <<EOM
4845
4846 Perl can be built to take advantage of long doubles which
4847 (if available) may give more accuracy and range for floating point numbers.
4848
4849 If this doesn't make any sense to you, just accept the default '$dflt'.
4850 EOM
4851 rp='Try to use long doubles if available?'
4852 . ./myread
4853 case "$ans" in
4854 y|Y)    val="$define"   ;;
4855 *)      val="$undef"    ;;
4856 esac
4857 set uselongdouble
4858 eval $setvar
4859
4860 case "$uselongdouble" in
4861 true|[yY]*) uselongdouble="$define" ;;
4862 esac
4863
4864 : Look for a hint-file generated 'call-back-unit'.  If the
4865 : user has specified that long doubles should be used,
4866 : we may need to set or change some other defaults.
4867 if $test -f uselongdouble.cbu; then
4868     echo "Your platform has some specific hints regarding long doubles, using them..."
4869     . ./uselongdouble.cbu
4870 else
4871     case "$uselongdouble" in
4872         $define)
4873                 $cat <<EOM
4874 (Your platform does not have any specific hints for long doubles.)
4875 EOM
4876         ;;
4877     esac
4878 fi
4879
4880 : Looking for optional libraries
4881 echo " "
4882 echo "Checking for optional libraries..." >&4
4883 case "$libs" in
4884 ' '|'') dflt='';;
4885 *) dflt="$libs";;
4886 esac
4887 case "$libswanted" in
4888 '') libswanted='c_s';;
4889 esac
4890 case "$usesocks" in
4891 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4892 esac
4893 libsfound=''
4894 libsfiles=''
4895 libsdirs=''
4896 libspath=''
4897 for thisdir in $libpth $xlibpth; do
4898   test -d $thisdir && libspath="$libspath $thisdir"
4899 done
4900 for thislib in $libswanted; do
4901         for thisdir in $libspath; do
4902             xxx=''
4903             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4904                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4905                 $test -f "$xxx" && eval $libscheck
4906                 $test -f "$xxx" && libstyle=shared
4907             fi
4908             if test ! -f "$xxx"; then
4909                 xxx=$thisdir/lib$thislib.$so
4910                 $test -f "$xxx" && eval $libscheck
4911                 $test -f "$xxx" && libstyle=shared
4912             fi
4913             if test ! -f "$xxx"; then
4914                 xxx=$thisdir/lib$thislib$_a
4915                 $test -f "$xxx" && eval $libscheck
4916                 $test -f "$xxx" && libstyle=static
4917             fi
4918             if test ! -f "$xxx"; then
4919                 xxx=$thisdir/$thislib$_a
4920                 $test -f "$xxx" && eval $libscheck
4921                 $test -f "$xxx" && libstyle=static
4922             fi
4923             if test ! -f "$xxx"; then
4924                 xxx=$thisdir/lib${thislib}_s$_a
4925                 $test -f "$xxx" && eval $libscheck
4926                 $test -f "$xxx" && libstyle=static
4927                 $test -f "$xxx" && thislib=${thislib}_s
4928             fi
4929             if test ! -f "$xxx"; then
4930                 xxx=$thisdir/Slib$thislib$_a
4931                 $test -f "$xxx" && eval $libscheck
4932                 $test -f "$xxx" && libstyle=static
4933             fi
4934             if $test -f "$xxx"; then
4935                 case "$libstyle" in
4936                 shared) echo "Found -l$thislib (shared)." ;;
4937                 static) echo "Found -l$thislib." ;;
4938                 *)      echo "Found -l$thislib ($libstyle)." ;;
4939                 esac
4940                 case " $dflt " in
4941                 *"-l$thislib "*);;
4942                 *) dflt="$dflt -l$thislib"
4943                    libsfound="$libsfound $xxx"
4944                    yyy=`basename $xxx`
4945                    libsfiles="$libsfiles $yyy"
4946                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4947                    case " $libsdirs " in
4948                    *" $yyy "*) ;;
4949                    *) libsdirs="$libsdirs $yyy" ;;
4950                    esac
4951                    ;;
4952                 esac
4953                 break
4954             fi
4955         done
4956         if $test ! -f "$xxx"; then
4957             echo "No -l$thislib."
4958         fi
4959 done
4960 set X $dflt
4961 shift
4962 dflt="$*"
4963 case "$libs" in
4964 '') dflt="$dflt";;
4965 *) dflt="$libs";;
4966 esac
4967 case "$dflt" in
4968 ' '|'') dflt='none';;
4969 esac
4970
4971 $cat <<EOM
4972
4973 In order to compile $package on your machine, a number of libraries
4974 are usually needed.  Include any other special libraries here as well.
4975 Say "none" for none.  The default list is almost always right.
4976 EOM
4977
4978 echo " "
4979 rp="What libraries to use?"
4980 . ./myread
4981 case "$ans" in
4982 none) libs=' ';;
4983 *) libs="$ans";;
4984 esac
4985
4986 : determine optimization, if desired, or use for debug flag also
4987 case "$optimize" in
4988 ' '|$undef) dflt='none';;
4989 '') dflt='-O';;
4990 *) dflt="$optimize";;
4991 esac
4992 $cat <<EOH
4993
4994 By default, $package compiles with the -O flag to use the optimizer.
4995 Alternately, you might want to use the symbolic debugger, which uses
4996 the -g flag (on traditional Unix systems).  Either flag can be
4997 specified here.  To use neither flag, specify the word "none".
4998
4999 EOH
5000 rp="What optimizer/debugger flag should be used?"
5001 . ./myread
5002 optimize="$ans"
5003 case "$optimize" in
5004 'none') optimize=" ";;
5005 esac
5006
5007 : Check what DEBUGGING is required from the command line
5008 : -DEBUGGING      or -DDEBUGGING or
5009 : -DEBUGGING=both                       = -g + -DDEBUGGING
5010 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5011 : -DEBUGGING=none or -UDEBUGGING        =
5012 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5013 case "$EBUGGING" in
5014 '')     ;;
5015 *)      DEBUGGING=$EBUGGING ;;
5016 esac
5017
5018 case "$DEBUGGING" in
5019 -g|both|$define)
5020     case "$optimize" in
5021         *-g*) ;;
5022         *)    optimize="$optimize -g" ;;
5023     esac ;;
5024 none|$undef)
5025     case "$optimize" in
5026         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5027                 shift
5028                 optimize="$*"
5029                 ;;
5030     esac ;;
5031 esac
5032
5033 dflt=''
5034 case "$DEBUGGING" in
5035 both|$define) dflt='-DDEBUGGING'
5036 esac
5037
5038 : argument order is deliberate, as the flag will start with - which set could
5039 : think is an option
5040 checkccflag='check=$1; flag=$2; callback=$3;
5041 echo " ";
5042 echo "Checking if your compiler accepts $flag" 2>&1;
5043 echo "int main(void) { return 0; }" > gcctest.c;
5044 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5045     echo "Yes, it does." 2>&1;
5046     if $test -s gcctest.out ; then
5047         echo "But your platform does not like it:";
5048         cat gcctest.out;
5049     else
5050         case "$ccflags" in
5051         *$check*)
5052             echo "Leaving current flags $ccflags alone." 2>&1
5053             ;;
5054         *) dflt="$dflt $flag";
5055             eval $callback
5056             ;;
5057         esac
5058     fi
5059 else
5060     echo "Nope, it does not, but that is ok." 2>&1;
5061 fi
5062 '
5063
5064 : We will not override a previous value, but we might want to
5065 : augment a hint file
5066 case "$hint" in
5067 default|recommended)
5068         case "$gccversion" in
5069         1*) dflt="$dflt -fpcc-struct-return" ;;
5070         esac
5071         case "$optimize:$DEBUGGING" in
5072         *-g*:old) dflt="$dflt -DDEBUGGING";;
5073         esac
5074         case "$gccversion" in
5075         2*) if $test -d /etc/conf/kconfig.d &&
5076                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5077                 then
5078                         # Interactive Systems (ISC) POSIX mode.
5079                         dflt="$dflt -posix"
5080                 fi
5081                 ;;
5082         esac
5083         case "$gccversion" in
5084         1*) ;;
5085         2.[0-8]*) ;;
5086         ?*)     set strict-aliasing -fno-strict-aliasing
5087                 eval $checkccflag
5088                 ;;
5089         esac
5090         # For gcc, adding -pipe speeds up compilations for some, but apparently
5091         # some assemblers can't read from stdin.  (It also slows down compilations
5092         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5093         case "$gccversion" in
5094         ?*)     set pipe -pipe
5095                 eval $checkccflag
5096                 ;;
5097         esac
5098
5099         # on x86_64 (at least) we require an extra library (libssp) in the
5100         # link command line. This library is not named, so I infer that it is
5101         # an implementation detail that may change. Hence the safest approach
5102         # is to add the flag to the flags passed to the compiler at link time,
5103         # as that way the compiler can do the right implementation dependant
5104         # thing. (NWC)
5105         case "$gccversion" in
5106         ?*)     set stack-protector -fstack-protector
5107                 eval $checkccflag
5108                 ;;
5109         esac
5110         ;;
5111 esac
5112
5113 case "$mips_type" in
5114 *BSD*|'') inclwanted="$locincpth $usrinc";;
5115 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5116 esac
5117 for thisincl in $inclwanted; do
5118         if $test -d $thisincl; then
5119                 if $test x$thisincl != x$usrinc; then
5120                         case "$dflt" in
5121                         *" -I$thisincl "*);;
5122                         *) dflt="$dflt -I$thisincl ";;
5123                         esac
5124                 fi
5125         fi
5126 done
5127
5128 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5129         xxx=true;
5130 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5131         xxx=true;
5132 else
5133         xxx=false;
5134 fi;
5135 if $xxx; then
5136         case "$dflt" in
5137         *$2*);;
5138         *) dflt="$dflt -D$2";;
5139         esac;
5140 fi'
5141
5142 set signal.h LANGUAGE_C; eval $inctest
5143
5144 case "$usesocks" in
5145 $define)
5146         ccflags="$ccflags -DSOCKS"
5147         ;;
5148 esac
5149
5150 case "$hint" in
5151 default|recommended) dflt="$ccflags $dflt" ;;
5152 *) dflt="$ccflags";;
5153 esac
5154
5155 case "$dflt" in
5156 ''|' ') dflt=none;;
5157 esac
5158
5159 $cat <<EOH
5160
5161 Your C compiler may want other flags.  For this question you should include
5162 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5163 but you should NOT include libraries or ld flags like -lwhatever.  If you
5164 want $package to honor its debug switch, you should include -DDEBUGGING here.
5165 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5166
5167 To use no flags, specify the word "none".
5168
5169 EOH
5170 set X $dflt
5171 shift
5172 dflt=${1+"$@"}
5173 rp="Any additional cc flags?"
5174 . ./myread
5175 case "$ans" in
5176 none) ccflags='';;
5177 *) ccflags="$ans";;
5178 esac
5179
5180 : the following weeds options from ccflags that are of no interest to cpp
5181 case "$cppflags" in
5182 '') cppflags="$ccflags" ;;
5183 *)  cppflags="$cppflags $ccflags" ;;
5184 esac
5185 case "$gccversion" in
5186 1*) cppflags="$cppflags -D__GNUC__"
5187 esac
5188 case "$mips_type" in
5189 '');;
5190 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5191 esac
5192 case "$cppflags" in
5193 '');;
5194 *)
5195         echo " "
5196         echo "Let me guess what the preprocessor flags are..." >&4
5197         set X $cppflags
5198         shift
5199         cppflags=''
5200         $cat >cpp.c <<'EOM'
5201 #define BLURFL foo
5202
5203 BLURFL xx LFRULB
5204 EOM
5205         previous=''
5206         for flag in $*
5207         do
5208                 case "$flag" in
5209                 -*) ftry="$flag";;
5210                 *) ftry="$previous $flag";;
5211                 esac
5212                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5213                         >cpp1.out 2>/dev/null && \
5214                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5215                         >cpp2.out 2>/dev/null && \
5216                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5217                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5218                 then
5219                         cppflags="$cppflags $ftry"
5220                         previous=''
5221                 else
5222                         previous="$flag"
5223                 fi
5224         done
5225         set X $cppflags
5226         shift
5227         cppflags=${1+"$@"}
5228         case "$cppflags" in
5229         *-*)  echo "They appear to be: $cppflags";;
5230         esac
5231         $rm -f cpp.c cpp?.out
5232         ;;
5233 esac
5234
5235 : flags used in final linking phase
5236 case "$ldflags" in
5237 '') if ./venix; then
5238                 dflt='-i -z'
5239         else
5240                 dflt=''
5241         fi
5242         case "$ccflags" in
5243         *-posix*) dflt="$dflt -posix" ;;
5244         esac
5245         ;;
5246 *) dflt="$ldflags";;
5247 esac
5248 # See note above about -fstack-protector
5249 case "$ccflags" in
5250 *-fstack-protector*) 
5251         case "$dflt" in
5252         *-fstack-protector*) ;; # Don't add it again
5253         *) dflt="$dflt -fstack-protector" ;; 
5254         esac
5255         ;;
5256 esac
5257
5258 : Try to guess additional flags to pick up local libraries.
5259 for thislibdir in $libpth; do
5260         case " $loclibpth " in
5261         *" $thislibdir "*)
5262                 case "$dflt " in
5263                 *"-L$thislibdir "*) ;;
5264                 *)  dflt="$dflt -L$thislibdir" ;;
5265                 esac
5266                 ;;
5267         esac
5268 done
5269
5270 case "$dflt" in
5271 '') dflt='none' ;;
5272 esac
5273
5274 $cat <<EOH
5275
5276 Your C linker may need flags.  For this question you should
5277 include -L/whatever and any other flags used by the C linker, but you
5278 should NOT include libraries like -lwhatever.
5279
5280 Make sure you include the appropriate -L/path flags if your C linker
5281 does not normally search all of the directories you specified above,
5282 namely
5283         $libpth
5284 To use no flags, specify the word "none".
5285
5286 EOH
5287
5288 rp="Any additional ld flags (NOT including libraries)?"
5289 . ./myread
5290 case "$ans" in
5291 none) ldflags='';;
5292 *) ldflags="$ans";;
5293 esac
5294 rmlist="$rmlist pdp11"
5295
5296 : coherency check
5297 echo " "
5298 echo "Checking your choice of C compiler and flags for coherency..." >&4
5299 $cat > try.c <<'EOF'
5300 #include <stdio.h>
5301 int main() { printf("Ok\n"); return(0); }
5302 EOF
5303 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5304 shift
5305 $cat >try.msg <<'EOM'
5306 I've tried to compile and run the following simple program:
5307
5308 EOM
5309 $cat try.c >> try.msg
5310
5311 $cat >> try.msg <<EOM
5312
5313 I used the command:
5314
5315         $*
5316         $run ./try
5317
5318 and I got the following output:
5319
5320 EOM
5321 dflt=y
5322 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5323         if $sh -c "$run ./try " >>try.msg 2>&1; then
5324                 xxx=`$run ./try`
5325                 case "$xxx" in
5326                 "Ok") dflt=n ;;
5327                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5328                         case " $libs " in
5329                         *" -lsfio "*)
5330                                 cat >> try.msg <<'EOQS'
5331 If $libs contains -lsfio, and sfio is mis-configured, then it
5332 sometimes (apparently) runs and exits with a 0 status, but with no
5333 output!  It may have to do with sfio's use of _exit vs. exit.
5334
5335 EOQS
5336                                 rp="You have a big problem.  Shall I abort Configure"
5337                                 dflt=y
5338                                 ;;
5339                         esac
5340                         ;;
5341                 esac
5342         else
5343                 echo "The program compiled OK, but exited with status $?." >>try.msg
5344                 rp="You have a problem.  Shall I abort Configure"
5345                 dflt=y
5346         fi
5347 else
5348         echo "I can't compile the test program." >>try.msg
5349         rp="You have a BIG problem.  Shall I abort Configure"
5350         dflt=y
5351 fi
5352 case "$dflt" in
5353 y)
5354         $cat try.msg >&4
5355         case "$knowitall" in
5356         '')
5357                 echo "(The supplied flags or libraries might be incorrect.)"
5358                 ;;
5359         *) dflt=n;;
5360         esac
5361         echo " "
5362         . ./myread
5363         case "$ans" in
5364         n*|N*) ;;
5365         *)      echo "Ok.  Stopping Configure." >&4
5366                 exit 1
5367                 ;;
5368         esac
5369         ;;
5370 n) echo "OK, that should do.";;
5371 esac
5372 $rm_try gcctest gcctest.out
5373
5374 : define a shorthand compile call
5375 compile='
5376 mc_file=$1;
5377 shift;
5378 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5379 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5380 exit 1;
5381 fi;
5382 esac;
5383 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5384 : define a shorthand compile call for compilations that should be ok.
5385 compile_ok='
5386 mc_file=$1;
5387 shift;
5388 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5389
5390 : determine filename position in cpp output
5391 echo " "
5392 echo "Computing filename position in cpp output for #include directives..." >&4
5393 case "$osname" in
5394 vos) testaccess=-e ;;
5395 *)   testaccess=-r ;;
5396 esac
5397 echo '#include <stdio.h>' > foo.c
5398 $cat >fieldn <<EOF
5399 $startsh
5400 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5401 $grep '^[       ]*#.*stdio\.h' | \
5402 while read cline; do
5403         pos=1
5404         set \$cline
5405         while $test \$# -gt 0; do
5406                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5407                         echo "\$pos"
5408                         exit 0
5409                 fi
5410                 shift
5411                 pos=\`expr \$pos + 1\`
5412         done
5413 done
5414 EOF
5415 chmod +x fieldn
5416 fieldn=`./fieldn`
5417 $rm -f foo.c fieldn
5418 case $fieldn in
5419 '') pos='???';;
5420 1) pos=first;;
5421 2) pos=second;;
5422 3) pos=third;;
5423 *) pos="${fieldn}th";;
5424 esac
5425 echo "Your cpp writes the filename in the $pos field of the line."
5426
5427 case "$osname" in
5428 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5429 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5430 *)   cppfilter='' ;;
5431 esac
5432 : locate header file
5433 $cat >findhdr <<EOF
5434 $startsh
5435 wanted=\$1
5436 name=''
5437 for usrincdir in $usrinc
5438 do
5439         if test -f \$usrincdir/\$wanted; then
5440                 echo "\$usrincdir/\$wanted"
5441                 exit 0
5442         fi
5443 done
5444 awkprg='{ print \$$fieldn }'
5445 echo "#include <\$wanted>" > foo\$\$.c
5446 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5447 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5448 while read cline; do
5449         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5450         case "\$name" in
5451         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5452         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5453         *) exit 2;;
5454         esac;
5455 done;
5456 #
5457 # status = 0: grep returned 0 lines, case statement not executed
5458 # status = 1: headerfile found
5459 # status = 2: while loop executed, no headerfile found
5460 #
5461 status=\$?
5462 $rm -f foo\$\$.c;
5463 if test \$status -eq 1; then
5464         exit 0;
5465 fi
5466 exit 1
5467 EOF
5468 chmod +x findhdr
5469
5470 : define an alternate in-header-list? function
5471 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5472 cont=true; xxf="echo \"<\$1> found.\" >&4";
5473 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5474 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5475 esac;
5476 case $# in 4) instead=instead;; *) instead="at last";; esac;
5477 while $test "$cont"; do
5478         xxx=`./findhdr $1`
5479         var=$2; eval "was=\$$2";
5480         if $test "$xxx" && $test -r "$xxx";
5481         then eval $xxf;
5482         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5483                 cont="";
5484         else eval $xxnf;
5485         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5486         set $yyy; shift; shift; yyy=$@;
5487         case $# in 0) cont="";;
5488         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5489                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5490         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5491                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5492         esac;
5493 done;
5494 while $test "$yyy";
5495 do set $yyy; var=$2; eval "was=\$$2";
5496         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5497         set $yyy; shift; shift; yyy=$@;
5498 done'
5499
5500 : see if stdlib is available
5501 set stdlib.h i_stdlib
5502 eval $inhdr
5503
5504 : check for lengths of integral types
5505 echo " "
5506 case "$intsize" in
5507 '')
5508         echo "Checking to see how big your integers are..." >&4
5509         $cat >try.c <<EOCP
5510 #include <stdio.h>
5511 #$i_stdlib I_STDLIB
5512 #ifdef I_STDLIB
5513 #include <stdlib.h>
5514 #endif
5515 int main()
5516 {
5517         printf("intsize=%d;\n", (int)sizeof(int));
5518         printf("longsize=%d;\n", (int)sizeof(long));
5519         printf("shortsize=%d;\n", (int)sizeof(short));
5520         exit(0);
5521 }
5522 EOCP
5523         set try
5524         if eval $compile_ok && $run ./try > /dev/null; then
5525                 eval `$run ./try`
5526                 echo "Your integers are $intsize bytes long."
5527                 echo "Your long integers are $longsize bytes long."
5528                 echo "Your short integers are $shortsize bytes long."
5529         else
5530                 $cat >&4 <<EOM
5531 !
5532 Help! I can't compile and run the intsize test program: please enlighten me!
5533 (This is probably a misconfiguration in your system or libraries, and
5534 you really ought to fix it.  Still, I'll try anyway.)
5535 !
5536 EOM
5537                 dflt=4
5538                 rp="What is the size of an integer (in bytes)?"
5539                 . ./myread
5540                 intsize="$ans"
5541                 dflt=$intsize
5542                 rp="What is the size of a long integer (in bytes)?"
5543                 . ./myread
5544                 longsize="$ans"
5545                 dflt=2
5546                 rp="What is the size of a short integer (in bytes)?"
5547                 . ./myread
5548                 shortsize="$ans"
5549         fi
5550         ;;
5551 esac
5552 $rm_try
5553
5554 : check for long long
5555 echo " "
5556 echo "Checking to see if you have long long..." >&4
5557 echo 'int main() { long long x = 7; return 0; }' > try.c
5558 set try
5559 if eval $compile; then
5560         val="$define"
5561         echo "You have long long."
5562 else
5563         val="$undef"
5564         echo "You do not have long long."
5565 fi
5566 $rm_try
5567 set d_longlong
5568 eval $setvar
5569
5570 : check for length of long long
5571 case "${d_longlong}${longlongsize}" in
5572 $define)
5573         echo " "
5574         echo "Checking to see how big your long longs are..." >&4
5575         $cat >try.c <<'EOCP'
5576 #include <stdio.h>
5577 int main()
5578 {
5579     printf("%d\n", (int)sizeof(long long));
5580     return(0);
5581 }
5582 EOCP
5583         set try
5584         if eval $compile_ok; then
5585                 longlongsize=`$run ./try`
5586                 echo "Your long longs are $longlongsize bytes long."
5587         else
5588                 dflt='8'
5589                 echo " "
5590                 echo "(I can't seem to compile the test program.  Guessing...)"
5591                 rp="What is the size of a long long (in bytes)?"
5592                 . ./myread
5593                 longlongsize="$ans"
5594         fi
5595         if $test "X$longsize" = "X$longlongsize"; then
5596                 echo "(That isn't any different from an ordinary long.)"
5597         fi
5598         ;;
5599 esac
5600 $rm_try
5601
5602 : see if inttypes.h is available
5603 : we want a real compile instead of Inhdr because some systems
5604 : have an inttypes.h which includes non-existent headers
5605 echo " "
5606 $cat >try.c <<EOCP
5607 #include <inttypes.h>
5608 int main() {
5609         static int32_t foo32 = 0x12345678;
5610 }
5611 EOCP
5612 set try
5613 if eval $compile; then
5614         echo "<inttypes.h> found." >&4
5615         val="$define"
5616 else
5617         echo "<inttypes.h> NOT found." >&4
5618         val="$undef"
5619 fi
5620 $rm_try
5621 set i_inttypes
5622 eval $setvar
5623
5624 : check for int64_t
5625 echo " "
5626 echo "Checking to see if you have int64_t..." >&4
5627 $cat >try.c <<EOCP
5628 #include <sys/types.h>
5629 #$i_inttypes I_INTTYPES
5630 #ifdef I_INTTYPES
5631 #include <inttypes.h>
5632 #endif
5633 int main() { int64_t x = 7; }
5634 EOCP
5635 set try
5636 if eval $compile; then
5637         val="$define"
5638         echo "You have int64_t."
5639 else
5640         val="$undef"
5641         echo "You do not have int64_t."
5642 fi
5643 $rm_try
5644 set d_int64_t
5645 eval $setvar
5646
5647 : Check if 64bit ints have a quad type
5648 echo " "
5649 echo "Checking which 64-bit integer type we could use..." >&4
5650
5651 case "$intsize" in
5652 8) val=int
5653    set quadtype
5654    eval $setvar
5655    val='"unsigned int"'
5656    set uquadtype
5657    eval $setvar
5658    quadkind=1
5659    ;;
5660 *) case "$longsize" in
5661    8) val=long
5662       set quadtype
5663       eval $setvar
5664       val='"unsigned long"'
5665       set uquadtype
5666       eval $setvar
5667       quadkind=2
5668       ;;
5669    *) case "$d_longlong:$longlongsize" in
5670       define:8)
5671         val='"long long"'
5672         set quadtype
5673         eval $setvar
5674         val='"unsigned long long"'
5675         set uquadtype
5676         eval $setvar
5677         quadkind=3
5678         ;;
5679       *) case "$d_int64_t" in
5680          define)
5681            val=int64_t
5682            set quadtype
5683            eval $setvar
5684            val=uint64_t
5685            set uquadtype
5686            eval $setvar
5687            quadkind=4
5688            ;;
5689          esac
5690          ;;
5691       esac
5692       ;;
5693    esac
5694    ;;
5695 esac
5696
5697 case "$quadtype" in
5698 '')     echo "Alas, no 64-bit integer types in sight." >&4
5699         d_quad="$undef"
5700         ;;
5701 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5702         d_quad="$define"
5703         ;;
5704 esac
5705
5706 : Do we want 64bit support
5707 case "$uselonglong" in
5708 "$define"|true|[yY]*)
5709         cat <<EOM >&4
5710
5711 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5712 EOM
5713         use64bitint="$define"
5714         ;;
5715 esac
5716 case "$use64bits" in
5717 "$define"|true|[yY]*)
5718         cat <<EOM >&4
5719
5720 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5721 EOM
5722         use64bitint="$define"
5723         ;;
5724 esac
5725 case "$use64bitints" in
5726 "$define"|true|[yY]*)
5727         cat <<EOM >&4
5728
5729 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5730 EOM
5731         use64bitint="$define"
5732         ;;
5733 esac
5734 case "$use64bitsint" in
5735 "$define"|true|[yY]*)
5736         cat <<EOM >&4
5737
5738 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5739 EOM
5740         use64bitint="$define"
5741         ;;
5742 esac
5743 case "$uselonglongs" in
5744 "$define"|true|[yY]*)
5745         cat <<EOM >&4
5746
5747 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5748 EOM
5749         use64bitint="$define"
5750         ;;
5751 esac
5752 case "$use64bitsall" in
5753 "$define"|true|[yY]*)
5754         cat <<EOM >&4
5755
5756 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5757 EOM
5758         use64bitall="$define"
5759         ;;
5760 esac
5761
5762 case "$ccflags" in
5763 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5764 esac
5765 case "$use64bitall" in
5766 "$define"|true|[yY]*) use64bitint="$define" ;;
5767 esac
5768
5769 case "$longsize" in
5770 8) cat <<EOM
5771
5772 You have natively 64-bit long integers.
5773 EOM
5774    val="$define"
5775    ;;
5776 *) case "$use64bitint" in
5777    "$define"|true|[yY]*) dflt='y';;
5778    *) dflt='n';;
5779    esac
5780    case "$d_quad" in
5781    "$define") ;;
5782    *) dflt='n' ;;
5783    esac
5784    cat <<EOM
5785
5786 Perl can be built to take advantage of 64-bit integer types
5787 on some systems.  To do so, Configure can be run with -Duse64bitint.
5788 Choosing this option will most probably introduce binary incompatibilities.
5789
5790 If this doesn't make any sense to you, just accept the default '$dflt'.
5791 (The default has been chosen based on your configuration.)
5792 EOM
5793    rp='Try to use 64-bit integers, if available?'
5794    . ./myread
5795    case "$ans" in
5796    [yY]*) val="$define" ;;
5797    *)     val="$undef"  ;;
5798    esac
5799    ;;
5800 esac
5801 set use64bitint
5802 eval $setvar
5803
5804 case "$use64bitall" in
5805 "$define"|true|[yY]*) dflt='y' ;;
5806 *) case "$longsize" in
5807    8) dflt='y' ;;
5808    *) dflt='n' ;;
5809    esac
5810    ;;
5811 esac
5812 cat <<EOM
5813
5814 You may also choose to try maximal 64-bitness.  It means using as much
5815 64-bitness as possible on the platform.  This in turn means even more
5816 binary incompatibilities.  On the other hand, your platform may not
5817 have any more 64-bitness available than what you already have chosen.
5818
5819 If this doesn't make any sense to you, just accept the default '$dflt'.
5820 (The default has been chosen based on your configuration.)
5821 EOM
5822 rp='Try to use maximal 64-bit support, if available?'
5823 . ./myread
5824 case "$ans" in
5825 [yY]*) val="$define" ;;
5826 *)     val="$undef"  ;;
5827 esac
5828 set use64bitall
5829 eval $setvar
5830 case "$use64bitall" in
5831 "$define")
5832         case "$use64bitint" in
5833         "$undef")
5834                 cat <<EOM
5835
5836 Since you have chosen a maximally 64-bit build, I'm also turning on
5837 the use of 64-bit integers.
5838 EOM
5839                 use64bitint="$define" ;;
5840         esac
5841         ;;
5842 esac
5843
5844 : Look for a hint-file generated 'call-back-unit'.  If the
5845 : user has specified that a 64-bit perl is to be built,
5846 : we may need to set or change some other defaults.
5847 if $test -f use64bitint.cbu; then
5848         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5849         . ./use64bitint.cbu
5850 fi
5851 case "$use64bitint" in
5852 "$define"|true|[yY]*)
5853         case "$longsize" in
5854         4) case "$archname64" in
5855            '') archname64=64int ;;
5856            esac
5857            ;;
5858         esac
5859         ;;
5860 esac
5861
5862 : Look for a hint-file generated 'call-back-unit'.  If the
5863 : user has specified that a maximally 64-bit perl is to be built,
5864 : we may need to set or change some other defaults.
5865 if $test -f use64bitall.cbu; then
5866         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5867         . ./use64bitall.cbu
5868 fi
5869 case "$use64bitall" in
5870 "$define"|true|[yY]*)
5871         case "$longsize" in
5872         4) case "$archname64" in
5873            ''|64int) archname64=64all ;;
5874            esac
5875            ;;
5876         esac
5877         ;;
5878 esac
5879
5880 case "$d_quad:$use64bitint" in
5881 $undef:$define)
5882         cat >&4 <<EOF
5883
5884 *** You have chosen to use 64-bit integers,
5885 *** but none can be found.
5886 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5887 *** Cannot continue, aborting.
5888
5889 EOF
5890         exit 1
5891         ;;
5892 esac
5893
5894 : check for length of double
5895 echo " "
5896 case "$doublesize" in
5897 '')
5898         echo "Checking to see how big your double precision numbers are..." >&4
5899         $cat >try.c <<EOCP
5900 #include <stdio.h>
5901 #$i_stdlib I_STDLIB
5902 #ifdef I_STDLIB
5903 #include <stdlib.h>
5904 #endif
5905 int main()
5906 {
5907     printf("%d\n", (int)sizeof(double));
5908     exit(0);
5909 }
5910 EOCP
5911         set try
5912         if eval $compile_ok; then
5913                 doublesize=`$run ./try`
5914                 echo "Your double is $doublesize bytes long."
5915         else
5916                 dflt='8'
5917                 echo "(I can't seem to compile the test program.  Guessing...)"
5918                 rp="What is the size of a double precision number (in bytes)?"
5919                 . ./myread
5920                 doublesize="$ans"
5921         fi
5922         ;;
5923 esac
5924 $rm_try
5925
5926 : check for long doubles
5927 echo " "
5928 echo "Checking to see if you have long double..." >&4
5929 echo 'int main() { long double x = 7.0; }' > try.c
5930 set try
5931 if eval $compile; then
5932         val="$define"
5933         echo "You have long double."
5934 else
5935         val="$undef"
5936         echo "You do not have long double."
5937 fi
5938 $rm_try
5939 set d_longdbl
5940 eval $setvar
5941
5942 : check for length of long double
5943 case "${d_longdbl}${longdblsize}" in
5944 $define)
5945         echo " "
5946         echo "Checking to see how big your long doubles are..." >&4
5947         $cat >try.c <<'EOCP'
5948 #include <stdio.h>
5949 int main()
5950 {
5951         printf("%d\n", sizeof(long double));
5952 }
5953 EOCP
5954         set try
5955         set try
5956         if eval $compile; then
5957                 longdblsize=`$run ./try`
5958                 echo "Your long doubles are $longdblsize bytes long."
5959         else
5960                 dflt='8'
5961                 echo " "
5962                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5963                 rp="What is the size of a long double (in bytes)?"
5964                 . ./myread
5965                 longdblsize="$ans"
5966         fi
5967         if $test "X$doublesize" = "X$longdblsize"; then
5968                 echo "That isn't any different from an ordinary double."
5969                 echo "I'll keep your setting anyway, but you may see some"
5970                 echo "harmless compilation warnings."
5971         fi
5972         ;;
5973 esac
5974 $rm_try
5975
5976 : determine the architecture name
5977 echo " "
5978 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5979         tarch=`arch`"-$osname"
5980 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5981         if uname -m > tmparch 2>&1 ; then
5982                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5983                         -e 's/$/'"-$osname/" tmparch`
5984         else
5985                 tarch="$osname"
5986         fi
5987         $rm -f tmparch
5988 else
5989         tarch="$osname"
5990 fi
5991 case "$myarchname" in
5992 ''|"$tarch") ;;
5993 *)
5994         echo "(Your architecture name used to be $myarchname.)"
5995         archname=''
5996         ;;
5997 esac
5998 case "$targetarch" in
5999 '') ;;
6000 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6001 esac
6002 myarchname="$tarch"
6003 case "$archname" in
6004 '') dflt="$tarch";;
6005 *) dflt="$archname";;
6006 esac
6007 rp='What is your architecture name'
6008 . ./myread
6009 archname="$ans"
6010 case "$usethreads" in
6011 $define)
6012         echo "Threads selected." >&4
6013         case "$archname" in
6014         *-thread*) echo "...and architecture name already has -thread." >&4
6015                 ;;
6016         *)      archname="$archname-thread"
6017                 echo "...setting architecture name to $archname." >&4
6018                 ;;
6019         esac
6020         ;;
6021 esac
6022 case "$usemultiplicity" in
6023 $define)
6024         echo "Multiplicity selected." >&4
6025         case "$archname" in
6026         *-multi*) echo "...and architecture name already has -multi." >&4
6027                 ;;
6028         *)      archname="$archname-multi"
6029                 echo "...setting architecture name to $archname." >&4
6030                 ;;
6031         esac
6032         ;;
6033 esac
6034 case "$use64bitint$use64bitall" in
6035 *"$define"*)
6036         case "$archname64" in
6037         '')
6038                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6039                 ;;
6040         *)
6041                 case "$use64bitint" in
6042                 "$define") echo "64 bit integers selected." >&4 ;;
6043                 esac
6044                 case "$use64bitall" in
6045                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6046                 esac
6047                 case "$archname" in
6048                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6049                         ;;
6050                 *)      archname="$archname-$archname64"
6051                         echo "...setting architecture name to $archname." >&4
6052                         ;;
6053                 esac
6054                 ;;
6055         esac
6056 esac
6057 case "$uselongdouble" in
6058 $define)
6059         echo "Long doubles selected." >&4
6060         case "$longdblsize" in
6061         $doublesize)
6062                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6063                 ;;
6064         *)
6065                 case "$archname" in
6066                 *-ld*) echo "...and architecture name already has -ld." >&4
6067                         ;;
6068                 *)      archname="$archname-ld"
6069                         echo "...setting architecture name to $archname." >&4
6070                         ;;
6071                 esac
6072                 ;;
6073         esac
6074         ;;
6075 esac
6076 if $test -f archname.cbu; then
6077         echo "Your platform has some specific hints for architecture name, using them..."
6078         . ./archname.cbu
6079 fi
6080
6081 : set the prefixit variable, to compute a suitable default value
6082 prefixit='case "$3" in
6083 ""|none)
6084         case "$oldprefix" in
6085         "") eval "$1=\"\$$2\"";;
6086         *)
6087                 case "$3" in
6088                 "") eval "$1=";;
6089                 none)
6090                         eval "tp=\"\$$2\"";
6091                         case "$tp" in
6092                         ""|" ") eval "$1=\"\$$2\"";;
6093                         *) eval "$1=";;
6094                         esac;;
6095                 esac;;
6096         esac;;
6097 *)
6098         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6099         case "$tp" in
6100         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6101         /*-$oldprefix/*|\~*-$oldprefix/*)
6102                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6103         *) eval "$1=\"\$$2\"";;
6104         esac;;
6105 esac'
6106
6107 : determine installation style
6108 : For now, try to deduce it from prefix unless it is already set.
6109 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6110 case "$installstyle" in
6111 '')     case "$prefix" in
6112                 *perl*) dflt='lib';;
6113                 *) dflt='lib/perl5' ;;
6114         esac
6115         ;;
6116 *)      dflt="$installstyle" ;;
6117 esac
6118 : Probably not worth prompting for this since we prompt for all
6119 : the directories individually, and the prompt would be too long and
6120 : confusing anyway.
6121 installstyle=$dflt
6122
6123 : determine where public executables go
6124 echo " "
6125 set dflt bin bin
6126 eval $prefixit
6127 fn=d~
6128 rp='Pathname where the public executables will reside?'
6129 . ./getfile
6130 if $test "X$ansexp" != "X$binexp"; then
6131         installbin=''
6132 fi
6133 prefixvar=bin
6134 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6135 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6136 :     this via initialinstalllocation
6137 . ./setprefixvar
6138
6139 case "$userelocatableinc" in
6140 $define|true|[yY]*)     dflt='y' ;;
6141 *)                      dflt='n' ;;
6142 esac
6143 cat <<EOM
6144
6145 Would you like to build Perl so that the installation is relocatable, so that
6146 library paths in @INC are determined relative to the path of the perl binary?
6147 This is not advised for system Perl installs, or if you need to run setid
6148 scripts or scripts under taint mode.
6149
6150 If this doesn't make any sense to you, just accept the default '$dflt'.
6151 EOM
6152 rp='Use relocatable @INC?'
6153 . ./myread
6154 case "$ans" in
6155 y|Y)    val="$define" ;;
6156 *)      val="$undef"  ;;
6157 esac
6158 set userelocatableinc
6159 eval $setvar
6160
6161 initialinstalllocation="$binexp"
6162 : Default prefix is now "up one level from where the binaries are"
6163 case "$userelocatableinc" in
6164 $define|true|[yY]*)
6165     bin=".../"
6166     binexp=".../"
6167     prefix=".../.."
6168     prefixexp=".../.."
6169     installprefixexp=".../.."
6170     ;;
6171 esac
6172
6173 : determine where private library files go
6174 : Usual default is /usr/local/lib/perl5/$version.
6175 : Also allow things like /opt/perl/lib/$version, since
6176 : /opt/perl/lib/perl5... would be redundant.
6177 : The default "style" setting is made in installstyle.U
6178 case "$installstyle" in
6179 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6180 *)       set dflt privlib lib/$version ;;
6181 esac
6182 eval $prefixit
6183 $cat <<EOM
6184
6185 There are some auxiliary files for $package that need to be put into a
6186 private library directory that is accessible by everyone.
6187
6188 EOM
6189 fn=$binexp
6190 fn=d~+
6191 rp='Pathname where the private library files will reside?'
6192 . ./getfile
6193 prefixvar=privlib
6194 . ./setprefixvar
6195
6196 : set the prefixup variable, to restore leading tilda escape
6197 prefixup='case "$prefixexp" in
6198 "$prefix") ;;
6199 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6200 esac'
6201
6202 : determine where public architecture dependent libraries go
6203 set archlib archlib
6204 eval $prefixit
6205 : privlib default is /usr/local/lib/$package/$version
6206 : archlib default is /usr/local/lib/$package/$version/$archname
6207 : privlib may have an optional trailing /share.
6208 tdflt=`echo $privlib | $sed 's,/share$,,'`
6209 tdflt=$tdflt/$archname
6210 case "$archlib" in
6211 '')     dflt=$tdflt
6212         ;;
6213 *)      dflt="$archlib"
6214     ;;
6215 esac
6216 $cat <<EOM
6217
6218 $spackage contains architecture-dependent library files.  If you are
6219 sharing libraries in a heterogeneous environment, you might store
6220 these files in a separate location.  Otherwise, you can just include
6221 them with the rest of the public library files.
6222
6223 EOM
6224 fn=$binexp
6225 fn=d+~
6226 rp='Where do you want to put the public architecture-dependent libraries?'
6227 . ./getfile
6228 prefixvar=archlib
6229 . ./setprefixvar
6230 if $test X"$archlib" = X"$privlib"; then
6231         d_archlib="$undef"
6232 else
6233         d_archlib="$define"
6234 fi
6235
6236 : see if setuid scripts can be secure
6237 $cat <<EOM
6238
6239 Some kernels have a bug that prevents setuid #! scripts from being
6240 secure.  Some sites have disabled setuid #! scripts because of this.
6241
6242 First let's decide if your kernel supports secure setuid #! scripts.
6243 (If setuid #! scripts would be secure but have been disabled anyway,
6244 don't say that they are secure if asked.)
6245
6246 EOM
6247
6248 val="$undef"
6249 if $test -d /dev/fd; then
6250         echo "#!$ls" >reflect
6251         chmod +x,u+s reflect
6252         ./reflect >flect 2>&1
6253         if $contains "/dev/fd" flect >/dev/null; then
6254                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6255                 val="$define"
6256         else
6257                 $cat <<EOM
6258 If you are not sure if they are secure, I can check but I'll need a
6259 username and password different from the one you are using right now.
6260 If you don't have such a username or don't want me to test, simply
6261 enter 'none'.
6262
6263 EOM
6264                 rp='Other username to test security of setuid scripts with?'
6265                 dflt='none'
6266                 . ./myread
6267                 case "$ans" in
6268                 n|none)
6269                         case "$d_suidsafe" in
6270                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6271                                 dflt=n;;
6272                         "$undef")
6273                                 echo "Well, the $hint value is *not* secure." >&4
6274                                 dflt=n;;
6275                         *)      echo "Well, the $hint value *is* secure." >&4
6276                                 dflt=y;;
6277                         esac
6278                         ;;
6279                 *)
6280                         $rm -f reflect flect
6281                         echo "#!$ls" >reflect
6282                         chmod +x,u+s reflect
6283                         echo >flect
6284                         chmod a+w flect
6285                         echo '"su" will (probably) prompt you for '"$ans's password."
6286                         su $ans -c './reflect >flect'
6287                         if $contains "/dev/fd" flect >/dev/null; then
6288                                 echo "Okay, it looks like setuid scripts are secure." >&4
6289                                 dflt=y
6290                         else
6291                                 echo "I don't think setuid scripts are secure." >&4
6292                                 dflt=n
6293                         fi
6294                         ;;
6295                 esac
6296                 rp='Does your kernel have *secure* setuid scripts?'
6297                 . ./myread
6298                 case "$ans" in
6299                 [yY]*)  val="$define";;
6300                 *)      val="$undef";;
6301                 esac
6302         fi
6303 else
6304         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6305         echo "(That's for file descriptors, not floppy disks.)"
6306         val="$undef"
6307 fi
6308 set d_suidsafe
6309 eval $setvar
6310
6311 $rm -f reflect flect
6312
6313 : now see if they want to do setuid emulation
6314 if $test $patchlevel -lt 11; then
6315 echo " "
6316 val="$undef"
6317 case "$d_suidsafe" in
6318 "$define")
6319         val="$undef"
6320         echo "No need to emulate SUID scripts since they are secure here." >&4
6321         ;;
6322 *)
6323         $cat <<EOM
6324 Some systems have disabled setuid scripts, especially systems where
6325 setuid scripts cannot be secure.  On systems where setuid scripts have
6326 been disabled, the setuid/setgid bits on scripts are currently
6327 useless.  It is possible for $package to detect those bits and emulate
6328 setuid/setgid in a secure fashion.  This emulation will only work if
6329 setuid scripts have been disabled in your kernel.
6330
6331 EOM
6332         case "$d_dosuid" in
6333         "$define") dflt=y ;;
6334         *) dflt=n ;;
6335         esac
6336         rp="Do you want to do setuid/setgid emulation?"
6337         . ./myread
6338         case "$ans" in
6339         [yY]*)  val="$define";;
6340         *)      val="$undef";;
6341         esac
6342         ;;
6343 esac
6344 set d_dosuid
6345 eval $setvar
6346 else
6347     case "$d_dosuid" in
6348         "$define")
6349         cat >&4 <<EOH
6350
6351 SUID emulation has been removed for 5.12
6352 Please re-run Configure without -Dd_dosuid
6353
6354 EOH
6355         exit 1;
6356         ;;
6357     esac
6358     d_dosuid=undef
6359 fi
6360
6361 : Find perl5.005 or later.
6362 echo "Looking for a previously installed perl5.005 or later... "
6363 case "$perl5" in
6364 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6365                 : Check if this perl is recent and can load a simple module
6366                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6367                         perl5=$tdir/perl
6368                         break;
6369                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6370                         perl5=$tdir/perl5
6371                         break;
6372                 fi
6373         done
6374         ;;
6375 *)      perl5="$perl5"
6376         ;;
6377 esac
6378 case "$perl5" in
6379 '')     echo "None found.  That's ok.";;
6380 *)      echo "Using $perl5." ;;
6381 esac
6382
6383 : Set the siteprefix variables
6384 $cat <<EOM
6385
6386 After $package is installed, you may wish to install various
6387 add-on modules and utilities.  Typically, these add-ons will
6388 be installed under $prefix with the rest
6389 of this package.  However, you may wish to install such add-ons
6390 elsewhere under a different prefix.
6391
6392 If you do not wish to put everything under a single prefix, that's
6393 ok.  You will be prompted for the individual locations; this siteprefix
6394 is only used to suggest the defaults.
6395
6396 The default should be fine for most people.
6397
6398 EOM
6399 fn=d~+
6400 rp='Installation prefix to use for add-on modules and utilities?'
6401 : XXX Here might be another good place for an installstyle setting.
6402 case "$siteprefix" in
6403 '') dflt=$prefix ;;
6404 *)  dflt=$siteprefix ;;
6405 esac
6406 . ./getfile
6407 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6408 oldsiteprefix=''
6409 case "$siteprefix" in
6410 '') ;;
6411 *)      case "$ans" in
6412         "$prefix") ;;
6413         *) oldsiteprefix="$prefix";;
6414         esac
6415         ;;
6416 esac
6417 siteprefix="$ans"
6418 siteprefixexp="$ansexp"
6419
6420 : determine where site specific libraries go.
6421 : Usual default is /usr/local/lib/perl5/site_perl/$version
6422 : The default "style" setting is made in installstyle.U
6423 : XXX No longer works with Prefixit stuff.
6424 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6425 case "$sitelib" in
6426 '') case "$installstyle" in
6427         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6428         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6429         esac
6430         ;;
6431 *)      dflt="$sitelib"
6432         ;;
6433 esac
6434 $cat <<EOM
6435
6436 The installation process will create a directory for
6437 site-specific extensions and modules.  Most users find it convenient
6438 to place all site-specific files in this directory rather than in the
6439 main distribution directory.
6440
6441 EOM
6442 fn=d~+
6443 rp='Pathname for the site-specific library files?'
6444 . ./getfile
6445 prefixvar=sitelib
6446 . ./setprefixvar
6447 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6448
6449 : Determine list of previous versions to include in @INC
6450 $cat > getverlist <<EOPL
6451 #!$perl5 -w
6452 use File::Basename;
6453 \$api_versionstring = "$api_versionstring";
6454 \$version = "$version";
6455 \$stem = "$sitelib_stem";
6456 \$archname = "$archname";
6457 EOPL
6458         $cat >> getverlist <<'EOPL'
6459 # The list found is store twice for each entry: the original name, and
6460 # the binary broken down version as pack "sss", so sorting is easy and
6461 # unambiguous. This will work for all versions that have a maximum of
6462 # three digit groups, separate by '.'s or '_'s. Names are extended with
6463 # ".0.0" to ensure at least three elements for the pack.
6464 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6465
6466 # Can't have leading @ because metaconfig interprets it as a command!
6467 ;@inc_version_list=();
6468 # XXX Redo to do opendir/readdir?
6469 if (-d $stem) {
6470     chdir($stem);
6471     ;@candidates = map {
6472         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6473     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6474 }
6475 else {
6476     ;@candidates = ();
6477 }
6478
6479 ($pversion, $aversion, $vsn5005) = map {
6480     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6481 foreach $d (@candidates) {
6482     if ($d->[1] lt $pversion) {
6483         if ($d->[1] ge $aversion) {
6484             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6485         }
6486         elsif ($d->[1] ge $vsn5005) {
6487             unshift(@inc_version_list, grep { -d } $d->[0]);
6488         }
6489     }
6490     else {
6491         # Skip newer version.  I.e. don't look in
6492         # 5.7.0 if we're installing 5.6.1.
6493     }
6494 }
6495
6496 if (@inc_version_list) {
6497     print join(' ', @inc_version_list);
6498 }
6499 else {
6500     # Blank space to preserve value for next Configure run.
6501     print " ";
6502 }
6503 EOPL
6504 chmod +x getverlist
6505 case "$inc_version_list" in
6506 '')     if test -x "$perl5$exe_ext"; then
6507                 dflt=`$perl5 getverlist`
6508         else
6509                 dflt='none'
6510         fi
6511         ;;
6512 $undef) dflt='none' ;;
6513 *)  eval dflt=\"$inc_version_list\" ;;
6514 esac
6515 case "$dflt" in
6516 ''|' ') dflt=none ;;
6517 esac
6518 case "$dflt" in
6519 5.005) dflt=none ;;
6520 esac
6521 $cat <<EOM
6522
6523 In order to ease the process of upgrading, this version of perl
6524 can be configured to use modules built and installed with earlier
6525 versions of perl that were installed under $prefix.  Specify here
6526 the list of earlier versions that this version of perl should check.
6527 If Configure detected no earlier versions of perl installed under
6528 $prefix, then the list will be empty.  Answer 'none' to tell perl
6529 to not search earlier versions.
6530
6531 The default should almost always be sensible, so if you're not sure,
6532 just accept the default.
6533 EOM
6534
6535 rp='List of earlier versions to include in @INC?'
6536 . ./myread
6537 case "$ans" in
6538 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6539 *) inc_version_list="$ans" ;;
6540 esac
6541 case "$inc_version_list" in
6542 ''|' ')
6543         inc_version_list_init='0'
6544         d_inc_version_list="$undef"
6545         ;;
6546 *)      inc_version_list_init=`echo $inc_version_list |
6547                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6548         d_inc_version_list="$define"
6549         ;;
6550 esac
6551 $rm -f getverlist
6552
6553 : see if malloc/malloc.h has to be included
6554 set malloc/malloc.h i_mallocmalloc
6555 eval $inhdr
6556
6557 : see if this is a malloc.h system
6558 : we want a real compile instead of Inhdr because some systems have a
6559 : malloc.h that just gives a compile error saying to use stdlib.h instead
6560 echo " "
6561 $cat >try.c <<EOCP
6562 #include <stdlib.h>
6563 #include <malloc.h>
6564 #$i_mallocmalloc I_MALLOCMALLOC
6565 #ifdef I_MALLOCMALLOC
6566 # include <malloc/malloc.h>
6567 #endif
6568
6569 int main () { return 0; }
6570 EOCP
6571 set try
6572 if eval $compile; then
6573     echo "<malloc.h> found." >&4
6574     val="$define"
6575 else
6576     echo "<malloc.h> NOT found." >&4
6577     val="$undef"
6578 fi
6579 $rm_try
6580 set i_malloc
6581 eval $setvar
6582
6583 : check for void type
6584 echo " "
6585 echo "Checking to see how well your C compiler groks the void type..." >&4
6586 case "$voidflags" in
6587 '')
6588         $cat >try.c <<EOCP
6589 #$i_stdlib I_STDLIB
6590 #ifdef I_STDLIB
6591 #include <stdlib.h>
6592 #endif
6593 #if TRY & 1
6594 void sub() {
6595 #else
6596 sub() {
6597 #endif
6598         extern void moo();      /* function returning void */
6599         void (*goo)();          /* ptr to func returning void */
6600 #if TRY & 8
6601         void *hue;              /* generic ptr */
6602 #endif
6603 #if TRY & 2
6604         void (*foo[10])();
6605 #endif
6606
6607 #if TRY & 4
6608         if(goo == moo) {
6609                 exit(0);
6610         }
6611 #endif
6612         exit(0);
6613 }
6614 int main() { sub(); }
6615 EOCP
6616         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6617                 voidflags=$defvoidused
6618         echo "Good.  It appears to support void to the level $package wants.">&4
6619                 if $contains warning .out >/dev/null 2>&1; then
6620                         echo "However, you might get some warnings that look like this:"
6621                         $cat .out
6622                 fi
6623         else
6624 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6625                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6626                         echo "It supports 1..."
6627                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6628                                 echo "It also supports 2..."
6629                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6630                                         voidflags=7
6631                                         echo "And it supports 4 but not 8 definitely."
6632                                 else
6633                                         echo "It doesn't support 4..."
6634                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6635                                                 voidflags=11
6636                                                 echo "But it supports 8."
6637                                         else
6638                                                 voidflags=3
6639                                                 echo "Neither does it support 8."
6640                                         fi
6641                                 fi
6642                         else
6643                                 echo "It does not support 2..."
6644                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6645                                         voidflags=13
6646                                         echo "But it supports 4 and 8."
6647                                 else
6648                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6649                                                 voidflags=5
6650                                                 echo "And it supports 4 but has not heard about 8."
6651                                         else
6652                                                 echo "However it supports 8 but not 4."
6653                                         fi
6654                                 fi
6655                         fi
6656                 else
6657                         echo "There is no support at all for void."
6658                         voidflags=0
6659                 fi
6660         fi
6661 esac
6662 case "$voidflags" in
6663 "$defvoidused") ;;
6664 *)      $cat >&4 <<'EOM'
6665   Support flag bits are:
6666     1: basic void declarations.
6667     2: arrays of pointers to functions returning void.
6668     4: operations between pointers to and addresses of void functions.
6669     8: generic void pointers.
6670 EOM
6671         dflt="$voidflags";
6672         rp="Your void support flags add up to what?"
6673         . ./myread
6674         voidflags="$ans"
6675         ;;
6676 esac
6677 $rm_try
6678
6679 : check for length of pointer
6680 echo " "
6681 case "$ptrsize" in
6682 '')
6683         echo "Checking to see how big your pointers are..." >&4
6684         if test "$voidflags" -gt 7; then
6685                 echo '#define VOID_PTR char *' > try.c
6686         else
6687                 echo '#define VOID_PTR void *' > try.c
6688         fi
6689         $cat >>try.c <<EOCP
6690 #include <stdio.h>
6691 #$i_stdlib I_STDLIB
6692 #ifdef I_STDLIB
6693 #include <stdlib.h>
6694 #endif
6695 int main()
6696 {
6697     printf("%d\n", (int)sizeof(VOID_PTR));
6698     exit(0);
6699 }
6700 EOCP
6701         set try
6702         if eval $compile_ok; then
6703                 ptrsize=`$run ./try`
6704                 echo "Your pointers are $ptrsize bytes long."
6705         else
6706                 dflt='4'
6707                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6708                 rp="What is the size of a pointer (in bytes)?"
6709                 . ./myread
6710                 ptrsize="$ans"
6711         fi
6712         ;;
6713 esac
6714 $rm_try
6715 case "$use64bitall" in
6716 "$define"|true|[yY]*)
6717         case "$ptrsize" in
6718         4)      cat <<EOM >&4
6719
6720 *** You have chosen a maximally 64-bit build,
6721 *** but your pointers are only 4 bytes wide.
6722 *** Please rerun Configure without -Duse64bitall.
6723 EOM
6724                 case "$d_quad" in
6725                 define)
6726                         cat <<EOM >&4
6727 *** Since you have quads, you could possibly try with -Duse64bitint.
6728 EOM
6729                         ;;
6730                 esac
6731                 cat <<EOM >&4
6732 *** Cannot continue, aborting.
6733
6734 EOM
6735
6736                 exit 1
6737                 ;;
6738         esac
6739         ;;
6740 esac
6741
6742
6743 : determine whether to use malloc wrapping
6744 echo " "
6745 case "$usemallocwrap" in
6746 [yY]*|true|$define)     dflt='y' ;;
6747 [nN]*|false|$undef)     dflt='n' ;;
6748 *)      case "$usedevel" in
6749         [yY]*|true|$define)     dflt='y' ;;
6750         *) dflt='n' ;;
6751         esac
6752         ;;
6753 esac
6754 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6755 . ./myread
6756 usemallocwrap="$ans"
6757 case "$ans" in
6758 y*|true)
6759         usemallocwrap="$define" ;;
6760 *)
6761         usemallocwrap="$undef" ;;
6762 esac
6763
6764 : determine which malloc to compile in
6765 echo " "
6766 case "$usemymalloc" in
6767 [yY]*|true|$define)     dflt='y' ;;
6768 [nN]*|false|$undef)     dflt='n' ;;
6769 *)      case "$ptrsize" in
6770         4) dflt='y' ;;
6771         *) dflt='n' ;;
6772         esac
6773         ;;
6774 esac
6775 rp="Do you wish to attempt to use the malloc that comes with $package?"
6776 . ./myread
6777 usemymalloc="$ans"
6778 case "$ans" in
6779 y*|true)
6780         usemymalloc='y'
6781         mallocsrc='malloc.c'
6782         mallocobj="malloc$_o"
6783         d_mymalloc="$define"
6784         case "$libs" in
6785         *-lmalloc*)
6786                 : Remove malloc from list of libraries to use
6787                 echo "Removing unneeded -lmalloc from library list" >&4
6788                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6789                 shift
6790                 libs="$*"
6791                 echo "libs = $libs" >&4
6792                 ;;
6793         esac
6794         ;;
6795 *)
6796         usemymalloc='n'
6797         mallocsrc=''
6798         mallocobj=''
6799         d_mymalloc="$undef"
6800         ;;
6801 esac
6802
6803 : compute the return types of malloc and free
6804 echo " "
6805 $cat >malloc.c <<END
6806 #$i_malloc I_MALLOC
6807 #$i_stdlib I_STDLIB
6808 #include <stdio.h>
6809 #include <sys/types.h>
6810 #ifdef I_MALLOC
6811 #include <malloc.h>
6812 #endif
6813 #ifdef I_STDLIB
6814 #include <stdlib.h>
6815 #endif
6816 #ifdef TRY_MALLOC
6817 void *malloc();
6818 #endif
6819 #ifdef TRY_FREE
6820 void free();
6821 #endif
6822 END
6823 case "$malloctype" in
6824 '')
6825         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6826                 malloctype='void *'
6827         else
6828                 malloctype='char *'
6829         fi
6830         ;;
6831 esac
6832 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6833
6834 case "$freetype" in
6835 '')
6836         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6837                 freetype='void'
6838         else
6839                 freetype='int'
6840         fi
6841         ;;
6842 esac
6843 echo "Your system uses $freetype free(), it would seem." >&4
6844 $rm -f malloc.[co]
6845 : determine where site specific architecture-dependent libraries go.
6846 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6847 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6848 : sitelib may have an optional trailing /share.
6849 case "$sitearch" in
6850 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6851         dflt="$dflt/$archname"
6852         ;;
6853 *)      dflt="$sitearch"
6854         ;;
6855 esac
6856 set sitearch sitearch none
6857 eval $prefixit
6858 $cat <<EOM
6859
6860 The installation process will also create a directory for
6861 architecture-dependent site-specific extensions and modules.
6862
6863 EOM
6864 fn=d~+
6865 rp='Pathname for the site-specific architecture-dependent library files?'
6866 . ./getfile
6867 prefixvar=sitearch
6868 . ./setprefixvar
6869 if $test X"$sitearch" = X"$sitelib"; then
6870         d_sitearch="$undef"
6871 else
6872         d_sitearch="$define"
6873 fi
6874
6875 : Set the vendorprefix variables
6876 $cat <<EOM
6877
6878 The installation process will also create a directory for
6879 vendor-supplied add-ons.  Vendors who supply perl with their system
6880 may find it convenient to place all vendor-supplied files in this
6881 directory rather than in the main distribution directory.  This will
6882 ease upgrades between binary-compatible maintenance versions of perl.
6883
6884 Of course you may also use these directories in whatever way you see
6885 fit.  For example, you might use them to access modules shared over a
6886 company-wide network.
6887
6888 The default answer should be fine for most people.
6889 This causes further questions about vendor add-ons to be skipped
6890 and no vendor-specific directories will be configured for perl.
6891
6892 EOM
6893 rp='Do you want to configure vendor-specific add-on directories?'
6894 case "$usevendorprefix" in
6895 define|true|[yY]*) dflt=y ;;
6896 *)      : User may have set vendorprefix directly on Configure command line.
6897         case "$vendorprefix" in
6898         ''|' ') dflt=n ;;
6899         *)      dflt=y ;;
6900         esac
6901         ;;
6902 esac
6903 . ./myread
6904 case "$ans" in
6905 [yY]*)  fn=d~+
6906         rp='Installation prefix to use for vendor-supplied add-ons?'
6907         case "$vendorprefix" in
6908         '') dflt='' ;;
6909         *)  dflt=$vendorprefix ;;
6910         esac
6911         . ./getfile
6912         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6913         oldvendorprefix=''
6914         case "$vendorprefix" in
6915         '') ;;
6916         *)      case "$ans" in
6917                 "$prefix") ;;
6918                 *) oldvendorprefix="$prefix";;
6919                 esac
6920                 ;;
6921         esac
6922         usevendorprefix="$define"
6923         vendorprefix="$ans"
6924         vendorprefixexp="$ansexp"
6925         ;;
6926 *)      usevendorprefix="$undef"
6927         vendorprefix=''
6928         vendorprefixexp=''
6929         ;;
6930 esac
6931
6932 : Set the vendorlib variables
6933 case "$vendorprefix" in
6934 '')     d_vendorlib="$undef"
6935         vendorlib=''
6936         vendorlibexp=''
6937         ;;
6938 *)      d_vendorlib="$define"
6939         : determine where vendor-supplied modules go.
6940         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6941         case "$vendorlib" in
6942         '')
6943                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6944                 case "$installstyle" in
6945                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6946                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6947                 esac
6948                 ;;
6949         *)      dflt="$vendorlib"
6950                 ;;
6951         esac
6952         fn=d~+
6953         rp='Pathname for the vendor-supplied library files?'
6954         . ./getfile
6955         vendorlib="$ans"
6956         vendorlibexp="$ansexp"
6957         ;;
6958 esac
6959 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6960 prefixvar=vendorlib
6961 . ./installprefix
6962
6963 : Set the vendorarch variables
6964 case "$vendorprefix" in
6965 '')     d_vendorarch="$undef"
6966         vendorarch=''
6967         vendorarchexp=''
6968         ;;
6969 *)      d_vendorarch="$define"
6970         : determine where vendor-supplied architecture-dependent libraries go.
6971         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6972         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6973         : vendorlib may have an optional trailing /share.
6974         case "$vendorarch" in
6975         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6976                 dflt="$dflt/$archname"
6977                 ;;
6978         *)      dflt="$vendorarch" ;;
6979         esac
6980         fn=d~+
6981         rp='Pathname for vendor-supplied architecture-dependent files?'
6982         . ./getfile
6983         vendorarch="$ans"
6984         vendorarchexp="$ansexp"
6985         ;;
6986 esac
6987 prefixvar=vendorarch
6988 . ./installprefix
6989 if $test X"$vendorarch" = X"$vendorlib"; then
6990         d_vendorarch="$undef"
6991 else
6992         d_vendorarch="$define"
6993 fi
6994
6995 : Final catch-all directories to search
6996 $cat <<EOM
6997
6998 Lastly, you can have perl look in other directories for extensions and
6999 modules in addition to those already specified.
7000 These directories will be searched after 
7001         $sitearch 
7002         $sitelib 
7003 EOM
7004 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7005 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7006 echo ' '
7007 case "$otherlibdirs" in
7008 ''|' ') dflt='none' ;;
7009 *)      dflt="$otherlibdirs" ;;
7010 esac
7011 $cat <<EOM
7012 Enter a colon-separated set of extra paths to include in perl's @INC
7013 search path, or enter 'none' for no extra paths.
7014
7015 EOM
7016
7017 rp='Colon-separated list of additional directories for perl to search?'
7018 . ./myread
7019 case "$ans" in
7020 ' '|''|none)    otherlibdirs=' ' ;;     
7021 *)      otherlibdirs="$ans" ;;
7022 esac
7023 case "$otherlibdirs" in
7024 ' ') val=$undef ;;
7025 *)      val=$define ;;
7026 esac
7027 set d_perl_otherlibdirs
7028 eval $setvar
7029
7030 : Cruising for prototypes
7031 echo " "
7032 echo "Checking out function prototypes..." >&4
7033 $cat >prototype.c <<EOCP
7034 #$i_stdlib I_STDLIB
7035 #ifdef I_STDLIB
7036 #include <stdlib.h>
7037 #endif
7038 int main(int argc, char *argv[]) {
7039         exit(0);}
7040 EOCP
7041 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7042         echo "Your C compiler appears to support function prototypes."
7043         val="$define"
7044 else
7045         echo "Your C compiler doesn't seem to understand function prototypes."
7046         val="$undef"
7047 fi
7048 set prototype
7049 eval $setvar
7050 $rm -f prototype*
7051
7052 : Check if ansi2knr is required
7053 case "$prototype" in
7054 "$define") ;;
7055 *)      ansi2knr='ansi2knr'
7056         echo " "
7057         cat <<EOM >&4
7058
7059 $me:  FATAL ERROR:
7060 This version of $package can only be compiled by a compiler that 
7061 understands function prototypes.  Unfortunately, your C compiler 
7062         $cc $ccflags
7063 doesn't seem to understand them.  Sorry about that.
7064
7065 If GNU cc is available for your system, perhaps you could try that instead.  
7066
7067 Eventually, we hope to support building Perl with pre-ANSI compilers.
7068 If you would like to help in that effort, please contact <perlbug@perl.org>.
7069
7070 Aborting Configure now.
7071 EOM
7072         exit 2
7073         ;;
7074 esac
7075
7076 : DTrace support
7077 dflt_dtrace='/usr/sbin/dtrace'
7078 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7079
7080 cat <<EOM
7081
7082 Perl can be built to support DTrace on platforms that support it.
7083 DTrace is a diagnosis and performance analysis tool from Sun.
7084
7085 If this doesn't make any sense to you, just accept the default '$dflt'.
7086 EOM
7087
7088 while $test 1 ; do
7089         case "$usedtrace" in
7090         $define|true|[yY]*)
7091                 dflt='y'
7092                 ;;
7093         ?*)
7094                 dflt='y'
7095                 dflt_dtrace=$usedtrace
7096                 ;;
7097         *)
7098                 dflt='n'
7099                 ;;
7100         esac
7101
7102         rp='Support DTrace if available?'
7103         . ./myread
7104         case "$ans" in
7105         y|Y)    val="$define" ;;
7106         *)      val="$undef" ;;
7107         esac
7108         set usedtrace
7109         eval $setvar
7110
7111         test "X$usedtrace" != "X$define" && break
7112
7113         echo " "
7114         rp='Where is the dtrace executable?'
7115         dflt=$dflt_dtrace
7116         . ./getfile
7117         val="$ans"
7118         set dtrace
7119         eval $setvar
7120
7121         if $test -f $dtrace
7122         then
7123                 if $dtrace -h -s ../perldtrace.d \
7124                         -o perldtrace.tmp >/dev/null 2>&1 \
7125                         && rm -f perldtrace.tmp
7126                 then
7127                         echo " "
7128                         echo "Good: your $dtrace knows about the -h flag."
7129                 else
7130                         cat >&2 <<EOM
7131
7132 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7133 ***
7134 *** Your installed dtrace doesn't support the -h switch to compile a D
7135 *** program into a C header. Can't continue.
7136
7137 EOM
7138                         exit 1
7139                 fi
7140                 break;
7141         fi
7142
7143         case "$fastread" in
7144         yes)
7145                 cat >&2 <<EOM
7146
7147 *** $me:  Fatal Error:  $dtrace not found.
7148 *** Can't continue.
7149
7150 EOM
7151                 exit 1
7152                 ;;
7153         *)
7154                 echo "*** $dtrace was not found."
7155                 echo " "
7156                 ;;
7157         esac
7158 done
7159
7160 : See if we want extra modules installed
7161 echo " "
7162 case "$extras" in
7163 '') dflt='n';;
7164 *) dflt='y';;
7165 esac
7166 cat <<EOM
7167 Perl can be built with extra modules or bundles of modules which
7168 will be fetched from the CPAN and installed alongside Perl.
7169
7170 Notice that you will need access to the CPAN; either via the Internet,
7171 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7172 be asked later to configure the CPAN.pm module which will in turn do
7173 the installation of the rest of the extra modules or bundles.)
7174
7175 Notice also that if the modules require any external software such as
7176 libraries and headers (the libz library and the zlib.h header for the
7177 Compress::Zlib module, for example) you MUST have any such software
7178 already installed, this configuration process will NOT install such
7179 things for you.
7180
7181 If this doesn't make any sense to you, just accept the default '$dflt'.
7182 EOM
7183 rp='Install any extra modules (y or n)?'
7184 . ./myread
7185 case "$ans" in
7186 y|Y)
7187         cat <<EOM
7188
7189 Please list any extra modules or bundles to be installed from CPAN,
7190 with spaces between the names.  The names can be in any format the
7191 'install' command of CPAN.pm will understand.  (Answer 'none',
7192 without the quotes, to install no extra modules or bundles.)
7193 EOM
7194         rp='Extras?'
7195         dflt="$extras"
7196         . ./myread
7197         extras="$ans"
7198 esac
7199 case "$extras" in
7200 ''|'none')
7201         val=''
7202         $rm -f ../extras.lst
7203         ;;
7204 *)      echo "(Saving the list of extras for later...)"
7205         echo "$extras" > ../extras.lst
7206         val="'$extras'"
7207         ;;
7208 esac
7209 set extras
7210 eval $setvar
7211 echo " "
7212
7213 : determine where html pages for programs go
7214 set html1dir html1dir none
7215 eval $prefixit
7216 $cat <<EOM
7217
7218 If you wish to install html files for programs in $spackage, indicate
7219 the appropriate directory here.  To skip installing html files,
7220 answer "none".
7221 EOM
7222 case "$html1dir" in
7223 ''|none|$undef|' ') dflt=none ;;
7224 *) dflt=$html1dir ;;
7225 esac
7226 fn=dn+~
7227 rp="Directory for the main $spackage html pages?"
7228 . ./getfile
7229 prefixvar=html1dir
7230 . ./setprefixvar
7231 : Use ' ' for none so value is preserved next time through Configure
7232 $test X"$html1dir" = "X" && html1dir=' '
7233
7234 : determine where html pages for libraries and modules go
7235 set html3dir html3dir none
7236 eval $prefixit
7237 $cat <<EOM
7238
7239 If you wish to install html files for modules associated with $spackage,
7240 indicate the appropriate directory here.  To skip installing html files,
7241 answer "none".
7242 EOM
7243 : There is no obvious default.  If they have specified html1dir, then
7244 : try to key off that, possibly changing .../html1 into .../html3.
7245 case "$html3dir" in
7246 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7247 *) dflt=$html3dir ;;
7248 esac
7249 fn=dn+~
7250 rp="Directory for the $spackage module html pages?"
7251 . ./getfile
7252 prefixvar=html3dir
7253 . ./setprefixvar
7254 : Use ' ' for none so value is preserved next time through Configure
7255 $test X"$html3dir" = "X" && html3dir=' '
7256
7257 : determine whether to install perl also as /usr/bin/perl
7258
7259 echo " "
7260 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7261         $cat <<EOM
7262 Many scripts expect perl to be installed as /usr/bin/perl.
7263
7264 If you want to, I can install the perl you are about to compile
7265 as /usr/bin/perl (in addition to $bin/perl).
7266 EOM
7267         if test -f /usr/bin/perl; then
7268             $cat <<EOM
7269
7270 However, please note that because you already have a /usr/bin/perl,
7271 overwriting that with a new Perl would very probably cause problems.
7272 Therefore I'm assuming you don't want to do that (unless you insist).
7273
7274 EOM
7275             case "$installusrbinperl" in
7276             "$define"|[yY]*)    dflt='y';;
7277             *)                  dflt='n';;
7278             esac
7279         else
7280             $cat <<EOM
7281
7282 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7283
7284 EOM
7285             case "$installusrbinperl" in
7286             "$undef"|[nN]*)     dflt='n';;
7287             *)                  dflt='y';;
7288             esac
7289         fi
7290         rp="Do you want to install perl as /usr/bin/perl?"
7291         . ./myread
7292         case "$ans" in
7293         [yY]*)  val="$define";;
7294         *)      val="$undef" ;;
7295         esac
7296 else
7297         val="$undef"
7298 fi
7299 set installusrbinperl
7300 eval $setvar
7301
7302 : Check if we are using the GNU C library
7303 echo " "
7304 echo "Checking for GNU C Library..." >&4
7305 cat >try.c <<'EOCP'
7306 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7307    alone are insufficient to distinguish different versions, such as
7308    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7309    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7310 */
7311 #include <stdio.h>
7312 int main(void)
7313 {
7314 #ifdef __GLIBC__
7315 #   ifdef __GLIBC_MINOR__
7316 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7317 #           include <gnu/libc-version.h>
7318             printf("%s\n",  gnu_get_libc_version());
7319 #       else
7320             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7321 #       endif
7322 #   else
7323         printf("%d\n",  __GLIBC__);
7324 #   endif
7325     return 0;
7326 #else
7327     return 1;
7328 #endif
7329 }
7330 EOCP
7331 set try
7332 if eval $compile_ok && $run ./try > glibc.ver; then
7333         val="$define"
7334         gnulibc_version=`$cat glibc.ver`
7335         echo "You are using the GNU C Library version $gnulibc_version"
7336 else
7337         val="$undef"
7338         gnulibc_version=''
7339         echo "You are not using the GNU C Library"
7340 fi
7341 $rm_try glibc.ver
7342 set d_gnulibc
7343 eval $setvar
7344
7345 : see if nm is to be used to determine whether a symbol is defined or not
7346 case "$usenm" in
7347 '')
7348         dflt=''
7349         case "$d_gnulibc" in
7350         "$define")
7351                 echo " "
7352                 echo "nm probably won't work on the GNU C Library." >&4
7353                 dflt=n
7354                 ;;
7355         esac
7356         case "$dflt" in
7357         '') 
7358                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7359                         echo " "
7360                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7361                         echo "'nm' won't be sufficient on this sytem." >&4
7362                         dflt=n
7363                 fi
7364                 ;;
7365         esac
7366         case "$dflt" in
7367         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7368                 if $test $dflt -gt 20; then
7369                         dflt=y
7370                 else
7371                         dflt=n
7372                 fi
7373                 ;;
7374         esac
7375         ;;
7376 *)
7377         case "$usenm" in
7378         true|$define) dflt=y;;
7379         *) dflt=n;;
7380         esac
7381         ;;
7382 esac
7383 $cat <<EOM
7384
7385 I can use $nm to extract the symbols from your C libraries. This
7386 is a time consuming task which may generate huge output on the disk (up
7387 to 3 megabytes) but that should make the symbols extraction faster. The
7388 alternative is to skip the 'nm' extraction part and to compile a small
7389 test program instead to determine whether each symbol is present. If
7390 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7391 this may be the best solution.
7392
7393 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7394
7395 EOM
7396 rp="Shall I use $nm to extract C symbols from the libraries?"
7397 . ./myread
7398 case "$ans" in
7399 [Nn]*) usenm=false;;
7400 *) usenm=true;;
7401 esac
7402
7403 runnm=$usenm
7404 case "$reuseval" in
7405 true) runnm=false;;
7406 esac
7407
7408 : nm options which may be necessary
7409 case "$nm_opt" in
7410 '') if $test -f /mach_boot; then
7411                 nm_opt=''       # Mach
7412         elif $test -d /usr/ccs/lib; then
7413                 nm_opt='-p'     # Solaris (and SunOS?)
7414         elif $test -f /dgux; then
7415                 nm_opt='-p'     # DG-UX
7416         elif $test -f /lib64/rld; then
7417                 nm_opt='-p'     # 64-bit Irix
7418         else
7419                 nm_opt=''
7420         fi;;
7421 esac
7422
7423 : nm options which may be necessary for shared libraries but illegal
7424 : for archive libraries.  Thank you, Linux.
7425 case "$nm_so_opt" in
7426 '')     case "$myuname" in
7427         *linux*|gnu*)
7428                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7429                         nm_so_opt='--dynamic'
7430                 fi
7431                 ;;
7432         esac
7433         ;;
7434 esac
7435
7436 : Figure out where the libc is located
7437 case "$runnm" in
7438 true)
7439 : get list of predefined functions in a handy place
7440 echo " "
7441 case "$libc" in
7442 '') libc=unknown
7443         case "$libs" in
7444         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7445         esac
7446         ;;
7447 esac
7448 case "$libs" in
7449 '') ;;
7450 *)  for thislib in $libs; do
7451         case "$thislib" in
7452         -lc|-lc_s)
7453                 : Handle C library specially below.
7454                 ;;
7455         -l*)
7456                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7457                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7458                         :
7459                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7460                         :
7461                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7462                         :
7463                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7464                         :
7465                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7466                         :
7467                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7468                         :
7469                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7470                         :
7471                 else
7472                         try=''
7473                 fi
7474                 libnames="$libnames $try"
7475                 ;;
7476         *) libnames="$libnames $thislib" ;;
7477         esac
7478         done
7479         ;;
7480 esac
7481 xxx=normal
7482 case "$libc" in
7483 unknown)
7484         set /lib/libc.$so
7485         for xxx in $libpth; do
7486                 $test -r $1 || set $xxx/libc.$so
7487                 : The messy sed command sorts on library version numbers.
7488                 $test -r $1 || \
7489                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7490                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7491                                 h
7492                                 s/[0-9][0-9]*/0000&/g
7493                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7494                                 G
7495                                 s/\n/ /' | \
7496                          $sort | $sed -e 's/^.* //'`
7497                 eval set \$$#
7498         done
7499         $test -r $1 || set /usr/ccs/lib/libc.$so
7500         $test -r $1 || set /lib/libsys_s$_a
7501         ;;
7502 *)
7503         set blurfl
7504         ;;
7505 esac
7506 if $test -r "$1"; then
7507         echo "Your (shared) C library seems to be in $1."
7508         libc="$1"
7509 elif $test -r /lib/libc && $test -r /lib/clib; then
7510         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7511         xxx=apollo
7512         libc='/lib/clib /lib/libc'
7513         if $test -r /lib/syslib; then
7514                 echo "(Your math library is in /lib/syslib.)"
7515                 libc="$libc /lib/syslib"
7516         fi
7517 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7518         echo "Your C library seems to be in $libc, as you said before."
7519 elif $test -r $incpath/usr/lib/libc$_a; then
7520         libc=$incpath/usr/lib/libc$_a;
7521         echo "Your C library seems to be in $libc.  That's fine."
7522 elif $test -r /lib/libc$_a; then
7523         libc=/lib/libc$_a;
7524         echo "Your C library seems to be in $libc.  You're normal."
7525 else
7526         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7527                 :
7528         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7529                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7530         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7531                 :
7532         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7533                 :
7534         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7535                 :
7536         else
7537                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7538         fi
7539         if $test -r "$tans"; then
7540                 echo "Your C library seems to be in $tans, of all places."
7541                 libc=$tans
7542         else
7543                 libc='blurfl'
7544         fi
7545 fi
7546 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7547         dflt="$libc"
7548         cat <<EOM
7549
7550 If the guess above is wrong (which it might be if you're using a strange
7551 compiler, or your machine supports multiple models), you can override it here.
7552
7553 EOM
7554 else
7555         dflt=''
7556         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7557         cat >&4 <<EOM
7558 I can't seem to find your C library.  I've looked in the following places:
7559
7560 EOM
7561         $sed 's/^/      /' libpath
7562         cat <<EOM
7563
7564 None of these seems to contain your C library. I need to get its name...
7565
7566 EOM
7567 fi
7568 fn=f
7569 rp='Where is your C library?'
7570 . ./getfile
7571 libc="$ans"
7572
7573 echo " "
7574 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7575 set X `cat libnames`
7576 shift
7577 xxx=files
7578 case $# in 1) xxx=file; esac
7579 echo "Extracting names from the following $xxx for later perusal:" >&4
7580 echo " "
7581 $sed 's/^/      /' libnames >&4
7582 echo " "
7583 $echo $n "This may take a while...$c" >&4
7584
7585 for file in $*; do
7586         case $file in
7587         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7588         *) $nm $nm_opt $file 2>/dev/null;;
7589         esac
7590 done >libc.tmp
7591
7592 $echo $n ".$c"
7593 $grep fprintf libc.tmp > libc.ptf
7594 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7595 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7596 xxx='[ADTSIWi]'
7597 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7598         eval $xscan;\
7599         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7600                 eval $xrun
7601 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7602         eval $xscan;\
7603         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7604                 eval $xrun
7605 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7606         eval $xscan;\
7607         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7608                 eval $xrun
7609 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7610         eval $xscan;\
7611         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7612                 eval $xrun
7613 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7614         eval $xscan;\
7615         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7616                 eval $xrun
7617 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7618         eval $xscan;\
7619         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7620                 eval $xrun
7621 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7622                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7623         eval $xscan;\
7624         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7625                 eval $xrun
7626 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7627         eval $xscan;\
7628         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7629                 eval $xrun
7630 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7631         eval $xscan;\
7632         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7633                 eval $xrun
7634 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7635         eval $xscan;\
7636         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7637                 eval $xrun
7638 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7639         eval $xscan;\
7640         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7641                 eval $xrun
7642 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7643         eval $xscan;\
7644         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7645                 eval $xrun
7646 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7647         eval $xscan;\
7648         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7649                 eval $xrun
7650 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7651         eval $xscan;\
7652         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7653                 eval $xrun
7654 else
7655         $nm -p $* 2>/dev/null >libc.tmp
7656         $grep fprintf libc.tmp > libc.ptf
7657         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7658                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7659         then
7660                 nm_opt='-p'
7661                 eval $xrun
7662         else
7663                 echo " "
7664                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7665                 com=''
7666                 if $ar t $libc > libc.tmp && \
7667                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7668                 then
7669                         for thisname in $libnames $libc; do
7670                                 $ar t $thisname >>libc.tmp
7671                         done
7672                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7673                         echo "Ok." >&4
7674                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7675                         for thisname in $libnames $libc; do
7676                                 $ar tv $thisname >>libc.tmp
7677                                 emximp -o tmp.imp $thisname \
7678                                     2>/dev/null && \
7679                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7680                                     < tmp.imp >>libc.tmp
7681                                 $rm -f tmp.imp
7682                         done
7683                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7684                         echo "Ok." >&4
7685                 else
7686                         echo "$ar didn't seem to work right." >&4
7687                         echo "Maybe this is a Cray...trying bld instead..." >&4
7688                         if  bld t $libc | \
7689                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7690                                 $test -s libc.list
7691                         then
7692                                 for thisname in $libnames; do
7693                                         bld t $libnames | \
7694                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7695                                         $ar t $thisname >>libc.tmp
7696                                 done
7697                                 echo "Ok." >&4
7698                         else
7699                                 echo "That didn't work either.  Giving up." >&4
7700                                 exit 1
7701                         fi
7702                 fi
7703         fi
7704 fi
7705 nm_extract="$com"
7706 case "$PASE" in
7707 define)
7708     echo " "
7709     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7710     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7711     ;;
7712 *)  if $test -f /lib/syscalls.exp; then
7713         echo " "
7714         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7715         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7716                 /lib/syscalls.exp >>libc.list
7717     fi
7718     ;;
7719 esac
7720 ;;
7721 esac
7722 $rm -f libnames libpath
7723
7724 : see if dld is available
7725 set dld.h i_dld
7726 eval $inhdr
7727
7728 : Check if we are using C++
7729 echo " "
7730 echo "Checking for C++..." >&4
7731 $cat >try.c <<'EOCP'
7732 #include <stdio.h>
7733 int main(void)
7734 {
7735 #ifdef __cplusplus
7736     return 0;
7737 #else
7738     return 1;
7739 #endif
7740 }
7741 EOCP
7742 set try
7743 if eval $compile_ok && $run ./try; then
7744         val="$define"
7745         echo "You are using a C++ compiler."
7746 else
7747         val="$undef"
7748         echo "You are not using a C++ compiler."
7749 fi
7750 $rm_try cplusplus$$
7751 set d_cplusplus
7752 eval $setvar
7753
7754 : is a C symbol defined?
7755 csym='tlook=$1;
7756 case "$3" in
7757 -v) tf=libc.tmp; tdc="";;
7758 -a) tf=libc.tmp; tdc="[]";;
7759 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7760 esac;
7761 case "$d_cplusplus" in
7762     $define)    extern_C="extern \"C\"" ;;
7763     *)          extern_C="extern"       ;;
7764 esac;
7765 tx=yes;
7766 case "$reuseval-$4" in
7767 true-) ;;
7768 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7769 esac;
7770 case "$tx" in
7771 yes)
7772         tval=false;
7773         if $test "$runnm" = true; then
7774                 if $contains $tlook $tf >/dev/null 2>&1; then
7775                         tval=true;
7776                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7777                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7778                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7779                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7780                         $rm_try;
7781                 fi;
7782         else
7783                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7784                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7785                 $rm_try;
7786         fi;
7787         ;;
7788 *)
7789         case "$tval" in
7790         $define) tval=true;;
7791         *) tval=false;;
7792         esac;
7793         ;;
7794 esac;
7795 eval "$2=$tval"'
7796
7797 : define an is-in-libc? function
7798 inlibc='echo " "; td=$define; tu=$undef;
7799 sym=$1; var=$2; eval "was=\$$2";
7800 tx=yes;
7801 case "$reuseval$was" in
7802 true) ;;
7803 true*) tx=no;;
7804 esac;
7805 case "$tx" in
7806 yes)
7807         set $sym tres -f;
7808         eval $csym;
7809         case "$tres" in
7810         true)
7811                 echo "$sym() found." >&4;
7812                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7813         *)
7814                 echo "$sym() NOT found." >&4;
7815                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7816         esac;;
7817 *)
7818         case "$was" in
7819         $define) echo "$sym() found." >&4;;
7820         *) echo "$sym() NOT found." >&4;;
7821         esac;;
7822 esac'
7823
7824 : see if dlopen exists
7825 xxx_runnm="$runnm"
7826 xxx_ccflags="$ccflags"
7827 runnm=false
7828 : with g++ one needs -shared to get is-in-libc to work for dlopen
7829 case "$gccversion" in
7830 '')     ;;
7831 *)      case "$d_cplusplus" in
7832         "$define") ccflags="$ccflags -shared" ;;
7833         esac
7834         ;;
7835 esac
7836 set dlopen d_dlopen
7837 eval $inlibc
7838 runnm="$xxx_runnm"
7839 ccflags="$xxx_ccflags"
7840
7841 : see if this is a unistd.h system
7842 set unistd.h i_unistd
7843 eval $inhdr
7844
7845 : determine which dynamic loading, if any, to compile in
7846 echo " "
7847 dldir="ext/DynaLoader"
7848 case "$usedl" in
7849 $define|y|true)
7850         dflt='y'
7851         usedl="$define"
7852         ;;
7853 $undef|n|false)
7854         dflt='n'
7855         usedl="$undef"
7856         ;;
7857 *)
7858         dflt='n'
7859         case "$d_dlopen" in
7860             $define) dflt='y' ;;
7861         esac
7862         case "$i_dld" in
7863             $define) dflt='y' ;;
7864         esac
7865         : Does a dl_xxx.xs file exist for this operating system
7866         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7867         ;;
7868 esac
7869 rp="Do you wish to use dynamic loading?"
7870 . ./myread
7871 usedl="$ans"
7872 bin_ELF="$undef"
7873 case "$ans" in
7874 y*) usedl="$define"
7875         case "$dlsrc" in
7876         '')
7877                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7878                         dflt="$dldir/dl_${osname}.xs"
7879                 elif $test "$d_dlopen" = "$define" ; then
7880                         dflt="$dldir/dl_dlopen.xs"
7881                 elif $test "$i_dld" = "$define" ; then
7882                         dflt="$dldir/dl_dld.xs"
7883                 else
7884                         dflt=''
7885                 fi
7886                 ;;
7887         *)      dflt="$dldir/$dlsrc"
7888                 ;;
7889         esac
7890     echo "The following dynamic loading files are available:"
7891         : Can not go over to $dldir because getfile has path hard-coded in.
7892         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7893         rp="Source file to use for dynamic loading"
7894         fn="fne"
7895         gfpth="$src"
7896         . ./getfile
7897         usedl="$define"
7898         : emulate basename
7899         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7900
7901         $cat << EOM
7902
7903 Some systems may require passing special flags to $cc -c to
7904 compile modules that will be used to create a shared library.
7905 To use no flags, say "none".
7906
7907 EOM
7908     case "$cccdlflags" in
7909     '') case "$gccversion" in
7910                 '') case "$osname" in
7911                         hpux)   dflt='+z' ;;
7912                         next)   dflt='none' ;;
7913                         irix*)  dflt='-KPIC' ;;
7914                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7915                         sunos)  dflt='-pic' ;;
7916                         *)      dflt='none' ;;
7917                     esac
7918                         ;;
7919                 *)  case "$osname" in
7920                         darwin) dflt='none' ;;
7921                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7922                         *)      dflt='-fpic' ;;
7923                     esac ;;
7924             esac ;;
7925         ' ') dflt='none' ;;
7926     *)  dflt="$cccdlflags" ;;
7927     esac
7928     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7929     . ./myread
7930     case "$ans" in
7931     none) cccdlflags=' ' ;;
7932     *) cccdlflags="$ans" ;;
7933     esac
7934
7935     cat << EOM
7936
7937 Some systems use ld to create libraries that can be dynamically loaded,
7938 while other systems (such as those using ELF) use $cc.
7939
7940 EOM
7941         case "$ld" in
7942         '')     $cat >try.c <<EOM
7943 /* Test for whether ELF binaries are produced */
7944 #include <fcntl.h>
7945 #$i_stdlib I_STDLIB
7946 #ifdef I_STDLIB
7947 #include <stdlib.h>
7948 #endif
7949 #$i_unistd I_UNISTD
7950 #ifdef I_UNISTD
7951 #include <unistd.h>
7952 #endif
7953 int main() {
7954         char b[4];
7955         int i = open("a.out",O_RDONLY);
7956         if(i == -1)
7957                 exit(1); /* fail */
7958         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7959                 exit(0); /* succeed (yes, it's ELF) */
7960         else
7961                 exit(1); /* fail */
7962 }
7963 EOM
7964                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7965                         cat <<EOM
7966 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7967 EOM
7968                         dflt="$cc"
7969                         bin_ELF="$define"
7970                 else
7971                         echo "I'll use ld to build dynamic libraries."
7972                         dflt='ld'
7973                 fi
7974                 $rm_try
7975                 ;;
7976         *)      dflt="$ld"
7977                 ;;
7978         esac
7979
7980     rp="What command should be used to create dynamic libraries?"
7981     . ./myread
7982         ld="$ans"
7983
7984     cat << EOM
7985
7986 Some systems may require passing special flags to $ld to create a
7987 library that can be dynamically loaded.  If your ld flags include
7988 -L/other/path options to locate libraries outside your loader's normal
7989 search path, you may need to specify those -L options here as well.  To
7990 use no flags, say "none".
7991
7992 EOM
7993     case "$lddlflags" in
7994     '') case "$osname" in
7995                         beos) dflt='-nostart' ;;
7996                         haiku) dflt='-shared' ;;
7997                         hpux) dflt='-b';
7998                               case "$gccversion" in
7999                               '') dflt="$dflt +vnocompatwarnings" ;;
8000                               esac
8001                               ;;
8002                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8003                         next)  dflt='none' ;;
8004                         solaris) dflt='-G' ;;
8005                         sunos) dflt='-assert nodefinitions' ;;
8006                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8007                 *)     dflt='none' ;;
8008                         esac
8009                         ;;
8010     *) dflt="$lddlflags" ;;
8011     esac
8012
8013         : Try to guess additional flags to pick up local libraries.
8014         : Be careful not to append to a plain 'none'
8015         case "$dflt" in
8016         none) dflt='' ;;
8017         esac
8018         for thisflag in $ldflags; do
8019                 case "$thisflag" in
8020                 -L*|-R*|-Wl,-R*)
8021                         case " $dflt " in
8022                         *" $thisflag "*) ;;
8023                         *) dflt="$dflt $thisflag" ;;
8024                         esac
8025                         ;;
8026                 esac
8027         done
8028
8029         case "$dflt" in
8030         ''|' ') dflt='none' ;;
8031         esac
8032
8033         case "$ldflags" in
8034         *-fstack-protector*)
8035             case "$dflt" in
8036                         *-fstack-protector*) ;; # Don't add it again
8037                         *) dflt="$dflt -fstack-protector" ;; 
8038                 esac
8039                 ;;
8040         esac
8041
8042
8043     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8044     . ./myread
8045     case "$ans" in
8046     none) lddlflags=' ' ;;
8047     *) lddlflags="$ans" ;;
8048     esac
8049
8050         cat <<EOM
8051
8052 Some systems may require passing special flags to $cc to indicate that
8053 the resulting executable will use dynamic linking.  To use no flags,
8054 say "none".
8055
8056 EOM
8057     case "$ccdlflags" in
8058     '') case "$osname" in
8059             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8060             next|sunos) dflt='none' ;;
8061             *)          dflt='none' ;;
8062             esac ;;
8063     ' ')  dflt='none' ;;
8064     *)  dflt="$ccdlflags" ;;
8065     esac
8066     rp="Any special flags to pass to $cc to use dynamic linking?"
8067     . ./myread
8068     case "$ans" in
8069     none) ccdlflags=' ' ;;
8070     *) ccdlflags="$ans" ;;
8071     esac
8072     ;;
8073 *)  usedl="$undef"
8074         ld='ld'
8075     dlsrc='dl_none.xs'
8076     lddlflags=''
8077     ccdlflags=''
8078     ;;
8079 esac
8080
8081 : Do we want a shared libperl?
8082 also=''
8083 case "$usedl" in
8084 $undef)
8085         # No dynamic loading being used, so don't bother even to prompt.
8086         useshrplib='false'
8087         ;;
8088 *)      case "$useshrplib" in
8089         '')     case "$osname" in
8090                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8091                         dflt=y
8092                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8093                         ;;
8094                 next*)
8095                         case "$osvers" in
8096                         4*)     dflt=y
8097                                 also='Building a shared libperl is needed for MAB support.'
8098                                 ;;
8099                         *)      dflt=n
8100                                 ;;
8101                         esac
8102                         ;;
8103                 *)      dflt=n
8104                         ;;
8105                 esac
8106                 ;;
8107         $define|true|[Yy]*)
8108                 dflt=y
8109                 ;;
8110         *)      dflt=n
8111                 ;;
8112         esac
8113         $cat << EOM
8114
8115 The perl executable is normally obtained by linking perlmain.c with
8116 libperl${_a}, any static extensions (usually just DynaLoader), and
8117 any other libraries needed on this system (such as -lm, etc.).  Since
8118 your system supports dynamic loading, it is probably possible to build
8119 a shared libperl.$so.  If you will have more than one executable linked
8120 to libperl.$so, this will significantly reduce the size of each
8121 executable, but it may have a noticeable effect on performance.  The
8122 default is probably sensible for your system.
8123 $also
8124
8125 EOM
8126         rp="Build a shared libperl.$so (y/n)"
8127         . ./myread
8128         case "$ans" in
8129         true|$define|[Yy]*)
8130                 useshrplib='true'  ;;
8131         *)      useshrplib='false' ;;
8132         esac
8133         ;;
8134 esac
8135
8136 case "$useshrplib" in
8137 true)
8138         case "$userelocatableinc" in
8139         true|define)
8140                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8141                 echo "See INSTALL for an explanation why that won't work." >&4
8142                 exit 4
8143                 ;;
8144         esac
8145         case "$libperl" in
8146         '')
8147                 # Figure out a good name for libperl.so.  Since it gets stored in
8148                 # a version-specific architecture-dependent library, the version
8149                 # number isn't really that important, except for making cc/ld happy.
8150                 #
8151                 # A name such as libperl.so.10.1
8152                 majmin="libperl.$so.$patchlevel.$subversion"
8153                 # A name such as libperl.so.100
8154                 majonly=`echo $patchlevel $subversion |
8155                         $awk '{printf "%d%02d", $1, $2}'`
8156                 majonly=libperl.$so.$majonly
8157                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8158                 # rely on figuring it out from the naming of libc.
8159                 case "${osname}${osvers}" in
8160                 next4*)
8161                         dflt=libperl.5.$so
8162                         # XXX How handle the --version stuff for MAB?
8163                         ;;
8164                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8165                         dflt=libperl.$so
8166                         ;;
8167                 cygwin*) # ld links now against the dll directly
8168                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8169                         majonly=`echo $patchlevel $subversion |
8170                                 $awk '{printf "%03d%03d", $1, $2}'`
8171                         majonly=cygperl5.$majonly.$so
8172                         dflt=$majmin
8173                         ;;
8174                 *)      # Try to guess based on whether libc has major.minor.
8175                         case "$libc" in
8176                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8177                         *libc.$so.[0-9]*) dflt=$majonly ;;
8178                         *)      dflt=libperl.$so ;;
8179                         esac
8180                         ;;
8181                 esac
8182                 ;;
8183         *)      dflt=$libperl
8184                 ;;
8185         esac
8186         cat << EOM
8187
8188 I need to select a good name for the shared libperl.  If your system uses
8189 library names with major and minor numbers, then you might want something
8190 like $majmin.  Alternatively, if your system uses a single version
8191 number for shared libraries, then you might want to use $majonly.
8192 Or, your system might be quite happy with a simple libperl.$so.
8193
8194 Since the shared libperl will get installed into a version-specific
8195 architecture-dependent directory, the version number of the shared perl
8196 library probably isn't important, so the default should be o.k.
8197
8198 EOM
8199         rp='What name do you want to give to the shared libperl?'
8200         . ./myread
8201         libperl=$ans
8202         echo "Ok, I'll use $libperl"
8203         ;;
8204 *)
8205         libperl="libperl${_a}"
8206         ;;
8207 esac
8208
8209 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8210 case "$shrpdir" in
8211 '') ;;
8212 *)      $cat >&4 <<EOM
8213 WARNING:  Use of the shrpdir variable for the installation location of
8214 the shared $libperl is not supported.  It was never documented and
8215 will not work in this version.  Let me (perlbug@perl.org)
8216 know of any problems this may cause.
8217
8218 EOM
8219         case "$shrpdir" in
8220         "$archlibexp/CORE")
8221                 $cat >&4 <<EOM
8222 But your current setting of $shrpdir is
8223 the default anyway, so it's harmless.
8224 EOM
8225                 ;;
8226         *)
8227                 $cat >&4 <<EOM
8228 Further, your current attempted setting of $shrpdir
8229 conflicts with the value of $archlibexp/CORE
8230 that installperl will use.
8231 EOM
8232                 ;;
8233         esac
8234         ;;
8235 esac
8236
8237 # How will the perl executable find the installed shared $libperl?
8238 # Add $xxx to ccdlflags.
8239 # If we can't figure out a command-line option, use $shrpenv to
8240 # set env LD_RUN_PATH.  The main perl makefile uses this.
8241 shrpdir=$archlibexp/CORE
8242 xxx=''
8243 tmp_shrpenv=''
8244 if "$useshrplib"; then
8245     case "$osname" in
8246         aix)
8247                 # We'll set it in Makefile.SH...
8248                 ;;
8249         solaris)
8250                 xxx="-R $shrpdir"
8251                 ;;
8252         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly)
8253                 xxx="-Wl,-R$shrpdir"
8254                 ;;
8255         bsdos|linux|irix*|dec_osf|gnu*)
8256                 xxx="-Wl,-rpath,$shrpdir"
8257                 ;;
8258         next)
8259                 # next doesn't like the default...
8260                 ;;
8261         beos)
8262                 # beos doesn't like the default, either.
8263                 ;;
8264         haiku)
8265                 # Haiku doesn't like the default, either.
8266                 ;;
8267         hpux*)
8268                 # hpux doesn't like the default, either.
8269                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8270                 ;;
8271         cygwin)
8272                 # cygwin needs only ldlibpth
8273                 ;;
8274         *)
8275                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8276                 ;;
8277         esac
8278         case "$xxx" in
8279         '') ;;
8280         *)
8281                 # Only add $xxx if it isn't already in ccdlflags.
8282                 case " $ccdlflags " in
8283                 *" $xxx "*)     ;;
8284                 *)      ccdlflags="$ccdlflags $xxx"
8285                         cat <<EOM >&4
8286
8287 Adding $xxx to the flags
8288 passed to $ld so that the perl executable will find the
8289 installed shared $libperl.
8290
8291 EOM
8292                         ;;
8293                 esac
8294                 ;;
8295         esac
8296 fi
8297 # Fix ccdlflags in AIX for building external extensions.
8298 # (For building Perl itself bare -bE:perl.exp is needed,
8299 #  Makefile.SH takes care of this.)
8300 case "$osname" in
8301 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8302 esac
8303 # Respect a hint or command-line value.
8304 case "$shrpenv" in
8305 '') shrpenv="$tmp_shrpenv" ;;
8306 esac
8307 case "$ldlibpthname" in
8308 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8309 none)   ldlibpthname='' ;;
8310 esac
8311
8312 : determine where manual pages are on this system
8313 echo " "
8314 case "$sysman" in
8315 '') 
8316         syspath='/usr/share/man/man1 /usr/man/man1'
8317         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8318         syspath="$syspath /usr/man/u_man/man1"
8319         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8320         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8321         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8322         sysman=`./loc . /usr/man/man1 $syspath`
8323         ;;
8324 esac
8325 if $test -d "$sysman"; then
8326         echo "System manual is in $sysman." >&4
8327 else
8328         echo "Could not find manual pages in source form." >&4
8329 fi
8330
8331 : determine where manual pages go
8332 set man1dir man1dir none
8333 eval $prefixit
8334 $cat <<EOM
8335
8336 $spackage has manual pages available in source form.
8337 EOM
8338 case "$nroff" in
8339 nroff)
8340         echo "However, you don't have nroff, so they're probably useless to you."
8341         case "$man1dir" in
8342         '') man1dir="none";;
8343         esac;;
8344 esac
8345 echo "If you don't want the manual sources installed, answer 'none'."
8346 case "$man1dir" in
8347 ' ') dflt=none
8348         ;;
8349 '')
8350         lookpath="$prefixexp/share/man/man1"
8351         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8352         lookpath="$lookpath $prefixexp/man/p_man/man1"
8353         lookpath="$lookpath $prefixexp/man/u_man/man1"
8354         lookpath="$lookpath $prefixexp/man/man.1"
8355         case "$sysman" in
8356         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8357         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8358         esac
8359         set dflt
8360         eval $prefixup
8361         ;;
8362 *)  dflt="$man1dir"
8363         ;;
8364 esac
8365 echo " "
8366 fn=dn+~
8367 rp="Where do the main $spackage manual pages (source) go?"
8368 . ./getfile
8369 if $test "X$man1direxp" != "X$ansexp"; then
8370         installman1dir=''
8371 fi
8372 prefixvar=man1dir
8373 . ./setprefixvar
8374
8375 case "$man1dir" in
8376 '')     man1dir=' '
8377         installman1dir='';;
8378 esac
8379
8380 : What suffix to use on installed man pages
8381
8382 case "$man1dir" in
8383 ' ')
8384         man1ext='0'
8385         ;;
8386 *)
8387         rp="What suffix should be used for the main $spackage man pages?"
8388         case "$man1ext" in
8389         '')     case "$man1dir" in
8390                 *1)  dflt=1 ;;
8391                 *1p) dflt=1p ;;
8392                 *1pm) dflt=1pm ;;
8393                 *l) dflt=l;;
8394                 *n) dflt=n;;
8395                 *o) dflt=o;;
8396                 *p) dflt=p;;
8397                 *C) dflt=C;;
8398                 *L) dflt=L;;
8399                 *L1) dflt=L1;;
8400                 *) dflt=1;;
8401                 esac
8402                 ;;
8403         *)      dflt="$man1ext";;
8404         esac
8405         . ./myread
8406         man1ext="$ans"
8407         ;;
8408 esac
8409
8410 : see if we can have long filenames
8411 echo " "
8412 first=123456789abcdef
8413 $rm -f $first
8414 if (echo hi >$first) 2>/dev/null; then
8415         if $test -f 123456789abcde; then
8416                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8417                 val="$undef"
8418         else
8419                 echo 'You can have filenames longer than 14 characters.'>&4
8420                 val="$define"
8421         fi
8422 else
8423         $cat <<'EOM'
8424 You can't have filenames longer than 14 chars.
8425 You can't even think about them!
8426 EOM
8427         val="$undef"
8428 fi
8429 set d_flexfnam
8430 eval $setvar
8431 $rm -rf 123456789abcde*
8432
8433 : determine where library module manual pages go
8434 set man3dir man3dir none
8435 eval $prefixit
8436 $cat <<EOM
8437
8438 $spackage has manual pages for many of the library modules.
8439 EOM
8440
8441 case "$nroff" in
8442 nroff)
8443         $cat <<'EOM'
8444 However, you don't have nroff, so they're probably useless to you.
8445 EOM
8446         case "$man3dir" in
8447         '') man3dir="none";;
8448         esac;;
8449 esac
8450
8451 case "$d_flexfnam" in
8452 undef)
8453         $cat <<'EOM'
8454 However, your system can't handle the long file names like File::Basename.3.
8455 EOM
8456         case "$man3dir" in
8457         '') man3dir="none";;
8458         esac;;
8459 esac
8460
8461 echo "If you don't want the manual sources installed, answer 'none'."
8462 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8463 case "$man3dir" in
8464 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8465         if $test -d "$privlib/man/man3"; then
8466                 cat <<EOM >&4
8467
8468 WARNING:  Previous versions of perl installed man3 pages into
8469 $privlib/man/man3.  This version will suggest a
8470 new default of $dflt.
8471 EOM
8472                 tdflt=$dflt
8473                 dflt='n'
8474                 rp='Do you wish to preserve the old behavior?(y/n)'
8475                 . ./myread
8476                 case "$ans" in
8477                 y*) dflt="$privlib/man/man3" ;;
8478                 *)  dflt=$tdflt ;;
8479                 esac
8480     fi
8481         ;;
8482 *)      dflt="$man3dir" ;;
8483 esac
8484 case "$dflt" in
8485 ' ') dflt=none ;;
8486 esac
8487 echo " "
8488 fn=dn+~
8489 rp="Where do the $package library man pages (source) go?"
8490 . ./getfile
8491 prefixvar=man3dir
8492 . ./setprefixvar
8493
8494 case "$man3dir" in
8495 '')     man3dir=' '
8496         installman3dir='';;
8497 esac
8498
8499 : What suffix to use on installed man pages
8500 case "$man3dir" in
8501 ' ')
8502         man3ext='0'
8503         ;;
8504 *)
8505         rp="What suffix should be used for the $package library man pages?"
8506         case "$man3ext" in
8507         '')     case "$man3dir" in
8508                 *3)  dflt=3 ;;
8509                 *3p) dflt=3p ;;
8510                 *3pm) dflt=3pm ;;
8511                 *l) dflt=l;;
8512                 *n) dflt=n;;
8513                 *o) dflt=o;;
8514                 *p) dflt=p;;
8515                 *C) dflt=C;;
8516                 *L) dflt=L;;
8517                 *L3) dflt=L3;;
8518                 *) dflt=3;;
8519                 esac
8520                 ;;
8521         *)      dflt="$man3ext";;
8522         esac
8523         . ./myread
8524         man3ext="$ans"
8525         ;;
8526 esac
8527
8528 : see if we have to deal with yellow pages, now NIS.
8529 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8530         if $test -f /usr/etc/nibindd; then
8531                 echo " "
8532                 echo "I'm fairly confident you're on a NeXT."
8533                 echo " "
8534                 rp='Do you get the hosts file via NetInfo?'
8535                 dflt=y
8536                 case "$hostcat" in
8537                 nidump*) ;;
8538                 '') ;;
8539                 *) dflt=n;;
8540                 esac
8541                 . ./myread
8542                 case "$ans" in
8543                 y*) hostcat='nidump hosts .';;
8544                 *)      case "$hostcat" in
8545                         nidump*) hostcat='';;
8546                         esac
8547                         ;;
8548                 esac
8549         fi
8550         case "$hostcat" in
8551         nidump*) ;;
8552         *)
8553                 case "$hostcat" in
8554                 *ypcat*) dflt=y;;
8555                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8556                                 dflt=y
8557                         else
8558                                 dflt=n
8559                         fi;;
8560                 *) dflt=n;;
8561                 esac
8562                 echo " "
8563                 rp='Are you getting the hosts file via yellow pages?'
8564                 . ./myread
8565                 case "$ans" in
8566                 y*) hostcat='ypcat hosts';;
8567                 *) hostcat='cat /etc/hosts';;
8568                 esac
8569                 ;;
8570         esac
8571 fi
8572 case "$hostcat" in
8573 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8574 esac
8575 case "$groupcat" in
8576 '') test -f /etc/group && groupcat='cat /etc/group';;
8577 esac
8578 case "$passcat" in
8579 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8580 esac
8581
8582 : now get the host name
8583 echo " "
8584 echo "Figuring out host name..." >&4
8585 case "$myhostname" in
8586 '') cont=true
8587         echo 'Maybe "hostname" will work...'
8588         if tans=`sh -c hostname 2>&1` ; then
8589                 myhostname=$tans
8590                 phostname=hostname
8591                 cont=''
8592         fi
8593         ;;
8594 *) cont='';;
8595 esac
8596 if $test "$cont"; then
8597         if ./xenix; then
8598                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8599                 if tans=`cat /etc/systemid 2>&1` ; then
8600                         myhostname=$tans
8601                         phostname='cat /etc/systemid'
8602                         echo "Whadyaknow.  Xenix always was a bit strange..."
8603                         cont=''
8604                 fi
8605         elif $test -r /etc/systemid; then
8606                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8607         fi
8608 fi
8609 if $test "$cont"; then
8610         echo 'No, maybe "uuname -l" will work...'
8611         if tans=`sh -c 'uuname -l' 2>&1` ; then
8612                 myhostname=$tans
8613                 phostname='uuname -l'
8614         else
8615                 echo 'Strange.  Maybe "uname -n" will work...'
8616                 if tans=`sh -c 'uname -n' 2>&1` ; then
8617                         myhostname=$tans
8618                         phostname='uname -n'
8619                 else
8620                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8621                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8622                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8623                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8624                         else
8625                                 case "$myhostname" in
8626                                 '') echo "Does this machine have an identity crisis or something?"
8627                                         phostname='';;
8628                                 *)
8629                                         echo "Well, you said $myhostname before..."
8630                                         phostname='echo $myhostname';;
8631                                 esac
8632                         fi
8633                 fi
8634         fi
8635 fi
8636 case "$myhostname" in
8637 '') myhostname=noname ;;
8638 esac
8639 : you do not want to know about this
8640 set $myhostname
8641 myhostname=$1
8642
8643 : verify guess
8644 if $test "$myhostname" ; then
8645         dflt=y
8646         rp='Your host name appears to be "'$myhostname'".'" Right?"
8647         . ./myread
8648         case "$ans" in
8649         y*) ;;
8650         *) myhostname='';;
8651         esac
8652 fi
8653
8654 : bad guess or no guess
8655 while $test "X$myhostname" = X ; do
8656         dflt=''
8657         rp="Please type the (one word) name of your host:"
8658         . ./myread
8659         myhostname="$ans"
8660 done
8661
8662 : translate upper to lower if necessary
8663 case "$myhostname" in
8664 *[A-Z]*)
8665         echo "(Normalizing case in your host name)"
8666         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8667         ;;
8668 esac
8669
8670 case "$myhostname" in
8671 *.*)
8672         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8673         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8674         echo "(Trimming domain name from host name--host name is now $myhostname)"
8675         ;;
8676 *) case "$mydomain" in
8677         '')
8678                 {
8679                         test "X$hostcat" = "Xypcat hosts" &&
8680                         ypmatch "$myhostname" hosts 2>/dev/null |\
8681                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8682                         $test -s hosts
8683                 } || {
8684                         test "X$hostcat" != "X" &&
8685                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8686                                         /[       ]$myhostname[  . ]/p" > hosts
8687                 }
8688                 tmp_re="[       . ]"
8689                 if $test -f hosts; then
8690                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8691                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8692                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8693                                 hosts | $sort | $uniq | \
8694                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8695                         case `$echo X$dflt` in
8696                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8697                                 dflt=.
8698                                 ;;
8699                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8700                                 ;;
8701                         esac
8702                 else
8703                         echo "(I cannot locate a hosts database anywhere)"
8704                         dflt=.
8705                 fi
8706                 case "$dflt" in
8707                 .)
8708                         tans=`./loc resolv.conf X /etc /usr/etc`
8709                         if $test -f "$tans"; then
8710                                 echo "(Attempting domain name extraction from $tans)"
8711                                 dflt=.`$sed -n -e 's/   / /g' \
8712                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8713                                   -e 1q 2>/dev/null`
8714                                 case "$dflt" in
8715                                 .) dflt=.`$sed -n -e 's/        / /g' \
8716                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8717                                      -e 1q 2>/dev/null`
8718                                         ;;
8719                                 esac
8720                         fi
8721                         ;;
8722                 esac
8723                 case "$dflt" in
8724                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8725                         dflt=.`sh -c domainname 2>/dev/null`
8726                         case "$dflt" in
8727                         '') dflt='.';;
8728                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8729                         esac
8730                         ;;
8731                 esac
8732                 case "$dflt$osname" in
8733                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8734                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8735                         ;;
8736                 esac
8737                 case "$dflt" in
8738                 .) echo "(Lost all hope -- silly guess then)"
8739                         dflt='.nonet'
8740                         ;;
8741                 esac
8742                 $rm -f hosts
8743                 ;;
8744         *) dflt="$mydomain";;
8745         esac;;
8746 esac
8747 echo " "
8748 rp="What is your domain name?"
8749 . ./myread
8750 tans="$ans"
8751 case "$ans" in
8752 '') ;;
8753 .*) ;;
8754 *) tans=".$tans";;
8755 esac
8756 mydomain="$tans"
8757
8758 : translate upper to lower if necessary
8759 case "$mydomain" in
8760 *[A-Z]*)
8761         echo "(Normalizing case in your domain name)"
8762         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8763         ;;
8764 esac
8765
8766 : a little sanity check here
8767 case "$phostname" in
8768 '') ;;
8769 *)
8770         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8771         $myhostname$mydomain|$myhostname) ;;
8772         *)
8773                 case "$phostname" in
8774                 sed*)
8775                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8776                         ;;
8777                 *)
8778                         echo "(That doesn't agree with your $phostname command, by the way.)"
8779                         ;;
8780                 esac
8781         ;;
8782         esac
8783         ;;
8784 esac
8785
8786 : determine the e-mail address of the user who is running us
8787 $cat <<EOM
8788
8789 I need to get your e-mail address in Internet format if possible, i.e.
8790 something like user@host.domain. Please answer accurately since I have
8791 no easy means to double check it. The default value provided below
8792 is most probably close to reality but may not be valid from outside
8793 your organization...
8794
8795 EOM
8796 cont=x
8797 while test "$cont"; do
8798         case "$cf_email" in
8799         '') dflt="$cf_by@$myhostname$mydomain";;
8800         *) dflt="$cf_email";;
8801         esac
8802         rp='What is your e-mail address?'
8803         . ./myread
8804         cf_email="$ans"
8805         case "$cf_email" in
8806         *@*.*) cont='' ;;
8807         *)
8808                 rp='Address does not look like an Internet one.  Use it anyway?'
8809                 case "$fastread" in
8810                 yes) dflt=y ;;
8811                 *) dflt=n ;;
8812                 esac
8813                 . ./myread
8814                 case "$ans" in
8815                 y*) cont='' ;;
8816                 *) echo " " ;;
8817                 esac
8818                 ;;
8819         esac
8820 done
8821
8822 : Ask e-mail of administrator
8823 $cat <<EOM
8824
8825 If you or somebody else will be maintaining perl at your site, please
8826 fill in the correct e-mail address here so that they may be contacted
8827 if necessary. Currently, the "perlbug" program included with perl
8828 will send mail to this address in addition to perlbug@perl.org. You may
8829 enter "none" for no administrator.
8830
8831 EOM
8832 case "$perladmin" in
8833 '') dflt="$cf_email";;
8834 *) dflt="$perladmin";;
8835 esac
8836 rp='Perl administrator e-mail address'
8837 . ./myread
8838 perladmin="$ans"
8839
8840 : determine whether to only install version-specific parts.
8841 echo " "
8842 $cat <<EOM
8843 Do you want to install only the version-specific parts of the perl
8844 distribution?  Usually you do *not* want to do this.
8845 EOM
8846 case "$versiononly" in
8847 "$define"|[Yy]*|true) dflt='y' ;;
8848 *) dflt='n';
8849 esac
8850 rp="Do you want to install only the version-specific parts of perl?"
8851 . ./myread
8852 case "$ans" in
8853 [yY]*)  val="$define";;
8854 *)      val="$undef" ;;
8855 esac
8856 set versiononly
8857 eval $setvar
8858
8859 case "$versiononly" in
8860 "$define") inc_version_list=''
8861            inc_version_list_init=0
8862            ;;
8863 esac
8864
8865 : figure out how to guarantee perl startup
8866 : XXX Note that this currently takes advantage of the bug that binexp ignores
8867 :     the Configure -Dinstallprefix setting, which in turn means that under
8868 :     relocatable @INC, initialinstalllocation is what binexp started as.
8869 case "$startperl" in
8870 '')
8871         case "$sharpbang" in
8872         *!)
8873                 $cat <<EOH
8874
8875 I can use the #! construct to start perl on your system. This will
8876 make startup of perl scripts faster, but may cause problems if you
8877 want to share those scripts and perl is not in a standard place
8878 ($initialinstalllocation/perl) on all your platforms. The alternative
8879 is to force a shell by starting the script with a single ':' character.
8880
8881 EOH
8882                 case "$versiononly" in
8883                 "$define")      dflt="$initialinstalllocation/perl$version";;
8884                 *)              dflt="$initialinstalllocation/perl";;
8885                 esac
8886                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8887                 . ./myread
8888                 case "$ans" in
8889                 none)   startperl=": # use perl";;
8890                 *)      startperl="#!$ans"
8891                         if $test 30 -lt `echo "$ans" | wc -c`; then
8892                                 $cat >&4 <<EOM
8893
8894 WARNING:  Some systems limit the #! command to 32 characters.
8895 If you experience difficulty running Perl scripts with #!, try
8896 installing Perl in a directory with a shorter pathname.
8897
8898 EOM
8899                         fi ;;
8900                 esac
8901                 ;;
8902         *) startperl=": # use perl"
8903                 ;;
8904         esac
8905         ;;
8906 esac
8907 echo "I'll use $startperl to start perl scripts."
8908
8909 : figure best path for perl in scripts
8910 case "$perlpath" in
8911 '')
8912         case "$versiononly" in
8913         "$define")      perlpath="$initialinstalllocation/perl$version";;
8914         *)              perlpath="$initialinstalllocation/perl";;
8915         esac
8916         case "$startperl" in
8917         *!*) ;;
8918         *)
8919                 $cat <<EOH
8920
8921 I will use the "eval 'exec'" idiom to start Perl on your system.
8922 I can use the full path of your Perl binary for this purpose, but
8923 doing so may cause problems if you want to share those scripts and
8924 Perl is not always in a standard place ($initialinstalllocation/perl).
8925
8926 EOH
8927                 dflt="$initialinstalllocation/perl"
8928                 rp="What path shall I use in \"eval 'exec'\"?"
8929                 . ./myread
8930                 perlpath="$ans"
8931                 ;;
8932         esac
8933         ;;
8934 esac
8935 case "$startperl" in
8936 *!*)    ;;
8937 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8938 esac
8939
8940 : determine where public executable scripts go
8941 set scriptdir scriptdir
8942 eval $prefixit
8943 case "$scriptdir" in
8944 '')
8945         dflt="$bin"
8946         : guess some guesses
8947         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8948         $test -d /usr/share/bin     && dflt=/usr/share/bin
8949         $test -d /usr/local/script  && dflt=/usr/local/script
8950         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8951         $test -d $prefixexp/script  && dflt=$prefixexp/script
8952         set dflt
8953         eval $prefixup
8954         ;;
8955 *)  dflt="$scriptdir"
8956         ;;
8957 esac
8958 $cat <<EOM
8959
8960 Some installations have a separate directory just for executable scripts so
8961 that they can mount it across multiple architectures but keep the scripts in
8962 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8963 Or you might just lump your scripts in with all your other executables.
8964
8965 EOM
8966 fn=d~
8967 rp='Where do you keep publicly executable scripts?'
8968 . ./getfile
8969 if $test "X$ansexp" != "X$scriptdirexp"; then
8970         installscript=''
8971 fi
8972 installscriptdir=''
8973 prefixvar=scriptdir
8974 . ./setprefixvar
8975 : A little fix up for an irregularly named variable.
8976 installscript="$installscriptdir"
8977
8978 : determine where add-on public executables go
8979 case "$sitebin" in
8980 '')     dflt=$siteprefix/bin ;;
8981 *)      dflt=$sitebin ;;
8982 esac
8983 fn=d~
8984 rp='Pathname where the add-on public executables should be installed?'
8985 . ./getfile
8986 prefixvar=sitebin
8987 . ./setprefixvar
8988
8989 : determine where add-on html pages go
8990 : There is no standard location, so try to copy the previously-selected
8991 : directory structure for the core html pages.
8992 case "$sitehtml1dir" in
8993 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8994 *)     dflt=$sitehtml1dir ;;
8995 esac
8996 case "$dflt" in
8997 ''|' ') dflt=none ;;
8998 esac
8999 fn=dn+~
9000 rp='Pathname where the site-specific html pages should be installed?'
9001 . ./getfile
9002 prefixvar=sitehtml1dir
9003 . ./setprefixvar
9004
9005 : determine where add-on library html pages go
9006 : There is no standard location, so try to copy the previously-selected
9007 : directory structure for the core html pages.
9008 case "$sitehtml3dir" in
9009 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9010 *)     dflt=$sitehtml3dir ;;
9011 esac
9012 case "$dflt" in
9013 ''|' ') dflt=none ;;
9014 esac
9015 fn=dn+~
9016 rp='Pathname where the site-specific library html pages should be installed?'
9017 . ./getfile
9018 prefixvar=sitehtml3dir
9019 . ./setprefixvar
9020
9021 : determine where add-on manual pages go
9022 case "$siteman1dir" in
9023 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9024 *)      dflt=$siteman1dir ;;
9025 esac
9026 case "$dflt" in
9027 ''|' ') dflt=none ;;
9028 esac
9029 fn=dn+~
9030 rp='Pathname where the site-specific manual pages should be installed?'
9031 . ./getfile
9032 prefixvar=siteman1dir
9033 . ./setprefixvar
9034
9035 : determine where add-on library man pages go
9036 case "$siteman3dir" in
9037 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9038 *)      dflt=$siteman3dir ;;
9039 esac
9040 case "$dflt" in
9041 ''|' ') dflt=none ;;
9042 esac
9043 fn=dn+~
9044 rp='Pathname where the site-specific library manual pages should be installed?'
9045 . ./getfile
9046 prefixvar=siteman3dir
9047 . ./setprefixvar
9048
9049 : determine where add-on public executable scripts go
9050 case "$sitescript" in
9051 '')     dflt=$siteprefix/script
9052         $test -d $dflt || dflt=$sitebin ;;
9053 *)  dflt="$sitescript" ;;
9054 esac
9055 fn=d~+
9056 rp='Pathname where add-on public executable scripts should be installed?'
9057 . ./getfile
9058 prefixvar=sitescript
9059 . ./setprefixvar
9060
9061 : Check if faststdio is requested and available
9062 case "$usefaststdio" in
9063 $define|true|[yY]*|'')
9064         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9065         case "$xversion" in
9066         [68])   dflt='y' ;;
9067         *)      dflt='n' ;;
9068         esac
9069         ;;
9070 *) dflt='n';;
9071 esac
9072 cat <<EOM
9073
9074 Perl can be built to use 'fast stdio', which means using the stdio
9075 library but also directly manipulating the stdio buffers to enable
9076 faster I/O.  Using stdio is better for backward compatibility (especially
9077 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9078 interface has been preferred instead of stdio.
9079
9080 If this doesn't make any sense to you, just accept the default '$dflt'.
9081 EOM
9082 rp='Use the "fast stdio" if available?'
9083 . ./myread
9084 case "$ans" in
9085 y|Y)    val="$define" ;;
9086 *)      val="$undef" ;;
9087 esac
9088 set usefaststdio
9089 eval $setvar
9090
9091
9092 : define an is-a-typedef? function
9093 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9094 case "$inclist" in
9095 "") inclist="sys/types.h";;
9096 esac;
9097 eval "varval=\$$var";
9098 case "$varval" in
9099 "")
9100         $rm -f temp.c;
9101         for inc in $inclist; do
9102                 echo "#include <$inc>" >>temp.c;
9103         done;
9104         echo "#ifdef $type" >> temp.c;
9105         echo "printf(\"We have $type\");" >> temp.c;
9106         echo "#endif" >> temp.c;
9107         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9108         if $contains $type temp.E >/dev/null 2>&1; then
9109                 eval "$var=\$type";
9110         else
9111                 eval "$var=\$def";
9112         fi;
9113         $rm -f temp.?;;
9114 *) eval "$var=\$varval";;
9115 esac'
9116
9117 : define an is-a-typedef? function that prompts if the type is not available.
9118 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9119 case "$inclist" in
9120 "") inclist="sys/types.h";;
9121 esac;
9122 eval "varval=\$$var";
9123 case "$varval" in
9124 "")
9125         $rm -f temp.c;
9126         for inc in $inclist; do
9127                 echo "#include <$inc>" >>temp.c;
9128         done;
9129         echo "#ifdef $type" >> temp.c;
9130         echo "printf(\"We have $type\");" >> temp.c;
9131         echo "#endif" >> temp.c;
9132         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9133         echo " " ;
9134         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9135         if $contains $type temp.E >/dev/null 2>&1; then
9136                 echo "$type found." >&4;
9137                 eval "$var=\$type";
9138         else
9139                 echo "$type NOT found." >&4;
9140                 dflt="$def";
9141                 . ./myread ;
9142                 eval "$var=\$ans";
9143         fi;
9144         $rm -f temp.?;;
9145 *) eval "$var=\$varval";;
9146 esac'
9147
9148 : see what type lseek is declared as in the kernel
9149 rp="What is the type used for lseek's offset on this system?"
9150 set off_t lseektype long stdio.h sys/types.h
9151 eval $typedef_ask
9152
9153 echo " "
9154 echo "Checking to see how big your file offsets are..." >&4
9155 $cat >try.c <<EOCP
9156 #include <sys/types.h>
9157 #include <stdio.h>
9158 int main()
9159 {
9160     printf("%d\n", (int)sizeof($lseektype));
9161     return(0);
9162 }
9163 EOCP
9164 set try
9165 if eval $compile_ok; then
9166         lseeksize=`$run ./try`
9167         echo "Your file offsets are $lseeksize bytes long."
9168 else
9169         dflt=$longsize
9170         echo " "
9171         echo "(I can't seem to compile the test program.  Guessing...)"
9172         rp="What is the size of your file offsets (in bytes)?"
9173         . ./myread
9174         lseeksize="$ans"
9175 fi
9176 $rm_try
9177
9178 : see what type file positions are declared as in the library
9179 rp="What is the type for file position used by fsetpos()?"
9180 set fpos_t fpostype long stdio.h sys/types.h
9181 eval $typedef_ask
9182
9183 : Check size for Fpos_t
9184 echo " "
9185 case "$fpostype" in
9186 *_t) zzz="$fpostype"    ;;
9187 *)   zzz="fpos_t"       ;;
9188 esac
9189 echo "Checking the size of $zzz..." >&4
9190 cat > try.c <<EOCP
9191 #include <sys/types.h>
9192 #include <stdio.h>
9193 #$i_stdlib I_STDLIB
9194 #ifdef I_STDLIB
9195 #include <stdlib.h>
9196 #endif
9197 int main() {
9198     printf("%d\n", (int)sizeof($fpostype));
9199     exit(0);
9200 }
9201 EOCP
9202 set try
9203 if eval $compile_ok; then
9204         yyy=`$run ./try`
9205         case "$yyy" in
9206         '')     fpossize=4
9207                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9208                 ;;
9209         *)      fpossize=$yyy
9210                 echo "Your $zzz is $fpossize bytes long."
9211                 ;;
9212         esac
9213 else
9214         dflt="$longsize"
9215         echo " " >&4
9216         echo "(I can't compile the test program.  Guessing...)" >&4
9217         rp="What is the size of your file positions (in bytes)?"
9218         . ./myread
9219         fpossize="$ans"
9220 fi
9221
9222 : Check for large file support
9223 # Backward compatibility (uselfs is deprecated).
9224 case "$uselfs" in
9225 "$define"|true|[yY]*)
9226         cat <<EOM >&4
9227
9228 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9229 EOM
9230         uselargefiles="$define"
9231         ;;
9232 esac
9233
9234 case "$lseeksize:$fpossize" in
9235 8:8) cat <<EOM
9236
9237 You can have files larger than 2 gigabytes.
9238 EOM
9239    val="$define" ;;
9240 *)    case "$uselargefiles" in
9241    "$undef"|false|[nN]*) dflt='n' ;;
9242    *)   dflt='y' ;;
9243    esac
9244    cat <<EOM
9245
9246 Perl can be built to understand large files (files larger than 2 gigabytes)
9247 on some systems.  To do so, Configure can be run with -Duselargefiles.
9248
9249 If this doesn't make any sense to you, just accept the default '$dflt'.
9250 EOM
9251    rp='Try to understand large files, if available?'
9252    . ./myread
9253    case "$ans" in
9254    y|Y)         val="$define" ;;
9255    *)           val="$undef"  ;;
9256    esac
9257    ;;
9258 esac
9259 set uselargefiles
9260 eval $setvar
9261 : Look for a hint-file generated 'call-back-unit'.  If the
9262 : user has specified that a large files perl is to be built,
9263 : we may need to set or change some other defaults.
9264 if $test -f uselargefiles.cbu; then
9265         echo "Your platform has some specific hints regarding large file builds, using them..."
9266         . ./uselargefiles.cbu
9267 fi
9268 case "$uselargefiles" in
9269 "$define")
9270         if $test -f uselargefiles.cbu; then
9271                 echo " "
9272                 echo "Rechecking to see how big your file offsets are..." >&4
9273                 $cat >try.c <<EOCP
9274 #include <sys/types.h>
9275 #include <stdio.h>
9276 int main()
9277 {
9278     printf("%d\n", (int)sizeof($lseektype));
9279     return(0);
9280 }
9281 EOCP
9282                 set try
9283                 if eval $compile_ok; then
9284                         lseeksize=`$run ./try`
9285                         $echo "Your file offsets are now $lseeksize bytes long."
9286                 else
9287                         dflt="$lseeksize"
9288                         echo " "
9289                         echo "(I can't seem to compile the test program.  Guessing...)"
9290                         rp="What is the size of your file offsets (in bytes)?"
9291                         . ./myread
9292                         lseeksize="$ans"
9293                 fi
9294                 case "$fpostype" in
9295                 *_t) zzz="$fpostype"    ;;
9296                 *)   zzz="fpos_t"       ;;
9297                 esac
9298                 $echo $n "Rechecking the size of $zzz...$c" >&4
9299                 $cat > try.c <<EOCP
9300 #include <sys/types.h>
9301 #include <stdio.h>
9302 #$i_stdlib I_STDLIB
9303 #ifdef I_STDLIB
9304 #include <stdlib.h>
9305 #endif
9306 int main() {
9307     printf("%d\n", (int)sizeof($fpostype));
9308     return(0);
9309 }
9310 EOCP
9311                 set try
9312                 if eval $compile_ok; then
9313                         yyy=`$run ./try`
9314                         dflt="$lseeksize"
9315                         case "$yyy" in
9316                         '')     echo " "
9317                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9318                                 ;;
9319                         *)      fpossize=$yyy
9320                                 echo " $fpossize bytes." >&4
9321                                 ;;
9322                         esac
9323                 else
9324                         dflt="$fpossize"
9325                         echo " "
9326                         echo "(I can't compile the test program.  Guessing...)" >&4
9327                         rp="What is the size of your file positions (in bytes)?"
9328                         . ./myread
9329                         fpossize="$ans"
9330                 fi
9331                 $rm_try
9332         fi
9333         ;;
9334 esac
9335
9336 : Check if we want perlio
9337 useperlio="$define"
9338
9339 : Set the vendorbin variables
9340 case "$vendorprefix" in
9341 '')     d_vendorbin="$undef"
9342         vendorbin=''
9343         vendorbinexp=''
9344         ;;
9345 *)      d_vendorbin="$define"
9346         : determine where vendor-supplied executables go.
9347         case "$vendorbin" in
9348         '') dflt=$vendorprefix/bin ;;
9349         *)      dflt="$vendorbin" ;;
9350         esac
9351         fn=d~+
9352         rp='Pathname for the vendor-supplied executables directory?'
9353         . ./getfile
9354         vendorbin="$ans"
9355         vendorbinexp="$ansexp"
9356         ;;
9357 esac
9358 prefixvar=vendorbin
9359 . ./installprefix
9360
9361 : Set the vendorhtml1dir variables
9362 case "$vendorprefix" in
9363 '')     vendorhtml1dir=''
9364         vendorhtml1direxp=''
9365         ;;
9366 *)      : determine where vendor-supplied html pages go.
9367         : There is no standard location, so try to copy the previously-selected
9368         : directory structure for the core html pages.
9369         : XXX Better default suggestions would be welcome.
9370         case "$vendorhtml1dir" in
9371         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9372         *)      dflt=$vendorhtml1dir ;;
9373         esac
9374         case "$dflt" in
9375         ''|' ') dflt=none ;;
9376         esac
9377         fn=dn+~
9378         rp='Pathname for the vendor-supplied html pages?'
9379         . ./getfile
9380         vendorhtml1dir="$ans"
9381         vendorhtml1direxp="$ansexp"
9382         ;;
9383 esac
9384 : Use ' ' for none so value is preserved next time through Configure
9385 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9386 prefixvar=vendorhtml1dir
9387 . ./installprefix
9388
9389 : Set the vendorhtml3dir variables
9390 case "$vendorprefix" in
9391 '')     vendorhtml3dir=''
9392         vendorhtml3direxp=''
9393         ;;
9394 *)      : determine where vendor-supplied module html pages go.
9395         : There is no standard location, so try to copy the previously-selected
9396         : directory structure for the core html pages.
9397         : XXX Better default suggestions would be welcome.
9398         case "$vendorhtml3dir" in
9399         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9400         *)      dflt=$vendorhtml3dir ;;
9401         esac
9402         case "$dflt" in
9403         ''|' ') dflt=none ;;
9404         esac
9405         fn=dn+~
9406         rp='Pathname for the vendor-supplied html pages?'
9407         . ./getfile
9408         vendorhtml3dir="$ans"
9409         vendorhtml3direxp="$ansexp"
9410         ;;
9411 esac
9412 : Use ' ' for none so value is preserved next time through Configure
9413 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9414 prefixvar=vendorhtml3dir
9415 . ./installprefix
9416
9417 : Set the vendorman1dir variables
9418 case "$vendorprefix" in
9419 '')     vendorman1dir=''
9420         vendorman1direxp=''
9421         ;;
9422 *)      : determine where vendor-supplied manual pages go.
9423         case "$vendorman1dir" in
9424         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9425         *)      dflt=$vendorman1dir ;;
9426         esac
9427         case "$dflt" in
9428         ''|' ') dflt=none ;;
9429         esac
9430         fn=nd~+
9431         rp='Pathname for the vendor-supplied manual section 1 pages?'
9432         . ./getfile
9433         vendorman1dir="$ans"
9434         vendorman1direxp="$ansexp"
9435         ;;
9436 esac
9437 : Use ' ' for none so value is preserved next time through Configure
9438 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9439 prefixvar=vendorman1dir
9440 . ./installprefix
9441
9442 : Set the vendorman3dir variables
9443 case "$vendorprefix" in
9444 '')     vendorman3dir=''
9445         vendorman3direxp=''
9446         ;;
9447 *)      : determine where vendor-supplied module manual pages go.
9448         case "$vendorman3dir" in
9449         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9450         *)      dflt=$vendorman3dir ;;
9451         esac
9452         case "$dflt" in
9453         ''|' ') dflt=none ;;
9454         esac
9455         fn=nd~+
9456         rp='Pathname for the vendor-supplied manual section 3 pages?'
9457         . ./getfile
9458         vendorman3dir="$ans"
9459         vendorman3direxp="$ansexp"
9460         ;;
9461 esac
9462 : Use ' ' for none so value is preserved next time through Configure
9463 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9464 prefixvar=vendorman3dir
9465 . ./installprefix
9466
9467 : Set the vendorscript variables
9468 case "$vendorprefix" in
9469 '')     d_vendorscript="$undef"
9470         vendorscript=''
9471         vendorscriptexp=''
9472         ;;
9473 *)      d_vendorscript="$define"
9474         : determine where vendor-supplied scripts go.
9475         case "$vendorscript" in
9476         '')     dflt=$vendorprefix/script
9477                 $test -d $dflt || dflt=$vendorbin ;;
9478         *)  dflt="$vendorscript" ;;
9479         esac
9480         $cat <<EOM
9481
9482 The installation process will create a directory for
9483 vendor-supplied scripts.
9484
9485 EOM
9486         fn=d~+
9487         rp='Pathname for the vendor-supplied scripts directory?'
9488         . ./getfile
9489         vendorscript="$ans"
9490         vendorscriptexp="$ansexp"
9491         ;;
9492 esac
9493 prefixvar=vendorscript
9494 . ./installprefix
9495
9496 : script used to emit important warnings
9497 cat >warn <<EOS
9498 $startsh
9499 if test \$# -gt 0; then
9500         echo "\$@" >msg
9501 else
9502         cat >msg
9503 fi
9504 echo "*** WARNING:" >&4
9505 sed -e 's/^/*** /' <msg >&4
9506 echo "*** " >&4
9507 cat msg >>config.msg
9508 echo " " >>config.msg
9509 rm -f msg
9510 EOS
9511 chmod +x warn
9512 $eunicefix warn
9513
9514 : see which of string.h or strings.h is needed
9515 echo " "
9516 strings=`./findhdr string.h`
9517 if $test "$strings" && $test -r "$strings"; then
9518         echo "Using <string.h> instead of <strings.h>." >&4
9519         val="$define"
9520 else
9521         val="$undef"
9522         strings=`./findhdr strings.h`
9523         if $test "$strings" && $test -r "$strings"; then
9524                 echo "Using <strings.h> instead of <string.h>." >&4
9525         else
9526                 ./warn "No string header found -- You'll surely have problems."
9527         fi
9528 fi
9529 set i_string
9530 eval $setvar
9531 case "$i_string" in
9532 "$undef") strings=`./findhdr strings.h`;;
9533 *)        strings=`./findhdr string.h`;;
9534 esac
9535
9536 : see if qgcvt exists
9537 set qgcvt d_qgcvt
9538 eval $inlibc
9539
9540 : Check print/scan long double stuff
9541 echo " "
9542
9543 if $test X"$d_longdbl" = X"$define"; then
9544
9545 echo "Checking how to print long doubles..." >&4
9546
9547 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9548         $cat >try.c <<'EOCP'
9549 #include <sys/types.h>
9550 #include <stdio.h>
9551 int main() {
9552   double d = 123.456;
9553   printf("%.3f\n", d);
9554 }
9555 EOCP
9556         set try
9557         if eval $compile; then
9558                 yyy=`$run ./try`
9559                 case "$yyy" in
9560                 123.456)
9561                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9562                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9563                         echo "We will use %f."
9564                         ;;
9565                 esac
9566         fi
9567 fi
9568
9569 if $test X"$sPRIfldbl" = X; then
9570         $cat >try.c <<'EOCP'
9571 #include <sys/types.h>
9572 #include <stdio.h>
9573 int main() {
9574   long double d = 123.456;
9575   printf("%.3Lf\n", d);
9576 }
9577 EOCP
9578         set try
9579         if eval $compile; then
9580                 yyy=`$run ./try`
9581                 case "$yyy" in
9582                 123.456)
9583                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9584                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9585                         echo "We will use %Lf."
9586                         ;;
9587                 esac
9588         fi
9589 fi
9590
9591 if $test X"$sPRIfldbl" = X; then
9592         $cat >try.c <<'EOCP'
9593 #include <sys/types.h>
9594 #include <stdio.h>
9595 int main() {
9596   long double d = 123.456;
9597   printf("%.3llf\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='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9606                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9607                         echo "We will use %llf."
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         echo "Cannot figure out how to print long doubles." >&4
9637 else
9638         sSCNfldbl=$sPRIfldbl    # expect consistency
9639 fi
9640
9641 $rm_try
9642
9643 fi # d_longdbl
9644
9645 case "$sPRIfldbl" in
9646 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9647         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9648         d_SCNfldbl="$undef";
9649         ;;
9650 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9651         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9652         d_SCNfldbl="$define";
9653         ;;
9654 esac
9655
9656 : Check how to convert floats to strings.
9657
9658 if test "X$d_Gconvert" = X; then
9659
9660 echo " "
9661 echo "Checking for an efficient way to convert floats to strings."
9662 echo " " > try.c
9663 case "$uselongdouble" in
9664 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9665 esac
9666 case "$d_longdbl" in
9667 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9668 esac
9669 case "$d_PRIgldbl" in
9670 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9671 esac
9672 $cat >>try.c <<EOP
9673 #ifdef TRY_gconvert
9674 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9675 char *myname = "gconvert";
9676 #endif
9677 #ifdef TRY_gcvt
9678 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9679 char *myname = "gcvt";
9680 #endif
9681 #ifdef TRY_qgcvt
9682 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9683 char *myname = "qgcvt";
9684 #define DOUBLETYPE long double
9685 #endif
9686 #ifdef TRY_sprintf
9687 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9688 #ifdef HAS_PRIgldbl
9689 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9690 #else
9691 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9692 #endif
9693 #else
9694 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9695 #endif
9696 char *myname = "sprintf";
9697 #endif
9698
9699 #ifndef DOUBLETYPE
9700 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9701 #define DOUBLETYPE long double
9702 #else
9703 #define DOUBLETYPE double
9704 #endif
9705 #endif
9706
9707 #include <stdio.h>
9708
9709 #$i_stdlib I_STDLIB
9710 #ifdef I_STDLIB
9711 #include <stdlib.h>
9712 #endif
9713 #$i_string I_STRING
9714 #ifdef I_STRING
9715 #  include <string.h>
9716 #else
9717 #  include <strings.h>
9718 #endif
9719
9720 int checkit(char *expect, char *got)
9721 {
9722     if (strcmp(expect, got)) {
9723                 printf("%s oddity:  Expected %s, got %s\n",
9724                         myname, expect, got);
9725                 exit(1);
9726         }
9727 }
9728
9729 int main()
9730 {
9731         char buf[64];
9732         buf[63] = '\0';
9733
9734         /* This must be 1st test on (which?) platform */
9735         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9736         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9737         checkit("0.1", buf);
9738
9739         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9740         checkit("0.01", buf);
9741
9742         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9743         checkit("0.001", buf);
9744
9745         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9746         checkit("0.0001", buf);
9747
9748         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9749         if (strlen(buf) > 5)
9750             checkit("9e-005", buf); /* for Microsoft ?? */
9751         else
9752             checkit("9e-05", buf);
9753
9754         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9755         checkit("1", buf);
9756
9757         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9758         checkit("1.1", buf);
9759
9760         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9761         checkit("1.01", buf);
9762
9763         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9764         checkit("1.001", buf);
9765
9766         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9767         checkit("1.0001", buf);
9768
9769         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9770         checkit("1.00001", buf);
9771
9772         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9773         checkit("1.000001", buf);
9774
9775         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9776         checkit("0", buf);
9777
9778         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9779         checkit("-1", buf);
9780
9781         /* Some Linux gcvt's give 1.e+5 here. */
9782         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9783         checkit("100000", buf);
9784
9785         /* Some Linux gcvt's give -1.e+5 here. */
9786         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9787         checkit("-100000", buf);
9788
9789         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9790         checkit("123.456", buf);
9791
9792         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9793         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9794         /* 34 should be enough to scare even long double
9795          * places into using the e notation. */
9796         if (strlen(buf) > 5)
9797             checkit("1e+034", buf); /* for Microsoft */
9798         else
9799             checkit("1e+34", buf);
9800
9801         /* For Perl, if you add additional tests here, also add them to
9802          * t/base/num.t for benefit of platforms not using Configure or
9803          * overriding d_Gconvert */
9804
9805         exit(0);
9806 }
9807 EOP
9808 : first add preferred functions to our list
9809 xxx_list=""
9810 for xxx_convert in $gconvert_preference; do
9811     case $xxx_convert in
9812     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9813     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9814     esac
9815 done
9816 : then add any others
9817 for xxx_convert in gconvert gcvt sprintf; do
9818     case "$xxx_list" in
9819     *$xxx_convert*) ;;
9820     *) xxx_list="$xxx_list $xxx_convert" ;;
9821     esac
9822 done
9823
9824 case "$d_longdbl$uselongdouble" in
9825 "$define$define")
9826     : again, add preferred functions to our list first
9827     xxx_ld_list=""
9828     for xxx_convert in $gconvert_ld_preference; do
9829         case $xxx_convert in
9830         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9831         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9832         esac
9833     done
9834     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9835     for xxx_convert in qgcvt sprintf $xxx_list; do
9836         case "$xxx_ld_list" in
9837         $xxx_convert*|*" $xxx_convert"*) ;;
9838         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9839         esac
9840     done
9841     : if sprintf cannot do long doubles, move it to the end
9842     if test "$d_PRIgldbl" != "$define"; then
9843         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9844     fi
9845     : if no qgcvt, remove it
9846     if test "$d_qgcvt" != "$define"; then
9847         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9848     fi
9849     : use the ld_list
9850     xxx_list="$xxx_ld_list"
9851     ;;
9852 esac
9853
9854 for xxx_convert in $xxx_list; do
9855         echo "Trying $xxx_convert..."
9856         $rm -f try try$_o core
9857         set try -DTRY_$xxx_convert
9858         if eval $compile; then
9859                 echo "$xxx_convert() found." >&4
9860                 if $run ./try; then
9861                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9862                         break;
9863                 else
9864                         echo "...But $xxx_convert didn't work as I expected."
9865                         xxx_convert=''
9866                 fi
9867         else
9868                 echo "$xxx_convert NOT found." >&4
9869         fi
9870 done
9871
9872 if test X$xxx_convert = X; then
9873     echo "*** WHOA THERE!!! ***" >&4
9874     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9875     xxx_convert=sprintf
9876 fi
9877
9878 case "$xxx_convert" in
9879 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9880 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9881 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9882 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9883    "$define$define$define")
9884       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9885    "$define$define$undef")
9886       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9887    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9888    esac
9889    ;;
9890 esac
9891
9892 fi
9893 $rm_try
9894
9895 : see if _fwalk exists
9896 set fwalk d__fwalk
9897 eval $inlibc
9898
9899 : Initialize h_fcntl
9900 h_fcntl=false
9901
9902 : Initialize h_sysfile
9903 h_sysfile=false
9904
9905 : access call always available on UNIX
9906 set access d_access
9907 eval $inlibc
9908
9909 : locate the flags for 'access()'
9910 case "$d_access" in
9911 "$define")
9912         echo " "
9913         $cat >access.c <<EOCP
9914 #include <sys/types.h>
9915 #ifdef I_FCNTL
9916 #include <fcntl.h>
9917 #endif
9918 #ifdef I_SYS_FILE
9919 #include <sys/file.h>
9920 #endif
9921 #ifdef I_UNISTD
9922 #include <unistd.h>
9923 #endif
9924 #$i_stdlib I_STDLIB
9925 #ifdef I_STDLIB
9926 #include <stdlib.h>
9927 #endif
9928 int main() {
9929         exit(R_OK);
9930 }
9931 EOCP
9932         : check sys/file.h first, no particular reason here
9933         if $test `./findhdr sys/file.h` && \
9934                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9935                 h_sysfile=true;
9936                 echo "<sys/file.h> defines the *_OK access constants." >&4
9937         elif $test `./findhdr fcntl.h` && \
9938                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9939                 h_fcntl=true;
9940                 echo "<fcntl.h> defines the *_OK access constants." >&4
9941         elif $test `./findhdr unistd.h` && \
9942                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9943                 echo "<unistd.h> defines the *_OK access constants." >&4
9944         else
9945                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9946         fi
9947         ;;
9948 esac
9949 $rm -f access*
9950
9951 : see if accessx exists
9952 set accessx d_accessx
9953 eval $inlibc
9954
9955 : see if aintl exists
9956 set aintl d_aintl
9957 eval $inlibc
9958
9959 : see if alarm exists
9960 set alarm d_alarm
9961 eval $inlibc
9962
9963 : see if 64bit time functions exists
9964
9965 set ctime64 d_ctime64
9966 eval $inlibc
9967
9968 set localtime64 d_localtime64
9969 eval $inlibc
9970
9971 set gmtime64 d_gmtime64
9972 eval $inlibc
9973
9974 set mktime64 d_mktime64
9975 eval $inlibc
9976
9977 set difftime64 d_difftime64
9978 eval $inlibc
9979
9980 set asctime64 d_asctime64
9981 eval $inlibc
9982
9983 : see if POSIX threads are available
9984 set pthread.h i_pthread
9985 eval $inhdr
9986
9987 : define a function to check prototypes
9988 $cat > protochk <<EOSH
9989 $startsh
9990 cc="$cc"
9991 optimize="$optimize"
9992 ccflags="$ccflags"
9993 prototype="$prototype"
9994 define="$define"
9995 rm_try="$rm_try"
9996 usethreads=$usethreads
9997 i_pthread=$i_pthread
9998 pthread_h_first=$pthread_h_first
9999 EOSH
10000
10001 $cat >> protochk <<'EOSH'
10002
10003 $rm_try
10004 foo="$1"
10005 shift
10006 while test $# -ge 2; do
10007         case "$1" in
10008                 $define) echo "#include <$2>" >> try.c ;;
10009                 literal) echo "$2" >> try.c ;;
10010         esac
10011     # Extra magic for the benefit of systems that need pthread.h
10012     # to be included early to correctly detect threadsafe functions.
10013     # Such functions must guarantee themselves, though, that the usethreads
10014     # and i_pthread have been defined, before calling protochk.
10015     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10016         echo "#include <pthread.h>" >> try.c
10017         pthread_h_done=yes
10018     fi
10019     shift 2
10020 done
10021 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10022 cat >> try.c <<'EOCP'
10023 #ifdef CAN_PROTOTYPE
10024 #define _(args) args
10025 #else
10026 #define _(args) ()
10027 #endif
10028 EOCP
10029 echo "$foo" >> try.c
10030 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10031 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10032 status=$?
10033 $rm_try
10034 exit $status
10035 EOSH
10036 chmod +x protochk
10037 $eunicefix protochk
10038
10039 : Define hasproto macro for Configure internal use
10040 hasproto='varname=$1; func=$2; shift; shift;
10041 while $test $# -ge 2; do
10042         case "$1" in
10043         $define) echo "#include <$2>";;
10044         esac ;
10045     shift 2;
10046 done > try.c;
10047 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10048 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10049         echo "$func() prototype found.";
10050         val="$define";
10051 else
10052         echo "$func() prototype NOT found.";
10053         val="$undef";
10054 fi;
10055 set $varname;
10056 eval $setvar;
10057 $rm_try tryout.c'
10058
10059 : see if sys/types.h has to be included
10060 set sys/types.h i_systypes
10061 eval $inhdr
10062
10063 : see if sys/select.h has to be included
10064 set sys/select.h i_sysselct
10065 eval $inhdr
10066
10067 : Define hasfield macro for Configure internal use
10068 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10069 while $test $# -ge 2; do
10070         case "$1" in
10071         $define) echo "#include <$2>";;
10072         esac ;
10073     shift 2;
10074 done > try.c;
10075 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10076 set try;
10077 if eval $compile; then
10078         val="$define";
10079 else
10080         val="$undef";
10081 fi;
10082 set $varname;
10083 eval $setvar;
10084 $rm_try'
10085
10086 : see if we should include time.h, sys/time.h, or both
10087 echo " "
10088 if test "X$timeincl" = X; then
10089         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10090         $echo $n "I'm now running the test program...$c"
10091         $cat >try.c <<EOCP
10092 #include <sys/types.h>
10093 #ifdef I_TIME
10094 #include <time.h>
10095 #endif
10096 #ifdef I_SYSTIME
10097 #ifdef SYSTIMEKERNEL
10098 #define KERNEL
10099 #endif
10100 #include <sys/time.h>
10101 #endif
10102 #ifdef I_SYSSELECT
10103 #include <sys/select.h>
10104 #endif
10105 #$i_stdlib I_STDLIB
10106 #ifdef I_STDLIB
10107 #include <stdlib.h>
10108 #endif
10109 int main()
10110 {
10111         struct tm foo;
10112 #ifdef S_TIMEVAL
10113         struct timeval bar;
10114 #endif
10115 #ifdef S_TIMEZONE
10116         struct timezone tzp;
10117 #endif
10118         if (foo.tm_sec == foo.tm_sec)
10119                 exit(0);
10120 #ifdef S_TIMEVAL
10121         if (bar.tv_sec == bar.tv_sec)
10122                 exit(0);
10123 #endif
10124         exit(1);
10125 }
10126 EOCP
10127         flags=''
10128         for s_timezone in '-DS_TIMEZONE' ''; do
10129         sysselect=''
10130         for s_timeval in '-DS_TIMEVAL' ''; do
10131         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10132         for i_time in '' '-DI_TIME'; do
10133         for i_systime in '-DI_SYSTIME' ''; do
10134                 case "$flags" in
10135                 '') $echo $n ".$c"
10136                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10137                         if eval $compile; then
10138                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10139                                 shift
10140                                 flags="$*"
10141                                 echo " "
10142                                 $echo $n "Succeeded with $flags$c"
10143                         fi
10144                         ;;
10145                 esac
10146         done
10147         done
10148         done
10149         done
10150         done
10151         timeincl=''
10152         echo " "
10153         case "$flags" in
10154         *SYSTIMEKERNEL*) i_systimek="$define"
10155                 timeincl=`./findhdr sys/time.h`
10156                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10157         *) i_systimek="$undef";;
10158         esac
10159         case "$flags" in
10160         *I_TIME*) i_time="$define"
10161                 timeincl=`./findhdr time.h`" $timeincl"
10162                 echo "We'll include <time.h>." >&4;;
10163         *) i_time="$undef";;
10164         esac
10165         case "$flags" in
10166         *I_SYSTIME*) i_systime="$define"
10167                 timeincl=`./findhdr sys/time.h`" $timeincl"
10168                 echo "We'll include <sys/time.h>." >&4;;
10169         *) i_systime="$undef";;
10170         esac
10171         $rm_try
10172 fi
10173 : see if struct tm knows about tm_zone
10174 case "$i_systime$i_time" in
10175 *$define*)
10176         echo " "
10177         echo "Checking to see if your struct tm has tm_zone field..." >&4
10178         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10179         eval $hasfield
10180         ;;
10181 *)      val="$undef"
10182         set d_tm_tm_zone
10183         eval $setvar
10184         ;;
10185 esac
10186 case "$d_tm_tm_zone" in
10187 "$define")      echo "Yes, it does."   ;;
10188 *)              echo "No, it doesn't." ;;
10189 esac
10190 : see if struct tm knows about tm_gmtoff
10191 case "$i_systime$i_time" in
10192 *$define*)
10193         echo " "
10194         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10195         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10196         eval $hasfield
10197         ;;
10198 *)      val="$undef"
10199         set d_tm_tm_gmtoff
10200         eval $setvar
10201         ;;
10202 esac
10203 case "$d_tm_tm_gmtoff" in
10204 "$define")      echo "Yes, it does."   ;;
10205 *)              echo "No, it doesn't." ;;
10206 esac
10207
10208 : see if asctime_r exists
10209 set asctime_r d_asctime_r
10210 eval $inlibc
10211 case "$d_asctime_r" in
10212 "$define")
10213         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10214         case "$d_asctime_r_proto:$usethreads" in
10215         ":define")      d_asctime_r_proto=define
10216                 set d_asctime_r_proto asctime_r $hdrs
10217                 eval $hasproto ;;
10218         *)      ;;
10219         esac
10220         case "$d_asctime_r_proto" in
10221         define)
10222         case "$asctime_r_proto" in
10223         ''|0) try='char* asctime_r(const struct tm*, char*);'
10224         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10225         esac
10226         case "$asctime_r_proto" in
10227         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10228         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10229         esac
10230         case "$asctime_r_proto" in
10231         ''|0) try='int asctime_r(const struct tm*, char*);'
10232         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10233         esac
10234         case "$asctime_r_proto" in
10235         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10236         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10237         esac
10238         case "$asctime_r_proto" in
10239         ''|0)   d_asctime_r=undef
10240                 asctime_r_proto=0
10241                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10242         * )     case "$asctime_r_proto" in
10243                 REENTRANT_PROTO*) ;;
10244                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10245                 esac
10246                 echo "Prototype: $try" ;;
10247         esac
10248         ;;
10249         *)      case "$usethreads" in
10250                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10251                 esac
10252                 d_asctime_r=undef
10253                 asctime_r_proto=0
10254                 ;;
10255         esac
10256         ;;
10257 *)      asctime_r_proto=0
10258         ;;
10259 esac
10260
10261 : see if atolf exists
10262 set atolf d_atolf
10263 eval $inlibc
10264
10265 : see if atoll exists
10266 set atoll d_atoll
10267 eval $inlibc
10268
10269 : Look for GCC-style attribute format
10270 case "$d_attribute_format" in
10271 '')
10272 echo " "
10273 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10274 $cat >attrib.c <<'EOCP'
10275 #include <stdio.h>
10276 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10277 EOCP
10278 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10279         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10280                 echo "Your C compiler doesn't support __attribute__((format))."
10281                 val="$undef"
10282         else
10283                 echo "Your C compiler supports __attribute__((format))."
10284                 val="$define"
10285         fi
10286 else
10287         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10288         val="$undef"
10289 fi
10290 ;;
10291 *) val="$d_attribute_format" ;;
10292 esac
10293 set d_attribute_format
10294 eval $setvar
10295 $rm -f attrib*
10296
10297 : Look for GCC-style attribute format with null format allowed
10298 case "$d_printf_format_null" in
10299 '') case "$d_attribute_format" in
10300     $define)
10301         echo " "
10302         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10303 $cat >attrib.c <<EOCP
10304 #include <stdio.h>
10305 #$i_stdlib I_STDLIB
10306 #ifdef I_STDLIB
10307 #include <stdlib.h>
10308 #endif
10309 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10310 int null_printf (char* pat,...) { return (int)pat; }
10311 int main () { exit(null_printf(NULL)); }
10312 EOCP
10313         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10314             : run the executable in case it produces a run-time warning
10315             if $run ./attrib >>attrib.out 2>&1; then
10316                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10317                     echo "Your C compiler doesn't allow __printf__ format to be null."
10318                     val="$undef"
10319                 else
10320                     echo "Your C compiler allows __printf__ format to be null."
10321                     val="$define"
10322                 fi
10323             else
10324             echo "Your C compiler executable failed with __printf__ format null."
10325             val="$undef"
10326         fi
10327     else
10328         echo "Your C compiler fails with __printf__ format null."
10329         val="$undef"
10330     fi
10331     ;;
10332     *)  val="$undef" ;;
10333     esac
10334 ;;
10335 *)  val="$d_printf_format_null" ;;
10336 esac
10337 set d_printf_format_null
10338 eval $setvar
10339 $rm -f attrib*
10340
10341 : Look for GCC-style attribute malloc
10342 case "$d_attribute_malloc" in
10343 '')
10344 echo " "
10345 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10346 $cat >attrib.c <<'EOCP'
10347 #include <stdio.h>
10348 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10349 EOCP
10350 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10351         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10352                 echo "Your C compiler doesn't support __attribute__((malloc))."
10353                 val="$undef"
10354         else
10355                 echo "Your C compiler supports __attribute__((malloc))."
10356                 val="$define"
10357         fi
10358 else
10359         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10360         val="$undef"
10361 fi
10362 ;;
10363 *) val="$d_attribute_malloc" ;;
10364 esac
10365 set d_attribute_malloc
10366 eval $setvar
10367 $rm -f attrib*
10368
10369 : Look for GCC-style attribute nonnull
10370 case "$d_attribute_nonnull" in
10371 '')
10372 echo " "
10373 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10374 $cat >attrib.c <<'EOCP'
10375 #include <stdio.h>
10376 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10377 EOCP
10378 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10379         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10380                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10381                 val="$undef"
10382         else
10383                 echo "Your C compiler supports __attribute__((nonnull))."
10384                 val="$define"
10385         fi
10386 else
10387         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10388         val="$undef"
10389 fi
10390 ;;
10391 *) val="$d_attribute_nonnull" ;;
10392 esac
10393 set d_attribute_nonnull
10394 eval $setvar
10395 $rm -f attrib*
10396
10397 : Look for GCC-style attribute noreturn
10398 case "$d_attribute_noreturn" in
10399 '')
10400 echo " "
10401 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10402 $cat >attrib.c <<'EOCP'
10403 #include <stdio.h>
10404 void fall_over_dead( void ) __attribute__((noreturn));
10405 EOCP
10406 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10407         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10408                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10409                 val="$undef"
10410         else
10411                 echo "Your C compiler supports __attribute__((noreturn))."
10412                 val="$define"
10413         fi
10414 else
10415         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10416         val="$undef"
10417 fi
10418 ;;
10419 *) val="$d_attribute_noreturn" ;;
10420 esac
10421 set d_attribute_noreturn
10422 eval $setvar
10423 $rm -f attrib*
10424
10425 : Look for GCC-style attribute pure
10426 case "$d_attribute_pure" in
10427 '')
10428 echo " "
10429 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10430 $cat >attrib.c <<'EOCP'
10431 #include <stdio.h>
10432 int square( int n ) __attribute__((pure));
10433 EOCP
10434 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10435         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10436                 echo "Your C compiler doesn't support __attribute__((pure))."
10437                 val="$undef"
10438         else
10439                 echo "Your C compiler supports __attribute__((pure))."
10440                 val="$define"
10441         fi
10442 else
10443         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10444         val="$undef"
10445 fi
10446 ;;
10447 *) val="$d_attribute_pure" ;;
10448 esac
10449 set d_attribute_pure
10450 eval $setvar
10451 $rm -f attrib*
10452
10453 : Look for GCC-style attribute unused
10454 case "$d_attribute_unused" in
10455 '')
10456 echo " "
10457 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10458 $cat >attrib.c <<'EOCP'
10459 #include <stdio.h>
10460 int do_something( int dummy __attribute__((unused)), int n );
10461 EOCP
10462 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10463         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10464                 echo "Your C compiler doesn't support __attribute__((unused))."
10465                 val="$undef"
10466         else
10467                 echo "Your C compiler supports __attribute__((unused))."
10468                 val="$define"
10469         fi
10470 else
10471         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10472         val="$undef"
10473 fi
10474 ;;
10475 *) val="$d_attribute_unused" ;;
10476 esac
10477 set d_attribute_unused
10478 eval $setvar
10479 $rm -f attrib*
10480
10481 : Look for GCC-style attribute deprecated
10482 case "$d_attribute_deprecated" in
10483 '')
10484 echo " "
10485 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10486 $cat >attrib.c <<'EOCP'
10487 #include <stdio.h>
10488 int I_am_deprecated(void) __attribute__((deprecated));
10489 EOCP
10490 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10491         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10492                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10493                 val="$undef"
10494         else
10495                 echo "Your C compiler supports __attribute__((deprecated))."
10496                 val="$define"
10497         fi
10498 else
10499         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10500         val="$undef"
10501 fi
10502 ;;
10503 *) val="$d_attribute_deprecated" ;;
10504 esac
10505 set d_attribute_deprecated
10506 eval $setvar
10507 $rm -f attrib*
10508
10509 : Look for GCC-style attribute warn_unused_result
10510 case "$d_attribute_warn_unused_result" in
10511 '')
10512 echo " "
10513 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10514 $cat >attrib.c <<'EOCP'
10515 #include <stdio.h>
10516 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10517 EOCP
10518 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10519         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10520                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10521                 val="$undef"
10522         else
10523                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10524                 val="$define"
10525         fi
10526 else
10527         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10528         val="$undef"
10529 fi
10530 ;;
10531 *) val="$d_attribute_warn_unused_result" ;;
10532 esac
10533 set d_attribute_warn_unused_result
10534 eval $setvar
10535 $rm -f attrib*
10536
10537 : see if bcmp exists
10538 set bcmp d_bcmp
10539 eval $inlibc
10540
10541 : see if bcopy exists
10542 set bcopy d_bcopy
10543 eval $inlibc
10544
10545 : see if getpgrp exists
10546 set getpgrp d_getpgrp
10547 eval $inlibc
10548
10549 case "$d_getpgrp" in
10550 "$define")
10551         echo " "
10552         echo "Checking to see which flavor of getpgrp is in use..."
10553         $cat >try.c <<EOP
10554 #$i_unistd I_UNISTD
10555 #include <sys/types.h>
10556 #ifdef I_UNISTD
10557 #  include <unistd.h>
10558 #endif
10559 #$i_stdlib I_STDLIB
10560 #ifdef I_STDLIB
10561 #include <stdlib.h>
10562 #endif
10563 int main()
10564 {
10565         if (getuid() == 0) {
10566                 printf("(I see you are running Configure as super-user...)\n");
10567                 setuid(1);
10568         }
10569 #ifdef TRY_BSD_PGRP
10570         if (getpgrp(1) == 0)
10571                 exit(0);
10572 #else
10573         if (getpgrp() > 0)
10574                 exit(0);
10575 #endif
10576         exit(1);
10577 }
10578 EOP
10579         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10580                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10581                 val="$define"
10582         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10583                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10584                 val="$undef"
10585         else
10586                 echo "I can't seem to compile and run the test program."
10587                 if ./usg; then
10588                         xxx="a USG one, i.e. you use getpgrp()."
10589                 else
10590                         # SVR4 systems can appear rather BSD-ish.
10591                         case "$i_unistd" in
10592                         $undef)
10593                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10594                                 val="$define"
10595                                 ;;
10596                         $define)
10597                                 xxx="probably a USG one, i.e. you use getpgrp()."
10598                                 val="$undef"
10599                                 ;;
10600                         esac
10601                 fi
10602                 echo "Assuming your getpgrp is $xxx" >&4
10603         fi
10604         ;;
10605 *) val="$undef";;
10606 esac
10607 set d_bsdgetpgrp
10608 eval $setvar
10609 $rm_try
10610
10611 : see if setpgrp exists
10612 set setpgrp d_setpgrp
10613 eval $inlibc
10614
10615 case "$d_setpgrp" in
10616 "$define")
10617         echo " "
10618         echo "Checking to see which flavor of setpgrp is in use..."
10619         $cat >try.c <<EOP
10620 #$i_unistd I_UNISTD
10621 #include <sys/types.h>
10622 #ifdef I_UNISTD
10623 #  include <unistd.h>
10624 #endif
10625 #$i_stdlib I_STDLIB
10626 #ifdef I_STDLIB
10627 #include <stdlib.h>
10628 #endif
10629 int main()
10630 {
10631         if (getuid() == 0) {
10632                 printf("(I see you are running Configure as super-user...)\n");
10633                 setuid(1);
10634         }
10635 #ifdef TRY_BSD_PGRP
10636         if (-1 == setpgrp(1, 1))
10637                 exit(0);
10638 #else
10639         if (setpgrp() != -1)
10640                 exit(0);
10641 #endif
10642         exit(1);
10643 }
10644 EOP
10645         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10646                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10647                 val="$define"
10648         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10649                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10650                 val="$undef"
10651         else
10652                 echo "(I can't seem to compile and run the test program.)"
10653                 if ./usg; then
10654                         xxx="a USG one, i.e. you use setpgrp()."
10655                 else
10656                         # SVR4 systems can appear rather BSD-ish.
10657                         case "$i_unistd" in
10658                         $undef)
10659                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10660                                 val="$define"
10661                                 ;;
10662                         $define)
10663                                 xxx="probably a USG one, i.e. you use setpgrp()."
10664                                 val="$undef"
10665                                 ;;
10666                         esac
10667                 fi
10668                 echo "Assuming your setpgrp is $xxx" >&4
10669         fi
10670         ;;
10671 *) val="$undef";;
10672 esac
10673 set d_bsdsetpgrp
10674 eval $setvar
10675 $rm_try
10676
10677 : Look for GCC-style __builtin_choose_expr
10678 case "$d_builtin_choose_expr" in
10679 '')
10680     echo " "
10681     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10682     $cat >try.c <<'EOCP'
10683 #include <assert.h>
10684 #include <stdlib.h>
10685 #include <stdio.h>
10686
10687 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10688
10689 int main(void) {
10690     assert( SYRINX(1) == 2112 );
10691     assert( SYRINX(1) != 5150 );
10692     assert( SYRINX(0) == 5150 );
10693     assert( SYRINX(0) != 2112 );
10694     puts( "All good!" );
10695     exit(0);
10696 }
10697
10698 EOCP
10699     set try
10700     if eval $compile && $run ./try; then
10701         echo "Your C compiler supports __builtin_choose_expr."
10702         val="$define"
10703     else
10704         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10705         val="$undef"
10706     fi
10707 ;;
10708 *) val="$d_builtin_choose_expr" ;;
10709 esac
10710
10711 set d_builtin_choose_expr
10712 eval $setvar
10713 $rm_try
10714
10715 : Look for GCC-style __builtin_expect
10716 case "$d_builtin_expect" in
10717 '')
10718     echo " "
10719     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10720     $cat >try.c <<'EOCP'
10721 int main(void) {
10722     int n = 50;
10723     if ( __builtin_expect(n, 0) ) n = 1;
10724     /* Remember shell exit code truth is 0, C truth is non-zero */
10725     return !(n == 1);
10726 }
10727 EOCP
10728     set try
10729     if eval $compile && $run ./try; then
10730         echo "Your C compiler supports __builtin_expect."
10731         val="$define"
10732     else
10733         echo "Your C compiler doesn't seem to understand __builtin_expect."
10734         val="$undef"
10735     fi
10736     ;;
10737 *) val="$d_builtin_expect" ;;
10738 esac
10739
10740 set d_builtin_expect
10741 eval $setvar
10742 $rm_try
10743
10744 : see if bzero exists
10745 set bzero d_bzero
10746 eval $inlibc
10747
10748 : see if stdarg is available
10749 echo " "
10750 if $test `./findhdr stdarg.h`; then
10751         echo "<stdarg.h> found." >&4
10752         valstd="$define"
10753 else
10754         echo "<stdarg.h> NOT found." >&4
10755         valstd="$undef"
10756 fi
10757
10758 : see if varags is available
10759 echo " "
10760 if $test `./findhdr varargs.h`; then
10761         echo "<varargs.h> found." >&4
10762 else
10763         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10764 fi
10765
10766 : set up the varargs testing programs
10767 $cat > varargs.c <<EOP
10768 #ifdef I_STDARG
10769 #include <stdarg.h>
10770 #endif
10771 #ifdef I_VARARGS
10772 #include <varargs.h>
10773 #endif
10774
10775 #ifdef I_STDARG
10776 int f(char *p, ...)
10777 #else
10778 int f(va_alist)
10779 va_dcl
10780 #endif
10781 {
10782         va_list ap;
10783 #ifndef I_STDARG
10784         char *p;
10785 #endif
10786 #ifdef I_STDARG
10787         va_start(ap,p);
10788 #else
10789         va_start(ap);
10790         p = va_arg(ap, char *);
10791 #endif
10792         va_end(ap);
10793         return 0;
10794 }
10795 EOP
10796 $cat > varargs <<EOP
10797 $startsh
10798 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10799         echo "true"
10800 else
10801         echo "false"
10802 fi
10803 $rm -f varargs$_o
10804 EOP
10805 chmod +x varargs
10806
10807 : now check which varargs header should be included
10808 echo " "
10809 i_varhdr=''
10810 case "$valstd" in
10811 "$define")
10812         if `./varargs I_STDARG`; then
10813                 val='stdarg.h'
10814         elif `./varargs I_VARARGS`; then
10815                 val='varargs.h'
10816         fi
10817         ;;
10818 *)
10819         if `./varargs I_VARARGS`; then
10820                 val='varargs.h'
10821         fi
10822         ;;
10823 esac
10824 case "$val" in
10825 '')
10826 echo "I could not find the definition for va_dcl... You have problems..." >&4
10827         val="$undef"; set i_stdarg; eval $setvar
10828         val="$undef"; set i_varargs; eval $setvar
10829         ;;
10830 *)
10831         set i_varhdr
10832         eval $setvar
10833         case "$i_varhdr" in
10834         stdarg.h)
10835                 val="$define"; set i_stdarg; eval $setvar
10836                 val="$undef"; set i_varargs; eval $setvar
10837                 ;;
10838         varargs.h)
10839                 val="$undef"; set i_stdarg; eval $setvar
10840                 val="$define"; set i_varargs; eval $setvar
10841                 ;;
10842         esac
10843         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10844 esac
10845 $rm -f varargs*
10846
10847 : see if the Compiler supports C99 variadic macros
10848 case "$i_stdarg$i_stdlib" in
10849     "$define$define")
10850     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10851     $cat >try.c <<EOCP
10852 #include <stdio.h>
10853 #include <stdarg.h>
10854
10855 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10856
10857 int main() {
10858   char buf[20];
10859   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10860   puts(buf);
10861   return 0;
10862 }
10863 EOCP
10864     set try
10865     if eval $compile && $run ./try 2>&1 >/dev/null; then
10866         case "`$run ./try`" in
10867             "123 456 789")
10868             echo "You have C99 variadic macros." >&4
10869             d_c99_variadic_macros="$define"
10870             ;;
10871             *)
10872             echo "You don't have functional C99 variadic macros." >&4
10873             d_c99_variadic_macros="$undef"
10874             ;;
10875         esac
10876     else
10877         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10878         d_c99_variadic_macros="$undef"
10879     fi
10880     $rm_try
10881     ;;
10882     *)
10883     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10884     d_c99_variadic_macros="$undef"
10885     ;;
10886 esac
10887
10888 : see if signal is declared as pointer to function returning int or void
10889 echo " "
10890 xxx=`./findhdr signal.h`
10891 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10892 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10893         echo "You have int (*signal())() instead of void." >&4
10894         val="$undef"
10895 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10896         echo "You have void (*signal())()." >&4
10897         val="$define"
10898 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10899         echo "You have int (*signal())() instead of void." >&4
10900         val="$undef"
10901 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10902         echo "You have void (*signal())()." >&4
10903         val="$define"
10904 else
10905         case "$d_voidsig" in
10906         '')
10907         echo "I can't determine whether signal handler returns void or int..." >&4
10908                 dflt=void
10909                 rp="What type does your signal handler return?"
10910                 . ./myread
10911                 case "$ans" in
10912                 v*) val="$define";;
10913                 *) val="$undef";;
10914                 esac;;
10915         "$define")
10916                 echo "As you already told me, signal handler returns void." >&4
10917                 val="$define"
10918                 ;;
10919         *)      echo "As you already told me, signal handler returns int." >&4
10920                 val="$undef"
10921                 ;;
10922         esac
10923 fi
10924 set d_voidsig
10925 eval $setvar
10926 case "$d_voidsig" in
10927 "$define") signal_t="void";;
10928 *) signal_t="int";;
10929 esac
10930 $rm -f $$.tmp
10931
10932 : check for ability to cast large floats to 32-bit ints.
10933 echo " "
10934 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10935 if $test "$intsize" -ge 4; then
10936         xxx=int
10937 else
10938         xxx=long
10939 fi
10940 $cat >try.c <<EOCP
10941 #include <stdio.h>
10942 #$i_stdlib I_STDLIB
10943 #ifdef I_STDLIB
10944 #include <stdlib.h>
10945 #endif
10946 #include <sys/types.h>
10947 #include <signal.h>
10948 $signal_t blech(int s) { exit(3); }
10949 int main()
10950 {
10951         $xxx i32;
10952         double f, g;
10953         int result = 0;
10954         char str[16];
10955         signal(SIGFPE, blech);
10956
10957         /* Don't let compiler optimize the test away.  Store the number
10958            in a writable string for gcc to pass to sscanf under HP-UX.
10959         */
10960         sprintf(str, "2147483647");
10961         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10962         g = 10 * f;
10963         i32  = ($xxx) g;
10964
10965         /* x86 processors will probably give 0x8000 0000, which is a
10966            sign change.  We don't want that.  We want to mimic SPARC
10967            behavior here, which is to preserve the sign and give
10968            back 0x7fff ffff.
10969         */
10970         if (i32 != ($xxx) f)
10971                 result |= 1;
10972         exit(result);
10973 }
10974 EOCP
10975 set try
10976 if eval $compile_ok; then
10977         $run ./try
10978         yyy=$?
10979 else
10980         echo "(I can't seem to compile the test program--assuming it can't)"
10981         yyy=1
10982 fi
10983 case "$yyy" in
10984 0)      val="$define"
10985         echo "Yup, it can."
10986         ;;
10987 *)      val="$undef"
10988         echo "Nope, it can't."
10989         ;;
10990 esac
10991 set d_casti32
10992 eval $setvar
10993 $rm_try
10994
10995 : check for ability to cast negative floats to unsigned
10996 echo " "
10997 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10998 $cat >try.c <<EOCP
10999 #include <stdio.h>
11000 #$i_stdlib I_STDLIB
11001 #ifdef I_STDLIB
11002 #include <stdlib.h>
11003 #endif
11004 #include <sys/types.h>
11005 #include <signal.h>
11006 $signal_t blech(int s) { exit(7); }
11007 $signal_t blech_in_list(int s) { exit(4); }
11008 unsigned long dummy_long(unsigned long p) { return p; }
11009 unsigned int dummy_int(unsigned int p) { return p; }
11010 unsigned short dummy_short(unsigned short p) { return p; }
11011 int main()
11012 {
11013         double f;
11014         unsigned long along;
11015         unsigned int aint;
11016         unsigned short ashort;
11017         int result = 0;
11018         char str[16];
11019
11020         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11021            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11022            optimized the whole file away
11023         */
11024         /* Store the number in a writable string for gcc to pass to
11025            sscanf under HP-UX.
11026         */
11027         sprintf(str, "-123");
11028         sscanf(str, "%lf", &f);  /* f = -123.; */
11029
11030         signal(SIGFPE, blech);
11031         along = (unsigned long)f;
11032         aint = (unsigned int)f;
11033         ashort = (unsigned short)f;
11034         if (along != (unsigned long)-123)
11035                 result |= 1;
11036         if (aint != (unsigned int)-123)
11037                 result |= 1;
11038         if (ashort != (unsigned short)-123)
11039                 result |= 1;
11040         sprintf(str, "1073741824.");
11041         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11042         f = f + f;
11043         along = 0;
11044         along = (unsigned long)f;
11045         if (along != 0x80000000)
11046                 result |= 2;
11047         f -= 1.;
11048         along = 0;
11049         along = (unsigned long)f;
11050         if (along != 0x7fffffff)
11051                 result |= 1;
11052         f += 2.;
11053         along = 0;
11054         along = (unsigned long)f;
11055         if (along != 0x80000001)
11056                 result |= 2;
11057         if (result)
11058                 exit(result);
11059         signal(SIGFPE, blech_in_list);
11060         sprintf(str, "123.");
11061         sscanf(str, "%lf", &f);  /* f = 123.; */
11062         along = dummy_long((unsigned long)f);
11063         aint = dummy_int((unsigned int)f);
11064         ashort = dummy_short((unsigned short)f);
11065         if (along != (unsigned long)123)
11066                 result |= 4;
11067         if (aint != (unsigned int)123)
11068                 result |= 4;
11069         if (ashort != (unsigned short)123)
11070                 result |= 4;
11071         exit(result);
11072
11073 }
11074 EOCP
11075 set try
11076 if eval $compile_ok; then
11077         $run ./try
11078         castflags=$?
11079 else
11080         echo "(I can't seem to compile the test program--assuming it can't)"
11081         castflags=7
11082 fi
11083 case "$castflags" in
11084 0)      val="$define"
11085         echo "Yup, it can."
11086         ;;
11087 *)      val="$undef"
11088         echo "Nope, it can't."
11089         ;;
11090 esac
11091 set d_castneg
11092 eval $setvar
11093 $rm_try
11094
11095 : see if vprintf exists
11096 echo " "
11097 if set vprintf val -f d_vprintf; eval $csym; $val; then
11098         echo 'vprintf() found.' >&4
11099         val="$define"
11100         $cat >try.c <<EOF
11101 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11102 #$i_varargs I_VARARGS
11103
11104 #$i_stdlib I_STDLIB
11105 #$i_unistd I_UNISTD
11106
11107 #ifdef I_STDARG
11108 #  include <stdarg.h>
11109 #else /* I_VARARGS */
11110 #  include <varargs.h>
11111 #endif
11112
11113 #ifdef I_UNISTD
11114 #  include <unistd.h>
11115 #endif
11116
11117 #ifdef I_STDLIB
11118 #  include <stdlib.h>
11119 #endif
11120
11121 #include <stdio.h> /* vsprintf prototype */
11122
11123 #ifdef I_STDARG
11124 void xxx(int n, ...)
11125 {
11126     va_list args;
11127     char buf[10];
11128     va_start(args, n);
11129     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11130 }
11131 int main() { xxx(1, "foo"); }
11132
11133 #else /* I_VARARGS */
11134
11135 xxx(va_alist)
11136 va_dcl
11137 {
11138     va_list args;
11139     char buf[10];
11140     va_start(args);
11141     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11142 }
11143 int main() { xxx("foo"); }
11144
11145 #endif
11146
11147 EOF
11148         set try
11149         if eval $compile_ok; then
11150                 if $run ./try; then
11151                         echo "Your vsprintf() returns (int)." >&4
11152                         val2="$undef"
11153                 else
11154                         echo "Your vsprintf() returns (char*)." >&4
11155                         val2="$define"
11156                 fi
11157         else
11158                 echo 'I am unable to compile the vsprintf() test program.' >&4
11159                 # We shouldn't get here.  If we do, assume the standard signature,
11160                 # not the old BSD one.
11161                 echo 'Guessing that vsprintf() returns (int).' >&4
11162                 val2="$undef"
11163         fi
11164 else
11165         echo 'vprintf() NOT found.' >&4
11166         val="$undef"
11167         val2="$undef"
11168 fi
11169 $rm_try
11170 set d_vprintf
11171 eval $setvar
11172 val=$val2
11173 set d_charvspr
11174 eval $setvar
11175
11176 : see if chown exists
11177 set chown d_chown
11178 eval $inlibc
11179
11180 : see if chroot exists
11181 set chroot d_chroot
11182 eval $inlibc
11183
11184 : see if chsize exists
11185 set chsize d_chsize
11186 eval $inlibc
11187
11188 : see if class exists
11189 set class d_class
11190 eval $inlibc
11191
11192 : see if clearenv exists
11193 set clearenv d_clearenv
11194 eval $inlibc
11195
11196 : Define hasstruct macro for Configure internal use
11197 hasstruct='varname=$1; struct=$2; shift; shift;
11198 while $test $# -ge 2; do
11199         case "$1" in
11200         $define) echo "#include <$2>";;
11201         esac ;
11202     shift 2;
11203 done > try.c;
11204 echo "int main () { struct $struct foo; }" >> try.c;
11205 set try;
11206 if eval $compile; then
11207         val="$define";
11208 else
11209         val="$undef";
11210 fi;
11211 set $varname;
11212 eval $setvar;
11213 $rm_try'
11214
11215 : see whether socket exists
11216 socketlib=''
11217 sockethdr=''
11218 echo " "
11219 $echo $n "Hmm... $c" >&4
11220 if set socket val -f d_socket; eval $csym; $val; then
11221         echo "Looks like you have Berkeley networking support." >&4
11222         d_socket="$define"
11223         if set setsockopt val -f; eval $csym; $val; then
11224                 d_oldsock="$undef"
11225         else
11226                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11227                 d_oldsock="$define"
11228         fi
11229 else
11230         if $contains socklib libc.list >/dev/null 2>&1; then
11231                 echo "Looks like you have Berkeley networking support." >&4
11232                 d_socket="$define"
11233                 : we will have to assume that it supports the 4.2 BSD interface
11234                 d_oldsock="$undef"
11235         else
11236                 echo "You don't have Berkeley networking in libc$_a..." >&4
11237                 if test "X$d_socket" = "X$define"; then
11238                    echo "...but you seem to believe that you have sockets." >&4
11239                 else
11240                         for net in net socket
11241                         do
11242                                 if test -f /usr/lib/lib$net$_a; then
11243                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11244                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11245                                         if $contains socket libc.list >/dev/null 2>&1; then
11246                                                 d_socket="$define"
11247                                                 socketlib="-l$net"
11248                                                 case "$net" in
11249                                                 net)
11250                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11251                                                         sockethdr="-I/usr/netinclude"
11252                                                         ;;
11253                                                 esac
11254                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11255                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11256                                                         d_oldsock="$undef"
11257                                                 else
11258                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11259                                                         d_oldsock="$define"
11260                                                 fi
11261                                                 break
11262                                         fi
11263                                 fi
11264                         done
11265                         if test "X$d_socket" != "X$define"; then
11266                            echo "or anywhere else I see." >&4
11267                            d_socket="$undef"
11268                            d_oldsock="$undef"
11269                         fi
11270                 fi
11271         fi
11272 fi
11273
11274 : see if socketpair exists
11275 set socketpair d_sockpair
11276 eval $inlibc
11277
11278
11279 echo " "
11280 echo "Checking the availability sa_len in the sock struct ..." >&4
11281 $cat >try.c <<EOF
11282 #include <sys/types.h>
11283 #include <sys/socket.h>
11284 int main() {
11285 struct sockaddr sa;
11286 return (sa.sa_len);
11287 }
11288 EOF
11289 val="$undef"
11290 set try; if eval $compile; then
11291         val="$define"
11292 fi
11293 set d_sockaddr_sa_len; eval $setvar
11294 $rm_try
11295
11296 echo " "
11297 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11298 $cat >try.c <<EOF
11299 #include <sys/types.h>
11300 #include <sys/socket.h>
11301 #include <netinet/in.h>
11302 int main() {
11303 struct sockaddr_in6 sin6;
11304 return (sin6.sin6_scope_id);
11305 }
11306 EOF
11307 val="$undef"
11308 set try; if eval $compile; then
11309         val="$define"
11310 fi
11311 set d_sin6_scope_id; eval $setvar
11312 $rm_try
11313
11314 echo " "
11315 echo "Checking the availability of certain socket constants..." >&4
11316 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11317         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11318         $cat >try.c <<EOF
11319 #include <sys/types.h>
11320 #include <sys/socket.h>
11321 int main() {
11322     int i = $ENUM;
11323 }
11324 EOF
11325         val="$undef"
11326         set try; if eval $compile; then
11327                 val="$define"
11328         fi
11329         set d_${enum}; eval $setvar
11330         $rm_try
11331 done
11332
11333 : see if this is a sys/uio.h system
11334 set sys/uio.h i_sysuio
11335 eval $inhdr
11336
11337 : Check for cmsghdr support
11338 echo " "
11339 echo "Checking to see if your system supports struct cmsghdr..." >&4
11340 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11341 eval $hasstruct
11342 case "$d_cmsghdr_s" in
11343 "$define")      echo "Yes, it does."   ;;
11344 *)              echo "No, it doesn't." ;;
11345 esac
11346
11347
11348 : check for const keyword
11349 echo " "
11350 echo 'Checking to see if your C compiler knows about "const"...' >&4
11351 $cat >const.c <<'EOCP'
11352 typedef struct spug { int drokk; } spug;
11353 int main()
11354 {
11355         const char *foo;
11356         const spug y = { 0 };
11357 }
11358 EOCP
11359 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11360         val="$define"
11361         echo "Yup, it does."
11362 else
11363         val="$undef"
11364         echo "Nope, it doesn't."
11365 fi
11366 set d_const
11367 eval $setvar
11368
11369 : see if copysignl exists
11370 set copysignl d_copysignl
11371 eval $inlibc
11372
11373 : see if crypt exists
11374 echo " "
11375 set crypt d_crypt
11376 eval $inlibc
11377 case "$d_crypt" in
11378 $define) cryptlib='' ;;
11379 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11380                 echo 'crypt() found.' >&4
11381                 val="$define"
11382                 cryptlib=''
11383         else
11384                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11385                 if $test -z "$cryptlib"; then
11386                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11387                 else
11388                         cryptlib=-lcrypt
11389                 fi
11390                 if $test -z "$cryptlib"; then
11391                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11392                 else
11393                         cryptlib=-lcrypt
11394                 fi
11395                 if $test -z "$cryptlib"; then
11396                         cryptlib=`./loc libcrypt$_a "" $libpth`
11397                 else
11398                         cryptlib=-lcrypt
11399                 fi
11400                 if $test -z "$cryptlib"; then
11401                         echo 'crypt() NOT found.' >&4
11402                         val="$undef"
11403                 else
11404                         val="$define"
11405                 fi
11406         fi
11407         set d_crypt
11408         eval $setvar
11409         ;;
11410 esac
11411
11412 : see if this is a crypt.h system
11413 set crypt.h i_crypt
11414 eval $inhdr
11415
11416 : see if crypt_r exists
11417 set crypt_r d_crypt_r
11418 eval $inlibc
11419 case "$d_crypt_r" in
11420 "$define")
11421         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11422         case "$d_crypt_r_proto:$usethreads" in
11423         ":define")      d_crypt_r_proto=define
11424                 set d_crypt_r_proto crypt_r $hdrs
11425                 eval $hasproto ;;
11426         *)      ;;
11427         esac
11428         case "$d_crypt_r_proto" in
11429         define)
11430         case "$crypt_r_proto" in
11431         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11432         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11433         esac
11434         case "$crypt_r_proto" in
11435         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11436         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11437         esac
11438         case "$crypt_r_proto" in
11439         ''|0)   d_crypt_r=undef
11440                 crypt_r_proto=0
11441                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11442         * )     case "$crypt_r_proto" in
11443                 REENTRANT_PROTO*) ;;
11444                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11445                 esac
11446                 echo "Prototype: $try" ;;
11447         esac
11448         ;;
11449         *)      case "$usethreads" in
11450                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11451                 esac
11452                 d_crypt_r=undef
11453                 crypt_r_proto=0
11454                 ;;
11455         esac
11456         ;;
11457 *)      crypt_r_proto=0
11458         ;;
11459 esac
11460
11461 : get csh whereabouts
11462 case "$csh" in
11463 'csh') val="$undef" ;;
11464 *) val="$define" ;;
11465 esac
11466 set d_csh
11467 eval $setvar
11468 : Respect a hint or command line value for full_csh.
11469 case "$full_csh" in
11470 '') full_csh=$csh ;;
11471 esac
11472
11473 : see if ctermid exists
11474 set ctermid d_ctermid
11475 eval $inlibc
11476
11477 : see if ctermid_r exists
11478 set ctermid_r d_ctermid_r
11479 eval $inlibc
11480 case "$d_ctermid_r" in
11481 "$define")
11482         hdrs="$i_systypes sys/types.h define stdio.h "
11483         case "$d_ctermid_r_proto:$usethreads" in
11484         ":define")      d_ctermid_r_proto=define
11485                 set d_ctermid_r_proto ctermid_r $hdrs
11486                 eval $hasproto ;;
11487         *)      ;;
11488         esac
11489         case "$d_ctermid_r_proto" in
11490         define)
11491         case "$ctermid_r_proto" in
11492         ''|0) try='char* ctermid_r(char*);'
11493         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11494         esac
11495         case "$ctermid_r_proto" in
11496         ''|0)   d_ctermid_r=undef
11497                 ctermid_r_proto=0
11498                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11499         * )     case "$ctermid_r_proto" in
11500                 REENTRANT_PROTO*) ;;
11501                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11502                 esac
11503                 echo "Prototype: $try" ;;
11504         esac
11505         ;;
11506         *)      case "$usethreads" in
11507                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11508                 esac
11509                 d_ctermid_r=undef
11510                 ctermid_r_proto=0
11511                 ;;
11512         esac
11513         ;;
11514 *)      ctermid_r_proto=0
11515         ;;
11516 esac
11517
11518 : see if ctime_r exists
11519 set ctime_r d_ctime_r
11520 eval $inlibc
11521 case "$d_ctime_r" in
11522 "$define")
11523         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11524         case "$d_ctime_r_proto:$usethreads" in
11525         ":define")      d_ctime_r_proto=define
11526                 set d_ctime_r_proto ctime_r $hdrs
11527                 eval $hasproto ;;
11528         *)      ;;
11529         esac
11530         case "$d_ctime_r_proto" in
11531         define)
11532         case "$ctime_r_proto" in
11533         ''|0) try='char* ctime_r(const time_t*, char*);'
11534         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11535         esac
11536         case "$ctime_r_proto" in
11537         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11538         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11539         esac
11540         case "$ctime_r_proto" in
11541         ''|0) try='int ctime_r(const time_t*, char*);'
11542         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11543         esac
11544         case "$ctime_r_proto" in
11545         ''|0) try='int ctime_r(const time_t*, char*, int);'
11546         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11547         esac
11548         case "$ctime_r_proto" in
11549         ''|0)   d_ctime_r=undef
11550                 ctime_r_proto=0
11551                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11552         * )     case "$ctime_r_proto" in
11553                 REENTRANT_PROTO*) ;;
11554                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11555                 esac
11556                 echo "Prototype: $try" ;;
11557         esac
11558         ;;
11559         *)      case "$usethreads" in
11560                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11561                 esac
11562                 d_ctime_r=undef
11563                 ctime_r_proto=0
11564                 ;;
11565         esac
11566         ;;
11567 *)      ctime_r_proto=0
11568         ;;
11569 esac
11570
11571 : see if cuserid exists
11572 set cuserid d_cuserid
11573 eval $inlibc
11574
11575 : see if this is a limits.h system
11576 set limits.h i_limits
11577 eval $inhdr
11578
11579 : see if this is a float.h system
11580 set float.h i_float
11581 eval $inhdr
11582
11583 : See if number of significant digits in a double precision number is known
11584 echo " "
11585 $cat >dbl_dig.c <<EOM
11586 #$i_limits I_LIMITS
11587 #$i_float I_FLOAT
11588 #ifdef I_LIMITS
11589 #include <limits.h>
11590 #endif
11591 #ifdef I_FLOAT
11592 #include <float.h>
11593 #endif
11594 #ifdef DBL_DIG
11595 printf("Contains DBL_DIG");
11596 #endif
11597 EOM
11598 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11599 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11600         echo "DBL_DIG found." >&4
11601         val="$define"
11602 else
11603         echo "DBL_DIG NOT found." >&4
11604         val="$undef"
11605 fi
11606 $rm -f dbl_dig.?
11607 set d_dbl_dig
11608 eval $setvar
11609
11610 : see if dbm.h is available
11611 : see if dbmclose exists
11612 set dbmclose d_dbmclose
11613 eval $inlibc
11614
11615 case "$d_dbmclose" in
11616 $define)
11617         set dbm.h i_dbm
11618         eval $inhdr
11619         case "$i_dbm" in
11620         $define)
11621                 val="$undef"
11622                 set i_rpcsvcdbm
11623                 eval $setvar
11624                 ;;
11625         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11626                 eval $inhdr
11627                 ;;
11628         esac
11629         ;;
11630 *)      echo "We won't be including <dbm.h>"
11631         val="$undef"
11632         set i_dbm
11633         eval $setvar
11634         val="$undef"
11635         set i_rpcsvcdbm
11636         eval $setvar
11637         ;;
11638 esac
11639
11640 : see if prototype for dbminit is available
11641 echo " "
11642 set d_dbminitproto dbminit $i_dbm dbm.h
11643 eval $hasproto
11644
11645 : see if difftime exists
11646 set difftime d_difftime
11647 eval $inlibc
11648
11649 : see if this is a dirent system
11650 echo " "
11651 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11652         val="$define"
11653         echo "<dirent.h> found." >&4
11654 else
11655         val="$undef"
11656         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11657                 echo "<sys/dir.h> found." >&4
11658                 echo " "
11659         else
11660                 xinc=`./findhdr sys/ndir.h`
11661         fi
11662         echo "<dirent.h> NOT found." >&4
11663 fi
11664 set i_dirent
11665 eval $setvar
11666
11667 : Look for type of directory structure.
11668 echo " "
11669 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11670
11671 case "$direntrytype" in
11672 ''|' ')
11673         case "$i_dirent" in
11674         $define) guess1='struct dirent' ;;
11675         *) guess1='struct direct'  ;;
11676         esac
11677         ;;
11678 *)      guess1="$direntrytype"
11679         ;;
11680 esac
11681
11682 case "$guess1" in
11683 'struct dirent') guess2='struct direct' ;;
11684 *) guess2='struct dirent' ;;
11685 esac
11686
11687 if $contains "$guess1" try.c >/dev/null 2>&1; then
11688         direntrytype="$guess1"
11689         echo "Your directory entries are $direntrytype." >&4
11690 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11691         direntrytype="$guess2"
11692         echo "Your directory entries seem to be $direntrytype." >&4
11693 else
11694         echo "I don't recognize your system's directory entries." >&4
11695         rp="What type is used for directory entries on this system?"
11696         dflt="$guess1"
11697         . ./myread
11698         direntrytype="$ans"
11699 fi
11700 $rm_try
11701
11702 : see if the directory entry stores field length
11703 echo " "
11704 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11705 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11706         echo "Good, your directory entry keeps length information in d_namlen." >&4
11707         val="$define"
11708 else
11709         echo "Your directory entry does not know about the d_namlen field." >&4
11710         val="$undef"
11711 fi
11712 set d_dirnamlen
11713 eval $setvar
11714 $rm_try
11715
11716 : Look for DIR.dd_fd
11717 case "$i_dirent" in
11718 "$define")
11719     echo "Checking to see if DIR has a dd_fd member variable" >&4
11720     $cat >try.c <<EOCP
11721 #$i_stdlib I_STDLIB
11722 #ifdef I_STDLIB
11723 #include <stdlib.h>
11724 #endif
11725 #include <dirent.h>
11726
11727 int main() {
11728     DIR dir;
11729     dir.dd_fd = 1;
11730     return 0;
11731 }
11732 EOCP
11733     val=$undef
11734     set try
11735     if eval $compile; then
11736         echo "Yes, it does."
11737         val="$define"
11738     else
11739         echo "No, it does not."
11740         val="$undef"
11741     fi
11742     ;;
11743 *)
11744     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11745     val="$undef"
11746     ;;
11747 esac
11748 set d_dir_dd_fd
11749 eval $setvar
11750 $rm_try
11751
11752 : see if this is an sysdir system
11753 set sys/dir.h i_sysdir
11754 eval $inhdr
11755
11756 : see if this is an sysndir system
11757 set sys/ndir.h i_sysndir
11758 eval $inhdr
11759
11760 : Look for dirfd
11761 echo " "
11762 $cat >dirfd.c <<EOM
11763 #include <stdio.h>
11764 #$i_stdlib I_STDLIB
11765 #ifdef I_STDLIB
11766 #include <stdlib.h>
11767 #endif
11768 #$i_dirent I_DIRENT             /**/
11769 #$i_sysdir I_SYS_DIR            /**/
11770 #$i_sysndir I_SYS_NDIR          /**/
11771 #$i_systypes I_SYS_TYPES        /**/
11772 #if defined(I_SYS_TYPES)
11773 #include <sys/types.h>
11774 #endif
11775 #if defined(I_DIRENT)
11776 #include <dirent.h>
11777 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11778 #include <sys/dir.h>
11779 #endif
11780 #else
11781 #ifdef I_SYS_NDIR
11782 #include <sys/ndir.h>
11783 #else
11784 #ifdef I_SYS_DIR
11785 #ifdef hp9000s500
11786 #include <ndir.h>       /* may be wrong in the future */
11787 #else
11788 #include <sys/dir.h>
11789 #endif
11790 #endif
11791 #endif
11792 #endif 
11793 int main() {
11794         DIR *dirp = opendir(".");
11795         if (dirfd(dirp) >= 0)
11796                 exit(0);
11797         else
11798                 exit(1);
11799 }
11800 EOM
11801 val=$undef
11802 set dirfd
11803 if eval $compile; then
11804         val="$define"
11805 fi
11806 case "$val" in
11807 $define)        echo "dirfd() found." >&4       ;;
11808 *)              echo "dirfd() NOT found." >&4   ;;
11809 esac
11810 set d_dirfd
11811 eval $setvar
11812 $rm -f dirfd*
11813
11814 : see if dlerror exists
11815 xxx_runnm="$runnm"
11816 runnm=false
11817 set dlerror d_dlerror
11818 eval $inlibc
11819 runnm="$xxx_runnm"
11820
11821 : see if dlfcn is available
11822 set dlfcn.h i_dlfcn
11823 eval $inhdr
11824
11825 : Check what extension to use for shared libs
11826 case "$usedl" in
11827 $define|y|true)
11828         $cat << EOM
11829
11830 On a few systems, the dynamically loaded modules that perl generates and uses
11831 will need a different extension than shared libs. The default will probably
11832 be appropriate.
11833
11834 EOM
11835         case "$dlext" in
11836         '')     dflt="$so" ;;
11837         *)      dflt="$dlext" ;;
11838         esac
11839         rp='What is the extension of dynamically loaded modules'
11840         . ./myread
11841         dlext="$ans"
11842         ;;
11843 *)
11844         dlext="none"
11845         ;;
11846 esac
11847
11848 : Check if dlsym need a leading underscore
11849 echo " "
11850 val="$undef"
11851
11852 case "$dlsrc" in
11853 dl_dlopen.xs)
11854         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11855         $cat >dyna.c <<'EOM'
11856 fred () { }
11857 EOM
11858
11859 $cat >fred.c<<EOM
11860
11861 #include <stdio.h>
11862 #$i_stdlib I_STDLIB
11863 #ifdef I_STDLIB
11864 #include <stdlib.h>
11865 #endif
11866 #$i_dlfcn I_DLFCN
11867 #ifdef I_DLFCN
11868 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11869 #else
11870 #include <sys/types.h>
11871 #include <nlist.h>
11872 #include <link.h>
11873 #endif
11874
11875 extern int fred() ;
11876
11877 int main()
11878 {
11879     void * handle ;
11880     void * symbol ;
11881 #ifndef RTLD_LAZY
11882     int mode = 1 ;
11883 #else
11884     int mode = RTLD_LAZY ;
11885 #endif
11886     handle = dlopen("./dyna.$dlext", mode) ;
11887     if (handle == NULL) {
11888         printf ("1\n") ;
11889         fflush (stdout) ;
11890         exit(0);
11891     }
11892     symbol = dlsym(handle, "fred") ;
11893     if (symbol == NULL) {
11894         /* try putting a leading underscore */
11895         symbol = dlsym(handle, "_fred") ;
11896         if (symbol == NULL) {
11897             printf ("2\n") ;
11898             fflush (stdout) ;
11899             exit(0);
11900         }
11901         printf ("3\n") ;
11902     }
11903     else
11904         printf ("4\n") ;
11905     fflush (stdout) ;
11906     exit(0);
11907 }
11908 EOM
11909         : Call the object file tmp-dyna.o in case dlext=o.
11910         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11911                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11912                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11913                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11914                 xxx=`$run ./fred`
11915                 case $xxx in
11916                 1)      echo "Test program failed using dlopen." >&4
11917                         echo "Perhaps you should not use dynamic loading." >&4;;
11918                 2)      echo "Test program failed using dlsym." >&4
11919                         echo "Perhaps you should not use dynamic loading." >&4;;
11920                 3)      echo "dlsym needs a leading underscore" >&4
11921                         val="$define" ;;
11922                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11923                 esac
11924         else
11925                 echo "I can't compile and run the test program." >&4
11926                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11927         fi
11928         ;;
11929 esac
11930
11931 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11932
11933 set d_dlsymun
11934 eval $setvar
11935
11936 : see if drand48_r exists
11937 set drand48_r d_drand48_r
11938 eval $inlibc
11939 case "$d_drand48_r" in
11940 "$define")
11941         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11942         case "$d_drand48_r_proto:$usethreads" in
11943         ":define")      d_drand48_r_proto=define
11944                 set d_drand48_r_proto drand48_r $hdrs
11945                 eval $hasproto ;;
11946         *)      ;;
11947         esac
11948         case "$d_drand48_r_proto" in
11949         define)
11950         case "$drand48_r_proto" in
11951         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11952         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
11953         esac
11954         case "$drand48_r_proto" in
11955         ''|0)   d_drand48_r=undef
11956                 drand48_r_proto=0
11957                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11958         * )     case "$drand48_r_proto" in
11959                 REENTRANT_PROTO*) ;;
11960                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11961                 esac
11962                 echo "Prototype: $try" ;;
11963         esac
11964         ;;
11965         *)      case "$usethreads" in
11966                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11967                 esac
11968                 d_drand48_r=undef
11969                 drand48_r_proto=0
11970                 ;;
11971         esac
11972         ;;
11973 *)      drand48_r_proto=0
11974         ;;
11975 esac
11976
11977 : see if prototype for drand48 is available
11978 echo " "
11979 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11980 eval $hasproto
11981
11982 : see if dup2 exists
11983 set dup2 d_dup2
11984 eval $inlibc
11985
11986 : see if eaccess exists
11987 set eaccess d_eaccess
11988 eval $inlibc
11989
11990 : see if endgrent exists
11991 set endgrent d_endgrent
11992 eval $inlibc
11993
11994 : see if this is an grp system
11995 set grp.h i_grp
11996 eval $inhdr
11997
11998 case "$i_grp" in
11999 $define)
12000         xxx=`./findhdr grp.h`
12001         $cppstdin $cppflags $cppminus < $xxx >$$.h
12002
12003         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12004                 val="$define"
12005         else
12006                 val="$undef"
12007         fi
12008         set d_grpasswd
12009         eval $setvar
12010
12011         $rm -f $$.h
12012         ;;
12013 *)
12014         val="$undef";
12015         set d_grpasswd; eval $setvar
12016         ;;
12017 esac
12018
12019 : see if endgrent_r exists
12020 set endgrent_r d_endgrent_r
12021 eval $inlibc
12022 case "$d_endgrent_r" in
12023 "$define")
12024         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12025         case "$d_endgrent_r_proto:$usethreads" in
12026         ":define")      d_endgrent_r_proto=define
12027                 set d_endgrent_r_proto endgrent_r $hdrs
12028                 eval $hasproto ;;
12029         *)      ;;
12030         esac
12031         case "$d_endgrent_r_proto" in
12032         define)
12033         case "$endgrent_r_proto" in
12034         ''|0) try='int endgrent_r(FILE**);'
12035         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12036         esac
12037         case "$endgrent_r_proto" in
12038         ''|0) try='void endgrent_r(FILE**);'
12039         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12040         esac
12041         case "$endgrent_r_proto" in
12042         ''|0)   d_endgrent_r=undef
12043                 endgrent_r_proto=0
12044                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12045         * )     case "$endgrent_r_proto" in
12046                 REENTRANT_PROTO*) ;;
12047                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12048                 esac
12049                 echo "Prototype: $try" ;;
12050         esac
12051         ;;
12052         *)      case "$usethreads" in
12053                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12054                 esac
12055                 d_endgrent_r=undef
12056                 endgrent_r_proto=0
12057                 ;;
12058         esac
12059         ;;
12060 *)      endgrent_r_proto=0
12061         ;;
12062 esac
12063
12064 : see if endhostent exists
12065 set endhostent d_endhent
12066 eval $inlibc
12067
12068 : see if this is a netdb.h system
12069 set netdb.h i_netdb
12070 eval $inhdr
12071
12072 : see if endhostent_r exists
12073 set endhostent_r d_endhostent_r
12074 eval $inlibc
12075 case "$d_endhostent_r" in
12076 "$define")
12077         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12078         case "$d_endhostent_r_proto:$usethreads" in
12079         ":define")      d_endhostent_r_proto=define
12080                 set d_endhostent_r_proto endhostent_r $hdrs
12081                 eval $hasproto ;;
12082         *)      ;;
12083         esac
12084         case "$d_endhostent_r_proto" in
12085         define)
12086         case "$endhostent_r_proto" in
12087         ''|0) try='int endhostent_r(struct hostent_data*);'
12088         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12089         esac
12090         case "$endhostent_r_proto" in
12091         ''|0) try='void endhostent_r(struct hostent_data*);'
12092         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12093         esac
12094         case "$endhostent_r_proto" in
12095         ''|0)   d_endhostent_r=undef
12096                 endhostent_r_proto=0
12097                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12098         * )     case "$endhostent_r_proto" in
12099                 REENTRANT_PROTO*) ;;
12100                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12101                 esac
12102                 echo "Prototype: $try" ;;
12103         esac
12104         ;;
12105         *)      case "$usethreads" in
12106                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12107                 esac
12108                 d_endhostent_r=undef
12109                 endhostent_r_proto=0
12110                 ;;
12111         esac
12112         ;;
12113 *)      endhostent_r_proto=0
12114         ;;
12115 esac
12116
12117 : see if endnetent exists
12118 set endnetent d_endnent
12119 eval $inlibc
12120
12121 : see if endnetent_r exists
12122 set endnetent_r d_endnetent_r
12123 eval $inlibc
12124 case "$d_endnetent_r" in
12125 "$define")
12126         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12127         case "$d_endnetent_r_proto:$usethreads" in
12128         ":define")      d_endnetent_r_proto=define
12129                 set d_endnetent_r_proto endnetent_r $hdrs
12130                 eval $hasproto ;;
12131         *)      ;;
12132         esac
12133         case "$d_endnetent_r_proto" in
12134         define)
12135         case "$endnetent_r_proto" in
12136         ''|0) try='int endnetent_r(struct netent_data*);'
12137         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12138         esac
12139         case "$endnetent_r_proto" in
12140         ''|0) try='void endnetent_r(struct netent_data*);'
12141         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12142         esac
12143         case "$endnetent_r_proto" in
12144         ''|0)   d_endnetent_r=undef
12145                 endnetent_r_proto=0
12146                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12147         * )     case "$endnetent_r_proto" in
12148                 REENTRANT_PROTO*) ;;
12149                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12150                 esac
12151                 echo "Prototype: $try" ;;
12152         esac
12153         ;;
12154         *)      case "$usethreads" in
12155                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12156                 esac
12157                 d_endnetent_r=undef
12158                 endnetent_r_proto=0
12159                 ;;
12160         esac
12161         ;;
12162 *)      endnetent_r_proto=0
12163         ;;
12164 esac
12165
12166 : see if endprotoent exists
12167 set endprotoent d_endpent
12168 eval $inlibc
12169
12170 : see if endprotoent_r exists
12171 set endprotoent_r d_endprotoent_r
12172 eval $inlibc
12173 case "$d_endprotoent_r" in
12174 "$define")
12175         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12176         case "$d_endprotoent_r_proto:$usethreads" in
12177         ":define")      d_endprotoent_r_proto=define
12178                 set d_endprotoent_r_proto endprotoent_r $hdrs
12179                 eval $hasproto ;;
12180         *)      ;;
12181         esac
12182         case "$d_endprotoent_r_proto" in
12183         define)
12184         case "$endprotoent_r_proto" in
12185         ''|0) try='int endprotoent_r(struct protoent_data*);'
12186         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12187         esac
12188         case "$endprotoent_r_proto" in
12189         ''|0) try='void endprotoent_r(struct protoent_data*);'
12190         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12191         esac
12192         case "$endprotoent_r_proto" in
12193         ''|0)   d_endprotoent_r=undef
12194                 endprotoent_r_proto=0
12195                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12196         * )     case "$endprotoent_r_proto" in
12197                 REENTRANT_PROTO*) ;;
12198                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12199                 esac
12200                 echo "Prototype: $try" ;;
12201         esac
12202         ;;
12203         *)      case "$usethreads" in
12204                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12205                 esac
12206                 d_endprotoent_r=undef
12207                 endprotoent_r_proto=0
12208                 ;;
12209         esac
12210         ;;
12211 *)      endprotoent_r_proto=0
12212         ;;
12213 esac
12214
12215 : see if endpwent exists
12216 set endpwent d_endpwent
12217 eval $inlibc
12218
12219 : see if this is a pwd.h system
12220 set pwd.h i_pwd
12221 eval $inhdr
12222
12223 case "$i_pwd" in
12224 $define)
12225         xxx=`./findhdr pwd.h`
12226         $cppstdin $cppflags $cppminus < $xxx >$$.h
12227
12228         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12229                 val="$define"
12230         else
12231                 val="$undef"
12232         fi
12233         set d_pwquota
12234         eval $setvar
12235
12236         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12237                 val="$define"
12238         else
12239                 val="$undef"
12240         fi
12241         set d_pwage
12242         eval $setvar
12243
12244         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12245                 val="$define"
12246         else
12247                 val="$undef"
12248         fi
12249         set d_pwchange
12250         eval $setvar
12251
12252         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12253                 val="$define"
12254         else
12255                 val="$undef"
12256         fi
12257         set d_pwclass
12258         eval $setvar
12259
12260         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12261                 val="$define"
12262         else
12263                 val="$undef"
12264         fi
12265         set d_pwexpire
12266         eval $setvar
12267
12268         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12269                 val="$define"
12270         else
12271                 val="$undef"
12272         fi
12273         set d_pwcomment
12274         eval $setvar
12275
12276         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12277                 val="$define"
12278         else
12279                 val="$undef"
12280         fi
12281         set d_pwgecos
12282         eval $setvar
12283
12284         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12285                 val="$define"
12286         else
12287                 val="$undef"
12288         fi
12289         set d_pwpasswd
12290         eval $setvar
12291
12292         $rm -f $$.h
12293         ;;
12294 *)
12295         val="$undef"; 
12296         set d_pwquota; eval $setvar
12297         set d_pwage; eval $setvar
12298         set d_pwchange; eval $setvar
12299         set d_pwclass; eval $setvar
12300         set d_pwexpire; eval $setvar
12301         set d_pwcomment; eval $setvar
12302         set d_pwgecos; eval $setvar
12303         set d_pwpasswd; eval $setvar
12304         ;;
12305 esac
12306
12307 : see if endpwent_r exists
12308 set endpwent_r d_endpwent_r
12309 eval $inlibc
12310 case "$d_endpwent_r" in
12311 "$define")
12312         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12313         case "$d_endpwent_r_proto:$usethreads" in
12314         ":define")      d_endpwent_r_proto=define
12315                 set d_endpwent_r_proto endpwent_r $hdrs
12316                 eval $hasproto ;;
12317         *)      ;;
12318         esac
12319         case "$d_endpwent_r_proto" in
12320         define)
12321         case "$endpwent_r_proto" in
12322         ''|0) try='int endpwent_r(FILE**);'
12323         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12324         esac
12325         case "$endpwent_r_proto" in
12326         ''|0) try='void endpwent_r(FILE**);'
12327         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12328         esac
12329         case "$endpwent_r_proto" in
12330         ''|0)   d_endpwent_r=undef
12331                 endpwent_r_proto=0
12332                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12333         * )     case "$endpwent_r_proto" in
12334                 REENTRANT_PROTO*) ;;
12335                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12336                 esac
12337                 echo "Prototype: $try" ;;
12338         esac
12339         ;;
12340         *)      case "$usethreads" in
12341                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12342                 esac
12343                 d_endpwent_r=undef
12344                 endpwent_r_proto=0
12345                 ;;
12346         esac
12347         ;;
12348 *)      endpwent_r_proto=0
12349         ;;
12350 esac
12351
12352 : see if endservent exists
12353 set endservent d_endsent
12354 eval $inlibc
12355
12356 : see if endservent_r exists
12357 set endservent_r d_endservent_r
12358 eval $inlibc
12359 case "$d_endservent_r" in
12360 "$define")
12361         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12362         case "$d_endservent_r_proto:$usethreads" in
12363         ":define")      d_endservent_r_proto=define
12364                 set d_endservent_r_proto endservent_r $hdrs
12365                 eval $hasproto ;;
12366         *)      ;;
12367         esac
12368         case "$d_endservent_r_proto" in
12369         define)
12370         case "$endservent_r_proto" in
12371         ''|0) try='int endservent_r(struct servent_data*);'
12372         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12373         esac
12374         case "$endservent_r_proto" in
12375         ''|0) try='void endservent_r(struct servent_data*);'
12376         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12377         esac
12378         case "$endservent_r_proto" in
12379         ''|0)   d_endservent_r=undef
12380                 endservent_r_proto=0
12381                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12382         * )     case "$endservent_r_proto" in
12383                 REENTRANT_PROTO*) ;;
12384                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12385                 esac
12386                 echo "Prototype: $try" ;;
12387         esac
12388         ;;
12389         *)      case "$usethreads" in
12390                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12391                 esac
12392                 d_endservent_r=undef
12393                 endservent_r_proto=0
12394                 ;;
12395         esac
12396         ;;
12397 *)      endservent_r_proto=0
12398         ;;
12399 esac
12400
12401 : Locate the flags for 'open()'
12402 echo " "
12403 $cat >try.c <<EOCP
12404 #include <sys/types.h>
12405 #ifdef I_FCNTL
12406 #include <fcntl.h>
12407 #endif
12408 #ifdef I_SYS_FILE
12409 #include <sys/file.h>
12410 #endif
12411 #$i_stdlib I_STDLIB
12412 #ifdef I_STDLIB
12413 #include <stdlib.h>
12414 #endif
12415 int main() {
12416         if(O_RDONLY);
12417 #ifdef O_TRUNC
12418         exit(0);
12419 #else
12420         exit(1);
12421 #endif
12422 }
12423 EOCP
12424 : check sys/file.h first to get FREAD on Sun
12425 if $test `./findhdr sys/file.h` && \
12426                 set try -DI_SYS_FILE && eval $compile; then
12427         h_sysfile=true;
12428         echo "<sys/file.h> defines the O_* constants..." >&4
12429         if $run ./try; then
12430                 echo "and you have the 3 argument form of open()." >&4
12431                 val="$define"
12432         else
12433                 echo "but not the 3 argument form of open().  Oh, well." >&4
12434                 val="$undef"
12435         fi
12436 elif $test `./findhdr fcntl.h` && \
12437                 set try -DI_FCNTL && eval $compile; then
12438         h_fcntl=true;
12439         echo "<fcntl.h> defines the O_* constants..." >&4
12440         if $run ./try; then
12441                 echo "and you have the 3 argument form of open()." >&4
12442                 val="$define"
12443         else
12444                 echo "but not the 3 argument form of open().  Oh, well." >&4
12445                 val="$undef"
12446         fi
12447 else
12448         val="$undef"
12449         echo "I can't find the O_* constant definitions!  You got problems." >&4
12450 fi
12451 set d_open3
12452 eval $setvar
12453 $rm_try
12454
12455 : see if this is a sys/file.h system
12456 val=''
12457 set sys/file.h val
12458 eval $inhdr
12459
12460 : do we need to include sys/file.h ?
12461 case "$val" in
12462 "$define")
12463         echo " "
12464         if $h_sysfile; then
12465                 val="$define"
12466                 echo "We'll be including <sys/file.h>." >&4
12467         else
12468                 val="$undef"
12469                 echo "We won't be including <sys/file.h>." >&4
12470         fi
12471         ;;
12472 *)
12473         h_sysfile=false
12474         ;;
12475 esac
12476 set i_sysfile
12477 eval $setvar
12478
12479 : see if fcntl.h is there
12480 val=''
12481 set fcntl.h val
12482 eval $inhdr
12483
12484 : see if we can include fcntl.h
12485 case "$val" in
12486 "$define")
12487         echo " "
12488         if $h_fcntl; then
12489                 val="$define"
12490                 echo "We'll be including <fcntl.h>." >&4
12491         else
12492                 val="$undef"
12493                 if $h_sysfile; then
12494         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12495                 else
12496                         echo "We won't be including <fcntl.h>." >&4
12497                 fi
12498         fi
12499         ;;
12500 *)
12501         h_fcntl=false
12502         val="$undef"
12503         ;;
12504 esac
12505 set i_fcntl
12506 eval $setvar
12507
12508 : see if fork exists
12509 set fork d_fork
12510 eval $inlibc
12511
12512 : see if pipe exists
12513 set pipe d_pipe
12514 eval $inlibc
12515
12516 : check for non-blocking I/O stuff
12517 case "$h_sysfile" in
12518 true) echo "#include <sys/file.h>" > head.c;;
12519 *)
12520        case "$h_fcntl" in
12521        true) echo "#include <fcntl.h>" > head.c;;
12522        *) echo "#include <sys/fcntl.h>" > head.c;;
12523        esac
12524        ;;
12525 esac
12526 echo " "
12527 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12528 case "$o_nonblock" in
12529 '')
12530         $cat head.c > try.c
12531         $cat >>try.c <<EOCP
12532 #include <stdio.h>
12533 #$i_stdlib I_STDLIB
12534 #ifdef I_STDLIB
12535 #include <stdlib.h>
12536 #endif
12537 #$i_fcntl I_FCNTL
12538 #ifdef I_FCNTL
12539 #include <fcntl.h>
12540 #endif
12541 int main() {
12542 #ifdef O_NONBLOCK
12543         printf("O_NONBLOCK\n");
12544         exit(0);
12545 #endif
12546 #ifdef O_NDELAY
12547         printf("O_NDELAY\n");
12548         exit(0);
12549 #endif
12550 #ifdef FNDELAY
12551         printf("FNDELAY\n");
12552         exit(0);
12553 #endif
12554         exit(0);
12555 }
12556 EOCP
12557         set try
12558         if eval $compile_ok; then
12559                 o_nonblock=`$run ./try`
12560                 case "$o_nonblock" in
12561                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12562                 *) echo "Seems like we can use $o_nonblock.";;
12563                 esac
12564         else
12565                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12566         fi
12567         ;;
12568 *) echo "Using $hint value $o_nonblock.";;
12569 esac
12570 $rm_try
12571
12572 echo " "
12573 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12574 case "$eagain" in
12575 '')
12576         case "$d_fork:$d_pipe" in
12577         define:define)
12578         $cat head.c > try.c
12579         $cat >>try.c <<EOCP
12580 #include <errno.h>
12581 #include <sys/types.h>
12582 #include <signal.h>
12583 #include <stdio.h>
12584 #$i_stdlib I_STDLIB
12585 #ifdef I_STDLIB
12586 #include <stdlib.h>
12587 #endif
12588 #$i_fcntl I_FCNTL
12589 #ifdef I_FCNTL
12590 #include <fcntl.h>
12591 #endif
12592 #define MY_O_NONBLOCK $o_nonblock
12593 #ifndef errno  /* XXX need better Configure test */
12594 extern int errno;
12595 #endif
12596 #$i_unistd I_UNISTD
12597 #ifdef I_UNISTD
12598 #include <unistd.h>
12599 #endif
12600 #$i_string I_STRING
12601 #ifdef I_STRING
12602 #include <string.h>
12603 #else
12604 #include <strings.h>
12605 #endif
12606 $signal_t blech(int x) { exit(3); }
12607 EOCP
12608         $cat >> try.c <<'EOCP'
12609 int main()
12610 {
12611         int pd[2];
12612         int pu[2];
12613         char buf[1];
12614         char string[100];
12615
12616         pipe(pd);       /* Down: child -> parent */
12617         pipe(pu);       /* Up: parent -> child */
12618         if (0 != fork()) {
12619                 int ret;
12620                 close(pd[1]);   /* Parent reads from pd[0] */
12621                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12622 #ifdef F_SETFL
12623                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12624                         exit(1);
12625 #else
12626                 exit(4);
12627 #endif
12628                 signal(SIGALRM, blech);
12629                 alarm(5);
12630                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12631                         exit(2);
12632                 sprintf(string, "%d\n", ret);
12633                 write(2, string, strlen(string));
12634                 alarm(0);
12635 #ifdef EAGAIN
12636                 if (errno == EAGAIN) {
12637                         printf("EAGAIN\n");
12638                         goto ok;
12639                 }
12640 #endif
12641 #ifdef EWOULDBLOCK
12642                 if (errno == EWOULDBLOCK)
12643                         printf("EWOULDBLOCK\n");
12644 #endif
12645         ok:
12646                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12647                 sleep(2);                               /* Give it time to close our pipe */
12648                 alarm(5);
12649                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12650                 alarm(0);
12651                 sprintf(string, "%d\n", ret);
12652                 write(4, string, strlen(string));
12653                 exit(0);
12654         }
12655
12656         close(pd[0]);                   /* We write to pd[1] */
12657         close(pu[1]);                   /* We read from pu[0] */
12658         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12659         close(pd[1]);                   /* Pipe pd is now fully closed! */
12660         exit(0);                                /* Bye bye, thank you for playing! */
12661 }
12662 EOCP
12663         set try
12664         if eval $compile_ok; then
12665                 echo "$startsh" >mtry
12666                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12667                 chmod +x mtry
12668                 ./mtry >/dev/null 2>&1
12669                 case $? in
12670                 0) eagain=`$cat try.out`;;
12671                 1) echo "Could not perform non-blocking setting!";;
12672                 2) echo "I did a successful read() for something that was not there!";;
12673                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12674                 4) echo "Could not find F_SETFL!";;
12675                 *) echo "Something terribly wrong happened during testing.";;
12676                 esac
12677                 rd_nodata=`$cat try.ret`
12678                 echo "A read() system call with no data present returns $rd_nodata."
12679                 case "$rd_nodata" in
12680                 0|-1) ;;
12681                 *)
12682                         echo "(That's peculiar, fixing that to be -1.)"
12683                         rd_nodata=-1
12684                         ;;
12685                 esac
12686                 case "$eagain" in
12687                 '')
12688                         echo "Forcing errno EAGAIN on read() with no data available."
12689                         eagain=EAGAIN
12690                         ;;
12691                 *)
12692                         echo "Your read() sets errno to $eagain when no data is available."
12693                         ;;
12694                 esac
12695                 status=`$cat try.err`
12696                 case "$status" in
12697                 0) echo "And it correctly returns 0 to signal EOF.";;
12698                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12699                 *) echo "However, your read() returns '$status' on EOF??";;
12700                 esac
12701                 val="$define"
12702                 if test "$status" = "$rd_nodata"; then
12703                         echo "WARNING: you can't distinguish between EOF and no data!"
12704                         val="$undef"
12705                 fi
12706         else
12707                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12708                 eagain=EAGAIN
12709         fi
12710         ;;
12711         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12712                 eagain=EAGAIN
12713                 val="$define"
12714                 ;;
12715         esac
12716         set d_eofnblk
12717         eval $setvar
12718         ;;
12719 *)
12720         echo "Using $hint value $eagain."
12721         echo "Your read() returns $rd_nodata when no data is present."
12722         case "$d_eofnblk" in
12723         "$define") echo "And you can see EOF because read() returns 0.";;
12724         "$undef") echo "But you can't see EOF status from read() returned value.";;
12725         *)
12726                 echo "(Assuming you can't see EOF status from read anyway.)"
12727                 d_eofnblk=$undef
12728                 ;;
12729         esac
12730         ;;
12731 esac
12732 $rm_try head.c mtry
12733
12734 : see if _ptr and _cnt from stdio act std
12735 echo " "
12736
12737 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12738         echo "(Looks like you have stdio.h from BSD.)"
12739         case "$stdio_ptr" in
12740         '') stdio_ptr='((fp)->_p)'
12741                 ptr_lval=$define
12742                 ;;
12743         *)      ptr_lval=$d_stdio_ptr_lval;;
12744         esac
12745         case "$stdio_cnt" in
12746         '') stdio_cnt='((fp)->_r)'
12747                 cnt_lval=$define
12748                 ;;
12749         *)      cnt_lval=$d_stdio_cnt_lval;;
12750         esac
12751         case "$stdio_base" in
12752         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12753         esac
12754         case "$stdio_bufsiz" in
12755         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12756         esac
12757 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12758         echo "(Looks like you have stdio.h from Linux.)"
12759         case "$stdio_ptr" in
12760         '') stdio_ptr='((fp)->_IO_read_ptr)'
12761                 ptr_lval=$define
12762                 ;;
12763         *)      ptr_lval=$d_stdio_ptr_lval;;
12764         esac
12765         case "$stdio_cnt" in
12766         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12767                 cnt_lval=$undef
12768                 ;;
12769         *)      cnt_lval=$d_stdio_cnt_lval;;
12770         esac
12771         case "$stdio_base" in
12772         '') stdio_base='((fp)->_IO_read_base)';;
12773         esac
12774         case "$stdio_bufsiz" in
12775         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12776         esac
12777 else
12778         case "$stdio_ptr" in
12779         '') stdio_ptr='((fp)->_ptr)'
12780                 ptr_lval=$define
12781                 ;;
12782         *)      ptr_lval=$d_stdio_ptr_lval;;
12783         esac
12784         case "$stdio_cnt" in
12785         '') stdio_cnt='((fp)->_cnt)'
12786                 cnt_lval=$define
12787                 ;;
12788         *)      cnt_lval=$d_stdio_cnt_lval;;
12789         esac
12790         case "$stdio_base" in
12791         '') stdio_base='((fp)->_base)';;
12792         esac
12793         case "$stdio_bufsiz" in
12794         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12795         esac
12796 fi
12797
12798 : test whether _ptr and _cnt really work
12799 echo "Checking how std your stdio is..." >&4
12800 $cat >try.c <<EOP
12801 #include <stdio.h>
12802 #$i_stdlib I_STDLIB
12803 #ifdef I_STDLIB
12804 #include <stdlib.h>
12805 #endif
12806 #define FILE_ptr(fp)    $stdio_ptr
12807 #define FILE_cnt(fp)    $stdio_cnt
12808 int main() {
12809         FILE *fp = fopen("try.c", "r");
12810         char c = getc(fp);
12811         if (
12812                 18 <= FILE_cnt(fp) &&
12813                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12814         )
12815                 exit(0);
12816         exit(1);
12817 }
12818 EOP
12819 val="$undef"
12820 set try
12821 if eval $compile && $to try.c; then
12822         if $run ./try; then
12823                 echo "Your stdio acts pretty std."
12824                 val="$define"
12825         else
12826                 echo "Your stdio isn't very std."
12827         fi
12828 else
12829         echo "Your stdio doesn't appear very std."
12830 fi
12831 $rm_try
12832
12833 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12834 # direct buffer manipulation no longer works.  The Configure tests
12835 # should be changed to correctly detect this, but until then,
12836 # the following check should at least let perl compile and run.
12837 # (This quick fix should be updated before 5.8.1.)
12838 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12839 # A. Dougherty, June 3, 2002.
12840 case "$d_gnulibc" in
12841 $define)
12842         case "$gnulibc_version" in
12843         2.[01]*)  ;;
12844         2.2) ;;
12845         2.2.[0-9]) ;;
12846         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12847                 val="$undef"
12848                 ;;
12849         esac
12850         ;;
12851 esac
12852 set d_stdstdio
12853 eval $setvar
12854
12855 : Can _ptr be used as an lvalue?
12856 case "$d_stdstdio$ptr_lval" in
12857 $define$define) val=$define ;;
12858 *) val=$undef ;;
12859 esac
12860 set d_stdio_ptr_lval
12861 eval $setvar
12862
12863 : Can _cnt be used as an lvalue?
12864 case "$d_stdstdio$cnt_lval" in
12865 $define$define) val=$define ;;
12866 *) val=$undef ;;
12867 esac
12868 set d_stdio_cnt_lval
12869 eval $setvar
12870
12871
12872 : test whether setting _ptr sets _cnt as a side effect
12873 d_stdio_ptr_lval_sets_cnt="$undef"
12874 d_stdio_ptr_lval_nochange_cnt="$undef"
12875 case "$d_stdio_ptr_lval$d_stdstdio" in
12876 $define$define)
12877         echo "Checking to see what happens if we set the stdio ptr..." >&4
12878 $cat >try.c <<EOP
12879 #include <stdio.h>
12880 /* Can we scream? */
12881 /* Eat dust sed :-) */
12882 /* In the buffer space, no one can hear you scream. */
12883 #$i_stdlib I_STDLIB
12884 #ifdef I_STDLIB
12885 #include <stdlib.h>
12886 #endif
12887 #define FILE_ptr(fp)    $stdio_ptr
12888 #define FILE_cnt(fp)    $stdio_cnt
12889 #include <sys/types.h>
12890 int main() {
12891         FILE *fp = fopen("try.c", "r");
12892         int c;
12893         char *ptr;
12894         size_t cnt;
12895         if (!fp) {
12896             puts("Fail even to read");
12897             exit(1);
12898         }
12899         c = getc(fp); /* Read away the first # */
12900         if (c == EOF) {
12901             puts("Fail even to read");
12902             exit(1);
12903         }
12904         if (!(
12905                 18 <= FILE_cnt(fp) &&
12906                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12907         )) {
12908                 puts("Fail even to read");
12909                 exit (1);
12910         }
12911         ptr = (char*) FILE_ptr(fp);
12912         cnt = (size_t)FILE_cnt(fp);
12913
12914         FILE_ptr(fp) += 42;
12915
12916         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12917                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12918                 exit (1);
12919         }
12920         if (FILE_cnt(fp) <= 20) {
12921                 printf ("Fail (<20 chars to test)");
12922                 exit (1);
12923         }
12924         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12925                 puts("Fail compare");
12926                 exit (1);
12927         }
12928         if (cnt == FILE_cnt(fp)) {
12929                 puts("Pass_unchanged");
12930                 exit (0);
12931         }
12932         if (FILE_cnt(fp) == (cnt - 42)) {
12933                 puts("Pass_changed");
12934                 exit (0);
12935         }
12936         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12937         return 1;
12938
12939 }
12940 EOP
12941         set try
12942         if eval $compile && $to try.c; then
12943                 case `$run ./try` in
12944                 Pass_changed)
12945                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12946                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12947                 Pass_unchanged)
12948                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12949                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12950                 Fail*)
12951                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12952                 *)
12953                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12954         esac
12955         else
12956                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12957         fi
12958         $rm_try
12959         ;;
12960 esac
12961
12962 : see if _base is also standard
12963 val="$undef"
12964 case "$d_stdstdio" in
12965 $define)
12966         $cat >try.c <<EOP
12967 #include <stdio.h>
12968 #$i_stdlib I_STDLIB
12969 #ifdef I_STDLIB
12970 #include <stdlib.h>
12971 #endif
12972 #define FILE_base(fp)   $stdio_base
12973 #define FILE_bufsiz(fp) $stdio_bufsiz
12974 int main() {
12975         FILE *fp = fopen("try.c", "r");
12976         char c = getc(fp);
12977         if (
12978                 19 <= FILE_bufsiz(fp) &&
12979                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12980         )
12981                 exit(0);
12982         exit(1);
12983 }
12984 EOP
12985         set try
12986         if eval $compile && $to try.c; then
12987                 if $run ./try; then
12988                         echo "And its _base field acts std."
12989                         val="$define"
12990                 else
12991                         echo "But its _base field isn't std."
12992                 fi
12993         else
12994                 echo "However, it seems to be lacking the _base field."
12995         fi
12996         $rm_try
12997         ;;
12998 esac
12999 set d_stdiobase
13000 eval $setvar
13001
13002 : see if fast_stdio exists
13003 val="$undef"
13004 case "$d_stdstdio:$d_stdio_ptr_lval" in
13005 "$define:$define")
13006         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13007         *$define*)
13008                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13009                 val="$define"
13010                 ;;
13011         esac
13012         ;;
13013 esac
13014 set d_faststdio
13015 eval $setvar
13016
13017
13018
13019 : see if fchdir exists
13020 set fchdir d_fchdir
13021 eval $inlibc
13022
13023 : see if fchmod exists
13024 set fchmod d_fchmod
13025 eval $inlibc
13026
13027 : see if fchown exists
13028 set fchown d_fchown
13029 eval $inlibc
13030
13031 : see if this is an fcntl system
13032 set fcntl d_fcntl
13033 eval $inlibc
13034
13035 : See if fcntl-based locking works.
13036 echo " "
13037 $cat >try.c <<EOCP
13038 #$i_stdlib I_STDLIB
13039 #ifdef I_STDLIB
13040 #include <stdlib.h>
13041 #endif
13042 #include <unistd.h>
13043 #include <fcntl.h>
13044 #include <signal.h>
13045 $signal_t blech(int x) { exit(3); }
13046 int main() {
13047 #if defined(F_SETLK) && defined(F_SETLKW)
13048      struct flock flock;
13049      int retval, fd;
13050      fd = open("try.c", O_RDONLY);
13051      flock.l_type = F_RDLCK;
13052      flock.l_whence = SEEK_SET;
13053      flock.l_start = flock.l_len = 0;
13054      signal(SIGALRM, blech);
13055      alarm(10);
13056      retval = fcntl(fd, F_SETLK, &flock);
13057      close(fd);
13058      (retval < 0 ? exit(2) : exit(0));
13059 #else
13060      exit(2);
13061 #endif
13062 }
13063 EOCP
13064 echo "Checking if fcntl-based file locking works... "
13065 case "$d_fcntl" in
13066 "$define")
13067         set try
13068         if eval $compile_ok; then
13069                 if $run ./try; then
13070                         echo "Yes, it seems to work."
13071                         val="$define"
13072                 else
13073                         echo "Nope, it didn't work."
13074                         val="$undef"
13075                         case "$?" in
13076                         3) $cat >&4 <<EOM
13077 ***
13078 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13079 *** This is (almost) impossible.
13080 *** If your NFS lock daemons are not feeling well, something like
13081 *** this may happen, please investigate.  Cannot continue, aborting.
13082 ***
13083 EOM
13084                                 exit 1
13085                                 ;;
13086                         esac
13087                 fi
13088         else
13089                 echo "I'm unable to compile the test program, so I'll assume not."
13090                 val="$undef"
13091         fi
13092         ;;
13093 *) val="$undef";
13094         echo "Nope, since you don't even have fcntl()."
13095         ;;
13096 esac
13097 set d_fcntl_can_lock
13098 eval $setvar
13099 $rm_try
13100
13101 : check for fd_set items
13102 $cat <<EOM
13103
13104 Checking to see how well your C compiler handles fd_set and friends ...
13105 EOM
13106 $cat >try.c <<EOCP
13107 #$i_stdlib I_STDLIB
13108 #ifdef I_STDLIB
13109 #include <stdlib.h>
13110 #endif
13111 #$i_systime I_SYS_TIME
13112 #$i_sysselct I_SYS_SELECT
13113 #$d_socket HAS_SOCKET
13114 #include <sys/types.h>
13115 #ifdef HAS_SOCKET
13116 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13117 #endif
13118 #ifdef I_SYS_TIME
13119 #include <sys/time.h>
13120 #endif
13121 #ifdef I_SYS_SELECT
13122 #include <sys/select.h>
13123 #endif
13124 int main() {
13125         fd_set fds;
13126
13127 #ifdef TRYBITS
13128         if(fds.fds_bits);
13129 #endif
13130
13131 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13132         exit(0);
13133 #else
13134         exit(1);
13135 #endif
13136 }
13137 EOCP
13138 set try -DTRYBITS
13139 if eval $compile; then
13140         d_fds_bits="$define"
13141         d_fd_set="$define"
13142         echo "Well, your system knows about the normal fd_set typedef..." >&4
13143         if $run ./try; then
13144                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13145                 d_fd_macros="$define"
13146         else
13147                 $cat >&4 <<'EOM'
13148 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13149 EOM
13150                 d_fd_macros="$undef"
13151         fi
13152 else
13153         $cat <<'EOM'
13154 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13155 EOM
13156         set try
13157         if eval $compile; then
13158                 d_fds_bits="$undef"
13159                 d_fd_set="$define"
13160                 echo "Well, your system has some sort of fd_set available..." >&4
13161                 if $run ./try; then
13162                         echo "and you have the normal fd_set macros." >&4
13163                         d_fd_macros="$define"
13164                 else
13165                         $cat <<'EOM'
13166 but not the normal fd_set macros!  Gross!  More work for me...
13167 EOM
13168                         d_fd_macros="$undef"
13169                 fi
13170         else
13171         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13172                 d_fd_set="$undef"
13173                 d_fds_bits="$undef"
13174                 d_fd_macros="$undef"
13175         fi
13176 fi
13177 $rm_try
13178
13179 : see if fgetpos exists
13180 set fgetpos d_fgetpos
13181 eval $inlibc
13182
13183 : see if finite exists
13184 set finite d_finite
13185 eval $inlibc
13186
13187 : see if finitel exists
13188 set finitel d_finitel
13189 eval $inlibc
13190
13191 : see if flock exists
13192 set flock d_flock
13193 eval $inlibc
13194
13195 : see if prototype for flock is available
13196 echo " "
13197 set d_flockproto flock $i_sysfile sys/file.h
13198 eval $hasproto
13199
13200 : see if fp_class exists
13201 set fp_class d_fp_class
13202 eval $inlibc
13203
13204 : see if pathconf exists
13205 set pathconf d_pathconf
13206 eval $inlibc
13207
13208 : see if fpathconf exists
13209 set fpathconf d_fpathconf
13210 eval $inlibc
13211
13212 : see if fpclass exists
13213 set fpclass d_fpclass
13214 eval $inlibc
13215
13216 : see if fpclassify exists
13217 set fpclassify d_fpclassify
13218 eval $inlibc
13219
13220 : see if fpclassl exists
13221 set fpclassl d_fpclassl
13222 eval $inlibc
13223
13224 : check for fpos64_t
13225 echo " "
13226 echo "Checking to see if you have fpos64_t..." >&4
13227 $cat >try.c <<EOCP
13228 #include <stdio.h>
13229 int main() { fpos64_t x = 7; }
13230 EOCP
13231 set try
13232 if eval $compile; then
13233         val="$define"
13234         echo "You have fpos64_t."
13235 else
13236         val="$undef"
13237         echo "You do not have fpos64_t."
13238         case "$fpossize" in
13239         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13240         esac
13241 fi
13242 $rm_try
13243 set d_fpos64_t
13244 eval $setvar
13245
13246 : see if frexpl exists
13247 set frexpl d_frexpl
13248 eval $inlibc
13249
13250 : see if this is a sys/param system
13251 set sys/param.h i_sysparam
13252 eval $inhdr
13253
13254 : see if this is a sys/mount.h system
13255 set sys/mount.h i_sysmount
13256 eval $inhdr
13257
13258 : Check for fs_data_s
13259 echo " "
13260 echo "Checking to see if your system supports struct fs_data..." >&4
13261 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13262 eval $hasstruct
13263 case "$d_fs_data_s" in
13264 "$define")      echo "Yes, it does."   ;;
13265 *)              echo "No, it doesn't." ;;
13266 esac
13267
13268 : see if fseeko exists
13269 set fseeko d_fseeko
13270 eval $inlibc
13271 case "$longsize" in
13272 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13273 esac
13274
13275 : see if fsetpos exists
13276 set fsetpos d_fsetpos
13277 eval $inlibc
13278
13279 : see if fstatfs exists
13280 set fstatfs d_fstatfs
13281 eval $inlibc
13282
13283 : see if statvfs exists
13284 set statvfs d_statvfs
13285 eval $inlibc
13286
13287 : see if fstatvfs exists
13288 set fstatvfs d_fstatvfs
13289 eval $inlibc
13290
13291
13292 : see if fsync exists
13293 set fsync d_fsync
13294 eval $inlibc
13295
13296 : see if ftello exists
13297 set ftello d_ftello
13298 eval $inlibc
13299 case "$longsize" in
13300 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13301 esac
13302
13303 : check for a working futimes
13304 d_futimes="$undef"
13305 echo " "
13306 echo "Checking if you have a working futimes()" >&4
13307 $cat >try.c <<EOCP
13308 #include <stdio.h>
13309 #include <sys/time.h>
13310 #include <errno.h>
13311 #include <fcntl.h>
13312
13313 int main ()
13314 {
13315     int fd, rv;
13316     fd = open ("try.c", O_RDWR);
13317     if (-1 == fd) exit (1);
13318     rv = futimes (fd, NULL);
13319     exit (rv == -1 ? errno : 0);
13320 }
13321 EOCP
13322 set try
13323 if eval $compile; then
13324     `$run ./try`
13325     rc=$?
13326     case "$rc" in
13327         0)  echo "Yes, you have" >&4
13328             d_futimes="$define"
13329             ;;
13330         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13331             ;;
13332     esac
13333 else
13334     echo "No, it does not (probably harmless)" >&4
13335 fi
13336 $rm_try
13337
13338 : see if ndbm.h is available
13339 set ndbm.h i_ndbm
13340 eval $inhdr
13341 : Compatibility location for RedHat 7.1
13342 set gdbm/ndbm.h i_gdbmndbm
13343 eval $inhdr
13344 : Compatibility location for Debian 4.0
13345 set gdbm-ndbm.h i_gdbm_ndbm
13346 eval $inhdr
13347
13348 val="$undef"
13349 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13350         : see if dbm_open exists
13351         set dbm_open d_dbm_open
13352         eval $inlibc
13353         case "$d_dbm_open" in
13354         $undef)
13355                 i_ndbm="$undef"
13356                 i_gdbmndbm="$undef"
13357                 i_gdbm_ndbm="$undef"
13358                 echo "We won't be including <ndbm.h>"
13359                 val="$undef"
13360                 ;;
13361         *) val="$define"
13362            ;;
13363         esac
13364 fi
13365 set d_ndbm
13366 eval $setvar
13367
13368 ndbm_hdr_protochk='name=$1; hdr=$2;
13369 eval "ihdr=\$""i_$name";
13370 val="$undef";
13371 if $test "$ihdr" = "$define"; then
13372         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13373         case "$d_cplusplus" in
13374         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13375         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13376         esac;
13377         case "$val" in
13378         $define) $echo "Your <$hdr> seems to have prototypes";;
13379         *) $echo "Your <$hdr> does not seem to have prototypes";;
13380         esac;
13381 fi;
13382 set "d_${name}_h_uses_prototypes";
13383 eval $setvar'
13384
13385 set ndbm ndbm.h
13386 eval $ndbm_hdr_protochk
13387 set gdbmndbm gdbm/ndbm.h
13388 eval $ndbm_hdr_protochk
13389 set gdbm_ndbm gdbm-ndbm.h
13390 eval $ndbm_hdr_protochk
13391
13392 : see if getaddrinfo exists
13393 set getaddrinfo d_getaddrinfo
13394 eval $inlibc
13395
13396 : see if getcwd exists
13397 set getcwd d_getcwd
13398 eval $inlibc
13399
13400 : see if getespwnam exists
13401 set getespwnam d_getespwnam
13402 eval $inlibc
13403
13404 : see if getfsstat exists
13405 set getfsstat d_getfsstat
13406 eval $inlibc
13407
13408 : see if getgrent exists
13409 set getgrent d_getgrent
13410 eval $inlibc
13411
13412 : see if getgrent_r exists
13413 set getgrent_r d_getgrent_r
13414 eval $inlibc
13415 case "$d_getgrent_r" in
13416 "$define")
13417         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13418         case "$d_getgrent_r_proto:$usethreads" in
13419         ":define")      d_getgrent_r_proto=define
13420                 set d_getgrent_r_proto getgrent_r $hdrs
13421                 eval $hasproto ;;
13422         *)      ;;
13423         esac
13424         case "$d_getgrent_r_proto" in
13425         define)
13426         case "$getgrent_r_proto" in
13427         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13428         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13429         esac
13430         case "$getgrent_r_proto" in
13431         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13432         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13433         esac
13434         case "$getgrent_r_proto" in
13435         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13436         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13437         esac
13438         case "$getgrent_r_proto" in
13439         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13440         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13441         esac
13442         case "$getgrent_r_proto" in
13443         ''|0) try='int getgrent_r(struct group*, char*, int);'
13444         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13445         esac
13446         case "$getgrent_r_proto" in
13447         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13448         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13449         esac
13450         case "$getgrent_r_proto" in
13451         ''|0)   d_getgrent_r=undef
13452                 getgrent_r_proto=0
13453                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13454         * )     case "$getgrent_r_proto" in
13455                 REENTRANT_PROTO*) ;;
13456                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13457                 esac
13458                 echo "Prototype: $try" ;;
13459         esac
13460         ;;
13461         *)      case "$usethreads" in
13462                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13463                 esac
13464                 d_getgrent_r=undef
13465                 getgrent_r_proto=0
13466                 ;;
13467         esac
13468         ;;
13469 *)      getgrent_r_proto=0
13470         ;;
13471 esac
13472
13473 : see if getgrgid_r exists
13474 set getgrgid_r d_getgrgid_r
13475 eval $inlibc
13476 case "$d_getgrgid_r" in
13477 "$define")
13478         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13479         case "$d_getgrgid_r_proto:$usethreads" in
13480         ":define")      d_getgrgid_r_proto=define
13481                 set d_getgrgid_r_proto getgrgid_r $hdrs
13482                 eval $hasproto ;;
13483         *)      ;;
13484         esac
13485         case "$d_getgrgid_r_proto" in
13486         define)
13487         case "$getgrgid_r_proto" in
13488         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13489         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13490         esac
13491         case "$getgrgid_r_proto" in
13492         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13493         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13494         esac
13495         case "$getgrgid_r_proto" in
13496         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13497         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13498         esac
13499         case "$getgrgid_r_proto" in
13500         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13501         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13502         esac
13503         case "$getgrgid_r_proto" in
13504         ''|0)   d_getgrgid_r=undef
13505                 getgrgid_r_proto=0
13506                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13507         * )     case "$getgrgid_r_proto" in
13508                 REENTRANT_PROTO*) ;;
13509                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13510                 esac
13511                 echo "Prototype: $try" ;;
13512         esac
13513         ;;
13514         *)      case "$usethreads" in
13515                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13516                 esac
13517                 d_getgrgid_r=undef
13518                 getgrgid_r_proto=0
13519                 ;;
13520         esac
13521         ;;
13522 *)      getgrgid_r_proto=0
13523         ;;
13524 esac
13525
13526 : see if getgrnam_r exists
13527 set getgrnam_r d_getgrnam_r
13528 eval $inlibc
13529 case "$d_getgrnam_r" in
13530 "$define")
13531         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13532         case "$d_getgrnam_r_proto:$usethreads" in
13533         ":define")      d_getgrnam_r_proto=define
13534                 set d_getgrnam_r_proto getgrnam_r $hdrs
13535                 eval $hasproto ;;
13536         *)      ;;
13537         esac
13538         case "$d_getgrnam_r_proto" in
13539         define)
13540         case "$getgrnam_r_proto" in
13541         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13542         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13543         esac
13544         case "$getgrnam_r_proto" in
13545         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13546         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13547         esac
13548         case "$getgrnam_r_proto" in
13549         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13550         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13551         esac
13552         case "$getgrnam_r_proto" in
13553         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13554         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13555         esac
13556         case "$getgrnam_r_proto" in
13557         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13558         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13559         esac
13560         case "$getgrnam_r_proto" in
13561         ''|0)   d_getgrnam_r=undef
13562                 getgrnam_r_proto=0
13563                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13564         * )     case "$getgrnam_r_proto" in
13565                 REENTRANT_PROTO*) ;;
13566                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13567                 esac
13568                 echo "Prototype: $try" ;;
13569         esac
13570         ;;
13571         *)      case "$usethreads" in
13572                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13573                 esac
13574                 d_getgrnam_r=undef
13575                 getgrnam_r_proto=0
13576                 ;;
13577         esac
13578         ;;
13579 *)      getgrnam_r_proto=0
13580         ;;
13581 esac
13582
13583 : see if gethostbyaddr exists
13584 set gethostbyaddr d_gethbyaddr
13585 eval $inlibc
13586
13587 : see if gethostbyname exists
13588 set gethostbyname d_gethbyname
13589 eval $inlibc
13590
13591 : see if gethostent exists
13592 set gethostent d_gethent
13593 eval $inlibc
13594
13595 : see how we will look up host name
13596 echo " "
13597 call=''
13598 if set gethostname val -f d_gethname; eval $csym; $val; then
13599         echo 'gethostname() found.' >&4
13600         d_gethname="$define"
13601         call=gethostname
13602 fi
13603 if set uname val -f d_uname; eval $csym; $val; then
13604         if ./xenix; then
13605                 $cat <<'EOM'
13606 uname() was found, but you're running xenix, and older versions of xenix
13607 have a broken uname(). If you don't really know whether your xenix is old
13608 enough to have a broken system call, use the default answer.
13609
13610 EOM
13611                 dflt=y
13612                 case "$d_uname" in
13613                 "$define") dflt=n;;
13614                 esac
13615                 rp='Is your uname() broken?'
13616                 . ./myread
13617                 case "$ans" in
13618                 n*) d_uname="$define"; call=uname;;
13619                 esac
13620         else
13621                 echo 'uname() found.' >&4
13622                 d_uname="$define"
13623                 case "$call" in
13624                 '') call=uname ;;
13625                 esac
13626         fi
13627 fi
13628 case "$d_gethname" in
13629 '') d_gethname="$undef";;
13630 esac
13631 case "$d_uname" in
13632 '') d_uname="$undef";;
13633 esac
13634 case "$d_uname$d_gethname" in
13635 *define*)
13636         dflt=n
13637         cat <<EOM
13638
13639 Every now and then someone has a $call() that lies about the hostname
13640 but can't be fixed for political or economic reasons.  If you wish, I can
13641 pretend $call() isn't there and maybe compute hostname at run-time
13642 thanks to the '$phostname' command.
13643
13644 EOM
13645         rp="Shall I ignore $call() from now on?"
13646         . ./myread
13647         case "$ans" in
13648         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13649         esac;;
13650 esac
13651 case "$phostname" in
13652 '') aphostname='';;
13653 *) case "$aphostname" in
13654         /*) ;;
13655         *) set X $phostname
13656                 shift
13657                 file=$1
13658                 shift
13659                 file=`./loc $file $file $pth`
13660                 aphostname=`echo $file $*`
13661                 ;;
13662         esac
13663         ;;
13664 esac
13665 case "$d_uname$d_gethname" in
13666 *define*) ;;
13667 *)
13668         case "$phostname" in
13669         '')
13670                 echo "There will be no way for $package to get your hostname." >&4;;
13671         *)
13672         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13673                 ;;
13674         esac;;
13675 esac
13676 case "$d_phostname" in
13677 '') d_phostname="$undef";;
13678 esac
13679
13680 : see if gethostbyaddr_r exists
13681 set gethostbyaddr_r d_gethostbyaddr_r
13682 eval $inlibc
13683 case "$d_gethostbyaddr_r" in
13684 "$define")
13685         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13686         case "$d_gethostbyaddr_r_proto:$usethreads" in
13687         ":define")      d_gethostbyaddr_r_proto=define
13688                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13689                 eval $hasproto ;;
13690         *)      ;;
13691         esac
13692         case "$d_gethostbyaddr_r_proto" in
13693         define)
13694         case "$gethostbyaddr_r_proto" in
13695         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13696         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13697         esac
13698         case "$gethostbyaddr_r_proto" in
13699         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13700         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13701         esac
13702         case "$gethostbyaddr_r_proto" in
13703         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13704         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13705         esac
13706         case "$gethostbyaddr_r_proto" in
13707         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13708         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13709         esac
13710         case "$gethostbyaddr_r_proto" in
13711         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13712         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13713         esac
13714         case "$gethostbyaddr_r_proto" in
13715         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13716         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13717         esac
13718         case "$gethostbyaddr_r_proto" in
13719         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13720         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13721         esac
13722         case "$gethostbyaddr_r_proto" in
13723         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13724         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13725         esac
13726         case "$gethostbyaddr_r_proto" in
13727         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13728         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13729         esac
13730         case "$gethostbyaddr_r_proto" in
13731         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13732         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13733         esac
13734         case "$gethostbyaddr_r_proto" in
13735         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13736         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13737         esac
13738         case "$gethostbyaddr_r_proto" in
13739         ''|0)   d_gethostbyaddr_r=undef
13740                 gethostbyaddr_r_proto=0
13741                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13742         * )     case "$gethostbyaddr_r_proto" in
13743                 REENTRANT_PROTO*) ;;
13744                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13745                 esac
13746                 echo "Prototype: $try" ;;
13747         esac
13748         ;;
13749         *)      case "$usethreads" in
13750                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13751                 esac
13752                 d_gethostbyaddr_r=undef
13753                 gethostbyaddr_r_proto=0
13754                 ;;
13755         esac
13756         ;;
13757 *)      gethostbyaddr_r_proto=0
13758         ;;
13759 esac
13760
13761 : see if gethostbyname_r exists
13762 set gethostbyname_r d_gethostbyname_r
13763 eval $inlibc
13764 case "$d_gethostbyname_r" in
13765 "$define")
13766         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13767         case "$d_gethostbyname_r_proto:$usethreads" in
13768         ":define")      d_gethostbyname_r_proto=define
13769                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13770                 eval $hasproto ;;
13771         *)      ;;
13772         esac
13773         case "$d_gethostbyname_r_proto" in
13774         define)
13775         case "$gethostbyname_r_proto" in
13776         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13777         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13778         esac
13779         case "$gethostbyname_r_proto" in
13780         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13781         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13782         esac
13783         case "$gethostbyname_r_proto" in
13784         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13785         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13786         esac
13787         case "$gethostbyname_r_proto" in
13788         ''|0)   d_gethostbyname_r=undef
13789                 gethostbyname_r_proto=0
13790                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13791         * )     case "$gethostbyname_r_proto" in
13792                 REENTRANT_PROTO*) ;;
13793                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13794                 esac
13795                 echo "Prototype: $try" ;;
13796         esac
13797         ;;
13798         *)      case "$usethreads" in
13799                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13800                 esac
13801                 d_gethostbyname_r=undef
13802                 gethostbyname_r_proto=0
13803                 ;;
13804         esac
13805         ;;
13806 *)      gethostbyname_r_proto=0
13807         ;;
13808 esac
13809
13810 : see if gethostent_r exists
13811 set gethostent_r d_gethostent_r
13812 eval $inlibc
13813 case "$d_gethostent_r" in
13814 "$define")
13815         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13816         case "$d_gethostent_r_proto:$usethreads" in
13817         ":define")      d_gethostent_r_proto=define
13818                 set d_gethostent_r_proto gethostent_r $hdrs
13819                 eval $hasproto ;;
13820         *)      ;;
13821         esac
13822         case "$d_gethostent_r_proto" in
13823         define)
13824         case "$gethostent_r_proto" in
13825         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13826         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13827         esac
13828         case "$gethostent_r_proto" in
13829         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13830         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13831         esac
13832         case "$gethostent_r_proto" in
13833         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13834         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13835         esac
13836         case "$gethostent_r_proto" in
13837         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13838         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13839         esac
13840         case "$gethostent_r_proto" in
13841         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13842         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13843         esac
13844         case "$gethostent_r_proto" in
13845         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13846         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13847         esac
13848         case "$gethostent_r_proto" in
13849         ''|0)   d_gethostent_r=undef
13850                 gethostent_r_proto=0
13851                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13852         * )     case "$gethostent_r_proto" in
13853                 REENTRANT_PROTO*) ;;
13854                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13855                 esac
13856                 echo "Prototype: $try" ;;
13857         esac
13858         ;;
13859         *)      case "$usethreads" in
13860                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13861                 esac
13862                 d_gethostent_r=undef
13863                 gethostent_r_proto=0
13864                 ;;
13865         esac
13866         ;;
13867 *)      gethostent_r_proto=0
13868         ;;
13869 esac
13870
13871 : see if prototypes for various gethostxxx netdb.h functions are available
13872 echo " "
13873 set d_gethostprotos gethostent $i_netdb netdb.h
13874 eval $hasproto
13875
13876 : see if getitimer exists
13877 set getitimer d_getitimer
13878 eval $inlibc
13879
13880 : see if getlogin exists
13881 set getlogin d_getlogin
13882 eval $inlibc
13883
13884 : see if getlogin_r exists
13885 set getlogin_r d_getlogin_r
13886 eval $inlibc
13887 case "$d_getlogin_r" in
13888 "$define")
13889         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13890         case "$d_getlogin_r_proto:$usethreads" in
13891         ":define")      d_getlogin_r_proto=define
13892                 set d_getlogin_r_proto getlogin_r $hdrs
13893                 eval $hasproto ;;
13894         *)      ;;
13895         esac
13896         case "$d_getlogin_r_proto" in
13897         define)
13898         case "$getlogin_r_proto" in
13899         ''|0) try='int getlogin_r(char*, size_t);'
13900         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13901         esac
13902         case "$getlogin_r_proto" in
13903         ''|0) try='int getlogin_r(char*, int);'
13904         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13905         esac
13906         case "$getlogin_r_proto" in
13907         ''|0) try='char* getlogin_r(char*, size_t);'
13908         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13909         esac
13910         case "$getlogin_r_proto" in
13911         ''|0) try='char* getlogin_r(char*, int);'
13912         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
13913         esac
13914         case "$getlogin_r_proto" in
13915         ''|0)   d_getlogin_r=undef
13916                 getlogin_r_proto=0
13917                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13918         * )     case "$getlogin_r_proto" in
13919                 REENTRANT_PROTO*) ;;
13920                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13921                 esac
13922                 echo "Prototype: $try" ;;
13923         esac
13924         ;;
13925         *)      case "$usethreads" in
13926                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13927                 esac
13928                 d_getlogin_r=undef
13929                 getlogin_r_proto=0
13930                 ;;
13931         esac
13932         ;;
13933 *)      getlogin_r_proto=0
13934         ;;
13935 esac
13936
13937 : see if getmnt exists
13938 set getmnt d_getmnt
13939 eval $inlibc
13940
13941 : see if getmntent exists
13942 set getmntent d_getmntent
13943 eval $inlibc
13944
13945 : see if getnameinfo exists
13946 set getnameinfo d_getnameinfo
13947 eval $inlibc
13948
13949 : see if getnetbyaddr exists
13950 set getnetbyaddr d_getnbyaddr
13951 eval $inlibc
13952
13953 : see if getnetbyname exists
13954 set getnetbyname d_getnbyname
13955 eval $inlibc
13956
13957 : see if getnetent exists
13958 set getnetent d_getnent
13959 eval $inlibc
13960
13961 : see if getnetbyaddr_r exists
13962 set getnetbyaddr_r d_getnetbyaddr_r
13963 eval $inlibc
13964 case "$d_getnetbyaddr_r" in
13965 "$define")
13966         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13967         case "$d_getnetbyaddr_r_proto:$usethreads" in
13968         ":define")      d_getnetbyaddr_r_proto=define
13969                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13970                 eval $hasproto ;;
13971         *)      ;;
13972         esac
13973         case "$d_getnetbyaddr_r_proto" in
13974         define)
13975         case "$getnetbyaddr_r_proto" in
13976         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13977         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13978         esac
13979         case "$getnetbyaddr_r_proto" in
13980         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13981         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13982         esac
13983         case "$getnetbyaddr_r_proto" in
13984         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13985         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13986         esac
13987         case "$getnetbyaddr_r_proto" in
13988         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13989         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13990         esac
13991         case "$getnetbyaddr_r_proto" in
13992         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13993         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13994         esac
13995         case "$getnetbyaddr_r_proto" in
13996         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13997         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13998         esac
13999         case "$getnetbyaddr_r_proto" in
14000         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14001         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14002         esac
14003         case "$getnetbyaddr_r_proto" in
14004         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14005         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14006         esac
14007         case "$getnetbyaddr_r_proto" in
14008         ''|0)   d_getnetbyaddr_r=undef
14009                 getnetbyaddr_r_proto=0
14010                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14011         * )     case "$getnetbyaddr_r_proto" in
14012                 REENTRANT_PROTO*) ;;
14013                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14014                 esac
14015                 echo "Prototype: $try" ;;
14016         esac
14017         ;;
14018         *)      case "$usethreads" in
14019                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14020                 esac
14021                 d_getnetbyaddr_r=undef
14022                 getnetbyaddr_r_proto=0
14023                 ;;
14024         esac
14025         ;;
14026 *)      getnetbyaddr_r_proto=0
14027         ;;
14028 esac
14029
14030 : see if getnetbyname_r exists
14031 set getnetbyname_r d_getnetbyname_r
14032 eval $inlibc
14033 case "$d_getnetbyname_r" in
14034 "$define")
14035         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14036         case "$d_getnetbyname_r_proto:$usethreads" in
14037         ":define")      d_getnetbyname_r_proto=define
14038                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14039                 eval $hasproto ;;
14040         *)      ;;
14041         esac
14042         case "$d_getnetbyname_r_proto" in
14043         define)
14044         case "$getnetbyname_r_proto" in
14045         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14046         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14047         esac
14048         case "$getnetbyname_r_proto" in
14049         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14050         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14051         esac
14052         case "$getnetbyname_r_proto" in
14053         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14054         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14055         esac
14056         case "$getnetbyname_r_proto" in
14057         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14058         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14059         esac
14060         case "$getnetbyname_r_proto" in
14061         ''|0)   d_getnetbyname_r=undef
14062                 getnetbyname_r_proto=0
14063                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14064         * )     case "$getnetbyname_r_proto" in
14065                 REENTRANT_PROTO*) ;;
14066                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14067                 esac
14068                 echo "Prototype: $try" ;;
14069         esac
14070         ;;
14071         *)      case "$usethreads" in
14072                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14073                 esac
14074                 d_getnetbyname_r=undef
14075                 getnetbyname_r_proto=0
14076                 ;;
14077         esac
14078         ;;
14079 *)      getnetbyname_r_proto=0
14080         ;;
14081 esac
14082
14083 : see if getnetent_r exists
14084 set getnetent_r d_getnetent_r
14085 eval $inlibc
14086 case "$d_getnetent_r" in
14087 "$define")
14088         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14089         case "$d_getnetent_r_proto:$usethreads" in
14090         ":define")      d_getnetent_r_proto=define
14091                 set d_getnetent_r_proto getnetent_r $hdrs
14092                 eval $hasproto ;;
14093         *)      ;;
14094         esac
14095         case "$d_getnetent_r_proto" in
14096         define)
14097         case "$getnetent_r_proto" in
14098         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14099         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14100         esac
14101         case "$getnetent_r_proto" in
14102         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14103         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14104         esac
14105         case "$getnetent_r_proto" in
14106         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14107         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14108         esac
14109         case "$getnetent_r_proto" in
14110         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14111         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14112         esac
14113         case "$getnetent_r_proto" in
14114         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14115         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14116         esac
14117         case "$getnetent_r_proto" in
14118         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14119         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14120         esac
14121         case "$getnetent_r_proto" in
14122         ''|0)   d_getnetent_r=undef
14123                 getnetent_r_proto=0
14124                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14125         * )     case "$getnetent_r_proto" in
14126                 REENTRANT_PROTO*) ;;
14127                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14128                 esac
14129                 echo "Prototype: $try" ;;
14130         esac
14131         ;;
14132         *)      case "$usethreads" in
14133                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14134                 esac
14135                 d_getnetent_r=undef
14136                 getnetent_r_proto=0
14137                 ;;
14138         esac
14139         ;;
14140 *)      getnetent_r_proto=0
14141         ;;
14142 esac
14143
14144 : see if prototypes for various getnetxxx netdb.h functions are available
14145 echo " "
14146 set d_getnetprotos getnetent $i_netdb netdb.h
14147 eval $hasproto
14148
14149 : see if getpagesize exists
14150 set getpagesize d_getpagsz
14151 eval $inlibc
14152
14153 : Optional checks for getprotobyname and getprotobynumber
14154
14155 : see if getprotobyname exists
14156 set getprotobyname d_getpbyname
14157 eval $inlibc
14158
14159 : see if getprotobynumber exists
14160 set getprotobynumber d_getpbynumber
14161 eval $inlibc
14162
14163 : see if getprotoent exists
14164 set getprotoent d_getpent
14165 eval $inlibc
14166
14167 : see if getpgid exists
14168 set getpgid d_getpgid
14169 eval $inlibc
14170
14171 : see if getpgrp2 exists
14172 set getpgrp2 d_getpgrp2
14173 eval $inlibc
14174
14175 : see if getppid exists
14176 set getppid d_getppid
14177 eval $inlibc
14178
14179 : see if getpriority exists
14180 set getpriority d_getprior
14181 eval $inlibc
14182
14183 : see if getprotobyname_r exists
14184 set getprotobyname_r d_getprotobyname_r
14185 eval $inlibc
14186 case "$d_getprotobyname_r" in
14187 "$define")
14188         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14189         case "$d_getprotobyname_r_proto:$usethreads" in
14190         ":define")      d_getprotobyname_r_proto=define
14191                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14192                 eval $hasproto ;;
14193         *)      ;;
14194         esac
14195         case "$d_getprotobyname_r_proto" in
14196         define)
14197         case "$getprotobyname_r_proto" in
14198         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14199         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14200         esac
14201         case "$getprotobyname_r_proto" in
14202         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14203         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14204         esac
14205         case "$getprotobyname_r_proto" in
14206         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14207         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14208         esac
14209         case "$getprotobyname_r_proto" in
14210         ''|0)   d_getprotobyname_r=undef
14211                 getprotobyname_r_proto=0
14212                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14213         * )     case "$getprotobyname_r_proto" in
14214                 REENTRANT_PROTO*) ;;
14215                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14216                 esac
14217                 echo "Prototype: $try" ;;
14218         esac
14219         ;;
14220         *)      case "$usethreads" in
14221                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14222                 esac
14223                 d_getprotobyname_r=undef
14224                 getprotobyname_r_proto=0
14225                 ;;
14226         esac
14227         ;;
14228 *)      getprotobyname_r_proto=0
14229         ;;
14230 esac
14231
14232 : see if getprotobynumber_r exists
14233 set getprotobynumber_r d_getprotobynumber_r
14234 eval $inlibc
14235 case "$d_getprotobynumber_r" in
14236 "$define")
14237         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14238         case "$d_getprotobynumber_r_proto:$usethreads" in
14239         ":define")      d_getprotobynumber_r_proto=define
14240                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14241                 eval $hasproto ;;
14242         *)      ;;
14243         esac
14244         case "$d_getprotobynumber_r_proto" in
14245         define)
14246         case "$getprotobynumber_r_proto" in
14247         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14248         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14249         esac
14250         case "$getprotobynumber_r_proto" in
14251         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14252         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14253         esac
14254         case "$getprotobynumber_r_proto" in
14255         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14256         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14257         esac
14258         case "$getprotobynumber_r_proto" in
14259         ''|0)   d_getprotobynumber_r=undef
14260                 getprotobynumber_r_proto=0
14261                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14262         * )     case "$getprotobynumber_r_proto" in
14263                 REENTRANT_PROTO*) ;;
14264                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14265                 esac
14266                 echo "Prototype: $try" ;;
14267         esac
14268         ;;
14269         *)      case "$usethreads" in
14270                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14271                 esac
14272                 d_getprotobynumber_r=undef
14273                 getprotobynumber_r_proto=0
14274                 ;;
14275         esac
14276         ;;
14277 *)      getprotobynumber_r_proto=0
14278         ;;
14279 esac
14280
14281 : see if getprotoent_r exists
14282 set getprotoent_r d_getprotoent_r
14283 eval $inlibc
14284 case "$d_getprotoent_r" in
14285 "$define")
14286         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14287         case "$d_getprotoent_r_proto:$usethreads" in
14288         ":define")      d_getprotoent_r_proto=define
14289                 set d_getprotoent_r_proto getprotoent_r $hdrs
14290                 eval $hasproto ;;
14291         *)      ;;
14292         esac
14293         case "$d_getprotoent_r_proto" in
14294         define)
14295         case "$getprotoent_r_proto" in
14296         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14297         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14298         esac
14299         case "$getprotoent_r_proto" in
14300         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14301         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14302         esac
14303         case "$getprotoent_r_proto" in
14304         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14305         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14306         esac
14307         case "$getprotoent_r_proto" in
14308         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14309         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14310         esac
14311         case "$getprotoent_r_proto" in
14312         ''|0)   d_getprotoent_r=undef
14313                 getprotoent_r_proto=0
14314                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14315         * )     case "$getprotoent_r_proto" in
14316                 REENTRANT_PROTO*) ;;
14317                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14318                 esac
14319                 echo "Prototype: $try" ;;
14320         esac
14321         ;;
14322         *)      case "$usethreads" in
14323                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14324                 esac
14325                 d_getprotoent_r=undef
14326                 getprotoent_r_proto=0
14327                 ;;
14328         esac
14329         ;;
14330 *)      getprotoent_r_proto=0
14331         ;;
14332 esac
14333
14334 : see if prototypes for various getprotoxxx netdb.h functions are available
14335 echo " "
14336 set d_getprotoprotos getprotoent $i_netdb netdb.h
14337 eval $hasproto
14338
14339 : see if getprpwnam exists
14340 set getprpwnam d_getprpwnam
14341 eval $inlibc
14342
14343 : see if getpwent exists
14344 set getpwent d_getpwent
14345 eval $inlibc
14346
14347 : see if getpwent_r exists
14348 set getpwent_r d_getpwent_r
14349 eval $inlibc
14350 case "$d_getpwent_r" in
14351 "$define")
14352         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14353         case "$d_getpwent_r_proto:$usethreads" in
14354         ":define")      d_getpwent_r_proto=define
14355                 set d_getpwent_r_proto getpwent_r $hdrs
14356                 eval $hasproto ;;
14357         *)      ;;
14358         esac
14359         case "$d_getpwent_r_proto" in
14360         define)
14361         case "$getpwent_r_proto" in
14362         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14363         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14364         esac
14365         case "$getpwent_r_proto" in
14366         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14367         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14368         esac
14369         case "$getpwent_r_proto" in
14370         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14371         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14372         esac
14373         case "$getpwent_r_proto" in
14374         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14375         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14376         esac
14377         case "$getpwent_r_proto" in
14378         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14379         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14380         esac
14381         case "$getpwent_r_proto" in
14382         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14383         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14384         esac
14385         case "$getpwent_r_proto" in
14386         ''|0)   d_getpwent_r=undef
14387                 getpwent_r_proto=0
14388                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14389         * )     case "$getpwent_r_proto" in
14390                 REENTRANT_PROTO*) ;;
14391                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14392                 esac
14393                 echo "Prototype: $try" ;;
14394         esac
14395         ;;
14396         *)      case "$usethreads" in
14397                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14398                 esac
14399                 d_getpwent_r=undef
14400                 getpwent_r_proto=0
14401                 ;;
14402         esac
14403         ;;
14404 *)      getpwent_r_proto=0
14405         ;;
14406 esac
14407
14408 : see if getpwnam_r exists
14409 set getpwnam_r d_getpwnam_r
14410 eval $inlibc
14411 case "$d_getpwnam_r" in
14412 "$define")
14413         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14414         case "$d_getpwnam_r_proto:$usethreads" in
14415         ":define")      d_getpwnam_r_proto=define
14416                 set d_getpwnam_r_proto getpwnam_r $hdrs
14417                 eval $hasproto ;;
14418         *)      ;;
14419         esac
14420         case "$d_getpwnam_r_proto" in
14421         define)
14422         case "$getpwnam_r_proto" in
14423         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14424         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14425         esac
14426         case "$getpwnam_r_proto" in
14427         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14428         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14429         esac
14430         case "$getpwnam_r_proto" in
14431         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14432         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14433         esac
14434         case "$getpwnam_r_proto" in
14435         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14436         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14437         esac
14438         case "$getpwnam_r_proto" in
14439         ''|0)   d_getpwnam_r=undef
14440                 getpwnam_r_proto=0
14441                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14442         * )     case "$getpwnam_r_proto" in
14443                 REENTRANT_PROTO*) ;;
14444                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14445                 esac
14446                 echo "Prototype: $try" ;;
14447         esac
14448         ;;
14449         *)      case "$usethreads" in
14450                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14451                 esac
14452                 d_getpwnam_r=undef
14453                 getpwnam_r_proto=0
14454                 ;;
14455         esac
14456         ;;
14457 *)      getpwnam_r_proto=0
14458         ;;
14459 esac
14460
14461 : see if getpwuid_r exists
14462 set getpwuid_r d_getpwuid_r
14463 eval $inlibc
14464 case "$d_getpwuid_r" in
14465 "$define")
14466         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14467         case "$d_getpwuid_r_proto:$usethreads" in
14468         ":define")      d_getpwuid_r_proto=define
14469                 set d_getpwuid_r_proto getpwuid_r $hdrs
14470                 eval $hasproto ;;
14471         *)      ;;
14472         esac
14473         case "$d_getpwuid_r_proto" in
14474         define)
14475         case "$getpwuid_r_proto" in
14476         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14477         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14478         esac
14479         case "$getpwuid_r_proto" in
14480         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14481         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14482         esac
14483         case "$getpwuid_r_proto" in
14484         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14485         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14486         esac
14487         case "$getpwuid_r_proto" in
14488         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14489         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14490         esac
14491         case "$getpwuid_r_proto" in
14492         ''|0)   d_getpwuid_r=undef
14493                 getpwuid_r_proto=0
14494                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14495         * )     case "$getpwuid_r_proto" in
14496                 REENTRANT_PROTO*) ;;
14497                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14498                 esac
14499                 echo "Prototype: $try" ;;
14500         esac
14501         ;;
14502         *)      case "$usethreads" in
14503                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14504                 esac
14505                 d_getpwuid_r=undef
14506                 getpwuid_r_proto=0
14507                 ;;
14508         esac
14509         ;;
14510 *)      getpwuid_r_proto=0
14511         ;;
14512 esac
14513
14514 : Optional checks for getsbyname and getsbyport
14515
14516 : see if getservbyname exists
14517 set getservbyname d_getsbyname
14518 eval $inlibc
14519
14520 : see if getservbyport exists
14521 set getservbyport d_getsbyport
14522 eval $inlibc
14523
14524 : see if getservent exists
14525 set getservent d_getsent
14526 eval $inlibc
14527
14528 : see if getservbyname_r exists
14529 set getservbyname_r d_getservbyname_r
14530 eval $inlibc
14531 case "$d_getservbyname_r" in
14532 "$define")
14533         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14534         case "$d_getservbyname_r_proto:$usethreads" in
14535         ":define")      d_getservbyname_r_proto=define
14536                 set d_getservbyname_r_proto getservbyname_r $hdrs
14537                 eval $hasproto ;;
14538         *)      ;;
14539         esac
14540         case "$d_getservbyname_r_proto" in
14541         define)
14542         case "$getservbyname_r_proto" in
14543         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14544         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14545         esac
14546         case "$getservbyname_r_proto" in
14547         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14548         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14549         esac
14550         case "$getservbyname_r_proto" in
14551         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14552         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14553         esac
14554         case "$getservbyname_r_proto" in
14555         ''|0)   d_getservbyname_r=undef
14556                 getservbyname_r_proto=0
14557                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14558         * )     case "$getservbyname_r_proto" in
14559                 REENTRANT_PROTO*) ;;
14560                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14561                 esac
14562                 echo "Prototype: $try" ;;
14563         esac
14564         ;;
14565         *)      case "$usethreads" in
14566                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14567                 esac
14568                 d_getservbyname_r=undef
14569                 getservbyname_r_proto=0
14570                 ;;
14571         esac
14572         ;;
14573 *)      getservbyname_r_proto=0
14574         ;;
14575 esac
14576
14577 : see if getservbyport_r exists
14578 set getservbyport_r d_getservbyport_r
14579 eval $inlibc
14580 case "$d_getservbyport_r" in
14581 "$define")
14582         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14583         case "$d_getservbyport_r_proto:$usethreads" in
14584         ":define")      d_getservbyport_r_proto=define
14585                 set d_getservbyport_r_proto getservbyport_r $hdrs
14586                 eval $hasproto ;;
14587         *)      ;;
14588         esac
14589         case "$d_getservbyport_r_proto" in
14590         define)
14591         case "$getservbyport_r_proto" in
14592         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14593         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14594         esac
14595         case "$getservbyport_r_proto" in
14596         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14597         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14598         esac
14599         case "$getservbyport_r_proto" in
14600         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14601         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14602         esac
14603         case "$getservbyport_r_proto" in
14604         ''|0)   d_getservbyport_r=undef
14605                 getservbyport_r_proto=0
14606                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14607         * )     case "$getservbyport_r_proto" in
14608                 REENTRANT_PROTO*) ;;
14609                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14610                 esac
14611                 echo "Prototype: $try" ;;
14612         esac
14613         ;;
14614         *)      case "$usethreads" in
14615                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14616                 esac
14617                 d_getservbyport_r=undef
14618                 getservbyport_r_proto=0
14619                 ;;
14620         esac
14621         ;;
14622 *)      getservbyport_r_proto=0
14623         ;;
14624 esac
14625
14626 : see if getservent_r exists
14627 set getservent_r d_getservent_r
14628 eval $inlibc
14629 case "$d_getservent_r" in
14630 "$define")
14631         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14632         case "$d_getservent_r_proto:$usethreads" in
14633         ":define")      d_getservent_r_proto=define
14634                 set d_getservent_r_proto getservent_r $hdrs
14635                 eval $hasproto ;;
14636         *)      ;;
14637         esac
14638         case "$d_getservent_r_proto" in
14639         define)
14640         case "$getservent_r_proto" in
14641         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14642         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14643         esac
14644         case "$getservent_r_proto" in
14645         ''|0) try='int getservent_r(struct servent*, char*, int);'
14646         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14647         esac
14648         case "$getservent_r_proto" in
14649         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14650         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14651         esac
14652         case "$getservent_r_proto" in
14653         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14654         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14655         esac
14656         case "$getservent_r_proto" in
14657         ''|0)   d_getservent_r=undef
14658                 getservent_r_proto=0
14659                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14660         * )     case "$getservent_r_proto" in
14661                 REENTRANT_PROTO*) ;;
14662                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14663                 esac
14664                 echo "Prototype: $try" ;;
14665         esac
14666         ;;
14667         *)      case "$usethreads" in
14668                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14669                 esac
14670                 d_getservent_r=undef
14671                 getservent_r_proto=0
14672                 ;;
14673         esac
14674         ;;
14675 *)      getservent_r_proto=0
14676         ;;
14677 esac
14678
14679 : see if prototypes for various getservxxx netdb.h functions are available
14680 echo " "
14681 set d_getservprotos getservent $i_netdb netdb.h
14682 eval $hasproto
14683
14684 : see if getspnam exists
14685 set getspnam d_getspnam
14686 eval $inlibc
14687
14688 : see if this is a shadow.h system
14689 set shadow.h i_shadow
14690 eval $inhdr
14691
14692 : see if getspnam_r exists
14693 set getspnam_r d_getspnam_r
14694 eval $inlibc
14695 case "$d_getspnam_r" in
14696 "$define")
14697         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14698         case "$d_getspnam_r_proto:$usethreads" in
14699         ":define")      d_getspnam_r_proto=define
14700                 set d_getspnam_r_proto getspnam_r $hdrs
14701                 eval $hasproto ;;
14702         *)      ;;
14703         esac
14704         case "$d_getspnam_r_proto" in
14705         define)
14706         case "$getspnam_r_proto" in
14707         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14708         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14709         esac
14710         case "$getspnam_r_proto" in
14711         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14712         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14713         esac
14714         case "$getspnam_r_proto" in
14715         ''|0)   d_getspnam_r=undef
14716                 getspnam_r_proto=0
14717                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14718         * )     case "$getspnam_r_proto" in
14719                 REENTRANT_PROTO*) ;;
14720                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14721                 esac
14722                 echo "Prototype: $try" ;;
14723         esac
14724         ;;
14725         *)      case "$usethreads" in
14726                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14727                 esac
14728                 d_getspnam_r=undef
14729                 getspnam_r_proto=0
14730                 ;;
14731         esac
14732         ;;
14733 *)      getspnam_r_proto=0
14734         ;;
14735 esac
14736
14737 : see if gettimeofday or ftime exists
14738 set gettimeofday d_gettimeod
14739 eval $inlibc
14740 case "$d_gettimeod" in
14741 "$undef")
14742         set ftime d_ftime 
14743         eval $inlibc
14744         ;;
14745 *)
14746         val="$undef"; set d_ftime; eval $setvar
14747         ;;
14748 esac
14749 case "$d_gettimeod$d_ftime" in
14750 "$undef$undef")
14751         echo " "
14752         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14753         ;;
14754 esac
14755
14756 : see if gmtime_r exists
14757 set gmtime_r d_gmtime_r
14758 eval $inlibc
14759 case "$d_gmtime_r" in
14760 "$define")
14761         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14762         case "$d_gmtime_r_proto:$usethreads" in
14763         ":define")      d_gmtime_r_proto=define
14764                 set d_gmtime_r_proto gmtime_r $hdrs
14765                 eval $hasproto ;;
14766         *)      ;;
14767         esac
14768         case "$d_gmtime_r_proto" in
14769         define)
14770         case "$gmtime_r_proto" in
14771         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14772         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14773         esac
14774         case "$gmtime_r_proto" in
14775         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14776         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14777         esac
14778         case "$gmtime_r_proto" in
14779         ''|0)   d_gmtime_r=undef
14780                 gmtime_r_proto=0
14781                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14782         * )     case "$gmtime_r_proto" in
14783                 REENTRANT_PROTO*) ;;
14784                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14785                 esac
14786                 echo "Prototype: $try" ;;
14787         esac
14788         ;;
14789         *)      case "$usethreads" in
14790                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14791                 esac
14792                 d_gmtime_r=undef
14793                 gmtime_r_proto=0
14794                 ;;
14795         esac
14796         ;;
14797 *)      gmtime_r_proto=0
14798         ;;
14799 esac
14800
14801 : see if hasmntopt exists
14802 set hasmntopt d_hasmntopt
14803 eval $inlibc
14804
14805 : see if this is a netinet/in.h or sys/in.h system
14806 set netinet/in.h i_niin sys/in.h i_sysin
14807 eval $inhdr
14808
14809 : see if arpa/inet.h has to be included
14810 set arpa/inet.h i_arpainet
14811 eval $inhdr
14812
14813 : see if htonl --and friends-- exists
14814 val=''
14815 set htonl val
14816 eval $inlibc
14817
14818 : Maybe they are macros.
14819 case "$val" in
14820 $undef)
14821         $cat >htonl.c <<EOM
14822 #include <stdio.h>
14823 #include <sys/types.h>
14824 #$i_niin I_NETINET_IN
14825 #$i_sysin I_SYS_IN
14826 #$i_arpainet I_ARPA_INET
14827 #ifdef I_NETINET_IN
14828 #include <netinet/in.h>
14829 #endif
14830 #ifdef I_SYS_IN
14831 #include <sys/in.h>
14832 #endif
14833 #ifdef I_ARPA_INET
14834 #include <arpa/inet.h>
14835 #endif
14836 #ifdef htonl
14837 printf("Defined as a macro.");
14838 #endif
14839 EOM
14840         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14841         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14842                 val="$define"
14843                 echo "But it seems to be defined as a macro." >&4
14844         fi
14845         $rm -f htonl.?
14846         ;;
14847 esac
14848 set d_htonl
14849 eval $setvar
14850
14851 : see if ilogbl exists
14852 set ilogbl d_ilogbl
14853 eval $inlibc
14854
14855 : index or strchr
14856 echo " "
14857 if set index val -f; eval $csym; $val; then
14858         if set strchr val -f d_strchr; eval $csym; $val; then
14859                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14860                         val="$define"
14861                         vali="$undef"
14862                         echo "strchr() found." >&4
14863                 else
14864                         val="$undef"
14865                         vali="$define"
14866                         echo "index() found." >&4
14867                 fi
14868         else
14869                 val="$undef"
14870                 vali="$define"
14871                 echo "index() found." >&4
14872         fi
14873 else
14874         if set strchr val -f d_strchr; eval $csym; $val; then
14875                 val="$define"
14876                 vali="$undef"
14877                 echo "strchr() found." >&4
14878         else
14879                 echo "No index() or strchr() found!" >&4
14880                 val="$undef"
14881                 vali="$undef"
14882         fi
14883 fi
14884 set d_strchr; eval $setvar
14885 val="$vali"
14886 set d_index; eval $setvar
14887
14888 : check whether inet_aton exists
14889 set inet_aton d_inetaton
14890 eval $inlibc
14891
14892 : see if inet_ntop exists
14893 set inet_ntop d_inetntop
14894 eval $inlibc
14895
14896 : see if inet_pton exists
14897 set inet_pton d_inetpton
14898 eval $inlibc
14899
14900 : Look for isascii
14901 echo " "
14902 $cat >isascii.c <<EOCP
14903 #include <stdio.h>
14904 #include <ctype.h>
14905 #$i_stdlib I_STDLIB
14906 #ifdef I_STDLIB
14907 #include <stdlib.h>
14908 #endif
14909 int main() {
14910         int c = 'A';
14911         if (isascii(c))
14912                 exit(0);
14913         else
14914                 exit(1);
14915 }
14916 EOCP
14917 set isascii
14918 if eval $compile; then
14919         echo "isascii() found." >&4
14920         val="$define"
14921 else
14922         echo "isascii() NOT found." >&4
14923         val="$undef"
14924 fi
14925 set d_isascii
14926 eval $setvar
14927 $rm -f isascii*
14928
14929 : see if isfinite exists
14930 set isfinite d_isfinite
14931 eval $inlibc
14932
14933 : see if isinf exists
14934 set isinf d_isinf
14935 eval $inlibc
14936
14937 : see if isnan exists
14938 set isnan d_isnan
14939 eval $inlibc
14940
14941 : see if isnanl exists
14942 set isnanl d_isnanl
14943 eval $inlibc
14944
14945 : see if killpg exists
14946 set killpg d_killpg
14947 eval $inlibc
14948
14949 : see if lchown exists
14950 echo " "
14951 $cat > try.c <<'EOCP'
14952 /* System header to define __stub macros and hopefully few prototypes,
14953     which can conflict with char lchown(); below.  */
14954 #include <assert.h>
14955 /* Override any gcc2 internal prototype to avoid an error.  */
14956 /* We use char because int might match the return type of a gcc2
14957    builtin and then its argument prototype would still apply.  */
14958 char lchown();
14959 int main() {
14960     /*  The GNU C library defines this for functions which it implements
14961         to always fail with ENOSYS.  Some functions are actually named
14962         something starting with __ and the normal name is an alias.  */
14963 #if defined (__stub_lchown) || defined (__stub___lchown)
14964 choke me
14965 #else
14966 lchown();
14967 #endif
14968 ; return 0; }
14969 EOCP
14970 set try
14971 if eval $compile; then
14972     $echo "lchown() found." >&4
14973     val="$define"
14974 else
14975     $echo "lchown() NOT found." >&4
14976     val="$undef"
14977 fi
14978 set d_lchown
14979 eval $setvar
14980
14981 : See if number of significant digits in a double precision number is known
14982 echo " "
14983 $cat >ldbl_dig.c <<EOM
14984 #$i_limits I_LIMITS
14985 #$i_float I_FLOAT
14986 #ifdef I_LIMITS
14987 #include <limits.h>
14988 #endif
14989 #ifdef I_FLOAT
14990 #include <float.h>
14991 #endif
14992 #ifdef LDBL_DIG
14993 printf("Contains LDBL_DIG");
14994 #endif
14995 EOM
14996 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14997 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14998         echo "LDBL_DIG found." >&4
14999         val="$define"
15000 else
15001         echo "LDBL_DIG NOT found." >&4
15002         val="$undef"
15003 fi
15004 $rm -f ldbl_dig.?
15005 set d_ldbl_dig
15006 eval $setvar
15007
15008 : see if this is a math.h system
15009 set math.h i_math
15010 eval $inhdr
15011
15012 : check to see if math.h defines _LIB_VERSION
15013 d_libm_lib_version="$undef"
15014 case $i_math in
15015     $define)
15016         echo " "
15017         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15018         $cat >try.c <<EOCP
15019 #include <unistd.h>
15020 #include <math.h>
15021 int main (int argc, char *argv[])
15022 {
15023     printf ("%d\n", _LIB_VERSION);
15024     return (0);
15025     } /* main */
15026 EOCP
15027         set try
15028         if eval $compile; then
15029             foo=`$run ./try`
15030             echo "Yes, it does ($foo)" >&4
15031             d_libm_lib_version="$define"
15032         else
15033             echo "No, it does not (probably harmless)" >&4
15034             fi
15035         $rm_try
15036         ;;
15037
15038     esac
15039
15040 : see if link exists
15041 set link d_link
15042 eval $inlibc
15043
15044 : see if localtime_r exists
15045 set localtime_r d_localtime_r
15046 eval $inlibc
15047 case "$d_localtime_r" in
15048 "$define")
15049         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15050         case "$d_localtime_r_proto:$usethreads" in
15051         ":define")      d_localtime_r_proto=define
15052                 set d_localtime_r_proto localtime_r $hdrs
15053                 eval $hasproto ;;
15054         *)      ;;
15055         esac
15056         case "$d_localtime_r_proto" in
15057         define)
15058         case "$localtime_r_proto" in
15059         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15060         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15061         esac
15062         case "$localtime_r_proto" in
15063         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15064         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15065         esac
15066         case "$localtime_r_proto" in
15067         ''|0)   d_localtime_r=undef
15068                 localtime_r_proto=0
15069                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15070         * )     case "$localtime_r_proto" in
15071                 REENTRANT_PROTO*) ;;
15072                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15073                 esac
15074                 echo "Prototype: $try" ;;
15075         esac
15076         ;;
15077         *)      case "$usethreads" in
15078                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15079                 esac
15080                 d_localtime_r=undef
15081                 localtime_r_proto=0
15082                 ;;
15083         esac
15084         ;;
15085 *)      localtime_r_proto=0
15086         ;;
15087 esac
15088
15089 : see if localtime_r calls tzset
15090 case "$localtime_r_proto" in
15091 REENTRANT_PROTO*)
15092         $cat >try.c <<EOCP
15093 /*  Does our libc's localtime_r call tzset ?
15094  *  return 0 if so, 1 otherwise.
15095  */
15096 #$i_systypes    I_SYS_TYPES
15097 #$i_unistd      I_UNISTD
15098 #$i_time        I_TIME
15099 #$i_stdlib      I_STDLIB
15100 #$i_string      I_STRING
15101 #$i_malloc      I_MALLOC
15102 #ifdef I_SYS_TYPES
15103 #  include <sys/types.h>
15104 #endif
15105 #ifdef I_UNISTD
15106 #  include <unistd.h>
15107 #endif
15108 #ifdef I_TIME
15109 #  include <time.h>
15110 #endif
15111 #ifdef I_STDLIB
15112 #include <stdlib.h>
15113 #endif
15114 #ifdef I_STRING
15115 #  include <string.h>
15116 #else
15117 #  include <strings.h>
15118 #endif
15119 #ifdef I_MALLOC
15120 #  include <malloc.h>
15121 #endif
15122 int main()
15123 {
15124     time_t t = time(0L);
15125     char w_tz[]="TZ" "=GMT+5",
15126          e_tz[]="TZ" "=GMT-5",
15127         *tz_e = (char*)malloc(16),
15128         *tz_w = (char*)malloc(16);
15129     struct tm tm_e, tm_w;
15130     memset(&tm_e,'\0',sizeof(struct tm));
15131     memset(&tm_w,'\0',sizeof(struct tm));
15132     strcpy(tz_e,e_tz);
15133     strcpy(tz_w,w_tz);
15134
15135     putenv(tz_e);
15136     localtime_r(&t, &tm_e);
15137
15138     putenv(tz_w);
15139     localtime_r(&t, &tm_w);
15140
15141     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15142         return 1;
15143     return 0;
15144 }
15145 EOCP
15146         set try
15147         if eval $compile; then
15148             if $run ./try; then
15149                 d_localtime_r_needs_tzset=undef;
15150             else
15151                 d_localtime_r_needs_tzset=define;
15152             fi;
15153         else
15154             d_localtime_r_needs_tzset=undef;
15155         fi;
15156      ;;
15157   *)
15158      d_localtime_r_needs_tzset=undef;
15159      ;;
15160 esac
15161 $rm_try
15162
15163 : see if localeconv exists
15164 set localeconv d_locconv
15165 eval $inlibc
15166
15167 : see if lockf exists
15168 set lockf d_lockf
15169 eval $inlibc
15170
15171 : see if prototype for lseek is available
15172 echo " "
15173 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15174 eval $hasproto
15175
15176 : see if lstat exists
15177 set lstat d_lstat
15178 eval $inlibc
15179
15180 : see if madvise exists
15181 set madvise d_madvise
15182 eval $inlibc
15183
15184 : see if malloc_size exists
15185 set malloc_size d_malloc_size
15186 eval $inlibc
15187
15188 : see if malloc_size_good exists
15189 set malloc_good_size d_malloc_good_size
15190 eval $inlibc
15191
15192 : see if mblen exists
15193 set mblen d_mblen
15194 eval $inlibc
15195
15196 : see if mbstowcs exists
15197 set mbstowcs d_mbstowcs
15198 eval $inlibc
15199
15200 : see if mbtowc exists
15201 set mbtowc d_mbtowc
15202 eval $inlibc
15203
15204 : see if memchr exists
15205 set memchr d_memchr
15206 eval $inlibc
15207
15208 : see if memcmp exists
15209 set memcmp d_memcmp
15210 eval $inlibc
15211
15212 : see if memcpy exists
15213 set memcpy d_memcpy
15214 eval $inlibc
15215
15216 : see if memmove exists
15217 set memmove d_memmove
15218 eval $inlibc
15219
15220 : see if memset exists
15221 set memset d_memset
15222 eval $inlibc
15223
15224 : see if mkdir exists
15225 set mkdir d_mkdir
15226 eval $inlibc
15227
15228 : see if mkdtemp exists
15229 set mkdtemp d_mkdtemp
15230 eval $inlibc
15231
15232 : see if mkfifo exists
15233 set mkfifo d_mkfifo
15234 eval $inlibc
15235
15236 : see if mkstemp exists
15237 set mkstemp d_mkstemp
15238 eval $inlibc
15239
15240 : see if mkstemps exists
15241 set mkstemps d_mkstemps
15242 eval $inlibc
15243
15244 : see if mktime exists
15245 set mktime d_mktime
15246 eval $inlibc
15247
15248 : see if this is a sys/mman.h system
15249 set sys/mman.h i_sysmman
15250 eval $inhdr
15251
15252 : see if mmap exists
15253 set mmap d_mmap
15254 eval $inlibc
15255 : see what shmat returns
15256 : default to something harmless
15257 mmaptype='void *'
15258 case "$i_sysmman$d_mmap" in
15259 "$define$define")
15260         $cat >mmap.c <<'END'
15261 #include <sys/mman.h>
15262 void *mmap();
15263 END
15264         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15265                 mmaptype='void *'
15266         else
15267                 mmaptype='caddr_t'
15268         fi
15269         echo "and it returns ($mmaptype)." >&4
15270         ;;
15271 esac
15272
15273
15274
15275 : see if sqrtl exists
15276 set sqrtl d_sqrtl
15277 eval $inlibc
15278
15279 : see if scalbnl exists
15280 set scalbnl d_scalbnl
15281 eval $inlibc
15282
15283 : see if modfl exists
15284 set modfl d_modfl
15285 eval $inlibc
15286
15287 : see if prototype for modfl is available
15288 echo " "
15289 set d_modflproto modfl $i_math math.h
15290 eval $hasproto
15291
15292 d_modfl_pow32_bug="$undef"
15293
15294 case "$d_longdbl$d_modfl" in
15295 $define$define)
15296         $cat <<EOM
15297 Checking to see whether your modfl() is okay for large values...
15298 EOM
15299 $cat >try.c <<EOCP
15300 #include <math.h>
15301 #include <stdio.h>
15302 EOCP
15303 if $test "X$d_modflproto" != "X$define"; then
15304         $cat >>try.c <<EOCP
15305 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15306 long double modfl (long double, long double *);
15307 EOCP
15308 fi
15309 $cat >>try.c <<EOCP
15310 int main() {
15311     long double nv = 4294967303.15;
15312     long double v, w;
15313     v = modfl(nv, &w);
15314 #ifdef __GLIBC__
15315     printf("glibc");
15316 #endif
15317     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15318     return 0;
15319 }
15320 EOCP
15321         case "$osname:$gccversion" in
15322         aix:)   saveccflags="$ccflags"
15323                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15324         esac
15325         set try
15326         if eval $compile; then
15327                 foo=`$run ./try`
15328                 case "$foo" in
15329                 *" 4294967303.150000 1.150000 4294967302.000000")
15330                         echo >&4 "Your modfl() is broken for large values."
15331                         d_modfl_pow32_bug="$define"
15332                         case "$foo" in
15333                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15334                         ;;
15335                         esac
15336                         ;;
15337                 *" 4294967303.150000 0.150000 4294967303.000000")
15338                         echo >&4 "Your modfl() seems okay for large values."
15339                         ;;
15340                 *)      echo >&4 "I don't understand your modfl() at all."
15341                         d_modfl="$undef"
15342                         ;;
15343                 esac
15344                 $rm_try
15345         else
15346                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15347                 d_modfl="$undef"
15348         fi
15349         case "$osname:$gccversion" in
15350         aix:)   ccflags="$saveccflags" ;; # restore
15351         esac
15352         ;;
15353 esac
15354
15355 if $test "$uselongdouble" = "$define"; then
15356     message=""
15357     if $test "$d_sqrtl" != "$define"; then
15358         message="$message sqrtl"
15359     fi
15360     if $test "$d_modfl" != "$define"; then
15361         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15362             echo "You have both aintl and copysignl, so I can emulate modfl."
15363         else
15364             message="$message modfl"
15365         fi
15366     fi
15367     if $test "$d_frexpl" != "$define"; then
15368         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15369             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15370         else
15371             message="$message frexpl"
15372         fi
15373     fi
15374
15375     if $test "$message" != ""; then
15376         $cat <<EOM >&4
15377
15378 *** You requested the use of long doubles but you do not seem to have
15379 *** the following mathematical functions needed for long double support:
15380 ***    $message
15381 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15382 *** Cannot continue, aborting.
15383
15384 EOM
15385
15386         exit 1
15387     fi
15388 fi
15389
15390 : see if mprotect exists
15391 set mprotect d_mprotect
15392 eval $inlibc
15393
15394 : see if msgctl exists
15395 set msgctl d_msgctl
15396 eval $inlibc
15397
15398 : see if msgget exists
15399 set msgget d_msgget
15400 eval $inlibc
15401
15402 : see if msgsnd exists
15403 set msgsnd d_msgsnd
15404 eval $inlibc
15405
15406 : see if msgrcv exists
15407 set msgrcv d_msgrcv
15408 eval $inlibc
15409
15410 : see how much of the 'msg*(2)' library is present.
15411 h_msg=true
15412 echo " "
15413 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15414 *"$undef"*) h_msg=false;;
15415 esac
15416 case "$osname" in
15417 freebsd)
15418     case "`ipcs 2>&1`" in
15419     "SVID messages"*"not configured"*)
15420         echo "Your $osname does not have the msg*(2) configured." >&4
15421         h_msg=false
15422         val="$undef"
15423         set msgctl d_msgctl
15424         eval $setvar
15425         set msgget d_msgget
15426         eval $setvar
15427         set msgsnd d_msgsnd
15428         eval $setvar
15429         set msgrcv d_msgrcv
15430         eval $setvar
15431         ;;
15432     esac
15433     ;;
15434 esac
15435 : we could also check for sys/ipc.h ...
15436 if $h_msg && $test `./findhdr sys/msg.h`; then
15437         echo "You have the full msg*(2) library." >&4
15438         val="$define"
15439 else
15440         echo "You don't have the full msg*(2) library." >&4
15441         val="$undef"
15442 fi
15443 set d_msg
15444 eval $setvar
15445
15446 : Check for msghdr_s
15447 echo " "
15448 echo "Checking to see if your system supports struct msghdr..." >&4
15449 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15450 eval $hasstruct
15451 case "$d_msghdr_s" in
15452 "$define")      echo "Yes, it does."   ;;
15453 *)              echo "No, it doesn't." ;;
15454 esac
15455
15456
15457 : see if msync exists
15458 set msync d_msync
15459 eval $inlibc
15460
15461 : see if munmap exists
15462 set munmap d_munmap
15463 eval $inlibc
15464
15465 : see if nice exists
15466 set nice d_nice
15467 eval $inlibc
15468
15469 : see if this is a langinfo.h system
15470 set langinfo.h i_langinfo
15471 eval $inhdr
15472
15473 : see if nl_langinfo exists
15474 set nl_langinfo d_nl_langinfo
15475 eval $inlibc
15476
15477 : check for volatile keyword
15478 echo " "
15479 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15480 $cat >try.c <<'EOCP'
15481 int main()
15482 {
15483         typedef struct _goo_struct goo_struct;
15484         goo_struct * volatile goo = ((goo_struct *)0);
15485         struct _goo_struct {
15486                 long long_int;
15487                 int reg_int;
15488                 char char_var;
15489         };
15490         typedef unsigned short foo_t;
15491         char *volatile foo;
15492         volatile int bar;
15493         volatile foo_t blech;
15494         foo = foo;
15495 }
15496 EOCP
15497 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15498         val="$define"
15499         echo "Yup, it does."
15500 else
15501         val="$undef"
15502         echo "Nope, it doesn't."
15503 fi
15504 set d_volatile
15505 eval $setvar
15506 $rm_try
15507
15508 : Check basic sizes
15509 echo " "
15510 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15511
15512 case "$use64bitint:$d_quad:$quadtype" in
15513 define:define:?*)
15514         ivtype="$quadtype"
15515         uvtype="$uquadtype"
15516         ivsize=8
15517         uvsize=8
15518         ;;
15519 *)      ivtype="long"
15520         uvtype="unsigned long"
15521         ivsize=$longsize
15522         uvsize=$longsize
15523         ;;
15524 esac
15525
15526 case "$uselongdouble:$d_longdbl" in
15527 define:define)
15528         nvtype="long double"
15529         nvsize=$longdblsize
15530         ;;
15531 *)      nvtype=double
15532         nvsize=$doublesize
15533         ;;
15534 esac
15535
15536 $echo "(IV will be "$ivtype", $ivsize bytes)"
15537 $echo "(UV will be "$uvtype", $uvsize bytes)"
15538 $echo "(NV will be "$nvtype", $nvsize bytes)"
15539
15540 $cat >try.c <<EOCP
15541 #$i_inttypes I_INTTYPES
15542 #ifdef I_INTTYPES
15543 #include <inttypes.h>
15544 #endif
15545 #include <stdio.h>
15546 int main() {
15547 #ifdef INT8
15548    int8_t i =  INT8_MAX;
15549   uint8_t u = UINT8_MAX;
15550   printf("int8_t\n");
15551 #endif
15552 #ifdef INT16
15553    int16_t i =  INT16_MAX;
15554   uint16_t i = UINT16_MAX;
15555   printf("int16_t\n");
15556 #endif
15557 #ifdef INT32
15558    int32_t i =  INT32_MAX;
15559   uint32_t u = UINT32_MAX;
15560   printf("int32_t\n");
15561 #endif
15562 }
15563 EOCP
15564
15565 i8type="signed char"
15566 u8type="unsigned char"
15567 i8size=1
15568 u8size=1
15569
15570 case "$i16type" in
15571 '')     case "$shortsize" in
15572         2)      i16type=short
15573                 u16type="unsigned short"
15574                 i16size=$shortsize
15575                 u16size=$shortsize
15576                 ;;
15577         esac
15578         ;;
15579 esac
15580 case "$i16type" in
15581 '')     set try -DINT16
15582         if eval $compile; then
15583                 case "`$run ./try`" in
15584                 int16_t)
15585                         i16type=int16_t
15586                         u16type=uint16_t
15587                         i16size=2
15588                         u16size=2
15589                         ;;
15590                 esac
15591         fi
15592         ;;
15593 esac
15594 case "$i16type" in
15595 '')     if $test $shortsize -ge 2; then
15596                 i16type=short
15597                 u16type="unsigned short"
15598                 i16size=$shortsize
15599                 u16size=$shortsize
15600         fi
15601         ;;
15602 esac
15603
15604 case "$i32type" in
15605 '')     case "$longsize" in
15606         4)      i32type=long
15607                 u32type="unsigned long"
15608                 i32size=$longsize
15609                 u32size=$longsize
15610                 ;;
15611         *)      case "$intsize" in
15612                 4)      i32type=int
15613                         u32type="unsigned int"
15614                         i32size=$intsize
15615                         u32size=$intsize
15616                         ;;
15617                 esac
15618                 ;;
15619         esac
15620         ;;
15621 esac
15622 case "$i32type" in
15623 '')     set try -DINT32
15624         if eval $compile; then
15625                 case "`$run ./try`" in
15626                 int32_t)
15627                         i32type=int32_t
15628                         u32type=uint32_t
15629                         i32size=4
15630                         u32size=4
15631                         ;;
15632                 esac
15633         fi
15634         ;;
15635 esac
15636 case "$i32type" in
15637 '')     if $test $intsize -ge 4; then
15638                 i32type=int
15639                 u32type="unsigned int"
15640                 i32size=$intsize
15641                 u32size=$intsize
15642         fi
15643         ;;
15644 esac
15645
15646 case "$i64type" in
15647 '')     case "$d_quad:$quadtype" in
15648         define:?*)
15649                 i64type="$quadtype"
15650                 u64type="$uquadtype"
15651                 i64size=8
15652                 u64size=8
15653                 ;;
15654         esac
15655         ;;
15656 esac
15657
15658 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15659 : volatile so that the compiler has to store it out to memory.
15660 if test X"$d_volatile" = X"$define"; then
15661         volatile=volatile
15662 fi
15663 $cat <<EOP >try.c
15664 #include <stdio.h>
15665 #$i_stdlib I_STDLIB
15666 #ifdef I_STDLIB
15667 #include <stdlib.h>
15668 #endif
15669 #include <sys/types.h>
15670 #include <signal.h>
15671 #ifdef SIGFPE
15672 $volatile int bletched = 0;
15673 $signal_t blech(int s) { bletched = 1; }
15674 #endif
15675 int main() {
15676     $uvtype u = 0;
15677     $nvtype d;
15678     int     n = 8 * $uvsize;
15679     int     i;
15680 #ifdef SIGFPE
15681     signal(SIGFPE, blech);
15682 #endif
15683
15684     for (i = 0; i < n; i++) {
15685       u = u << 1 | ($uvtype)1;
15686       d = ($nvtype)u;
15687       if (($uvtype)d != u)
15688         break;
15689       if (d <= 0)
15690         break;
15691       d = ($nvtype)(u - 1);
15692       if (($uvtype)d != (u - 1))
15693         break;
15694 #ifdef SIGFPE
15695       if (bletched)
15696         break;
15697 #endif
15698     }
15699     printf("%d\n", ((i == n) ? -n : i));
15700     exit(0);
15701 }
15702 EOP
15703 set try
15704
15705 d_nv_preserves_uv="$undef"
15706 if eval $compile; then
15707         nv_preserves_uv_bits="`$run ./try`"
15708 fi
15709 case "$nv_preserves_uv_bits" in
15710 \-[1-9]*)
15711         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15712         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15713         d_nv_preserves_uv="$define"
15714         ;;
15715 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15716         d_nv_preserves_uv="$undef" ;;
15717 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15718         nv_preserves_uv_bits="0" ;;
15719 esac
15720 $rm_try
15721
15722 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15723 : volatile so that the compiler has to store it out to memory.
15724 if test X"$d_volatile" = X"$define"; then
15725         volatile=volatile
15726 fi
15727 $cat <<EOP >try.c
15728 #include <stdio.h>
15729
15730 typedef $nvtype NV;
15731
15732 int
15733 main() {
15734   NV value = 2;
15735   int count = 1;
15736
15737   while(count < 256) {
15738     $volatile NV up = value + 1.0;
15739     $volatile NV negated = -value;
15740     $volatile NV down = negated - 1.0;
15741     $volatile NV got_up = up - value;
15742     int up_good = got_up == 1.0;
15743     int got_down = down - negated;
15744     int down_good = got_down == -1.0;
15745
15746     if (down_good != up_good) {
15747       fprintf(stderr,
15748               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15749               up_good, (double) got_up, down_good, (double) got_down,
15750               count, (double) value);
15751       return 1;
15752     }
15753     if (!up_good) {
15754       while (1) {
15755         if (count > 8) {
15756           count -= 8;
15757           fputs("256.0", stdout);
15758         } else {
15759           count--;
15760           fputs("2.0", stdout);
15761         }
15762         if (!count) {
15763           puts("");
15764           return 0;
15765         }
15766         fputs("*", stdout);
15767       }
15768     }
15769     value *= 2;
15770     ++count;
15771   }
15772   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15773           count, (double) value);
15774   return 1;
15775 }
15776 EOP
15777 set try
15778
15779 nv_overflows_integers_at='0'
15780 if eval $compile; then
15781     xxx="`$run ./try`"
15782     case "$?" in
15783         0)
15784             case "$xxx" in
15785                 2*)  cat >&4 <<EOM
15786 The largest integer your NVs can preserve is equal to $xxx
15787 EOM
15788                     nv_overflows_integers_at="$xxx"
15789                     ;;
15790                 *)  cat >&4 <<EOM
15791 Cannot determine the largest integer value your NVs can hold, unexpected output
15792 '$xxx'
15793 EOM
15794                     ;;
15795             esac
15796             ;;
15797         *)  cat >&4 <<EOM
15798 Cannot determine the largest integer value your NVs can hold
15799 EOM
15800             ;;
15801     esac
15802 fi
15803 $rm_try
15804
15805 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15806 : volatile so that the compiler has to store it out to memory.
15807 if test X"$d_volatile" = X"$define"; then
15808         volatile=volatile
15809 fi
15810 $cat <<EOP >try.c
15811 #include <stdio.h>
15812 #$i_stdlib I_STDLIB
15813 #ifdef I_STDLIB
15814 #include <stdlib.h>
15815 #endif
15816 #$i_string I_STRING
15817 #ifdef I_STRING
15818 #  include <string.h>
15819 #else
15820 #  include <strings.h>
15821 #endif
15822 #include <sys/types.h>
15823 #include <signal.h>
15824 #ifdef SIGFPE
15825 $volatile int bletched = 0;
15826 $signal_t blech(int s) { bletched = 1; }
15827 #endif
15828
15829 int checkit($nvtype d, char *where) {
15830     unsigned char *p = (char *)&d;
15831     unsigned char *end = p + sizeof(d);
15832     int fail = 0;
15833
15834     while (p < end)
15835         fail += *p++;
15836
15837     if (!fail)
15838         return 0;
15839
15840     p = (char *)&d;
15841     printf("No - %s: 0x", where);
15842     while (p < end)
15843         printf ("%02X", *p++);
15844     printf("\n");
15845     return 1;
15846 }
15847
15848 int main(int argc, char **argv) {
15849     $nvtype d = 0.0;
15850     int fail = 0;
15851     fail += checkit(d, "0.0");
15852
15853     /* The compiler shouldn't be assuming that bletched is 0  */
15854     d = bletched;
15855
15856     fail += checkit(d, "bleched");
15857
15858 #ifdef SIGFPE
15859     signal(SIGFPE, blech);
15860 #endif
15861
15862     /* Paranoia - the compiler should have no way of knowing that ANSI says
15863        that argv[argc] will always be NULL.  Actually, if it did assume this it
15864        would be buggy, as this is C and main() can be called from elsewhere in
15865        the program.  */
15866     d = argv[argc] ? 1 : 0;
15867
15868     if (d) {
15869         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15870     }
15871
15872     fail += checkit(d, "ternary");
15873
15874     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15875
15876     if (d != 0.0) {
15877         printf("No - memset doesn't give 0.0\n");
15878         /* This might just blow up:  */
15879         printf("(gives %g)\n", d);
15880         return 1;
15881     }
15882
15883 #ifdef SIGFPE
15884     if (bletched) {
15885         printf("No - something bleched\n");
15886         return 1;
15887     }
15888 #endif
15889     if (fail) {
15890       printf("No - %d fail(s)\n", fail);
15891       return 1;
15892     }
15893     printf("Yes\n");
15894     return 0;
15895 }
15896 EOP
15897 set try
15898
15899 d_nv_zero_is_allbits_zero="$undef"
15900 if eval $compile; then
15901     xxx="`$run ./try`"
15902     case "$?" in
15903         0)
15904             case "$xxx" in
15905                 Yes)  cat >&4 <<EOM
15906 0.0 is represented as all bits zero in memory
15907 EOM
15908                     d_nv_zero_is_allbits_zero="$define"
15909                     ;;
15910                 *)  cat >&4 <<EOM
15911 0.0 is not represented as all bits zero in memory
15912 EOM
15913                     d_nv_zero_is_allbits_zero="$undef"
15914                     ;;
15915             esac
15916             ;;
15917         *)  cat >&4 <<EOM
15918 0.0 is not represented as all bits zero in memory
15919 EOM
15920             d_nv_zero_is_allbits_zero="$undef"
15921             ;;
15922     esac
15923 fi
15924 $rm_try
15925
15926 : check for off64_t
15927 echo " "
15928 echo "Checking to see if you have off64_t..." >&4
15929 $cat >try.c <<EOCP
15930 #include <sys/types.h>
15931 #include <unistd.h>
15932 int main() { off64_t x = 7; }
15933 EOCP
15934 set try
15935 if eval $compile; then
15936         val="$define"
15937         echo "You have off64_t."
15938 else
15939         val="$undef"
15940         echo "You do not have off64_t."
15941         case "$lseeksize" in
15942         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15943         esac
15944 fi
15945 $rm_try
15946 set d_off64_t
15947 eval $setvar
15948
15949 : how to create joinable pthreads
15950 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15951         echo " "
15952         echo "Checking what constant to use for creating joinable pthreads..." >&4
15953         $cat >try.c <<'EOCP'
15954 #include <pthread.h>
15955 int main() {
15956     int detachstate = JOINABLE;
15957 }
15958 EOCP
15959         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15960         if eval $compile; then
15961                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15962                 val="$undef" # Yes, undef.
15963                 set d_old_pthread_create_joinable
15964                 eval $setvar
15965                 val=""
15966                 set old_pthread_create_joinable
15967                 eval $setvar
15968         else
15969                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15970                 if eval $compile; then
15971                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15972                         val="$define"
15973                         set d_old_pthread_create_joinable
15974                         eval $setvar
15975                         val=PTHREAD_CREATE_UNDETACHED
15976                         set old_pthread_create_joinable
15977                         eval $setvar
15978                 else
15979                         set try -DJOINABLE=__UNDETACHED
15980                         if eval $compile; then
15981                                 echo "You seem to use __UNDETACHED." >&4
15982                                 val="$define"
15983                                 set d_old_pthread_create_joinable
15984                                 eval $setvar
15985                                 val=__UNDETACHED
15986                                 set old_pthread_create_joinable
15987                                 eval $setvar
15988                         else
15989                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15990                                 val="$define"
15991                                 set d_old_pthread_create_joinable
15992                                 eval $setvar
15993                                 val=0
15994                                 set old_pthread_create_joinable
15995                                 eval $setvar
15996                         fi
15997                 fi
15998         fi
15999         $rm_try
16000 else
16001     d_old_pthread_create_joinable="$undef"
16002     old_pthread_create_joinable=""
16003 fi
16004
16005 : see if pause exists
16006 set pause d_pause
16007 eval $inlibc
16008
16009 : see if poll exists
16010 set poll d_poll
16011 eval $inlibc
16012
16013 : see if prctl exists
16014 set prctl d_prctl
16015 eval $inlibc
16016
16017 : see if prctl supports PR_SET_NAME
16018 d_prctl_set_name=$undef
16019 case $d_prctl in
16020     $define)
16021         $cat >try.c <<EOM
16022 #include <sys/prctl.h>
16023
16024 int main (int argc, char *argv[])
16025 {
16026     return (prctl (PR_SET_NAME, "Test"));
16027     } /* main */
16028 EOM
16029         set try
16030         if eval $compile_ok && $run ./try; then
16031             echo "Your prctl (PR_SET_NAME, ...) works"
16032             d_prctl_set_name=$define
16033             fi
16034         $rm_try
16035         ;;
16036     esac
16037
16038 : see if readlink exists
16039 set readlink d_readlink
16040 eval $inlibc
16041
16042 : Check if exe is symlink to abs path of executing program
16043 echo " "
16044 procselfexe=''
16045 val="$undef"
16046 case "$d_readlink" in
16047 "$define")
16048         if $issymlink /proc/self/exe ; then
16049                 $ls -l /proc/self/exe > reflect
16050                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16051                         echo "You have Linux-like /proc/self/exe."
16052                         procselfexe='"/proc/self/exe"'
16053                         val="$define"
16054                 fi
16055         fi
16056         if $issymlink /proc/curproc/file ; then
16057                 $ls -l /proc/curproc/file > reflect
16058                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16059                         echo "You have BSD-like /proc/curproc/file."
16060                         procselfexe='"/proc/curproc/file"'
16061                         val="$define"
16062                 fi
16063         fi
16064         ;;
16065 esac
16066 $rm -f reflect
16067 set d_procselfexe
16068 eval $setvar
16069
16070 : backward compatibility for d_hvfork
16071 if test X$d_hvfork != X; then
16072         d_vfork="$d_hvfork"
16073         d_hvfork=''
16074 fi
16075 : see if there is a vfork
16076 val=''
16077 set vfork val
16078 eval $inlibc
16079
16080 d_pseudofork=$undef
16081
16082 : Ok, but do we want to use it. vfork is reportedly unreliable in
16083 : perl on Solaris 2.x, and probably elsewhere.
16084 case "$val" in
16085 $define)
16086         echo " "
16087         case "$usevfork" in
16088         false) dflt='n';;
16089         *) dflt='y';;
16090         esac
16091         cat <<'EOM'
16092
16093 Perl can only use a vfork() that doesn't suffer from strict
16094 restrictions on calling functions or modifying global data in
16095 the child.  For example, glibc-2.1 contains such a vfork()
16096 that is unsuitable.  If your system provides a proper fork()
16097 call, chances are that you do NOT want perl to use vfork().
16098
16099 EOM
16100         rp="Do you still want to use vfork()?"
16101         . ./myread
16102         case "$ans" in
16103         y|Y) ;;
16104         *)
16105                 echo "Ok, we won't use vfork()."
16106                 val="$undef"
16107                 ;;
16108         esac
16109         ;;
16110 esac
16111 set d_vfork
16112 eval $setvar
16113 case "$d_vfork" in
16114 $define) usevfork='true';;
16115 *) usevfork='false';;
16116 esac
16117
16118 : see whether the pthread_atfork exists
16119 $cat >try.c <<EOP
16120 #include <pthread.h>
16121 #include <stdio.h>
16122 int main() {
16123 #ifdef  PTHREAD_ATFORK
16124         pthread_atfork(NULL,NULL,NULL);
16125 #endif
16126 }
16127 EOP
16128
16129 : see if pthread_atfork exists
16130 set try -DPTHREAD_ATFORK
16131 if eval $compile; then
16132     val="$define"
16133 else
16134     val="$undef"
16135 fi
16136 case "$usethreads" in
16137 $define)
16138         case "$val" in
16139         $define) echo 'pthread_atfork found.' >&4        ;;
16140         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16141         esac
16142 esac
16143 set d_pthread_atfork
16144 eval $setvar
16145
16146 : see if pthread_attr_setscope exists
16147 set pthread_attr_setscope d_pthread_attr_setscope
16148 eval $inlibc
16149
16150 : see whether the various POSIXish _yields exist
16151 $cat >try.c <<EOP
16152 #include <pthread.h>
16153 #include <stdio.h>
16154 int main() {
16155 #ifdef SCHED_YIELD
16156         sched_yield();
16157 #else
16158 #ifdef PTHREAD_YIELD
16159         pthread_yield();
16160 #else
16161 #ifdef PTHREAD_YIELD_NULL
16162         pthread_yield(NULL);
16163 #endif
16164 #endif
16165 #endif
16166 }
16167 EOP
16168 : see if sched_yield exists
16169 set try -DSCHED_YIELD
16170 if eval $compile; then
16171     val="$define"
16172     sched_yield='sched_yield()'
16173 else
16174     val="$undef"
16175 fi
16176 case "$usethreads" in
16177 $define)
16178         case "$val" in
16179         $define) echo 'sched_yield() found.' >&4        ;;
16180         *)       echo 'sched_yield() NOT found.' >&4    ;;
16181         esac
16182 esac
16183 set d_sched_yield
16184 eval $setvar
16185
16186 : see if pthread_yield exists
16187 set try -DPTHREAD_YIELD
16188 if eval $compile; then
16189     val="$define"
16190     case "$sched_yield" in
16191     '') sched_yield='pthread_yield()' ;;
16192     esac
16193 else
16194     set try -DPTHREAD_YIELD_NULL
16195     if eval $compile; then
16196         val="$define"
16197         case "$sched_yield" in
16198         '') sched_yield='pthread_yield(NULL)' ;;
16199         esac
16200     else
16201         val="$undef"
16202     fi
16203 fi
16204 case "$usethreads" in
16205 $define)
16206         case "$val" in
16207         $define) echo 'pthread_yield() found.' >&4      ;;
16208         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16209         esac
16210         ;;
16211 esac
16212 set d_pthread_yield
16213 eval $setvar
16214 case "$sched_yield" in
16215 '') sched_yield=undef ;;
16216 esac
16217 $rm_try
16218
16219 : see if random_r exists
16220 set random_r d_random_r
16221 eval $inlibc
16222 case "$d_random_r" in
16223 "$define")
16224         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16225         case "$d_random_r_proto:$usethreads" in
16226         ":define")      d_random_r_proto=define
16227                 set d_random_r_proto random_r $hdrs
16228                 eval $hasproto ;;
16229         *)      ;;
16230         esac
16231         case "$d_random_r_proto" in
16232         define)
16233         case "$random_r_proto" in
16234         ''|0) try='int random_r(int*, struct random_data*);'
16235         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16236         esac
16237         case "$random_r_proto" in
16238         ''|0) try='int random_r(long*, struct random_data*);'
16239         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16240         esac
16241         case "$random_r_proto" in
16242         ''|0) try='int random_r(struct random_data*, int32_t*);'
16243         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16244         esac
16245         case "$random_r_proto" in
16246         ''|0)   d_random_r=undef
16247                 random_r_proto=0
16248                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16249         * )     case "$random_r_proto" in
16250                 REENTRANT_PROTO*) ;;
16251                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16252                 esac
16253                 echo "Prototype: $try" ;;
16254         esac
16255         ;;
16256         *)      case "$usethreads" in
16257                 define) echo "random_r has no prototype, not using it." >&4 ;;
16258                 esac
16259                 d_random_r=undef
16260                 random_r_proto=0
16261                 ;;
16262         esac
16263         ;;
16264 *)      random_r_proto=0
16265         ;;
16266 esac
16267
16268 : see if readdir and friends exist
16269 set readdir d_readdir
16270 eval $inlibc
16271 set seekdir d_seekdir
16272 eval $inlibc
16273 set telldir d_telldir
16274 eval $inlibc
16275 set rewinddir d_rewinddir
16276 eval $inlibc
16277
16278 : see if readdir64_r exists
16279 set readdir64_r d_readdir64_r
16280 eval $inlibc
16281 case "$d_readdir64_r" in
16282 "$define")
16283         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16284         case "$d_readdir64_r_proto:$usethreads" in
16285         ":define")      d_readdir64_r_proto=define
16286                 set d_readdir64_r_proto readdir64_r $hdrs
16287                 eval $hasproto ;;
16288         *)      ;;
16289         esac
16290         case "$d_readdir64_r_proto" in
16291         define)
16292         case "$readdir64_r_proto" in
16293         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16294         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16295         esac
16296         case "$readdir64_r_proto" in
16297         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16298         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16299         esac
16300         case "$readdir64_r_proto" in
16301         ''|0)   d_readdir64_r=undef
16302                 readdir64_r_proto=0
16303                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16304         * )     case "$readdir64_r_proto" in
16305                 REENTRANT_PROTO*) ;;
16306                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16307                 esac
16308                 echo "Prototype: $try" ;;
16309         esac
16310         ;;
16311         *)      case "$usethreads" in
16312                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16313                 esac
16314                 d_readdir64_r=undef
16315                 readdir64_r_proto=0
16316                 ;;
16317         esac
16318         ;;
16319 *)      readdir64_r_proto=0
16320         ;;
16321 esac
16322
16323 : see if readdir_r exists
16324 set readdir_r d_readdir_r
16325 eval $inlibc
16326 case "$d_readdir_r" in
16327 "$define")
16328         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16329         case "$d_readdir_r_proto:$usethreads" in
16330         ":define")      d_readdir_r_proto=define
16331                 set d_readdir_r_proto readdir_r $hdrs
16332                 eval $hasproto ;;
16333         *)      ;;
16334         esac
16335         case "$d_readdir_r_proto" in
16336         define)
16337         case "$readdir_r_proto" in
16338         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16339         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16340         esac
16341         case "$readdir_r_proto" in
16342         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16343         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16344         esac
16345         case "$readdir_r_proto" in
16346         ''|0)   d_readdir_r=undef
16347                 readdir_r_proto=0
16348                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16349         * )     case "$readdir_r_proto" in
16350                 REENTRANT_PROTO*) ;;
16351                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16352                 esac
16353                 echo "Prototype: $try" ;;
16354         esac
16355         ;;
16356         *)      case "$usethreads" in
16357                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16358                 esac
16359                 d_readdir_r=undef
16360                 readdir_r_proto=0
16361                 ;;
16362         esac
16363         ;;
16364 *)      readdir_r_proto=0
16365         ;;
16366 esac
16367
16368 : see if readv exists
16369 set readv d_readv
16370 eval $inlibc
16371
16372 : see if recvmsg exists
16373 set recvmsg d_recvmsg
16374 eval $inlibc
16375
16376 : see if rename exists
16377 set rename d_rename
16378 eval $inlibc
16379
16380 : see if rmdir exists
16381 set rmdir d_rmdir
16382 eval $inlibc
16383
16384 : see if memory.h is available.
16385 val=''
16386 set memory.h val
16387 eval $inhdr
16388
16389 : See if it conflicts with string.h
16390 case "$val" in
16391 $define)
16392         case "$strings" in
16393         '') ;;
16394         *)
16395                 $cppstdin $cppflags $cppminus < $strings > mem.h
16396                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16397                         echo " "
16398                         echo "We won't be including <memory.h>."
16399                         val="$undef"
16400                 fi
16401                 $rm -f mem.h
16402                 ;;
16403         esac
16404 esac
16405 set i_memory
16406 eval $setvar
16407
16408 : can bcopy handle overlapping blocks?
16409 echo " "
16410 val="$undef"
16411 case "$d_memmove" in
16412 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16413 *)      case "$d_bcopy" in
16414         "$define")
16415                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16416                 $cat >try.c <<EOCP
16417 #$i_memory I_MEMORY
16418 #$i_stdlib I_STDLIB
16419 #$i_string I_STRING
16420 #$i_unistd I_UNISTD
16421 EOCP
16422         $cat >>try.c <<'EOCP'
16423 #include <stdio.h>
16424 #ifdef I_MEMORY
16425 #  include <memory.h>
16426 #endif
16427 #ifdef I_STDLIB
16428 #  include <stdlib.h>
16429 #endif
16430 #ifdef I_STRING
16431 #  include <string.h>
16432 #else
16433 #  include <strings.h>
16434 #endif
16435 #ifdef I_UNISTD
16436 #  include <unistd.h>  /* Needed for NetBSD */
16437 #endif
16438 int main()
16439 {
16440 char buf[128], abc[128];
16441 char *b;
16442 int len;
16443 int off;
16444 int align;
16445
16446 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16447    try to store the string in read-only memory. */
16448 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16449
16450 for (align = 7; align >= 0; align--) {
16451         for (len = 36; len; len--) {
16452                 b = buf+align;
16453                 bcopy(abc, b, len);
16454                 for (off = 1; off <= len; off++) {
16455                         bcopy(b, b+off, len);
16456                         bcopy(b+off, b, len);
16457                         if (bcmp(b, abc, len))
16458                                 exit(1);
16459                 }
16460         }
16461 }
16462 exit(0);
16463 }
16464 EOCP
16465                 set try
16466                 if eval $compile_ok; then
16467                         if $run ./try 2>/dev/null; then
16468                                 echo "Yes, it can."
16469                                 val="$define"
16470                         else
16471                                 echo "It can't, sorry."
16472                         fi
16473                 else
16474                         echo "(I can't compile the test program, so we'll assume not...)"
16475                 fi
16476                 ;;
16477         esac
16478         $rm_try
16479         ;;
16480 esac
16481 set d_safebcpy
16482 eval $setvar
16483
16484 : can memcpy handle overlapping blocks?
16485 echo " "
16486 val="$undef"
16487 case "$d_memmove" in
16488 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16489 *)      case "$d_memcpy" in
16490         "$define")
16491                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16492                 $cat >try.c <<EOCP
16493 #$i_memory I_MEMORY
16494 #$i_stdlib I_STDLIB
16495 #$i_string I_STRING
16496 #$i_unistd I_UNISTD
16497 EOCP
16498         $cat >>try.c <<'EOCP'
16499 #include <stdio.h>
16500 #ifdef I_MEMORY
16501 #  include <memory.h>
16502 #endif
16503 #ifdef I_STDLIB
16504 #  include <stdlib.h>
16505 #endif
16506 #ifdef I_STRING
16507 #  include <string.h>
16508 #else
16509 #  include <strings.h>
16510 #endif
16511 #ifdef I_UNISTD
16512 #  include <unistd.h>  /* Needed for NetBSD */
16513 #endif
16514 int main()
16515 {
16516 char buf[128], abc[128];
16517 char *b;
16518 int len;
16519 int off;
16520 int align;
16521
16522 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16523    try to store the string in read-only memory. */
16524 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16525
16526 for (align = 7; align >= 0; align--) {
16527         for (len = 36; len; len--) {
16528                 b = buf+align;
16529                 memcpy(b, abc, len);
16530                 for (off = 1; off <= len; off++) {
16531                         memcpy(b+off, b, len);
16532                         memcpy(b, b+off, len);
16533                         if (memcmp(b, abc, len))
16534                                 exit(1);
16535                 }
16536         }
16537 }
16538 exit(0);
16539 }
16540 EOCP
16541                 set try
16542                 if eval $compile_ok; then
16543                         if $run ./try 2>/dev/null; then
16544                                 echo "Yes, it can."
16545                                 val="$define"
16546                         else
16547                                 echo "It can't, sorry."
16548                         fi
16549                 else
16550                         echo "(I can't compile the test program, so we'll assume not...)"
16551                 fi
16552                 ;;
16553         esac
16554         $rm_try
16555         ;;
16556 esac
16557 set d_safemcpy
16558 eval $setvar
16559
16560 : can memcmp be trusted to compare relative magnitude?
16561 val="$undef"
16562 case "$d_memcmp" in
16563 "$define")
16564         echo " "
16565         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16566         $cat >try.c <<EOCP
16567 #$i_memory I_MEMORY
16568 #$i_stdlib I_STDLIB
16569 #$i_string I_STRING
16570 #$i_unistd I_UNISTD
16571 EOCP
16572         $cat >>try.c <<'EOCP'
16573 #include <stdio.h>
16574 #ifdef I_MEMORY
16575 #  include <memory.h>
16576 #endif
16577 #ifdef I_STDLIB
16578 #  include <stdlib.h>
16579 #endif
16580 #ifdef I_STRING
16581 #  include <string.h>
16582 #else
16583 #  include <strings.h>
16584 #endif
16585 #ifdef I_UNISTD
16586 #  include <unistd.h>  /* Needed for NetBSD */
16587 #endif
16588 int main()
16589 {
16590 char a = -1;
16591 char b = 0;
16592 if ((a < b) && memcmp(&a, &b, 1) < 0)
16593         exit(1);
16594 exit(0);
16595 }
16596 EOCP
16597         set try
16598         if eval $compile_ok; then
16599                 if $run ./try 2>/dev/null; then
16600                         echo "Yes, it can."
16601                         val="$define"
16602                 else
16603                         echo "No, it can't (it uses signed chars)."
16604                 fi
16605         else
16606                 echo "(I can't compile the test program, so we'll assume not...)"
16607         fi
16608         ;;
16609 esac
16610 $rm_try
16611 set d_sanemcmp
16612 eval $setvar
16613
16614 : see if prototype for sbrk is available
16615 echo " "
16616 set d_sbrkproto sbrk $i_unistd unistd.h
16617 eval $hasproto
16618
16619 : see if select exists
16620 set select d_select
16621 eval $inlibc
16622
16623 : see if semctl exists
16624 set semctl d_semctl
16625 eval $inlibc
16626
16627 : see if semget exists
16628 set semget d_semget
16629 eval $inlibc
16630
16631 : see if semop exists
16632 set semop d_semop
16633 eval $inlibc
16634
16635 : see how much of the 'sem*(2)' library is present.
16636 h_sem=true
16637 echo " "
16638 case "$d_semctl$d_semget$d_semop" in
16639 *"$undef"*) h_sem=false;;
16640 esac
16641 case "$osname" in
16642 freebsd)
16643     case "`ipcs 2>&1`" in
16644     "SVID messages"*"not configured"*)
16645         echo "Your $osname does not have the sem*(2) configured." >&4
16646         h_sem=false
16647         val="$undef"
16648         set semctl d_semctl
16649         eval $setvar
16650         set semget d_semget
16651         eval $setvar
16652         set semop d_semop
16653         eval $setvar
16654         ;;
16655     esac
16656     ;;
16657 esac
16658 : we could also check for sys/ipc.h ...
16659 if $h_sem && $test `./findhdr sys/sem.h`; then
16660         echo "You have the full sem*(2) library." >&4
16661         val="$define"
16662 else
16663         echo "You don't have the full sem*(2) library." >&4
16664         val="$undef"
16665 fi
16666 set d_sem
16667 eval $setvar
16668
16669 : see whether sys/sem.h defines union semun
16670 echo " "
16671 $cat > try.c <<'END'
16672 #include <sys/types.h>
16673 #include <sys/ipc.h>
16674 #include <sys/sem.h>
16675 int main () { union semun semun; semun.buf = 0; }
16676 END
16677 set try
16678 if eval $compile; then
16679     echo "You have union semun in <sys/sem.h>." >&4
16680     val="$define"
16681 else
16682     echo "You do not have union semun in <sys/sem.h>." >&4
16683     val="$undef"
16684 fi
16685 $rm_try
16686 set d_union_semun
16687 eval $setvar
16688
16689 : see how to do semctl IPC_STAT
16690 case "$d_sem" in
16691 $define)
16692     echo " "
16693     $cat > tryh.h <<END
16694 #ifndef S_IRUSR
16695 #   ifdef S_IREAD
16696 #       define S_IRUSR S_IREAD
16697 #       define S_IWUSR S_IWRITE
16698 #       define S_IXUSR S_IEXEC
16699 #   else
16700 #       define S_IRUSR 0400
16701 #       define S_IWUSR 0200
16702 #       define S_IXUSR 0100
16703 #   endif
16704 #   define S_IRGRP (S_IRUSR>>3)
16705 #   define S_IWGRP (S_IWUSR>>3)
16706 #   define S_IXGRP (S_IXUSR>>3)
16707 #   define S_IROTH (S_IRUSR>>6)
16708 #   define S_IWOTH (S_IWUSR>>6)
16709 #   define S_IXOTH (S_IXUSR>>6)
16710 #endif
16711 #ifndef S_IRWXU
16712 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16713 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16714 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16715 #endif
16716 END
16717     : see whether semctl IPC_STAT can use union semun
16718     case "$d_semctl_semun" in
16719     '')
16720       val="$undef"
16721       $cat > try.c <<END
16722 #include <sys/types.h>
16723 #include <sys/ipc.h>
16724 #include <sys/sem.h>
16725 #include <sys/stat.h>
16726 #include <stdio.h>
16727 #include <errno.h>
16728 #include "tryh.h"
16729 #ifndef errno
16730 extern int errno;
16731 #endif
16732 #$d_union_semun HAS_UNION_SEMUN
16733 int main() {
16734     union semun
16735 #ifndef HAS_UNION_SEMUN
16736     {
16737         int val;
16738         struct semid_ds *buf;
16739         unsigned short *array;
16740     }
16741 #endif
16742     arg;
16743     int sem, st;
16744
16745 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16746     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16747     if (sem > -1) {
16748         struct semid_ds argbuf;
16749         arg.buf = &argbuf;
16750 #       ifdef IPC_STAT
16751         st = semctl(sem, 0, IPC_STAT, arg);
16752         if (st == 0)
16753             printf("semun\n");
16754         else
16755 #       endif /* IPC_STAT */
16756             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16757 #       ifdef IPC_RMID
16758         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16759 #       endif /* IPC_RMID */
16760             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16761     } else
16762 #endif /* IPC_PRIVATE && ... */
16763         printf("semget failed: errno = %d\n", errno);
16764   return 0;
16765 }
16766 END
16767       set try
16768       if eval $compile; then
16769           xxx=`$run ./try`
16770           case "$xxx" in
16771           semun) val="$define" ;;
16772           esac
16773       fi
16774       $rm_try
16775       set d_semctl_semun
16776       eval $setvar
16777       ;;
16778     esac
16779     case "$d_semctl_semun" in
16780     $define)
16781         echo "You can use union semun for semctl IPC_STAT." >&4
16782         also='also'
16783         ;;
16784     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16785         also=''
16786         ;;
16787     esac
16788
16789     : see whether semctl IPC_STAT can use struct semid_ds pointer
16790     case "$d_semctl_semid_ds" in
16791     '')
16792       val="$undef"
16793       $cat > try.c <<'END'
16794 #include <sys/types.h>
16795 #include <sys/ipc.h>
16796 #include <sys/sem.h>
16797 #include <sys/stat.h>
16798 #include "tryh.h"
16799 #include <stdio.h>
16800 #include <errno.h>
16801 #ifndef errno
16802 extern int errno;
16803 #endif
16804 int main() {
16805     struct semid_ds arg;
16806     int sem, st;
16807
16808 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16809     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16810     if (sem > -1) {
16811 #       ifdef IPC_STAT
16812         st = semctl(sem, 0, IPC_STAT, &arg);
16813         if (st == 0)
16814             printf("semid_ds\n");
16815         else
16816 #       endif /* IPC_STAT */
16817             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16818 #       ifdef IPC_RMID
16819         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16820 #       endif /* IPC_RMID */
16821             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16822     } else
16823 #endif /* IPC_PRIVATE && ... */
16824         printf("semget failed: errno = %d\n", errno);
16825
16826     return 0;
16827 }
16828 END
16829       set try
16830       if eval $compile; then
16831           xxx=`$run ./try`
16832           case "$xxx" in
16833           semid_ds) val="$define" ;;
16834           esac
16835       fi
16836       $rm_try
16837       set d_semctl_semid_ds
16838       eval $setvar
16839       ;;
16840     esac
16841     case "$d_semctl_semid_ds" in
16842     $define)
16843         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16844         ;;
16845     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16846         ;;
16847     esac
16848     ;;
16849 *)  val="$undef"
16850
16851     # We do not have the full sem*(2) library, so assume we can not
16852     # use either.
16853
16854     set d_semctl_semun
16855     eval $setvar
16856
16857     set d_semctl_semid_ds
16858     eval $setvar
16859     ;;
16860 esac
16861 $rm_try tryh.h
16862
16863 : see if sendmsg exists
16864 set sendmsg d_sendmsg
16865 eval $inlibc
16866
16867 : see if setegid exists
16868 set setegid d_setegid
16869 eval $inlibc
16870
16871 : see if seteuid exists
16872 set seteuid d_seteuid
16873 eval $inlibc
16874
16875 : see if setgrent exists
16876 set setgrent d_setgrent
16877 eval $inlibc
16878
16879 : see if setgrent_r exists
16880 set setgrent_r d_setgrent_r
16881 eval $inlibc
16882 case "$d_setgrent_r" in
16883 "$define")
16884         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16885         case "$d_setgrent_r_proto:$usethreads" in
16886         ":define")      d_setgrent_r_proto=define
16887                 set d_setgrent_r_proto setgrent_r $hdrs
16888                 eval $hasproto ;;
16889         *)      ;;
16890         esac
16891         case "$d_setgrent_r_proto" in
16892         define)
16893         case "$setgrent_r_proto" in
16894         ''|0) try='int setgrent_r(FILE**);'
16895         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
16896         esac
16897         case "$setgrent_r_proto" in
16898         ''|0) try='void setgrent_r(FILE**);'
16899         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
16900         esac
16901         case "$setgrent_r_proto" in
16902         ''|0)   d_setgrent_r=undef
16903                 setgrent_r_proto=0
16904                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16905         * )     case "$setgrent_r_proto" in
16906                 REENTRANT_PROTO*) ;;
16907                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16908                 esac
16909                 echo "Prototype: $try" ;;
16910         esac
16911         ;;
16912         *)      case "$usethreads" in
16913                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16914                 esac
16915                 d_setgrent_r=undef
16916                 setgrent_r_proto=0
16917                 ;;
16918         esac
16919         ;;
16920 *)      setgrent_r_proto=0
16921         ;;
16922 esac
16923
16924 : see if sethostent exists
16925 set sethostent d_sethent
16926 eval $inlibc
16927
16928 : see if sethostent_r exists
16929 set sethostent_r d_sethostent_r
16930 eval $inlibc
16931 case "$d_sethostent_r" in
16932 "$define")
16933         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16934         case "$d_sethostent_r_proto:$usethreads" in
16935         ":define")      d_sethostent_r_proto=define
16936                 set d_sethostent_r_proto sethostent_r $hdrs
16937                 eval $hasproto ;;
16938         *)      ;;
16939         esac
16940         case "$d_sethostent_r_proto" in
16941         define)
16942         case "$sethostent_r_proto" in
16943         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16944         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
16945         esac
16946         case "$sethostent_r_proto" in
16947         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16948         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
16949         esac
16950         case "$sethostent_r_proto" in
16951         ''|0)   d_sethostent_r=undef
16952                 sethostent_r_proto=0
16953                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16954         * )     case "$sethostent_r_proto" in
16955                 REENTRANT_PROTO*) ;;
16956                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16957                 esac
16958                 echo "Prototype: $try" ;;
16959         esac
16960         ;;
16961         *)      case "$usethreads" in
16962                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16963                 esac
16964                 d_sethostent_r=undef
16965                 sethostent_r_proto=0
16966                 ;;
16967         esac
16968         ;;
16969 *)      sethostent_r_proto=0
16970         ;;
16971 esac
16972
16973 : see if setitimer exists
16974 set setitimer d_setitimer
16975 eval $inlibc
16976
16977 : see if setlinebuf exists
16978 set setlinebuf d_setlinebuf
16979 eval $inlibc
16980
16981 : see if setlocale exists
16982 set setlocale d_setlocale
16983 eval $inlibc
16984
16985 : see if locale.h is available
16986 set locale.h i_locale
16987 eval $inhdr
16988
16989 : see if setlocale_r exists
16990 set setlocale_r d_setlocale_r
16991 eval $inlibc
16992 case "$d_setlocale_r" in
16993 "$define")
16994         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16995         case "$d_setlocale_r_proto:$usethreads" in
16996         ":define")      d_setlocale_r_proto=define
16997                 set d_setlocale_r_proto setlocale_r $hdrs
16998                 eval $hasproto ;;
16999         *)      ;;
17000         esac
17001         case "$d_setlocale_r_proto" in
17002         define)
17003         case "$setlocale_r_proto" in
17004         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17005         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17006         esac
17007         case "$setlocale_r_proto" in
17008         ''|0)   d_setlocale_r=undef
17009                 setlocale_r_proto=0
17010                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17011         * )     case "$setlocale_r_proto" in
17012                 REENTRANT_PROTO*) ;;
17013                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17014                 esac
17015                 echo "Prototype: $try" ;;
17016         esac
17017         ;;
17018         *)      case "$usethreads" in
17019                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17020                 esac
17021                 d_setlocale_r=undef
17022                 setlocale_r_proto=0
17023                 ;;
17024         esac
17025         ;;
17026 *)      setlocale_r_proto=0
17027         ;;
17028 esac
17029
17030 : see if setnetent exists
17031 set setnetent d_setnent
17032 eval $inlibc
17033
17034 : see if setnetent_r exists
17035 set setnetent_r d_setnetent_r
17036 eval $inlibc
17037 case "$d_setnetent_r" in
17038 "$define")
17039         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17040         case "$d_setnetent_r_proto:$usethreads" in
17041         ":define")      d_setnetent_r_proto=define
17042                 set d_setnetent_r_proto setnetent_r $hdrs
17043                 eval $hasproto ;;
17044         *)      ;;
17045         esac
17046         case "$d_setnetent_r_proto" in
17047         define)
17048         case "$setnetent_r_proto" in
17049         ''|0) try='int setnetent_r(int, struct netent_data*);'
17050         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17051         esac
17052         case "$setnetent_r_proto" in
17053         ''|0) try='void setnetent_r(int, struct netent_data*);'
17054         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17055         esac
17056         case "$setnetent_r_proto" in
17057         ''|0)   d_setnetent_r=undef
17058                 setnetent_r_proto=0
17059                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17060         * )     case "$setnetent_r_proto" in
17061                 REENTRANT_PROTO*) ;;
17062                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17063                 esac
17064                 echo "Prototype: $try" ;;
17065         esac
17066         ;;
17067         *)      case "$usethreads" in
17068                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17069                 esac
17070                 d_setnetent_r=undef
17071                 setnetent_r_proto=0
17072                 ;;
17073         esac
17074         ;;
17075 *)      setnetent_r_proto=0
17076         ;;
17077 esac
17078
17079 : see if setprotoent exists
17080 set setprotoent d_setpent
17081 eval $inlibc
17082
17083 : see if setpgid exists
17084 set setpgid d_setpgid
17085 eval $inlibc
17086
17087 : see if setpgrp2 exists
17088 set setpgrp2 d_setpgrp2
17089 eval $inlibc
17090
17091 : see if setpriority exists
17092 set setpriority d_setprior
17093 eval $inlibc
17094
17095 : see if setproctitle exists
17096 set setproctitle d_setproctitle
17097 eval $inlibc
17098
17099 : see if setprotoent_r exists
17100 set setprotoent_r d_setprotoent_r
17101 eval $inlibc
17102 case "$d_setprotoent_r" in
17103 "$define")
17104         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17105         case "$d_setprotoent_r_proto:$usethreads" in
17106         ":define")      d_setprotoent_r_proto=define
17107                 set d_setprotoent_r_proto setprotoent_r $hdrs
17108                 eval $hasproto ;;
17109         *)      ;;
17110         esac
17111         case "$d_setprotoent_r_proto" in
17112         define)
17113         case "$setprotoent_r_proto" in
17114         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17115         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17116         esac
17117         case "$setprotoent_r_proto" in
17118         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17119         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17120         esac
17121         case "$setprotoent_r_proto" in
17122         ''|0)   d_setprotoent_r=undef
17123                 setprotoent_r_proto=0
17124                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17125         * )     case "$setprotoent_r_proto" in
17126                 REENTRANT_PROTO*) ;;
17127                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17128                 esac
17129                 echo "Prototype: $try" ;;
17130         esac
17131         ;;
17132         *)      case "$usethreads" in
17133                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17134                 esac
17135                 d_setprotoent_r=undef
17136                 setprotoent_r_proto=0
17137                 ;;
17138         esac
17139         ;;
17140 *)      setprotoent_r_proto=0
17141         ;;
17142 esac
17143
17144 : see if setpwent exists
17145 set setpwent d_setpwent
17146 eval $inlibc
17147
17148 : see if setpwent_r exists
17149 set setpwent_r d_setpwent_r
17150 eval $inlibc
17151 case "$d_setpwent_r" in
17152 "$define")
17153         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17154         case "$d_setpwent_r_proto:$usethreads" in
17155         ":define")      d_setpwent_r_proto=define
17156                 set d_setpwent_r_proto setpwent_r $hdrs
17157                 eval $hasproto ;;
17158         *)      ;;
17159         esac
17160         case "$d_setpwent_r_proto" in
17161         define)
17162         case "$setpwent_r_proto" in
17163         ''|0) try='int setpwent_r(FILE**);'
17164         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17165         esac
17166         case "$setpwent_r_proto" in
17167         ''|0) try='void setpwent_r(FILE**);'
17168         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17169         esac
17170         case "$setpwent_r_proto" in
17171         ''|0)   d_setpwent_r=undef
17172                 setpwent_r_proto=0
17173                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17174         * )     case "$setpwent_r_proto" in
17175                 REENTRANT_PROTO*) ;;
17176                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17177                 esac
17178                 echo "Prototype: $try" ;;
17179         esac
17180         ;;
17181         *)      case "$usethreads" in
17182                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17183                 esac
17184                 d_setpwent_r=undef
17185                 setpwent_r_proto=0
17186                 ;;
17187         esac
17188         ;;
17189 *)      setpwent_r_proto=0
17190         ;;
17191 esac
17192
17193 : see if setregid exists
17194 set setregid d_setregid
17195 eval $inlibc
17196 set setresgid d_setresgid
17197 eval $inlibc
17198
17199 : see if setreuid exists
17200 set setreuid d_setreuid
17201 eval $inlibc
17202 set setresuid d_setresuid
17203 eval $inlibc
17204
17205 : see if setrgid exists
17206 set setrgid d_setrgid
17207 eval $inlibc
17208
17209 : see if setruid exists
17210 set setruid d_setruid
17211 eval $inlibc
17212
17213 : see if setservent exists
17214 set setservent d_setsent
17215 eval $inlibc
17216
17217 : see if setservent_r exists
17218 set setservent_r d_setservent_r
17219 eval $inlibc
17220 case "$d_setservent_r" in
17221 "$define")
17222         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17223         case "$d_setservent_r_proto:$usethreads" in
17224         ":define")      d_setservent_r_proto=define
17225                 set d_setservent_r_proto setservent_r $hdrs
17226                 eval $hasproto ;;
17227         *)      ;;
17228         esac
17229         case "$d_setservent_r_proto" in
17230         define)
17231         case "$setservent_r_proto" in
17232         ''|0) try='int setservent_r(int, struct servent_data*);'
17233         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17234         esac
17235         case "$setservent_r_proto" in
17236         ''|0) try='void setservent_r(int, struct servent_data*);'
17237         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17238         esac
17239         case "$setservent_r_proto" in
17240         ''|0)   d_setservent_r=undef
17241                 setservent_r_proto=0
17242                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17243         * )     case "$setservent_r_proto" in
17244                 REENTRANT_PROTO*) ;;
17245                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17246                 esac
17247                 echo "Prototype: $try" ;;
17248         esac
17249         ;;
17250         *)      case "$usethreads" in
17251                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17252                 esac
17253                 d_setservent_r=undef
17254                 setservent_r_proto=0
17255                 ;;
17256         esac
17257         ;;
17258 *)      setservent_r_proto=0
17259         ;;
17260 esac
17261
17262 : see if setsid exists
17263 set setsid d_setsid
17264 eval $inlibc
17265
17266 : see if setvbuf exists
17267 set setvbuf d_setvbuf
17268 eval $inlibc
17269
17270 : see if sfio.h is available
17271 set sfio.h i_sfio
17272 eval $inhdr
17273
17274 : see if sfio library is available
17275 case "$i_sfio" in
17276 $define)
17277         val=''
17278         set sfreserve val
17279         eval $inlibc
17280         ;;
17281 *)
17282         val="$undef"
17283         ;;
17284 esac
17285 : Ok, but do we want to use it.
17286 case "$val" in
17287 $define)
17288         case "$usesfio" in
17289         true|$define|[yY]*) dflt='y';;
17290         *) dflt='n';;
17291         esac
17292         echo "$package can use the sfio library, but it is experimental."
17293         rp="You seem to have sfio available, do you want to try using it?"
17294         . ./myread
17295         case "$ans" in
17296         y|Y)    echo "Ok, turning on sfio then."
17297                 val="$define"
17298                 ;;
17299         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17300                 val="$undef"
17301                 ;;
17302         esac
17303         ;;
17304 *)      case "$usesfio" in
17305         true|$define|[yY]*)
17306                 echo "Sorry, cannot find sfio on this machine." >&4
17307                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17308                 val="$undef"
17309                 ;;
17310         esac
17311         ;;
17312 esac
17313 set d_sfio
17314 eval $setvar
17315 case "$d_sfio" in
17316 $define) usesfio='true';;
17317 *) usesfio='false';;
17318 esac
17319 case "$d_sfio" in
17320 $define) ;;
17321 *)      : Remove sfio from list of libraries to use
17322         case "$libs" in
17323         *-lsfio*)
17324                 echo "Removing unneeded -lsfio from library list" >&4
17325                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17326                 shift
17327                 libs="$*"
17328                 echo "libs = $libs" >&4
17329                 ;;
17330         esac
17331 ;;
17332 esac
17333
17334
17335 : see if shmctl exists
17336 set shmctl d_shmctl
17337 eval $inlibc
17338
17339 : see if shmget exists
17340 set shmget d_shmget
17341 eval $inlibc
17342
17343 : see if shmat exists
17344 set shmat d_shmat
17345 eval $inlibc
17346 : see what shmat returns
17347 case "$d_shmat" in
17348 "$define")
17349         $cat >shmat.c <<'END'
17350 #include <sys/shm.h>
17351 void *shmat();
17352 END
17353         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17354                 shmattype='void *'
17355         else
17356                 shmattype='char *'
17357         fi
17358         echo "and it returns ($shmattype)." >&4
17359         : see if a prototype for shmat is available
17360         xxx=`./findhdr sys/shm.h`
17361         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17362         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17363                 val="$define"
17364         else
17365                 val="$undef"
17366         fi
17367         $rm -f shmat.[co]
17368         ;;
17369 *)
17370         val="$undef"
17371         ;;
17372 esac
17373 set d_shmatprototype
17374 eval $setvar
17375
17376 : see if shmdt exists
17377 set shmdt d_shmdt
17378 eval $inlibc
17379
17380 : see how much of the 'shm*(2)' library is present.
17381 h_shm=true
17382 echo " "
17383 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17384 *"$undef"*) h_shm=false;;
17385 esac
17386 case "$osname" in
17387 freebsd)
17388     case "`ipcs 2>&1`" in
17389     "SVID shared memory"*"not configured"*)
17390         echo "Your $osname does not have the shm*(2) configured." >&4
17391         h_shm=false
17392         val="$undef"
17393         set shmctl d_shmctl
17394         evat $setvar
17395         set shmget d_shmget
17396         evat $setvar
17397         set shmat d_shmat
17398         evat $setvar
17399         set shmdt d_shmdt
17400         evat $setvar
17401         ;;
17402     esac
17403     ;;
17404 esac
17405 : we could also check for sys/ipc.h ...
17406 if $h_shm && $test `./findhdr sys/shm.h`; then
17407         echo "You have the full shm*(2) library." >&4
17408         val="$define"
17409 else
17410         echo "You don't have the full shm*(2) library." >&4
17411         val="$undef"
17412 fi
17413 set d_shm
17414 eval $setvar
17415
17416 : see if we have sigaction
17417 echo " "
17418 if set sigaction val -f d_sigaction; eval $csym; $val; then
17419         echo 'sigaction() found.' >&4
17420         $cat > try.c <<EOP
17421 #include <stdio.h>
17422 #include <sys/types.h>
17423 #include <signal.h>
17424 #$i_stdlib I_STDLIB
17425 #ifdef I_STDLIB
17426 #include <stdlib.h>
17427 #endif
17428 int main()
17429 {
17430     struct sigaction act, oact;
17431     act.sa_flags = 0;
17432     oact.sa_handler = 0;
17433     /* so that act and oact are used */
17434     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17435 }
17436 EOP
17437         set try
17438         if eval $compile_ok; then
17439                 val="$define"
17440         else
17441                 echo "But you don't seem to have a useable struct sigaction." >&4
17442                 val="$undef"
17443         fi
17444 else
17445         echo 'sigaction NOT found.' >&4
17446         val="$undef"
17447 fi
17448 set d_sigaction; eval $setvar
17449 $rm_try
17450
17451 : see if this is a sunmath.h system
17452 set sunmath.h i_sunmath
17453 eval $inhdr
17454
17455 : see if signbit exists
17456 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17457 $cat >try.c <<EOCP
17458 #$i_math I_MATH
17459 #$i_sunmath I_SUNMATH
17460 #ifdef I_MATH
17461 #  include <math.h>
17462 #endif
17463 #ifdef I_SUNMATH  /* Solaris special math library */
17464 #  include <sunmath.h>
17465 #endif
17466 #define NV $nvtype
17467 int main(int argc, char **argv)
17468 {
17469     NV x = 0.0;
17470     NV y = -0.0;
17471     if ((signbit(x) == 0) && (signbit(y) != 0))
17472         return 0;
17473     else
17474         return 1;
17475 }
17476 EOCP
17477 val="$undef"
17478 set try
17479 if eval $compile; then
17480     if $run ./try; then
17481         $echo "Yes." >&4
17482         val="$define"
17483     else
17484         $echo "Signbit seems to be available, but doesn't work as I expected."
17485         $echo "I won't use it." >&4
17486         val="$undef"
17487     fi
17488 else
17489     $echo "Nope." >&4
17490     dflt="$undef"
17491 fi
17492 set d_signbit
17493 eval $setvar
17494 $rm_try
17495
17496 : see if sigprocmask exists
17497 set sigprocmask d_sigprocmask
17498 eval $inlibc
17499
17500 : see if sigsetjmp exists
17501 echo " "
17502 case "$d_sigsetjmp" in
17503 '')
17504         $cat >try.c <<EOP
17505 #include <setjmp.h>
17506 #$i_stdlib I_STDLIB
17507 #ifdef I_STDLIB
17508 #include <stdlib.h>
17509 #endif
17510 sigjmp_buf env;
17511 int set = 1;
17512 int main()
17513 {
17514         if (sigsetjmp(env,1))
17515                 exit(set);
17516         set = 0;
17517         siglongjmp(env, 1);
17518         exit(1);
17519 }
17520 EOP
17521         set try
17522         if eval $compile; then
17523                 if $run ./try >/dev/null 2>&1; then
17524                         echo "POSIX sigsetjmp found." >&4
17525                         val="$define"
17526                 else
17527                         $cat >&4 <<EOM
17528 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17529 I'll ignore them.
17530 EOM
17531                         val="$undef"
17532                 fi
17533         else
17534                 echo "sigsetjmp not found." >&4
17535                 val="$undef"
17536         fi
17537         ;;
17538 *) val="$d_sigsetjmp"
17539         case "$d_sigsetjmp" in
17540         $define) echo "POSIX sigsetjmp found." >&4;;
17541         $undef) echo "sigsetjmp not found." >&4;;
17542         esac
17543         ;;
17544 esac
17545 set d_sigsetjmp
17546 eval $setvar
17547 $rm_try
17548
17549 : see if snprintf exists
17550 set snprintf d_snprintf
17551 eval $inlibc
17552
17553 : see if vsnprintf exists
17554 set vsnprintf d_vsnprintf
17555 eval $inlibc
17556
17557 case "$d_snprintf-$d_vsnprintf" in
17558 "$define-$define")
17559     $cat <<EOM
17560 Checking whether your snprintf() and vsnprintf() work okay...
17561 EOM
17562     $cat >try.c <<'EOCP'
17563 /* v?snprintf testing logic courtesy of Russ Allbery.
17564  * According to C99:
17565  * - if the buffer is too short it still must be \0-terminated
17566  * - if the buffer is too short the potentially required length
17567  *   must be returned and not -1
17568  * - if the buffer is NULL the potentially required length
17569  *   must be returned and not -1 or core dump
17570  */
17571 #include <stdio.h>
17572 #include <stdarg.h>
17573
17574 char buf[2];
17575
17576 int test (char *format, ...)
17577 {
17578     va_list args;
17579     int count;
17580
17581     va_start (args, format);
17582     count = vsnprintf (buf, sizeof buf, format, args);
17583     va_end (args);
17584     return count;
17585 }
17586
17587 int main ()
17588 {
17589     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17590              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17591 }
17592 EOCP
17593     set try
17594     if eval $compile; then
17595         `$run ./try`
17596         case "$?" in
17597         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17598         *) cat <<EOM >&4
17599 Your snprintf() and snprintf() don't seem to be working okay.
17600 EOM
17601            d_snprintf="$undef"
17602            d_vsnprintf="$undef"
17603            ;;
17604         esac
17605     else
17606         echo "(I can't seem to compile the test program--assuming they don't)"
17607         d_snprintf="$undef"
17608         d_vsnprintf="$undef"
17609     fi
17610     $rm_try
17611     ;;
17612 esac
17613
17614 : see if sockatmark exists
17615 set sockatmark d_sockatmark
17616 eval $inlibc
17617
17618 : see if prototype for sockatmark is available
17619 echo " "
17620 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17621 eval $hasproto
17622
17623 : see if socks5_init exists
17624 set socks5_init d_socks5_init
17625 eval $inlibc
17626
17627 : see if sprintf returns the length of the string in the buffer as per ANSI
17628 $echo "Checking whether sprintf returns the length of the string..." >&4
17629 $cat <<EOP >try.c
17630 #include <stdio.h>
17631 #$i_stdlib I_STDLIB
17632 #ifdef I_STDLIB
17633 #include <stdlib.h>
17634 #endif
17635 #$i_string I_STRING
17636 #ifdef I_STRING
17637 #  include <string.h>
17638 #else
17639 #  include <strings.h>
17640 #endif
17641 #$i_math I_MATH
17642 #ifdef I_MATH
17643 #include <math.h>
17644 #endif
17645
17646 char buffer[256];
17647
17648 int check (size_t expect, int test) {
17649   size_t got = strlen(buffer);
17650   if (expect == got)
17651     return 0;
17652
17653   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17654        test, buffer);
17655   exit (test);
17656 }
17657
17658 int main(int argc, char **argv) {
17659   int test = 0;
17660
17661   check(sprintf(buffer, ""), ++test);
17662   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17663   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17664
17665   return 0;
17666 }
17667 EOP
17668 set try
17669
17670 if eval $compile; then
17671     xxx="`$run ./try`"
17672     case "$?" in
17673         0) cat >&4 <<EOM
17674 sprintf returns the length of the string (as ANSI says it should)
17675 EOM
17676         d_sprintf_returns_strlen="$define"
17677         ;;
17678         *) cat >&4 <<EOM
17679 sprintf does not return the length of the string (how old is this system?)
17680 EOM
17681         d_sprintf_returns_strlen="$undef"
17682         ;;
17683     esac
17684 else
17685     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17686     d_sprintf_returns_strlen="$undef"
17687 fi
17688 $rm_try
17689
17690 : see if srand48_r exists
17691 set srand48_r d_srand48_r
17692 eval $inlibc
17693 case "$d_srand48_r" in
17694 "$define")
17695         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17696         case "$d_srand48_r_proto:$usethreads" in
17697         ":define")      d_srand48_r_proto=define
17698                 set d_srand48_r_proto srand48_r $hdrs
17699                 eval $hasproto ;;
17700         *)      ;;
17701         esac
17702         case "$d_srand48_r_proto" in
17703         define)
17704         case "$srand48_r_proto" in
17705         ''|0) try='int srand48_r(long, struct drand48_data*);'
17706         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17707         esac
17708         case "$srand48_r_proto" in
17709         ''|0)   d_srand48_r=undef
17710                 srand48_r_proto=0
17711                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17712         * )     case "$srand48_r_proto" in
17713                 REENTRANT_PROTO*) ;;
17714                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17715                 esac
17716                 echo "Prototype: $try" ;;
17717         esac
17718         ;;
17719         *)      case "$usethreads" in
17720                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17721                 esac
17722                 d_srand48_r=undef
17723                 srand48_r_proto=0
17724                 ;;
17725         esac
17726         ;;
17727 *)      srand48_r_proto=0
17728         ;;
17729 esac
17730
17731 : see if srandom_r exists
17732 set srandom_r d_srandom_r
17733 eval $inlibc
17734 case "$d_srandom_r" in
17735 "$define")
17736         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17737         case "$d_srandom_r_proto:$usethreads" in
17738         ":define")      d_srandom_r_proto=define
17739                 set d_srandom_r_proto srandom_r $hdrs
17740                 eval $hasproto ;;
17741         *)      ;;
17742         esac
17743         case "$d_srandom_r_proto" in
17744         define)
17745         case "$srandom_r_proto" in
17746         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17747         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17748         esac
17749         case "$srandom_r_proto" in
17750         ''|0)   d_srandom_r=undef
17751                 srandom_r_proto=0
17752                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17753         * )     case "$srandom_r_proto" in
17754                 REENTRANT_PROTO*) ;;
17755                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17756                 esac
17757                 echo "Prototype: $try" ;;
17758         esac
17759         ;;
17760         *)      case "$usethreads" in
17761                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17762                 esac
17763                 d_srandom_r=undef
17764                 srandom_r_proto=0
17765                 ;;
17766         esac
17767         ;;
17768 *)      srandom_r_proto=0
17769         ;;
17770 esac
17771
17772 : see if prototype for setresgid is available
17773 echo " "
17774 set d_sresgproto setresgid $i_unistd unistd.h
17775 eval $hasproto
17776
17777 : see if prototype for setresuid is available
17778 echo " "
17779 set d_sresuproto setresuid $i_unistd unistd.h
17780 eval $hasproto
17781
17782 : see if sys/stat.h is available
17783 set sys/stat.h i_sysstat
17784 eval $inhdr
17785
17786 : see if stat knows about block sizes
17787 echo " "
17788 echo "Checking to see if your struct stat has st_blocks field..." >&4
17789 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17790 eval $hasfield
17791
17792 : see if this is a sys/vfs.h system
17793 set sys/vfs.h i_sysvfs
17794 eval $inhdr
17795
17796 : see if this is a sys/statfs.h system
17797 set sys/statfs.h i_sysstatfs
17798 eval $inhdr
17799
17800 : Check for statfs_s
17801 echo " "
17802 echo "Checking to see if your system supports struct statfs..." >&4
17803 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
17804 eval $hasstruct
17805 case "$d_statfs_s" in
17806 "$define")      echo "Yes, it does."   ;;
17807 *)              echo "No, it doesn't." ;;
17808 esac
17809
17810
17811 : see if struct statfs knows about f_flags
17812 case "$d_statfs_s" in
17813 define)
17814         echo " "
17815         echo "Checking to see if your struct statfs has f_flags field..." >&4
17816         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
17817         eval $hasfield
17818         ;;
17819 *)      val="$undef"
17820         set d_statfs_f_flags
17821         eval $setvar
17822         ;;
17823 esac
17824 case "$d_statfs_f_flags" in
17825 "$define")      echo "Yes, it does."   ;;
17826 *)              echo "No, it doesn't." ;;
17827 esac
17828
17829 : see what flavor, if any, of static inline is supported
17830 echo " "
17831 echo "Checking to see if your system supports static inline..."
17832 $cat > try.c <<'EOCP'
17833 #include <stdlib.h>
17834 extern int f_via_a(int x);
17835 extern int f_via_b(int x);
17836 int main(int argc, char **argv)
17837 {
17838     int y;
17839
17840     y = f_via_a(0);
17841 #ifdef USE_B
17842     y = f_via_b(0);
17843 #endif
17844     if (y == 42) {
17845         return EXIT_SUCCESS;
17846     }
17847     else {
17848         return EXIT_FAILURE;
17849     }
17850 }
17851 EOCP
17852 $cat > a.c <<'EOCP'
17853 static INLINE int f(int x) {
17854     int y;
17855     y = x + 42;
17856     return y;
17857 }
17858
17859 int f_via_a(int x)
17860 {
17861     return f(x);
17862 }
17863 EOCP
17864 $cat > b.c <<'EOCP'
17865 extern int f(int x);
17866
17867 int f_via_b(int x)
17868 {
17869     return f(x);
17870 }
17871 EOCP
17872
17873 # Respect a hint (or previous) value for perl_static_inline, if there is one.
17874 case "$perl_static_inline" in
17875 '')     # Check the various possibilities, and break out on success.
17876         # For gcc, prefer __inline__, which will still permit 
17877         # cflags.SH to add in -ansi.
17878         case "$gccversion" in
17879                 '') xxx="inline __inline__ __inline _inline";;
17880                 *)  xxx="__inline__ inline __inline _inline";;
17881         esac
17882         for inline in $xxx; do
17883                 set try -DINLINE=$inline a.c
17884                 if eval $compile && $run ./try; then
17885                         # Now make sure there is no external linkage of static
17886                         # functions
17887                         set try -DINLINE=$inline -DUSE_B a.c b.c
17888                         if eval $compile && $run ./try; then
17889                                 $echo "Your compiler supports static $inline, " >&4
17890                                 $echo "but it also creates an external definition," >&4
17891                                 $echo "so I won't use it." >&4
17892                                 val=$undef
17893                         else
17894                                 $echo "Your compiler supports static $inline." >&4
17895                                 val=$define
17896                                 perl_static_inline="static $inline";
17897                                 break;
17898                         fi
17899                 else
17900                         $echo "Your compiler does NOT support static $inline." >&4
17901                         val="$undef"
17902                 fi
17903         done
17904         ;;
17905 *inline*) # Some variant of inline exists.
17906         echo "Keeping your $hint value of $perl_static_inline."
17907         val=$define
17908         ;;
17909 static)  # No inline capabilities
17910         echo "Keeping your $hint value of $perl_static_inline."
17911         val=$undef
17912         ;;
17913 *)  # Unrecognized previous value -- blindly trust the supplied
17914         # value and hope it makes sense.  Use old value for
17915         # d_static_inline, if there is one.
17916         echo "Keeping your $hint value of $perl_static_inline."
17917         case "$d_static_inline" in
17918                 '') val=$define ;;
17919                 *)  val=$d_static_inline ;;
17920         esac
17921         ;;
17922 esac
17923 # Fallback to plain 'static' if nothing worked.
17924 case "$perl_static_inline" in
17925 '')
17926         perl_static_inline="static"
17927         val=$undef
17928         ;;
17929 esac
17930 set d_static_inline
17931 eval $setvar
17932 $rm -f a.[co] b.[co]
17933 $rm_try
17934
17935 : Check stream access
17936 $cat >&4 <<EOM
17937 Checking how to access stdio streams by file descriptor number...
17938 EOM
17939 case "$stdio_stream_array" in
17940 '')     $cat >try.c <<EOCP
17941 #include <stdio.h>
17942 int main() {
17943   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17944     printf("yes\n");
17945 }
17946 EOCP
17947         for s in _iob __iob __sF
17948         do
17949                 set try -DSTDIO_STREAM_ARRAY=$s
17950                 if eval $compile; then
17951                         case "`$run ./try`" in
17952                         yes)    stdio_stream_array=$s; break ;;
17953                         esac
17954                 fi
17955         done
17956         $rm_try
17957 esac
17958 case "$stdio_stream_array" in
17959 '')     $cat >&4 <<EOM
17960 I can't figure out how to access stdio streams by file descriptor number.
17961 EOM
17962         d_stdio_stream_array="$undef"
17963         ;;
17964 *)      $cat >&4 <<EOM
17965 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17966 EOM
17967         d_stdio_stream_array="$define"
17968         ;;
17969 esac
17970
17971 : see if strcoll exists
17972 set strcoll d_strcoll
17973 eval $inlibc
17974
17975 : check for structure copying
17976 echo " "
17977 echo "Checking to see if your C compiler can copy structs..." >&4
17978 $cat >try.c <<'EOCP'
17979 int main()
17980 {
17981         struct blurfl {
17982                 int dyick;
17983         } foo, bar;
17984
17985         foo = bar;
17986 }
17987 EOCP
17988 if $cc -c try.c >/dev/null 2>&1 ; then
17989         val="$define"
17990         echo "Yup, it can."
17991 else
17992         val="$undef"
17993         echo "Nope, it can't."
17994 fi
17995 set d_strctcpy
17996 eval $setvar
17997 $rm_try
17998
17999 : see if strerror and/or sys_errlist[] exist
18000 echo " "
18001 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18002     if set strerror val -f d_strerror; eval $csym; $val; then
18003                 echo 'strerror() found.' >&4
18004                 d_strerror="$define"
18005                 d_strerrm='strerror(e)'
18006                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18007                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
18008                         d_syserrlst="$define"
18009                 else
18010                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
18011                         d_syserrlst="$undef"
18012                 fi
18013     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18014                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18015                 echo 'strerror() found in string header.' >&4
18016                 d_strerror="$define"
18017                 d_strerrm='strerror(e)'
18018                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18019                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18020                                 d_syserrlst="$define"
18021                 else
18022                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18023                         d_syserrlst="$undef"
18024                 fi
18025     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18026                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18027                 d_strerror="$undef"
18028                 d_syserrlst="$define"
18029                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18030     else
18031                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18032                 d_strerror="$undef"
18033                 d_syserrlst="$undef"
18034                 d_strerrm='"unknown"'
18035     fi
18036 fi
18037
18038 : see if strerror_r exists
18039 set strerror_r d_strerror_r
18040 eval $inlibc
18041 case "$d_strerror_r" in
18042 "$define")
18043         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18044         case "$d_strerror_r_proto:$usethreads" in
18045         ":define")      d_strerror_r_proto=define
18046                 set d_strerror_r_proto strerror_r $hdrs
18047                 eval $hasproto ;;
18048         *)      ;;
18049         esac
18050         case "$d_strerror_r_proto" in
18051         define)
18052         case "$strerror_r_proto" in
18053         ''|0) try='int strerror_r(int, char*, size_t);'
18054         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18055         esac
18056         case "$strerror_r_proto" in
18057         ''|0) try='int strerror_r(int, char*, int);'
18058         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18059         esac
18060         case "$strerror_r_proto" in
18061         ''|0) try='char* strerror_r(int, char*, size_t);'
18062         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18063         esac
18064         case "$strerror_r_proto" in
18065         ''|0)   d_strerror_r=undef
18066                 strerror_r_proto=0
18067                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18068         * )     case "$strerror_r_proto" in
18069                 REENTRANT_PROTO*) ;;
18070                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18071                 esac
18072                 echo "Prototype: $try" ;;
18073         esac
18074         ;;
18075         *)      case "$usethreads" in
18076                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18077                 esac
18078                 d_strerror_r=undef
18079                 strerror_r_proto=0
18080                 ;;
18081         esac
18082         ;;
18083 *)      strerror_r_proto=0
18084         ;;
18085 esac
18086
18087 : see if strftime exists
18088 set strftime d_strftime
18089 eval $inlibc
18090
18091 : see if strlcat exists
18092 set strlcat d_strlcat
18093 eval $inlibc
18094
18095 : see if strlcpy exists
18096 set strlcpy d_strlcpy
18097 eval $inlibc
18098
18099 : see if strtod exists
18100 set strtod d_strtod
18101 eval $inlibc
18102
18103 : see if strtol exists
18104 set strtol d_strtol
18105 eval $inlibc
18106
18107 : see if strtold exists
18108 set strtold d_strtold
18109 eval $inlibc
18110
18111 : see if strtoll exists
18112 set strtoll d_strtoll
18113 eval $inlibc
18114
18115 case "$d_longlong-$d_strtoll" in
18116 "$define-$define")
18117         $cat <<EOM
18118 Checking whether your strtoll() works okay...
18119 EOM
18120         $cat >try.c <<'EOCP'
18121 #include <errno.h>
18122 #ifdef __hpux
18123 #define strtoll __strtoll
18124 #endif
18125 #ifdef __EMX__
18126 #define strtoll _strtoll
18127 #endif
18128 #include <stdio.h>
18129 extern long long int strtoll(char *s, char **, int);
18130 static int bad = 0;
18131 int check(char *s, long long ell, int een) {
18132         long long gll;
18133         errno = 0;
18134         gll = strtoll(s, 0, 10);
18135         if (!((gll == ell) && (errno == een)))
18136                 bad++;
18137 }
18138 int main() {
18139         check(" 1",                                      1LL, 0);
18140         check(" 0",                                      0LL, 0);
18141         check("-1",                                     -1LL, 0);
18142         check("-9223372036854775808", -9223372036854775808LL, 0);
18143         check("-9223372036854775808", -9223372036854775808LL, 0);
18144         check(" 9223372036854775807",  9223372036854775807LL, 0);
18145         check("-9223372036854775808", -9223372036854775808LL, 0);
18146         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18147         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18148         if (!bad)
18149                 printf("ok\n");
18150 }
18151 EOCP
18152         set try
18153         if eval $compile; then
18154                 yyy=`$run ./try`
18155                 case "$yyy" in
18156                 ok) echo "Your strtoll() seems to be working okay." ;;
18157                 *) cat <<EOM >&4
18158 Your strtoll() doesn't seem to be working okay.
18159 EOM
18160                    d_strtoll="$undef"
18161                    ;;
18162                 esac
18163         else
18164                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18165                 d_strtoll="$undef"
18166         fi
18167         ;;
18168 esac
18169
18170 : see if strtoq exists
18171 set strtoq d_strtoq
18172 eval $inlibc
18173
18174 : see if strtoul exists
18175 set strtoul d_strtoul
18176 eval $inlibc
18177
18178 case "$d_strtoul" in
18179 "$define")
18180         $cat <<EOM
18181 Checking whether your strtoul() works okay...
18182 EOM
18183         $cat >try.c <<'EOCP'
18184 #include <errno.h>
18185 #include <stdio.h>
18186 extern unsigned long int strtoul(char *s, char **, int);
18187 static int bad = 0;
18188 void check(char *s, unsigned long eul, int een) {
18189         unsigned long gul;
18190         errno = 0;
18191         gul = strtoul(s, 0, 10);
18192         if (!((gul == eul) && (errno == een)))
18193                 bad++;
18194 }
18195 int main() {
18196         check(" 1", 1L, 0);
18197         check(" 0", 0L, 0);
18198 EOCP
18199         case "$longsize" in
18200         8)
18201             $cat >>try.c <<'EOCP'
18202         check("18446744073709551615", 18446744073709551615UL, 0);
18203         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18204 #if 0 /* strtoul() for /^-/ strings is undefined. */
18205         check("-1", 18446744073709551615UL, 0);
18206         check("-18446744073709551614", 2, 0);
18207         check("-18446744073709551615", 1, 0);
18208         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18209         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18210 #endif
18211 EOCP
18212                 ;;
18213         4)
18214                     $cat >>try.c <<'EOCP'
18215         check("4294967295", 4294967295UL, 0);
18216         check("4294967296", 4294967295UL, ERANGE);
18217 #if 0 /* strtoul() for /^-/ strings is undefined. */
18218         check("-1", 4294967295UL, 0);
18219         check("-4294967294", 2, 0);
18220         check("-4294967295", 1, 0);
18221         check("-4294967296", 4294967295UL, ERANGE);
18222         check("-4294967297", 4294967295UL, ERANGE);
18223 #endif
18224 EOCP
18225                 ;;
18226         *)
18227 : Should we write these tests to be more portable by sprintf-ing
18228 : ~0 and then manipulating that char string as input for strtol?
18229                 ;;
18230         esac
18231         $cat >>try.c <<'EOCP'
18232         if (!bad)
18233                 printf("ok\n");
18234         return 0;
18235 }
18236 EOCP
18237         set try
18238         if eval $compile; then
18239                 case "`$run ./try`" in
18240                 ok) echo "Your strtoul() seems to be working okay." ;;
18241                 *) cat <<EOM >&4
18242 Your strtoul() doesn't seem to be working okay.
18243 EOM
18244                    d_strtoul="$undef"
18245                    ;;
18246                 esac
18247         else
18248                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18249                 d_strtoul="$undef"
18250         fi
18251         ;;
18252 esac
18253
18254 : see if strtoull exists
18255 set strtoull d_strtoull
18256 eval $inlibc
18257
18258 case "$d_longlong-$d_strtoull" in
18259 "$define-$define")
18260         $cat <<EOM
18261 Checking whether your strtoull() works okay...
18262 EOM
18263         $cat >try.c <<'EOCP'
18264 #include <errno.h>
18265 #ifdef __hpux
18266 #define strtoull __strtoull
18267 #endif
18268 #include <stdio.h>
18269 extern unsigned long long int strtoull(char *s, char **, int);
18270 static int bad = 0;
18271 int check(char *s, long long eull, int een) {
18272         long long gull;
18273         errno = 0;
18274         gull = strtoull(s, 0, 10);
18275         if (!((gull == eull) && (errno == een)))
18276                 bad++;
18277 }
18278 int main() {
18279         check(" 1",                                        1LL, 0);
18280         check(" 0",                                        0LL, 0);
18281         check("18446744073709551615",  18446744073709551615ULL, 0);
18282         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18283 #if 0 /* strtoull() for /^-/ strings is undefined. */
18284         check("-1",                    18446744073709551615ULL, 0);
18285         check("-18446744073709551614",                     2LL, 0);
18286         check("-18446744073709551615",                     1LL, 0);
18287         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18288         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18289 #endif
18290         if (!bad)
18291                 printf("ok\n");
18292 }
18293 EOCP
18294         set try
18295         if eval $compile; then
18296                 case "`$run ./try`" in
18297                 ok) echo "Your strtoull() seems to be working okay." ;;
18298                 *) cat <<EOM >&4
18299 Your strtoull() doesn't seem to be working okay.
18300 EOM
18301                    d_strtoull="$undef"
18302                    ;;
18303                 esac
18304         else
18305                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18306                 d_strtoull="$undef"
18307         fi
18308         ;;
18309 esac
18310
18311 : see if strtouq exists
18312 set strtouq d_strtouq
18313 eval $inlibc
18314
18315 case "$d_strtouq" in
18316 "$define")
18317         $cat <<EOM
18318 Checking whether your strtouq() works okay...
18319 EOM
18320         $cat >try.c <<'EOCP'
18321 #include <errno.h>
18322 #include <stdio.h>
18323 extern unsigned long long int strtouq(char *s, char **, int);
18324 static int bad = 0;
18325 void check(char *s, unsigned long long eull, int een) {
18326         unsigned long long gull;
18327         errno = 0;
18328         gull = strtouq(s, 0, 10);
18329         if (!((gull == eull) && (errno == een)))
18330                 bad++;
18331 }
18332 int main() {
18333         check(" 1",                                        1LL, 0);
18334         check(" 0",                                        0LL, 0);
18335         check("18446744073709551615",  18446744073709551615ULL, 0);
18336         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18337 #if 0 /* strtouq() for /^-/ strings is undefined. */
18338         check("-1",                    18446744073709551615ULL, 0);
18339         check("-18446744073709551614",                     2LL, 0);
18340         check("-18446744073709551615",                     1LL, 0);
18341         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18342         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18343 #endif
18344         if (!bad)
18345                 printf("ok\n");
18346         return 0;
18347 }
18348 EOCP
18349         set try
18350         if eval $compile; then
18351                 case "`$run ./try`" in
18352                 ok) echo "Your strtouq() seems to be working okay." ;;
18353                 *) cat <<EOM >&4
18354 Your strtouq() doesn't seem to be working okay.
18355 EOM
18356                    d_strtouq="$undef"
18357                    ;;
18358                 esac
18359         else
18360                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18361                 d_strtouq="$undef"
18362         fi
18363         ;;
18364 esac
18365
18366 : see if strxfrm exists
18367 set strxfrm d_strxfrm
18368 eval $inlibc
18369
18370 : see if symlink exists
18371 set symlink d_symlink
18372 eval $inlibc
18373
18374 : see if syscall exists
18375 set syscall d_syscall
18376 eval $inlibc
18377
18378 : see if prototype for syscall is available
18379 echo " "
18380 set d_syscallproto syscall $i_unistd unistd.h
18381 eval $hasproto
18382
18383 : see if sysconf exists
18384 set sysconf d_sysconf
18385 eval $inlibc
18386
18387 : see if system exists
18388 set system d_system
18389 eval $inlibc
18390
18391 : see if tcgetpgrp exists
18392 set tcgetpgrp d_tcgetpgrp
18393 eval $inlibc
18394
18395 : see if tcsetpgrp exists
18396 set tcsetpgrp d_tcsetpgrp
18397 eval $inlibc
18398
18399 : see if prototype for telldir is available
18400 echo " "
18401 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18402 eval $hasproto
18403
18404 : see if time exists
18405 echo " "
18406 if test "X$d_time" = X -o X"$timetype" = X; then
18407     if set time val -f d_time; eval $csym; $val; then
18408                 echo 'time() found.' >&4
18409                 val="$define"
18410                 rp="What is the type returned by time() on this system?"
18411                 set time_t timetype long stdio.h sys/types.h
18412                 eval $typedef_ask
18413     else
18414                 echo 'time() not found, hope that will do.' >&4
18415                 val="$undef"
18416                 timetype='int';
18417     fi
18418     set d_time
18419     eval $setvar
18420 fi
18421
18422 : see if timegm exists
18423 set timegm d_timegm
18424 eval $inlibc
18425
18426 : see if this is a sys/times.h system
18427 set sys/times.h i_systimes
18428 eval $inhdr
18429
18430 : see if times exists
18431 echo " "
18432 if set times val -f d_times; eval $csym; $val; then
18433         echo 'times() found.' >&4
18434         d_times="$define"
18435         inc=''
18436         case "$i_systimes" in
18437         "$define") inc='sys/times.h';;
18438         esac
18439         rp="What is the type returned by times() on this system?"
18440         set clock_t clocktype long stdio.h sys/types.h $inc
18441         eval $typedef_ask
18442 else
18443         echo 'times() NOT found, hope that will do.' >&4
18444         d_times="$undef"
18445         clocktype='int'
18446 fi
18447
18448 : see if tmpnam_r exists
18449 set tmpnam_r d_tmpnam_r
18450 eval $inlibc
18451 case "$d_tmpnam_r" in
18452 "$define")
18453         hdrs="$i_systypes sys/types.h define stdio.h "
18454         case "$d_tmpnam_r_proto:$usethreads" in
18455         ":define")      d_tmpnam_r_proto=define
18456                 set d_tmpnam_r_proto tmpnam_r $hdrs
18457                 eval $hasproto ;;
18458         *)      ;;
18459         esac
18460         case "$d_tmpnam_r_proto" in
18461         define)
18462         case "$tmpnam_r_proto" in
18463         ''|0) try='char* tmpnam_r(char*);'
18464         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18465         esac
18466         case "$tmpnam_r_proto" in
18467         ''|0)   d_tmpnam_r=undef
18468                 tmpnam_r_proto=0
18469                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18470         * )     case "$tmpnam_r_proto" in
18471                 REENTRANT_PROTO*) ;;
18472                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18473                 esac
18474                 echo "Prototype: $try" ;;
18475         esac
18476         ;;
18477         *)      case "$usethreads" in
18478                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18479                 esac
18480                 d_tmpnam_r=undef
18481                 tmpnam_r_proto=0
18482                 ;;
18483         esac
18484         ;;
18485 *)      tmpnam_r_proto=0
18486         ;;
18487 esac
18488
18489 : see if truncate exists
18490 set truncate d_truncate
18491 eval $inlibc
18492
18493 : see if ttyname_r exists
18494 set ttyname_r d_ttyname_r
18495 eval $inlibc
18496 case "$d_ttyname_r" in
18497 "$define")
18498         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18499         case "$d_ttyname_r_proto:$usethreads" in
18500         ":define")      d_ttyname_r_proto=define
18501                 set d_ttyname_r_proto ttyname_r $hdrs
18502                 eval $hasproto ;;
18503         *)      ;;
18504         esac
18505         case "$d_ttyname_r_proto" in
18506         define)
18507         case "$ttyname_r_proto" in
18508         ''|0) try='int ttyname_r(int, char*, size_t);'
18509         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18510         esac
18511         case "$ttyname_r_proto" in
18512         ''|0) try='int ttyname_r(int, char*, int);'
18513         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18514         esac
18515         case "$ttyname_r_proto" in
18516         ''|0) try='char* ttyname_r(int, char*, int);'
18517         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18518         esac
18519         case "$ttyname_r_proto" in
18520         ''|0)   d_ttyname_r=undef
18521                 ttyname_r_proto=0
18522                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18523         * )     case "$ttyname_r_proto" in
18524                 REENTRANT_PROTO*) ;;
18525                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18526                 esac
18527                 echo "Prototype: $try" ;;
18528         esac
18529         ;;
18530         *)      case "$usethreads" in
18531                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18532                 esac
18533                 d_ttyname_r=undef
18534                 ttyname_r_proto=0
18535                 ;;
18536         esac
18537         ;;
18538 *)      ttyname_r_proto=0
18539         ;;
18540 esac
18541
18542 : see if tzname[] exists
18543 echo " "
18544 if set tzname val -a d_tzname; eval $csym; $val; then
18545         val="$define"
18546         echo 'tzname[] found.' >&4
18547 else
18548         val="$undef"
18549         echo 'tzname[] NOT found.' >&4
18550 fi
18551 set d_tzname
18552 eval $setvar
18553
18554 : Check if is a multiplatform env
18555 case "$osname" in
18556 next|rhapsody|darwin) multiarch="$define" ;;
18557 esac
18558 case "$multiarch" in
18559 ''|[nN]*) multiarch="$undef" ;;
18560 esac
18561
18562 : check for ordering of bytes in a UV
18563 echo " "
18564 case "$usecrosscompile$multiarch" in
18565 *$define*)
18566         $cat <<EOM
18567 You seem to be either cross-compiling or doing a multiarchitecture build,
18568 skipping the byteorder check.
18569
18570 EOM
18571         byteorder='ffff'
18572         ;;
18573 *)
18574         case "$byteorder" in
18575         '')
18576                 $cat <<'EOM'
18577 In the following, larger digits indicate more significance.  A big-endian
18578 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18579 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18580 machines may have weird orders like 3412.  A Cray will report 87654321,
18581 an Alpha will report 12345678. If the test program works the default is
18582 probably right.
18583 I'm now running the test program...
18584 EOM
18585                 $cat >try.c <<EOCP
18586 #include <stdio.h>
18587 #$i_stdlib I_STDLIB
18588 #ifdef I_STDLIB
18589 #include <stdlib.h>
18590 #endif
18591 #include <sys/types.h>
18592 typedef $uvtype UV;
18593 int main()
18594 {
18595         int i;
18596         union {
18597                 UV l;
18598                 char c[$uvsize];
18599         } u;
18600
18601         if ($uvsize > 4)
18602                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18603         else
18604                 u.l = (UV)0x04030201;
18605         for (i = 0; i < $uvsize; i++)
18606                 printf("%c", u.c[i]+'0');
18607         printf("\n");
18608         exit(0);
18609 }
18610 EOCP
18611                 xxx_prompt=y
18612                 set try
18613                 if eval $compile && $run ./try > /dev/null; then
18614                         dflt=`$run ./try`
18615                         case "$dflt" in
18616                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18617                                 echo "(The test program ran ok.)"
18618                                 echo "byteorder=$dflt"
18619                                 xxx_prompt=n
18620                         ;;
18621                         ????|????????) echo "(The test program ran ok.)" ;;
18622                         *) echo "(The test program didn't run right for some reason.)" ;;
18623                         esac
18624                 else
18625                         dflt='4321'
18626                         cat <<'EOM'
18627 (I can't seem to compile the test program.  Guessing big-endian...)
18628 EOM
18629                 fi
18630                 case "$xxx_prompt" in
18631                 y)
18632                         rp="What is the order of bytes in $uvtype?"
18633                         . ./myread
18634                         byteorder="$ans"
18635                         ;;
18636                 *)      byteorder=$dflt
18637                         ;;
18638                 esac
18639                 ;;
18640         esac
18641         $rm_try
18642         ;;
18643 esac
18644
18645 : Checking 32bit alignedness
18646 $cat <<EOM
18647
18648 Checking to see whether you can access character data unalignedly...
18649 EOM
18650 case "$d_u32align" in
18651 '')   $cat >try.c <<EOCP
18652 #include <stdio.h>
18653 #$i_stdlib I_STDLIB
18654 #ifdef I_STDLIB
18655 #include <stdlib.h>
18656 #endif
18657 #define U32 $u32type
18658 #define BYTEORDER 0x$byteorder
18659 #define U8 $u8type
18660 #include <signal.h>
18661 #ifdef SIGBUS
18662 $signal_t bletch(int s) { exit(4); }
18663 #endif
18664 int main() {
18665 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18666     volatile U8 buf[8];
18667     volatile U32 *up;
18668     int i;
18669
18670     if (sizeof(U32) != 4) {
18671         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18672         exit(1);
18673     }
18674
18675     fflush(stdout);
18676
18677 #ifdef SIGBUS
18678     signal(SIGBUS, bletch);
18679 #endif
18680
18681     buf[0] = 0;
18682     buf[1] = 0;
18683     buf[2] = 0;
18684     buf[3] = 1;
18685     buf[4] = 0;
18686     buf[5] = 0;
18687     buf[6] = 0;
18688     buf[7] = 1;
18689
18690     for (i = 0; i < 4; i++) {
18691         up = (U32*)(buf + i);
18692         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18693                (*up == 1 << (8*(3-i)))  /* little-endian */
18694               )
18695            )
18696         {
18697             printf("read failed (%x)\n", *up);
18698             exit(2);
18699         }
18700     }
18701
18702     /* write test */
18703     for (i = 0; i < 4; i++) {
18704         up = (U32*)(buf + i);
18705         *up = 0xBeef;
18706         if (*up != 0xBeef) {
18707             printf("write failed (%x)\n", *up);
18708             exit(3);
18709         }
18710     }
18711
18712     exit(0);
18713 #else
18714     printf("1\n");
18715     exit(1);
18716 #endif
18717     return 0;
18718 }
18719 EOCP
18720 set try
18721 if eval $compile_ok; then
18722         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18723         $run ./try 2>&1 >/dev/null
18724         case "$?" in
18725         0)      cat >&4 <<EOM
18726 You can access character data pretty unalignedly.
18727 EOM
18728                 d_u32align="$undef"
18729                 ;;
18730         *)      cat >&4 <<EOM
18731 It seems that you must access character data in an aligned manner.
18732 EOM
18733                 d_u32align="$define"
18734                 ;;
18735         esac
18736 else
18737         rp='Can you access character data at unaligned addresses?'
18738         dflt='n'
18739         . ./myread
18740         case "$ans" in
18741         [yY]*)  d_u32align="$undef"  ;;
18742         *)      d_u32align="$define" ;;
18743         esac
18744 fi
18745 $rm_try
18746 ;;
18747 esac
18748
18749 : see if ualarm exists
18750 set ualarm d_ualarm
18751 eval $inlibc
18752
18753 : see if umask exists
18754 set umask d_umask
18755 eval $inlibc
18756
18757 : see if unordered exists
18758 set unordered d_unordered
18759 eval $inlibc
18760
18761 : see if unsetenv exists
18762 set unsetenv d_unsetenv
18763 eval $inlibc
18764
18765 : see if usleep exists
18766 set usleep d_usleep
18767 eval $inlibc
18768
18769 : see if prototype for usleep is available
18770 echo " "
18771 set d_usleepproto usleep $i_unistd unistd.h
18772 eval $hasproto
18773
18774 : see if ustat exists
18775 set ustat d_ustat
18776 eval $inlibc
18777
18778 : see if closedir exists
18779 set closedir d_closedir
18780 eval $inlibc
18781
18782 case "$d_closedir" in
18783 "$define")
18784         echo " "
18785         echo "Checking whether closedir() returns a status..." >&4
18786         cat > try.c <<EOM
18787 #$i_dirent I_DIRENT             /**/
18788 #$i_sysdir I_SYS_DIR            /**/
18789 #$i_sysndir I_SYS_NDIR          /**/
18790 #$i_systypes I_SYS_TYPES        /**/
18791
18792 #if defined(I_SYS_TYPES)
18793 #include <sys/types.h>
18794 #endif
18795 #if defined(I_DIRENT)
18796 #include <dirent.h>
18797 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18798 #include <sys/dir.h>
18799 #endif
18800 #else
18801 #ifdef I_SYS_NDIR
18802 #include <sys/ndir.h>
18803 #else
18804 #ifdef I_SYS_DIR
18805 #ifdef hp9000s500
18806 #include <ndir.h>       /* may be wrong in the future */
18807 #else
18808 #include <sys/dir.h>
18809 #endif
18810 #endif
18811 #endif
18812 #endif
18813 int main() { return closedir(opendir(".")); }
18814 EOM
18815         set try
18816         if eval $compile_ok; then
18817                 if $run ./try > /dev/null 2>&1 ; then
18818                         echo "Yes, it does."
18819                         val="$undef"
18820                 else
18821                         echo "No, it doesn't."
18822                         val="$define"
18823                 fi
18824         else
18825                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18826                 val="$define"
18827         fi
18828         ;;
18829 *)
18830         val="$undef";
18831         ;;
18832 esac
18833 set d_void_closedir
18834 eval $setvar
18835 $rm_try
18836
18837 : see if there is a wait4
18838 set wait4 d_wait4
18839 eval $inlibc
18840
18841 : see if waitpid exists
18842 set waitpid d_waitpid
18843 eval $inlibc
18844
18845 : see if wcstombs exists
18846 set wcstombs d_wcstombs
18847 eval $inlibc
18848
18849 : see if wctomb exists
18850 set wctomb d_wctomb
18851 eval $inlibc
18852
18853 : see if writev exists
18854 set writev d_writev
18855 eval $inlibc
18856
18857 : preserve RCS keywords in files with variable substitution, grrr
18858 Date='$Date'
18859 Id='$Id'
18860 Log='$Log'
18861 RCSfile='$RCSfile'
18862 Revision='$Revision'
18863
18864 : check for alignment requirements
18865 echo " "
18866 case "$usecrosscompile$multiarch" in
18867 *$define*)
18868         $cat <<EOM
18869 You seem to be either cross-compiling or doing a multiarchitecture build,
18870 skipping the memory alignment check.
18871
18872 EOM
18873         case "$alignbytes" in
18874         '') alignbytes=8 ;;
18875         esac
18876         ;;
18877 *)
18878         case "$alignbytes" in
18879         '') echo "Checking alignment constraints..." >&4
18880                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18881                         $cat >try.c <<'EOCP'
18882 typedef long double NV;
18883 EOCP
18884                 else
18885                         $cat >try.c <<'EOCP'
18886 typedef double NV;
18887 EOCP
18888                 fi
18889                 $cat >>try.c <<'EOCP'
18890 #include <stdio.h>
18891 struct foobar {
18892         char foo;
18893         NV bar;
18894 } try_algn;
18895 int main()
18896 {
18897     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18898     return(0);
18899 }
18900 EOCP
18901                 set try
18902                 if eval $compile_ok; then
18903                         dflt=`$run ./try`
18904                 else
18905                         dflt='8'
18906                         echo "(I can't seem to compile the test program...)"
18907                 fi
18908                 ;;
18909         *) dflt="$alignbytes"
18910                 ;;
18911         esac
18912         rp="Doubles must be aligned on a how-many-byte boundary?"
18913         . ./myread
18914         alignbytes="$ans"
18915         $rm_try
18916         ;;
18917 esac
18918
18919
18920 : set the base revision
18921 baserev=5.0
18922
18923 : length of character in bytes. Is always 1, otherwise it isnt C
18924 : This used to be a test using sizeof
18925 charsize=1
18926
18927 : Check for the number of bits in a character
18928 case "$charbits" in
18929 '')     echo "Checking how long a character is (in bits)..." >&4
18930         $cat >try.c <<EOCP
18931 #include <stdio.h>
18932 int main ()
18933 {
18934     int n;
18935     unsigned char c;
18936     for (c = 1, n = 0; c; c <<= 1, n++) ;
18937     printf ("%d\n", n);
18938     return (0);
18939     }
18940 EOCP
18941         set try
18942         if eval $compile_ok; then
18943                 dflt=`$run ./try`
18944         else
18945                 dflt='8'
18946                 echo "(I can't seem to compile the test program.  Guessing...)"
18947         fi
18948         ;;
18949 *)
18950         dflt="$charbits"
18951         ;;
18952 esac
18953 rp="What is the length of a character (in bits)?"
18954 . ./myread
18955 charbits="$ans"
18956 $rm_try
18957 case "$charbits" in
18958 8)      ;;
18959 *)      cat >&4 << EOM
18960 Your system has an unsigned character size of $charbits bits, which
18961 is rather unusual (normally it is 8 bits).  Perl likely will not work
18962 correctly on your system, with subtle bugs in various places.
18963 EOM
18964         rp='Do you really want to continue?'
18965         dflt='n'
18966         . ./myread
18967         case "$ans" in
18968                 [yY])   echo >&4 "Okay, continuing."    ;;
18969                 *)      exit 1                          ;;
18970         esac
18971 esac
18972
18973 : how do we concatenate cpp tokens here?
18974 echo " "
18975 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18976 $cat >cpp_stuff.c <<'EOCP'
18977 #define RCAT(a,b)a/**/b
18978 #define ACAT(a,b)a ## b
18979 RCAT(Rei,ser)
18980 ACAT(Cir,cus)
18981 EOCP
18982 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18983 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18984         echo "Oh!  Smells like ANSI's been here." >&4
18985         echo "We can catify or stringify, separately or together!"
18986         cpp_stuff=42
18987 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18988         echo "Ah, yes!  The good old days!" >&4
18989         echo "However, in the good old days we don't know how to stringify and"
18990         echo "catify at the same time."
18991         cpp_stuff=1
18992 else
18993         $cat >&4 <<EOM
18994 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18995 You're going to have to edit the values of CAT[2-5] in config.h...
18996 EOM
18997         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18998 fi
18999 $rm -f cpp_stuff.*
19000
19001 : see if this is a db.h system
19002 set db.h i_db
19003 eval $inhdr
19004
19005 case "$i_db" in
19006 $define)
19007         : Check db version.
19008         echo " "
19009         echo "Checking Berkeley DB version ..." >&4
19010         $cat >try.c <<EOCP
19011 #$d_const HASCONST
19012 #ifndef HASCONST
19013 #define const
19014 #endif
19015 #include <sys/types.h>
19016 #include <stdio.h>
19017 #$i_stdlib I_STDLIB
19018 #ifdef I_STDLIB
19019 #include <stdlib.h>
19020 #endif
19021 #include <db.h>
19022 int main(int argc, char *argv[])
19023 {
19024 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19025     int Major, Minor, Patch ;
19026     unsigned long Version ;
19027     (void)db_version(&Major, &Minor, &Patch) ;
19028     if (argc == 2) {
19029         printf("%d %d %d %d %d %d\n",
19030                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19031                Major, Minor, Patch);
19032         exit(0);
19033     }
19034     printf("You have Berkeley DB Version 2 or greater.\n");
19035
19036     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19037                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19038     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19039                 Major, Minor, Patch) ;
19040
19041     /* check that db.h & libdb are compatible */
19042     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19043         printf("db.h and libdb are incompatible.\n") ;
19044         exit(3);
19045     }
19046
19047     printf("db.h and libdb are compatible.\n") ;
19048
19049     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19050                 + DB_VERSION_PATCH ;
19051
19052     /* needs to be >= 2.3.4 */
19053     if (Version < 2003004) {
19054     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19055         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19056         exit(2);
19057     }
19058
19059     exit(0);
19060 #else
19061 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19062     if (argc == 2) {
19063         printf("1 0 0\n");
19064         exit(0);
19065     }
19066     printf("You have Berkeley DB Version 1.\n");
19067     exit(0);    /* DB version < 2: the coast is clear. */
19068 #else
19069     exit(1);    /* <db.h> not Berkeley DB? */
19070 #endif
19071 #endif
19072 }
19073 EOCP
19074         set try
19075         if eval $compile_ok && $run ./try; then
19076                 echo 'Looks OK.' >&4
19077                 set `$run ./try 1`
19078                 db_version_major=$1
19079                 db_version_minor=$2
19080                 db_version_patch=$3
19081         else
19082                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19083                 i_db=$undef
19084                 case " $libs " in
19085                 *"-ldb "*)
19086                         : Remove db from list of libraries to use
19087                         echo "Removing unusable -ldb from library list" >&4
19088                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19089                         shift
19090                         libs="$*"
19091                         echo "libs = $libs" >&4
19092                         ;;
19093                 esac
19094         fi
19095         $rm_try
19096         ;;
19097 esac
19098
19099 case "$i_db" in
19100 define)
19101         : Check the return type needed for hash
19102         echo " "
19103         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19104         $cat >try.c <<EOCP
19105 #$d_const HASCONST
19106 #ifndef HASCONST
19107 #define const
19108 #endif
19109 #include <sys/types.h>
19110 #include <db.h>
19111
19112 #ifndef DB_VERSION_MAJOR
19113 u_int32_t hash_cb (ptr, size)
19114 const void *ptr;
19115 size_t size;
19116 {
19117 }
19118 HASHINFO info;
19119 int main()
19120 {
19121         info.hash = hash_cb;
19122 }
19123 #endif
19124 EOCP
19125         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19126                 if $contains warning try.out >>/dev/null 2>&1 ; then
19127                         db_hashtype='int'
19128                 else
19129                         db_hashtype='u_int32_t'
19130                 fi
19131         else
19132                 : XXX Maybe we should just give up here.
19133                 db_hashtype=u_int32_t
19134                 $cat try.out >&4
19135                 echo "Help:  I can't seem to compile the db test program." >&4
19136                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19137         fi
19138         $rm_try
19139         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19140         ;;
19141 *)      db_hashtype=u_int32_t
19142         ;;
19143 esac
19144 case "$i_db" in
19145 define)
19146         : Check the return type needed for prefix
19147         echo " "
19148         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19149         cat >try.c <<EOCP
19150 #$d_const HASCONST
19151 #ifndef HASCONST
19152 #define const
19153 #endif
19154 #include <sys/types.h>
19155 #include <db.h>
19156
19157 #ifndef DB_VERSION_MAJOR
19158 size_t prefix_cb (key1, key2)
19159 const DBT *key1;
19160 const DBT *key2;
19161 {
19162 }
19163 BTREEINFO info;
19164 int main()
19165 {
19166         info.prefix = prefix_cb;
19167 }
19168 #endif
19169 EOCP
19170         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19171                 if $contains warning try.out >>/dev/null 2>&1 ; then
19172                         db_prefixtype='int'
19173                 else
19174                         db_prefixtype='size_t'
19175                 fi
19176         else
19177                 db_prefixtype='size_t'
19178                 : XXX Maybe we should just give up here.
19179                 $cat try.out >&4
19180                 echo "Help:  I can't seem to compile the db test program." >&4
19181                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19182         fi
19183         $rm_try
19184         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19185         ;;
19186 *)      db_prefixtype='size_t'
19187         ;;
19188 esac
19189
19190 : How can we generate normalized random numbers ?
19191 echo " "
19192 echo "Looking for a random number function..." >&4
19193 case "$randfunc" in
19194 '')
19195         if set drand48 val -f; eval $csym; $val; then
19196                 dflt="drand48"
19197                 echo "Good, found drand48()." >&4
19198         elif set random val -f; eval $csym; $val; then
19199                 dflt="random"
19200                 echo "OK, found random()." >&4
19201         else
19202                 dflt="rand"
19203                 echo "Yick, looks like I have to use rand()." >&4
19204         fi
19205         echo " "
19206         ;;
19207 *)
19208         dflt="$randfunc"
19209         ;;
19210 esac
19211 cont=true
19212
19213 case "$ccflags" in
19214 *-Dmy_rand=*|*-Dmy_srand=*)
19215         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19216         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19217         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19218         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19219         ;;
19220 esac
19221
19222 while $test "$cont"; do
19223         rp="Use which function to generate random numbers?"
19224         . ./myread
19225         if $test "$ans" = "$dflt"; then
19226                 : null
19227         else
19228                 randbits=''
19229         fi
19230         randfunc="$ans"
19231         if set $ans val -f; eval $csym; $val; then
19232                 cont=''
19233         else
19234                 dflt=y
19235                 rp="I cannot find function $ans. Use that name anyway?"
19236                 . ./myread
19237                 dflt=rand
19238                 case "$ans" in
19239                         [yY]*) cont='';;
19240                 esac
19241         fi
19242         case "$cont" in
19243         '')
19244                 case "$randfunc" in
19245                 drand48)
19246                         drand01="drand48()"
19247                         seedfunc="srand48"
19248                         randbits=48
19249                         randseedtype=long
19250                         ;;
19251                 rand|random)
19252                         case "$randbits" in
19253                         '')
19254 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19255                                 $cat >try.c <<EOCP
19256 #$i_unistd I_UNISTD
19257 #$i_stdlib I_STDLIB
19258 #include <stdio.h>
19259 #ifdef I_UNISTD
19260 #  include <unistd.h>
19261 #endif
19262 #ifdef I_STDLIB
19263 #  include <stdlib.h>
19264 #endif
19265 int main()
19266 {
19267         register int i;
19268         register unsigned long tmp;
19269         register unsigned long max = 0L;
19270
19271         for (i = 1000; i; i--) {
19272                 tmp = (unsigned long) $randfunc();
19273                 if (tmp > max) max = tmp;
19274         }
19275         for (i = 0; max; i++)
19276                 max /= 2;
19277         printf("%d\n",i);
19278 }
19279 EOCP
19280                                 set try
19281                                 if eval $compile_ok; then
19282                                         dflt=`try`
19283                                 else
19284                                         dflt='?'
19285                                         echo "(I can't seem to compile the test program...)"
19286                                 fi
19287                                 ;;
19288                         *)
19289                                 dflt="$randbits"
19290                                 ;;
19291                         esac
19292                         rp="How many bits does your $randfunc() function produce?"
19293                         . ./myread
19294                         randbits="$ans"
19295                         $rm_try
19296                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19297                         seedfunc="s$randfunc"
19298                         randseedtype=unsigned
19299                         ;;
19300                 *)
19301                         dflt="31"
19302                         rp="How many bits does your $randfunc() function produce?"
19303                         . ./myread
19304                         randbits="$ans"
19305                         seedfunc="s$randfunc"
19306                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19307                         if set $seedfunc val -f; eval $csym; $val; then
19308                                 echo "(Using $seedfunc() to seed random generator)"
19309                         else
19310                                 echo "(Warning: no $seedfunc() to seed random generator)"
19311                                 seedfunc=rand
19312                         fi
19313                         randseedtype=unsigned
19314                         ;;
19315                 esac
19316                 ;;
19317         esac
19318 done
19319
19320 : Determine if this is an EBCDIC system
19321 echo " "
19322 echo "Determining whether or not we are on an EBCDIC system..." >&4
19323 $cat >try.c <<'EOM'
19324 int main()
19325 {
19326   if ('M'==0xd4) return 0;
19327   return 1;
19328 }
19329 EOM
19330
19331 val=$undef
19332 set try
19333 if eval $compile_ok; then
19334         if $run ./try; then
19335                 echo "You seem to speak EBCDIC." >&4
19336                 val="$define"
19337         else
19338                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19339         fi
19340 else
19341         echo "I'm unable to compile the test program." >&4
19342         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19343 fi
19344 $rm_try
19345 set ebcdic
19346 eval $setvar
19347
19348 : Check how to flush
19349 echo " "
19350 $cat >&4 <<EOM
19351 Checking how to flush all pending stdio output...
19352 EOM
19353 # I only know how to find the first 32 possibly open files on SunOS.
19354 # See also hints/sunos_4_1.sh and util.c  --AD
19355 case "$osname" in
19356 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19357 esac
19358 $cat >>try.c <<EOCP
19359 #include <stdio.h>
19360 #$i_stdlib I_STDLIB
19361 #ifdef I_STDLIB
19362 #include <stdlib.h>
19363 #endif
19364 #$i_unistd I_UNISTD
19365 #ifdef I_UNISTD
19366 # include <unistd.h>
19367 #endif
19368 #$d_sysconf HAS_SYSCONF
19369 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19370 #ifdef HAS_STDIO_STREAM_ARRAY
19371 # define STDIO_STREAM_ARRAY $stdio_stream_array
19372 #endif
19373 int main() {
19374   FILE* p;
19375   unlink("try.out");
19376   p = fopen("try.out", "w");
19377 #ifdef TRY_FPUTC
19378   fputc('x', p);
19379 #else
19380 # ifdef TRY_FPRINTF
19381   fprintf(p, "x");
19382 # endif
19383 #endif
19384 #ifdef TRY_FFLUSH_NULL
19385   fflush(NULL);
19386 #endif
19387 #ifdef TRY_FFLUSH_ALL
19388   {
19389     long open_max = -1;
19390 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19391     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19392 # else
19393 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19394     open_max = sysconf(_SC_OPEN_MAX);
19395 #  else
19396 #   ifdef FOPEN_MAX
19397     open_max = FOPEN_MAX;
19398 #   else
19399 #    ifdef OPEN_MAX
19400     open_max = OPEN_MAX;
19401 #    else
19402 #     ifdef _NFILE
19403     open_max = _NFILE;
19404 #     endif
19405 #    endif
19406 #   endif
19407 #  endif
19408 # endif
19409 # ifdef HAS_STDIO_STREAM_ARRAY
19410     if (open_max > 0) {
19411       long i;
19412       for (i = 0; i < open_max; i++)
19413             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19414                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19415                 STDIO_STREAM_ARRAY[i]._flag)
19416                 fflush(&STDIO_STREAM_ARRAY[i]);
19417     }
19418   }
19419 # endif
19420 #endif
19421   _exit(42);
19422 }
19423 EOCP
19424 : first we have to find out how _not_ to flush
19425 $to try.c
19426 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19427     output=''
19428     set try -DTRY_FPUTC
19429     if eval $compile; then
19430             $run ./try 2>/dev/null
19431             code="$?"
19432             $from try.out
19433             if $test ! -s try.out -a "X$code" = X42; then
19434                 output=-DTRY_FPUTC
19435             fi
19436     fi
19437     case "$output" in
19438     '')
19439             set try -DTRY_FPRINTF
19440             if eval $compile; then
19441                     $run ./try 2>/dev/null
19442                     code="$?"
19443                     $from try.out
19444                     if $test ! -s try.out -a "X$code" = X42; then
19445                         output=-DTRY_FPRINTF
19446                     fi
19447             fi
19448         ;;
19449     esac
19450 fi
19451 : check for fflush NULL behaviour
19452 case "$fflushNULL" in
19453 '')     set try -DTRY_FFLUSH_NULL $output
19454         if eval $compile; then
19455                 $run ./try 2>/dev/null
19456                 code="$?"
19457                 $from try.out
19458                 if $test -s try.out -a "X$code" = X42; then
19459                         fflushNULL="`$cat try.out`"
19460                 else
19461                         if $test "X$code" != X42; then
19462                                 $cat >&4 <<EOM
19463 (If this test failed, don't worry, we'll try another method shortly.)
19464 EOM
19465                         fi
19466                 fi
19467         fi
19468         $rm -f core try.core core.try.*
19469         case "$fflushNULL" in
19470         x)      $cat >&4 <<EOM
19471 Your fflush(NULL) works okay for output streams.
19472 Let's see if it clobbers input pipes...
19473 EOM
19474 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19475 # bug that improperly flushes the input end of pipes.  So we avoid the
19476 # autoflush on fork/system/exec support for now. :-(
19477 $cat >tryp.c <<EOCP
19478 #include <stdio.h>
19479 int
19480 main(int argc, char **argv)
19481 {
19482     char buf[1024];
19483     int i;
19484     char *bp = buf;
19485     while (1) {
19486         while ((i = getc(stdin)) != -1
19487                && (*bp++ = i) != '\n'
19488                && bp < &buf[1024])
19489         /* DO NOTHING */ ;
19490         *bp = '\0';
19491         fprintf(stdout, "%s", buf);
19492         fflush(NULL);
19493         if (i == -1)
19494             return 0;
19495         bp = buf;
19496     }
19497 }
19498 EOCP
19499                 fflushNULL="$define"
19500                 set tryp
19501                 if eval $compile; then
19502                     $rm -f tryp.out
19503                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19504                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19505                        $cat >&4 <<EOM
19506 fflush(NULL) seems to behave okay with input streams.
19507 EOM
19508                         fflushNULL="$define"
19509                     else
19510                         $cat >&4 <<EOM
19511 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19512 EOM
19513                         fflushNULL="$undef"
19514                     fi
19515                 fi
19516                 $rm -f core tryp.c tryp.core core.tryp.*
19517                 ;;
19518         '')     $cat >&4 <<EOM
19519 Your fflush(NULL) isn't working (contrary to ANSI C).
19520 EOM
19521                 fflushNULL="$undef"
19522                 ;;
19523         *)      $cat >&4 <<EOM
19524 Cannot figure out whether your fflush(NULL) works or not.
19525 I'm assuming it doesn't (contrary to ANSI C).
19526 EOM
19527                 fflushNULL="$undef"
19528                 ;;
19529         esac
19530         ;;
19531 $define|true|[yY]*)
19532         fflushNULL="$define"
19533         ;;
19534 *)
19535         fflushNULL="$undef"
19536         ;;
19537 esac
19538 : check explicit looping only if NULL did not work, and if the pipe
19539 : bug does not show up on an explicit flush too
19540 case "$fflushNULL" in
19541 "$undef")
19542         $cat >tryp.c <<EOCP
19543 #include <stdio.h>
19544 int
19545 main(int argc, char **argv)
19546 {
19547     char buf[1024];
19548     int i;
19549     char *bp = buf;
19550     while (1) {
19551         while ((i = getc(stdin)) != -1
19552                && (*bp++ = i) != '\n'
19553                && bp < &buf[1024])
19554         /* DO NOTHING */ ;
19555         *bp = '\0';
19556         fprintf(stdout, "%s", buf);
19557         fflush(stdin);
19558         if (i == -1)
19559             return 0;
19560         bp = buf;
19561     }
19562 }
19563 EOCP
19564         set tryp
19565         if eval $compile; then
19566             $rm -f tryp.out
19567             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19568             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19569                $cat >&4 <<EOM
19570 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19571 EOM
19572                 : now check for fflushall behaviour
19573                 case "$fflushall" in
19574                 '')     set try -DTRY_FFLUSH_ALL $output
19575                         if eval $compile; then
19576                                 $cat >&4 <<EOM
19577 (Now testing the other method--but note that this also may fail.)
19578 EOM
19579                                 $run ./try 2>/dev/null
19580                                 code=$?
19581                                 $from try.out
19582                                 if $test -s try.out -a "X$code" = X42; then
19583                                         fflushall="`$cat try.out`"
19584                                 fi
19585                         fi
19586                         $rm_try
19587                         case "$fflushall" in
19588                         x)      $cat >&4 <<EOM
19589 Whew. Flushing explicitly all the stdio streams works.
19590 EOM
19591                                 fflushall="$define"
19592                                 ;;
19593                         '')     $cat >&4 <<EOM
19594 Sigh. Flushing explicitly all the stdio streams doesn't work.
19595 EOM
19596                                 fflushall="$undef"
19597                                 ;;
19598                         *)      $cat >&4 <<EOM
19599 Cannot figure out whether flushing stdio streams explicitly works or not.
19600 I'm assuming it doesn't.
19601 EOM
19602                                 fflushall="$undef"
19603                                 ;;
19604                         esac
19605                         ;;
19606                 "$define"|true|[yY]*)
19607                         fflushall="$define"
19608                         ;;
19609                 *)
19610                         fflushall="$undef"
19611                         ;;
19612                 esac
19613             else
19614                 $cat >&4 <<EOM
19615 All is futile.  Even fflush(stdin) clobbers input pipes!
19616 EOM
19617                 fflushall="$undef"
19618             fi
19619         else
19620             fflushall="$undef"
19621         fi
19622         $rm -f core tryp.c tryp.core core.tryp.*
19623         ;;
19624 *)      fflushall="$undef"
19625         ;;
19626 esac
19627
19628 case "$fflushNULL$fflushall" in
19629 undefundef)
19630         $cat <<EOM
19631 OK, I give up.  I cannot figure out how to flush pending stdio output.
19632 We won't be flushing handles at all before fork/exec/popen.
19633 EOM
19634         ;;
19635 esac
19636 $rm_try tryp
19637
19638 : Store the full pathname to the ar program for use in the C program
19639 : Respect a hint or command line value for full_ar.
19640 case "$full_ar" in
19641 '') full_ar=$ar ;;
19642 esac
19643
19644 : Store the full pathname to the sed program for use in the C program
19645 full_sed=$sed
19646
19647 : see what type gids are declared as in the kernel
19648 echo " "
19649 echo "Looking for the type for group ids returned by getgid()."
19650 set gid_t gidtype xxx stdio.h sys/types.h
19651 eval $typedef
19652 case "$gidtype" in
19653 xxx)
19654         xxx=`./findhdr sys/user.h`
19655         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19656         case $1 in
19657         unsigned) dflt="$1 $2" ;;
19658         *) dflt="$1" ;;
19659         esac
19660         ;;
19661 *) dflt="$gidtype";;
19662 esac
19663 case "$gidtype" in
19664 gid_t) echo "gid_t found." ;;
19665 *)      rp="What is the type for group ids returned by getgid()?"
19666         . ./myread
19667         gidtype="$ans"
19668         ;;
19669 esac
19670
19671 : Check the size of GID
19672 echo " "
19673 case "$gidtype" in
19674 *_t) zzz="$gidtype"     ;;
19675 *)   zzz="gid"          ;;
19676 esac
19677 echo "Checking the size of $zzz..." >&4
19678 cat > try.c <<EOCP
19679 #include <sys/types.h>
19680 #include <stdio.h>
19681 #$i_stdlib I_STDLIB
19682 #ifdef I_STDLIB
19683 #include <stdlib.h>
19684 #endif
19685 int main() {
19686     printf("%d\n", (int)sizeof($gidtype));
19687     exit(0);
19688 }
19689 EOCP
19690 set try
19691 if eval $compile_ok; then
19692         yyy=`$run ./try`
19693         case "$yyy" in
19694         '')     gidsize=4
19695                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19696                 ;;
19697         *)      gidsize=$yyy
19698                 echo "Your $zzz is $gidsize bytes long."
19699                 ;;
19700         esac
19701 else
19702         gidsize=4
19703         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19704 fi
19705
19706
19707 : Check if GID is signed
19708 echo " "
19709 case "$gidtype" in
19710 *_t) zzz="$gidtype"     ;;
19711 *)   zzz="gid"          ;;
19712 esac
19713 echo "Checking the sign of $zzz..." >&4
19714 cat > try.c <<EOCP
19715 #include <sys/types.h>
19716 #include <stdio.h>
19717 int main() {
19718         $gidtype foo = -1;
19719         if (foo < 0)
19720                 printf("-1\n");
19721         else
19722                 printf("1\n");
19723 }
19724 EOCP
19725 set try
19726 if eval $compile; then
19727         yyy=`$run ./try`
19728         case "$yyy" in
19729         '')     gidsign=1
19730                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19731                 ;;
19732         *)      gidsign=$yyy
19733                 case "$gidsign" in
19734                  1) echo "Your $zzz is unsigned." ;;
19735                 -1) echo "Your $zzz is signed."   ;;
19736                 esac
19737                 ;;
19738         esac
19739 else
19740         gidsign=1
19741         echo "(I can't compile the test program--guessing unsigned.)" >&4
19742 fi
19743
19744
19745 : Check 64bit sizes
19746 echo " "
19747
19748 if $test X"$quadtype" != X; then
19749
19750 echo "Checking how to print 64-bit integers..." >&4
19751
19752 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19753         $cat >try.c <<'EOCP'
19754 #include <sys/types.h>
19755 #include <stdio.h>
19756 int main() {
19757   int q = 12345678901;
19758   printf("%ld\n", q);
19759 }
19760 EOCP
19761         set try
19762         if eval $compile; then
19763                 yyy=`$run ./try`
19764                 case "$yyy" in
19765                 12345678901)
19766                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19767                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19768                         echo "We will use %d."
19769                         ;;
19770                 esac
19771         fi
19772 fi
19773
19774 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19775         $cat >try.c <<'EOCP'
19776 #include <sys/types.h>
19777 #include <stdio.h>
19778 int main() {
19779   long q = 12345678901;
19780   printf("%ld\n", q);
19781 }
19782 EOCP
19783         set try
19784         if eval $compile; then
19785                 yyy=`$run ./try`
19786                 case "$yyy" in
19787                 12345678901)
19788                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19789                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19790                         echo "We will use %ld."
19791                         ;;
19792                 esac
19793         fi
19794 fi
19795
19796 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19797         $cat >try.c <<'EOCP'
19798 #include <sys/types.h>
19799 #include <inttypes.h>
19800 #include <stdio.h>
19801 int main() {
19802   int64_t q = 12345678901;
19803   printf("%" PRId64 "\n", q);
19804 }
19805 EOCP
19806         set try
19807         if eval $compile; then
19808                 yyy=`$run ./try`
19809                 case "$yyy" in
19810                 12345678901)
19811                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19812                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19813                         echo "We will use the C9X style."
19814                         ;;
19815                 esac
19816         fi
19817 fi
19818
19819 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19820         $cat >try.c <<EOCP
19821 #include <sys/types.h>
19822 #include <stdio.h>
19823 int main() {
19824   $quadtype q = 12345678901;
19825   printf("%Ld\n", q);
19826 }
19827 EOCP
19828         set try
19829         if eval $compile; then
19830                 yyy=`$run ./try`
19831                 case "$yyy" in
19832                 12345678901)
19833                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19834                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19835                         echo "We will use %Ld."
19836                         ;;
19837                 esac
19838         fi
19839 fi
19840
19841 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19842         $cat >try.c <<'EOCP'
19843 #include <sys/types.h>
19844 #include <stdio.h>
19845 int main() {
19846   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19847   printf("%lld\n", q);
19848 }
19849 EOCP
19850         set try
19851         if eval $compile; then
19852                 yyy=`$run ./try`
19853                 case "$yyy" in
19854                 12345678901)
19855                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19856                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19857                         echo "We will use the %lld style."
19858                         ;;
19859                 esac
19860         fi
19861 fi
19862
19863 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19864         $cat >try.c <<EOCP
19865 #include <sys/types.h>
19866 #include <stdio.h>
19867 int main() {
19868   $quadtype q = 12345678901;
19869   printf("%qd\n", q);
19870 }
19871 EOCP
19872         set try
19873         if eval $compile; then
19874                 yyy=`$run ./try`
19875                 case "$yyy" in
19876                 12345678901)
19877                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19878                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19879                         echo "We will use %qd."
19880                         ;;
19881                 esac
19882         fi
19883 fi
19884
19885 if $test X"$sPRId64" = X; then
19886         echo "Cannot figure out how to print 64-bit integers." >&4
19887 fi
19888 $rm_try
19889
19890 fi
19891
19892 case "$sPRId64" in
19893 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19894         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19895         ;;
19896 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19897         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19898         ;;
19899 esac
19900
19901 : Check format strings for internal types
19902 echo " "
19903 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19904
19905 if $test X"$ivsize" = X8; then
19906         ivdformat="$sPRId64"
19907         uvuformat="$sPRIu64"
19908         uvoformat="$sPRIo64"
19909         uvxformat="$sPRIx64"
19910         uvXUformat="$sPRIXU64"
19911 else
19912         if $test X"$ivsize" = X"$longsize"; then
19913                 ivdformat='"ld"'
19914                 uvuformat='"lu"'
19915                 uvoformat='"lo"'
19916                 uvxformat='"lx"'
19917                 uvXUformat='"lX"'
19918         else
19919                 if $test X"$ivsize" = X"$intsize"; then
19920                         ivdformat='"d"'
19921                         uvuformat='"u"'
19922                         uvoformat='"o"'
19923                         uvxformat='"x"'
19924                         uvXUformat='"X"'
19925                 else
19926                         : far out
19927                         if $test X"$ivsize" = X"$shortsize"; then
19928                                 ivdformat='"hd"'
19929                                 uvuformat='"hu"'
19930                                 uvoformat='"ho"'
19931                                 uvxformat='"hx"'
19932                                 uvXUformat='"hX"'
19933                         fi
19934                 fi
19935         fi
19936 fi
19937
19938 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19939         nveformat="$sPRIeldbl"
19940         nvfformat="$sPRIfldbl"
19941         nvgformat="$sPRIgldbl"
19942         nvEUformat="$sPRIEUldbl"
19943         nvFUformat="$sPRIFUldbl"
19944         nvGUformat="$sPRIGUldbl"
19945 else
19946         nveformat='"e"'
19947         nvfformat='"f"'
19948         nvgformat='"g"'
19949         nvEUformat='"E"'
19950         nvFUformat='"F"'
19951         nvGUformat='"G"'
19952 fi
19953
19954 case "$ivdformat" in
19955 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19956     exit 1
19957     ;;
19958 esac
19959
19960 : Check format string for GID
19961
19962 echo " "
19963 $echo "Checking the format string to be used for gids..." >&4
19964
19965 case "$gidsign" in
19966 -1)     if $test X"$gidsize" = X"$ivsize"; then
19967                 gidformat="$ivdformat"
19968         else
19969                 if $test X"$gidsize" = X"$longsize"; then
19970                         gidformat='"ld"'
19971                 else
19972                         if $test X"$gidsize" = X"$intsize"; then
19973                                 gidformat='"d"'
19974                         else
19975                                 if $test X"$gidsize" = X"$shortsize"; then
19976                                         gidformat='"hd"'
19977                                 fi
19978                         fi
19979                 fi
19980         fi
19981         ;;
19982 *)      if $test X"$gidsize" = X"$uvsize"; then
19983                 gidformat="$uvuformat"
19984         else
19985                 if $test X"$gidsize" = X"$longsize"; then
19986                         gidformat='"lu"'
19987                 else
19988                         if $test X"$gidsize" = X"$intsize"; then
19989                                 gidformat='"u"'
19990                         else
19991                                 if $test X"$gidsize" = X"$shortsize"; then
19992                                         gidformat='"hu"'
19993                                 fi
19994                         fi
19995                 fi
19996         fi
19997         ;;
19998 esac
19999
20000 : see if getgroups exists
20001 set getgroups d_getgrps
20002 eval $inlibc
20003
20004 : see if setgroups exists
20005 set setgroups d_setgrps
20006 eval $inlibc
20007
20008 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20009 echo " "
20010 case "$d_getgrps$d_setgrps" in
20011 *define*)
20012         case "$groupstype" in
20013         '') dflt="$gidtype" ;;
20014         *)  dflt="$groupstype" ;;
20015         esac
20016         $cat <<EOM
20017 What type of pointer is the second argument to getgroups() and setgroups()?
20018 Usually this is the same as group ids, $gidtype, but not always.
20019
20020 EOM
20021         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20022         . ./myread
20023         groupstype="$ans"
20024         ;;
20025 *)  groupstype="$gidtype";;
20026 esac
20027
20028 : MAD = Misc Attribute Definition
20029
20030 if $test $patchlevel -lt 9; then
20031 : MAD is not available in 5.8.x or earlier.
20032     ans=n;
20033 else
20034     case "$mad" in
20035     $define|true|[yY]*) dflt='y' ;;
20036     *)                  dflt='n' ;;
20037     esac
20038     cat <<EOM
20039
20040 Would you like to build with Misc Attribute Decoration? This is development
20041 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20042 overhead on the interpreter.
20043
20044 If this doesn't make any sense to you, just accept the default '$dflt'.
20045 EOM
20046     rp='Build Perl with MAD?'
20047     . ./myread
20048 fi
20049 case "$ans" in
20050 y|Y)    val="$define"
20051         madlyh='madly.h madly.act madly.tab'
20052         madlysrc='madly.c'
20053         madlyobj="madly$_o" ;;
20054 *)      val="$undef"
20055         madlyh=''
20056         madlysrc=''
20057         madlyobj='' ;;
20058 esac
20059 set mad
20060 eval $setvar
20061
20062 : check whether make sets MAKE
20063 echo " "
20064 echo "Checking if your $make program sets \$(MAKE)..." >&4
20065 case "$make_set_make" in
20066 '')
20067         $sed 's/^X //' > testmake.mak << 'EOF'
20068 Xall:
20069 X       @echo 'maketemp="$(MAKE)"'
20070 EOF
20071         case "`$make -f testmake.mak 2>/dev/null`" in
20072         *maketemp=*) make_set_make='#' ;;
20073         *)      make_set_make="MAKE=$make" ;;
20074         esac
20075         $rm -f testmake.mak
20076         ;;
20077 esac
20078 case "$make_set_make" in
20079 '#') echo "Yup, it does.";;
20080 *) echo "Nope, it doesn't.";;
20081 esac
20082
20083 : see what type is used for mode_t
20084 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20085 set mode_t modetype int stdio.h sys/types.h
20086 eval $typedef_ask
20087
20088 : see if we need va_copy
20089 echo " "
20090 case "$i_stdarg" in
20091 "$define")
20092         $cat >try.c <<EOCP
20093 #include <stdarg.h>
20094 #include <stdio.h>
20095 #$i_stdlib I_STDLIB
20096 #ifdef I_STDLIB
20097 #include <stdlib.h>
20098 #endif
20099 #include <signal.h>
20100
20101 int
20102 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20103 {
20104   return vfprintf(f, fmt, *valp);
20105 }
20106
20107 int
20108 myvfprintf(FILE *f, const  char *fmt, va_list val)
20109 {
20110   return ivfprintf(f, fmt, &val);
20111 }
20112
20113 int
20114 myprintf(char *fmt, ...)
20115 {
20116   va_list val;
20117   va_start(val, fmt);
20118   return myvfprintf(stdout, fmt, val);
20119 }
20120
20121 int
20122 main(int ac, char **av)
20123 {
20124   signal(SIGSEGV, exit);
20125
20126   myprintf("%s%cs all right, then\n", "that", '\'');
20127   exit(0);
20128 }
20129 EOCP
20130         set try
20131         if eval $compile && $run ./try 2>&1 >/dev/null; then
20132                 case "`$run ./try`" in
20133                 "that's all right, then")
20134                         okay=yes
20135                         ;;
20136                 esac
20137         fi
20138         case "$okay" in
20139         yes)    echo "It seems that you don't need va_copy()." >&4
20140                 need_va_copy="$undef"
20141                 ;;
20142         *)      echo "It seems that va_copy() or similar will be needed." >&4
20143                 need_va_copy="$define"
20144                 ;;
20145         esac
20146         $rm_try
20147         ;;
20148 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20149         ;;
20150 esac
20151
20152 : see what type is used for size_t
20153 rp="What is the type used for the length parameter for string functions?"
20154 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20155 eval $typedef_ask
20156
20157 : check for type of arguments to gethostbyaddr. 
20158 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20159         case "$d_gethbyaddr" in
20160         $define)
20161                 $cat <<EOM
20162
20163 Checking to see what type of arguments are accepted by gethostbyaddr().
20164 EOM
20165                 hdrs="$define sys/types.h
20166                         $d_socket sys/socket.h 
20167                         $i_niin netinet/in.h 
20168                         $i_netdb netdb.h
20169                         $i_unistd unistd.h"
20170                 : The first arg can 'char *' or 'void *'
20171                 : The second arg is some of integral type
20172                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20173                         for yyy in size_t long int; do
20174                                 case "$netdb_host_type" in
20175                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20176                                         if ./protochk "$try" $hdrs; then
20177                                                 echo "Your system accepts $xxx for the first arg."
20178                                                 echo "...and $yyy for the second arg."
20179                                                 netdb_host_type="$xxx"
20180                                                 netdb_hlen_type="$yyy"
20181                                         fi
20182                                         ;;
20183                                 esac
20184                         done
20185                 done
20186                 : In case none of those worked, prompt the user.
20187                 case "$netdb_host_type" in
20188                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20189                         dflt='char *'
20190                         . ./myread
20191                         netdb_host_type=$ans
20192                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20193                         dflt="$sizetype"
20194                         . ./myread
20195                         netdb_hlen_type=$ans
20196                         ;;
20197                 esac
20198                 ;;
20199         *)      : no gethostbyaddr, so pick harmless defaults
20200                 netdb_host_type='char *'
20201                 netdb_hlen_type="$sizetype"
20202                 ;;
20203         esac
20204         # Remove the "const" if needed. -- but then we'll have a 
20205         # prototype clash!
20206         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20207 fi
20208
20209 : check for type of argument to gethostbyname. 
20210 if test "X$netdb_name_type" = X ; then
20211         case "$d_gethbyname" in
20212         $define)
20213                 $cat <<EOM
20214
20215 Checking to see what type of argument is accepted by gethostbyname().
20216 EOM
20217                 hdrs="$define sys/types.h
20218                         $d_socket sys/socket.h 
20219                         $i_niin netinet/in.h 
20220                         $i_netdb netdb.h
20221                         $i_unistd unistd.h"
20222                 for xxx in "const char *" "char *"; do
20223                         case "$netdb_name_type" in
20224                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20225                                 if ./protochk "$try" $hdrs; then
20226                                         echo "Your system accepts $xxx."
20227                                         netdb_name_type="$xxx"
20228                                 fi
20229                                 ;;
20230                         esac
20231                 done
20232                 : In case none of those worked, prompt the user.
20233                 case "$netdb_name_type" in
20234                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20235                         dflt='char *'
20236                         . ./myread
20237                         netdb_name_type=$ans
20238                         ;;
20239                 esac
20240                 ;;
20241         *)      : no gethostbyname, so pick harmless default
20242                 netdb_name_type='char *'
20243                 ;;
20244         esac
20245 fi
20246
20247 : check for type of 1st argument to getnetbyaddr. 
20248 if test "X$netdb_net_type" = X ; then
20249         case "$d_getnbyaddr" in
20250         $define)
20251                 $cat <<EOM
20252
20253 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20254 EOM
20255                 hdrs="$define sys/types.h
20256                         $d_socket sys/socket.h 
20257                         $i_niin netinet/in.h 
20258                         $i_netdb netdb.h
20259                         $i_unistd unistd.h"
20260                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20261                         case "$netdb_net_type" in
20262                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20263                                 if ./protochk "$try" $hdrs; then
20264                                         echo "Your system accepts $xxx."
20265                                         netdb_net_type="$xxx"
20266                                 fi
20267                                 ;;
20268                         esac
20269                 done
20270                 : In case none of those worked, prompt the user.
20271                 case "$netdb_net_type" in
20272                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20273                         dflt='long'
20274                         . ./myread
20275                         netdb_net_type=$ans
20276                         ;;
20277                 esac
20278                 ;;
20279         *)      : no getnetbyaddr, so pick harmless default
20280                 netdb_net_type='long'
20281                 ;;
20282         esac
20283 fi
20284 : locate the preferred pager for this system
20285 fn=f/
20286 case "$pager" in
20287 '')
20288         dflt=''
20289         case "$pg" in
20290         /*) dflt=$pg;;
20291         [a-zA-Z]:/*) dflt=$pg;;
20292         esac
20293         case "$more" in
20294         /*) dflt=$more;;
20295         [a-zA-Z]:/*) dflt=$more;;
20296         esac
20297         case "$less" in
20298         /*) dflt=$less;;
20299         [a-zA-Z]:/*) dflt=$less;;
20300         esac
20301         case "$dflt" in
20302         '') dflt=/usr/ucb/more;;
20303         esac
20304         ;;
20305 *)      dflt="$pager"
20306         fn="f/($pager)"
20307         ;;
20308 esac
20309 echo " "
20310 rp='What pager is used on your system?'
20311 . ./getfile
20312 pager="$ans"
20313
20314 : see what type pids are declared as in the kernel
20315 rp="What is the type of process ids on this system?"
20316 set pid_t pidtype int stdio.h sys/types.h
20317 eval $typedef_ask
20318
20319 : see if ar generates random libraries by itself
20320 echo " "
20321 echo "Checking how to generate random libraries on your machine..." >&4
20322 echo 'int bar1() { return bar2(); }' > bar1.c
20323 echo 'int bar2() { return 2; }' > bar2.c
20324 $cat > foo.c <<EOP
20325 #$i_stdlib I_STDLIB
20326 #ifdef I_STDLIB
20327 #include <stdlib.h>
20328 #endif
20329 int main() { printf("%d\n", bar1()); exit(0); }
20330 EOP
20331 $cc $ccflags -c bar1.c >/dev/null 2>&1
20332 $cc $ccflags -c bar2.c >/dev/null 2>&1
20333 $cc $ccflags -c foo.c >/dev/null 2>&1
20334 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20335 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20336         $run ./foobar >/dev/null 2>&1; then
20337         echo "$ar appears to generate random libraries itself."
20338         orderlib=false
20339         if [ "X$ranlib" = "X" ]; then
20340             ranlib=":"
20341         fi
20342 elif $ar s bar$_a >/dev/null 2>&1 &&
20343         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20344         $run ./foobar >/dev/null 2>&1; then
20345                 echo "a table of contents needs to be added with '$ar s'."
20346                 orderlib=false
20347                 ranlib="$ar s"
20348 elif $ar ts bar$_a >/dev/null 2>&1 &&
20349         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20350         $run ./foobar >/dev/null 2>&1; then
20351                 echo "a table of contents needs to be added with '$ar ts'."
20352                 orderlib=false
20353                 ranlib="$ar ts"
20354 else
20355         case "$ranlib" in
20356         :) ranlib='';;
20357         '')
20358                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20359                 $test -f $ranlib || ranlib=''
20360                 ;;
20361         esac
20362         if $test -n "$ranlib"; then
20363                 echo "your system has '$ranlib'; we'll use that."
20364                 orderlib=false
20365         else
20366                 echo "your system doesn't seem to support random libraries"
20367                 echo "so we'll use lorder and tsort to order the libraries."
20368                 orderlib=true
20369                 ranlib=":"
20370         fi
20371 fi
20372 $rm -f foo* bar*
20373
20374 : see if this is a values.h system
20375 set values.h i_values
20376 eval $inhdr
20377
20378 : Check the max offset that gmtime and localtime accept
20379 echo "Checking max offsets that gmtime () accepts"
20380
20381 case $i_values in
20382     define) yyy="#include <values.h>" ;;
20383     *)      yyy="" ;;
20384     esac
20385
20386 case "$sGMTIME_min/$sGMTIME_max" in
20387     0/0|/)
20388         $cat >try.c <<EOCP
20389 #include <sys/types.h>
20390 #include <stdio.h>
20391 #include <time.h>
20392 $yyy
20393
20394 int i;
20395 struct tm *tmp;
20396 time_t pt;
20397
20398 void gm_check (time_t t, int min_year, int max_year)
20399 {
20400     tmp = gmtime (&t);
20401     if ( tmp == NULL ||
20402         /* Check tm_year overflow */
20403          tmp->tm_year < min_year || tmp->tm_year > max_year)
20404         tmp = NULL;
20405     else
20406         pt = t;
20407     } /* gm_check */
20408
20409 int check_max ()
20410 {
20411     tmp = NULL;
20412     pt  = 0;
20413 #ifdef MAXLONG
20414     gm_check (MAXLONG, 69, 0x7fffffff);
20415 #endif
20416     if (tmp == NULL || tmp->tm_year < 0) {
20417         for (i = 63; i >= 0; i--) {
20418             time_t x = pt | ((time_t)1 << i);
20419             if (x < 0 || x < pt) continue;
20420             gm_check (x, 69, 0x7fffffff);
20421             }
20422         }
20423     printf ("sGMTIME_max=%ld\n", pt);
20424     return (0);
20425     } /* check_max */
20426
20427 int check_min ()
20428 {
20429     tmp = NULL;
20430     pt  = 0;
20431 #ifdef MINLONG
20432     gm_check (MINLONG, -1900, 70);
20433 #endif
20434     if (tmp == NULL) {
20435         for (i = 36; i >= 0; i--) {
20436             time_t x = pt - ((time_t)1 << i);
20437             if (x > 0) continue;
20438             gm_check (x, -1900, 70);
20439             }
20440         }
20441     printf ("sGMTIME_min=%ld\n", pt);
20442     return (0);
20443     } /* check_min */
20444
20445 int main (int argc, char *argv[])
20446 {
20447     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20448     check_max ();
20449     check_min ();
20450     return (0);
20451     } /* main */
20452 EOCP
20453         set try
20454         if eval $compile; then
20455             eval `$run ./try`
20456         else
20457             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20458             fi
20459         $rm_try
20460         ;;
20461     esac
20462
20463 echo "Checking max offsets that localtime () accepts"
20464
20465 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20466     0/0|/)
20467         $cat >try.c <<EOCP
20468 #include <sys/types.h>
20469 #include <stdio.h>
20470 #include <time.h>
20471 $yyy
20472
20473 int i;
20474 struct tm *tmp;
20475 time_t pt;
20476
20477 void local_check (time_t t, int min_year, int max_year)
20478 {
20479     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20480         tmp = NULL;
20481     else
20482         tmp = localtime (&t);
20483     if ( tmp == NULL ||
20484         /* Check tm_year overflow */
20485          tmp->tm_year < min_year || tmp->tm_year > max_year)
20486         tmp = NULL;
20487     else
20488         pt = t;
20489     } /* local_check */
20490
20491 int check_max ()
20492 {
20493     tmp = NULL;
20494     pt  = 0;
20495 #ifdef MAXLONG
20496     local_check (MAXLONG, 69, 0x7fffffff);
20497 #endif
20498     if (tmp == NULL || tmp->tm_year < 0) {
20499         for (i = 63; i >= 0; i--) {
20500             time_t x = pt | ((time_t)1 << i);
20501             if (x < 0 || x < pt) continue;
20502             local_check (x, 69, 0x7fffffff);
20503             }
20504         }
20505     printf ("sLOCALTIME_max=%ld\n", pt);
20506     return (0);
20507    } /* check_max */
20508
20509 int check_min ()
20510 {
20511     tmp = NULL;
20512     pt  = 0;
20513 #ifdef MINLONG
20514     local_check (MINLONG, -1900, 70);
20515 #endif
20516     if (tmp == NULL) {
20517         for (i = 36; i >= 0; i--) {
20518             time_t x = pt - ((time_t)1 << i);
20519             if (x > 0) continue;
20520             local_check (x, -1900, 70);
20521             }
20522         }
20523     printf ("sLOCALTIME_min=%ld\n", pt);
20524     return (0);
20525     } /* check_min */
20526
20527 int main (int argc, char *argv[])
20528 {
20529     check_max ();
20530     check_min ();
20531     return (0);
20532     } /* main */
20533 EOCP
20534         set try
20535         if eval $compile; then
20536             eval `$run ./try`
20537         else
20538             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20539             fi
20540         $rm_try
20541         ;;
20542     esac
20543
20544 : check for type of arguments to select.
20545 case "$selecttype" in
20546 '') case "$d_select" in
20547         $define)
20548                 echo " "
20549                 $cat <<EOM
20550 Checking to see what type of arguments are accepted by select().
20551 EOM
20552                 hdrs="$define sys/types.h
20553                         $i_systime sys/time.h
20554                         $i_sysselct sys/select.h
20555                         $d_socket sys/socket.h"
20556                 : The first arg can be int, unsigned, or size_t
20557                 : The last arg may or may not be 'const'
20558                 val=''
20559                 : void pointer has been seen but using that
20560                 : breaks the selectminbits test
20561                 for xxx in 'fd_set *' 'int *'; do
20562                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20563                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20564                                         case "$val" in
20565                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20566                                                 if ./protochk "$try" $hdrs; then
20567                                                         echo "Your system accepts $xxx."
20568                                                         val="$xxx"
20569                                                 fi
20570                                                 ;;
20571                                         esac
20572                                 done
20573                         done
20574                 done
20575                 case "$val" in
20576                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20577                         case "$d_fd_set" in
20578                                 $define) dflt="fd_set *" ;;
20579                                 *)              dflt="int *" ;;
20580                         esac
20581                         . ./myread
20582                         val=$ans
20583                         ;;
20584                 esac
20585                 selecttype="$val"
20586                 ;;
20587         *)      : no select, so pick a harmless default
20588                 selecttype='int *'
20589                 ;;
20590         esac
20591         ;;
20592 esac
20593
20594 : check for the select 'width'
20595 case "$selectminbits" in
20596 '') safebits=`expr $ptrsize \* 8`
20597     case "$d_select" in
20598         $define)
20599                 $cat <<EOM
20600
20601 Checking to see on how many bits at a time your select() operates...
20602 EOM
20603                 $cat >try.c <<EOCP
20604 #include <sys/types.h>
20605 #$i_time I_TIME
20606 #$i_systime I_SYS_TIME
20607 #$i_systimek I_SYS_TIME_KERNEL
20608 #ifdef I_TIME
20609 #   include <time.h>
20610 #endif
20611 #ifdef I_SYS_TIME
20612 #   ifdef I_SYS_TIME_KERNEL
20613 #       define KERNEL
20614 #   endif
20615 #   include <sys/time.h>
20616 #   ifdef I_SYS_TIME_KERNEL
20617 #       undef KERNEL
20618 #   endif
20619 #endif
20620 #$i_sysselct I_SYS_SELECT
20621 #ifdef I_SYS_SELECT
20622 #include <sys/select.h>
20623 #endif
20624 #$d_socket HAS_SOCKET
20625 #ifdef HAS_SOCKET
20626 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20627 #endif
20628 #include <stdio.h>
20629 #$i_stdlib I_STDLIB
20630 #ifdef I_STDLIB
20631 #include <stdlib.h>
20632 #endif
20633 $selecttype b;
20634 #define S sizeof(*(b))
20635 #define MINBITS 64
20636 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20637 #define NBITS  (NBYTES * 8)
20638 int main() {
20639     char *s = (char *)malloc(NBYTES);
20640     struct timeval t;
20641     int i;
20642     FILE* fp;
20643     int fd;
20644
20645     if (!s)
20646         exit(1);
20647     fclose(stdin);
20648     fp = fopen("try.c", "r");
20649     if (fp == 0)
20650       exit(2);
20651     fd = fileno(fp);
20652     if (fd < 0)
20653       exit(3);
20654     b = ($selecttype)s;
20655     for (i = 0; i < NBITS; i++)
20656         FD_SET(i, b);
20657     t.tv_sec  = 0;
20658     t.tv_usec = 0;
20659     select(fd + 1, b, 0, 0, &t);
20660     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20661     free(s);
20662     printf("%d\n", i + 1);
20663     return 0;
20664 }
20665 EOCP
20666                 set try
20667                 if eval $compile_ok; then
20668                         selectminbits=`$run ./try`
20669                         case "$selectminbits" in
20670                         '')     cat >&4 <<EOM
20671 Cannot figure out on how many bits at a time your select() operates.
20672 I'll play safe and guess it is $safebits bits.
20673 EOM
20674                                 selectminbits=$safebits
20675                                 bits="$safebits bits"
20676                                 ;;
20677                         1)      bits="1 bit" ;;
20678                         *)      bits="$selectminbits bits" ;;
20679                         esac
20680                         echo "Your select() operates on $bits at a time." >&4
20681                 else
20682                         rp='What is the minimum number of bits your select() operates on?'
20683                         case "$byteorder" in
20684                         12345678)       dflt=64 ;;
20685                         1234)           dflt=32 ;;
20686                         *)              dflt=1  ;;
20687                         esac
20688                         . ./myread
20689                         val=$ans
20690                         selectminbits="$val"
20691                 fi
20692                 $rm_try
20693                 ;;
20694         *)      : no select, so pick a harmless default
20695                 selectminbits=$safebits
20696                 ;;
20697         esac
20698         ;;
20699 esac
20700
20701 : Trace out the files included by signal.h, then look for SIGxxx names.
20702 if [ "X$fieldn" = X ]; then
20703         : Just make some guesses.  We check them later.
20704         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20705 else
20706         xxx=`echo '#include <signal.h>' |
20707         $cppstdin $cppminus $cppflags 2>/dev/null |
20708         $grep '^[       ]*#.*include' |
20709         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20710                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20711 fi
20712 xxxfiles=''
20713 for xx in $xxx /dev/null ; do
20714         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20715 done
20716 case "$xxxfiles" in
20717 '')     xxxfiles=`./findhdr signal.h` ;;
20718 esac
20719 xxx=`awk '
20720 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20721         print substr($2, 4, 20)
20722 }
20723 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20724         print substr($3, 4, 20)
20725 }' $xxxfiles`
20726 : Append some common names just in case the awk scan failed.
20727 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20728 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20729 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20730 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20731 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20732
20733 : generate a few handy files for later
20734 $cat > signal.c <<EOCP
20735 #include <sys/types.h>
20736 #include <signal.h>
20737 #$i_stdlib I_STDLIB
20738 #ifdef I_STDLIB
20739 #include <stdlib.h>
20740 #endif
20741 #include <stdio.h>
20742 int main() {
20743
20744 /* Strange style to avoid deeply-nested #if/#else/#endif */
20745 #ifndef NSIG
20746 #  ifdef _NSIG
20747 #    define NSIG (_NSIG)
20748 #  endif
20749 #endif
20750
20751 #ifndef NSIG
20752 #  ifdef SIGMAX
20753 #    define NSIG (SIGMAX+1)
20754 #  endif
20755 #endif
20756
20757 #ifndef NSIG
20758 #  ifdef SIG_MAX
20759 #    define NSIG (SIG_MAX+1)
20760 #  endif
20761 #endif
20762
20763 #ifndef NSIG
20764 #  ifdef _SIG_MAX
20765 #    define NSIG (_SIG_MAX+1)
20766 #  endif
20767 #endif
20768
20769 #ifndef NSIG
20770 #  ifdef MAXSIG
20771 #    define NSIG (MAXSIG+1)
20772 #  endif
20773 #endif
20774
20775 #ifndef NSIG
20776 #  ifdef MAX_SIG
20777 #    define NSIG (MAX_SIG+1)
20778 #  endif
20779 #endif
20780
20781 #ifndef NSIG
20782 #  ifdef SIGARRAYSIZE
20783 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20784 #  endif
20785 #endif
20786
20787 #ifndef NSIG
20788 #  ifdef _sys_nsig
20789 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20790 #  endif
20791 #endif
20792
20793 /* Default to some arbitrary number that's big enough to get most
20794    of the common signals.
20795 */
20796 #ifndef NSIG
20797 #    define NSIG 50
20798 #endif
20799
20800 printf("NSIG %d\n", NSIG);
20801
20802 #ifndef JUST_NSIG
20803
20804 EOCP
20805
20806 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20807 {
20808         printf "#ifdef SIG"; printf $1; printf "\n"
20809         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20810         printf $1; printf ");\n"
20811         printf "#endif\n"
20812 }
20813 END {
20814         printf "#endif /* JUST_NSIG */\n";
20815         printf "exit(0);\n}\n";
20816 }
20817 ' >>signal.c
20818 $cat >signal.awk <<'EOP'
20819 BEGIN { ndups = 0 }
20820 $1 ~ /^NSIG$/ { nsig = $2 }
20821 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20822     if ($2 > maxsig) { maxsig = $2 }
20823     if (sig_name[$2]) {
20824         dup_name[ndups] = $1
20825         dup_num[ndups] = $2
20826         ndups++
20827     }
20828     else {
20829         sig_name[$2] = $1
20830         sig_num[$2] = $2
20831     }
20832 }
20833 END {
20834     if (nsig == 0) {
20835         nsig = maxsig + 1
20836     }
20837     printf("NSIG %d\n", nsig);
20838     for (n = 1; n < nsig; n++) {
20839         if (sig_name[n]) {
20840             printf("%s %d\n", sig_name[n], sig_num[n])
20841         }
20842         else {
20843             printf("NUM%d %d\n", n, n)
20844         }
20845     }
20846     for (n = 0; n < ndups; n++) {
20847         printf("%s %d\n", dup_name[n], dup_num[n])
20848     }
20849 }
20850 EOP
20851 $cat >signal_cmd <<EOS
20852 $startsh
20853 if $test -s signal.lst; then
20854     echo "Using your existing signal.lst file"
20855         exit 0
20856 fi
20857 xxx="$xxx"
20858 EOS
20859 $cat >>signal_cmd <<'EOS'
20860
20861 set signal
20862 if eval $compile_ok; then
20863         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20864                 $uniq | $awk -f signal.awk >signal.lst
20865 else
20866         echo "(I can't seem be able to compile the whole test program)" >&4
20867         echo "(I'll try it in little pieces.)" >&4
20868         set signal -DJUST_NSIG
20869         if eval $compile_ok; then
20870                 $run ./signal$_exe > signal.nsg
20871                 $cat signal.nsg
20872         else
20873                 echo "I can't seem to figure out how many signals you have." >&4
20874                 echo "Guessing 50." >&4
20875                 echo 'NSIG 50' > signal.nsg
20876         fi
20877         : Now look at all the signal names, one at a time.
20878         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20879                 $cat > signal.c <<EOCP
20880 #include <sys/types.h>
20881 #include <signal.h>
20882 #include <stdio.h>
20883 int main() {
20884 printf("$xx %d\n", SIG${xx});
20885 return 0;
20886 }
20887 EOCP
20888                 set signal
20889                 if eval $compile; then
20890                         echo "SIG${xx} found."
20891                         $run ./signal$_exe  >> signal.ls1
20892                 else
20893                         echo "SIG${xx} NOT found."
20894                 fi
20895         done
20896         if $test -s signal.ls1; then
20897                 $cat signal.nsg signal.ls1 |
20898                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20899         fi
20900
20901 fi
20902 if $test -s signal.lst; then
20903         :
20904 else
20905         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20906         echo 'kill -l' >signal
20907         set X `csh -f <signal`
20908         $rm -f signal
20909         shift
20910         case $# in
20911         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20912         esac
20913         echo $@ | $tr ' ' $trnl | \
20914             $awk '{ printf "%s %d\n", $1, ++s; }
20915                   END { printf "NSIG %d\n", ++s }' >signal.lst
20916 fi
20917 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20918 EOS
20919 chmod a+x signal_cmd
20920 $eunicefix signal_cmd
20921
20922 : generate list of signal names
20923 echo " "
20924 case "$sig_name_init" in
20925 '') doinit=yes ;;
20926 *)  case "$sig_num_init" in
20927     ''|*,*) doinit=yes ;;
20928     esac ;;
20929 esac
20930 case "$doinit" in
20931 yes)
20932         echo "Generating a list of signal names and numbers..." >&4
20933         . ./signal_cmd
20934         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20935         sig_name=`$awk 'BEGIN { printf "ZERO " }
20936                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20937         sig_num=`$awk  'BEGIN { printf "0 " }
20938                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20939         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20940                              !/^NSIG/   { printf "\"%s\", ", $1 }
20941                              END        { printf "0\n" }' signal.lst`
20942         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20943                              !/^NSIG/   { printf "%d, ", $2}
20944                              END        { printf "0\n"}' signal.lst`
20945         ;;
20946 esac
20947 echo "The following $sig_count signals are available:"
20948 echo " "
20949 echo $sig_name | $awk \
20950 'BEGIN { linelen = 0 }
20951 {
20952         for (i = 1; i <= NF; i++) {
20953                 name = "SIG" $i " "
20954                 linelen = linelen + length(name)
20955                 if (linelen > 70) {
20956                         printf "\n"
20957                         linelen = length(name)
20958                 }
20959                 printf "%s", name
20960         }
20961         printf "\n"
20962 }'
20963 sig_size=`echo $sig_name | awk '{print NF}'`
20964 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20965
20966 : Check size of size
20967 echo " "
20968 case "$sizetype" in
20969 *_t) zzz="$sizetype"    ;;
20970 *)   zzz="filesize"     ;;
20971 esac
20972 echo "Checking the size of $zzz..." >&4
20973 cat > try.c <<EOCP
20974 #include <sys/types.h>
20975 #include <stdio.h>
20976 #$i_stdlib I_STDLIB
20977 #ifdef I_STDLIB
20978 #include <stdlib.h>
20979 #endif
20980 int main() {
20981     printf("%d\n", (int)sizeof($sizetype));
20982     exit(0);
20983 }
20984 EOCP
20985 set try
20986 if eval $compile_ok; then
20987         yyy=`$run ./try`
20988         case "$yyy" in
20989         '')     sizesize=4
20990                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20991                 ;;
20992         *)      sizesize=$yyy
20993                 echo "Your $zzz size is $sizesize bytes."
20994                 ;;
20995         esac
20996 else
20997         sizesize=4
20998         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20999 fi
21000
21001
21002 : check for socklen_t
21003 echo " "
21004 echo "Checking to see if you have socklen_t..." >&4
21005 $cat >try.c <<EOCP
21006 #include <sys/types.h>
21007 #$d_socket HAS_SOCKET
21008 #ifdef HAS_SOCKET
21009 #include <sys/socket.h>
21010 #endif
21011 int main() { socklen_t x = 16; }
21012 EOCP
21013 set try
21014 if eval $compile; then
21015         val="$define"
21016         echo "You have socklen_t."
21017 else
21018         val="$undef"
21019         echo "You do not have socklen_t."
21020         case "$sizetype" in
21021         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21022         esac
21023 fi
21024 $rm_try
21025 set d_socklen_t
21026 eval $setvar
21027
21028 : see if this is a socks.h system
21029 set socks.h i_socks
21030 eval $inhdr
21031
21032 : check for type of the size argument to socket calls
21033 case "$d_socket" in
21034 "$define")
21035         $cat <<EOM
21036
21037 Checking to see what type is the last argument of accept().
21038 EOM
21039         yyy=''
21040         case "$d_socklen_t" in
21041         "$define") yyy="$yyy socklen_t"
21042         esac
21043         yyy="$yyy $sizetype int long unsigned"
21044         for xxx in $yyy; do
21045                 case "$socksizetype" in
21046                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21047                         case "$usesocks" in
21048                         "$define")
21049                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21050                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21051                                         socksizetype="$xxx"
21052                                 fi
21053                                 ;;
21054                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21055                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21056                                         socksizetype="$xxx"
21057                                 fi
21058                                 ;;
21059                         esac
21060                         ;;
21061                 esac
21062         done
21063 : In case none of those worked, prompt the user.
21064         case "$socksizetype" in
21065         '')     rp='What is the type for socket address structure sizes?'
21066                 dflt='int'
21067                 . ./myread
21068                 socksizetype=$ans
21069                 ;;
21070         esac
21071         ;;
21072 *)      : no sockets, so pick relatively harmless default
21073         socksizetype='int'
21074         ;;
21075 esac
21076
21077 : see what type is used for signed size_t
21078 set ssize_t ssizetype int stdio.h sys/types.h
21079 eval $typedef
21080 dflt="$ssizetype"
21081 $cat > try.c <<EOM
21082 #include <stdio.h>
21083 #$i_stdlib I_STDLIB
21084 #ifdef I_STDLIB
21085 #include <stdlib.h>
21086 #endif
21087 #include <sys/types.h>
21088 #define Size_t $sizetype
21089 #define SSize_t $dflt
21090 int main()
21091 {
21092         if (sizeof(Size_t) == sizeof(SSize_t))
21093                 printf("$dflt\n");
21094         else if (sizeof(Size_t) == sizeof(int))
21095                 printf("int\n");
21096         else
21097                 printf("long\n");
21098         exit(0);
21099 }
21100 EOM
21101 echo " "
21102 set try
21103 if eval $compile_ok && $run ./try > /dev/null; then
21104         ssizetype=`$run ./try`
21105         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21106 else
21107         $cat >&4 <<EOM
21108 Help! I can't compile and run the ssize_t test program: please enlighten me!
21109 (This is probably a misconfiguration in your system or libraries, and
21110 you really ought to fix it.  Still, I'll try anyway.)
21111
21112 I need a type that is the same size as $sizetype, but is guaranteed to
21113 be signed.  Common values are ssize_t, int and long.
21114
21115 EOM
21116         rp="What signed type is the same size as $sizetype?"
21117         . ./myread
21118         ssizetype="$ans"
21119 fi
21120 $rm_try
21121
21122 : Check the size of st_ino
21123 $echo " "
21124 $echo "Checking the size of st_ino..." >&4
21125 $cat > try.c <<EOCP
21126 #include <sys/stat.h>
21127 #include <stdio.h>
21128 #$i_stdlib I_STDLIB
21129 #ifdef I_STDLIB
21130 #include <stdlib.h>
21131 #endif
21132 int main() {
21133     struct stat st;
21134     printf("%d\n", (int)sizeof(st.st_ino));
21135     exit(0);
21136 }
21137 EOCP
21138 set try
21139 if eval $compile_ok; then
21140         val=`$run ./try`
21141         case "$val" in
21142         '')     st_ino_size=4
21143                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21144                 ;;
21145         *)      st_ino_size=$val
21146                 $echo "Your st_ino is $st_ino_size bytes long."
21147                 ;;
21148         esac
21149 else
21150         st_ino_size=4
21151         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21152 fi
21153 $rm_try
21154
21155 : Check if st_ino is signed
21156 $echo " "
21157 $echo "Checking the sign of st_ino..." >&4
21158 $cat > try.c <<EOCP
21159 #include <sys/stat.h>
21160 #include <stdio.h>
21161 int main() {
21162         struct stat foo;
21163         foo.st_ino = -1;
21164         if (foo.st_ino < 0)
21165                 printf("-1\n");
21166         else
21167                 printf("1\n");
21168 }
21169 EOCP
21170 set try
21171 if eval $compile; then
21172         val=`$run ./try`
21173         case "$val" in
21174         '')     st_ino_sign=1
21175                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21176                 ;;
21177         *)      st_ino_sign=$val
21178                 case "$st_ino_sign" in
21179                  1) $echo "Your st_ino is unsigned." ;;
21180                 -1) $echo "Your st_ino is signed."   ;;
21181                 esac
21182                 ;;
21183         esac
21184 else
21185         st_ino_sign=1
21186         $echo "(I can't compile the test program--guessing unsigned.)" >&4
21187 fi
21188 $rm_try
21189
21190 : see what type of char stdio uses.
21191 echo " "
21192 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21193 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21194         echo "Your stdio uses unsigned chars." >&4
21195         stdchar="unsigned char"
21196 else
21197         echo "Your stdio uses signed chars." >&4
21198         stdchar="char"
21199 fi
21200 $rm -f stdioh
21201
21202 : see what type uids are declared as in the kernel
21203 echo " "
21204 echo "Looking for the type for user ids returned by getuid()."
21205 set uid_t uidtype xxx stdio.h sys/types.h
21206 eval $typedef
21207 case "$uidtype" in
21208 xxx)
21209         xxx=`./findhdr sys/user.h`
21210         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21211         case $1 in
21212         unsigned) dflt="$1 $2" ;;
21213         *) dflt="$1" ;;
21214         esac
21215         ;;
21216 *) dflt="$uidtype";;
21217 esac
21218 case "$uidtype" in
21219 uid_t)  echo "uid_t found." ;;
21220 *)      rp="What is the type for user ids returned by getuid()?"
21221         . ./myread
21222         uidtype="$ans"
21223         ;;
21224 esac
21225
21226 : Check size of UID
21227 echo " "
21228 case "$uidtype" in
21229 *_t) zzz="$uidtype"     ;;
21230 *)   zzz="uid"          ;;
21231 esac
21232 echo "Checking the size of $zzz..." >&4
21233 cat > try.c <<EOCP
21234 #include <sys/types.h>
21235 #include <stdio.h>
21236 #$i_stdlib I_STDLIB
21237 #ifdef I_STDLIB
21238 #include <stdlib.h>
21239 #endif
21240 int main() {
21241     printf("%d\n", (int)sizeof($uidtype));
21242     exit(0);
21243 }
21244 EOCP
21245 set try
21246 if eval $compile_ok; then
21247         yyy=`$run ./try`
21248         case "$yyy" in
21249         '')     uidsize=4
21250                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21251                 ;;
21252         *)      uidsize=$yyy
21253                 echo "Your $zzz is $uidsize bytes long."
21254                 ;;
21255         esac
21256 else
21257         uidsize=4
21258         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21259 fi
21260
21261 : Check if UID is signed
21262 echo " "
21263 case "$uidtype" in
21264 *_t) zzz="$uidtype"     ;;
21265 *)   zzz="uid"          ;;
21266 esac
21267 echo "Checking the sign of $zzz..." >&4
21268 cat > try.c <<EOCP
21269 #include <sys/types.h>
21270 #include <stdio.h>
21271 int main() {
21272         $uidtype foo = -1;
21273         if (foo < 0)
21274                 printf("-1\n");
21275         else
21276                 printf("1\n");
21277 }
21278 EOCP
21279 set try
21280 if eval $compile; then
21281         yyy=`$run ./try`
21282         case "$yyy" in
21283         '')     uidsign=1
21284                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21285                 ;;
21286         *)      uidsign=$yyy
21287                 case "$uidsign" in
21288                  1) echo "Your $zzz is unsigned." ;;
21289                 -1) echo "Your $zzz is signed."   ;;
21290                 esac
21291                 ;;
21292         esac
21293 else
21294         uidsign=1
21295         echo "(I can't compile the test program--guessing unsigned.)" >&4
21296 fi
21297
21298
21299 : Check format string for UID
21300 echo " "
21301 $echo "Checking the format string to be used for uids..." >&4
21302
21303 case "$uidsign" in
21304 -1)     if $test X"$uidsize" = X"$ivsize"; then
21305                 uidformat="$ivdformat"
21306         else
21307                 if $test X"$uidsize" = X"$longsize"; then
21308                         uidformat='"ld"'
21309                 else
21310                         if $test X"$uidsize" = X"$intsize"; then
21311                                 uidformat='"d"'
21312                         else
21313                                 if $test X"$uidsize" = X"$shortsize"; then
21314                                         uidformat='"hd"'
21315                                 fi
21316                         fi
21317                 fi
21318         fi
21319         ;;
21320 *)      if $test X"$uidsize" = X"$uvsize"; then
21321                 uidformat="$uvuformat"
21322         else
21323                 if $test X"$uidsize" = X"$longsize"; then
21324                         uidformat='"lu"'
21325                 else
21326                         if $test X"$uidsize" = X"$intsize"; then
21327                                 uidformat='"u"'
21328                         else
21329                                 if $test X"$uidsize" = X"$shortsize"; then
21330                                         uidformat='"hu"'
21331                                 fi
21332                         fi
21333                 fi
21334         fi
21335         ;;
21336 esac
21337
21338 : Check if site customization support was requested
21339 case "$usesitecustomize" in
21340     $define|true|[Yy]*)
21341         usesitecustomize="$define"
21342         ;;
21343     *)
21344         usesitecustomize="$undef"
21345         ;;
21346     esac
21347
21348 : see if prototypes support variable argument declarations
21349 echo " "
21350 case "$prototype$i_stdarg" in
21351 $define$define)
21352         echo "It appears we'll be able to prototype varargs functions." >&4
21353         val="$define"
21354         ;;
21355 *)
21356         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21357         val="$undef"
21358         ;;
21359 esac
21360 set vaproto
21361 eval $setvar
21362
21363 : determine compiler compiler
21364 case "$yacc" in
21365 '')
21366         dflt=yacc;;
21367 *)
21368         dflt="$yacc";;
21369 esac
21370 echo " "
21371 comp='yacc'
21372 if $test -f "$byacc$_exe"; then
21373         dflt="$byacc"
21374         comp="byacc or $comp"
21375 fi
21376 if $test -f "$bison$_exe"; then
21377         comp="$comp or bison -y"
21378 fi
21379 rp="Which compiler compiler ($comp) shall I use?"
21380 . ./myread
21381 yacc="$ans"
21382 case "$yacc" in
21383 *bis*)
21384         case "$yacc" in
21385         *-y*) ;;
21386         *)
21387                 yacc="$yacc -y"
21388                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21389                 ;;
21390         esac
21391         ;;
21392 esac
21393
21394 : see if this is a assert.h system
21395 set assert.h i_assert
21396 eval $inhdr
21397
21398 : see if this is a fp.h system
21399 set fp.h i_fp
21400 eval $inhdr
21401
21402 : see if this is a fp_class.h system
21403 set fp_class.h i_fp_class
21404 eval $inhdr
21405
21406 : see if gdbm.h is available
21407 set gdbm.h t_gdbm
21408 eval $inhdr
21409 case "$t_gdbm" in
21410 $define)
21411         : see if gdbm_open exists
21412         set gdbm_open d_gdbm_open
21413         eval $inlibc
21414         case "$d_gdbm_open" in
21415         $undef)
21416                 t_gdbm="$undef"
21417                 echo "We won't be including <gdbm.h>"
21418                 ;;
21419         esac
21420         ;;
21421 esac
21422 val="$t_gdbm"
21423 set i_gdbm
21424 eval $setvar
21425
21426 : see if this is a ieeefp.h system
21427 case "$i_ieeefp" in
21428 '' ) set ieeefp.h i_ieeefp
21429      eval $inhdr
21430      ;;
21431 esac
21432
21433 : see if this is a libutil.h system
21434 set libutil.h i_libutil
21435 eval $inhdr
21436
21437 : see if mach cthreads are available
21438 if test "X$usethreads" = "X$define"; then
21439         set mach/cthreads.h i_machcthr
21440         eval $inhdr
21441 else
21442         i_machcthr="$undef"
21443 fi
21444
21445 : see if this is a mntent.h system
21446 set mntent.h i_mntent
21447 eval $inhdr
21448
21449 : see if net/errno.h is available
21450 val=''
21451 set net/errno.h val
21452 eval $inhdr
21453
21454 : Unfortunately, it causes problems on some systems.  Arrgh.
21455 case "$val" in
21456 $define)
21457         cat > try.c <<'EOM'
21458 #include <stdio.h>
21459 #include <errno.h>
21460 #include <net/errno.h>
21461 int func()
21462 {
21463         return ENOTSOCK;
21464 }
21465 EOM
21466         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21467                 echo "We'll be including <net/errno.h>." >&4
21468         else
21469                 echo "We won't be including <net/errno.h>." >&4
21470                 val="$undef"
21471         fi
21472         $rm_try
21473         ;;
21474 esac
21475 set i_neterrno
21476 eval $setvar
21477
21478 : see if netinet/tcp.h is available
21479 set netinet/tcp.h i_netinettcp
21480 eval $inhdr
21481
21482 : see if this is a poll.h system
21483 set poll.h i_poll
21484 eval $inhdr
21485
21486 : see if this is a prot.h system
21487 set prot.h i_prot
21488 eval $inhdr
21489
21490 : Preprocessor symbols
21491 echo " "
21492 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21493 $cat <<'EOSH' > Cppsym.know
21494 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21495 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21496 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21497 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21498 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21499 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21500 bull c cadmus clipper CMU COFF COMPILER_VERSION
21501 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21502 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21503 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21504 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21505 GLIBC GLIBC_MINOR
21506 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21507 H3050R H3050RX hbullx20 hcx host_mips
21508 hp200 hp300 hp700 HP700 hp800 hp9000
21509 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21510 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21511 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21512 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21513 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21514 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21515 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21516 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21517 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21518 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21519 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21520 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21521 MATH_HAS_NO_SIDE_EFFECTS
21522 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21523 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21524 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21525 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21526 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21527 NetBSD news1500 news1700 news1800 news1900 news3700
21528 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21529 ns32016 ns32332 ns32k nsc32000
21530 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21531 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21532 pc532 pdp11 PGC PIC plexus PORTAR posix
21533 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21534 POSIX_C_SOURCE POSIX_SOURCE POWER
21535 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21536 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21537 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21538 sony sony_news sonyrisc sparc sparclite spectrum
21539 stardent stdc STDC_EXT stratos sun sun3 sun386
21540 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21541 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21542 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21543 sysV68 sysV88 Tek4132 Tek4300 titan
21544 TM3200 TM5400 TM5600
21545 tower tower32 tower32_200 tower32_600 tower32_700
21546 tower32_800 tower32_850 tss
21547 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21548 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21549 unix UNIX95 UNIX99 unixpc unos
21550 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21551 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21552 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21553 USGr4 USGr4_2
21554 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21555 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21556 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21557 z8000
21558 EOSH
21559 # Maybe put other stuff here too.
21560 cat <<EOSH >>Cppsym.know
21561 $osname
21562 EOSH
21563 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21564 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21565 $cat Cppsym.know > Cppsym.c
21566 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21567 $rm -f Cppsym.a Cppsym.b Cppsym.c
21568 cat <<EOSH > Cppsym
21569 $startsh
21570 if $test \$# -gt 0; then
21571     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21572     if $test -s Cppsym.got; then
21573         $rm -f Cppsym.got
21574         exit 0
21575     fi
21576     $rm -f Cppsym.got
21577     exit 1
21578 else
21579     $tr " " "$trnl" | ./Cppsym.try
21580     exit 0
21581 fi
21582 EOSH
21583 chmod +x Cppsym
21584 $eunicefix Cppsym
21585 cat <<EOSH > Cppsym.try
21586 $startsh
21587 cat <<'EOCP' > try.c
21588 #include <stdio.h>
21589 #if cpp_stuff == 1
21590 #define STRINGIFY(a)    "a"
21591 #endif
21592 #if cpp_stuff == 42
21593 #define StGiFy(a)  #a
21594 #define STRINGIFY(a)    StGiFy(a)
21595 #endif
21596 #if $cpp_stuff != 1 && $cpp_stuff != 42
21597 #   include "Bletch: How does this C preprocessor stringify macros?"
21598 #endif
21599 int main() {
21600 EOCP
21601 $awk \\
21602 EOSH
21603 cat <<'EOSH' >> Cppsym.try
21604 'length($1) > 0 {
21605     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21606     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21607     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21608     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21609 }'       >> try.c
21610 echo 'return 0;}' >> try.c
21611 EOSH
21612 cat <<EOSH >> Cppsym.try
21613 ccflags="$ccflags"
21614 case "$osname-$gccversion" in
21615 irix-) ccflags="\$ccflags -woff 1178" ;;
21616 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21617 esac
21618 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21619 EOSH
21620 chmod +x Cppsym.try
21621 $eunicefix Cppsym.try
21622 ./Cppsym < Cppsym.know > Cppsym.true
21623 : Add in any linux cpp "predefined macros":
21624 case "$osname::$gccversion" in
21625   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
21626     tHdrH=_tmpHdr
21627     rm -f $tHdrH'.h' $tHdrH
21628     touch $tHdrH'.h'
21629     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21630        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21631        if [ -s $tHdrH'_cppsym.real' ]; then
21632           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21633        fi
21634     fi
21635     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21636   ;;
21637 esac
21638 : now check the C compiler for additional symbols
21639 postprocess_cc_v=''
21640 case "$osname" in
21641 aix) postprocess_cc_v="|$tr , ' '" ;;
21642 esac
21643 $cat >ccsym <<EOS
21644 $startsh
21645 $cat >tmp.c <<EOF
21646 extern int foo;
21647 EOF
21648 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21649 do
21650         case "\$i" in
21651         -D*) echo "\$i" | $sed 's/^-D//';;
21652         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21653         esac
21654 done
21655 $rm_try
21656 EOS
21657 postprocess_cc_v=''
21658 chmod +x ccsym
21659 $eunicefix ccsym
21660 ./ccsym > ccsym1.raw
21661 if $test -s ccsym1.raw; then
21662        $sort ccsym1.raw | $uniq >ccsym.raw
21663 else
21664        mv ccsym1.raw ccsym.raw
21665 fi
21666
21667 $awk '/\=/ { print $0; next }
21668         { print $0"=1" }' ccsym.raw >ccsym.list
21669 $comm -13 Cppsym.true ccsym.list >ccsym.own
21670 $comm -12 Cppsym.true ccsym.list >ccsym.com
21671 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21672 also=''
21673 if $test -z ccsym.raw; then
21674         echo "Your C compiler doesn't seem to define any symbols!" >&4
21675         echo " "
21676         echo "However, your C preprocessor defines the following symbols:"
21677         $cat Cppsym.true
21678         ccsymbols=''
21679         cppsymbols=`$cat Cppsym.true`
21680         cppsymbols=`echo $cppsymbols`
21681         cppccsymbols="$cppsymbols"
21682 else
21683         if $test -s ccsym.com; then
21684                 echo "Your C compiler and pre-processor define these symbols:"
21685                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21686                 also='also '
21687                 symbols='ones'
21688                 cppccsymbols=`$cat ccsym.com`
21689                 cppccsymbols=`echo $cppccsymbols`
21690                 $test "$silent" || sleep 1
21691         fi
21692         if $test -s ccsym.cpp; then
21693                 $test "$also" && echo " "
21694                 echo "Your C pre-processor ${also}defines the following symbols:"
21695                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21696                 also='further '
21697                 cppsymbols=`$cat ccsym.cpp`
21698                 cppsymbols=`echo $cppsymbols`
21699                 $test "$silent" || sleep 1
21700         fi
21701         if $test -s ccsym.own; then
21702                 $test "$also" && echo " "
21703                 echo "Your C compiler ${also}defines the following cpp symbols:"
21704                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21705                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21706                 ccsymbols=`$cat ccsym.own`
21707                 ccsymbols=`echo $ccsymbols`
21708                 $test "$silent" || sleep 1
21709         fi
21710 fi
21711
21712 : see if this is a termio system
21713 val="$undef"
21714 val2="$undef"
21715 val3="$undef"
21716 if $test `./findhdr termios.h`; then
21717         set tcsetattr i_termios
21718         eval $inlibc
21719         val3="$i_termios"
21720 fi
21721 echo " "
21722 case "$val3" in
21723 "$define") echo "You have POSIX termios.h... good!" >&4;;
21724 *) if ./Cppsym pyr; then
21725                 case "`/bin/universe`" in
21726                 ucb) if $test `./findhdr sgtty.h`; then
21727                                 val2="$define"
21728                                 echo "<sgtty.h> found." >&4
21729                         else
21730                                 echo "System is pyramid with BSD universe."
21731                                 ./warn "<sgtty.h> not found--you could have problems."
21732                         fi;;
21733                 *) if $test `./findhdr termio.h`; then
21734                                 val="$define"
21735                                 echo "<termio.h> found." >&4
21736                         else
21737                                 echo "System is pyramid with USG universe."
21738                                 ./warn "<termio.h> not found--you could have problems."
21739                         fi;;
21740                 esac
21741         elif ./usg; then
21742                 if $test `./findhdr termio.h`; then
21743                         echo "<termio.h> found." >&4
21744                         val="$define"
21745                 elif $test `./findhdr sgtty.h`; then
21746                         echo "<sgtty.h> found." >&4
21747                         val2="$define"
21748                 else
21749                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21750                 fi
21751         else
21752                 if $test `./findhdr sgtty.h`; then
21753                         echo "<sgtty.h> found." >&4
21754                         val2="$define"
21755                 elif $test `./findhdr termio.h`; then
21756                         echo "<termio.h> found." >&4
21757                         val="$define"
21758                 else
21759                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21760                 fi
21761         fi;;
21762 esac
21763 set i_termio; eval $setvar
21764 val=$val2; set i_sgtty; eval $setvar
21765 val=$val3; set i_termios; eval $setvar
21766
21767 : see if stddef is available
21768 set stddef.h i_stddef
21769 eval $inhdr
21770
21771 : see if sys/access.h is available
21772 set sys/access.h i_sysaccess
21773 eval $inhdr
21774
21775 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21776 set sys/filio.h i_sysfilio
21777 eval $inhdr
21778 echo " "
21779 if $test `./findhdr sys/ioctl.h`; then
21780         val="$define"
21781         echo '<sys/ioctl.h> found.' >&4
21782 else
21783         val="$undef"
21784         if $test $i_sysfilio = "$define"; then
21785             echo '<sys/ioctl.h> NOT found.' >&4
21786         else
21787                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21788                 $test $i_termio = "$define" && xxx="termio.h"
21789                 $test $i_termios = "$define" && xxx="termios.h"
21790 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21791         fi
21792 fi
21793 set i_sysioctl
21794 eval $setvar
21795
21796 : see if socket ioctl defs are in sys/sockio.h
21797 echo " "
21798 xxx=`./findhdr sys/sockio.h`
21799 if $test "$xxx"; then
21800         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21801                 val="$define"
21802                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21803         else
21804                 val="$undef"
21805                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21806         fi
21807 else
21808         val="$undef"
21809         $cat <<EOM
21810 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21811 EOM
21812 fi
21813 set i_syssockio
21814 eval $setvar
21815
21816 : see if this is a syslog.h system
21817 set syslog.h i_syslog
21818 eval $inhdr
21819
21820 : see if this is a sys/mode.h system
21821 set sys/mode.h i_sysmode
21822 eval $inhdr
21823
21824 : see if there is a sys/poll.h file
21825 set sys/poll.h i_syspoll
21826 eval $inhdr
21827
21828 : see if sys/resource.h has to be included
21829 set sys/resource.h i_sysresrc
21830 eval $inhdr
21831
21832 : see if sys/security.h is available
21833 set sys/security.h i_syssecrt
21834 eval $inhdr
21835
21836 : see if this is a sys/statvfs.h system
21837 set sys/statvfs.h i_sysstatvfs
21838 eval $inhdr
21839
21840 : see if this is a sys/un.h system
21841 set sys/un.h i_sysun
21842 eval $inhdr
21843
21844 : see if this is a sys/utsname.h system
21845 set sys/utsname.h i_sysutsname
21846 eval $inhdr
21847
21848 : see if this is a syswait system
21849 set sys/wait.h i_syswait
21850 eval $inhdr
21851
21852 : see if this is a ustat.h system
21853 set ustat.h i_ustat
21854 eval $inhdr
21855
21856 : see if this is an utime system
21857 set utime.h i_utime
21858 eval $inhdr
21859
21860 : see if this is a vfork system
21861 case "$d_vfork" in
21862 "$define")
21863         set vfork.h i_vfork
21864         eval $inhdr
21865         ;;
21866 *)
21867         i_vfork="$undef"
21868         ;;
21869 esac
21870
21871 : Check extensions
21872 echo " "
21873 echo "Looking for extensions..." >&4
21874 : If we are using the old config.sh, known_extensions may contain
21875 : old or inaccurate or duplicate values.
21876 known_extensions=''
21877 nonxs_extensions=''
21878 : We do not use find because it might not be available.
21879 : We do not just use MANIFEST because the user may have dropped
21880 : some additional extensions into the source tree and expect them
21881 : to be built.
21882
21883 : Function to recursively find available extensions, ignoring DynaLoader
21884 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21885 : In 5.10.1 and later, extensions are stored in directories
21886 : like File-Glob instead of the older File/Glob/.
21887 find_extensions='
21888     for xxx in *; do
21889         case "$xxx" in
21890             DynaLoader|dynaload) ;;
21891             *)
21892             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
21893             leaf=`echo $xxx | $sed -e s/.*-//`;
21894             if $test -d File; then
21895                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
21896                     known_extensions="$known_extensions $1$this_ext";
21897                 elif $test -f $xxx/Makefile.PL; then
21898                     nonxs_extensions="$nonxs_extensions $1$this_ext";
21899                 else
21900                     if $test -d $xxx -a $# -lt 10; then
21901                         set $1$xxx/ $*;
21902                         cd "$xxx";
21903                         eval $find_extensions;
21904                         cd ..;
21905                         shift;
21906                     fi;
21907                 fi;
21908             else
21909                 $ls -1 $xxx > $$.tmp;
21910                 if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
21911                     known_extensions="$known_extensions $this_ext";
21912                 elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
21913                     known_extensions="$known_extensions $this_ext";
21914                 elif $test -d $xxx; then
21915                     nonxs_extensions="$nonxs_extensions $this_ext";
21916                 fi;
21917                 $rm -f $$.tmp;
21918             fi
21919             ;;
21920         esac;
21921     done'
21922 tdir=`pwd`
21923 cd "$rsrc/cpan"
21924 set X
21925 shift
21926 eval $find_extensions
21927 cd "$rsrc/dist"
21928 set X
21929 shift
21930 eval $find_extensions
21931 cd "$rsrc/ext"
21932 set X
21933 shift
21934 eval $find_extensions
21935 if $test -d File-Glob; then
21936     : All ext/ flattened
21937 else
21938     # Special case:  Add in modules that nest beyond the first level.
21939     # Currently threads/shared and Hash/Util/FieldHash, since they are
21940     # not picked up by the recursive find above (and adding in general
21941     # recursive finding breaks SDBM_File/sdbm).
21942     # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21943     known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21944 fi
21945 set X $known_extensions
21946 shift
21947 known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
21948 set X $nonxs_extensions
21949 shift
21950 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
21951 cd "$tdir"
21952
21953 : Now see which are supported on this system.
21954 avail_ext=''
21955 for xxx in $known_extensions ; do
21956         case "$xxx" in
21957         DB_File|db_file)
21958                 case "$i_db" in
21959                 $define) avail_ext="$avail_ext $xxx" ;;
21960                 esac
21961                 ;;
21962         GDBM_File|gdbm_fil)
21963                 case "$i_gdbm" in
21964                 $define) avail_ext="$avail_ext $xxx" ;;
21965                 esac
21966                 ;;
21967         I18N/Langinfo|i18n_lan)
21968                 case "$i_langinfo$d_nl_langinfo" in
21969                 $define$define) avail_ext="$avail_ext $xxx" ;;
21970                 esac
21971                 ;;
21972         IPC/SysV|ipc/sysv)
21973                 : XXX Do we need a useipcsysv variable here
21974                 case "${d_msg}${d_sem}${d_shm}" in
21975                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21976                 esac
21977                 ;;
21978         NDBM_File|ndbm_fil)
21979                 case "$d_ndbm" in
21980                 $define)
21981                     case "$osname-$use64bitint" in
21982                     hpux-define)
21983                         case "$libs" in
21984                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21985                         esac
21986                         ;;
21987                     *) avail_ext="$avail_ext $xxx" ;;
21988                     esac
21989                     ;;
21990                 esac
21991                 ;;
21992         ODBM_File|odbm_fil)
21993                 case "${i_dbm}${i_rpcsvcdbm}" in
21994                 *"${define}"*)
21995                     case "$d_cplusplus" in
21996                     define) ;; # delete as a function name will not work
21997                     *)  case "$osname-$use64bitint" in
21998                         hpux-define)
21999                             case "$libs" in
22000                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22001                             esac
22002                             ;;
22003                         *) avail_ext="$avail_ext $xxx" ;;
22004                         esac
22005                         ;;
22006                     esac
22007                     ;;
22008                 esac
22009                 ;;
22010         Opcode|opcode)
22011                 case "$useopcode" in
22012                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22013                 esac
22014                 ;;
22015         POSIX|posix)
22016                 case "$useposix" in
22017                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22018                 esac
22019                 ;;
22020         Socket|socket)
22021                 case "$d_socket" in
22022                 true|$define|y)
22023                     case "$osname" in
22024                     beos) ;; # not unless BONE
22025                     *) avail_ext="$avail_ext $xxx" ;;
22026                     esac
22027                     ;;
22028                 esac
22029                 ;;
22030         Sys/Syslog|sys/syslog)
22031                 : XXX syslog requires socket
22032                 case "$d_socket" in
22033                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22034                 esac
22035                 ;;
22036         Thread|thread)
22037                 case "$usethreads" in
22038                 true|$define|y)
22039                         case "$use5005threads" in
22040                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22041                         esac
22042                 esac
22043                 ;;
22044         threads|threads/shared)
22045                 # threads and threads::shared are special cases.
22046                 # To stop people from asking "Perl 5.8.0 was supposed
22047                 # to have this new fancy threads implementation but my
22048                 # perl doesn't have it" and from people trying to
22049                 # (re)install the threads module using CPAN.pm and
22050                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22051                 # the threads.pm and threads/shared.pm will always be
22052                 # there, croaking informatively ("you need to rebuild
22053                 # all of Perl with threads, sorry") when threads haven't
22054                 # been compiled in.
22055                 # --jhi
22056                 avail_ext="$avail_ext $xxx"
22057                 ;;
22058         VMS*)
22059                 ;;
22060         Win32*)
22061                 case "$osname" in
22062                 cygwin) avail_ext="$avail_ext $xxx" ;;
22063                 esac
22064                 ;;
22065         XS/APItest|xs/apitest)
22066                 # This is just for testing.  Skip it unless we have dynamic loading.
22067
22068                 case "$usedl" in
22069                 $define) avail_ext="$avail_ext $xxx" ;;
22070                 esac
22071                 ;;
22072         XS/Typemap|xs/typemap)
22073                 # This is just for testing.  Skip it unless we have dynamic loading.
22074                 case "$usedl" in
22075                 $define) avail_ext="$avail_ext $xxx" ;;
22076                 esac
22077                 ;;
22078         *)      avail_ext="$avail_ext $xxx"
22079                 ;;
22080         esac
22081 done
22082
22083 set X $avail_ext
22084 shift
22085 avail_ext="$*"
22086
22087 case "$onlyextensions" in
22088 '') ;;
22089 *)  keepextensions=''
22090     echo "You have requested that only certain extensions be included..." >&4
22091     for i in $onlyextensions; do
22092         case " $avail_ext " in
22093         *" $i "*)
22094             echo "Keeping extension $i."
22095             keepextensions="$keepextensions $i"
22096             ;;
22097         *) echo "Ignoring extension $i." ;;
22098         esac
22099     done
22100     avail_ext="$keepextensions"
22101     ;;
22102 esac
22103
22104 case "$noextensions" in
22105 '') ;;
22106 *)  keepextensions=''
22107     echo "You have requested that certain extensions be ignored..." >&4
22108     for i in $avail_ext; do
22109         case " $noextensions " in
22110         *" $i "*) echo "Ignoring extension $i." ;;
22111         *) echo "Keeping extension $i.";
22112            keepextensions="$keepextensions $i"
22113            ;;
22114         esac
22115     done
22116     avail_ext="$keepextensions"
22117     ;;
22118 esac
22119
22120 : Now see which nonxs extensions are supported on this system.
22121 : For now assume all are.
22122 nonxs_ext=''
22123 for xxx in $nonxs_extensions ; do
22124         case "$xxx" in
22125         *)      nonxs_ext="$nonxs_ext $xxx"
22126                 ;;
22127         esac
22128 done
22129
22130 set X $nonxs_ext
22131 shift
22132 nonxs_ext="$*"
22133
22134 case $usedl in
22135 $define)
22136         $cat <<EOM
22137 A number of extensions are supplied with $package.  You may choose to
22138 compile these extensions for dynamic loading (the default), compile
22139 them into the $package executable (static loading), or not include
22140 them at all.  Answer "none" to include no extensions.
22141 Note that DynaLoader is always built and need not be mentioned here.
22142
22143 EOM
22144         case "$dynamic_ext" in
22145         '')
22146                 : Exclude those listed in static_ext
22147                 dflt=''
22148                 for xxx in $avail_ext; do
22149                         case " $static_ext " in
22150                         *" $xxx "*) ;;
22151                         *) dflt="$dflt $xxx" ;;
22152                         esac
22153                 done
22154                 set X $dflt
22155                 shift
22156                 dflt="$*"
22157                 ;;
22158         *)      dflt="$dynamic_ext"
22159                 # Perhaps we are reusing an old out-of-date config.sh.
22160                 case "$hint" in
22161                 previous)
22162                         if test X"$dynamic_ext" != X"$avail_ext"; then
22163                                 $cat <<EOM
22164 NOTICE:  Your previous config.sh list may be incorrect.
22165 The extensions now available to you are
22166         ${avail_ext}
22167 but the default list from your previous config.sh is
22168         ${dynamic_ext}
22169
22170 EOM
22171                         fi
22172                         ;;
22173                 esac
22174                 ;;
22175         esac
22176         case "$dflt" in
22177         '')     dflt=none;;
22178         esac
22179         rp="What extensions do you wish to load dynamically?"
22180         . ./myread
22181         case "$ans" in
22182         none) dynamic_ext=' ' ;;
22183         *) dynamic_ext="$ans" ;;
22184         esac
22185
22186         case "$static_ext" in
22187         '')
22188                 : Exclude those already listed in dynamic linking
22189                 dflt=''
22190                 for xxx in $avail_ext; do
22191                         case " $dynamic_ext " in
22192                         *" $xxx "*) ;;
22193                         *) dflt="$dflt $xxx" ;;
22194                         esac
22195                 done
22196                 set X $dflt
22197                 shift
22198                 dflt="$*"
22199                 ;;
22200         *)  dflt="$static_ext"
22201                 ;;
22202         esac
22203
22204         case "$dflt" in
22205         '')     dflt=none;;
22206         esac
22207         rp="What extensions do you wish to load statically?"
22208         . ./myread
22209         case "$ans" in
22210         none) static_ext=' ' ;;
22211         *) static_ext="$ans" ;;
22212         esac
22213         ;;
22214 *)
22215         $cat <<EOM
22216 A number of extensions are supplied with $package.  Answer "none"
22217 to include no extensions.
22218 Note that DynaLoader is always built and need not be mentioned here.
22219
22220 EOM
22221         case "$static_ext" in
22222         '') dflt="$avail_ext" ;;
22223         *)      dflt="$static_ext"
22224                 # Perhaps we are reusing an old out-of-date config.sh.
22225                 case "$hint" in
22226                 previous)
22227                         if test X"$static_ext" != X"$avail_ext"; then
22228                                 $cat <<EOM
22229 NOTICE:  Your previous config.sh list may be incorrect.
22230 The extensions now available to you are
22231         ${avail_ext}
22232 but the default list from your previous config.sh is
22233         ${static_ext}
22234
22235 EOM
22236                         fi
22237                         ;;
22238                 esac
22239                 ;;
22240         esac
22241         : Exclude those that are not xs extensions
22242         case "$dflt" in
22243         '')     dflt=none;;
22244         esac
22245         rp="What extensions do you wish to include?"
22246         . ./myread
22247         case "$ans" in
22248         none) static_ext=' ' ;;
22249         *) static_ext="$ans" ;;
22250         esac
22251         ;;
22252 esac
22253 #
22254 # Encode is a special case.  If we are building Encode as a static
22255 # extension, we need to explicitly list its subextensions as well.
22256 # For other nested extensions, this is handled automatically by
22257 # the appropriate Makefile.PL.
22258 case " $static_ext " in
22259         *" Encode "*) # Add the subextensions of Encode
22260         cd "$rsrc/cpan"
22261         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22262                 static_ext="$static_ext Encode/$xxx"
22263         done
22264         cd "$tdir"
22265         ;;
22266 esac
22267
22268 set X $dynamic_ext $static_ext $nonxs_ext
22269 shift
22270 extensions="$*"
22271
22272 # Sanity check:  We require an extension suitable for use with
22273 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22274 # should show up as failures in the test suite, but it's helpful to
22275 # catch them now.) The 'extensions' list is normally sorted
22276 # alphabetically, so we need to accept either
22277 #    DB_File ... Fcntl ... IO  ....
22278 # or something like
22279 #    Fcntl ... NDBM_File ... IO  ....
22280 case " $extensions"  in
22281 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22282 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22283 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22284 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22285    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22286    ;;
22287 esac
22288
22289 : Remove libraries needed only for extensions
22290 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22291 : The exception is SunOS 4.x, which needs them.
22292 case "${osname}X${osvers}" in
22293 sunos*X4*)
22294     perllibs="$libs"
22295     ;;
22296 *) case "$usedl" in
22297     $define|true|[yY]*)
22298             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
22299             shift
22300             perllibs="$*"
22301             ;;
22302     *)  perllibs="$libs"
22303             ;;
22304     esac
22305     ;;
22306 esac
22307
22308 : Remove build directory name from cppstdin so it can be used from
22309 : either the present location or the final installed location.
22310 echo " "
22311 : Get out of the UU directory to get correct path name.
22312 cd ..
22313 case "$cppstdin" in
22314 `pwd`/cppstdin)
22315         echo "Stripping down cppstdin path name"
22316         cppstdin=cppstdin
22317         ;;
22318 esac
22319 cd UU
22320
22321 : end of configuration questions
22322 echo " "
22323 echo "End of configuration questions."
22324 echo " "
22325
22326 : back to where it started
22327 if test -d ../UU; then
22328         cd ..
22329 fi
22330
22331 : configuration may be unconditionally patched via a 'config.arch' file
22332 if $test -f config.arch; then
22333         echo "I see a config.arch file, loading it." >&4
22334         . ./config.arch
22335 fi
22336
22337 : configuration may be patched via a 'config.over' file
22338 if $test -f config.over; then
22339         echo " "
22340         dflt=y
22341         rp='I see a config.over file.  Do you wish to load it?'
22342         . UU/myread
22343         case "$ans" in
22344         n*) echo "OK, I'll ignore it.";;
22345         *)      . ./config.over
22346                 echo "Configuration override changes have been loaded."
22347                 ;;
22348         esac
22349 fi
22350
22351 : in case they want portability, strip down executable paths
22352 case "$d_portable" in
22353 "$define")
22354         echo " "
22355         echo "Stripping down executable paths..." >&4
22356         for file in $loclist $trylist; do
22357                 eval temp=\$$file
22358                 eval $file=`basename $temp`
22359         done
22360         ;;
22361 esac
22362
22363 : create config.sh file
22364 echo " "
22365 echo "Creating config.sh..." >&4
22366 $spitshell <<EOT >config.sh
22367 $startsh
22368 #
22369 # This file was produced by running the Configure script. It holds all the
22370 # definitions figured out by Configure. Should you modify one of these values,
22371 # do not forget to propagate your changes by running "Configure -der". You may
22372 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22373 #
22374
22375 # Package name      : $package
22376 # Source directory  : $src
22377 # Configuration time: $cf_time
22378 # Configured by     : $cf_by
22379 # Target system     : $myuname
22380
22381 EOT
22382 : Add in command line options if available
22383 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22384
22385 $spitshell <<EOT >>config.sh
22386
22387 Author='$Author'
22388 Date='$Date'
22389 Header='$Header'
22390 Id='$Id'
22391 Locker='$Locker'
22392 Log='$Log'
22393 RCSfile='$RCSfile'
22394 Revision='$Revision'
22395 Source='$Source'
22396 State='$State'
22397 _a='$_a'
22398 _exe='$_exe'
22399 _o='$_o'
22400 afs='$afs'
22401 afsroot='$afsroot'
22402 alignbytes='$alignbytes'
22403 ansi2knr='$ansi2knr'
22404 aphostname='$aphostname'
22405 api_revision='$api_revision'
22406 api_subversion='$api_subversion'
22407 api_version='$api_version'
22408 api_versionstring='$api_versionstring'
22409 ar='$ar'
22410 archlib='$archlib'
22411 archlibexp='$archlibexp'
22412 archname64='$archname64'
22413 archname='$archname'
22414 archobjs='$archobjs'
22415 asctime_r_proto='$asctime_r_proto'
22416 awk='$awk'
22417 baserev='$baserev'
22418 bash='$bash'
22419 bin='$bin'
22420 bin_ELF='$bin_ELF'
22421 binexp='$binexp'
22422 bison='$bison'
22423 byacc='$byacc'
22424 byteorder='$byteorder'
22425 c='$c'
22426 castflags='$castflags'
22427 cat='$cat'
22428 cc='$cc'
22429 cccdlflags='$cccdlflags'
22430 ccdlflags='$ccdlflags'
22431 ccflags='$ccflags'
22432 ccflags_uselargefiles='$ccflags_uselargefiles'
22433 ccname='$ccname'
22434 ccsymbols='$ccsymbols'
22435 ccversion='$ccversion'
22436 cf_by='$cf_by'
22437 cf_email='$cf_email'
22438 cf_time='$cf_time'
22439 charbits='$charbits'
22440 charsize='$charsize'
22441 chgrp='$chgrp'
22442 chmod='$chmod'
22443 chown='$chown'
22444 clocktype='$clocktype'
22445 comm='$comm'
22446 compress='$compress'
22447 contains='$contains'
22448 cp='$cp'
22449 cpio='$cpio'
22450 cpp='$cpp'
22451 cpp_stuff='$cpp_stuff'
22452 cppccsymbols='$cppccsymbols'
22453 cppflags='$cppflags'
22454 cpplast='$cpplast'
22455 cppminus='$cppminus'
22456 cpprun='$cpprun'
22457 cppstdin='$cppstdin'
22458 cppsymbols='$cppsymbols'
22459 crypt_r_proto='$crypt_r_proto'
22460 cryptlib='$cryptlib'
22461 csh='$csh'
22462 ctermid_r_proto='$ctermid_r_proto'
22463 ctime_r_proto='$ctime_r_proto'
22464 d_Gconvert='$d_Gconvert'
22465 d_PRIEUldbl='$d_PRIEUldbl'
22466 d_PRIFUldbl='$d_PRIFUldbl'
22467 d_PRIGUldbl='$d_PRIGUldbl'
22468 d_PRIXU64='$d_PRIXU64'
22469 d_PRId64='$d_PRId64'
22470 d_PRIeldbl='$d_PRIeldbl'
22471 d_PRIfldbl='$d_PRIfldbl'
22472 d_PRIgldbl='$d_PRIgldbl'
22473 d_PRIi64='$d_PRIi64'
22474 d_PRIo64='$d_PRIo64'
22475 d_PRIu64='$d_PRIu64'
22476 d_PRIx64='$d_PRIx64'
22477 d_SCNfldbl='$d_SCNfldbl'
22478 d__fwalk='$d__fwalk'
22479 d_access='$d_access'
22480 d_accessx='$d_accessx'
22481 d_aintl='$d_aintl'
22482 d_alarm='$d_alarm'
22483 d_archlib='$d_archlib'
22484 d_asctime64='$d_asctime64'
22485 d_asctime_r='$d_asctime_r'
22486 d_atolf='$d_atolf'
22487 d_atoll='$d_atoll'
22488 d_attribute_deprecated='$d_attribute_deprecated'
22489 d_attribute_format='$d_attribute_format'
22490 d_attribute_malloc='$d_attribute_malloc'
22491 d_attribute_nonnull='$d_attribute_nonnull'
22492 d_attribute_noreturn='$d_attribute_noreturn'
22493 d_attribute_pure='$d_attribute_pure'
22494 d_attribute_unused='$d_attribute_unused'
22495 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22496 d_bcmp='$d_bcmp'
22497 d_bcopy='$d_bcopy'
22498 d_bsd='$d_bsd'
22499 d_bsdgetpgrp='$d_bsdgetpgrp'
22500 d_bsdsetpgrp='$d_bsdsetpgrp'
22501 d_builtin_choose_expr='$d_builtin_choose_expr'
22502 d_builtin_expect='$d_builtin_expect'
22503 d_bzero='$d_bzero'
22504 d_c99_variadic_macros='$d_c99_variadic_macros'
22505 d_casti32='$d_casti32'
22506 d_castneg='$d_castneg'
22507 d_charvspr='$d_charvspr'
22508 d_chown='$d_chown'
22509 d_chroot='$d_chroot'
22510 d_chsize='$d_chsize'
22511 d_class='$d_class'
22512 d_clearenv='$d_clearenv'
22513 d_closedir='$d_closedir'
22514 d_cmsghdr_s='$d_cmsghdr_s'
22515 d_const='$d_const'
22516 d_copysignl='$d_copysignl'
22517 d_cplusplus='$d_cplusplus'
22518 d_crypt='$d_crypt'
22519 d_crypt_r='$d_crypt_r'
22520 d_csh='$d_csh'
22521 d_ctermid='$d_ctermid'
22522 d_ctermid_r='$d_ctermid_r'
22523 d_ctime64='$d_ctime64'
22524 d_ctime_r='$d_ctime_r'
22525 d_cuserid='$d_cuserid'
22526 d_dbl_dig='$d_dbl_dig'
22527 d_dbminitproto='$d_dbminitproto'
22528 d_difftime64='$d_difftime64'
22529 d_difftime='$d_difftime'
22530 d_dir_dd_fd='$d_dir_dd_fd'
22531 d_dirfd='$d_dirfd'
22532 d_dirnamlen='$d_dirnamlen'
22533 d_dlerror='$d_dlerror'
22534 d_dlopen='$d_dlopen'
22535 d_dlsymun='$d_dlsymun'
22536 d_dosuid='$d_dosuid'
22537 d_drand48_r='$d_drand48_r'
22538 d_drand48proto='$d_drand48proto'
22539 d_dup2='$d_dup2'
22540 d_eaccess='$d_eaccess'
22541 d_endgrent='$d_endgrent'
22542 d_endgrent_r='$d_endgrent_r'
22543 d_endhent='$d_endhent'
22544 d_endhostent_r='$d_endhostent_r'
22545 d_endnent='$d_endnent'
22546 d_endnetent_r='$d_endnetent_r'
22547 d_endpent='$d_endpent'
22548 d_endprotoent_r='$d_endprotoent_r'
22549 d_endpwent='$d_endpwent'
22550 d_endpwent_r='$d_endpwent_r'
22551 d_endsent='$d_endsent'
22552 d_endservent_r='$d_endservent_r'
22553 d_eofnblk='$d_eofnblk'
22554 d_eunice='$d_eunice'
22555 d_faststdio='$d_faststdio'
22556 d_fchdir='$d_fchdir'
22557 d_fchmod='$d_fchmod'
22558 d_fchown='$d_fchown'
22559 d_fcntl='$d_fcntl'
22560 d_fcntl_can_lock='$d_fcntl_can_lock'
22561 d_fd_macros='$d_fd_macros'
22562 d_fd_set='$d_fd_set'
22563 d_fds_bits='$d_fds_bits'
22564 d_fgetpos='$d_fgetpos'
22565 d_finite='$d_finite'
22566 d_finitel='$d_finitel'
22567 d_flexfnam='$d_flexfnam'
22568 d_flock='$d_flock'
22569 d_flockproto='$d_flockproto'
22570 d_fork='$d_fork'
22571 d_fp_class='$d_fp_class'
22572 d_fpathconf='$d_fpathconf'
22573 d_fpclass='$d_fpclass'
22574 d_fpclassify='$d_fpclassify'
22575 d_fpclassl='$d_fpclassl'
22576 d_fpos64_t='$d_fpos64_t'
22577 d_frexpl='$d_frexpl'
22578 d_fs_data_s='$d_fs_data_s'
22579 d_fseeko='$d_fseeko'
22580 d_fsetpos='$d_fsetpos'
22581 d_fstatfs='$d_fstatfs'
22582 d_fstatvfs='$d_fstatvfs'
22583 d_fsync='$d_fsync'
22584 d_ftello='$d_ftello'
22585 d_ftime='$d_ftime'
22586 d_futimes='$d_futimes'
22587 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22588 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22589 d_getaddrinfo='$d_getaddrinfo'
22590 d_getcwd='$d_getcwd'
22591 d_getespwnam='$d_getespwnam'
22592 d_getfsstat='$d_getfsstat'
22593 d_getgrent='$d_getgrent'
22594 d_getgrent_r='$d_getgrent_r'
22595 d_getgrgid_r='$d_getgrgid_r'
22596 d_getgrnam_r='$d_getgrnam_r'
22597 d_getgrps='$d_getgrps'
22598 d_gethbyaddr='$d_gethbyaddr'
22599 d_gethbyname='$d_gethbyname'
22600 d_gethent='$d_gethent'
22601 d_gethname='$d_gethname'
22602 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22603 d_gethostbyname_r='$d_gethostbyname_r'
22604 d_gethostent_r='$d_gethostent_r'
22605 d_gethostprotos='$d_gethostprotos'
22606 d_getitimer='$d_getitimer'
22607 d_getlogin='$d_getlogin'
22608 d_getlogin_r='$d_getlogin_r'
22609 d_getmnt='$d_getmnt'
22610 d_getmntent='$d_getmntent'
22611 d_getnameinfo='$d_getnameinfo'
22612 d_getnbyaddr='$d_getnbyaddr'
22613 d_getnbyname='$d_getnbyname'
22614 d_getnent='$d_getnent'
22615 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22616 d_getnetbyname_r='$d_getnetbyname_r'
22617 d_getnetent_r='$d_getnetent_r'
22618 d_getnetprotos='$d_getnetprotos'
22619 d_getpagsz='$d_getpagsz'
22620 d_getpbyname='$d_getpbyname'
22621 d_getpbynumber='$d_getpbynumber'
22622 d_getpent='$d_getpent'
22623 d_getpgid='$d_getpgid'
22624 d_getpgrp2='$d_getpgrp2'
22625 d_getpgrp='$d_getpgrp'
22626 d_getppid='$d_getppid'
22627 d_getprior='$d_getprior'
22628 d_getprotobyname_r='$d_getprotobyname_r'
22629 d_getprotobynumber_r='$d_getprotobynumber_r'
22630 d_getprotoent_r='$d_getprotoent_r'
22631 d_getprotoprotos='$d_getprotoprotos'
22632 d_getprpwnam='$d_getprpwnam'
22633 d_getpwent='$d_getpwent'
22634 d_getpwent_r='$d_getpwent_r'
22635 d_getpwnam_r='$d_getpwnam_r'
22636 d_getpwuid_r='$d_getpwuid_r'
22637 d_getsbyname='$d_getsbyname'
22638 d_getsbyport='$d_getsbyport'
22639 d_getsent='$d_getsent'
22640 d_getservbyname_r='$d_getservbyname_r'
22641 d_getservbyport_r='$d_getservbyport_r'
22642 d_getservent_r='$d_getservent_r'
22643 d_getservprotos='$d_getservprotos'
22644 d_getspnam='$d_getspnam'
22645 d_getspnam_r='$d_getspnam_r'
22646 d_gettimeod='$d_gettimeod'
22647 d_gmtime64='$d_gmtime64'
22648 d_gmtime_r='$d_gmtime_r'
22649 d_gnulibc='$d_gnulibc'
22650 d_grpasswd='$d_grpasswd'
22651 d_hasmntopt='$d_hasmntopt'
22652 d_htonl='$d_htonl'
22653 d_ilogbl='$d_ilogbl'
22654 d_inc_version_list='$d_inc_version_list'
22655 d_index='$d_index'
22656 d_inetaton='$d_inetaton'
22657 d_inetntop='$d_inetntop'
22658 d_inetpton='$d_inetpton'
22659 d_int64_t='$d_int64_t'
22660 d_isascii='$d_isascii'
22661 d_isfinite='$d_isfinite'
22662 d_isinf='$d_isinf'
22663 d_isnan='$d_isnan'
22664 d_isnanl='$d_isnanl'
22665 d_killpg='$d_killpg'
22666 d_lchown='$d_lchown'
22667 d_ldbl_dig='$d_ldbl_dig'
22668 d_libm_lib_version='$d_libm_lib_version'
22669 d_link='$d_link'
22670 d_localtime64='$d_localtime64'
22671 d_localtime_r='$d_localtime_r'
22672 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22673 d_locconv='$d_locconv'
22674 d_lockf='$d_lockf'
22675 d_longdbl='$d_longdbl'
22676 d_longlong='$d_longlong'
22677 d_lseekproto='$d_lseekproto'
22678 d_lstat='$d_lstat'
22679 d_madvise='$d_madvise'
22680 d_malloc_good_size='$d_malloc_good_size'
22681 d_malloc_size='$d_malloc_size'
22682 d_mblen='$d_mblen'
22683 d_mbstowcs='$d_mbstowcs'
22684 d_mbtowc='$d_mbtowc'
22685 d_memchr='$d_memchr'
22686 d_memcmp='$d_memcmp'
22687 d_memcpy='$d_memcpy'
22688 d_memmove='$d_memmove'
22689 d_memset='$d_memset'
22690 d_mkdir='$d_mkdir'
22691 d_mkdtemp='$d_mkdtemp'
22692 d_mkfifo='$d_mkfifo'
22693 d_mkstemp='$d_mkstemp'
22694 d_mkstemps='$d_mkstemps'
22695 d_mktime64='$d_mktime64'
22696 d_mktime='$d_mktime'
22697 d_mmap='$d_mmap'
22698 d_modfl='$d_modfl'
22699 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22700 d_modflproto='$d_modflproto'
22701 d_mprotect='$d_mprotect'
22702 d_msg='$d_msg'
22703 d_msg_ctrunc='$d_msg_ctrunc'
22704 d_msg_dontroute='$d_msg_dontroute'
22705 d_msg_oob='$d_msg_oob'
22706 d_msg_peek='$d_msg_peek'
22707 d_msg_proxy='$d_msg_proxy'
22708 d_msgctl='$d_msgctl'
22709 d_msgget='$d_msgget'
22710 d_msghdr_s='$d_msghdr_s'
22711 d_msgrcv='$d_msgrcv'
22712 d_msgsnd='$d_msgsnd'
22713 d_msync='$d_msync'
22714 d_munmap='$d_munmap'
22715 d_mymalloc='$d_mymalloc'
22716 d_ndbm='$d_ndbm'
22717 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
22718 d_nice='$d_nice'
22719 d_nl_langinfo='$d_nl_langinfo'
22720 d_nv_preserves_uv='$d_nv_preserves_uv'
22721 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22722 d_off64_t='$d_off64_t'
22723 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22724 d_oldpthreads='$d_oldpthreads'
22725 d_oldsock='$d_oldsock'
22726 d_open3='$d_open3'
22727 d_pathconf='$d_pathconf'
22728 d_pause='$d_pause'
22729 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22730 d_phostname='$d_phostname'
22731 d_pipe='$d_pipe'
22732 d_poll='$d_poll'
22733 d_portable='$d_portable'
22734 d_prctl='$d_prctl'
22735 d_prctl_set_name='$d_prctl_set_name'
22736 d_printf_format_null='$d_printf_format_null'
22737 d_procselfexe='$d_procselfexe'
22738 d_pseudofork='$d_pseudofork'
22739 d_pthread_atfork='$d_pthread_atfork'
22740 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22741 d_pthread_yield='$d_pthread_yield'
22742 d_pwage='$d_pwage'
22743 d_pwchange='$d_pwchange'
22744 d_pwclass='$d_pwclass'
22745 d_pwcomment='$d_pwcomment'
22746 d_pwexpire='$d_pwexpire'
22747 d_pwgecos='$d_pwgecos'
22748 d_pwpasswd='$d_pwpasswd'
22749 d_pwquota='$d_pwquota'
22750 d_qgcvt='$d_qgcvt'
22751 d_quad='$d_quad'
22752 d_random_r='$d_random_r'
22753 d_readdir64_r='$d_readdir64_r'
22754 d_readdir='$d_readdir'
22755 d_readdir_r='$d_readdir_r'
22756 d_readlink='$d_readlink'
22757 d_readv='$d_readv'
22758 d_recvmsg='$d_recvmsg'
22759 d_rename='$d_rename'
22760 d_rewinddir='$d_rewinddir'
22761 d_rmdir='$d_rmdir'
22762 d_safebcpy='$d_safebcpy'
22763 d_safemcpy='$d_safemcpy'
22764 d_sanemcmp='$d_sanemcmp'
22765 d_sbrkproto='$d_sbrkproto'
22766 d_scalbnl='$d_scalbnl'
22767 d_sched_yield='$d_sched_yield'
22768 d_scm_rights='$d_scm_rights'
22769 d_seekdir='$d_seekdir'
22770 d_select='$d_select'
22771 d_sem='$d_sem'
22772 d_semctl='$d_semctl'
22773 d_semctl_semid_ds='$d_semctl_semid_ds'
22774 d_semctl_semun='$d_semctl_semun'
22775 d_semget='$d_semget'
22776 d_semop='$d_semop'
22777 d_sendmsg='$d_sendmsg'
22778 d_setegid='$d_setegid'
22779 d_seteuid='$d_seteuid'
22780 d_setgrent='$d_setgrent'
22781 d_setgrent_r='$d_setgrent_r'
22782 d_setgrps='$d_setgrps'
22783 d_sethent='$d_sethent'
22784 d_sethostent_r='$d_sethostent_r'
22785 d_setitimer='$d_setitimer'
22786 d_setlinebuf='$d_setlinebuf'
22787 d_setlocale='$d_setlocale'
22788 d_setlocale_r='$d_setlocale_r'
22789 d_setnent='$d_setnent'
22790 d_setnetent_r='$d_setnetent_r'
22791 d_setpent='$d_setpent'
22792 d_setpgid='$d_setpgid'
22793 d_setpgrp2='$d_setpgrp2'
22794 d_setpgrp='$d_setpgrp'
22795 d_setprior='$d_setprior'
22796 d_setproctitle='$d_setproctitle'
22797 d_setprotoent_r='$d_setprotoent_r'
22798 d_setpwent='$d_setpwent'
22799 d_setpwent_r='$d_setpwent_r'
22800 d_setregid='$d_setregid'
22801 d_setresgid='$d_setresgid'
22802 d_setresuid='$d_setresuid'
22803 d_setreuid='$d_setreuid'
22804 d_setrgid='$d_setrgid'
22805 d_setruid='$d_setruid'
22806 d_setsent='$d_setsent'
22807 d_setservent_r='$d_setservent_r'
22808 d_setsid='$d_setsid'
22809 d_setvbuf='$d_setvbuf'
22810 d_sfio='$d_sfio'
22811 d_shm='$d_shm'
22812 d_shmat='$d_shmat'
22813 d_shmatprototype='$d_shmatprototype'
22814 d_shmctl='$d_shmctl'
22815 d_shmdt='$d_shmdt'
22816 d_shmget='$d_shmget'
22817 d_sigaction='$d_sigaction'
22818 d_signbit='$d_signbit'
22819 d_sigprocmask='$d_sigprocmask'
22820 d_sigsetjmp='$d_sigsetjmp'
22821 d_sin6_scope_id='$d_sin6_scope_id'
22822 d_sitearch='$d_sitearch'
22823 d_snprintf='$d_snprintf'
22824 d_sockaddr_sa_len='$d_sockaddr_sa_len'
22825 d_sockatmark='$d_sockatmark'
22826 d_sockatmarkproto='$d_sockatmarkproto'
22827 d_socket='$d_socket'
22828 d_socklen_t='$d_socklen_t'
22829 d_sockpair='$d_sockpair'
22830 d_socks5_init='$d_socks5_init'
22831 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22832 d_sqrtl='$d_sqrtl'
22833 d_srand48_r='$d_srand48_r'
22834 d_srandom_r='$d_srandom_r'
22835 d_sresgproto='$d_sresgproto'
22836 d_sresuproto='$d_sresuproto'
22837 d_statblks='$d_statblks'
22838 d_statfs_f_flags='$d_statfs_f_flags'
22839 d_statfs_s='$d_statfs_s'
22840 d_static_inline='$d_static_inline'
22841 d_statvfs='$d_statvfs'
22842 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22843 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22844 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22845 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22846 d_stdio_stream_array='$d_stdio_stream_array'
22847 d_stdiobase='$d_stdiobase'
22848 d_stdstdio='$d_stdstdio'
22849 d_strchr='$d_strchr'
22850 d_strcoll='$d_strcoll'
22851 d_strctcpy='$d_strctcpy'
22852 d_strerrm='$d_strerrm'
22853 d_strerror='$d_strerror'
22854 d_strerror_r='$d_strerror_r'
22855 d_strftime='$d_strftime'
22856 d_strlcat='$d_strlcat'
22857 d_strlcpy='$d_strlcpy'
22858 d_strtod='$d_strtod'
22859 d_strtol='$d_strtol'
22860 d_strtold='$d_strtold'
22861 d_strtoll='$d_strtoll'
22862 d_strtoq='$d_strtoq'
22863 d_strtoul='$d_strtoul'
22864 d_strtoull='$d_strtoull'
22865 d_strtouq='$d_strtouq'
22866 d_strxfrm='$d_strxfrm'
22867 d_suidsafe='$d_suidsafe'
22868 d_symlink='$d_symlink'
22869 d_syscall='$d_syscall'
22870 d_syscallproto='$d_syscallproto'
22871 d_sysconf='$d_sysconf'
22872 d_sysernlst='$d_sysernlst'
22873 d_syserrlst='$d_syserrlst'
22874 d_system='$d_system'
22875 d_tcgetpgrp='$d_tcgetpgrp'
22876 d_tcsetpgrp='$d_tcsetpgrp'
22877 d_telldir='$d_telldir'
22878 d_telldirproto='$d_telldirproto'
22879 d_time='$d_time'
22880 d_timegm='$d_timegm'
22881 d_times='$d_times'
22882 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22883 d_tm_tm_zone='$d_tm_tm_zone'
22884 d_tmpnam_r='$d_tmpnam_r'
22885 d_truncate='$d_truncate'
22886 d_ttyname_r='$d_ttyname_r'
22887 d_tzname='$d_tzname'
22888 d_u32align='$d_u32align'
22889 d_ualarm='$d_ualarm'
22890 d_umask='$d_umask'
22891 d_uname='$d_uname'
22892 d_union_semun='$d_union_semun'
22893 d_unordered='$d_unordered'
22894 d_unsetenv='$d_unsetenv'
22895 d_usleep='$d_usleep'
22896 d_usleepproto='$d_usleepproto'
22897 d_ustat='$d_ustat'
22898 d_vendorarch='$d_vendorarch'
22899 d_vendorbin='$d_vendorbin'
22900 d_vendorlib='$d_vendorlib'
22901 d_vendorscript='$d_vendorscript'
22902 d_vfork='$d_vfork'
22903 d_void_closedir='$d_void_closedir'
22904 d_voidsig='$d_voidsig'
22905 d_voidtty='$d_voidtty'
22906 d_volatile='$d_volatile'
22907 d_vprintf='$d_vprintf'
22908 d_vsnprintf='$d_vsnprintf'
22909 d_wait4='$d_wait4'
22910 d_waitpid='$d_waitpid'
22911 d_wcstombs='$d_wcstombs'
22912 d_wctomb='$d_wctomb'
22913 d_writev='$d_writev'
22914 d_xenix='$d_xenix'
22915 date='$date'
22916 db_hashtype='$db_hashtype'
22917 db_prefixtype='$db_prefixtype'
22918 db_version_major='$db_version_major'
22919 db_version_minor='$db_version_minor'
22920 db_version_patch='$db_version_patch'
22921 defvoidused='$defvoidused'
22922 direntrytype='$direntrytype'
22923 dlext='$dlext'
22924 dlsrc='$dlsrc'
22925 doublesize='$doublesize'
22926 drand01='$drand01'
22927 drand48_r_proto='$drand48_r_proto'
22928 dtrace='$dtrace'
22929 dynamic_ext='$dynamic_ext'
22930 eagain='$eagain'
22931 ebcdic='$ebcdic'
22932 echo='$echo'
22933 egrep='$egrep'
22934 emacs='$emacs'
22935 endgrent_r_proto='$endgrent_r_proto'
22936 endhostent_r_proto='$endhostent_r_proto'
22937 endnetent_r_proto='$endnetent_r_proto'
22938 endprotoent_r_proto='$endprotoent_r_proto'
22939 endpwent_r_proto='$endpwent_r_proto'
22940 endservent_r_proto='$endservent_r_proto'
22941 eunicefix='$eunicefix'
22942 exe_ext='$exe_ext'
22943 expr='$expr'
22944 extensions='$extensions'
22945 extern_C='$extern_C'
22946 extras='$extras'
22947 fflushNULL='$fflushNULL'
22948 fflushall='$fflushall'
22949 find='$find'
22950 firstmakefile='$firstmakefile'
22951 flex='$flex'
22952 fpossize='$fpossize'
22953 fpostype='$fpostype'
22954 freetype='$freetype'
22955 from='$from'
22956 full_ar='$full_ar'
22957 full_csh='$full_csh'
22958 full_sed='$full_sed'
22959 gccansipedantic='$gccansipedantic'
22960 gccosandvers='$gccosandvers'
22961 gccversion='$gccversion'
22962 getgrent_r_proto='$getgrent_r_proto'
22963 getgrgid_r_proto='$getgrgid_r_proto'
22964 getgrnam_r_proto='$getgrnam_r_proto'
22965 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22966 gethostbyname_r_proto='$gethostbyname_r_proto'
22967 gethostent_r_proto='$gethostent_r_proto'
22968 getlogin_r_proto='$getlogin_r_proto'
22969 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22970 getnetbyname_r_proto='$getnetbyname_r_proto'
22971 getnetent_r_proto='$getnetent_r_proto'
22972 getprotobyname_r_proto='$getprotobyname_r_proto'
22973 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22974 getprotoent_r_proto='$getprotoent_r_proto'
22975 getpwent_r_proto='$getpwent_r_proto'
22976 getpwnam_r_proto='$getpwnam_r_proto'
22977 getpwuid_r_proto='$getpwuid_r_proto'
22978 getservbyname_r_proto='$getservbyname_r_proto'
22979 getservbyport_r_proto='$getservbyport_r_proto'
22980 getservent_r_proto='$getservent_r_proto'
22981 getspnam_r_proto='$getspnam_r_proto'
22982 gidformat='$gidformat'
22983 gidsign='$gidsign'
22984 gidsize='$gidsize'
22985 gidtype='$gidtype'
22986 glibpth='$glibpth'
22987 gmake='$gmake'
22988 gmtime_r_proto='$gmtime_r_proto'
22989 gnulibc_version='$gnulibc_version'
22990 grep='$grep'
22991 groupcat='$groupcat'
22992 groupstype='$groupstype'
22993 gzip='$gzip'
22994 h_fcntl='$h_fcntl'
22995 h_sysfile='$h_sysfile'
22996 hint='$hint'
22997 hostcat='$hostcat'
22998 html1dir='$html1dir'
22999 html1direxp='$html1direxp'
23000 html3dir='$html3dir'
23001 html3direxp='$html3direxp'
23002 i16size='$i16size'
23003 i16type='$i16type'
23004 i32size='$i32size'
23005 i32type='$i32type'
23006 i64size='$i64size'
23007 i64type='$i64type'
23008 i8size='$i8size'
23009 i8type='$i8type'
23010 i_arpainet='$i_arpainet'
23011 i_assert='$i_assert'
23012 i_bsdioctl='$i_bsdioctl'
23013 i_crypt='$i_crypt'
23014 i_db='$i_db'
23015 i_dbm='$i_dbm'
23016 i_dirent='$i_dirent'
23017 i_dld='$i_dld'
23018 i_dlfcn='$i_dlfcn'
23019 i_fcntl='$i_fcntl'
23020 i_float='$i_float'
23021 i_fp='$i_fp'
23022 i_fp_class='$i_fp_class'
23023 i_gdbm='$i_gdbm'
23024 i_gdbm_ndbm='$i_gdbm_ndbm'
23025 i_gdbmndbm='$i_gdbmndbm'
23026 i_grp='$i_grp'
23027 i_ieeefp='$i_ieeefp'
23028 i_inttypes='$i_inttypes'
23029 i_langinfo='$i_langinfo'
23030 i_libutil='$i_libutil'
23031 i_limits='$i_limits'
23032 i_locale='$i_locale'
23033 i_machcthr='$i_machcthr'
23034 i_malloc='$i_malloc'
23035 i_mallocmalloc='$i_mallocmalloc'
23036 i_math='$i_math'
23037 i_memory='$i_memory'
23038 i_mntent='$i_mntent'
23039 i_ndbm='$i_ndbm'
23040 i_netdb='$i_netdb'
23041 i_neterrno='$i_neterrno'
23042 i_netinettcp='$i_netinettcp'
23043 i_niin='$i_niin'
23044 i_poll='$i_poll'
23045 i_prot='$i_prot'
23046 i_pthread='$i_pthread'
23047 i_pwd='$i_pwd'
23048 i_rpcsvcdbm='$i_rpcsvcdbm'
23049 i_sfio='$i_sfio'
23050 i_sgtty='$i_sgtty'
23051 i_shadow='$i_shadow'
23052 i_socks='$i_socks'
23053 i_stdarg='$i_stdarg'
23054 i_stddef='$i_stddef'
23055 i_stdlib='$i_stdlib'
23056 i_string='$i_string'
23057 i_sunmath='$i_sunmath'
23058 i_sysaccess='$i_sysaccess'
23059 i_sysdir='$i_sysdir'
23060 i_sysfile='$i_sysfile'
23061 i_sysfilio='$i_sysfilio'
23062 i_sysin='$i_sysin'
23063 i_sysioctl='$i_sysioctl'
23064 i_syslog='$i_syslog'
23065 i_sysmman='$i_sysmman'
23066 i_sysmode='$i_sysmode'
23067 i_sysmount='$i_sysmount'
23068 i_sysndir='$i_sysndir'
23069 i_sysparam='$i_sysparam'
23070 i_syspoll='$i_syspoll'
23071 i_sysresrc='$i_sysresrc'
23072 i_syssecrt='$i_syssecrt'
23073 i_sysselct='$i_sysselct'
23074 i_syssockio='$i_syssockio'
23075 i_sysstat='$i_sysstat'
23076 i_sysstatfs='$i_sysstatfs'
23077 i_sysstatvfs='$i_sysstatvfs'
23078 i_systime='$i_systime'
23079 i_systimek='$i_systimek'
23080 i_systimes='$i_systimes'
23081 i_systypes='$i_systypes'
23082 i_sysuio='$i_sysuio'
23083 i_sysun='$i_sysun'
23084 i_sysutsname='$i_sysutsname'
23085 i_sysvfs='$i_sysvfs'
23086 i_syswait='$i_syswait'
23087 i_termio='$i_termio'
23088 i_termios='$i_termios'
23089 i_time='$i_time'
23090 i_unistd='$i_unistd'
23091 i_ustat='$i_ustat'
23092 i_utime='$i_utime'
23093 i_values='$i_values'
23094 i_varargs='$i_varargs'
23095 i_varhdr='$i_varhdr'
23096 i_vfork='$i_vfork'
23097 ignore_versioned_solibs='$ignore_versioned_solibs'
23098 inc_version_list='$inc_version_list'
23099 inc_version_list_init='$inc_version_list_init'
23100 incpath='$incpath'
23101 inews='$inews'
23102 initialinstalllocation='$initialinstalllocation'
23103 installarchlib='$installarchlib'
23104 installbin='$installbin'
23105 installhtml1dir='$installhtml1dir'
23106 installhtml3dir='$installhtml3dir'
23107 installman1dir='$installman1dir'
23108 installman3dir='$installman3dir'
23109 installprefix='$installprefix'
23110 installprefixexp='$installprefixexp'
23111 installprivlib='$installprivlib'
23112 installscript='$installscript'
23113 installsitearch='$installsitearch'
23114 installsitebin='$installsitebin'
23115 installsitehtml1dir='$installsitehtml1dir'
23116 installsitehtml3dir='$installsitehtml3dir'
23117 installsitelib='$installsitelib'
23118 installsiteman1dir='$installsiteman1dir'
23119 installsiteman3dir='$installsiteman3dir'
23120 installsitescript='$installsitescript'
23121 installstyle='$installstyle'
23122 installusrbinperl='$installusrbinperl'
23123 installvendorarch='$installvendorarch'
23124 installvendorbin='$installvendorbin'
23125 installvendorhtml1dir='$installvendorhtml1dir'
23126 installvendorhtml3dir='$installvendorhtml3dir'
23127 installvendorlib='$installvendorlib'
23128 installvendorman1dir='$installvendorman1dir'
23129 installvendorman3dir='$installvendorman3dir'
23130 installvendorscript='$installvendorscript'
23131 intsize='$intsize'
23132 issymlink='$issymlink'
23133 ivdformat='$ivdformat'
23134 ivsize='$ivsize'
23135 ivtype='$ivtype'
23136 known_extensions='$known_extensions'
23137 ksh='$ksh'
23138 ld='$ld'
23139 lddlflags='$lddlflags'
23140 ldflags='$ldflags'
23141 ldflags_uselargefiles='$ldflags_uselargefiles'
23142 ldlibpthname='$ldlibpthname'
23143 less='$less'
23144 lib_ext='$lib_ext'
23145 libc='$libc'
23146 libperl='$libperl'
23147 libpth='$libpth'
23148 libs='$libs'
23149 libsdirs='$libsdirs'
23150 libsfiles='$libsfiles'
23151 libsfound='$libsfound'
23152 libspath='$libspath'
23153 libswanted='$libswanted'
23154 libswanted_uselargefiles='$libswanted_uselargefiles'
23155 line='$line'
23156 lint='$lint'
23157 lkflags='$lkflags'
23158 ln='$ln'
23159 lns='$lns'
23160 localtime_r_proto='$localtime_r_proto'
23161 locincpth='$locincpth'
23162 loclibpth='$loclibpth'
23163 longdblsize='$longdblsize'
23164 longlongsize='$longlongsize'
23165 longsize='$longsize'
23166 lp='$lp'
23167 lpr='$lpr'
23168 ls='$ls'
23169 lseeksize='$lseeksize'
23170 lseektype='$lseektype'
23171 mad='$mad'
23172 madlyh='$madlyh'
23173 madlyobj='$madlyobj'
23174 madlysrc='$madlysrc'
23175 mail='$mail'
23176 mailx='$mailx'
23177 make='$make'
23178 make_set_make='$make_set_make'
23179 mallocobj='$mallocobj'
23180 mallocsrc='$mallocsrc'
23181 malloctype='$malloctype'
23182 man1dir='$man1dir'
23183 man1direxp='$man1direxp'
23184 man1ext='$man1ext'
23185 man3dir='$man3dir'
23186 man3direxp='$man3direxp'
23187 man3ext='$man3ext'
23188 mips_type='$mips_type'
23189 mistrustnm='$mistrustnm'
23190 mkdir='$mkdir'
23191 mmaptype='$mmaptype'
23192 modetype='$modetype'
23193 more='$more'
23194 multiarch='$multiarch'
23195 mv='$mv'
23196 myarchname='$myarchname'
23197 mydomain='$mydomain'
23198 myhostname='$myhostname'
23199 myuname='$myuname'
23200 n='$n'
23201 need_va_copy='$need_va_copy'
23202 netdb_hlen_type='$netdb_hlen_type'
23203 netdb_host_type='$netdb_host_type'
23204 netdb_name_type='$netdb_name_type'
23205 netdb_net_type='$netdb_net_type'
23206 nm='$nm'
23207 nm_opt='$nm_opt'
23208 nm_so_opt='$nm_so_opt'
23209 nonxs_ext='$nonxs_ext'
23210 nroff='$nroff'
23211 nvEUformat='$nvEUformat'
23212 nvFUformat='$nvFUformat'
23213 nvGUformat='$nvGUformat'
23214 nv_overflows_integers_at='$nv_overflows_integers_at'
23215 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23216 nveformat='$nveformat'
23217 nvfformat='$nvfformat'
23218 nvgformat='$nvgformat'
23219 nvsize='$nvsize'
23220 nvtype='$nvtype'
23221 o_nonblock='$o_nonblock'
23222 obj_ext='$obj_ext'
23223 old_pthread_create_joinable='$old_pthread_create_joinable'
23224 optimize='$optimize'
23225 orderlib='$orderlib'
23226 osname='$osname'
23227 osvers='$osvers'
23228 otherlibdirs='$otherlibdirs'
23229 package='$package'
23230 pager='$pager'
23231 passcat='$passcat'
23232 patchlevel='$patchlevel'
23233 path_sep='$path_sep'
23234 perl5='$perl5'
23235 perl='$perl'
23236 perl_patchlevel='$perl_patchlevel'
23237 perl_static_inline='$perl_static_inline'
23238 perladmin='$perladmin'
23239 perllibs='$perllibs'
23240 perlpath='$perlpath'
23241 pg='$pg'
23242 phostname='$phostname'
23243 pidtype='$pidtype'
23244 plibpth='$plibpth'
23245 pmake='$pmake'
23246 pr='$pr'
23247 prefix='$prefix'
23248 prefixexp='$prefixexp'
23249 privlib='$privlib'
23250 privlibexp='$privlibexp'
23251 procselfexe='$procselfexe'
23252 prototype='$prototype'
23253 ptrsize='$ptrsize'
23254 quadkind='$quadkind'
23255 quadtype='$quadtype'
23256 randbits='$randbits'
23257 randfunc='$randfunc'
23258 random_r_proto='$random_r_proto'
23259 randseedtype='$randseedtype'
23260 ranlib='$ranlib'
23261 rd_nodata='$rd_nodata'
23262 readdir64_r_proto='$readdir64_r_proto'
23263 readdir_r_proto='$readdir_r_proto'
23264 revision='$revision'
23265 rm='$rm'
23266 rm_try='$rm_try'
23267 rmail='$rmail'
23268 run='$run'
23269 runnm='$runnm'
23270 sGMTIME_max='$sGMTIME_max'
23271 sGMTIME_min='$sGMTIME_min'
23272 sLOCALTIME_max='$sLOCALTIME_max'
23273 sLOCALTIME_min='$sLOCALTIME_min'
23274 sPRIEUldbl='$sPRIEUldbl'
23275 sPRIFUldbl='$sPRIFUldbl'
23276 sPRIGUldbl='$sPRIGUldbl'
23277 sPRIXU64='$sPRIXU64'
23278 sPRId64='$sPRId64'
23279 sPRIeldbl='$sPRIeldbl'
23280 sPRIfldbl='$sPRIfldbl'
23281 sPRIgldbl='$sPRIgldbl'
23282 sPRIi64='$sPRIi64'
23283 sPRIo64='$sPRIo64'
23284 sPRIu64='$sPRIu64'
23285 sPRIx64='$sPRIx64'
23286 sSCNfldbl='$sSCNfldbl'
23287 sched_yield='$sched_yield'
23288 scriptdir='$scriptdir'
23289 scriptdirexp='$scriptdirexp'
23290 sed='$sed'
23291 seedfunc='$seedfunc'
23292 selectminbits='$selectminbits'
23293 selecttype='$selecttype'
23294 sendmail='$sendmail'
23295 setgrent_r_proto='$setgrent_r_proto'
23296 sethostent_r_proto='$sethostent_r_proto'
23297 setlocale_r_proto='$setlocale_r_proto'
23298 setnetent_r_proto='$setnetent_r_proto'
23299 setprotoent_r_proto='$setprotoent_r_proto'
23300 setpwent_r_proto='$setpwent_r_proto'
23301 setservent_r_proto='$setservent_r_proto'
23302 sh='$sh'
23303 shar='$shar'
23304 sharpbang='$sharpbang'
23305 shmattype='$shmattype'
23306 shortsize='$shortsize'
23307 shrpenv='$shrpenv'
23308 shsharp='$shsharp'
23309 sig_count='$sig_count'
23310 sig_name='$sig_name'
23311 sig_name_init='$sig_name_init'
23312 sig_num='$sig_num'
23313 sig_num_init='$sig_num_init'
23314 sig_size='$sig_size'
23315 signal_t='$signal_t'
23316 sitearch='$sitearch'
23317 sitearchexp='$sitearchexp'
23318 sitebin='$sitebin'
23319 sitebinexp='$sitebinexp'
23320 sitehtml1dir='$sitehtml1dir'
23321 sitehtml1direxp='$sitehtml1direxp'
23322 sitehtml3dir='$sitehtml3dir'
23323 sitehtml3direxp='$sitehtml3direxp'
23324 sitelib='$sitelib'
23325 sitelib_stem='$sitelib_stem'
23326 sitelibexp='$sitelibexp'
23327 siteman1dir='$siteman1dir'
23328 siteman1direxp='$siteman1direxp'
23329 siteman3dir='$siteman3dir'
23330 siteman3direxp='$siteman3direxp'
23331 siteprefix='$siteprefix'
23332 siteprefixexp='$siteprefixexp'
23333 sitescript='$sitescript'
23334 sitescriptexp='$sitescriptexp'
23335 sizesize='$sizesize'
23336 sizetype='$sizetype'
23337 sleep='$sleep'
23338 smail='$smail'
23339 so='$so'
23340 sockethdr='$sockethdr'
23341 socketlib='$socketlib'
23342 socksizetype='$socksizetype'
23343 sort='$sort'
23344 spackage='$spackage'
23345 spitshell='$spitshell'
23346 srand48_r_proto='$srand48_r_proto'
23347 srandom_r_proto='$srandom_r_proto'
23348 src='$src'
23349 ssizetype='$ssizetype'
23350 st_ino_sign='$st_ino_sign'
23351 st_ino_size='$st_ino_size'
23352 startperl='$startperl'
23353 startsh='$startsh'
23354 static_ext='$static_ext'
23355 stdchar='$stdchar'
23356 stdio_base='$stdio_base'
23357 stdio_bufsiz='$stdio_bufsiz'
23358 stdio_cnt='$stdio_cnt'
23359 stdio_filbuf='$stdio_filbuf'
23360 stdio_ptr='$stdio_ptr'
23361 stdio_stream_array='$stdio_stream_array'
23362 strerror_r_proto='$strerror_r_proto'
23363 strings='$strings'
23364 submit='$submit'
23365 subversion='$subversion'
23366 sysman='$sysman'
23367 tail='$tail'
23368 tar='$tar'
23369 targetarch='$targetarch'
23370 tbl='$tbl'
23371 tee='$tee'
23372 test='$test'
23373 timeincl='$timeincl'
23374 timetype='$timetype'
23375 tmpnam_r_proto='$tmpnam_r_proto'
23376 to='$to'
23377 touch='$touch'
23378 tr='$tr'
23379 trnl='$trnl'
23380 troff='$troff'
23381 ttyname_r_proto='$ttyname_r_proto'
23382 u16size='$u16size'
23383 u16type='$u16type'
23384 u32size='$u32size'
23385 u32type='$u32type'
23386 u64size='$u64size'
23387 u64type='$u64type'
23388 u8size='$u8size'
23389 u8type='$u8type'
23390 uidformat='$uidformat'
23391 uidsign='$uidsign'
23392 uidsize='$uidsize'
23393 uidtype='$uidtype'
23394 uname='$uname'
23395 uniq='$uniq'
23396 uquadtype='$uquadtype'
23397 use5005threads='$use5005threads'
23398 use64bitall='$use64bitall'
23399 use64bitint='$use64bitint'
23400 usecrosscompile='$usecrosscompile'
23401 usedevel='$usedevel'
23402 usedl='$usedl'
23403 usedtrace='$usedtrace'
23404 usefaststdio='$usefaststdio'
23405 useithreads='$useithreads'
23406 uselargefiles='$uselargefiles'
23407 uselongdouble='$uselongdouble'
23408 usemallocwrap='$usemallocwrap'
23409 usemorebits='$usemorebits'
23410 usemultiplicity='$usemultiplicity'
23411 usemymalloc='$usemymalloc'
23412 usenm='$usenm'
23413 useopcode='$useopcode'
23414 useperlio='$useperlio'
23415 useposix='$useposix'
23416 usereentrant='$usereentrant'
23417 userelocatableinc='$userelocatableinc'
23418 usesfio='$usesfio'
23419 useshrplib='$useshrplib'
23420 usesitecustomize='$usesitecustomize'
23421 usesocks='$usesocks'
23422 usethreads='$usethreads'
23423 usevendorprefix='$usevendorprefix'
23424 usevfork='$usevfork'
23425 usrinc='$usrinc'
23426 uuname='$uuname'
23427 uvXUformat='$uvXUformat'
23428 uvoformat='$uvoformat'
23429 uvsize='$uvsize'
23430 uvtype='$uvtype'
23431 uvuformat='$uvuformat'
23432 uvxformat='$uvxformat'
23433 vaproto='$vaproto'
23434 vendorarch='$vendorarch'
23435 vendorarchexp='$vendorarchexp'
23436 vendorbin='$vendorbin'
23437 vendorbinexp='$vendorbinexp'
23438 vendorhtml1dir='$vendorhtml1dir'
23439 vendorhtml1direxp='$vendorhtml1direxp'
23440 vendorhtml3dir='$vendorhtml3dir'
23441 vendorhtml3direxp='$vendorhtml3direxp'
23442 vendorlib='$vendorlib'
23443 vendorlib_stem='$vendorlib_stem'
23444 vendorlibexp='$vendorlibexp'
23445 vendorman1dir='$vendorman1dir'
23446 vendorman1direxp='$vendorman1direxp'
23447 vendorman3dir='$vendorman3dir'
23448 vendorman3direxp='$vendorman3direxp'
23449 vendorprefix='$vendorprefix'
23450 vendorprefixexp='$vendorprefixexp'
23451 vendorscript='$vendorscript'
23452 vendorscriptexp='$vendorscriptexp'
23453 version='$version'
23454 version_patchlevel_string='$version_patchlevel_string'
23455 versiononly='$versiononly'
23456 vi='$vi'
23457 voidflags='$voidflags'
23458 xlibpth='$xlibpth'
23459 yacc='$yacc'
23460 yaccflags='$yaccflags'
23461 zcat='$zcat'
23462 zip='$zip'
23463 EOT
23464
23465 : add special variables
23466 $test -f $src/patchlevel.h && \
23467 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23468 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23469 echo "PERL_CONFIG_SH=true" >>config.sh
23470
23471 : propagate old symbols
23472 if $test -f UU/config.sh; then
23473         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23474         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23475                 config.sh config.sh UU/oldconfig.sh |\
23476                 $sort | $uniq -u >UU/oldsyms
23477         set X `$cat UU/oldsyms`
23478         shift
23479         case $# in
23480         0) ;;
23481         *)
23482                 $cat <<EOM
23483 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23484 EOM
23485                 echo ": Variables propagated from previous config.sh file." >>config.sh
23486                 for sym in `$cat UU/oldsyms`; do
23487                         echo "    Propagating $hint variable "'$'"$sym..."
23488                         eval 'tmp="$'"${sym}"'"'
23489                         echo "$tmp" | \
23490                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23491                 done
23492                 ;;
23493         esac
23494 fi
23495
23496 : Finish up by extracting the .SH files
23497 case "$alldone" in
23498 exit)
23499         $rm -rf UU
23500         echo "Extraction done."
23501         exit 0
23502         ;;
23503 cont)
23504         ;;
23505 '')
23506         dflt=''
23507         nostick=true
23508         $cat <<EOM
23509
23510 If you'd like to make any changes to the config.sh file before I begin
23511 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23512
23513 EOM
23514         rp="Press return or use a shell escape to edit config.sh:"
23515         . UU/myread
23516         nostick=''
23517         case "$ans" in
23518         '') ;;
23519         *) : in case they cannot read
23520                 sh 1>&4 -c "$ans";;
23521         esac
23522         ;;
23523 esac
23524
23525 : if this fails, just run all the .SH files by hand
23526 . ./config.sh
23527
23528 echo " "
23529 exec 1>&4
23530 pwd=`pwd`
23531 . ./UU/extract
23532 cd "$pwd"
23533
23534 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23535         dflt=y
23536         case "$silent" in
23537         true) ;;
23538         *)
23539                 $cat <<EOM
23540
23541 Now you need to generate make dependencies by running "$make depend".
23542 You might prefer to run it in background: "$make depend > makedepend.out &"
23543 It can take a while, so you might not want to run it right now.
23544
23545 EOM
23546                 ;;
23547         esac
23548         rp="Run $make depend now?"
23549         . UU/myread
23550         case "$ans" in
23551         y*)
23552                 $make depend && echo "Now you must run '$make'."
23553                 ;;
23554         *)
23555                 echo "You must run '$make depend' then '$make'."
23556                 ;;
23557         esac
23558 elif test -f [Mm]akefile; then
23559         echo " "
23560         echo "Now you must run a $make."
23561 else
23562         echo "Configure done."
23563 fi
23564
23565 if $test -f Policy.sh; then
23566     $cat <<EOM
23567
23568 If you compile $package on a different machine or from a different object
23569 directory, copy the Policy.sh file from this object directory to the
23570 new one before you run Configure -- this will help you with most of
23571 the policy defaults.
23572
23573 EOM
23574 fi
23575 if $test -f config.msg; then
23576     echo "Hmm.  I also noted the following information while running:"
23577     echo " "
23578     $cat config.msg >&4
23579     $rm -f config.msg
23580 fi
23581 $rm -f kit*isdone ark*isdone
23582 $rm -rf UU
23583
23584 : End of Configure
23585