This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add Kent Fredric to AUTHORS
[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 Fri Feb 15 14:51:06 CET 2013 [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 useversionedarchname=''
336 d_atolf=''
337 d_atoll=''
338 baserev=''
339 bin=''
340 binexp=''
341 initialinstalllocation=''
342 installbin=''
343 userelocatableinc=''
344 byteorder=''
345 cc=''
346 ccflags=''
347 cppflags=''
348 ldflags=''
349 lkflags=''
350 locincpth=''
351 optimize=''
352 cf_email=''
353 cf_by=''
354 cf_time=''
355 charbits=''
356 charsize=''
357 contains=''
358 cpp_stuff=''
359 cpplast=''
360 cppminus=''
361 cpprun=''
362 cppstdin=''
363 d__fwalk=''
364 d_access=''
365 d_accessx=''
366 d_aintl=''
367 d_alarm=''
368 asctime_r_proto=''
369 d_asctime_r=''
370 d_attribute_deprecated=''
371 d_attribute_format=''
372 d_attribute_malloc=''
373 d_attribute_nonnull=''
374 d_attribute_noreturn=''
375 d_attribute_pure=''
376 d_attribute_unused=''
377 d_attribute_warn_unused_result=''
378 d_printf_format_null=''
379 d_bcmp=''
380 d_bcopy=''
381 d_builtin_choose_expr=''
382 d_builtin_expect=''
383 d_bzero=''
384 d_c99_variadic_macros=''
385 d_casti32=''
386 castflags=''
387 d_castneg=''
388 d_chown=''
389 d_chroot=''
390 d_chsize=''
391 d_class=''
392 d_clearenv=''
393 d_closedir=''
394 d_void_closedir=''
395 d_cmsghdr_s=''
396 d_const=''
397 d_copysignl=''
398 d_cplusplus=''
399 cryptlib=''
400 d_crypt=''
401 crypt_r_proto=''
402 d_crypt_r=''
403 d_csh=''
404 full_csh=''
405 d_ctermid=''
406 ctermid_r_proto=''
407 d_ctermid_r=''
408 ctime_r_proto=''
409 d_ctime_r=''
410 d_cuserid=''
411 d_dbl_dig=''
412 d_dbminitproto=''
413 d_difftime=''
414 d_dir_dd_fd=''
415 d_dirfd=''
416 d_dlerror=''
417 d_dlopen=''
418 d_dlsymun=''
419 d_dosuid=''
420 d_suidsafe=''
421 d_drand48_r=''
422 drand48_r_proto=''
423 d_drand48proto=''
424 d_dup2=''
425 d_eaccess=''
426 d_endgrent=''
427 d_endgrent_r=''
428 endgrent_r_proto=''
429 d_endhent=''
430 d_endhostent_r=''
431 endhostent_r_proto=''
432 d_endnent=''
433 d_endnetent_r=''
434 endnetent_r_proto=''
435 d_endpent=''
436 d_endprotoent_r=''
437 endprotoent_r_proto=''
438 d_endpwent=''
439 d_endpwent_r=''
440 endpwent_r_proto=''
441 d_endsent=''
442 d_endservent_r=''
443 endservent_r_proto=''
444 d_faststdio=''
445 d_fchdir=''
446 d_fchmod=''
447 d_fchown=''
448 d_fcntl=''
449 d_fcntl_can_lock=''
450 d_fd_macros=''
451 d_fd_set=''
452 d_fds_bits=''
453 d_fgetpos=''
454 d_finite=''
455 d_finitel=''
456 d_flexfnam=''
457 d_flock=''
458 d_flockproto=''
459 d_fork=''
460 d_fp_class=''
461 d_fpclass=''
462 d_fpclassify=''
463 d_fpclassl=''
464 d_fpos64_t=''
465 d_frexpl=''
466 d_fs_data_s=''
467 d_fseeko=''
468 d_fsetpos=''
469 d_fstatfs=''
470 d_fsync=''
471 d_ftello=''
472 d_ftime=''
473 d_gettimeod=''
474 d_futimes=''
475 d_Gconvert=''
476 d_getaddrinfo=''
477 d_getcwd=''
478 d_getespwnam=''
479 d_getfsstat=''
480 d_getgrent=''
481 d_getgrent_r=''
482 getgrent_r_proto=''
483 d_getgrgid_r=''
484 getgrgid_r_proto=''
485 d_getgrnam_r=''
486 getgrnam_r_proto=''
487 d_getgrps=''
488 d_gethbyaddr=''
489 d_gethbyname=''
490 d_gethent=''
491 aphostname=''
492 d_gethname=''
493 d_phostname=''
494 d_uname=''
495 d_gethostbyaddr_r=''
496 gethostbyaddr_r_proto=''
497 d_gethostbyname_r=''
498 gethostbyname_r_proto=''
499 d_gethostent_r=''
500 gethostent_r_proto=''
501 d_gethostprotos=''
502 d_getitimer=''
503 d_getlogin=''
504 d_getlogin_r=''
505 getlogin_r_proto=''
506 d_getmnt=''
507 d_getmntent=''
508 d_getnameinfo=''
509 d_getnbyaddr=''
510 d_getnbyname=''
511 d_getnent=''
512 d_getnetbyaddr_r=''
513 getnetbyaddr_r_proto=''
514 d_getnetbyname_r=''
515 getnetbyname_r_proto=''
516 d_getnetent_r=''
517 getnetent_r_proto=''
518 d_getnetprotos=''
519 d_getpagsz=''
520 d_getpent=''
521 d_getpgid=''
522 d_getpgrp2=''
523 d_bsdgetpgrp=''
524 d_getpgrp=''
525 d_getppid=''
526 d_getprior=''
527 d_getpbyname=''
528 d_getpbynumber=''
529 d_getprotobyname_r=''
530 getprotobyname_r_proto=''
531 d_getprotobynumber_r=''
532 getprotobynumber_r_proto=''
533 d_getprotoent_r=''
534 getprotoent_r_proto=''
535 d_getprotoprotos=''
536 d_getprpwnam=''
537 d_getpwent=''
538 d_getpwent_r=''
539 getpwent_r_proto=''
540 d_getpwnam_r=''
541 getpwnam_r_proto=''
542 d_getpwuid_r=''
543 getpwuid_r_proto=''
544 d_getsent=''
545 d_getservbyname_r=''
546 getservbyname_r_proto=''
547 d_getservbyport_r=''
548 getservbyport_r_proto=''
549 d_getservent_r=''
550 getservent_r_proto=''
551 d_getservprotos=''
552 d_getspnam=''
553 d_getspnam_r=''
554 getspnam_r_proto=''
555 d_getsbyname=''
556 d_getsbyport=''
557 d_gmtime_r=''
558 gmtime_r_proto=''
559 d_gnulibc=''
560 gnulibc_version=''
561 d_hasmntopt=''
562 d_htonl=''
563 d_ilogbl=''
564 d_inetaton=''
565 d_inetntop=''
566 d_inetpton=''
567 d_int64_t=''
568 d_isascii=''
569 d_isblank=''
570 d_isfinite=''
571 d_isinf=''
572 d_isnan=''
573 d_isnanl=''
574 d_killpg=''
575 d_lchown=''
576 d_ldbl_dig=''
577 d_libm_lib_version=''
578 d_link=''
579 d_localtime_r=''
580 d_localtime_r_needs_tzset=''
581 localtime_r_proto=''
582 d_locconv=''
583 d_lockf=''
584 d_longdbl=''
585 longdblsize=''
586 d_longlong=''
587 longlongsize=''
588 d_lseekproto=''
589 d_lstat=''
590 d_madvise=''
591 d_malloc_good_size=''
592 d_malloc_size=''
593 d_mblen=''
594 d_mbstowcs=''
595 d_mbtowc=''
596 d_memchr=''
597 d_memcmp=''
598 d_memcpy=''
599 d_memmove=''
600 d_memset=''
601 d_mkdir=''
602 d_mkdtemp=''
603 d_mkfifo=''
604 d_mkstemp=''
605 d_mkstemps=''
606 d_mktime=''
607 d_mmap=''
608 mmaptype=''
609 d_modfl=''
610 d_modfl_pow32_bug=''
611 d_modflproto=''
612 d_mprotect=''
613 d_msg=''
614 d_msgctl=''
615 d_msgget=''
616 d_msghdr_s=''
617 d_msgrcv=''
618 d_msgsnd=''
619 d_msync=''
620 d_munmap=''
621 d_nice=''
622 d_nl_langinfo=''
623 d_off64_t=''
624 d_open3=''
625 d_fpathconf=''
626 d_pathconf=''
627 d_pause=''
628 d_pipe=''
629 d_poll=''
630 d_portable=''
631 d_prctl=''
632 d_prctl_set_name=''
633 d_procselfexe=''
634 procselfexe=''
635 d_old_pthread_create_joinable=''
636 old_pthread_create_joinable=''
637 d_pthread_atfork=''
638 d_pthread_attr_setscope=''
639 d_pthread_yield=''
640 d_sched_yield=''
641 sched_yield=''
642 d_qgcvt=''
643 d_random_r=''
644 random_r_proto=''
645 d_readdir64_r=''
646 readdir64_r_proto=''
647 d_readdir=''
648 d_rewinddir=''
649 d_seekdir=''
650 d_telldir=''
651 d_readdir_r=''
652 readdir_r_proto=''
653 d_readlink=''
654 d_readv=''
655 d_recvmsg=''
656 d_rename=''
657 d_rmdir=''
658 d_safebcpy=''
659 d_safemcpy=''
660 d_sanemcmp=''
661 d_sbrkproto=''
662 d_scalbnl=''
663 d_select=''
664 d_sem=''
665 d_semctl=''
666 d_semget=''
667 d_semop=''
668 d_sendmsg=''
669 d_setegid=''
670 d_seteuid=''
671 d_setgrent=''
672 d_setgrent_r=''
673 setgrent_r_proto=''
674 d_setgrps=''
675 d_sethent=''
676 d_sethostent_r=''
677 sethostent_r_proto=''
678 d_setitimer=''
679 d_setlinebuf=''
680 d_setlocale=''
681 d_setlocale_r=''
682 setlocale_r_proto=''
683 d_setnent=''
684 d_setnetent_r=''
685 setnetent_r_proto=''
686 d_setpent=''
687 d_setpgid=''
688 d_setpgrp2=''
689 d_bsdsetpgrp=''
690 d_setpgrp=''
691 d_setprior=''
692 d_setproctitle=''
693 d_setprotoent_r=''
694 setprotoent_r_proto=''
695 d_setpwent=''
696 d_setpwent_r=''
697 setpwent_r_proto=''
698 d_setregid=''
699 d_setresgid=''
700 d_setresuid=''
701 d_setreuid=''
702 d_setrgid=''
703 d_setruid=''
704 d_setsent=''
705 d_setservent_r=''
706 setservent_r_proto=''
707 d_setsid=''
708 d_setvbuf=''
709 d_sfio=''
710 usesfio=''
711 d_shm=''
712 d_shmat=''
713 d_shmatprototype=''
714 shmattype=''
715 d_shmctl=''
716 d_shmdt=''
717 d_shmget=''
718 d_sigaction=''
719 d_signbit=''
720 d_sigprocmask=''
721 d_sigsetjmp=''
722 usesitecustomize=''
723 d_snprintf=''
724 d_vsnprintf=''
725 d_sockatmark=''
726 d_sockatmarkproto=''
727 d_ip_mreq=''
728 d_ip_mreq_source=''
729 d_ipv6_mreq=''
730 d_ipv6_mreq_source=''
731 d_msg_ctrunc=''
732 d_msg_dontroute=''
733 d_msg_oob=''
734 d_msg_peek=''
735 d_msg_proxy=''
736 d_oldsock=''
737 d_scm_rights=''
738 d_sin6_scope_id=''
739 d_sockaddr_in6=''
740 d_sockaddr_sa_len=''
741 d_socket=''
742 d_sockpair=''
743 sockethdr=''
744 socketlib=''
745 d_socklen_t=''
746 d_socks5_init=''
747 d_sprintf_returns_strlen=''
748 d_sqrtl=''
749 d_srand48_r=''
750 srand48_r_proto=''
751 d_srandom_r=''
752 srandom_r_proto=''
753 d_sresgproto=''
754 d_sresuproto=''
755 d_statblks=''
756 d_statfs_f_flags=''
757 d_statfs_s=''
758 d_static_inline=''
759 perl_static_inline=''
760 d_fstatvfs=''
761 d_statvfs=''
762 d_stdio_cnt_lval=''
763 d_stdio_ptr_lval=''
764 d_stdio_ptr_lval_nochange_cnt=''
765 d_stdio_ptr_lval_sets_cnt=''
766 d_stdiobase=''
767 d_stdstdio=''
768 stdio_base=''
769 stdio_bufsiz=''
770 stdio_cnt=''
771 stdio_filbuf=''
772 stdio_ptr=''
773 d_index=''
774 d_strchr=''
775 d_strcoll=''
776 d_strctcpy=''
777 d_strerrm=''
778 d_strerror=''
779 d_sysernlst=''
780 d_syserrlst=''
781 d_strerror_r=''
782 strerror_r_proto=''
783 d_strftime=''
784 d_strlcat=''
785 d_strlcpy=''
786 d_strtod=''
787 d_strtol=''
788 d_strtold=''
789 d_strtoll=''
790 d_strtoq=''
791 d_strtoul=''
792 d_strtoull=''
793 d_strtouq=''
794 d_strxfrm=''
795 d_symlink=''
796 d_syscall=''
797 d_syscallproto=''
798 d_sysconf=''
799 d_system=''
800 d_tcgetpgrp=''
801 d_tcsetpgrp=''
802 d_telldirproto=''
803 d_time=''
804 timetype=''
805 d_asctime64=''
806 d_ctime64=''
807 d_difftime64=''
808 d_gmtime64=''
809 d_localtime64=''
810 d_mktime64=''
811 d_timegm=''
812 clocktype=''
813 d_times=''
814 d_tmpnam_r=''
815 tmpnam_r_proto=''
816 d_truncate=''
817 d_ttyname_r=''
818 ttyname_r_proto=''
819 d_tzname=''
820 d_u32align=''
821 d_ualarm=''
822 d_umask=''
823 d_semctl_semid_ds=''
824 d_semctl_semun=''
825 d_union_semun=''
826 d_unordered=''
827 d_unsetenv=''
828 d_usleep=''
829 d_usleepproto=''
830 d_ustat=''
831 d_pseudofork=''
832 d_vfork=''
833 usevfork=''
834 d_voidsig=''
835 signal_t=''
836 d_volatile=''
837 d_charvspr=''
838 d_vprintf=''
839 d_wait4=''
840 d_waitpid=''
841 d_wcstombs=''
842 d_wctomb=''
843 d_writev=''
844 dlext=''
845 bin_ELF=''
846 cccdlflags=''
847 ccdlflags=''
848 dlsrc=''
849 ld=''
850 ld_can_script=''
851 lddlflags=''
852 usedl=''
853 doublesize=''
854 ebcdic=''
855 fflushNULL=''
856 fflushall=''
857 fpossize=''
858 fpostype=''
859 gccansipedantic=''
860 gccosandvers=''
861 gccversion=''
862 gidformat=''
863 gidsign=''
864 gidsize=''
865 gidtype=''
866 groupstype=''
867 h_fcntl=''
868 h_sysfile=''
869 html1dir=''
870 html1direxp=''
871 installhtml1dir=''
872 html3dir=''
873 html3direxp=''
874 installhtml3dir=''
875 i_arpainet=''
876 i_assert=''
877 i_crypt=''
878 db_hashtype=''
879 db_prefixtype=''
880 db_version_major=''
881 db_version_minor=''
882 db_version_patch=''
883 i_db=''
884 i_dbm=''
885 i_rpcsvcdbm=''
886 d_dirnamlen=''
887 direntrytype=''
888 i_dirent=''
889 i_dld=''
890 i_dlfcn=''
891 i_fcntl=''
892 i_float=''
893 i_fp=''
894 i_fp_class=''
895 i_gdbm=''
896 d_grpasswd=''
897 i_grp=''
898 i_ieeefp=''
899 i_inttypes=''
900 i_langinfo=''
901 i_libutil=''
902 i_limits=''
903 i_locale=''
904 i_machcthr=''
905 i_malloc=''
906 i_mallocmalloc=''
907 i_math=''
908 i_memory=''
909 i_mntent=''
910 d_gdbm_ndbm_h_uses_prototypes=''
911 d_gdbmndbm_h_uses_prototypes=''
912 d_ndbm=''
913 d_ndbm_h_uses_prototypes=''
914 i_gdbm_ndbm=''
915 i_gdbmndbm=''
916 i_ndbm=''
917 i_netdb=''
918 i_neterrno=''
919 i_netinettcp=''
920 i_niin=''
921 i_sysin=''
922 i_poll=''
923 i_prot=''
924 i_pthread=''
925 d_pwage=''
926 d_pwchange=''
927 d_pwclass=''
928 d_pwcomment=''
929 d_pwexpire=''
930 d_pwgecos=''
931 d_pwpasswd=''
932 d_pwquota=''
933 i_pwd=''
934 i_sfio=''
935 i_shadow=''
936 i_socks=''
937 i_stdbool=''
938 i_stddef=''
939 i_stdlib=''
940 i_string=''
941 strings=''
942 i_sunmath=''
943 i_sysaccess=''
944 i_sysdir=''
945 i_sysfile=''
946 d_voidtty=''
947 i_bsdioctl=''
948 i_sysfilio=''
949 i_sysioctl=''
950 i_syssockio=''
951 i_syslog=''
952 i_sysmman=''
953 i_sysmode=''
954 i_sysmount=''
955 i_sysndir=''
956 i_sysparam=''
957 i_syspoll=''
958 i_sysresrc=''
959 i_syssecrt=''
960 i_sysselct=''
961 i_sysstat=''
962 i_sysstatfs=''
963 i_sysstatvfs=''
964 i_systimes=''
965 i_systypes=''
966 i_sysuio=''
967 i_sysun=''
968 i_sysutsname=''
969 i_sysvfs=''
970 i_syswait=''
971 i_sgtty=''
972 i_termio=''
973 i_termios=''
974 d_tm_tm_gmtoff=''
975 d_tm_tm_zone=''
976 i_systime=''
977 i_systimek=''
978 i_time=''
979 timeincl=''
980 i_unistd=''
981 i_ustat=''
982 i_utime=''
983 i_values=''
984 i_stdarg=''
985 i_varargs=''
986 i_varhdr=''
987 i_vfork=''
988 d_inc_version_list=''
989 inc_version_list=''
990 inc_version_list_init=''
991 installprefix=''
992 installprefixexp=''
993 installstyle=''
994 installusrbinperl=''
995 intsize=''
996 longsize=''
997 shortsize=''
998 issymlink=''
999 libc=''
1000 ldlibpthname=''
1001 libperl=''
1002 shrpenv=''
1003 useshrplib=''
1004 glibpth=''
1005 libpth=''
1006 loclibpth=''
1007 plibpth=''
1008 xlibpth=''
1009 ignore_versioned_solibs=''
1010 libs=''
1011 libsdirs=''
1012 libsfiles=''
1013 libsfound=''
1014 libspath=''
1015 lns=''
1016 d_PRIEUldbl=''
1017 d_PRIFUldbl=''
1018 d_PRIGUldbl=''
1019 d_PRIeldbl=''
1020 d_PRIfldbl=''
1021 d_PRIgldbl=''
1022 d_SCNfldbl=''
1023 sPRIEUldbl=''
1024 sPRIFUldbl=''
1025 sPRIGUldbl=''
1026 sPRIeldbl=''
1027 sPRIfldbl=''
1028 sPRIgldbl=''
1029 sSCNfldbl=''
1030 lseeksize=''
1031 lseektype=''
1032 mad=''
1033 madlyh=''
1034 madlyobj=''
1035 madlysrc=''
1036 make_set_make=''
1037 d_mymalloc=''
1038 freetype=''
1039 mallocobj=''
1040 mallocsrc=''
1041 malloctype=''
1042 usemallocwrap=''
1043 usemymalloc=''
1044 installman1dir=''
1045 man1dir=''
1046 man1direxp=''
1047 man1ext=''
1048 installman3dir=''
1049 man3dir=''
1050 man3direxp=''
1051 man3ext=''
1052 modetype=''
1053 multiarch=''
1054 mydomain=''
1055 myhostname=''
1056 phostname=''
1057 c=''
1058 n=''
1059 d_eofnblk=''
1060 eagain=''
1061 o_nonblock=''
1062 rd_nodata=''
1063 need_va_copy=''
1064 netdb_hlen_type=''
1065 netdb_host_type=''
1066 netdb_name_type=''
1067 netdb_net_type=''
1068 groupcat=''
1069 hostcat=''
1070 passcat=''
1071 orderlib=''
1072 ranlib=''
1073 d_perl_otherlibdirs=''
1074 otherlibdirs=''
1075 package=''
1076 spackage=''
1077 pager=''
1078 api_revision=''
1079 api_subversion=''
1080 api_version=''
1081 api_versionstring=''
1082 patchlevel=''
1083 perl_patchlevel=''
1084 revision=''
1085 subversion=''
1086 version=''
1087 version_patchlevel_string=''
1088 perl5=''
1089 perladmin=''
1090 perlpath=''
1091 d_nv_preserves_uv=''
1092 d_nv_zero_is_allbits_zero=''
1093 i16size=''
1094 i16type=''
1095 i32size=''
1096 i32type=''
1097 i64size=''
1098 i64type=''
1099 i8size=''
1100 i8type=''
1101 ivsize=''
1102 ivtype=''
1103 nv_overflows_integers_at=''
1104 nv_preserves_uv_bits=''
1105 nvsize=''
1106 nvtype=''
1107 u16size=''
1108 u16type=''
1109 u32size=''
1110 u32type=''
1111 u64size=''
1112 u64type=''
1113 u8size=''
1114 u8type=''
1115 uvsize=''
1116 uvtype=''
1117 ivdformat=''
1118 nvEUformat=''
1119 nvFUformat=''
1120 nvGUformat=''
1121 nveformat=''
1122 nvfformat=''
1123 nvgformat=''
1124 uvXUformat=''
1125 uvoformat=''
1126 uvuformat=''
1127 uvxformat=''
1128 pidtype=''
1129 prefix=''
1130 prefixexp=''
1131 installprivlib=''
1132 privlib=''
1133 privlibexp=''
1134 prototype=''
1135 ptrsize=''
1136 d_PRIXU64=''
1137 d_PRId64=''
1138 d_PRIi64=''
1139 d_PRIo64=''
1140 d_PRIu64=''
1141 d_PRIx64=''
1142 sPRIXU64=''
1143 sPRId64=''
1144 sPRIi64=''
1145 sPRIo64=''
1146 sPRIu64=''
1147 sPRIx64=''
1148 d_quad=''
1149 quadkind=''
1150 quadtype=''
1151 uquadtype=''
1152 drand01=''
1153 randbits=''
1154 randfunc=''
1155 randseedtype=''
1156 seedfunc=''
1157 installscript=''
1158 scriptdir=''
1159 scriptdirexp=''
1160 selectminbits=''
1161 selecttype=''
1162 sh=''
1163 sig_count=''
1164 sig_name=''
1165 sig_name_init=''
1166 sig_num=''
1167 sig_num_init=''
1168 sig_size=''
1169 d_sitearch=''
1170 installsitearch=''
1171 sitearch=''
1172 sitearchexp=''
1173 installsitebin=''
1174 sitebin=''
1175 sitebinexp=''
1176 installsitehtml1dir=''
1177 sitehtml1dir=''
1178 sitehtml1direxp=''
1179 installsitehtml3dir=''
1180 sitehtml3dir=''
1181 sitehtml3direxp=''
1182 installsitelib=''
1183 sitelib=''
1184 sitelib_stem=''
1185 sitelibexp=''
1186 installsiteman1dir=''
1187 siteman1dir=''
1188 siteman1direxp=''
1189 installsiteman3dir=''
1190 siteman3dir=''
1191 siteman3direxp=''
1192 siteprefix=''
1193 siteprefixexp=''
1194 installsitescript=''
1195 sitescript=''
1196 sitescriptexp=''
1197 sizesize=''
1198 sizetype=''
1199 so=''
1200 socksizetype=''
1201 sharpbang=''
1202 shsharp=''
1203 spitshell=''
1204 src=''
1205 ssizetype=''
1206 st_ino_sign=''
1207 st_ino_size=''
1208 startperl=''
1209 startsh=''
1210 stdchar=''
1211 d_stdio_stream_array=''
1212 stdio_stream_array=''
1213 sysman=''
1214 sGMTIME_max=''
1215 sGMTIME_min=''
1216 sLOCALTIME_max=''
1217 sLOCALTIME_min=''
1218 trnl=''
1219 uidformat=''
1220 uidsign=''
1221 uidsize=''
1222 uidtype=''
1223 archname64=''
1224 use64bitall=''
1225 use64bitint=''
1226 dtrace=''
1227 usedtrace=''
1228 usefaststdio=''
1229 usekernprocpathname=''
1230 ccflags_uselargefiles=''
1231 ldflags_uselargefiles=''
1232 libswanted_uselargefiles=''
1233 uselargefiles=''
1234 uselongdouble=''
1235 usemorebits=''
1236 usemultiplicity=''
1237 nm_opt=''
1238 nm_so_opt=''
1239 runnm=''
1240 usenm=''
1241 usensgetexecutablepath=''
1242 useperlio=''
1243 usesocks=''
1244 d_oldpthreads=''
1245 use5005threads=''
1246 useithreads=''
1247 usereentrant=''
1248 usethreads=''
1249 incpath=''
1250 mips_type=''
1251 usrinc=''
1252 vaproto=''
1253 d_vendorarch=''
1254 installvendorarch=''
1255 vendorarch=''
1256 vendorarchexp=''
1257 d_vendorbin=''
1258 installvendorbin=''
1259 vendorbin=''
1260 vendorbinexp=''
1261 installvendorhtml1dir=''
1262 vendorhtml1dir=''
1263 vendorhtml1direxp=''
1264 installvendorhtml3dir=''
1265 vendorhtml3dir=''
1266 vendorhtml3direxp=''
1267 d_vendorlib=''
1268 installvendorlib=''
1269 vendorlib=''
1270 vendorlib_stem=''
1271 vendorlibexp=''
1272 installvendorman1dir=''
1273 vendorman1dir=''
1274 vendorman1direxp=''
1275 installvendorman3dir=''
1276 vendorman3dir=''
1277 vendorman3direxp=''
1278 usevendorprefix=''
1279 vendorprefix=''
1280 vendorprefixexp=''
1281 d_vendorscript=''
1282 installvendorscript=''
1283 vendorscript=''
1284 vendorscriptexp=''
1285 versiononly=''
1286 defvoidused=''
1287 voidflags=''
1288 yacc=''
1289 yaccflags=''
1290 CONFIG=''
1291
1292 : Detect odd OSs
1293 define='define'
1294 undef='undef'
1295 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1296 rmlist=''
1297
1298 : We must find out about Eunice early
1299 eunicefix=':'
1300 if test -f /etc/unixtovms; then
1301         eunicefix=/etc/unixtovms
1302 fi
1303 if test -f /etc/unixtovms.exe; then
1304         eunicefix=/etc/unixtovms.exe
1305 fi
1306
1307 : Set executable suffix now -- needed before hints available
1308 if test -f "/libs/version.library"; then
1309 : Amiga OS
1310     _exe=""
1311 elif test -f "/system/gnu_library/bin/ar.pm"; then
1312 : Stratus VOS
1313     _exe=".pm"
1314 elif test -n "$DJGPP"; then
1315 : DOS DJGPP
1316     _exe=".exe"
1317 elif test -d c:/. -o -n "$is_os2" ; then
1318 : OS/2 or cygwin
1319     _exe=".exe"
1320 fi
1321
1322 groupstype=''
1323 i_whoami=''
1324 : Trailing extension.  Override this in a hint file, if needed.
1325 : Extra object files, if any, needed on this platform.
1326 archobjs=''
1327 archname=''
1328 : Possible local include directories to search.
1329 : Set locincpth to "" in a hint file to defeat local include searches.
1330 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1331 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1332 :
1333 : no include file wanted by default
1334 inclwanted=''
1335
1336 : Enable -DEBUGGING and -DDEBUGGING from the command line
1337 EBUGGING=''
1338 DEBUGGING=''
1339
1340 libnames=''
1341 : change the next line if compiling for Xenix/286 on Xenix/386
1342 xlibpth='/usr/lib/386 /lib/386'
1343 : Possible local library directories to search.
1344 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1345 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1346
1347 : general looking path for locating libraries
1348 glibpth="/lib /usr/lib $xlibpth"
1349 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1350 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1351 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1352 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1353
1354 : Private path used by Configure to find libraries.  Its value
1355 : is prepended to libpth. This variable takes care of special
1356 : machines, like the mips.  Usually, it should be empty.
1357 plibpth=''
1358
1359 : default library list
1360 libswanted=''
1361 : some systems want to use only the non-versioned libso:s
1362 ignore_versioned_solibs=''
1363 : set usethreads on the Configure command line to enable threads.
1364 usereentrant='undef'
1365 : full support for void wanted by default
1366 defvoidused=15
1367
1368 ccname=''
1369 ccversion=''
1370 perllibs=''
1371 : set useposix=false in your hint file to disable the POSIX extension.
1372 useposix=true
1373 : set useopcode=false in your hint file to disable the Opcode extension.
1374 useopcode=true
1375 archname64=''
1376 ccflags_uselargefiles=''
1377 ldflags_uselargefiles=''
1378 libswanted_uselargefiles=''
1379 : set usemultiplicity on the Configure command line to enable multiplicity.
1380 : set usesocks on the Configure command line to enable socks.
1381 : List of libraries we want.
1382 : If anyone needs extra -lxxx, put those in a hint file.
1383 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1384 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1385 : We probably want to search /usr/shlib before most other libraries.
1386 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1387 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1388 glibpth="/usr/shlib $glibpth"
1389 : Do not use vfork unless overridden by a hint file.
1390 usevfork=false
1391
1392 : Find the basic shell for Bourne shell scripts
1393 case "$sh" in
1394 '')
1395         case "$SYSTYPE" in
1396         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1397         *) xxx='/bin/sh';;
1398         esac
1399         if test -f "$xxx"; then
1400                 sh="$xxx"
1401         else
1402                 : Build up a list and do a single loop so we can 'break' out.
1403                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1404                 for xxx in sh bash ksh pdksh ash; do
1405                         for p in $pth; do
1406                                 try="$try ${p}/${xxx}"
1407                         done
1408                 done
1409                 for xxx in $try; do
1410                         if test -f "$xxx"; then
1411                                 sh="$xxx";
1412                                 break
1413                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1414                                 sh="$xxx";
1415                                 break
1416                         elif test -f "$xxx.exe"; then
1417                                 sh="$xxx";
1418                                 break
1419                         fi
1420                 done
1421         fi
1422         ;;
1423 esac
1424
1425 case "$sh" in
1426 '')     cat >&2 <<EOM
1427 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1428
1429 Usually it's in /bin/sh.  How did you even get this far?
1430 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1431 we'll try to straighten this all out.
1432 EOM
1433         exit 1
1434         ;;
1435 esac
1436
1437 : see if sh knows # comments
1438 if `$sh -c '#' >/dev/null 2>&1`; then
1439         shsharp=true
1440         spitshell=cat
1441         xcat=/bin/cat
1442         test -f $xcat$_exe || xcat=/usr/bin/cat
1443         if test ! -f $xcat$_exe; then
1444                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1445                         if test -f $p/cat$_exe; then
1446                                 xcat=$p/cat
1447                                 break
1448                         fi
1449                 done
1450                 if test ! -f $xcat$_exe; then
1451                         echo "Can't find cat anywhere!"
1452                         exit 1
1453                 fi
1454         fi
1455         echo "#!$xcat" >sharp
1456         $eunicefix sharp
1457         chmod +x sharp
1458         ./sharp > today 2>/dev/null
1459         if test -s today; then
1460                 sharpbang='#!'
1461         else
1462                 echo "#! $xcat" > sharp
1463                 $eunicefix sharp
1464                 chmod +x sharp
1465                 ./sharp > today 2>/dev/null
1466                 if test -s today; then
1467                         sharpbang='#! '
1468                 else
1469                         sharpbang=': use '
1470                 fi
1471         fi
1472 else
1473         echo " "
1474         echo "Your $sh doesn't grok # comments--I will strip them later on."
1475         shsharp=false
1476         cd ..
1477         echo "exec grep -v '^[  ]*#'" >spitshell
1478         chmod +x spitshell
1479         $eunicefix spitshell
1480         spitshell=`pwd`/spitshell
1481         cd UU
1482         echo "I presume that if # doesn't work, #! won't work either!"
1483         sharpbang=': use '
1484 fi
1485 rm -f sharp today
1486
1487 : figure out how to guarantee sh startup
1488 case "$startsh" in
1489 '') startsh=${sharpbang}${sh} ;;
1490 *)
1491 esac
1492 cat >sharp <<EOSS
1493 $startsh
1494 set abc
1495 test "$?abc" != 1
1496 EOSS
1497
1498 chmod +x sharp
1499 $eunicefix sharp
1500 if ./sharp; then
1501         : echo "Yup, it does."
1502 else
1503         echo "Hmm... '$startsh' does not guarantee sh startup..."
1504         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1505 fi
1506 rm -f sharp
1507
1508 : Save command line options in file UU/cmdline.opt for later use in
1509 : generating config.sh.
1510 cat > cmdline.opt <<EOSH
1511 : Configure command line arguments.
1512 config_arg0='$0'
1513 config_args='$*'
1514 config_argc=$#
1515 EOSH
1516 argn=1
1517 args_exp=''
1518 args_sep=''
1519 for arg in "$@"; do
1520         cat >>cmdline.opt <<EOSH
1521 config_arg$argn='$arg'
1522 EOSH
1523         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1524 $arg
1525 EOC
1526         arg_exp=`cat cmdl.opt`
1527         args_exp="$args_exp$args_sep'$arg_exp'"
1528         argn=`expr $argn + 1`
1529         args_sep=' '
1530 done
1531 rm -f cmdl.opt
1532
1533 : produce awk script to parse command line options
1534 cat >options.awk <<'EOF'
1535 BEGIN {
1536         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1537
1538         len = length(optstr);
1539         for (i = 1; i <= len; i++) {
1540                 c = substr(optstr, i, 1);
1541                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1542                 if (a == ":") {
1543                         arg[c] = 1;
1544                         i++;
1545                 }
1546                 opt[c] = 1;
1547         }
1548 }
1549 {
1550         expect = 0;
1551         str = $0;
1552         if (substr(str, 1, 1) != "-") {
1553                 printf("'%s'\n", str);
1554                 next;
1555         }
1556         len = length($0);
1557         for (i = 2; i <= len; i++) {
1558                 c = substr(str, i, 1);
1559                 if (!opt[c]) {
1560                         printf("-%s\n", substr(str, i));
1561                         next;
1562                 }
1563                 printf("-%s\n", c);
1564                 if (arg[c]) {
1565                         if (i < len)
1566                                 printf("'%s'\n", substr(str, i + 1));
1567                         else
1568                                 expect = 1;
1569                         next;
1570                 }
1571         }
1572 }
1573 END {
1574         if (expect)
1575                 print "?";
1576 }
1577 EOF
1578
1579 : process the command line options
1580 set X `for arg in "$@"; do echo "X$arg"; done |
1581         sed -e s/X// | awk -f options.awk`
1582 eval "set $*"
1583 shift
1584 rm -f options.awk
1585
1586 : set up default values
1587 fastread=''
1588 reuseval=false
1589 config_sh=''
1590 alldone=''
1591 error=''
1592 silent=''
1593 extractsh=''
1594 override=''
1595 knowitall=''
1596 rm -f optdef.sh posthint.sh
1597 cat >optdef.sh <<EOS
1598 $startsh
1599 EOS
1600
1601
1602 : option parsing
1603 while test $# -gt 0; do
1604         case "$1" in
1605         -d) shift; fastread=yes;;
1606         -e) shift; alldone=cont;;
1607         -f)
1608                 shift
1609                 cd ..
1610                 if test -r "$1"; then
1611                         config_sh="$1"
1612                 else
1613                         echo "$me: cannot read config file $1." >&2
1614                         error=true
1615                 fi
1616                 cd UU
1617                 shift;;
1618         --help|\
1619         -h) shift; error=true;;
1620         -r) shift; reuseval=true;;
1621         -s) shift; silent=true; realsilent=true;;
1622         -E) shift; alldone=exit;;
1623         -K) shift; knowitall=true;;
1624         -O) shift; override=true;;
1625         -S) shift; silent=true; extractsh=true;;
1626         -D)
1627                 shift
1628                 case "$1" in
1629                 *=)
1630                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1631                         echo "$me: ignoring -D $1" >&2
1632                         ;;
1633                 *=*) echo "$1" | \
1634                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1635                 *) echo "$1='define'" >> optdef.sh;;
1636                 esac
1637                 shift
1638                 ;;
1639         -U)
1640                 shift
1641                 case "$1" in
1642                 *=) echo "$1" >> optdef.sh;;
1643                 *=*)
1644                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1645                         echo "$me: ignoring -U $1" >&2
1646                         ;;
1647                 *) echo "$1='undef'" >> optdef.sh;;
1648                 esac
1649                 shift
1650                 ;;
1651         -A)
1652             shift
1653             xxx=''
1654             yyy="$1"
1655             zzz=''
1656             uuu=undef
1657             case "$yyy" in
1658             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1659                  case "$zzz" in
1660                  *:*) zzz='' ;;
1661                  *)   xxx=append
1662                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1663                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1664                  esac
1665                  ;;
1666             esac
1667             case "$xxx" in
1668             '')  case "$yyy" in
1669                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1670                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1671                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1672                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1673                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1674                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1675                  esac
1676                  ;;
1677             esac
1678             case "$xxx" in
1679             append)
1680                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1681             clear)
1682                 echo "$yyy=''"                  >> posthint.sh ;;
1683             define)
1684                 case "$zzz" in
1685                 '') zzz=define ;;
1686                 esac
1687                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1688             eval)
1689                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1690             prepend)
1691                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1692             undef)
1693                 case "$zzz" in
1694                 '') zzz="$uuu" ;;
1695                 esac
1696                 echo "$yyy=$zzz"                >> posthint.sh ;;
1697             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1698             esac
1699             shift
1700             ;;
1701         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1702             exit 0;;
1703         --) break;;
1704         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1705         *) break;;
1706         esac
1707 done
1708
1709 case "$error" in
1710 true)
1711         cat >&2 <<EOM
1712 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1713                  [-U symbol] [-U symbol=] [-A command:symbol...]
1714   -d : use defaults for all answers.
1715   -e : go on without questioning past the production of config.sh.
1716   -f : specify an alternate default configuration file.
1717   -h : print this help message and exit (with an error status).
1718   -r : reuse C symbols value if possible (skips costly nm extraction).
1719   -s : silent mode, only echoes questions and essential information.
1720   -D : define symbol to have some value:
1721          -D symbol         symbol gets the value 'define'
1722          -D symbol=value   symbol gets the value 'value'
1723        common used examples (see INSTALL for more info):
1724          -Duse64bitint            use 64bit integers
1725          -Duse64bitall            use 64bit integers and pointers
1726          -Dusethreads             use thread support
1727          -Dinc_version_list=none  do not include older perl trees in @INC
1728          -DEBUGGING=none          DEBUGGING options
1729          -Dcc=gcc                 choose your compiler
1730          -Dprefix=/opt/perl5      choose your destination
1731   -E : stop at the end of questions, after having produced config.sh.
1732   -K : do not use unless you know what you are doing.
1733   -O : let -D and -U override definitions from loaded configuration file.
1734   -S : perform variable substitutions on all .SH files (can mix with -f)
1735   -U : undefine symbol:
1736          -U symbol    symbol gets the value 'undef'
1737          -U symbol=   symbol gets completely empty
1738        e.g.:  -Uversiononly
1739   -A : manipulate symbol after the platform specific hints have been applied:
1740          -A append:symbol=value   append value to symbol
1741          -A symbol=value          like append:, but with a separating space
1742          -A define:symbol=value   define symbol to have value
1743          -A clear:symbol          define symbol to be ''
1744          -A define:symbol         define symbol to be 'define'
1745          -A eval:symbol=value     define symbol to be eval of value
1746          -A prepend:symbol=value  prepend value to symbol
1747          -A undef:symbol          define symbol to be 'undef'
1748          -A undef:symbol=         define symbol to be ''
1749        e.g.:  -A prepend:libswanted='cl pthread '
1750               -A ccflags=-DSOME_MACRO
1751   -V : print version number and exit (with a zero status).
1752 EOM
1753         exit 1
1754         ;;
1755 esac
1756
1757 : Sanity checks
1758 case "$fastread$alldone" in
1759 yescont|yesexit) ;;
1760 *)
1761         case "$extractsh" in
1762         true) ;;
1763         *)
1764                 if test ! -t 0; then
1765                         echo "Say 'sh Configure', not 'sh <Configure'"
1766                         exit 1
1767                 fi
1768                 ;;
1769         esac
1770         ;;
1771 esac
1772
1773 exec 4>&1
1774 case "$silent" in
1775 true) exec 1>/dev/null;;
1776 esac
1777
1778 : run the defines and the undefines, if any, but leave the file out there...
1779 touch optdef.sh
1780 . ./optdef.sh
1781 : create the posthint manipulation script and leave the file out there...
1782 touch posthint.sh
1783
1784 : set package name
1785 package='perl5'
1786 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1787 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1788 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1789 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1790 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1791 esac
1792
1793 : Some greps do not return status, grrr.
1794 echo "grimblepritz" >grimble
1795 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1796         contains=contains
1797 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1798         contains=grep
1799 else
1800         contains=contains
1801 fi
1802 rm -f grimble
1803 : the following should work in any shell
1804 case "$contains" in
1805 contains*)
1806         echo " "
1807         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1808         cat >contains <<'EOSS'
1809 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1810 EOSS
1811 chmod +x contains
1812 esac
1813
1814 : Find the path to the source tree
1815 case "$src" in
1816 '') case "$0" in
1817     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1818          case "$src" in
1819          /*)    ;;
1820          .)     ;;
1821          *)     src=`cd ../$src && pwd` ;;
1822          esac
1823          ;;
1824     *)   src='.';;
1825     esac;;
1826 esac
1827 case "$src" in
1828 '')     src=/
1829         rsrc=/
1830         ;;
1831 /*)     rsrc="$src";;
1832 *)      rsrc="../$src";;
1833 esac
1834 if test -f $rsrc/Configure && \
1835         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1836 then
1837    : found it, so we are ok.
1838 else
1839         rsrc=''
1840         for src in . .. ../.. ../../.. ../../../..; do
1841                 if test -f ../$src/Configure && \
1842                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1843                 then
1844                         rsrc=../$src
1845                         break
1846                 fi
1847         done
1848 fi
1849 case "$rsrc" in
1850 '')
1851         cat <<EOM >&4
1852
1853 Sorry, I can't seem to locate the source dir for $package.  Please start
1854 Configure with an explicit path -- i.e. /some/path/Configure.
1855
1856 EOM
1857         exit 1
1858         ;;
1859 ../.)   rsrc='..';;
1860 *)
1861         echo " "
1862         echo "Sources for $package found in \"$src\"." >&4
1863         ;;
1864 esac
1865
1866 : script used to extract .SH files with variable substitutions
1867 cat >extract <<'EOS'
1868 PERL_CONFIG_SH=true
1869 echo "Doing variable substitutions on .SH files..."
1870 if test -f MANIFEST; then
1871         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1872 else
1873         echo "(Looking for .SH files under the source directory.)"
1874         set x `(cd "$src"; find . -name "*.SH" -print)`
1875 fi
1876 shift
1877 case $# in
1878 0) set x `(cd "$src"; echo *.SH)`; shift;;
1879 esac
1880 if test ! -f "$src/$1"; then
1881         shift
1882 fi
1883 mkdir_p='
1884 name=$1;
1885 create="";
1886 while test $name; do
1887         if test ! -d "$name"; then
1888                 create="$name $create";
1889                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1890                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1891         else
1892                 name="";
1893         fi;
1894 done;
1895 for file in $create; do
1896         mkdir $file;
1897 done
1898 '
1899 for file in $*; do
1900         case "$src" in
1901         ".")
1902                 case "$file" in
1903                 */*)
1904                         dir=`expr X$file : 'X\(.*\)/'`
1905                         file=`expr X$file : 'X.*/\(.*\)'`
1906                         (cd "$dir" && . ./$file)
1907                         ;;
1908                 *)
1909                         . ./$file
1910                         ;;
1911                 esac
1912                 ;;
1913         *)
1914                 case "$file" in
1915                 */*)
1916                         dir=`expr X$file : 'X\(.*\)/'`
1917                         file=`expr X$file : 'X.*/\(.*\)'`
1918                         (set x $dir; shift; eval $mkdir_p)
1919                         sh <"$src/$dir/$file"
1920                         ;;
1921                 *)
1922                         sh <"$src/$file"
1923                         ;;
1924                 esac
1925                 ;;
1926         esac
1927 done
1928 if test -f "$src/config_h.SH"; then
1929         if test ! -f config.h; then
1930         : oops, they left it out of MANIFEST, probably, so do it anyway.
1931         . "$src/config_h.SH"
1932         fi
1933 fi
1934 EOS
1935
1936 : extract files and exit if asked to do so
1937 case "$extractsh" in
1938 true)
1939         case "$realsilent" in
1940         true) ;;
1941         *) exec 1>&4;;
1942         esac
1943         case "$config_sh" in
1944         '') config_sh='config.sh';;
1945         esac
1946         echo " "
1947         echo "Fetching answers from $config_sh..."
1948         cd ..
1949         . $config_sh
1950         test "$override" && . ./optdef.sh
1951         echo " "
1952         . UU/extract
1953         rm -rf UU
1954         echo "Extraction done."
1955         exit 0
1956         ;;
1957 esac
1958
1959 : Eunice requires " " instead of "", can you believe it
1960 echo " "
1961 : Here we go...
1962 echo "Beginning of configuration questions for $package."
1963
1964 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1965
1966 : first determine how to suppress newline on echo command
1967 echo " "
1968 echo "Checking echo to see how to suppress newlines..."
1969 (echo "hi there\c" ; echo " ") >.echotmp
1970 if $contains c .echotmp >/dev/null 2>&1 ; then
1971         echo "...using -n."
1972         n='-n'
1973         c=''
1974 else
1975         cat <<'EOM'
1976 ...using \c
1977 EOM
1978         n=''
1979         c='\c'
1980 fi
1981 echo $n "The star should be here-->$c"
1982 echo '*'
1983 rm -f .echotmp
1984
1985 : Now test for existence of everything in MANIFEST
1986 echo " "
1987 if test -f "$rsrc/MANIFEST"; then
1988         echo "First let's make sure your kit is complete.  Checking..." >&4
1989         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1990                 (split -l 50 2>/dev/null || split -50)
1991         rm -f missing
1992         tmppwd=`pwd`
1993         for filelist in x??; do
1994                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1995                         >/dev/null 2>>"$tmppwd/missing")
1996         done
1997         if test -s missing; then
1998                 cat missing >&4
1999                 cat >&4 <<'EOM'
2000
2001 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2002
2003 You have the option of continuing the configuration process, despite the
2004 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2005 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2006 and contact the author (perlbug@perl.org).
2007
2008 EOM
2009                 echo $n "Continue? [n] $c" >&4
2010                 read ans
2011                 case "$ans" in
2012                 y*)
2013                         echo "Continuing..." >&4
2014                         rm -f missing
2015                         ;;
2016                 *)
2017                         echo "ABORTING..." >&4
2018                         kill $$
2019                         ;;
2020                 esac
2021         else
2022                 echo "Looks good..."
2023         fi
2024 else
2025         echo "There is no MANIFEST file.  I hope your kit is complete !"
2026 fi
2027 rm -f missing x??
2028
2029 : Find the appropriate value for a newline for tr
2030 echo " "
2031 if test -n "$DJGPP"; then
2032        trnl='\012'
2033 fi
2034 if test X"$trnl" = X; then
2035         case "`echo foo|tr '\n' x 2>/dev/null`" in
2036         foox) trnl='\n' ;;
2037         esac
2038 fi
2039 if test X"$trnl" = X; then
2040         case "`echo foo|tr '\012' x 2>/dev/null`" in
2041         foox) trnl='\012' ;;
2042         esac
2043 fi
2044 if test X"$trnl" = X; then
2045        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2046        fooxy) trnl='\n\r' ;;
2047        esac
2048 fi
2049 if test X"$trnl" = X; then
2050         cat <<EOM >&2
2051
2052 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2053
2054 EOM
2055         exit 1
2056 fi
2057
2058 : compute the number of columns on the terminal for proper question formatting
2059 case "$COLUMNS" in
2060 '') COLUMNS='80';;
2061 esac
2062
2063 : set up the echo used in my read
2064 myecho="case \"\$xxxm\" in
2065 '') echo $n \"\$rp $c\" >&4;;
2066 *) case \"\$rp\" in
2067         '') echo $n \"[\$xxxm] $c\";;
2068         *)
2069                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2070                         echo \"\$rp\" >&4
2071                         echo $n \"[\$xxxm] $c\" >&4
2072                 else
2073                         echo $n \"\$rp [\$xxxm] $c\" >&4
2074                 fi
2075                 ;;
2076         esac;;
2077 esac"
2078
2079 : now set up to do reads with possible shell escape and default assignment
2080 cat <<EOSC >myread
2081 $startsh
2082 xxxm=\$dflt
2083 $myecho
2084 ans='!'
2085 case "\$fastread" in
2086 yes) case "\$dflt" in
2087         '') ;;
2088         *) ans='';
2089                 case "\$silent-\$rp" in
2090                 true-) ;;
2091                 *) echo " " >&4;;
2092                 esac;;
2093         esac;;
2094 *) case "\$silent" in
2095         true) case "\$rp" in
2096                 '') ans='';;
2097                 esac;;
2098         esac;;
2099 esac
2100 while expr "X\$ans" : "X!" >/dev/null; do
2101         read answ
2102         set x \$xxxm
2103         shift
2104         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2105         case  "\$answ" in
2106         "!")
2107                 sh 1>&4
2108                 echo " "
2109                 $myecho
2110                 ;;
2111         !*)
2112                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2113                 shift
2114                 sh 1>&4 -c "\$*"
2115                 echo " "
2116                 $myecho
2117                 ;;
2118         "\$ans")
2119                 case "\$ans" in
2120                 \\&*)
2121                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2122                         shift
2123                         case "\$1" in
2124                         -d)
2125                                 fastread=yes
2126                                 echo "(OK, I'll run with -d after this question.)" >&4
2127                                 ;;
2128                         -*)
2129                                 echo "*** Sorry, \$1 not supported yet." >&4
2130                                 ;;
2131                         esac
2132                         $myecho
2133                         ans=!
2134                         ;;
2135                 esac;;
2136         *)
2137                 case "\$aok" in
2138                 y)
2139                         echo "*** Substitution done -- please confirm."
2140                         xxxm="\$ans"
2141                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2142                         xxxm="\$ans"
2143                         ans=!
2144                         ;;
2145                 *)
2146                         echo "*** Error -- try again."
2147                         ans=!
2148                         ;;
2149                 esac
2150                 $myecho
2151                 ;;
2152         esac
2153         case "\$ans\$xxxm\$nostick" in
2154         '')
2155                 ans=!
2156                 $myecho
2157                 ;;
2158         esac
2159 done
2160 case "\$ans" in
2161 '') ans="\$xxxm";;
2162 esac
2163 EOSC
2164
2165 : create .config dir to save info across Configure sessions
2166 test -d ../.config || mkdir ../.config
2167 cat >../.config/README <<EOF
2168 This directory created by Configure to save information that should
2169 persist across sessions for $package.
2170
2171 You may safely delete it if you wish.
2172 EOF
2173
2174 : See if we are using a devel version and want that
2175 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2176 case "$usedevel" in
2177 $define|true|[yY]*)
2178     usedevel="$define" ;;
2179 *) case "$xversion" in
2180    *[13579])
2181         cat >&4 <<EOH
2182 *** WHOA THERE!!! ***
2183
2184     This is an UNSTABLE DEVELOPMENT release.
2185     The version of this $package distribution is $xversion, that is, odd,
2186     (as opposed to even) and that signifies a development release.
2187     If you want a maintenance release, you want an even-numbered version.
2188
2189     Do ***NOT*** install this into production use.
2190     Data corruption and crashes are possible.
2191
2192     It is most seriously suggested that you do not continue any further
2193     unless you want to help in developing and debugging Perl.
2194
2195     If you *still* want to build perl, you can answer 'y' now,
2196     or pass -Dusedevel to Configure.
2197
2198 EOH
2199         rp='Do you really want to continue?'
2200         dflt='n'
2201         . ./myread
2202         case "$ans" in
2203         [yY]) echo >&4 "Okay, continuing."
2204               usedevel="$define" ;;
2205         *) echo >&4 "Okay, bye."
2206            exit 1
2207            ;;
2208         esac
2209         ;;
2210     esac
2211     usedevel="$undef"
2212     ;;
2213 esac
2214 case "$usedevel" in
2215 $define|true|[yY]*)
2216         case "$versiononly" in
2217         '') versiononly="$define" ;;
2218         esac
2219         case "$installusrbinperl" in
2220         '') installusrbinperl="$undef" ;;
2221         esac
2222         ;;
2223 esac
2224
2225 : general instructions
2226 needman=true
2227 firsttime=true
2228 user=`(logname) 2>/dev/null`
2229 case "$user" in
2230 '') user=`whoami 2>&1`;;
2231 esac
2232 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2233         firsttime=false
2234         echo " "
2235         rp='Would you like to see the instructions?'
2236         dflt=n
2237         . ./myread
2238         case "$ans" in
2239         [yY]*) ;;
2240         *) needman=false;;
2241         esac
2242 fi
2243 if $needman; then
2244         cat <<EOH
2245
2246 This installation shell script will examine your system and ask you questions
2247 to determine how the perl5 package should be installed. If you get
2248 stuck on a question, you may use a ! shell escape to start a subshell or
2249 execute a command.  Many of the questions will have default answers in square
2250 brackets; typing carriage return will give you the default.
2251
2252 On some of the questions which ask for file or directory names you are allowed
2253 to use the ~name construct to specify the login directory belonging to "name",
2254 even if you don't have a shell which knows about that.  Questions where this is
2255 allowed will be marked "(~name ok)".
2256
2257 EOH
2258         rp=''
2259         dflt='Type carriage return to continue'
2260         . ./myread
2261         cat <<'EOH'
2262
2263 The prompter used in this script allows you to use shell variables and
2264 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2265 in the default answer, as if the default line was a set of arguments given to a
2266 script shell.  This means you may also use $* to repeat the whole default line,
2267 so you do not have to re-type everything to add something to the default.
2268
2269 Every time there is a substitution, you will have to confirm.  If there is an
2270 error (e.g. an unmatched backtick), the default answer will remain unchanged
2271 and you will be prompted again.
2272
2273 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2274 the questions and use the computed defaults (or the previous answers if there
2275 was already a config.sh file). Type 'Configure -h' for a list of options.
2276 You may also start interactively and then answer '& -d' at any prompt to turn
2277 on the non-interactive behaviour for the remainder of the execution.
2278
2279 EOH
2280         . ./myread
2281         cat <<EOH
2282
2283 Much effort has been expended to ensure that this shell script will run on any
2284 Unix system.  If despite that it blows up on yours, your best bet is to edit
2285 Configure and run it again.  If you can't run Configure for some reason,
2286 you'll have to generate a config.sh file by hand.  Whatever problems you
2287 have, let me (perlbug@perl.org) know how I blew it.
2288
2289 This installation script affects things in two ways:
2290
2291 1) it may do direct variable substitutions on some of the files included
2292    in this kit.
2293 2) it builds a config.h file for inclusion in C programs.  You may edit
2294    any of these files as the need arises after running this script.
2295
2296 If you make a mistake on a question, there is no easy way to back up to it
2297 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2298 files.  Configure will offer to let you do this before it runs the SH files.
2299
2300 EOH
2301         dflt='Type carriage return to continue'
2302         . ./myread
2303         case "$firsttime" in
2304         true) echo $user >>../.config/instruct;;
2305         esac
2306 fi
2307
2308 : find out where common programs are
2309 echo " "
2310 echo "Locating common programs..." >&4
2311 cat <<EOSC >loc
2312 $startsh
2313 case \$# in
2314 0) exit 1;;
2315 esac
2316 thing=\$1
2317 shift
2318 dflt=\$1
2319 shift
2320 for dir in \$*; do
2321         case "\$thing" in
2322         .)
2323         if test -d \$dir/\$thing; then
2324                 echo \$dir
2325                 exit 0
2326         fi
2327         ;;
2328         *)
2329         for thisthing in \$dir/\$thing; do
2330                 : just loop through to pick last item
2331         done
2332         if test -f \$thisthing; then
2333                 echo \$thisthing
2334                 exit 0
2335         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2336                 echo \$thisthing
2337                 exit 0
2338         elif test -f \$dir/\$thing.exe; then
2339                 if test -n "$DJGPP"; then
2340                         echo \$dir/\$thing.exe
2341                 elif test "$eunicefix" != ":"; then
2342                         : on Eunice apparently
2343                         echo \$dir/\$thing
2344                 fi
2345                 exit 0
2346         fi
2347         ;;
2348         esac
2349 done
2350 echo \$dflt
2351 exit 1
2352 EOSC
2353 chmod +x loc
2354 $eunicefix loc
2355 loclist="
2356 awk
2357 cat
2358 chmod
2359 comm
2360 cp
2361 echo
2362 expr
2363 grep
2364 ls
2365 mkdir
2366 rm
2367 sed
2368 sort
2369 touch
2370 tr
2371 uniq
2372 "
2373 trylist="
2374 ar
2375 bison
2376 byacc
2377 cpp
2378 csh
2379 date
2380 egrep
2381 gmake
2382 gzip
2383 less
2384 ln
2385 make
2386 more
2387 nm
2388 nroff
2389 perl
2390 pg
2391 test
2392 uname
2393 zip
2394 "
2395 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2396 pth="$pth /lib /usr/lib"
2397 for file in $loclist; do
2398         eval xxx=\$$file
2399         case "$xxx" in
2400         /*|?:[\\/]*)
2401                 if test -f "$xxx"; then
2402                         : ok
2403                 else
2404                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2405                         xxx=`./loc $file $file $pth`
2406                 fi
2407                 ;;
2408         '') xxx=`./loc $file $file $pth`;;
2409         *) xxx=`./loc $xxx $xxx $pth`;;
2410         esac
2411         eval $file=$xxx$_exe
2412         eval _$file=$xxx
2413         case "$xxx" in
2414         /*)
2415                 echo $file is in $xxx.
2416                 ;;
2417         ?:[\\/]*)
2418                 echo $file is in $xxx.
2419                 ;;
2420         *)
2421                 echo "I don't know where '$file' is, and my life depends on it." >&4
2422                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2423                 exit 1
2424                 ;;
2425         esac
2426 done
2427 echo " "
2428 echo "Don't worry if any of the following aren't found..."
2429 say=offhand
2430 for file in $trylist; do
2431         eval xxx=\$$file
2432         case "$xxx" in
2433         /*|?:[\\/]*)
2434                 if test -f "$xxx"; then
2435                         : ok
2436                 else
2437                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2438                         xxx=`./loc $file $file $pth`
2439                 fi
2440                 ;;
2441         '') xxx=`./loc $file $file $pth`;;
2442         *) xxx=`./loc $xxx $xxx $pth`;;
2443         esac
2444         eval $file=$xxx$_exe
2445         eval _$file=$xxx
2446         case "$xxx" in
2447         /*)
2448                 echo $file is in $xxx.
2449                 ;;
2450         ?:[\\/]*)
2451                 echo $file is in $xxx.
2452                 ;;
2453         *)
2454                 echo "I don't see $file out there, $say."
2455                 say=either
2456                 ;;
2457         esac
2458 done
2459 case "$egrep" in
2460 egrep)
2461         echo "Substituting grep for egrep."
2462         egrep=$grep
2463         _egrep=$grep
2464         ;;
2465 esac
2466 case "$less" in
2467 '')     ;;
2468 *)      if $less -R </dev/null >/dev/null; then
2469                echo "Substituting less -R for less."
2470                less="$less -R"
2471                _less=$less
2472         fi
2473         ;;
2474 esac
2475 case "$ln" in
2476 ln)
2477         echo "Substituting cp for ln."
2478         ln=$cp
2479         _ln=$cp
2480         ;;
2481 esac
2482 case "$make" in
2483 make)
2484         case "$gmake" in
2485         gmake)
2486         echo "I can't find make or gmake, and my life depends on it." >&4
2487         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2488         exit 1
2489         ;;
2490         esac
2491         ;;
2492 esac
2493 case "$gmake" in
2494 gmake)  ;;
2495 *)      # We can't have osname yet.
2496         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2497                 # Assume that gmake, if found, is definitely GNU make
2498                 # and prefer it over the system make.
2499                 echo "Substituting gmake for make."
2500                 make=$gmake
2501                 _make=$gmake
2502         fi
2503         ;;
2504 esac
2505 case "$test" in
2506 test)
2507         echo "Hopefully test is built into your sh."
2508         ;;
2509 *)
2510         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2511                 echo "Using the test built into your sh."
2512                 test=test
2513                 _test=test
2514         fi
2515         ;;
2516 esac
2517 case "$echo" in
2518 echo)
2519         echo "Hopefully echo is built into your sh."
2520         ;;
2521 '') ;;
2522 *)
2523         echo " "
2524 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2525         $echo $n "hi there$c" >foo1
2526         echo $n "hi there$c" >foo2
2527         if cmp foo1 foo2 >/dev/null 2>&1; then
2528                 echo "They are compatible.  In fact, they may be identical."
2529         else
2530                 case "$n" in
2531                 '-n') n='' c='\c';;
2532                 *) n='-n' c='';;
2533                 esac
2534                 cat <<FOO
2535 They are not compatible!  You are probably running ksh on a non-USG system.
2536 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2537 have echo built in and we may have to run some Bourne shell scripts.  That
2538 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2539
2540 FOO
2541                 $echo $n "The star should be here-->$c"
2542                 $echo "*"
2543         fi
2544         $rm -f foo1 foo2
2545         ;;
2546 esac
2547
2548 # This question was auctioned at YAPC::Europe-2007 in Vienna
2549 # I never promised you could answer it. I only auctioned the question.
2550 cat <<FOO
2551 The following message is sponsored by
2552
2553   Dresden.pm<--The stars should be here.
2554
2555 Dear Perl user, system administrator or package
2556 maintainer, the Perl community sends greetings to
2557 you. Do you (emblematical) greet back [Y/n]? n
2558
2559 FOO
2560
2561 : Check what type of C compiler we use
2562 cat <<EOS >trygcc
2563 $startsh
2564 EOS
2565 cat <<'EOSC' >>trygcc
2566 case "$cc" in
2567 '') ;;
2568 *)  $rm -f try try.*
2569     $cat >try.c <<EOM
2570 int main(int argc, char *argv[]) {
2571   return 0;
2572 }
2573 EOM
2574     if $cc -o try $ccflags $ldflags try.c; then
2575        :
2576     else
2577         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2578         despair=yes
2579         trygcc=yes
2580         case "$cc" in
2581         *gcc*) trygcc=no ;;
2582         esac
2583         # Skip this test because it gives a false match on output like:
2584         #    ./trygcc: line 23: cc: command not found
2585         # case "`$cc -v -c try.c 2>&1`" in
2586         # *gcc*) trygcc=no ;;
2587         # esac
2588         if $test X"$trygcc" = Xyes; then
2589             if gcc -o try -c try.c; then
2590                 echo " "
2591                 echo "You seem to have a working gcc, though." >&4
2592                 # Switching compilers may undo the work of hints files.
2593                 # The most common problem is -D_REENTRANT for threads.
2594                 # This heuristic catches that case, but gets false positives
2595                 # if -Dusethreads was not actually specified.  Better to
2596                 # bail out here with a useful message than fail 
2597                 # mysteriously later. Should we perhaps just try to
2598                 # re-invoke Configure -Dcc=gcc config_args ?
2599                 if $test -f usethreads.cbu; then
2600                         $cat >&4 <<EOM 
2601
2602 *** However, any setting of the C compiler flags (e.g. for thread support)
2603 *** will be lost.  It may be necessary for you to restart Configure and
2604 *** add -Dcc=gcc to your Configure command line.
2605
2606 EOM
2607                         rp="Would you like to go ahead and try gcc anyway?"
2608                         dflt=n
2609                 else
2610                         rp="Would you like to use it?"
2611                         dflt=y
2612                 fi
2613                 if $test -f myread; then
2614                     . ./myread
2615                 else
2616                     if $test -f UU/myread; then
2617                         . ./UU/myread
2618                     else
2619                         echo "Cannot find myread, sorry.  Aborting." >&2
2620                         exit 1
2621                     fi
2622                 fi  
2623                 case "$ans" in
2624                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2625                 esac
2626             fi
2627         fi
2628     fi
2629     $rm -f try try.*
2630     ;;
2631 esac
2632 EOSC
2633
2634 cat <<EOS >checkcc
2635 $startsh
2636 EOS
2637 cat <<'EOSC' >>checkcc
2638 case "$cc" in        
2639 '') ;;
2640 *)  $rm -f try try.*              
2641     $cat >try.c <<EOM
2642 int main(int argc, char *argv[]) {
2643   return 0;
2644 }
2645 EOM
2646     if $cc -o try $ccflags $ldflags try.c; then
2647        :
2648     else
2649         if $test X"$despair" = Xyes; then
2650            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2651         fi
2652         $cat >&4 <<EOM         
2653 You need to find a working C compiler.
2654 Either (purchase and) install the C compiler supplied by your OS vendor,
2655 or for a free C compiler try http://gcc.gnu.org/
2656 I cannot continue any further, aborting.
2657 EOM
2658         exit 1
2659     fi
2660     $rm -f try try.*
2661     ;;
2662 esac
2663 EOSC
2664
2665 : determine whether symbolic links are supported
2666 echo " "
2667 $touch blurfl
2668 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2669         echo "Symbolic links are supported." >&4
2670         lns="$ln -s"
2671 else
2672         echo "Symbolic links are NOT supported." >&4
2673         lns="$ln"
2674 fi
2675 $rm -f blurfl sym
2676
2677 : determine whether symbolic links are supported
2678 echo " "
2679 case "$lns" in
2680 *"ln"*" -s")
2681         echo "Checking how to test for symbolic links..." >&4
2682         $lns blurfl sym
2683         if $test "X$issymlink" = X; then
2684                 case "$newsh" in
2685                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2686                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2687                 esac
2688                 if test $? = 0; then
2689                         issymlink="test -h"
2690                 else
2691                         echo "Your builtin 'test -h' may be broken." >&4
2692                         case "$test" in
2693                         /*)     ;;
2694                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2695                                 for p in $pth
2696                                 do
2697                                         if test -f "$p/$test"; then
2698                                                 test="$p/$test"
2699                                                 break
2700                                         fi
2701                                 done
2702                                 ;;
2703                         esac
2704                         case "$test" in
2705                         /*)
2706                                 echo "Trying external '$test -h'." >&4
2707                                 issymlink="$test -h"
2708                                 if $test ! -h sym >/dev/null 2>&1; then
2709                                         echo "External '$test -h' is broken, too." >&4
2710                                         issymlink=''
2711                                 fi
2712                                 ;;
2713                         *)      issymlink='' ;;
2714                         esac
2715                 fi              
2716         fi
2717         if $test "X$issymlink" = X; then
2718                 if $test -L sym 2>/dev/null; then
2719                         issymlink="$test -L"
2720                         echo "The builtin '$test -L' worked." >&4
2721                 fi
2722         fi
2723         if $test "X$issymlink" != X; then
2724                 echo "You can test for symbolic links with '$issymlink'." >&4
2725         else
2726                 echo "I do not know how you can test for symbolic links." >&4
2727         fi
2728         $rm -f blurfl sym
2729         ;;
2730 *)      echo "No symbolic links, so not testing for their testing..." >&4
2731         ;;
2732 esac
2733 echo " "
2734
2735 : Make symlinks util
2736 case "$mksymlinks" in
2737 $define|true|[yY]*)
2738         case "$src" in
2739         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2740                 exit 1
2741                 ;;
2742         *)      case "$lns:$issymlink" in
2743                 *"ln"*" -s:"*"test -"?)
2744                         echo "Creating the symbolic links..." >&4
2745                         echo "(First creating the subdirectories...)" >&4
2746                         cd ..
2747                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2748                                 read directory
2749                                 test -z "$directory" && break
2750                                 mkdir -p $directory
2751                         done
2752                         # Sanity check 1.
2753                         if test ! -d t/base; then
2754                                 echo "Failed to create the subdirectories.  Aborting." >&4
2755                                 exit 1
2756                         fi
2757                         echo "(Then creating the symlinks...)" >&4
2758                         awk '{print $1}' $src/MANIFEST | while true; do
2759                                 read filename
2760                                 test -z "$filename" && break
2761                                 if test -f $filename; then
2762                                         if $issymlink $filename; then
2763                                                 rm -f $filename
2764                                         fi
2765                                 fi
2766                                 if test -f $filename; then
2767                                         echo "$filename already exists, not symlinking."
2768                                 else
2769                                         ln -s $src/$filename $filename
2770                                 fi
2771                         done
2772                         # Sanity check 2.
2773                         if test ! -f t/base/lex.t; then
2774                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2775                                 exit 1
2776                         fi
2777                         cd UU
2778                         ;;
2779                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2780                         ;;
2781                 esac
2782                 ;;
2783         esac
2784         ;;
2785 esac
2786
2787 : Check for Cross-Compilation
2788 case "$usecrosscompile" in
2789 $define|true|[yY]*)
2790         $echo "Cross-compiling..."
2791         croak=''
2792         case "$cc" in
2793         *-*-gcc) # A cross-compiling gcc, probably.
2794             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2795             ar=$targetarch-ar
2796             # leave out ld, choosing it is more complex
2797             nm=$targetarch-nm
2798             ranlib=$targetarch-ranlib
2799             $echo 'extern int foo;' > try.c
2800             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2801             shift
2802             if $test $# -gt 0; then
2803                 incpth="$incpth $*"
2804                 incpth="`$echo $incpth|$sed 's/^ //'`"
2805                 echo "Guessing incpth '$incpth'." >&4
2806                 for i in $*; do
2807                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2808                     if $test -d $j; then
2809                         libpth="$libpth $j"
2810                     fi
2811                 done   
2812                 libpth="`$echo $libpth|$sed 's/^ //'`"
2813                 echo "Guessing libpth '$libpth'." >&4
2814             fi
2815             $rm -f try.c
2816             ;;
2817         esac
2818         case "$targetarch" in
2819         '') echo "Targetarch not defined." >&4; croak=y ;;
2820         *)  echo "Using targetarch $targetarch." >&4 ;;
2821         esac
2822         case "$incpth" in
2823         '') echo "Incpth not defined." >&4; croak=y ;;
2824         *)  echo "Using incpth '$incpth'." >&4 ;;
2825         esac
2826         case "$libpth" in
2827         '') echo "Libpth not defined." >&4; croak=y ;;
2828         *)  echo "Using libpth '$libpth'." >&4 ;;
2829         esac
2830         case "$usrinc" in
2831         '') for i in $incpth; do
2832                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2833                     usrinc=$i
2834                     echo "Guessing usrinc $usrinc." >&4
2835                     break
2836                 fi
2837             done
2838             case "$usrinc" in
2839             '') echo "Usrinc not defined." >&4; croak=y ;;
2840             esac
2841             ;;
2842         *)  echo "Using usrinc $usrinc." >&4 ;;
2843         esac
2844         case "$targethost" in
2845         '') echo "Targethost not defined." >&4; croak=y ;;
2846         *)  echo "Using targethost $targethost." >&4
2847         esac
2848         locincpth=' '
2849         loclibpth=' '
2850         case "$croak" in
2851         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2852         esac
2853         case "$src" in
2854         /*) run=$src/Cross/run
2855             targetmkdir=$src/Cross/mkdir
2856             to=$src/Cross/to
2857             from=$src/Cross/from
2858             ;;
2859         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2860             run=$pwd/Cross/run
2861             targetmkdir=$pwd/Cross/mkdir
2862             to=$pwd/Cross/to
2863             from=$pwd/Cross/from
2864             ;;
2865         esac
2866         case "$targetrun" in
2867         '') targetrun=ssh ;;
2868         esac
2869         case "$targetto" in
2870         '') targetto=scp ;;
2871         esac
2872         case "$targetfrom" in
2873         '') targetfrom=scp ;;
2874         esac
2875         run=$run-$targetrun
2876         to=$to-$targetto
2877         from=$from-$targetfrom
2878         case "$targetdir" in
2879         '')  targetdir=/tmp
2880              echo "Guessing targetdir $targetdir." >&4
2881              ;;
2882         esac
2883         case "$targetuser" in
2884         '')  targetuser=root
2885              echo "Guessing targetuser $targetuser." >&4
2886              ;;
2887         esac
2888         case "$targetfrom" in
2889         scp)    q=-q ;;
2890         *)      q='' ;;
2891         esac
2892         case "$targetrun" in
2893         ssh|rsh)
2894             cat >$run <<EOF
2895 #!/bin/sh
2896 case "\$1" in
2897 -cwd)
2898   shift
2899   cwd=\$1
2900   shift
2901   ;;
2902 esac
2903 case "\$cwd" in
2904 '') cwd=$targetdir ;;
2905 esac
2906 exe=\$1
2907 shift
2908 if $test ! -f \$exe.xok; then
2909   $to \$exe
2910   $touch \$exe.xok
2911 fi
2912 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2913 EOF
2914             ;;
2915         *)  echo "Unknown targetrun '$targetrun'" >&4
2916             exit 1
2917             ;;
2918         esac
2919         case "$targetmkdir" in
2920         */Cross/mkdir)
2921             cat >$targetmkdir <<EOF
2922 #!/bin/sh
2923 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2924 EOF
2925             $chmod a+rx $targetmkdir
2926             ;;
2927         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2928             exit 1
2929             ;;
2930         esac
2931         case "$targetto" in
2932         scp|rcp)
2933             cat >$to <<EOF
2934 #!/bin/sh
2935 for f in \$@
2936 do
2937   case "\$f" in
2938   /*)
2939     $targetmkdir \`dirname \$f\`
2940     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2941     ;;
2942   *)
2943     $targetmkdir $targetdir/\`dirname \$f\`
2944     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2945     ;;
2946   esac
2947 done
2948 exit 0
2949 EOF
2950             ;;
2951         cp) cat >$to <<EOF
2952 #!/bin/sh
2953 for f in \$@
2954 do
2955   case "\$f" in
2956   /*)
2957     $mkdir -p $targetdir/\`dirname \$f\`
2958     $cp \$f $targetdir/\$f || exit 1
2959     ;;
2960   *)
2961     $targetmkdir $targetdir/\`dirname \$f\`
2962     $cp \$f $targetdir/\$f || exit 1
2963     ;;
2964   esac
2965 done
2966 exit 0
2967 EOF
2968             ;;
2969         *)  echo "Unknown targetto '$targetto'" >&4
2970             exit 1
2971             ;;
2972         esac
2973         case "$targetfrom" in
2974         scp|rcp)
2975           cat >$from <<EOF
2976 #!/bin/sh
2977 for f in \$@
2978 do
2979   $rm -f \$f
2980   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2981 done
2982 exit 0
2983 EOF
2984             ;;
2985         cp) cat >$from <<EOF
2986 #!/bin/sh
2987 for f in \$@
2988 do
2989   $rm -f \$f
2990   cp $targetdir/\$f . || exit 1
2991 done
2992 exit 0
2993 EOF
2994             ;;
2995         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2996             exit 1
2997             ;;
2998         esac
2999         if $test ! -f $run; then
3000             echo "Target 'run' script '$run' not found." >&4
3001         else
3002             $chmod a+rx $run
3003         fi
3004         if $test ! -f $to; then
3005             echo "Target 'to' script '$to' not found." >&4
3006         else
3007             $chmod a+rx $to
3008         fi
3009         if $test ! -f $from; then
3010             echo "Target 'from' script '$from' not found." >&4
3011         else
3012             $chmod a+rx $from
3013         fi
3014         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3015             exit 1
3016         fi
3017         cat >&4 <<EOF
3018 Using '$run' for remote execution,
3019 and '$from' and '$to'
3020 for remote file transfer.
3021 EOF
3022         ;;
3023 *)      run=''
3024         to=:
3025         from=:
3026         usecrosscompile='undef'
3027         targetarch=''
3028         ;;
3029 esac
3030
3031 : see whether [:lower:] and [:upper:] are supported character classes
3032 echo " "
3033 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3034 ABYZ)
3035         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3036         up='[:upper:]'
3037         low='[:lower:]'
3038         ;;
3039 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3040         # (0xd9 and 0xe2), therefore that is a nice testing point.
3041         if test "X$up" = X -o "X$low" = X; then
3042             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3043             rs) up='[A-Z]'
3044                 low='[a-z]'
3045                 ;;
3046             esac
3047         fi
3048         if test "X$up" = X -o "X$low" = X; then
3049             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3050             rs) up='A-Z'
3051                 low='a-z'
3052                 ;;
3053             esac
3054         fi
3055         if test "X$up" = X -o "X$low" = X; then
3056             case "`echo RS | od -x 2>/dev/null`" in
3057             *D9E2*|*d9e2*)
3058                 echo "Hey, this might be EBCDIC." >&4
3059                 if test "X$up" = X -o "X$low" = X; then
3060                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3061                     rs) up='[A-IJ-RS-Z]'
3062                         low='[a-ij-rs-z]'
3063                         ;;
3064                     esac
3065                 fi
3066                 if test "X$up" = X -o "X$low" = X; then
3067                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3068                     rs) up='A-IJ-RS-Z'
3069                         low='a-ij-rs-z'
3070                         ;;
3071                     esac
3072                 fi
3073                 ;;
3074             esac
3075         fi
3076 esac
3077 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3078 rs)
3079     echo "Using $up and $low to convert case." >&4
3080     ;;
3081 *)
3082     echo "I don't know how to translate letters from upper to lower case." >&4
3083     echo "Your tr is not acting any way I know of." >&4
3084     exit 1
3085     ;;
3086 esac
3087 : set up the translation script tr, must be called with ./tr of course
3088 cat >tr <<EOSC
3089 $startsh
3090 case "\$1\$2" in
3091 '[A-Z][a-z]') exec $tr '$up' '$low';;
3092 '[a-z][A-Z]') exec $tr '$low' '$up';;
3093 esac
3094 exec $tr "\$@"
3095 EOSC
3096 chmod +x tr
3097 $eunicefix tr
3098
3099 : Try to determine whether config.sh was made on this system
3100 case "$config_sh" in
3101 '')
3102 myuname=`$uname -a 2>/dev/null`
3103 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3104 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3105 # because the A-Z/a-z are not consecutive.
3106 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3107         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3108 newmyuname="$myuname"
3109 dflt=n
3110 case "$knowitall" in
3111 '')
3112         if test -f ../config.sh; then
3113                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3114                         eval "`grep myuname= ../config.sh`"
3115                 fi
3116                 if test "X$myuname" = "X$newmyuname"; then
3117                         dflt=y
3118                 fi
3119         fi
3120         ;;
3121 *) dflt=y;;
3122 esac
3123
3124 : Get old answers from old config file if Configure was run on the
3125 : same system, otherwise use the hints.
3126 hint=default
3127 cd ..
3128 if test -f config.sh; then
3129         echo " "
3130         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3131         . UU/myread
3132         case "$ans" in
3133         n*|N*) echo "OK, I'll ignore it."
3134                 mv config.sh config.sh.old
3135                 myuname="$newmyuname"
3136                 ;;
3137         *)  echo "Fetching default answers from your old config.sh file..." >&4
3138                 tmp_n="$n"
3139                 tmp_c="$c"
3140                 tmp_sh="$sh"
3141                 . ./config.sh
3142                 cp config.sh UU
3143                 n="$tmp_n"
3144                 c="$tmp_c"
3145                 : Older versions did not always set $sh.  Catch re-use of such
3146                 : an old config.sh.
3147                 case "$sh" in
3148                 '') sh="$tmp_sh" ;;
3149                 esac
3150                 hint=previous
3151                 ;;
3152         esac
3153 fi
3154 . ./UU/checkcc
3155 if test ! -f config.sh; then
3156         $cat <<EOM
3157
3158 First time through, eh?  I have some defaults handy for some systems
3159 that need some extra help getting the Configure answers right:
3160
3161 EOM
3162         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3163         dflt=''
3164         : Half the following guesses are probably wrong... If you have better
3165         : tests or hints, please send them to perlbug@perl.org
3166         : The metaconfig authors would also appreciate a copy...
3167         $test -f /irix && osname=irix
3168         $test -f /xenix && osname=sco_xenix
3169         $test -f /dynix && osname=dynix
3170         $test -f /dnix && osname=dnix
3171         $test -f /lynx.os && osname=lynxos
3172         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3173         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3174         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3175         $test -f /bin/mips && /bin/mips && osname=mips
3176         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3177                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3178         $test -d /usr/apollo/bin && osname=apollo
3179         $test -f /etc/saf/_sactab && osname=svr4
3180         $test -d /usr/include/minix && osname=minix
3181         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3182         if $test -d /MachTen -o -d /MachTen_Folder; then
3183                 osname=machten
3184                 if $test -x /sbin/version; then
3185                         osvers=`/sbin/version | $awk '{print $2}' |
3186                         $sed -e 's/[A-Za-z]$//'`
3187                 elif $test -x /usr/etc/version; then
3188                         osvers=`/usr/etc/version | $awk '{print $2}' |
3189                         $sed -e 's/[A-Za-z]$//'`
3190                 else
3191                         osvers="$2.$3"
3192                 fi
3193         fi
3194
3195         $test -f /sys/posix.dll &&
3196                 $test -f /usr/bin/what &&
3197                 set X `/usr/bin/what /sys/posix.dll` &&
3198                 $test "$3" = UWIN &&
3199                 osname=uwin &&
3200                 osvers="$5"
3201
3202         if $test -f $uname; then
3203                 set X $myuname
3204                 shift
3205
3206                 case "$5" in
3207                 fps*) osname=fps ;;
3208                 mips*)
3209                         case "$4" in
3210                         umips) osname=umips ;;
3211                         *) osname=mips ;;
3212                         esac;;
3213                 [23]100) osname=mips ;;
3214                 next*) osname=next ;;
3215                 i386*)
3216                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3217                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3218                                 osname='sco'
3219                                 osvers=$tmp
3220                         elif $test -f /etc/kconfig; then
3221                                 osname=isc
3222                                 if test "$lns" = "$ln -s"; then
3223                                         osvers=4
3224                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3225                                         osvers=3
3226                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3227                                         osvers=2
3228                                 fi
3229                         fi
3230                         tmp=''
3231                         ;;
3232                 pc*)
3233                         if test -n "$DJGPP"; then
3234                                 osname=dos
3235                                 osvers=djgpp
3236                         fi
3237                         ;;
3238                 esac
3239
3240                 case "$1" in
3241                 aix) osname=aix
3242                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3243                         case "$tmp" in
3244                         # oslevel can fail with:
3245                         # oslevel: Unable to acquire lock.
3246                         *not\ found) osvers="$4"."$3" ;;
3247                         '<3240'|'<>3240') osvers=3.2.0 ;;
3248                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3249                         '=3250'|'>3250') osvers=3.2.5 ;;
3250                         *) osvers=$tmp;;
3251                         esac
3252                         ;;
3253                 bsd386) osname=bsd386
3254                         osvers=`$uname -r`
3255                         ;;
3256                 cygwin*) osname=cygwin
3257                         osvers="$3"
3258                         ;;
3259                 *dc.osx) osname=dcosx
3260                         osvers="$3"
3261                         ;;
3262                 dnix) osname=dnix
3263                         osvers="$3"
3264                         ;;
3265                 domainos) osname=apollo
3266                         osvers="$3"
3267                         ;;
3268                 dgux)   osname=dgux
3269                         osvers="$3"
3270                         ;;
3271                 dragonfly) osname=dragonfly
3272                         osvers="$3"
3273                         ;;
3274                 dynixptx*) osname=dynixptx
3275                         osvers=`echo "$4"|sed 's/^v//'`
3276                         ;;
3277                 freebsd) osname=freebsd
3278                         osvers="$3" ;;
3279                 genix)  osname=genix ;;
3280                 gnu)    osname=gnu
3281                         osvers="$3" ;;
3282                 hp*)    osname=hpux
3283                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3284                         ;;
3285                 irix*)  osname=irix
3286                         case "$3" in
3287                         4*) osvers=4 ;;
3288                         5*) osvers=5 ;;
3289                         *)      osvers="$3" ;;
3290                         esac
3291                         ;;
3292                 linux)  osname=linux
3293                         case "$3" in
3294                         *)      osvers="$3" ;;
3295                         esac
3296                         ;;
3297                 MiNT)   osname=mint
3298                         ;;
3299                 netbsd*) osname=netbsd
3300                         osvers="$3"
3301                         ;;
3302                 news-os) osvers="$3"
3303                         case "$3" in
3304                         4*) osname=newsos4 ;;
3305                         *) osname=newsos ;;
3306                         esac
3307                         ;;
3308                 next*) osname=next ;;
3309                 nonstop-ux) osname=nonstopux ;;
3310                 openbsd) osname=openbsd
3311                         osvers="$3"
3312                         ;;
3313                 os2)    osname=os2
3314                         osvers="$4"
3315                         ;;
3316                 POSIX-BC | posix-bc ) osname=posix-bc
3317                         osvers="$3"
3318                         ;;
3319                 powerux | power_ux | powermax_os | powermaxos | \
3320                 powerunix | power_unix) osname=powerux
3321                         osvers="$3"
3322                         ;;
3323                 qnx) osname=qnx
3324                         osvers="$4"
3325                         ;;
3326                 solaris) osname=solaris
3327                         case "$3" in
3328                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3329                         *)      osvers="$3" ;;
3330                         esac
3331                         ;;
3332                 sunos) osname=sunos
3333                         case "$3" in
3334                         5*) osname=solaris
3335                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3336                         *)      osvers="$3" ;;
3337                         esac
3338                         ;;
3339                 titanos) osname=titanos
3340                         case "$3" in
3341                         1*) osvers=1 ;;
3342                         2*) osvers=2 ;;
3343                         3*) osvers=3 ;;
3344                         4*) osvers=4 ;;
3345                         *)      osvers="$3" ;;
3346                         esac
3347                         ;;
3348                 ultrix) osname=ultrix
3349                         osvers="$3"
3350                         ;;
3351                 osf1|mls+)      case "$5" in
3352                                 alpha)
3353                                         osname=dec_osf
3354                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3355                                         case "$osvers" in
3356                                         [1-9].[0-9]*) ;;
3357                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3358                                         esac
3359                                         ;;
3360                         hp*)    osname=hp_osf1  ;;
3361                         mips)   osname=mips_osf1 ;;
3362                         esac
3363                         ;;
3364                 # UnixWare 7.1.2 is known as Open UNIX 8
3365                 openunix|unixware) osname=svr5
3366                         osvers="$4"
3367                         ;;
3368                 uts)    osname=uts
3369                         osvers="$3"
3370                         ;;
3371                 vos) osvers="$3"
3372                         ;;
3373                 $2) case "$osname" in
3374                         *isc*) ;;
3375                         *freebsd*) ;;
3376                         svr*)
3377                                 : svr4.x or possibly later
3378                                 case "svr$3" in
3379                                 ${osname}*)
3380                                         osname=svr$3
3381                                         osvers=$4
3382                                         ;;
3383                                 esac
3384                                 case "$osname" in
3385                                 svr4.0)
3386                                         : Check for ESIX
3387                                         if test -f /stand/boot ; then
3388                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3389                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3390                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3391                                                         if test -n "$isesix"; then
3392                                                                 osname=esix4
3393                                                         fi
3394                                                 fi
3395                                         fi
3396                                         ;;
3397                                 esac
3398                                 ;;
3399                         *)      if test -f /etc/systemid; then
3400                                         osname=sco
3401                                         set `echo $3 | $sed 's/\./ /g'` $4
3402                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3403                                                 osvers=$1.$2.$3
3404                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3405                                                 osvers=$1.$2
3406                                         elif $test -f $src/hints/sco_$1.sh; then
3407                                                 osvers=$1
3408                                         fi
3409                                 else
3410                                         case "$osname" in
3411                                         '') : Still unknown.  Probably a generic Sys V.
3412                                                 osname="sysv"
3413                                                 osvers="$3"
3414                                                 ;;
3415                                         esac
3416                                 fi
3417                                 ;;
3418                         esac
3419                         ;;
3420                 *)      case "$osname" in
3421                         '') : Still unknown.  Probably a generic BSD.
3422                                 osname="$1"
3423                                 osvers="$3"
3424                                 ;;
3425                         esac
3426                         ;;
3427                 esac
3428         else
3429                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3430                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3431                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3432                                 osname=news_os
3433                         fi
3434                         $rm -f UU/kernel.what
3435                 elif test -d c:/. -o -n "$is_os2" ; then
3436                         set X $myuname
3437                         osname=os2
3438                         osvers="$5"
3439                 fi
3440         fi
3441
3442         case "$targetarch" in
3443         '') ;;
3444         *)  hostarch=$osname
3445             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3446             osvers=''
3447             ;;
3448         esac
3449
3450         : Now look for a hint file osname_osvers, unless one has been
3451         : specified already.
3452         case "$hintfile" in
3453         ''|' ')
3454                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3455                 : Also try without trailing minor version numbers.
3456                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3457                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3458                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3459                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3460                 case "$file" in
3461                 '') dflt=none ;;
3462                 *)  case "$osvers" in
3463                         '') dflt=$file
3464                                 ;;
3465                         *)  if $test -f $src/hints/$file.sh ; then
3466                                         dflt=$file
3467                                 elif $test -f $src/hints/$xfile.sh ; then
3468                                         dflt=$xfile
3469                                 elif $test -f $src/hints/$xxfile.sh ; then
3470                                         dflt=$xxfile
3471                                 elif $test -f $src/hints/$xxxfile.sh ; then
3472                                         dflt=$xxxfile
3473                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3474                                         dflt=$xxxxfile
3475                                 elif $test -f "$src/hints/${osname}.sh" ; then
3476                                         dflt="${osname}"
3477                                 else
3478                                         dflt=none
3479                                 fi
3480                                 ;;
3481                         esac
3482                         ;;
3483                 esac
3484                 if $test -f Policy.sh ; then
3485                         case "$dflt" in
3486                         *Policy*) ;;
3487                         none) dflt="Policy" ;;
3488                         *) dflt="Policy $dflt" ;;
3489                         esac
3490                 fi
3491                 ;;
3492         *)
3493                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3494                 ;;
3495         esac
3496
3497         if $test -f Policy.sh ; then
3498                 $cat <<EOM
3499
3500 There's also a Policy hint file available, which should make the
3501 site-specific (policy) questions easier to answer.
3502 EOM
3503
3504         fi
3505
3506         $cat <<EOM
3507
3508 You may give one or more space-separated answers, or "none" if appropriate.
3509 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3510 previous run of Configure, you may specify it as well as or instead of
3511 OS-specific hints.  If hints are provided for your OS, you should use them:
3512 although Perl can probably be built without hints on many platforms, using
3513 hints often improve performance and may enable features that Configure can't
3514 set up on its own. If there are no hints that match your OS, specify "none";
3515 DO NOT give a wrong version or a wrong OS.
3516
3517 EOM
3518
3519         rp="Which of these apply, if any?"
3520         . UU/myread
3521         tans=$ans
3522         for file in $tans; do
3523                 if $test X$file = XPolicy -a -f Policy.sh; then
3524                         . Policy.sh
3525                         $cat Policy.sh >> UU/config.sh
3526                 elif $test -f $src/hints/$file.sh; then
3527                         . $src/hints/$file.sh
3528                         $cat $src/hints/$file.sh >> UU/config.sh
3529                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3530                         : nothing
3531                 else
3532                         : Give one chance to correct a possible typo.
3533                         echo "$file.sh does not exist"
3534                         dflt=$file
3535                         rp="hint to use instead?"
3536                         . UU/myread
3537                         for file in $ans; do
3538                                 if $test -f "$src/hints/$file.sh"; then
3539                                         . $src/hints/$file.sh
3540                                         $cat $src/hints/$file.sh >> UU/config.sh
3541                                 elif $test X$ans = X -o X$ans = Xnone ; then
3542                                         : nothing
3543                                 else
3544                                         echo "$file.sh does not exist -- ignored."
3545                                 fi
3546                         done
3547                 fi
3548         done
3549
3550         hint=recommended
3551         : Remember our hint file for later.
3552         if $test -f "$src/hints/$file.sh" ; then
3553                 hintfile="$file"
3554         else
3555                 hintfile=''
3556         fi
3557 fi
3558 cd UU
3559 ;;
3560 *)
3561         echo " "
3562         echo "Fetching default answers from $config_sh..." >&4
3563         tmp_n="$n"
3564         tmp_c="$c"
3565         cd ..
3566         cp $config_sh config.sh 2>/dev/null
3567         chmod +w config.sh
3568         . ./config.sh
3569         cd UU
3570         cp ../config.sh .
3571         n="$tmp_n"
3572         c="$tmp_c"
3573         hint=previous
3574         ;;
3575 esac
3576 test "$override" && . ./optdef.sh
3577
3578 : Restore computed paths
3579 for file in $loclist $trylist; do
3580         eval $file="\$_$file"
3581 done
3582
3583 cat << EOM
3584
3585 Configure uses the operating system name and version to set some defaults.
3586 The default value is probably right if the name rings a bell. Otherwise,
3587 since spelling matters for me, either accept the default or answer "none"
3588 to leave it blank.
3589
3590 EOM
3591 case "$osname" in
3592         ''|' ')
3593                 case "$hintfile" in
3594                 ''|' '|none) dflt=none ;;
3595                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3596                 esac
3597                 ;;
3598         *) dflt="$osname" ;;
3599 esac
3600 rp="Operating system name?"
3601 . ./myread
3602 case "$ans" in
3603 none)  osname='' ;;
3604 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3605 esac
3606 echo " "
3607 case "$osvers" in
3608         ''|' ')
3609                 case "$hintfile" in
3610                 ''|' '|none) dflt=none ;;
3611                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3612                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3613                         case "$dflt" in
3614                         ''|' ') dflt=none ;;
3615                         esac
3616                         ;;
3617                 esac
3618                 ;;
3619         *) dflt="$osvers" ;;
3620 esac
3621 rp="Operating system version?"
3622 . ./myread
3623 case "$ans" in
3624 none)  osvers='' ;;
3625 *) osvers="$ans" ;;
3626 esac
3627
3628
3629 . ./posthint.sh
3630
3631 : who configured the system
3632 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3633 case "$cf_by" in
3634 "")
3635         cf_by=`(logname) 2>/dev/null`
3636         case "$cf_by" in
3637         "")
3638                 cf_by=`(whoami) 2>/dev/null`
3639                 case "$cf_by" in
3640                 "") cf_by=unknown ;;
3641                 esac ;;
3642         esac ;;
3643 esac
3644
3645 : decide how portable to be.  Allow command line overrides.
3646 case "$d_portable" in
3647 "$undef") ;;
3648 *)      d_portable="$define" ;;
3649 esac
3650
3651 : set up shell script to do ~ expansion
3652 cat >filexp <<EOSS
3653 $startsh
3654 : expand filename
3655 case "\$1" in
3656  \~/*|\~)
3657         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3658         ;;
3659  \~*)
3660         if $test -f /bin/csh; then
3661                 /bin/csh -f -c "glob \$1"
3662                 failed=\$?
3663                 echo ""
3664                 exit \$failed
3665         else
3666                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3667                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3668                 if $test ! -d "\$dir"; then
3669                         me=\`basename \$0\`
3670                         echo "\$me: can't locate home directory for: \$name" >&2
3671                         exit 1
3672                 fi
3673                 case "\$1" in
3674                 */*)
3675                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3676                         ;;
3677                 *)
3678                         echo \$dir
3679                         ;;
3680                 esac
3681         fi
3682         ;;
3683 *)
3684         echo \$1
3685         ;;
3686 esac
3687 EOSS
3688 chmod +x filexp
3689 $eunicefix filexp
3690
3691 : now set up to get a file name
3692 cat <<EOS >getfile
3693 $startsh
3694 EOS
3695 cat <<'EOSC' >>getfile
3696 tilde=''
3697 fullpath=''
3698 already=''
3699 skip=''
3700 none_ok=''
3701 exp_file=''
3702 nopath_ok=''
3703 orig_rp="$rp"
3704 orig_dflt="$dflt"
3705 case "$gfpth" in
3706 '') gfpth='.' ;;
3707 esac
3708
3709 case "$fn" in
3710 *\(*)
3711         : getfile will accept an answer from the comma-separated list
3712         : enclosed in parentheses even if it does not meet other criteria.
3713         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3714         fn=`echo $fn | sed 's/(.*)//'`
3715         ;;
3716 esac
3717
3718 case "$fn" in
3719 *:*)
3720         loc_file=`expr $fn : '.*:\(.*\)'`
3721         fn=`expr $fn : '\(.*\):.*'`
3722         ;;
3723 esac
3724
3725 case "$fn" in
3726 *~*) tilde=true;;
3727 esac
3728 case "$fn" in
3729 */*) fullpath=true;;
3730 esac
3731 case "$fn" in
3732 *+*) skip=true;;
3733 esac
3734 case "$fn" in
3735 *n*) none_ok=true;;
3736 esac
3737 case "$fn" in
3738 *e*) exp_file=true;;
3739 esac
3740 case "$fn" in
3741 *p*) nopath_ok=true;;
3742 esac
3743
3744 case "$fn" in
3745 *f*) type='File';;
3746 *d*) type='Directory';;
3747 *l*) type='Locate';;
3748 esac
3749
3750 what="$type"
3751 case "$what" in
3752 Locate) what='File';;
3753 esac
3754
3755 case "$exp_file" in
3756 '')
3757         case "$d_portable" in
3758         "$define") ;;
3759         *) exp_file=true;;
3760         esac
3761         ;;
3762 esac
3763
3764 cd ..
3765 while test "$type"; do
3766         redo=''
3767         rp="$orig_rp"
3768         dflt="$orig_dflt"
3769         case "$tilde" in
3770         true) rp="$rp (~name ok)";;
3771         esac
3772         . UU/myread
3773         if test -f UU/getfile.ok && \
3774                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3775         then
3776                 value="$ans"
3777                 ansexp="$ans"
3778                 break
3779         fi
3780         case "$ans" in
3781         none)
3782                 value=''
3783                 ansexp=''
3784                 case "$none_ok" in
3785                 true) type='';;
3786                 esac
3787                 ;;
3788         *)
3789                 case "$tilde" in
3790                 '') value="$ans"
3791                         ansexp="$ans";;
3792                 *)
3793                         value=`UU/filexp $ans`
3794                         case $? in
3795                         0)
3796                                 if test "$ans" != "$value"; then
3797                                         echo "(That expands to $value on this system.)"
3798                                 fi
3799                                 ;;
3800                         *) value="$ans";;
3801                         esac
3802                         ansexp="$value"
3803                         case "$exp_file" in
3804                         '') value="$ans";;
3805                         esac
3806                         ;;
3807                 esac
3808                 case "$fullpath" in
3809                 true)
3810                         case "$ansexp" in
3811                         /*) value="$ansexp" ;;
3812                         [a-zA-Z]:/*) value="$ansexp" ;;
3813                         *)
3814                                 redo=true
3815                                 case "$already" in
3816                                 true)
3817                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3818                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3819                                         ;;
3820                                 *)
3821                                 echo "Please give a full path name, starting with slash." >&4
3822                                         case "$tilde" in
3823                                         true)
3824                                 echo "Note that using ~name is ok provided it expands well." >&4
3825                                                 already=true
3826                                                 ;;
3827                                         esac
3828                                 esac
3829                                 ;;
3830                         esac
3831                         ;;
3832                 esac
3833                 case "$redo" in
3834                 '')
3835                         case "$type" in
3836                         File)
3837                                 for fp in $gfpth; do
3838                                         if test "X$fp" = X.; then
3839                                             pf="$ansexp"
3840                                         else    
3841                                             pf="$fp/$ansexp"
3842                                         fi
3843                                         if test -f "$pf"; then
3844                                                 type=''
3845                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3846                                         then
3847                                                 echo "($value is not a plain file, but that's ok.)"
3848                                                 type=''
3849                                         fi
3850                                         if test X"$type" = X; then
3851                                             value="$pf"
3852                                             break
3853                                         fi
3854                                 done
3855                                 ;;
3856                         Directory)
3857                                 for fp in $gfpth; do
3858                                         if test "X$fp" = X.; then
3859                                             dir="$ans"
3860                                             direxp="$ansexp"
3861                                         else    
3862                                             dir="$fp/$ansexp"
3863                                             direxp="$fp/$ansexp"
3864                                         fi
3865                                         if test -d "$direxp"; then
3866                                                 type=''
3867                                                 value="$dir"
3868                                                 break
3869                                         fi
3870                                 done
3871                                 ;;
3872                         Locate)
3873                                 if test -d "$ansexp"; then
3874                                         echo "(Looking for $loc_file in directory $value.)"
3875                                         value="$value/$loc_file"
3876                                         ansexp="$ansexp/$loc_file"
3877                                 fi
3878                                 if test -f "$ansexp"; then
3879                                         type=''
3880                                 fi
3881                                 case "$nopath_ok" in
3882                                 true)   case "$value" in
3883                                         */*) ;;
3884                                         *)      echo "Assuming $value will be in people's path."
3885                                                 type=''
3886                                                 ;;
3887                                         esac
3888                                         ;;
3889                                 esac
3890                                 ;;
3891                         esac
3892
3893                         case "$skip" in
3894                         true) type='';
3895                         esac
3896
3897                         case "$type" in
3898                         '') ;;
3899                         *)
3900                                 if test "$fastread" = yes; then
3901                                         dflt=y
3902                                 else
3903                                         dflt=n
3904                                 fi
3905                                 rp="$what $value doesn't exist.  Use that name anyway?"
3906                                 . UU/myread
3907                                 dflt=''
3908                                 case "$ans" in
3909                                 y*) type='';;
3910                                 *) echo " ";;
3911                                 esac
3912                                 ;;
3913                         esac
3914                         ;;
3915                 esac
3916                 ;;
3917         esac
3918 done
3919 cd UU
3920 ans="$value"
3921 rp="$orig_rp"
3922 dflt="$orig_dflt"
3923 rm -f getfile.ok
3924 test "X$gfpthkeep" != Xy && gfpth=""
3925 EOSC
3926
3927 : determine root of directory hierarchy where package will be installed.
3928 case "$prefix" in
3929 '')
3930         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3931         ;;
3932 *?/)
3933         dflt=`echo "$prefix" | sed 's/.$//'`
3934         ;;
3935 *)
3936         dflt="$prefix"
3937         ;;
3938 esac
3939 $cat <<EOM
3940
3941 By default, $package will be installed in $dflt/bin, manual pages
3942 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3943 installation directories. Typically this is something like /usr/local.
3944 If you wish to have binaries under /usr/bin but other parts of the
3945 installation under /usr/local, that's ok: you will be prompted
3946 separately for each of the installation directories, the prefix being
3947 only used to set the defaults.
3948
3949 EOM
3950 fn=d~
3951 rp='Installation prefix to use?'
3952 . ./getfile
3953 oldprefix=''
3954 case "$prefix" in
3955 '') ;;
3956 *)
3957         case "$ans" in
3958         "$prefix") ;;
3959         *) oldprefix="$prefix";;
3960         esac
3961         ;;
3962 esac
3963 prefix="$ans"
3964 prefixexp="$ansexp"
3965
3966 : allow them to override the AFS root
3967 case "$afsroot" in
3968 '')     afsroot=/afs ;;
3969 *)      afsroot=$afsroot ;;
3970 esac
3971
3972 : is AFS running?
3973 echo " "
3974 case "$afs" in
3975 $define|true)   afs=true ;;
3976 $undef|false)   afs=false ;;
3977 *)      if $test -d $afsroot; then
3978                 afs=true
3979         else
3980                 afs=false
3981         fi
3982         ;;
3983 esac
3984 if $afs; then
3985         echo "AFS may be running... I'll be extra cautious then..." >&4
3986 else
3987         echo "AFS does not seem to be running..." >&4
3988 fi
3989
3990 : determine installation prefix for where package is to be installed.
3991 if $afs; then 
3992 $cat <<EOM
3993
3994 Since you are running AFS, I need to distinguish the directory in which
3995 files will reside from the directory in which they are installed (and from
3996 which they are presumably copied to the former directory by occult means).
3997
3998 EOM
3999         case "$installprefix" in
4000         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4001         *) dflt="$installprefix";;
4002         esac
4003 else
4004 $cat <<EOM
4005
4006 In some special cases, particularly when building $package for distribution,
4007 it is convenient to distinguish the directory in which files should be
4008 installed from the directory ($prefix) in which they will
4009 eventually reside.  For most users, these two directories are the same.
4010
4011 EOM
4012         case "$installprefix" in
4013         '') dflt=$prefix ;;
4014         *) dflt=$installprefix;;
4015         esac
4016 fi
4017 fn=d~
4018 rp='What installation prefix should I use for installing files?'
4019 . ./getfile
4020 installprefix="$ans"
4021 installprefixexp="$ansexp"
4022
4023 : Perform the prefixexp/installprefixexp correction if necessary
4024 cat <<EOS >installprefix
4025 $startsh
4026 EOS
4027 cat <<'EOSC' >>installprefix
4028 : Change installation prefix, if necessary.
4029 if $test X"$prefix" != X"$installprefix"; then
4030     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4031 else
4032     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4033 fi
4034 EOSC
4035 chmod +x installprefix
4036 $eunicefix installprefix
4037
4038 : Set variables such as privlib and privlibexp from the output of ./getfile
4039 : performing the prefixexp/installprefixexp correction if necessary.
4040 cat <<EOS >setprefixvar
4041 $startsh
4042 EOS
4043 cat <<'EOSC' >>setprefixvar
4044 eval "${prefixvar}=\"\$ans\""
4045 eval "${prefixvar}exp=\"\$ansexp\""
4046 . ./installprefix
4047 EOSC
4048 chmod +x setprefixvar
4049 $eunicefix setprefixvar
4050
4051 : set up the script used to warn in case of inconsistency
4052 cat <<EOS >whoa
4053 $startsh
4054 EOS
4055 cat <<'EOSC' >>whoa
4056 dflt=y
4057 case "$hint" in
4058     recommended)
4059         case "$hintfile" in
4060         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4061                 ;;
4062         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4063                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4064                 ;;
4065         esac
4066         ;;
4067     *)  echo " "
4068         echo "*** WHOA THERE!!! ***" >&4
4069         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4070         ;;
4071 esac
4072 rp="    Keep the $hint value?"
4073 . ./myread
4074 case "$ans" in
4075 y) td=$was; tu=$was;;
4076 esac
4077 EOSC
4078
4079 : function used to set '$1' to '$val'
4080 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4081 case "$val$was" in
4082 $define$undef) . ./whoa; eval "$var=\$td";;
4083 $undef$define) . ./whoa; eval "$var=\$tu";;
4084 *) eval "$var=$val";;
4085 esac'
4086
4087 : get the patchlevel
4088 echo " "
4089 echo "Getting the current patchlevel..." >&4
4090 if $test -r $rsrc/patchlevel.h;then
4091         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4092         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4093         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4094         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4095         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4096         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4097         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4098 else
4099         revision=0
4100         patchlevel=0
4101         subversion=0
4102         api_revision=0
4103         api_version=0
4104         api_subversion=0
4105         perl_patchlevel=0
4106         $echo "(You do not have patchlevel.h.  Eek.)"
4107 fi
4108 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4109 version_patchlevel_string="version $patchlevel subversion $subversion"
4110 case "$perl_patchlevel" in
4111 0|'') ;;
4112 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4113     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4114     ;;
4115 esac
4116
4117 $echo "(You have $package $version_patchlevel_string.)"
4118
4119 case "$osname" in
4120 dos|vms)
4121         : XXX Should be a Configure test for double-dots in filenames.
4122         version=`echo $revision $patchlevel $subversion | \
4123                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4124         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4125                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4126         ;;
4127 *)
4128         version=`echo $revision $patchlevel $subversion | \
4129                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4130         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4131                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4132         ;;
4133 esac
4134 : Special case the 5.005_xx maintenance series, which used 5.005
4135 : without any subversion label as a subdirectory in $sitelib
4136 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4137         api_versionstring='5.005'
4138 fi
4139
4140 : Do we want threads support and if so, what type
4141 case "$usethreads" in
4142 $define|true|[yY]*)     dflt='y';;
4143 *)     # Catch case where user specified ithreads or 5005threads but
4144        # forgot -Dusethreads (A.D. 4/2002)
4145        case "$useithreads$use5005threads" in
4146        *$define*)       dflt='y';;
4147        *)               dflt='n';;
4148        esac
4149        ;;
4150 esac
4151 cat <<EOM
4152
4153 Perl can be built to take advantage of threads on some systems.
4154 To do so, Configure can be run with -Dusethreads.
4155
4156 Note that Perl built with threading support runs slightly slower
4157 and uses more memory than plain Perl. The current implementation
4158 is believed to be stable, but it is fairly new, and so should be
4159 treated with caution.
4160
4161 If this doesn't make any sense to you, just accept the default '$dflt'.
4162 EOM
4163 rp='Build a threading Perl?'
4164 . ./myread
4165 case "$ans" in
4166 y|Y)    val="$define" ;;
4167 *)      val="$undef" ;;
4168 esac
4169 set usethreads
4170 eval $setvar
4171
4172 if $test $patchlevel -lt 9; then
4173     case "$usethreads" in
4174     $define)
4175         $cat <<EOM
4176
4177 Since release 5.6, Perl has had two different threading implementations,
4178 the newer interpreter-based version (ithreads) with one interpreter per
4179 thread, and the older 5.005 version (5005threads).
4180 The 5005threads version is effectively unmaintained and will probably be
4181 removed in Perl 5.10, so there should be no need to build a Perl using it
4182 unless needed for backwards compatibility with some existing 5.005threads
4183 code.
4184
4185 EOM
4186         : Default to ithreads unless overridden on command line or with
4187         : old config.sh
4188         dflt='y'
4189         case "$use5005threads" in
4190                 $define|true|[yY]*) dflt='n';;
4191         esac
4192         case "$useithreads" in
4193                 $undef|false|[nN]*) dflt='n';;
4194         esac
4195         rp='Use the newer interpreter-based ithreads?'
4196         . ./myread
4197         case "$ans" in
4198         y|Y)    val="$define" ;;
4199         *)      val="$undef" ;;
4200         esac
4201         set useithreads
4202         eval $setvar
4203         : Now set use5005threads to the opposite value.
4204         case "$useithreads" in
4205         $define) val="$undef" ;;
4206         *) val="$define" ;;
4207         esac
4208         set use5005threads
4209         eval $setvar
4210         ;;
4211     *)
4212         useithreads="$undef"
4213         use5005threads="$undef"
4214         ;;
4215     esac
4216
4217     case "$useithreads$use5005threads" in
4218     "$define$define")
4219         $cat >&4 <<EOM
4220
4221 You cannot have both the ithreads and the 5.005 threads enabled
4222 at the same time.  Disabling the 5.005 threads since they are
4223 much less stable than the ithreads.
4224
4225 EOM
4226         use5005threads="$undef"
4227         ;;
4228     esac
4229
4230 else
4231 : perl-5.9.x and later
4232
4233     if test X"$usethreads" = "X$define"; then
4234         case "$use5005threads" in
4235             $define|true|[yY]*)
4236                 $cat >&4 <<EOM
4237
4238 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4239
4240 EOM
4241             ;;
4242         esac
4243     fi
4244
4245     use5005threads="$undef"
4246     useithreads="$usethreads"
4247 fi
4248
4249 case "$d_oldpthreads" in
4250 '')     : Configure tests would be welcome here.  For now, assume undef.
4251         val="$undef" ;;
4252 *)      val="$d_oldpthreads" ;;
4253 esac
4254 set d_oldpthreads
4255 eval $setvar
4256
4257
4258 : Look for a hint-file generated 'call-back-unit'.  If the
4259 : user has specified that a threading perl is to be built,
4260 : we may need to set or change some other defaults.
4261 if $test -f usethreads.cbu; then
4262     echo "Your platform has some specific hints regarding threaded builds, using them..."
4263     . ./usethreads.cbu
4264 else
4265     case "$usethreads" in
4266         "$define"|true|[yY]*)
4267                 $cat <<EOM
4268 (Your platform does not have any specific hints for threaded builds.
4269  Assuming POSIX threads, then.)
4270 EOM
4271         ;;
4272     esac
4273 fi
4274
4275 : Check if multiplicity is required
4276 cat <<EOM
4277
4278 Perl can be built so that multiple Perl interpreters can coexist
4279 within the same Perl executable.
4280 EOM
4281
4282 case "$useithreads" in
4283 $define)
4284         cat <<EOM
4285 This multiple interpreter support is required for interpreter-based threads.
4286 EOM
4287         val="$define"
4288         ;;
4289 *)      case "$usemultiplicity" in
4290         $define|true|[yY]*)     dflt='y';;
4291         *) dflt='n';;
4292         esac
4293         echo " "
4294         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4295         rp='Build Perl for multiplicity?'
4296         . ./myread
4297         case "$ans" in
4298         y|Y)    val="$define" ;;
4299         *)      val="$undef" ;;
4300         esac
4301         ;;
4302 esac
4303 set usemultiplicity
4304 eval $setvar
4305
4306 : Check if morebits is requested
4307 case "$usemorebits" in
4308 "$define"|true|[yY]*)
4309         use64bitint="$define"
4310         uselongdouble="$define"
4311         usemorebits="$define"
4312         ;;
4313 *)      usemorebits="$undef"
4314         ;;
4315 esac
4316
4317 : Determine the C compiler to be used
4318 echo " "
4319 case "$cc" in
4320 '') dflt=cc;;
4321 *) dflt="$cc";;
4322 esac
4323 rp="Use which C compiler?"
4324 . ./myread
4325 cc="$ans"
4326
4327 : See whether they have no cc but they do have gcc
4328 . ./trygcc
4329 if $test -f cc.cbu; then
4330     . ./cc.cbu
4331 fi
4332 . ./checkcc
4333
4334 : make some quick guesses about what we are up against
4335 echo " "
4336 $echo $n "Hmm...  $c"
4337 echo exit 1 >bsd
4338 echo exit 1 >usg
4339 echo exit 1 >v7
4340 echo exit 1 >osf1
4341 echo exit 1 >eunice
4342 echo exit 1 >xenix
4343 echo exit 1 >venix
4344 echo exit 1 >os2
4345 d_bsd="$undef"
4346 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4347 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4348 then
4349         echo "Looks kind of like an OSF/1 system, but we'll see..."
4350         echo exit 0 >osf1
4351 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4352         xxx=`./loc addbib blurfl $pth`
4353         if $test -f $xxx; then
4354         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4355                 echo exit 0 >bsd
4356                 echo exit 0 >usg
4357         else
4358                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4359                         echo "Looks kind of like an extended USG system, but we'll see..."
4360                 else
4361                         echo "Looks kind of like a USG system, but we'll see..."
4362                 fi
4363                 echo exit 0 >usg
4364         fi
4365 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4366         echo "Looks kind of like a BSD system, but we'll see..."
4367         d_bsd="$define"
4368         echo exit 0 >bsd
4369 else
4370         echo "Looks kind of like a Version 7 system, but we'll see..."
4371         echo exit 0 >v7
4372 fi
4373 case "$eunicefix" in
4374 *unixtovms*)
4375         $cat <<'EOI'
4376 There is, however, a strange, musty smell in the air that reminds me of
4377 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4378 EOI
4379         echo exit 0 >eunice
4380         d_eunice="$define"
4381 : it so happens the Eunice I know will not run shell scripts in Unix format
4382         ;;
4383 *)
4384         echo " "
4385         echo "Congratulations.  You aren't running Eunice."
4386         d_eunice="$undef"
4387         ;;
4388 esac
4389 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4390 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4391 : semicolon as a patch separator
4392 case "$p_" in
4393 :) ;;
4394 *)
4395         $cat <<'EOI'
4396 I have the feeling something is not exactly right, however...don't tell me...
4397 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4398 (Or you may be running DOS with DJGPP.)
4399 EOI
4400         echo exit 0 >os2
4401         ;;
4402 esac
4403 if test -f /xenix; then
4404         echo "Actually, this looks more like a XENIX system..."
4405         echo exit 0 >xenix
4406         d_xenix="$define"
4407 else
4408         echo " "
4409         echo "It's not Xenix..."
4410         d_xenix="$undef"
4411 fi
4412 chmod +x xenix
4413 $eunicefix xenix
4414 if test -f /venix; then
4415         echo "Actually, this looks more like a VENIX system..."
4416         echo exit 0 >venix
4417 else
4418         echo " "
4419         if ./xenix; then
4420                 : null
4421         else
4422                 echo "Nor is it Venix..."
4423         fi
4424 fi
4425 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4426 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4427 $rm -f foo
4428
4429 : Check if we are using GNU gcc and what its version is
4430 echo " "
4431 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4432 $cat >try.c <<EOM
4433 #include <stdio.h>
4434 int main() {
4435 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4436 #ifdef __VERSION__
4437         printf("%s\n", __VERSION__);
4438 #else
4439         printf("%s\n", "1");
4440 #endif
4441 #endif
4442         return(0);
4443 }
4444 EOM
4445 if $cc -o try $ccflags $ldflags try.c; then
4446         gccversion=`$run ./try`
4447         case "$gccversion" in
4448         '') echo "You are not using GNU cc." ;;
4449         *)  echo "You are using GNU cc $gccversion."
4450             ccname=gcc
4451             ;;
4452         esac
4453 else
4454         echo " "
4455         echo "*** WHOA THERE!!! ***" >&4
4456         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4457         case "$knowitall" in
4458         '')
4459         echo "    You'd better start hunting for one and let me know about it." >&4
4460                 exit 1
4461                 ;;
4462         esac
4463 fi
4464 $rm -f try try.*
4465 case "$gccversion" in
4466 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4467 esac
4468 case "$gccversion" in
4469 '') gccosandvers='' ;;
4470 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4471    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4472    gccshortvers=''
4473    case "$gccosandvers" in
4474    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4475    $osname$osvers) ;; # looking good
4476    $osname*) cat <<EOM >&4
4477
4478 *** WHOA THERE!!! ***
4479
4480     Your gcc has not been compiled for the exact release of
4481     your operating system ($gccosandvers versus $osname$osvers).
4482
4483     In general it is a good idea to keep gcc synchronized with
4484     the operating system because otherwise serious problems
4485     may ensue when trying to compile software, like Perl.
4486
4487     I'm trying to be optimistic here, though, and will continue.
4488     If later during the configuration and build icky compilation
4489     problems appear (headerfile conflicts being the most common
4490     manifestation), I suggest reinstalling the gcc to match
4491     your operating system release.
4492
4493 EOM
4494       ;;
4495    *) gccosandvers='' ;; # failed to parse, better be silent
4496    esac
4497    ;;
4498 esac
4499 case "$ccname" in
4500 '') ccname="$cc" ;;
4501 esac
4502
4503 # gcc 3.* complain about adding -Idirectories that they already know about,
4504 # so we will take those off from locincpth.
4505 case "$gccversion" in
4506 3*)
4507     echo "main(){}">try.c
4508     for incdir in $locincpth; do
4509        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4510              grep '^c[cp]p*[01]: warning: changing search order '`
4511        if test "X$warn" != X; then
4512            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4513        fi
4514     done
4515     $rm -f try try.*
4516 esac
4517
4518 : What should the include directory be ?
4519 echo " "
4520 $echo $n "Hmm...  $c"
4521 dflt='/usr/include'
4522 incpath=''
4523 mips_type=''
4524 if $test -f /bin/mips && /bin/mips; then
4525         echo "Looks like a MIPS system..."
4526         $cat >usr.c <<'EOCP'
4527 #ifdef SYSTYPE_BSD43
4528 /bsd43
4529 #endif
4530 EOCP
4531         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4532                 dflt='/bsd43/usr/include'
4533                 incpath='/bsd43'
4534                 mips_type='BSD 4.3'
4535         else
4536                 mips_type='System V'
4537         fi
4538         $rm -f usr.c usr.out
4539         echo "and you're compiling with the $mips_type compiler and libraries."
4540         xxx_prompt=y
4541         echo "exit 0" >mips
4542 else
4543         echo "Doesn't look like a MIPS system."
4544         xxx_prompt=n
4545         echo "exit 1" >mips
4546 fi
4547 chmod +x mips
4548 $eunicefix mips
4549 case "$usrinc" in
4550 '') ;;
4551 *) dflt="$usrinc";;
4552 esac
4553 case "$xxx_prompt" in
4554 y)      fn=d/
4555         echo " "
4556         rp='Where are the include files you want to use?'
4557         . ./getfile
4558         usrinc="$ans"
4559         ;;
4560 *)      usrinc="$dflt"
4561         ;;
4562 esac
4563
4564 : see how we invoke the C preprocessor
4565 echo " "
4566 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4567 cat <<'EOT' >testcpp.c
4568 #define ABC abc
4569 #define XYZ xyz
4570 ABC.XYZ
4571 EOT
4572 cd ..
4573 if test ! -f cppstdin; then
4574         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4575                 # AIX cc -E doesn't show the absolute headerfile
4576                 # locations but we'll cheat by using the -M flag.
4577                 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
4578         else
4579                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4580         fi
4581 else
4582         echo "Keeping your $hint cppstdin wrapper."
4583 fi
4584 chmod 755 cppstdin
4585 wrapper=`pwd`/cppstdin
4586 ok='false'
4587 cd UU
4588
4589 if $test "X$cppstdin" != "X" && \
4590         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4591         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4592 then
4593         echo "You used to use $cppstdin $cppminus so we'll use that again."
4594         case "$cpprun" in
4595         '') echo "But let's see if we can live without a wrapper..." ;;
4596         *)
4597                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4598                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4599                 then
4600                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4601                         ok='true'
4602                 else
4603                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4604                 fi
4605                 ;;
4606         esac
4607 else
4608         case "$cppstdin" in
4609         '') ;;
4610         *)
4611                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4612                 ;;
4613         esac
4614 fi
4615
4616 if $ok; then
4617         : nothing
4618 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4619         $cc -E <testcpp.c >testcpp.out 2>&1; \
4620         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4621         echo "Yup, it does."
4622         x_cpp="$cc -E"
4623         x_minus='';
4624 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4625         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4626         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4627         echo "Yup, it does."
4628         x_cpp="$cc -E"
4629         x_minus='-';
4630 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4631         $cc -P <testcpp.c >testcpp.out 2>&1; \
4632         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4633         echo "Yipee, that works!"
4634         x_cpp="$cc -P"
4635         x_minus='';
4636 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4637         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4638         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4639         echo "At long last!"
4640         x_cpp="$cc -P"
4641         x_minus='-';
4642 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4643         $cpp <testcpp.c >testcpp.out 2>&1; \
4644         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4645         echo "It works!"
4646         x_cpp="$cpp"
4647         x_minus='';
4648 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4649         $cpp - <testcpp.c >testcpp.out 2>&1; \
4650         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4651         echo "Hooray, it works!  I was beginning to wonder."
4652         x_cpp="$cpp"
4653         x_minus='-';
4654 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4655         $wrapper <testcpp.c >testcpp.out 2>&1; \
4656         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4657         x_cpp="$wrapper"
4658         x_minus=''
4659         echo "Eureka!"
4660 else
4661         dflt=''
4662         rp="No dice.  I can't find a C preprocessor.  Name one:"
4663         . ./myread
4664         x_cpp="$ans"
4665         x_minus=''
4666         $x_cpp <testcpp.c >testcpp.out 2>&1
4667         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4668                 echo "OK, that will do." >&4
4669         else
4670 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4671                 exit 1
4672         fi
4673 fi
4674
4675 case "$ok" in
4676 false)
4677         cppstdin="$x_cpp"
4678         cppminus="$x_minus"
4679         cpprun="$x_cpp"
4680         cpplast="$x_minus"
4681         set X $x_cpp
4682         shift
4683         case "$1" in
4684         "$cpp")
4685                 echo "Perhaps can we force $cc -E using a wrapper..."
4686                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4687                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4688                 then
4689                         echo "Yup, we can."
4690                         cppstdin="$wrapper"
4691                         cppminus='';
4692                 else
4693                         echo "Nope, we'll have to live without it..."
4694                 fi
4695                 ;;
4696         esac
4697         case "$cpprun" in
4698         "$wrapper")
4699                 cpprun=''
4700                 cpplast=''
4701                 ;;
4702         esac
4703         ;;
4704 esac
4705
4706 case "$cppstdin" in
4707 "$wrapper"|'cppstdin') ;;
4708 *) $rm -f $wrapper;;
4709 esac
4710 $rm -f testcpp.c testcpp.out
4711
4712 : Set private lib path
4713 case "$plibpth" in
4714 '') if ./mips; then
4715                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4716         fi;;
4717 esac
4718 case "$libpth" in
4719 ' ') dlist='';;
4720 '') dlist="$loclibpth $plibpth $glibpth";;
4721 *) dlist="$libpth";;
4722 esac
4723
4724 : Now check and see which directories actually exist, avoiding duplicates
4725 libpth=''
4726 for xxx in $dlist
4727 do
4728     if $test -d $xxx; then
4729                 case " $libpth " in
4730                 *" $xxx "*) ;;
4731                 *) libpth="$libpth $xxx";;
4732                 esac
4733     fi
4734 done
4735 $cat <<'EOM'
4736
4737 Some systems have incompatible or broken versions of libraries.  Among
4738 the directories listed in the question below, please remove any you
4739 know not to be holding relevant libraries, and add any that are needed.
4740 Say "none" for none.
4741
4742 EOM
4743 case "$libpth" in
4744 '') dflt='none';;
4745 *)
4746         set X $libpth
4747         shift
4748         dflt=${1+"$@"}
4749         ;;
4750 esac
4751 rp="Directories to use for library searches?"
4752 . ./myread
4753 case "$ans" in
4754 none) libpth=' ';;
4755 *) libpth="$ans";;
4756 esac
4757
4758 : compute shared library extension
4759 case "$so" in
4760 '')
4761         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4762                 dflt='sl'
4763         else
4764                 dflt='so'
4765         fi
4766         ;;
4767 *) dflt="$so";;
4768 esac
4769 $cat <<EOM
4770
4771 On some systems, shared libraries may be available.  Answer 'none' if
4772 you want to suppress searching of shared libraries for the remainder
4773 of this configuration.
4774
4775 EOM
4776 rp='What is the file extension used for shared libraries?'
4777 . ./myread
4778 so="$ans"
4779
4780 : Define several unixisms.
4781 : Hints files or command line option can be used to override them.
4782 : The convoluted testing is in case hints files set either the old
4783 : or the new name.
4784 case "$_exe" in
4785 '')     case "$exe_ext" in
4786         '')     ;;
4787         *)      _exe="$exe_ext" ;;
4788         esac
4789         ;;
4790 esac
4791 case "$_a" in
4792 '')     case "$lib_ext" in
4793     '') _a='.a';;
4794         *)      _a="$lib_ext" ;;
4795         esac
4796         ;;
4797 esac
4798 case "$_o" in
4799 '') case "$obj_ext" in
4800         '')     _o='.o';;
4801         *)      _o="$obj_ext";;
4802         esac
4803         ;;
4804 esac
4805 case "$p_" in
4806 '') case "$path_sep" in
4807         '')     p_=':';;
4808         *)      p_="$path_sep";;
4809         esac
4810         ;;
4811 esac
4812 exe_ext=$_exe
4813 lib_ext=$_a
4814 obj_ext=$_o
4815 path_sep=$p_
4816
4817 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4818
4819 : Which makefile gets called first.  This is used by make depend.
4820 case "$firstmakefile" in
4821 '') firstmakefile='makefile';;
4822 esac
4823
4824 : Check is we will use socks
4825 case "$usesocks" in
4826 $define|true|[yY]*)     dflt='y';;
4827 *) dflt='n';;
4828 esac
4829 cat <<EOM
4830
4831 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4832 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4833 to use the PerlIO abstraction layer, this will be implicitly selected.
4834
4835 If this doesn't make any sense to you, just accept the default '$dflt'.
4836 EOM
4837 rp='Build Perl for SOCKS?'
4838 . ./myread
4839 case "$ans" in
4840 y|Y)    val="$define" ;;
4841 *)      val="$undef" ;;
4842 esac
4843 set usesocks
4844 eval $setvar
4845
4846 : Check for uselongdouble support
4847 case "$ccflags" in
4848 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4849 esac
4850
4851 case "$uselongdouble" in
4852 $define|true|[yY]*)     dflt='y';;
4853 *) dflt='n';;
4854 esac
4855 cat <<EOM
4856
4857 Perl can be built to take advantage of long doubles which
4858 (if available) may give more accuracy and range for floating point numbers.
4859
4860 If this doesn't make any sense to you, just accept the default '$dflt'.
4861 EOM
4862 rp='Try to use long doubles if available?'
4863 . ./myread
4864 case "$ans" in
4865 y|Y)    val="$define"   ;;
4866 *)      val="$undef"    ;;
4867 esac
4868 set uselongdouble
4869 eval $setvar
4870
4871 case "$uselongdouble" in
4872 true|[yY]*) uselongdouble="$define" ;;
4873 esac
4874
4875 : Look for a hint-file generated 'call-back-unit'.  If the
4876 : user has specified that long doubles should be used,
4877 : we may need to set or change some other defaults.
4878 if $test -f uselongdouble.cbu; then
4879     echo "Your platform has some specific hints regarding long doubles, using them..."
4880     . ./uselongdouble.cbu
4881 else
4882     case "$uselongdouble" in
4883         $define)
4884                 $cat <<EOM
4885 (Your platform does not have any specific hints for long doubles.)
4886 EOM
4887         ;;
4888     esac
4889 fi
4890
4891 : Looking for optional libraries
4892 echo " "
4893 echo "Checking for optional libraries..." >&4
4894 case "$libs" in
4895 ' '|'') dflt='';;
4896 *) dflt="$libs";;
4897 esac
4898 case "$libswanted" in
4899 '') libswanted='c_s';;
4900 esac
4901 case "$usesocks" in
4902 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4903 esac
4904 libsfound=''
4905 libsfiles=''
4906 libsdirs=''
4907 libspath=''
4908 for thisdir in $libpth $xlibpth; do
4909   test -d $thisdir && libspath="$libspath $thisdir"
4910 done
4911 for thislib in $libswanted; do
4912         for thisdir in $libspath; do
4913             xxx=''
4914             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4915                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4916                 $test -f "$xxx" && eval $libscheck
4917                 $test -f "$xxx" && libstyle=shared
4918             fi
4919             if test ! -f "$xxx"; then
4920                 xxx=$thisdir/lib$thislib.$so
4921                 $test -f "$xxx" && eval $libscheck
4922                 $test -f "$xxx" && libstyle=shared
4923             fi
4924             if test ! -f "$xxx"; then
4925                 xxx=$thisdir/lib$thislib$_a
4926                 $test -f "$xxx" && eval $libscheck
4927                 $test -f "$xxx" && libstyle=static
4928             fi
4929             if test ! -f "$xxx"; then
4930                 xxx=$thisdir/$thislib$_a
4931                 $test -f "$xxx" && eval $libscheck
4932                 $test -f "$xxx" && libstyle=static
4933             fi
4934             if test ! -f "$xxx"; then
4935                 xxx=$thisdir/lib${thislib}_s$_a
4936                 $test -f "$xxx" && eval $libscheck
4937                 $test -f "$xxx" && libstyle=static
4938                 $test -f "$xxx" && thislib=${thislib}_s
4939             fi
4940             if test ! -f "$xxx"; then
4941                 xxx=$thisdir/Slib$thislib$_a
4942                 $test -f "$xxx" && eval $libscheck
4943                 $test -f "$xxx" && libstyle=static
4944             fi
4945             if $test -f "$xxx"; then
4946                 case "$libstyle" in
4947                 shared) echo "Found -l$thislib (shared)." ;;
4948                 static) echo "Found -l$thislib." ;;
4949                 *)      echo "Found -l$thislib ($libstyle)." ;;
4950                 esac
4951                 case " $dflt " in
4952                 *"-l$thislib "*);;
4953                 *) dflt="$dflt -l$thislib"
4954                    libsfound="$libsfound $xxx"
4955                    yyy=`basename $xxx`
4956                    libsfiles="$libsfiles $yyy"
4957                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4958                    case " $libsdirs " in
4959                    *" $yyy "*) ;;
4960                    *) libsdirs="$libsdirs $yyy" ;;
4961                    esac
4962                    ;;
4963                 esac
4964                 break
4965             fi
4966         done
4967         if $test ! -f "$xxx"; then
4968             echo "No -l$thislib."
4969         fi
4970 done
4971 set X $dflt
4972 shift
4973 dflt="$*"
4974 case "$libs" in
4975 '') dflt="$dflt";;
4976 *) dflt="$libs";;
4977 esac
4978 case "$dflt" in
4979 ' '|'') dflt='none';;
4980 esac
4981
4982 $cat <<EOM
4983
4984 In order to compile $package on your machine, a number of libraries
4985 are usually needed.  Include any other special libraries here as well.
4986 Say "none" for none.  The default list is almost always right.
4987 EOM
4988
4989 echo " "
4990 rp="What libraries to use?"
4991 . ./myread
4992 case "$ans" in
4993 none) libs=' ';;
4994 *) libs="$ans";;
4995 esac
4996
4997 : determine optimization, if desired, or use for debug flag also
4998 case "$optimize" in
4999 ' '|$undef) dflt='none';;
5000 '') dflt='-O';;
5001 *) dflt="$optimize";;
5002 esac
5003 $cat <<EOH
5004
5005 By default, $package compiles with the -O flag to use the optimizer.
5006 Alternately, you might want to use the symbolic debugger, which uses
5007 the -g flag (on traditional Unix systems).  Either flag can be
5008 specified here.  To use neither flag, specify the word "none".
5009
5010 EOH
5011 rp="What optimizer/debugger flag should be used?"
5012 . ./myread
5013 optimize="$ans"
5014 case "$optimize" in
5015 'none') optimize=" ";;
5016 esac
5017
5018 : Check what DEBUGGING is required from the command line
5019 : -DEBUGGING      or -DDEBUGGING or
5020 : -DEBUGGING=both                       = -g + -DDEBUGGING
5021 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5022 : -DEBUGGING=none or -UDEBUGGING        =
5023 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5024 case "$EBUGGING" in
5025 '')     ;;
5026 *)      DEBUGGING=$EBUGGING ;;
5027 esac
5028
5029 case "$DEBUGGING" in
5030 -g|both|$define)
5031     case "$optimize" in
5032         *-g*) ;;
5033         *)    optimize="$optimize -g" ;;
5034     esac ;;
5035 none|$undef)
5036     case "$optimize" in
5037         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5038                 shift
5039                 optimize="$*"
5040                 ;;
5041     esac ;;
5042 esac
5043
5044 dflt=''
5045 case "$DEBUGGING" in
5046 both|$define) dflt='-DDEBUGGING'
5047 esac
5048
5049 : argument order is deliberate, as the flag will start with - which set could
5050 : think is an option
5051 checkccflag='check=$1; flag=$2; callback=$3;
5052 echo " ";
5053 echo "Checking if your compiler accepts $flag" 2>&1;
5054 echo "int main(void) { return 0; }" > gcctest.c;
5055 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5056     echo "Yes, it does." 2>&1;
5057     if $test -s gcctest.out ; then
5058         echo "But your platform does not like it:";
5059         cat gcctest.out;
5060     else
5061         case "$ccflags" in
5062         *$check*)
5063             echo "Leaving current flags $ccflags alone." 2>&1
5064             ;;
5065         *) dflt="$dflt $flag";
5066             eval $callback
5067             ;;
5068         esac
5069     fi
5070 else
5071     echo "Nope, it does not, but that is ok." 2>&1;
5072 fi
5073 '
5074
5075 : We will not override a previous value, but we might want to
5076 : augment a hint file
5077 case "$hint" in
5078 default|recommended)
5079         case "$gccversion" in
5080         1*) dflt="$dflt -fpcc-struct-return" ;;
5081         esac
5082         case "$optimize:$DEBUGGING" in
5083         *-g*:old) dflt="$dflt -DDEBUGGING";;
5084         esac
5085         case "$gccversion" in
5086         2*) if $test -d /etc/conf/kconfig.d &&
5087                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5088                 then
5089                         # Interactive Systems (ISC) POSIX mode.
5090                         dflt="$dflt -posix"
5091                 fi
5092                 ;;
5093         esac
5094         case "$gccversion" in
5095         1*) ;;
5096         2.[0-8]*) ;;
5097         ?*)     set strict-aliasing -fno-strict-aliasing
5098                 eval $checkccflag
5099                 ;;
5100         esac
5101         # For gcc, adding -pipe speeds up compilations for some, but apparently
5102         # some assemblers can't read from stdin.  (It also slows down compilations
5103         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5104         case "$gccversion" in
5105         ?*)     set pipe -pipe
5106                 eval $checkccflag
5107                 ;;
5108         esac
5109
5110         # on x86_64 (at least) we require an extra library (libssp) in the
5111         # link command line. This library is not named, so I infer that it is
5112         # an implementation detail that may change. Hence the safest approach
5113         # is to add the flag to the flags passed to the compiler at link time,
5114         # as that way the compiler can do the right implementation dependant
5115         # thing. (NWC)
5116         case "$gccversion" in
5117         ?*)     set stack-protector -fstack-protector
5118                 eval $checkccflag
5119                 ;;
5120         esac
5121         ;;
5122 esac
5123
5124 case "$mips_type" in
5125 *BSD*|'') inclwanted="$locincpth $usrinc";;
5126 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5127 esac
5128 for thisincl in $inclwanted; do
5129         if $test -d $thisincl; then
5130                 if $test x$thisincl != x$usrinc; then
5131                         case "$dflt" in
5132                         *" -I$thisincl "*);;
5133                         *) dflt="$dflt -I$thisincl ";;
5134                         esac
5135                 fi
5136         fi
5137 done
5138
5139 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5140         xxx=true;
5141 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5142         xxx=true;
5143 else
5144         xxx=false;
5145 fi;
5146 if $xxx; then
5147         case "$dflt" in
5148         *$2*);;
5149         *) dflt="$dflt -D$2";;
5150         esac;
5151 fi'
5152
5153 set signal.h LANGUAGE_C; eval $inctest
5154
5155 case "$usesocks" in
5156 $define)
5157         ccflags="$ccflags -DSOCKS"
5158         ;;
5159 esac
5160
5161 case "$hint" in
5162 default|recommended) dflt="$ccflags $dflt" ;;
5163 *) dflt="$ccflags";;
5164 esac
5165
5166 case "$dflt" in
5167 ''|' ') dflt=none;;
5168 esac
5169
5170 $cat <<EOH
5171
5172 Your C compiler may want other flags.  For this question you should include
5173 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5174 but you should NOT include libraries or ld flags like -lwhatever.  If you
5175 want $package to honor its debug switch, you should include -DDEBUGGING here.
5176 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5177
5178 To use no flags, specify the word "none".
5179
5180 EOH
5181 set X $dflt
5182 shift
5183 dflt=${1+"$@"}
5184 rp="Any additional cc flags?"
5185 . ./myread
5186 case "$ans" in
5187 none) ccflags='';;
5188 *) ccflags="$ans";;
5189 esac
5190
5191 : the following weeds options from ccflags that are of no interest to cpp
5192 case "$cppflags" in
5193 '') cppflags="$ccflags" ;;
5194 *)  cppflags="$cppflags $ccflags" ;;
5195 esac
5196 case "$gccversion" in
5197 1*) cppflags="$cppflags -D__GNUC__"
5198 esac
5199 case "$mips_type" in
5200 '');;
5201 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5202 esac
5203 case "$cppflags" in
5204 '');;
5205 *)
5206         echo " "
5207         echo "Let me guess what the preprocessor flags are..." >&4
5208         set X $cppflags
5209         shift
5210         cppflags=''
5211         $cat >cpp.c <<'EOM'
5212 #define BLURFL foo
5213
5214 BLURFL xx LFRULB
5215 EOM
5216         previous=''
5217         for flag in $*
5218         do
5219                 case "$flag" in
5220                 -*) ftry="$flag";;
5221                 *) ftry="$previous $flag";;
5222                 esac
5223                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5224                         >cpp1.out 2>/dev/null && \
5225                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5226                         >cpp2.out 2>/dev/null && \
5227                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5228                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5229                 then
5230                         cppflags="$cppflags $ftry"
5231                         previous=''
5232                 else
5233                         previous="$flag"
5234                 fi
5235         done
5236         set X $cppflags
5237         shift
5238         cppflags=${1+"$@"}
5239         case "$cppflags" in
5240         *-*)  echo "They appear to be: $cppflags";;
5241         esac
5242         $rm -f cpp.c cpp?.out
5243         ;;
5244 esac
5245
5246 : flags used in final linking phase
5247 case "$ldflags" in
5248 '') if ./venix; then
5249                 dflt='-i -z'
5250         else
5251                 dflt=''
5252         fi
5253         case "$ccflags" in
5254         *-posix*) dflt="$dflt -posix" ;;
5255         esac
5256         ;;
5257 *) dflt="$ldflags";;
5258 esac
5259 # See note above about -fstack-protector
5260 case "$ccflags" in
5261 *-fstack-protector*) 
5262         case "$dflt" in
5263         *-fstack-protector*) ;; # Don't add it again
5264         *) dflt="$dflt -fstack-protector" ;; 
5265         esac
5266         ;;
5267 esac
5268
5269 : Try to guess additional flags to pick up local libraries.
5270 for thislibdir in $libpth; do
5271         case " $loclibpth " in
5272         *" $thislibdir "*)
5273                 case "$dflt " in
5274                 *"-L$thislibdir "*) ;;
5275                 *)  dflt="$dflt -L$thislibdir" ;;
5276                 esac
5277                 ;;
5278         esac
5279 done
5280
5281 case "$dflt" in
5282 '') dflt='none' ;;
5283 esac
5284
5285 $cat <<EOH
5286
5287 Your C linker may need flags.  For this question you should
5288 include -L/whatever and any other flags used by the C linker, but you
5289 should NOT include libraries like -lwhatever.
5290
5291 Make sure you include the appropriate -L/path flags if your C linker
5292 does not normally search all of the directories you specified above,
5293 namely
5294         $libpth
5295 To use no flags, specify the word "none".
5296
5297 EOH
5298
5299 rp="Any additional ld flags (NOT including libraries)?"
5300 . ./myread
5301 case "$ans" in
5302 none) ldflags='';;
5303 *) ldflags="$ans";;
5304 esac
5305 rmlist="$rmlist pdp11"
5306
5307 : coherency check
5308 echo " "
5309 echo "Checking your choice of C compiler and flags for coherency..." >&4
5310 $cat > try.c <<'EOF'
5311 #include <stdio.h>
5312 int main() { printf("Ok\n"); return(0); }
5313 EOF
5314 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5315 shift
5316 $cat >try.msg <<'EOM'
5317 I've tried to compile and run the following simple program:
5318
5319 EOM
5320 $cat try.c >> try.msg
5321
5322 $cat >> try.msg <<EOM
5323
5324 I used the command:
5325
5326         $*
5327         $run ./try
5328
5329 and I got the following output:
5330
5331 EOM
5332 dflt=y
5333 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5334         if $sh -c "$run ./try " >>try.msg 2>&1; then
5335                 xxx=`$run ./try`
5336                 case "$xxx" in
5337                 "Ok") dflt=n ;;
5338                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5339                         case " $libs " in
5340                         *" -lsfio "*)
5341                                 cat >> try.msg <<'EOQS'
5342 If $libs contains -lsfio, and sfio is mis-configured, then it
5343 sometimes (apparently) runs and exits with a 0 status, but with no
5344 output!  It may have to do with sfio's use of _exit vs. exit.
5345
5346 EOQS
5347                                 rp="You have a big problem.  Shall I abort Configure"
5348                                 dflt=y
5349                                 ;;
5350                         esac
5351                         ;;
5352                 esac
5353         else
5354                 echo "The program compiled OK, but exited with status $?." >>try.msg
5355                 rp="You have a problem.  Shall I abort Configure"
5356                 dflt=y
5357         fi
5358 else
5359         echo "I can't compile the test program." >>try.msg
5360         rp="You have a BIG problem.  Shall I abort Configure"
5361         dflt=y
5362 fi
5363 case "$dflt" in
5364 y)
5365         $cat try.msg >&4
5366         case "$knowitall" in
5367         '')
5368                 echo "(The supplied flags or libraries might be incorrect.)"
5369                 ;;
5370         *) dflt=n;;
5371         esac
5372         echo " "
5373         . ./myread
5374         case "$ans" in
5375         n*|N*) ;;
5376         *)      echo "Ok.  Stopping Configure." >&4
5377                 exit 1
5378                 ;;
5379         esac
5380         ;;
5381 n) echo "OK, that should do.";;
5382 esac
5383 $rm_try gcctest gcctest.out
5384
5385 : define a shorthand compile call
5386 compile='
5387 mc_file=$1;
5388 shift;
5389 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5390 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5391 exit 1;
5392 fi;
5393 esac;
5394 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5395 : define a shorthand compile call for compilations that should be ok.
5396 compile_ok='
5397 mc_file=$1;
5398 shift;
5399 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5400
5401 : determine filename position in cpp output
5402 echo " "
5403 echo "Computing filename position in cpp output for #include directives..." >&4
5404 case "$osname" in
5405 vos) testaccess=-e ;;
5406 *)   testaccess=-r ;;
5407 esac
5408 echo '#include <stdio.h>' > foo.c
5409 $cat >fieldn <<EOF
5410 $startsh
5411 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5412 $grep '^[       ]*#.*stdio\.h' | \
5413 while read cline; do
5414         pos=1
5415         set \$cline
5416         while $test \$# -gt 0; do
5417                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5418                         echo "\$pos"
5419                         exit 0
5420                 fi
5421                 shift
5422                 pos=\`expr \$pos + 1\`
5423         done
5424 done
5425 EOF
5426 chmod +x fieldn
5427 fieldn=`./fieldn`
5428 $rm -f foo.c fieldn
5429 case $fieldn in
5430 '') pos='???';;
5431 1) pos=first;;
5432 2) pos=second;;
5433 3) pos=third;;
5434 *) pos="${fieldn}th";;
5435 esac
5436 echo "Your cpp writes the filename in the $pos field of the line."
5437
5438 case "$osname" in
5439 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5440 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5441 *)   cppfilter='' ;;
5442 esac
5443 : locate header file
5444 $cat >findhdr <<EOF
5445 $startsh
5446 wanted=\$1
5447 name=''
5448 for usrincdir in $usrinc
5449 do
5450         if test -f \$usrincdir/\$wanted; then
5451                 echo "\$usrincdir/\$wanted"
5452                 exit 0
5453         fi
5454 done
5455 awkprg='{ print \$$fieldn }'
5456 echo "#include <\$wanted>" > foo\$\$.c
5457 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5458 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5459 while read cline; do
5460         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5461         case "\$name" in
5462         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5463         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5464         *) exit 2;;
5465         esac;
5466 done;
5467 #
5468 # status = 0: grep returned 0 lines, case statement not executed
5469 # status = 1: headerfile found
5470 # status = 2: while loop executed, no headerfile found
5471 #
5472 status=\$?
5473 $rm -f foo\$\$.c;
5474 if test \$status -eq 1; then
5475         exit 0;
5476 fi
5477 exit 1
5478 EOF
5479 chmod +x findhdr
5480
5481 : define an alternate in-header-list? function
5482 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5483 cont=true; xxf="echo \"<\$1> found.\" >&4";
5484 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5485 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5486 esac;
5487 case $# in 4) instead=instead;; *) instead="at last";; esac;
5488 while $test "$cont"; do
5489         xxx=`./findhdr $1`
5490         var=$2; eval "was=\$$2";
5491         if $test "$xxx" && $test -r "$xxx";
5492         then eval $xxf;
5493         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5494                 cont="";
5495         else eval $xxnf;
5496         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5497         set $yyy; shift; shift; yyy=$@;
5498         case $# in 0) cont="";;
5499         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5500                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5501         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5502                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5503         esac;
5504 done;
5505 while $test "$yyy";
5506 do set $yyy; var=$2; eval "was=\$$2";
5507         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5508         set $yyy; shift; shift; yyy=$@;
5509 done'
5510
5511 : see if stdlib is available
5512 set stdlib.h i_stdlib
5513 eval $inhdr
5514
5515 : check for lengths of integral types
5516 echo " "
5517 case "$intsize" in
5518 '')
5519         echo "Checking to see how big your integers are..." >&4
5520         $cat >try.c <<EOCP
5521 #include <stdio.h>
5522 #$i_stdlib I_STDLIB
5523 #ifdef I_STDLIB
5524 #include <stdlib.h>
5525 #endif
5526 int main()
5527 {
5528         printf("intsize=%d;\n", (int)sizeof(int));
5529         printf("longsize=%d;\n", (int)sizeof(long));
5530         printf("shortsize=%d;\n", (int)sizeof(short));
5531         exit(0);
5532 }
5533 EOCP
5534         set try
5535         if eval $compile_ok && $run ./try > /dev/null; then
5536                 eval `$run ./try`
5537                 echo "Your integers are $intsize bytes long."
5538                 echo "Your long integers are $longsize bytes long."
5539                 echo "Your short integers are $shortsize bytes long."
5540         else
5541                 $cat >&4 <<EOM
5542 !
5543 Help! I can't compile and run the intsize test program: please enlighten me!
5544 (This is probably a misconfiguration in your system or libraries, and
5545 you really ought to fix it.  Still, I'll try anyway.)
5546 !
5547 EOM
5548                 dflt=4
5549                 rp="What is the size of an integer (in bytes)?"
5550                 . ./myread
5551                 intsize="$ans"
5552                 dflt=$intsize
5553                 rp="What is the size of a long integer (in bytes)?"
5554                 . ./myread
5555                 longsize="$ans"
5556                 dflt=2
5557                 rp="What is the size of a short integer (in bytes)?"
5558                 . ./myread
5559                 shortsize="$ans"
5560         fi
5561         ;;
5562 esac
5563 $rm_try
5564
5565 : check for long long
5566 echo " "
5567 echo "Checking to see if you have long long..." >&4
5568 echo 'int main() { long long x = 7; return 0; }' > try.c
5569 set try
5570 if eval $compile; then
5571         val="$define"
5572         echo "You have long long."
5573 else
5574         val="$undef"
5575         echo "You do not have long long."
5576 fi
5577 $rm_try
5578 set d_longlong
5579 eval $setvar
5580
5581 : check for length of long long
5582 case "${d_longlong}${longlongsize}" in
5583 $define)
5584         echo " "
5585         echo "Checking to see how big your long longs are..." >&4
5586         $cat >try.c <<'EOCP'
5587 #include <stdio.h>
5588 int main()
5589 {
5590     printf("%d\n", (int)sizeof(long long));
5591     return(0);
5592 }
5593 EOCP
5594         set try
5595         if eval $compile_ok; then
5596                 longlongsize=`$run ./try`
5597                 echo "Your long longs are $longlongsize bytes long."
5598         else
5599                 dflt='8'
5600                 echo " "
5601                 echo "(I can't seem to compile the test program.  Guessing...)"
5602                 rp="What is the size of a long long (in bytes)?"
5603                 . ./myread
5604                 longlongsize="$ans"
5605         fi
5606         if $test "X$longsize" = "X$longlongsize"; then
5607                 echo "(That isn't any different from an ordinary long.)"
5608         fi
5609         ;;
5610 esac
5611 $rm_try
5612
5613 : see if inttypes.h is available
5614 : we want a real compile instead of Inhdr because some systems
5615 : have an inttypes.h which includes non-existent headers
5616 echo " "
5617 $cat >try.c <<EOCP
5618 #include <inttypes.h>
5619 int main() {
5620         static int32_t foo32 = 0x12345678;
5621 }
5622 EOCP
5623 set try
5624 if eval $compile; then
5625         echo "<inttypes.h> found." >&4
5626         val="$define"
5627 else
5628         echo "<inttypes.h> NOT found." >&4
5629         val="$undef"
5630 fi
5631 $rm_try
5632 set i_inttypes
5633 eval $setvar
5634
5635 : check for int64_t
5636 echo " "
5637 echo "Checking to see if you have int64_t..." >&4
5638 $cat >try.c <<EOCP
5639 #include <sys/types.h>
5640 #$i_inttypes I_INTTYPES
5641 #ifdef I_INTTYPES
5642 #include <inttypes.h>
5643 #endif
5644 int main() { int64_t x = 7; }
5645 EOCP
5646 set try
5647 if eval $compile; then
5648         val="$define"
5649         echo "You have int64_t."
5650 else
5651         val="$undef"
5652         echo "You do not have int64_t."
5653 fi
5654 $rm_try
5655 set d_int64_t
5656 eval $setvar
5657
5658 : Check if 64bit ints have a quad type
5659 echo " "
5660 echo "Checking which 64-bit integer type we could use..." >&4
5661
5662 case "$intsize" in
5663 8) val=int
5664    set quadtype
5665    eval $setvar
5666    val='"unsigned int"'
5667    set uquadtype
5668    eval $setvar
5669    quadkind=1
5670    ;;
5671 *) case "$longsize" in
5672    8) val=long
5673       set quadtype
5674       eval $setvar
5675       val='"unsigned long"'
5676       set uquadtype
5677       eval $setvar
5678       quadkind=2
5679       ;;
5680    *) case "$d_longlong:$longlongsize" in
5681       define:8)
5682         val='"long long"'
5683         set quadtype
5684         eval $setvar
5685         val='"unsigned long long"'
5686         set uquadtype
5687         eval $setvar
5688         quadkind=3
5689         ;;
5690       *) case "$d_int64_t" in
5691          define)
5692            val=int64_t
5693            set quadtype
5694            eval $setvar
5695            val=uint64_t
5696            set uquadtype
5697            eval $setvar
5698            quadkind=4
5699            ;;
5700          esac
5701          ;;
5702       esac
5703       ;;
5704    esac
5705    ;;
5706 esac
5707
5708 case "$quadtype" in
5709 '')     echo "Alas, no 64-bit integer types in sight." >&4
5710         d_quad="$undef"
5711         ;;
5712 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5713         d_quad="$define"
5714         ;;
5715 esac
5716
5717 : Do we want 64bit support
5718 case "$uselonglong" in
5719 "$define"|true|[yY]*)
5720         cat <<EOM >&4
5721
5722 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5723 EOM
5724         use64bitint="$define"
5725         ;;
5726 esac
5727 case "$use64bits" in
5728 "$define"|true|[yY]*)
5729         cat <<EOM >&4
5730
5731 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5732 EOM
5733         use64bitint="$define"
5734         ;;
5735 esac
5736 case "$use64bitints" in
5737 "$define"|true|[yY]*)
5738         cat <<EOM >&4
5739
5740 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5741 EOM
5742         use64bitint="$define"
5743         ;;
5744 esac
5745 case "$use64bitsint" in
5746 "$define"|true|[yY]*)
5747         cat <<EOM >&4
5748
5749 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5750 EOM
5751         use64bitint="$define"
5752         ;;
5753 esac
5754 case "$uselonglongs" in
5755 "$define"|true|[yY]*)
5756         cat <<EOM >&4
5757
5758 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5759 EOM
5760         use64bitint="$define"
5761         ;;
5762 esac
5763 case "$use64bitsall" in
5764 "$define"|true|[yY]*)
5765         cat <<EOM >&4
5766
5767 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5768 EOM
5769         use64bitall="$define"
5770         ;;
5771 esac
5772
5773 case "$ccflags" in
5774 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5775 esac
5776 case "$use64bitall" in
5777 "$define"|true|[yY]*) use64bitint="$define" ;;
5778 esac
5779
5780 case "$longsize" in
5781 8) cat <<EOM
5782
5783 You have natively 64-bit long integers.
5784 EOM
5785    val="$define"
5786    ;;
5787 *) case "$use64bitint" in
5788    "$define"|true|[yY]*) dflt='y';;
5789    *) dflt='n';;
5790    esac
5791    case "$d_quad" in
5792    "$define") ;;
5793    *) dflt='n' ;;
5794    esac
5795    cat <<EOM
5796
5797 Perl can be built to take advantage of 64-bit integer types
5798 on some systems.  To do so, Configure can be run with -Duse64bitint.
5799 Choosing this option will most probably introduce binary incompatibilities.
5800
5801 If this doesn't make any sense to you, just accept the default '$dflt'.
5802 (The default has been chosen based on your configuration.)
5803 EOM
5804    rp='Try to use 64-bit integers, if available?'
5805    . ./myread
5806    case "$ans" in
5807    [yY]*) val="$define" ;;
5808    *)     val="$undef"  ;;
5809    esac
5810    ;;
5811 esac
5812 set use64bitint
5813 eval $setvar
5814
5815 case "$use64bitall" in
5816 "$define"|true|[yY]*) dflt='y' ;;
5817 *) case "$longsize" in
5818    8) dflt='y' ;;
5819    *) dflt='n' ;;
5820    esac
5821    ;;
5822 esac
5823 cat <<EOM
5824
5825 You may also choose to try maximal 64-bitness.  It means using as much
5826 64-bitness as possible on the platform.  This in turn means even more
5827 binary incompatibilities.  On the other hand, your platform may not
5828 have any more 64-bitness available than what you already have chosen.
5829
5830 If this doesn't make any sense to you, just accept the default '$dflt'.
5831 (The default has been chosen based on your configuration.)
5832 EOM
5833 rp='Try to use maximal 64-bit support, if available?'
5834 . ./myread
5835 case "$ans" in
5836 [yY]*) val="$define" ;;
5837 *)     val="$undef"  ;;
5838 esac
5839 set use64bitall
5840 eval $setvar
5841 case "$use64bitall" in
5842 "$define")
5843         case "$use64bitint" in
5844         "$undef")
5845                 cat <<EOM
5846
5847 Since you have chosen a maximally 64-bit build, I'm also turning on
5848 the use of 64-bit integers.
5849 EOM
5850                 use64bitint="$define" ;;
5851         esac
5852         ;;
5853 esac
5854
5855 : Look for a hint-file generated 'call-back-unit'.  If the
5856 : user has specified that a 64-bit perl is to be built,
5857 : we may need to set or change some other defaults.
5858 if $test -f use64bitint.cbu; then
5859         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5860         . ./use64bitint.cbu
5861 fi
5862 case "$use64bitint" in
5863 "$define"|true|[yY]*)
5864         case "$longsize" in
5865         4) case "$archname64" in
5866            '') archname64=64int ;;
5867            esac
5868            ;;
5869         esac
5870         ;;
5871 esac
5872
5873 : Look for a hint-file generated 'call-back-unit'.  If the
5874 : user has specified that a maximally 64-bit perl is to be built,
5875 : we may need to set or change some other defaults.
5876 if $test -f use64bitall.cbu; then
5877         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5878         . ./use64bitall.cbu
5879 fi
5880 case "$use64bitall" in
5881 "$define"|true|[yY]*)
5882         case "$longsize" in
5883         4) case "$archname64" in
5884            ''|64int) archname64=64all ;;
5885            esac
5886            ;;
5887         esac
5888         ;;
5889 esac
5890
5891 case "$d_quad:$use64bitint" in
5892 $undef:$define)
5893         cat >&4 <<EOF
5894
5895 *** You have chosen to use 64-bit integers,
5896 *** but none can be found.
5897 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5898 *** Cannot continue, aborting.
5899
5900 EOF
5901         exit 1
5902         ;;
5903 esac
5904
5905 : check for length of double
5906 echo " "
5907 case "$doublesize" in
5908 '')
5909         echo "Checking to see how big your double precision numbers are..." >&4
5910         $cat >try.c <<EOCP
5911 #include <stdio.h>
5912 #$i_stdlib I_STDLIB
5913 #ifdef I_STDLIB
5914 #include <stdlib.h>
5915 #endif
5916 int main()
5917 {
5918     printf("%d\n", (int)sizeof(double));
5919     exit(0);
5920 }
5921 EOCP
5922         set try
5923         if eval $compile_ok; then
5924                 doublesize=`$run ./try`
5925                 echo "Your double is $doublesize bytes long."
5926         else
5927                 dflt='8'
5928                 echo "(I can't seem to compile the test program.  Guessing...)"
5929                 rp="What is the size of a double precision number (in bytes)?"
5930                 . ./myread
5931                 doublesize="$ans"
5932         fi
5933         ;;
5934 esac
5935 $rm_try
5936
5937 : check for long doubles
5938 echo " "
5939 echo "Checking to see if you have long double..." >&4
5940 echo 'int main() { long double x = 7.0; }' > try.c
5941 set try
5942 if eval $compile; then
5943         val="$define"
5944         echo "You have long double."
5945 else
5946         val="$undef"
5947         echo "You do not have long double."
5948 fi
5949 $rm_try
5950 set d_longdbl
5951 eval $setvar
5952
5953 : check for length of long double
5954 case "${d_longdbl}${longdblsize}" in
5955 $define)
5956         echo " "
5957         echo "Checking to see how big your long doubles are..." >&4
5958         $cat >try.c <<'EOCP'
5959 #include <stdio.h>
5960 int main()
5961 {
5962         printf("%d\n", sizeof(long double));
5963 }
5964 EOCP
5965         set try
5966         set try
5967         if eval $compile; then
5968                 longdblsize=`$run ./try`
5969                 echo "Your long doubles are $longdblsize bytes long."
5970         else
5971                 dflt='8'
5972                 echo " "
5973                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5974                 rp="What is the size of a long double (in bytes)?"
5975                 . ./myread
5976                 longdblsize="$ans"
5977         fi
5978         if $test "X$doublesize" = "X$longdblsize"; then
5979                 echo "That isn't any different from an ordinary double."
5980                 echo "I'll keep your setting anyway, but you may see some"
5981                 echo "harmless compilation warnings."
5982         fi
5983         ;;
5984 esac
5985 $rm_try
5986
5987 : determine the architecture name
5988 echo " "
5989 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5990         tarch=`arch`"-$osname"
5991 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5992         if uname -m > tmparch 2>&1 ; then
5993                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5994                         -e 's/$/'"-$osname/" tmparch`
5995         else
5996                 tarch="$osname"
5997         fi
5998         $rm -f tmparch
5999 else
6000         tarch="$osname"
6001 fi
6002 case "$myarchname" in
6003 ''|"$tarch") ;;
6004 *)
6005         echo "(Your architecture name used to be $myarchname.)"
6006         archname=''
6007         ;;
6008 esac
6009 case "$targetarch" in
6010 '') ;;
6011 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6012 esac
6013 myarchname="$tarch"
6014 case "$archname" in
6015 '') dflt="$tarch";;
6016 *) dflt="$archname";;
6017 esac
6018 rp='What is your architecture name'
6019 . ./myread
6020 archname="$ans"
6021
6022 : optionally add api version to the architecture for versioned archlibs
6023 case "$useversionedarchname" in
6024 $define|true|[yY]*) dflt='y';;
6025 *)                  dflt='n';;
6026 esac
6027 rp='Add the Perl API version to your archname?'
6028 . ./myread
6029 case "$ans" in
6030 y|Y)    useversionedarchname="$define" ;;
6031 *)      useversionedarchname="$undef" ;;
6032 esac
6033 case "$useversionedarchname" in
6034 $define)
6035         case "$archname" in
6036         *-$api_versionstring)
6037                 echo "...and architecture name already has -$api_versionstring" >&4
6038                 ;;
6039         *)
6040                 archname="$archname-$api_versionstring"
6041                 echo "...setting architecture name to $archname." >&4
6042                 ;;
6043         esac
6044         ;;
6045 esac
6046
6047 case "$usethreads" in
6048 $define)
6049         echo "Threads selected." >&4
6050         case "$archname" in
6051         *-thread*) echo "...and architecture name already has -thread." >&4
6052                 ;;
6053         *)      archname="$archname-thread"
6054                 echo "...setting architecture name to $archname." >&4
6055                 ;;
6056         esac
6057         ;;
6058 esac
6059 case "$usemultiplicity" in
6060 $define)
6061         echo "Multiplicity selected." >&4
6062         case "$archname" in
6063         *-multi*) echo "...and architecture name already has -multi." >&4
6064                 ;;
6065         *)      archname="$archname-multi"
6066                 echo "...setting architecture name to $archname." >&4
6067                 ;;
6068         esac
6069         ;;
6070 esac
6071 case "$use64bitint$use64bitall" in
6072 *"$define"*)
6073         case "$archname64" in
6074         '')
6075                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6076                 ;;
6077         *)
6078                 case "$use64bitint" in
6079                 "$define") echo "64 bit integers selected." >&4 ;;
6080                 esac
6081                 case "$use64bitall" in
6082                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6083                 esac
6084                 case "$archname" in
6085                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6086                         ;;
6087                 *)      archname="$archname-$archname64"
6088                         echo "...setting architecture name to $archname." >&4
6089                         ;;
6090                 esac
6091                 ;;
6092         esac
6093 esac
6094 case "$uselongdouble" in
6095 $define)
6096         echo "Long doubles selected." >&4
6097         case "$longdblsize" in
6098         $doublesize)
6099                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6100                 ;;
6101         *)
6102                 case "$archname" in
6103                 *-ld*) echo "...and architecture name already has -ld." >&4
6104                         ;;
6105                 *)      archname="$archname-ld"
6106                         echo "...setting architecture name to $archname." >&4
6107                         ;;
6108                 esac
6109                 ;;
6110         esac
6111         ;;
6112 esac
6113 if $test -f archname.cbu; then
6114         echo "Your platform has some specific hints for architecture name, using them..."
6115         . ./archname.cbu
6116 fi
6117
6118 : set the prefixit variable, to compute a suitable default value
6119 prefixit='case "$3" in
6120 ""|none)
6121         case "$oldprefix" in
6122         "") eval "$1=\"\$$2\"";;
6123         *)
6124                 case "$3" in
6125                 "") eval "$1=";;
6126                 none)
6127                         eval "tp=\"\$$2\"";
6128                         case "$tp" in
6129                         ""|" ") eval "$1=\"\$$2\"";;
6130                         *) eval "$1=";;
6131                         esac;;
6132                 esac;;
6133         esac;;
6134 *)
6135         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6136         case "$tp" in
6137         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6138         /*-$oldprefix/*|\~*-$oldprefix/*)
6139                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6140         *) eval "$1=\"\$$2\"";;
6141         esac;;
6142 esac'
6143
6144 : determine installation style
6145 : For now, try to deduce it from prefix unless it is already set.
6146 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6147 case "$installstyle" in
6148 '')     case "$prefix" in
6149                 *perl*) dflt='lib';;
6150                 *) dflt='lib/perl5' ;;
6151         esac
6152         ;;
6153 *)      dflt="$installstyle" ;;
6154 esac
6155 : Probably not worth prompting for this since we prompt for all
6156 : the directories individually, and the prompt would be too long and
6157 : confusing anyway.
6158 installstyle=$dflt
6159
6160 : determine where public executables go
6161 echo " "
6162 set dflt bin bin
6163 eval $prefixit
6164 fn=d~
6165 rp='Pathname where the public executables will reside?'
6166 . ./getfile
6167 if $test "X$ansexp" != "X$binexp"; then
6168         installbin=''
6169 fi
6170 prefixvar=bin
6171 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6172 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6173 :     this via initialinstalllocation
6174 . ./setprefixvar
6175
6176 case "$userelocatableinc" in
6177 $define|true|[yY]*)     dflt='y' ;;
6178 *)                      dflt='n' ;;
6179 esac
6180 cat <<EOM
6181
6182 Would you like to build Perl so that the installation is relocatable, so that
6183 library paths in @INC are determined relative to the path of the perl binary?
6184 This is not advised for system Perl installs, or if you need to run setid
6185 scripts or scripts under taint mode.
6186
6187 If this doesn't make any sense to you, just accept the default '$dflt'.
6188 EOM
6189 rp='Use relocatable @INC?'
6190 . ./myread
6191 case "$ans" in
6192 y|Y)    val="$define" ;;
6193 *)      val="$undef"  ;;
6194 esac
6195 set userelocatableinc
6196 eval $setvar
6197
6198 initialinstalllocation="$binexp"
6199 : Default prefix is now "up one level from where the binaries are"
6200 case "$userelocatableinc" in
6201 $define|true|[yY]*)
6202     bin=".../"
6203     binexp=".../"
6204     prefix=".../.."
6205     prefixexp=".../.."
6206     installprefixexp=".../.."
6207     ;;
6208 esac
6209
6210 : determine where private library files go
6211 : Usual default is /usr/local/lib/perl5/$version.
6212 : Also allow things like /opt/perl/lib/$version, since
6213 : /opt/perl/lib/perl5... would be redundant.
6214 : The default "style" setting is made in installstyle.U
6215 case "$installstyle" in
6216 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6217 *)       set dflt privlib lib/$version ;;
6218 esac
6219 eval $prefixit
6220 $cat <<EOM
6221
6222 There are some auxiliary files for $package that need to be put into a
6223 private library directory that is accessible by everyone.
6224
6225 EOM
6226 fn=$binexp
6227 fn=d~+
6228 rp='Pathname where the private library files will reside?'
6229 . ./getfile
6230 prefixvar=privlib
6231 . ./setprefixvar
6232
6233 : set the prefixup variable, to restore leading tilda escape
6234 prefixup='case "$prefixexp" in
6235 "$prefix") ;;
6236 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6237 esac'
6238
6239 : determine where public architecture dependent libraries go
6240 set archlib archlib
6241 eval $prefixit
6242 : privlib default is /usr/local/lib/$package/$version
6243 : archlib default is /usr/local/lib/$package/$version/$archname
6244 : privlib may have an optional trailing /share.
6245 tdflt=`echo $privlib | $sed 's,/share$,,'`
6246 tdflt=$tdflt/$archname
6247 case "$archlib" in
6248 '')     dflt=$tdflt
6249         ;;
6250 *)      dflt="$archlib"
6251     ;;
6252 esac
6253 $cat <<EOM
6254
6255 $spackage contains architecture-dependent library files.  If you are
6256 sharing libraries in a heterogeneous environment, you might store
6257 these files in a separate location.  Otherwise, you can just include
6258 them with the rest of the public library files.
6259
6260 EOM
6261 fn=$binexp
6262 fn=d+~
6263 rp='Where do you want to put the public architecture-dependent libraries?'
6264 . ./getfile
6265 prefixvar=archlib
6266 . ./setprefixvar
6267 if $test X"$archlib" = X"$privlib"; then
6268         d_archlib="$undef"
6269 else
6270         d_archlib="$define"
6271 fi
6272
6273 : see if setuid scripts can be secure
6274 $cat <<EOM
6275
6276 Some kernels have a bug that prevents setuid #! scripts from being
6277 secure.  Some sites have disabled setuid #! scripts because of this.
6278
6279 First let's decide if your kernel supports secure setuid #! scripts.
6280 (If setuid #! scripts would be secure but have been disabled anyway,
6281 don't say that they are secure if asked.)
6282
6283 EOM
6284
6285 val="$undef"
6286 if $test -d /dev/fd; then
6287         echo "#!$ls" >reflect
6288         chmod +x,u+s reflect
6289         ./reflect >flect 2>&1
6290         if $contains "/dev/fd" flect >/dev/null; then
6291                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6292                 val="$define"
6293         else
6294                 $cat <<EOM
6295 If you are not sure if they are secure, I can check but I'll need a
6296 username and password different from the one you are using right now.
6297 If you don't have such a username or don't want me to test, simply
6298 enter 'none'.
6299
6300 EOM
6301                 rp='Other username to test security of setuid scripts with?'
6302                 dflt='none'
6303                 . ./myread
6304                 case "$ans" in
6305                 n|none)
6306                         case "$d_suidsafe" in
6307                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6308                                 dflt=n;;
6309                         "$undef")
6310                                 echo "Well, the $hint value is *not* secure." >&4
6311                                 dflt=n;;
6312                         *)      echo "Well, the $hint value *is* secure." >&4
6313                                 dflt=y;;
6314                         esac
6315                         ;;
6316                 *)
6317                         $rm -f reflect flect
6318                         echo "#!$ls" >reflect
6319                         chmod +x,u+s reflect
6320                         echo >flect
6321                         chmod a+w flect
6322                         echo '"su" will (probably) prompt you for '"$ans's password."
6323                         su $ans -c './reflect >flect'
6324                         if $contains "/dev/fd" flect >/dev/null; then
6325                                 echo "Okay, it looks like setuid scripts are secure." >&4
6326                                 dflt=y
6327                         else
6328                                 echo "I don't think setuid scripts are secure." >&4
6329                                 dflt=n
6330                         fi
6331                         ;;
6332                 esac
6333                 rp='Does your kernel have *secure* setuid scripts?'
6334                 . ./myread
6335                 case "$ans" in
6336                 [yY]*)  val="$define";;
6337                 *)      val="$undef";;
6338                 esac
6339         fi
6340 else
6341         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6342         echo "(That's for file descriptors, not floppy disks.)"
6343         val="$undef"
6344 fi
6345 set d_suidsafe
6346 eval $setvar
6347
6348 $rm -f reflect flect
6349
6350 : now see if they want to do setuid emulation
6351 if $test $patchlevel -lt 11; then
6352 echo " "
6353 val="$undef"
6354 case "$d_suidsafe" in
6355 "$define")
6356         val="$undef"
6357         echo "No need to emulate SUID scripts since they are secure here." >&4
6358         ;;
6359 *)
6360         $cat <<EOM
6361 Some systems have disabled setuid scripts, especially systems where
6362 setuid scripts cannot be secure.  On systems where setuid scripts have
6363 been disabled, the setuid/setgid bits on scripts are currently
6364 useless.  It is possible for $package to detect those bits and emulate
6365 setuid/setgid in a secure fashion.  This emulation will only work if
6366 setuid scripts have been disabled in your kernel.
6367
6368 EOM
6369         case "$d_dosuid" in
6370         "$define") dflt=y ;;
6371         *) dflt=n ;;
6372         esac
6373         rp="Do you want to do setuid/setgid emulation?"
6374         . ./myread
6375         case "$ans" in
6376         [yY]*)  val="$define";;
6377         *)      val="$undef";;
6378         esac
6379         ;;
6380 esac
6381 set d_dosuid
6382 eval $setvar
6383 else
6384     case "$d_dosuid" in
6385         "$define")
6386         cat >&4 <<EOH
6387
6388 SUID emulation has been removed for 5.12
6389 Please re-run Configure without -Dd_dosuid
6390
6391 EOH
6392         exit 1;
6393         ;;
6394     esac
6395     d_dosuid=undef
6396 fi
6397
6398 : Find perl5.005 or later.
6399 echo "Looking for a previously installed perl5.005 or later... "
6400 case "$perl5" in
6401 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6402                 : Check if this perl is recent and can load a simple module
6403                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6404                         perl5=$tdir/perl
6405                         break;
6406                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6407                         perl5=$tdir/perl5
6408                         break;
6409                 fi
6410         done
6411         ;;
6412 *)      perl5="$perl5"
6413         ;;
6414 esac
6415 case "$perl5" in
6416 '')     echo "None found.  That's ok.";;
6417 *)      echo "Using $perl5." ;;
6418 esac
6419
6420 : Set the siteprefix variables
6421 $cat <<EOM
6422
6423 After $package is installed, you may wish to install various
6424 add-on modules and utilities.  Typically, these add-ons will
6425 be installed under $prefix with the rest
6426 of this package.  However, you may wish to install such add-ons
6427 elsewhere under a different prefix.
6428
6429 If you do not wish to put everything under a single prefix, that's
6430 ok.  You will be prompted for the individual locations; this siteprefix
6431 is only used to suggest the defaults.
6432
6433 The default should be fine for most people.
6434
6435 EOM
6436 fn=d~+
6437 rp='Installation prefix to use for add-on modules and utilities?'
6438 : XXX Here might be another good place for an installstyle setting.
6439 case "$siteprefix" in
6440 '') dflt=$prefix ;;
6441 *)  dflt=$siteprefix ;;
6442 esac
6443 . ./getfile
6444 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6445 oldsiteprefix=''
6446 case "$siteprefix" in
6447 '') ;;
6448 *)      case "$ans" in
6449         "$prefix") ;;
6450         *) oldsiteprefix="$prefix";;
6451         esac
6452         ;;
6453 esac
6454 siteprefix="$ans"
6455 siteprefixexp="$ansexp"
6456
6457 : determine where site specific libraries go.
6458 : Usual default is /usr/local/lib/perl5/site_perl/$version
6459 : The default "style" setting is made in installstyle.U
6460 : XXX No longer works with Prefixit stuff.
6461 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6462 case "$sitelib" in
6463 '') case "$installstyle" in
6464         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6465         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6466         esac
6467         ;;
6468 *)      dflt="$sitelib"
6469         ;;
6470 esac
6471 $cat <<EOM
6472
6473 The installation process will create a directory for
6474 site-specific extensions and modules.  Most users find it convenient
6475 to place all site-specific files in this directory rather than in the
6476 main distribution directory.
6477
6478 EOM
6479 fn=d~+
6480 rp='Pathname for the site-specific library files?'
6481 . ./getfile
6482 prefixvar=sitelib
6483 . ./setprefixvar
6484 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6485
6486 : Determine list of previous versions to include in @INC
6487 $cat > getverlist <<EOPL
6488 #!$perl5 -w
6489 use File::Basename;
6490 \$api_versionstring = "$api_versionstring";
6491 \$version = "$version";
6492 \$stem = "$sitelib_stem";
6493 \$archname = "$archname";
6494 EOPL
6495         $cat >> getverlist <<'EOPL'
6496 # The list found is store twice for each entry: the original name, and
6497 # the binary broken down version as pack "sss", so sorting is easy and
6498 # unambiguous. This will work for all versions that have a maximum of
6499 # three digit groups, separate by '.'s or '_'s. Names are extended with
6500 # ".0.0" to ensure at least three elements for the pack.
6501 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6502
6503 # Can't have leading @ because metaconfig interprets it as a command!
6504 ;@inc_version_list=();
6505 # XXX Redo to do opendir/readdir?
6506 if (-d $stem) {
6507     chdir($stem);
6508     ;@candidates = map {
6509         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6510     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6511 }
6512 else {
6513     ;@candidates = ();
6514 }
6515
6516 ($pversion, $aversion, $vsn5005) = map {
6517     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6518 foreach $d (@candidates) {
6519     if ($d->[1] lt $pversion) {
6520         if ($d->[1] ge $aversion) {
6521             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6522         }
6523         elsif ($d->[1] ge $vsn5005) {
6524             unshift(@inc_version_list, grep { -d } $d->[0]);
6525         }
6526     }
6527     else {
6528         # Skip newer version.  I.e. don't look in
6529         # 5.7.0 if we're installing 5.6.1.
6530     }
6531 }
6532
6533 if (@inc_version_list) {
6534     print join(' ', @inc_version_list);
6535 }
6536 else {
6537     # Blank space to preserve value for next Configure run.
6538     print " ";
6539 }
6540 EOPL
6541 chmod +x getverlist
6542 case "$inc_version_list" in
6543 '')     if test -x "$perl5$exe_ext"; then
6544                 dflt=`$perl5 getverlist`
6545         else
6546                 dflt='none'
6547         fi
6548         ;;
6549 $undef) dflt='none' ;;
6550 *)  eval dflt=\"$inc_version_list\" ;;
6551 esac
6552 case "$dflt" in
6553 ''|' ') dflt=none ;;
6554 esac
6555 case "$dflt" in
6556 5.005) dflt=none ;;
6557 esac
6558 $cat <<EOM
6559
6560 In order to ease the process of upgrading, this version of perl
6561 can be configured to use modules built and installed with earlier
6562 versions of perl that were installed under $prefix.  Specify here
6563 the list of earlier versions that this version of perl should check.
6564 If Configure detected no earlier versions of perl installed under
6565 $prefix, then the list will be empty.  Answer 'none' to tell perl
6566 to not search earlier versions.
6567
6568 The default should almost always be sensible, so if you're not sure,
6569 just accept the default.
6570 EOM
6571
6572 rp='List of earlier versions to include in @INC?'
6573 . ./myread
6574 case "$ans" in
6575 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6576 *) inc_version_list="$ans" ;;
6577 esac
6578 case "$inc_version_list" in
6579 ''|' ')
6580         inc_version_list_init='0'
6581         d_inc_version_list="$undef"
6582         ;;
6583 *)      inc_version_list_init=`echo $inc_version_list |
6584                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6585         d_inc_version_list="$define"
6586         ;;
6587 esac
6588 $rm -f getverlist
6589
6590 : see if malloc/malloc.h has to be included
6591 set malloc/malloc.h i_mallocmalloc
6592 eval $inhdr
6593
6594 : see if this is a malloc.h system
6595 : we want a real compile instead of Inhdr because some systems have a
6596 : malloc.h that just gives a compile error saying to use stdlib.h instead
6597 echo " "
6598 $cat >try.c <<EOCP
6599 #include <stdlib.h>
6600 #include <malloc.h>
6601 #$i_mallocmalloc I_MALLOCMALLOC
6602 #ifdef I_MALLOCMALLOC
6603 # include <malloc/malloc.h>
6604 #endif
6605
6606 int main () { return 0; }
6607 EOCP
6608 set try
6609 if eval $compile; then
6610     echo "<malloc.h> found." >&4
6611     val="$define"
6612 else
6613     echo "<malloc.h> NOT found." >&4
6614     val="$undef"
6615 fi
6616 $rm_try
6617 set i_malloc
6618 eval $setvar
6619
6620 : check for void type
6621 echo " "
6622 echo "Checking to see how well your C compiler groks the void type..." >&4
6623 case "$voidflags" in
6624 '')
6625         $cat >try.c <<EOCP
6626 #$i_stdlib I_STDLIB
6627 #ifdef I_STDLIB
6628 #include <stdlib.h>
6629 #endif
6630 #if TRY & 1
6631 void sub() {
6632 #else
6633 sub() {
6634 #endif
6635         extern void moo();      /* function returning void */
6636         void (*goo)();          /* ptr to func returning void */
6637 #if TRY & 8
6638         void *hue;              /* generic ptr */
6639 #endif
6640 #if TRY & 2
6641         void (*foo[10])();
6642 #endif
6643
6644 #if TRY & 4
6645         if(goo == moo) {
6646                 exit(0);
6647         }
6648 #endif
6649         exit(0);
6650 }
6651 int main() { sub(); }
6652 EOCP
6653         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6654                 voidflags=$defvoidused
6655         echo "Good.  It appears to support void to the level $package wants.">&4
6656                 if $contains warning .out >/dev/null 2>&1; then
6657                         echo "However, you might get some warnings that look like this:"
6658                         $cat .out
6659                 fi
6660         else
6661 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6662                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6663                         echo "It supports 1..."
6664                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6665                                 echo "It also supports 2..."
6666                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6667                                         voidflags=7
6668                                         echo "And it supports 4 but not 8 definitely."
6669                                 else
6670                                         echo "It doesn't support 4..."
6671                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6672                                                 voidflags=11
6673                                                 echo "But it supports 8."
6674                                         else
6675                                                 voidflags=3
6676                                                 echo "Neither does it support 8."
6677                                         fi
6678                                 fi
6679                         else
6680                                 echo "It does not support 2..."
6681                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6682                                         voidflags=13
6683                                         echo "But it supports 4 and 8."
6684                                 else
6685                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6686                                                 voidflags=5
6687                                                 echo "And it supports 4 but has not heard about 8."
6688                                         else
6689                                                 echo "However it supports 8 but not 4."
6690                                         fi
6691                                 fi
6692                         fi
6693                 else
6694                         echo "There is no support at all for void."
6695                         voidflags=0
6696                 fi
6697         fi
6698 esac
6699 case "$voidflags" in
6700 "$defvoidused") ;;
6701 *)      $cat >&4 <<'EOM'
6702   Support flag bits are:
6703     1: basic void declarations.
6704     2: arrays of pointers to functions returning void.
6705     4: operations between pointers to and addresses of void functions.
6706     8: generic void pointers.
6707 EOM
6708         dflt="$voidflags";
6709         rp="Your void support flags add up to what?"
6710         . ./myread
6711         voidflags="$ans"
6712         ;;
6713 esac
6714 $rm_try
6715
6716 : check for length of pointer
6717 echo " "
6718 case "$ptrsize" in
6719 '')
6720         echo "Checking to see how big your pointers are..." >&4
6721         if test "$voidflags" -gt 7; then
6722                 echo '#define VOID_PTR char *' > try.c
6723         else
6724                 echo '#define VOID_PTR void *' > try.c
6725         fi
6726         $cat >>try.c <<EOCP
6727 #include <stdio.h>
6728 #$i_stdlib I_STDLIB
6729 #ifdef I_STDLIB
6730 #include <stdlib.h>
6731 #endif
6732 int main()
6733 {
6734     printf("%d\n", (int)sizeof(VOID_PTR));
6735     exit(0);
6736 }
6737 EOCP
6738         set try
6739         if eval $compile_ok; then
6740                 ptrsize=`$run ./try`
6741                 echo "Your pointers are $ptrsize bytes long."
6742         else
6743                 dflt='4'
6744                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6745                 rp="What is the size of a pointer (in bytes)?"
6746                 . ./myread
6747                 ptrsize="$ans"
6748         fi
6749         ;;
6750 esac
6751 $rm_try
6752 case "$use64bitall" in
6753 "$define"|true|[yY]*)
6754         case "$ptrsize" in
6755         4)      cat <<EOM >&4
6756
6757 *** You have chosen a maximally 64-bit build,
6758 *** but your pointers are only 4 bytes wide.
6759 *** Please rerun Configure without -Duse64bitall.
6760 EOM
6761                 case "$d_quad" in
6762                 define)
6763                         cat <<EOM >&4
6764 *** Since you have quads, you could possibly try with -Duse64bitint.
6765 EOM
6766                         ;;
6767                 esac
6768                 cat <<EOM >&4
6769 *** Cannot continue, aborting.
6770
6771 EOM
6772
6773                 exit 1
6774                 ;;
6775         esac
6776         ;;
6777 esac
6778
6779
6780 : determine whether to use malloc wrapping
6781 echo " "
6782 case "$usemallocwrap" in
6783 [yY]*|true|$define)     dflt='y' ;;
6784 [nN]*|false|$undef)     dflt='n' ;;
6785 *)      case "$usedevel" in
6786         [yY]*|true|$define)     dflt='y' ;;
6787         *) dflt='n' ;;
6788         esac
6789         ;;
6790 esac
6791 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6792 . ./myread
6793 usemallocwrap="$ans"
6794 case "$ans" in
6795 y*|true)
6796         usemallocwrap="$define" ;;
6797 *)
6798         usemallocwrap="$undef" ;;
6799 esac
6800
6801 : determine which malloc to compile in
6802 echo " "
6803 case "$usemymalloc" in
6804 [yY]*|true|$define)     dflt='y' ;;
6805 [nN]*|false|$undef)     dflt='n' ;;
6806 *)      case "$ptrsize" in
6807         4) dflt='y' ;;
6808         *) dflt='n' ;;
6809         esac
6810         if test "$useithreads" = "$define"; then dflt='n'; fi
6811         ;;
6812 esac
6813 rp="Do you wish to attempt to use the malloc that comes with $package?"
6814 . ./myread
6815 usemymalloc="$ans"
6816 case "$ans" in
6817 y*|true)
6818         usemymalloc='y'
6819         mallocsrc='malloc.c'
6820         mallocobj="malloc$_o"
6821         d_mymalloc="$define"
6822         case "$libs" in
6823         *-lmalloc*)
6824                 : Remove malloc from list of libraries to use
6825                 echo "Removing unneeded -lmalloc from library list" >&4
6826                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6827                 shift
6828                 libs="$*"
6829                 echo "libs = $libs" >&4
6830                 ;;
6831         esac
6832         ;;
6833 *)
6834         usemymalloc='n'
6835         mallocsrc=''
6836         mallocobj=''
6837         d_mymalloc="$undef"
6838         ;;
6839 esac
6840
6841 : compute the return types of malloc and free
6842 echo " "
6843 $cat >malloc.c <<END
6844 #$i_malloc I_MALLOC
6845 #$i_stdlib I_STDLIB
6846 #include <stdio.h>
6847 #include <sys/types.h>
6848 #ifdef I_MALLOC
6849 #include <malloc.h>
6850 #endif
6851 #ifdef I_STDLIB
6852 #include <stdlib.h>
6853 #endif
6854 #ifdef TRY_MALLOC
6855 void *malloc();
6856 #endif
6857 #ifdef TRY_FREE
6858 void free();
6859 #endif
6860 END
6861 case "$malloctype" in
6862 '')
6863         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6864                 malloctype='void *'
6865         else
6866                 malloctype='char *'
6867         fi
6868         ;;
6869 esac
6870 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6871
6872 case "$freetype" in
6873 '')
6874         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6875                 freetype='void'
6876         else
6877                 freetype='int'
6878         fi
6879         ;;
6880 esac
6881 echo "Your system uses $freetype free(), it would seem." >&4
6882 $rm -f malloc.[co]
6883 : determine where site specific architecture-dependent libraries go.
6884 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6885 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6886 : sitelib may have an optional trailing /share.
6887 case "$sitearch" in
6888 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6889         dflt="$dflt/$archname"
6890         ;;
6891 *)      dflt="$sitearch"
6892         ;;
6893 esac
6894 set sitearch sitearch none
6895 eval $prefixit
6896 $cat <<EOM
6897
6898 The installation process will also create a directory for
6899 architecture-dependent site-specific extensions and modules.
6900
6901 EOM
6902 fn=d~+
6903 rp='Pathname for the site-specific architecture-dependent library files?'
6904 . ./getfile
6905 prefixvar=sitearch
6906 . ./setprefixvar
6907 if $test X"$sitearch" = X"$sitelib"; then
6908         d_sitearch="$undef"
6909 else
6910         d_sitearch="$define"
6911 fi
6912
6913 : Set the vendorprefix variables
6914 $cat <<EOM
6915
6916 The installation process will also create a directory for
6917 vendor-supplied add-ons.  Vendors who supply perl with their system
6918 may find it convenient to place all vendor-supplied files in this
6919 directory rather than in the main distribution directory.  This will
6920 ease upgrades between binary-compatible maintenance versions of perl.
6921
6922 Of course you may also use these directories in whatever way you see
6923 fit.  For example, you might use them to access modules shared over a
6924 company-wide network.
6925
6926 The default answer should be fine for most people.
6927 This causes further questions about vendor add-ons to be skipped
6928 and no vendor-specific directories will be configured for perl.
6929
6930 EOM
6931 rp='Do you want to configure vendor-specific add-on directories?'
6932 case "$usevendorprefix" in
6933 define|true|[yY]*) dflt=y ;;
6934 *)      : User may have set vendorprefix directly on Configure command line.
6935         case "$vendorprefix" in
6936         ''|' ') dflt=n ;;
6937         *)      dflt=y ;;
6938         esac
6939         ;;
6940 esac
6941 . ./myread
6942 case "$ans" in
6943 [yY]*)  fn=d~+
6944         rp='Installation prefix to use for vendor-supplied add-ons?'
6945         case "$vendorprefix" in
6946         '') dflt='' ;;
6947         *)  dflt=$vendorprefix ;;
6948         esac
6949         . ./getfile
6950         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6951         oldvendorprefix=''
6952         case "$vendorprefix" in
6953         '') ;;
6954         *)      case "$ans" in
6955                 "$prefix") ;;
6956                 *) oldvendorprefix="$prefix";;
6957                 esac
6958                 ;;
6959         esac
6960         usevendorprefix="$define"
6961         vendorprefix="$ans"
6962         vendorprefixexp="$ansexp"
6963         ;;
6964 *)      usevendorprefix="$undef"
6965         vendorprefix=''
6966         vendorprefixexp=''
6967         ;;
6968 esac
6969
6970 : Set the vendorlib variables
6971 case "$vendorprefix" in
6972 '')     d_vendorlib="$undef"
6973         vendorlib=''
6974         vendorlibexp=''
6975         ;;
6976 *)      d_vendorlib="$define"
6977         : determine where vendor-supplied modules go.
6978         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6979         case "$vendorlib" in
6980         '')
6981                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6982                 case "$installstyle" in
6983                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6984                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6985                 esac
6986                 ;;
6987         *)      dflt="$vendorlib"
6988                 ;;
6989         esac
6990         fn=d~+
6991         rp='Pathname for the vendor-supplied library files?'
6992         . ./getfile
6993         vendorlib="$ans"
6994         vendorlibexp="$ansexp"
6995         ;;
6996 esac
6997 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6998 prefixvar=vendorlib
6999 . ./installprefix
7000
7001 : Set the vendorarch variables
7002 case "$vendorprefix" in
7003 '')     d_vendorarch="$undef"
7004         vendorarch=''
7005         vendorarchexp=''
7006         ;;
7007 *)      d_vendorarch="$define"
7008         : determine where vendor-supplied architecture-dependent libraries go.
7009         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7010         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7011         : vendorlib may have an optional trailing /share.
7012         case "$vendorarch" in
7013         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7014                 dflt="$dflt/$archname"
7015                 ;;
7016         *)      dflt="$vendorarch" ;;
7017         esac
7018         fn=d~+
7019         rp='Pathname for vendor-supplied architecture-dependent files?'
7020         . ./getfile
7021         vendorarch="$ans"
7022         vendorarchexp="$ansexp"
7023         ;;
7024 esac
7025 prefixvar=vendorarch
7026 . ./installprefix
7027 if $test X"$vendorarch" = X"$vendorlib"; then
7028         d_vendorarch="$undef"
7029 else
7030         d_vendorarch="$define"
7031 fi
7032
7033 : Final catch-all directories to search
7034 $cat <<EOM
7035
7036 Lastly, you can have perl look in other directories for extensions and
7037 modules in addition to those already specified.
7038 These directories will be searched after 
7039         $sitearch 
7040         $sitelib 
7041 EOM
7042 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7043 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7044 echo ' '
7045 case "$otherlibdirs" in
7046 ''|' ') dflt='none' ;;
7047 *)      dflt="$otherlibdirs" ;;
7048 esac
7049 $cat <<EOM
7050 Enter a colon-separated set of extra paths to include in perl's @INC
7051 search path, or enter 'none' for no extra paths.
7052
7053 EOM
7054
7055 rp='Colon-separated list of additional directories for perl to search?'
7056 . ./myread
7057 case "$ans" in
7058 ' '|''|none)    otherlibdirs=' ' ;;     
7059 *)      otherlibdirs="$ans" ;;
7060 esac
7061 case "$otherlibdirs" in
7062 ' ') val=$undef ;;
7063 *)      val=$define ;;
7064 esac
7065 set d_perl_otherlibdirs
7066 eval $setvar
7067
7068 : Cruising for prototypes
7069 echo " "
7070 echo "Checking out function prototypes..." >&4
7071 $cat >prototype.c <<EOCP
7072 #$i_stdlib I_STDLIB
7073 #ifdef I_STDLIB
7074 #include <stdlib.h>
7075 #endif
7076 int main(int argc, char *argv[]) {
7077         exit(0);}
7078 EOCP
7079 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7080         echo "Your C compiler appears to support function prototypes."
7081         val="$define"
7082 else
7083         echo "Your C compiler doesn't seem to understand function prototypes."
7084         val="$undef"
7085 fi
7086 set prototype
7087 eval $setvar
7088 $rm -f prototype*
7089
7090 : Check if ansi2knr is required
7091 case "$prototype" in
7092 "$define") ;;
7093 *)      ansi2knr='ansi2knr'
7094         echo " "
7095         cat <<EOM >&4
7096
7097 $me:  FATAL ERROR:
7098 This version of $package can only be compiled by a compiler that 
7099 understands function prototypes.  Unfortunately, your C compiler 
7100         $cc $ccflags
7101 doesn't seem to understand them.  Sorry about that.
7102
7103 If GNU cc is available for your system, perhaps you could try that instead.  
7104
7105 Eventually, we hope to support building Perl with pre-ANSI compilers.
7106 If you would like to help in that effort, please contact <perlbug@perl.org>.
7107
7108 Aborting Configure now.
7109 EOM
7110         exit 2
7111         ;;
7112 esac
7113
7114 : DTrace support
7115 dflt_dtrace='/usr/sbin/dtrace'
7116 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7117
7118 cat <<EOM
7119
7120 Perl can be built to support DTrace on platforms that support it.
7121 DTrace is a diagnosis and performance analysis tool from Sun.
7122
7123 If this doesn't make any sense to you, just accept the default '$dflt'.
7124 EOM
7125
7126 while $test 1 ; do
7127         case "$usedtrace" in
7128         $define|true|[yY]*)
7129                 dflt='y'
7130                 ;;
7131         ?*)
7132                 dflt='y'
7133                 dflt_dtrace=$usedtrace
7134                 ;;
7135         *)
7136                 dflt='n'
7137                 ;;
7138         esac
7139
7140         rp='Support DTrace if available?'
7141         . ./myread
7142         case "$ans" in
7143         y|Y)    val="$define" ;;
7144         *)      val="$undef" ;;
7145         esac
7146         set usedtrace
7147         eval $setvar
7148
7149         test "X$usedtrace" != "X$define" && break
7150
7151         echo " "
7152         rp='Where is the dtrace executable?'
7153         dflt=$dflt_dtrace
7154         . ./getfile
7155         val="$ans"
7156         set dtrace
7157         eval $setvar
7158
7159         if $test -f $dtrace
7160         then
7161                 if $dtrace -h -s ../perldtrace.d \
7162                         -o perldtrace.tmp >/dev/null 2>&1 \
7163                         && rm -f perldtrace.tmp
7164                 then
7165                         echo " "
7166                         echo "Good: your $dtrace knows about the -h flag."
7167                 else
7168                         cat >&2 <<EOM
7169
7170 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7171 ***
7172 *** Your installed dtrace doesn't support the -h switch to compile a D
7173 *** program into a C header. Can't continue.
7174
7175 EOM
7176                         exit 1
7177                 fi
7178                 break;
7179         fi
7180
7181         case "$fastread" in
7182         yes)
7183                 cat >&2 <<EOM
7184
7185 *** $me:  Fatal Error:  $dtrace not found.
7186 *** Can't continue.
7187
7188 EOM
7189                 exit 1
7190                 ;;
7191         *)
7192                 echo "*** $dtrace was not found."
7193                 echo " "
7194                 ;;
7195         esac
7196 done
7197
7198 : See if we want extra modules installed
7199 echo " "
7200 case "$extras" in
7201 '') dflt='n';;
7202 *) dflt='y';;
7203 esac
7204 cat <<EOM
7205 Perl can be built with extra modules or bundles of modules which
7206 will be fetched from the CPAN and installed alongside Perl.
7207
7208 Notice that you will need access to the CPAN; either via the Internet,
7209 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7210 be asked later to configure the CPAN.pm module which will in turn do
7211 the installation of the rest of the extra modules or bundles.)
7212
7213 Notice also that if the modules require any external software such as
7214 libraries and headers (the libz library and the zlib.h header for the
7215 Compress::Zlib module, for example) you MUST have any such software
7216 already installed, this configuration process will NOT install such
7217 things for you.
7218
7219 If this doesn't make any sense to you, just accept the default '$dflt'.
7220 EOM
7221 rp='Install any extra modules (y or n)?'
7222 . ./myread
7223 case "$ans" in
7224 y|Y)
7225         cat <<EOM
7226
7227 Please list any extra modules or bundles to be installed from CPAN,
7228 with spaces between the names.  The names can be in any format the
7229 'install' command of CPAN.pm will understand.  (Answer 'none',
7230 without the quotes, to install no extra modules or bundles.)
7231 EOM
7232         rp='Extras?'
7233         dflt="$extras"
7234         . ./myread
7235         extras="$ans"
7236 esac
7237 case "$extras" in
7238 ''|'none')
7239         val=''
7240         $rm -f ../extras.lst
7241         ;;
7242 *)      echo "(Saving the list of extras for later...)"
7243         echo "$extras" > ../extras.lst
7244         val="'$extras'"
7245         ;;
7246 esac
7247 set extras
7248 eval $setvar
7249 echo " "
7250
7251 : determine where html pages for programs go
7252 set html1dir html1dir none
7253 eval $prefixit
7254 $cat <<EOM
7255
7256 If you wish to install html files for programs in $spackage, indicate
7257 the appropriate directory here.  To skip installing html files,
7258 answer "none".
7259 EOM
7260 case "$html1dir" in
7261 ''|none|$undef|' ') dflt=none ;;
7262 *) dflt=$html1dir ;;
7263 esac
7264 fn=dn+~
7265 rp="Directory for the main $spackage html pages?"
7266 . ./getfile
7267 prefixvar=html1dir
7268 . ./setprefixvar
7269 : Use ' ' for none so value is preserved next time through Configure
7270 $test X"$html1dir" = "X" && html1dir=' '
7271
7272 : determine where html pages for libraries and modules go
7273 set html3dir html3dir none
7274 eval $prefixit
7275 $cat <<EOM
7276
7277 If you wish to install html files for modules associated with $spackage,
7278 indicate the appropriate directory here.  To skip installing html files,
7279 answer "none".
7280 EOM
7281 : There is no obvious default.  If they have specified html1dir, then
7282 : try to key off that, possibly changing .../html1 into .../html3.
7283 case "$html3dir" in
7284 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7285 *) dflt=$html3dir ;;
7286 esac
7287 fn=dn+~
7288 rp="Directory for the $spackage module html pages?"
7289 . ./getfile
7290 prefixvar=html3dir
7291 . ./setprefixvar
7292 : Use ' ' for none so value is preserved next time through Configure
7293 $test X"$html3dir" = "X" && html3dir=' '
7294
7295 : determine whether to install perl also as /usr/bin/perl
7296
7297 echo " "
7298 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7299         $cat <<EOM
7300 Many scripts expect perl to be installed as /usr/bin/perl.
7301
7302 If you want to, I can install the perl you are about to compile
7303 as /usr/bin/perl (in addition to $bin/perl).
7304 EOM
7305         if test -f /usr/bin/perl; then
7306             $cat <<EOM
7307
7308 However, please note that because you already have a /usr/bin/perl,
7309 overwriting that with a new Perl would very probably cause problems.
7310 Therefore I'm assuming you don't want to do that (unless you insist).
7311
7312 EOM
7313             case "$installusrbinperl" in
7314             "$define"|[yY]*)    dflt='y';;
7315             *)                  dflt='n';;
7316             esac
7317         else
7318             $cat <<EOM
7319
7320 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7321
7322 EOM
7323             case "$installusrbinperl" in
7324             "$undef"|[nN]*)     dflt='n';;
7325             *)                  dflt='y';;
7326             esac
7327         fi
7328         rp="Do you want to install perl as /usr/bin/perl?"
7329         . ./myread
7330         case "$ans" in
7331         [yY]*)  val="$define";;
7332         *)      val="$undef" ;;
7333         esac
7334 else
7335         val="$undef"
7336 fi
7337 set installusrbinperl
7338 eval $setvar
7339
7340 : Check if we are using the GNU C library
7341 echo " "
7342 echo "Checking for GNU C Library..." >&4
7343 cat >try.c <<'EOCP'
7344 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7345    alone are insufficient to distinguish different versions, such as
7346    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7347    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7348 */
7349 #include <stdio.h>
7350 int main(void)
7351 {
7352 #ifdef __GLIBC__
7353 #   ifdef __GLIBC_MINOR__
7354 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7355 #           include <gnu/libc-version.h>
7356             printf("%s\n",  gnu_get_libc_version());
7357 #       else
7358             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7359 #       endif
7360 #   else
7361         printf("%d\n",  __GLIBC__);
7362 #   endif
7363     return 0;
7364 #else
7365     return 1;
7366 #endif
7367 }
7368 EOCP
7369 set try
7370 if eval $compile_ok && $run ./try > glibc.ver; then
7371         val="$define"
7372         gnulibc_version=`$cat glibc.ver`
7373         echo "You are using the GNU C Library version $gnulibc_version"
7374 else
7375         val="$undef"
7376         gnulibc_version=''
7377         echo "You are not using the GNU C Library"
7378 fi
7379 $rm_try glibc.ver
7380 set d_gnulibc
7381 eval $setvar
7382
7383 : see if nm is to be used to determine whether a symbol is defined or not
7384 case "$usenm" in
7385 '')
7386         dflt=''
7387         case "$d_gnulibc" in
7388         "$define")
7389                 echo " "
7390                 echo "nm probably won't work on the GNU C Library." >&4
7391                 dflt=n
7392                 ;;
7393         esac
7394         case "$dflt" in
7395         '') 
7396                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7397                         echo " "
7398                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7399                         echo "'nm' won't be sufficient on this sytem." >&4
7400                         dflt=n
7401                 fi
7402                 ;;
7403         esac
7404         case "$dflt" in
7405         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7406                 if $test $dflt -gt 20; then
7407                         dflt=y
7408                 else
7409                         dflt=n
7410                 fi
7411                 ;;
7412         esac
7413         ;;
7414 *)
7415         case "$usenm" in
7416         true|$define) dflt=y;;
7417         *) dflt=n;;
7418         esac
7419         ;;
7420 esac
7421 $cat <<EOM
7422
7423 I can use $nm to extract the symbols from your C libraries. This
7424 is a time consuming task which may generate huge output on the disk (up
7425 to 3 megabytes) but that should make the symbols extraction faster. The
7426 alternative is to skip the 'nm' extraction part and to compile a small
7427 test program instead to determine whether each symbol is present. If
7428 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7429 this may be the best solution.
7430
7431 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7432
7433 EOM
7434 rp="Shall I use $nm to extract C symbols from the libraries?"
7435 . ./myread
7436 case "$ans" in
7437 [Nn]*) usenm=false;;
7438 *) usenm=true;;
7439 esac
7440
7441 runnm=$usenm
7442 case "$reuseval" in
7443 true) runnm=false;;
7444 esac
7445
7446 : nm options which may be necessary
7447 case "$nm_opt" in
7448 '') if $test -f /mach_boot; then
7449                 nm_opt=''       # Mach
7450         elif $test -d /usr/ccs/lib; then
7451                 nm_opt='-p'     # Solaris (and SunOS?)
7452         elif $test -f /dgux; then
7453                 nm_opt='-p'     # DG-UX
7454         elif $test -f /lib64/rld; then
7455                 nm_opt='-p'     # 64-bit Irix
7456         else
7457                 nm_opt=''
7458         fi;;
7459 esac
7460
7461 : nm options which may be necessary for shared libraries but illegal
7462 : for archive libraries.  Thank you, Linux.
7463 case "$nm_so_opt" in
7464 '')     case "$myuname" in
7465         *linux*|gnu*)
7466                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7467                         nm_so_opt='--dynamic'
7468                 fi
7469                 ;;
7470         esac
7471         ;;
7472 esac
7473
7474 : Figure out where the libc is located
7475 case "$runnm" in
7476 true)
7477 : get list of predefined functions in a handy place
7478 echo " "
7479 case "$libc" in
7480 '') libc=unknown
7481         case "$libs" in
7482         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7483         esac
7484         ;;
7485 esac
7486 case "$libs" in
7487 '') ;;
7488 *)  for thislib in $libs; do
7489         case "$thislib" in
7490         -lc|-lc_s)
7491                 : Handle C library specially below.
7492                 ;;
7493         -l*)
7494                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7495                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7496                         :
7497                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7498                         :
7499                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7500                         :
7501                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7502                         :
7503                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7504                         :
7505                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7506                         :
7507                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7508                         :
7509                 else
7510                         try=''
7511                 fi
7512                 libnames="$libnames $try"
7513                 ;;
7514         *) libnames="$libnames $thislib" ;;
7515         esac
7516         done
7517         ;;
7518 esac
7519 xxx=normal
7520 case "$libc" in
7521 unknown)
7522         set /lib/libc.$so
7523         for xxx in $libpth; do
7524                 $test -r $1 || set $xxx/libc.$so
7525                 : The messy sed command sorts on library version numbers.
7526                 $test -r $1 || \
7527                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7528                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7529                                 h
7530                                 s/[0-9][0-9]*/0000&/g
7531                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7532                                 G
7533                                 s/\n/ /' | \
7534                          $sort | $sed -e 's/^.* //'`
7535                 eval set \$$#
7536         done
7537         $test -r $1 || set /usr/ccs/lib/libc.$so
7538         $test -r $1 || set /lib/libsys_s$_a
7539         ;;
7540 *)
7541         set blurfl
7542         ;;
7543 esac
7544 if $test -r "$1"; then
7545         echo "Your (shared) C library seems to be in $1."
7546         libc="$1"
7547 elif $test -r /lib/libc && $test -r /lib/clib; then
7548         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7549         xxx=apollo
7550         libc='/lib/clib /lib/libc'
7551         if $test -r /lib/syslib; then
7552                 echo "(Your math library is in /lib/syslib.)"
7553                 libc="$libc /lib/syslib"
7554         fi
7555 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7556         echo "Your C library seems to be in $libc, as you said before."
7557 elif $test -r $incpath/usr/lib/libc$_a; then
7558         libc=$incpath/usr/lib/libc$_a;
7559         echo "Your C library seems to be in $libc.  That's fine."
7560 elif $test -r /lib/libc$_a; then
7561         libc=/lib/libc$_a;
7562         echo "Your C library seems to be in $libc.  You're normal."
7563 else
7564         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7565                 :
7566         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7567                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7568         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7569                 :
7570         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7571                 :
7572         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7573                 :
7574         else
7575                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7576         fi
7577         if $test -r "$tans"; then
7578                 echo "Your C library seems to be in $tans, of all places."
7579                 libc=$tans
7580         else
7581                 libc='blurfl'
7582         fi
7583 fi
7584 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7585         dflt="$libc"
7586         cat <<EOM
7587
7588 If the guess above is wrong (which it might be if you're using a strange
7589 compiler, or your machine supports multiple models), you can override it here.
7590
7591 EOM
7592 else
7593         dflt=''
7594         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7595         cat >&4 <<EOM
7596 I can't seem to find your C library.  I've looked in the following places:
7597
7598 EOM
7599         $sed 's/^/      /' libpath
7600         cat <<EOM
7601
7602 None of these seems to contain your C library. I need to get its name...
7603
7604 EOM
7605 fi
7606 fn=f
7607 rp='Where is your C library?'
7608 . ./getfile
7609 libc="$ans"
7610
7611 echo " "
7612 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7613 set X `cat libnames`
7614 shift
7615 xxx=files
7616 case $# in 1) xxx=file; esac
7617 echo "Extracting names from the following $xxx for later perusal:" >&4
7618 echo " "
7619 $sed 's/^/      /' libnames >&4
7620 echo " "
7621 $echo $n "This may take a while...$c" >&4
7622
7623 for file in $*; do
7624         case $file in
7625         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7626         *) $nm $nm_opt $file 2>/dev/null;;
7627         esac
7628 done >libc.tmp
7629
7630 $echo $n ".$c"
7631 $grep fprintf libc.tmp > libc.ptf
7632 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7633 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7634 xxx='[ADTSIWi]'
7635 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7636         eval $xscan;\
7637         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7638                 eval $xrun
7639 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7640         eval $xscan;\
7641         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7642                 eval $xrun
7643 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7644         eval $xscan;\
7645         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7646                 eval $xrun
7647 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7648         eval $xscan;\
7649         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7650                 eval $xrun
7651 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7652         eval $xscan;\
7653         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7654                 eval $xrun
7655 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7656         eval $xscan;\
7657         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7658                 eval $xrun
7659 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7660                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7661         eval $xscan;\
7662         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7663                 eval $xrun
7664 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7665         eval $xscan;\
7666         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7667                 eval $xrun
7668 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7669         eval $xscan;\
7670         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7671                 eval $xrun
7672 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7673         eval $xscan;\
7674         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7675                 eval $xrun
7676 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7677         eval $xscan;\
7678         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7679                 eval $xrun
7680 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7681         eval $xscan;\
7682         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7683                 eval $xrun
7684 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7685         eval $xscan;\
7686         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7687                 eval $xrun
7688 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7689         eval $xscan;\
7690         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7691                 eval $xrun
7692 else
7693         $nm -p $* 2>/dev/null >libc.tmp
7694         $grep fprintf libc.tmp > libc.ptf
7695         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7696                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7697         then
7698                 nm_opt='-p'
7699                 eval $xrun
7700         else
7701                 echo " "
7702                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7703                 com=''
7704                 if $ar t $libc > libc.tmp && \
7705                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7706                 then
7707                         for thisname in $libnames $libc; do
7708                                 $ar t $thisname >>libc.tmp
7709                         done
7710                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7711                         echo "Ok." >&4
7712                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7713                         for thisname in $libnames $libc; do
7714                                 $ar tv $thisname >>libc.tmp
7715                                 emximp -o tmp.imp $thisname \
7716                                     2>/dev/null && \
7717                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7718                                     < tmp.imp >>libc.tmp
7719                                 $rm -f tmp.imp
7720                         done
7721                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7722                         echo "Ok." >&4
7723                 else
7724                         echo "$ar didn't seem to work right." >&4
7725                         echo "Maybe this is a Cray...trying bld instead..." >&4
7726                         if  bld t $libc | \
7727                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7728                                 $test -s libc.list
7729                         then
7730                                 for thisname in $libnames; do
7731                                         bld t $libnames | \
7732                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7733                                         $ar t $thisname >>libc.tmp
7734                                 done
7735                                 echo "Ok." >&4
7736                         else
7737                                 echo "That didn't work either.  Giving up." >&4
7738                                 exit 1
7739                         fi
7740                 fi
7741         fi
7742 fi
7743 nm_extract="$com"
7744 case "$PASE" in
7745 define)
7746     echo " "
7747     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7748     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7749     ;;
7750 *)  if $test -f /lib/syscalls.exp; then
7751         echo " "
7752         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7753         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7754                 /lib/syscalls.exp >>libc.list
7755     fi
7756     ;;
7757 esac
7758 ;;
7759 esac
7760 $rm -f libnames libpath
7761
7762 : see if dld is available
7763 set dld.h i_dld
7764 eval $inhdr
7765
7766 : Check if we are using C++
7767 echo " "
7768 echo "Checking for C++..." >&4
7769 $cat >try.c <<'EOCP'
7770 #include <stdio.h>
7771 int main(void)
7772 {
7773 #ifdef __cplusplus
7774     return 0;
7775 #else
7776     return 1;
7777 #endif
7778 }
7779 EOCP
7780 set try
7781 if eval $compile_ok && $run ./try; then
7782         val="$define"
7783         echo "You are using a C++ compiler."
7784 else
7785         val="$undef"
7786         echo "You are not using a C++ compiler."
7787 fi
7788 $rm_try cplusplus$$
7789 set d_cplusplus
7790 eval $setvar
7791
7792 : is a C symbol defined?
7793 csym='tlook=$1;
7794 case "$3" in
7795 -v) tf=libc.tmp; tdc="";;
7796 -a) tf=libc.tmp; tdc="[]";;
7797 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7798 esac;
7799 case "$d_cplusplus" in
7800     $define)    extern_C="extern \"C\"" ;;
7801     *)          extern_C="extern"       ;;
7802 esac;
7803 tx=yes;
7804 case "$reuseval-$4" in
7805 true-) ;;
7806 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7807 esac;
7808 case "$tx" in
7809 yes)
7810         tval=false;
7811         if $test "$runnm" = true; then
7812                 if $contains $tlook $tf >/dev/null 2>&1; then
7813                         tval=true;
7814                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7815                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7816                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7817                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7818                         $rm_try;
7819                 fi;
7820         else
7821                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7822                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7823                 $rm_try;
7824         fi;
7825         ;;
7826 *)
7827         case "$tval" in
7828         $define) tval=true;;
7829         *) tval=false;;
7830         esac;
7831         ;;
7832 esac;
7833 eval "$2=$tval"'
7834
7835 : define an is-in-libc? function
7836 inlibc='echo " "; td=$define; tu=$undef;
7837 sym=$1; var=$2; eval "was=\$$2";
7838 tx=yes;
7839 case "$reuseval$was" in
7840 true) ;;
7841 true*) tx=no;;
7842 esac;
7843 case "$tx" in
7844 yes)
7845         set $sym tres -f;
7846         eval $csym;
7847         case "$tres" in
7848         true)
7849                 echo "$sym() found." >&4;
7850                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7851         *)
7852                 echo "$sym() NOT found." >&4;
7853                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7854         esac;;
7855 *)
7856         case "$was" in
7857         $define) echo "$sym() found." >&4;;
7858         *) echo "$sym() NOT found." >&4;;
7859         esac;;
7860 esac'
7861
7862 : see if dlopen exists
7863 xxx_runnm="$runnm"
7864 xxx_ccflags="$ccflags"
7865 runnm=false
7866 : with g++ one needs -shared to get is-in-libc to work for dlopen
7867 case "$gccversion" in
7868 '')     ;;
7869 *)      case "$d_cplusplus" in
7870         "$define") ccflags="$ccflags -shared" ;;
7871         esac
7872         ;;
7873 esac
7874 set dlopen d_dlopen
7875 eval $inlibc
7876 runnm="$xxx_runnm"
7877 ccflags="$xxx_ccflags"
7878
7879 : see if this is a unistd.h system
7880 set unistd.h i_unistd
7881 eval $inhdr
7882
7883 : determine which dynamic loading, if any, to compile in
7884 echo " "
7885 dldir="ext/DynaLoader"
7886 case "$usedl" in
7887 $define|y|true)
7888         dflt='y'
7889         usedl="$define"
7890         ;;
7891 $undef|n|false)
7892         dflt='n'
7893         usedl="$undef"
7894         ;;
7895 *)
7896         dflt='n'
7897         case "$d_dlopen" in
7898             $define) dflt='y' ;;
7899         esac
7900         case "$i_dld" in
7901             $define) dflt='y' ;;
7902         esac
7903         : Does a dl_xxx.xs file exist for this operating system
7904         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7905         ;;
7906 esac
7907 rp="Do you wish to use dynamic loading?"
7908 . ./myread
7909 usedl="$ans"
7910 bin_ELF="$undef"
7911 case "$ans" in
7912 y*) usedl="$define"
7913         case "$dlsrc" in
7914         '')
7915                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7916                         dflt="$dldir/dl_${osname}.xs"
7917                 elif $test "$d_dlopen" = "$define" ; then
7918                         dflt="$dldir/dl_dlopen.xs"
7919                 elif $test "$i_dld" = "$define" ; then
7920                         dflt="$dldir/dl_dld.xs"
7921                 else
7922                         dflt=''
7923                 fi
7924                 ;;
7925         *)      dflt="$dldir/$dlsrc"
7926                 ;;
7927         esac
7928     echo "The following dynamic loading files are available:"
7929         : Can not go over to $dldir because getfile has path hard-coded in.
7930         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7931         rp="Source file to use for dynamic loading"
7932         fn="fne"
7933         gfpth="$src"
7934         . ./getfile
7935         usedl="$define"
7936         : emulate basename
7937         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7938
7939         $cat << EOM
7940
7941 Some systems may require passing special flags to $cc -c to
7942 compile modules that will be used to create a shared library.
7943 To use no flags, say "none".
7944
7945 EOM
7946     case "$cccdlflags" in
7947     '') case "$gccversion" in
7948                 '') case "$osname" in
7949                         hpux)   dflt='+z' ;;
7950                         next)   dflt='none' ;;
7951                         irix*)  dflt='-KPIC' ;;
7952                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7953                         sunos)  dflt='-pic' ;;
7954                         *)      dflt='none' ;;
7955                     esac
7956                         ;;
7957                 *)  case "$osname" in
7958                         darwin) dflt='none' ;;
7959                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7960                         *)      dflt='-fpic' ;;
7961                     esac ;;
7962             esac ;;
7963         ' ') dflt='none' ;;
7964     *)  dflt="$cccdlflags" ;;
7965     esac
7966     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7967     . ./myread
7968     case "$ans" in
7969     none) cccdlflags=' ' ;;
7970     *) cccdlflags="$ans" ;;
7971     esac
7972
7973     cat << EOM
7974
7975 Some systems use ld to create libraries that can be dynamically loaded,
7976 while other systems (such as those using ELF) use $cc.
7977
7978 EOM
7979
7980 : Determine if this is ELF
7981         $cat >try.c <<EOM
7982 /* Test for whether ELF binaries are produced */
7983 #include <fcntl.h>
7984 #$i_stdlib I_STDLIB
7985 #ifdef I_STDLIB
7986 #include <stdlib.h>
7987 #endif
7988 #$i_unistd I_UNISTD
7989 #ifdef I_UNISTD
7990 #include <unistd.h>
7991 #endif
7992 int main() {
7993         char b[4];
7994         int i = open("a.out",O_RDONLY);
7995         if(i == -1)
7996                 exit(1); /* fail */
7997         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7998                 exit(0); /* succeed (yes, it is ELF) */
7999         else
8000                 exit(1); /* fail */
8001 }
8002 EOM
8003         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8004                 bin_ELF="$define"
8005         fi
8006         $rm_try
8007
8008         case "$ld" in
8009         '')     if $test $bin_ELF = "$define"; then
8010                         cat <<EOM
8011 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8012 EOM
8013                         dflt="$cc"
8014                 else
8015                         echo "I'll use ld to build dynamic libraries."
8016                         dflt='ld'
8017                 fi
8018                 ;;
8019         *)      dflt="$ld"
8020                 ;;
8021         esac
8022
8023     rp="What command should be used to create dynamic libraries?"
8024     . ./myread
8025         ld="$ans"
8026
8027     cat << EOM
8028
8029 Some systems may require passing special flags to $ld to create a
8030 library that can be dynamically loaded.  If your ld flags include
8031 -L/other/path options to locate libraries outside your loader's normal
8032 search path, you may need to specify those -L options here as well.  To
8033 use no flags, say "none".
8034
8035 EOM
8036     case "$lddlflags" in
8037     '') case "$osname" in
8038                         haiku) dflt='-shared' ;;
8039                         hpux) dflt='-b';
8040                               case "$gccversion" in
8041                               '') dflt="$dflt +vnocompatwarnings" ;;
8042                               esac
8043                               ;;
8044                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8045                         next)  dflt='none' ;;
8046                         solaris) dflt='-G' ;;
8047                         sunos) dflt='-assert nodefinitions' ;;
8048                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8049                 *)     dflt='none' ;;
8050                         esac
8051                         ;;
8052     *) dflt="$lddlflags" ;;
8053     esac
8054
8055         : Try to guess additional flags to pick up local libraries.
8056         : Be careful not to append to a plain 'none'
8057         case "$dflt" in
8058         none) dflt='' ;;
8059         esac
8060         for thisflag in $ldflags; do
8061                 case "$thisflag" in
8062                 -L*|-R*|-Wl,-R*)
8063                         case " $dflt " in
8064                         *" $thisflag "*) ;;
8065                         *) dflt="$dflt $thisflag" ;;
8066                         esac
8067                         ;;
8068                 esac
8069         done
8070
8071         case "$dflt" in
8072         ''|' ') dflt='none' ;;
8073         esac
8074
8075         case "$ldflags" in
8076         *-fstack-protector*)
8077             case "$dflt" in
8078                         *-fstack-protector*) ;; # Don't add it again
8079                         *) dflt="$dflt -fstack-protector" ;; 
8080                 esac
8081                 ;;
8082         esac
8083
8084
8085     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8086     . ./myread
8087     case "$ans" in
8088     none) lddlflags=' ' ;;
8089     *) lddlflags="$ans" ;;
8090     esac
8091
8092         cat <<EOM
8093
8094 Some systems may require passing special flags to $cc to indicate that
8095 the resulting executable will use dynamic linking.  To use no flags,
8096 say "none".
8097
8098 EOM
8099     case "$ccdlflags" in
8100     '') case "$osname" in
8101             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8102             next|sunos) dflt='none' ;;
8103             *)          dflt='none' ;;
8104             esac ;;
8105     ' ')  dflt='none' ;;
8106     *)  dflt="$ccdlflags" ;;
8107     esac
8108     rp="Any special flags to pass to $cc to use dynamic linking?"
8109     . ./myread
8110     case "$ans" in
8111     none) ccdlflags=' ' ;;
8112     *) ccdlflags="$ans" ;;
8113     esac
8114     ;;
8115 *)  usedl="$undef"
8116         ld='ld'
8117     dlsrc='dl_none.xs'
8118     lddlflags=''
8119     ccdlflags=''
8120     ;;
8121 esac
8122
8123 ld_can_script="$undef"
8124 case "$bin_ELF$usedl" in
8125 $define$define)
8126     # Abuse try.h and a.out names for neat cleanup
8127     $cat >try.c <<EOM
8128 void foo() {}
8129 void bar() {}
8130 EOM
8131     $cat >try.h <<EOM
8132 LIBTEST_42 {
8133  global:
8134   foo;
8135  local: *;
8136  };
8137 EOM
8138     if $cc $cccdlflags $ccdlflags $ccflags \
8139            $ldflags $lddlflags -o a.out try.c \
8140            -Wl,--version-script=try.h >/dev/null 2>&1 \
8141        &&  $test -s a.out ; then
8142         echo "ld supports scripting" >&4
8143         ld_can_script="$define"
8144     else
8145         echo "ld does not support scripting" >&4
8146     fi
8147     $rm_try
8148     ;;
8149 esac
8150
8151 : Do we want a shared libperl?
8152 also=''
8153 case "$usedl" in
8154 $undef)
8155         # No dynamic loading being used, so don't bother even to prompt.
8156         useshrplib='false'
8157         ;;
8158 *)      case "$useshrplib" in
8159         '')     case "$osname" in
8160                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8161                         dflt=y
8162                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8163                         ;;
8164                 next*)
8165                         case "$osvers" in
8166                         4*)     dflt=y
8167                                 also='Building a shared libperl is needed for MAB support.'
8168                                 ;;
8169                         *)      dflt=n
8170                                 ;;
8171                         esac
8172                         ;;
8173                 *)      dflt=n
8174                         ;;
8175                 esac
8176                 ;;
8177         $define|true|[Yy]*)
8178                 dflt=y
8179                 ;;
8180         *)      dflt=n
8181                 ;;
8182         esac
8183         $cat << EOM
8184
8185 The perl executable is normally obtained by linking perlmain.c with
8186 libperl${_a}, any static extensions (usually just DynaLoader), and
8187 any other libraries needed on this system (such as -lm, etc.).  Since
8188 your system supports dynamic loading, it is probably possible to build
8189 a shared libperl.$so.  If you will have more than one executable linked
8190 to libperl.$so, this will significantly reduce the size of each
8191 executable, but it may have a noticeable effect on performance.  The
8192 default is probably sensible for your system.
8193 $also
8194
8195 EOM
8196         rp="Build a shared libperl.$so (y/n)"
8197         . ./myread
8198         case "$ans" in
8199         true|$define|[Yy]*)
8200                 useshrplib='true'  ;;
8201         *)      useshrplib='false' ;;
8202         esac
8203         ;;
8204 esac
8205
8206 case "$useshrplib" in
8207 true)
8208         case "$userelocatableinc" in
8209         true|define)
8210                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8211                 echo "See INSTALL for an explanation why that won't work." >&4
8212                 exit 4
8213                 ;;
8214         esac
8215         case "$libperl" in
8216         '')
8217                 # Figure out a good name for libperl.so.  Since it gets stored in
8218                 # a version-specific architecture-dependent library, the version
8219                 # number isn't really that important, except for making cc/ld happy.
8220                 #
8221                 # A name such as libperl.so.10.1
8222                 majmin="libperl.$so.$patchlevel.$subversion"
8223                 # A name such as libperl.so.100
8224                 majonly=`echo $patchlevel $subversion |
8225                         $awk '{printf "%d%02d", $1, $2}'`
8226                 majonly=libperl.$so.$majonly
8227                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8228                 # rely on figuring it out from the naming of libc.
8229                 case "${osname}${osvers}" in
8230                 next4*)
8231                         dflt=libperl.5.$so
8232                         # XXX How handle the --version stuff for MAB?
8233                         ;;
8234                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8235                         dflt=libperl.$so
8236                         ;;
8237                 cygwin*) # ld links now against the dll directly
8238                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8239                         majonly=`echo $patchlevel $subversion |
8240                                 $awk '{printf "%03d%03d", $1, $2}'`
8241                         majonly=cygperl5.$majonly.$so
8242                         dflt=$majmin
8243                         ;;
8244                 *)      # Try to guess based on whether libc has major.minor.
8245                         case "$libc" in
8246                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8247                         *libc.$so.[0-9]*) dflt=$majonly ;;
8248                         *)      dflt=libperl.$so ;;
8249                         esac
8250                         ;;
8251                 esac
8252                 ;;
8253         *)      dflt=$libperl
8254                 ;;
8255         esac
8256         cat << EOM
8257
8258 I need to select a good name for the shared libperl.  If your system uses
8259 library names with major and minor numbers, then you might want something
8260 like $majmin.  Alternatively, if your system uses a single version
8261 number for shared libraries, then you might want to use $majonly.
8262 Or, your system might be quite happy with a simple libperl.$so.
8263
8264 Since the shared libperl will get installed into a version-specific
8265 architecture-dependent directory, the version number of the shared perl
8266 library probably isn't important, so the default should be o.k.
8267
8268 EOM
8269         rp='What name do you want to give to the shared libperl?'
8270         . ./myread
8271         libperl=$ans
8272         echo "Ok, I'll use $libperl"
8273         ;;
8274 *)
8275         libperl="libperl${_a}"
8276         ;;
8277 esac
8278
8279 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8280 case "$shrpdir" in
8281 '') ;;
8282 *)      $cat >&4 <<EOM
8283 WARNING:  Use of the shrpdir variable for the installation location of
8284 the shared $libperl is not supported.  It was never documented and
8285 will not work in this version.  Let me (perlbug@perl.org)
8286 know of any problems this may cause.
8287
8288 EOM
8289         case "$shrpdir" in
8290         "$archlibexp/CORE")
8291                 $cat >&4 <<EOM
8292 But your current setting of $shrpdir is
8293 the default anyway, so it's harmless.
8294 EOM
8295                 ;;
8296         *)
8297                 $cat >&4 <<EOM
8298 Further, your current attempted setting of $shrpdir
8299 conflicts with the value of $archlibexp/CORE
8300 that installperl will use.
8301 EOM
8302                 ;;
8303         esac
8304         ;;
8305 esac
8306
8307 # How will the perl executable find the installed shared $libperl?
8308 # Add $xxx to ccdlflags.
8309 # If we can't figure out a command-line option, use $shrpenv to
8310 # set env LD_RUN_PATH.  The main perl makefile uses this.
8311 shrpdir=$archlibexp/CORE
8312 xxx=''
8313 tmp_shrpenv=''
8314 if "$useshrplib"; then
8315     case "$osname" in
8316         aix)
8317                 # We'll set it in Makefile.SH...
8318                 ;;
8319         solaris)
8320                 xxx="-R $shrpdir"
8321                 ;;
8322         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly)
8323                 xxx="-Wl,-R$shrpdir"
8324                 ;;
8325         bsdos|linux|irix*|dec_osf|gnu*)
8326                 xxx="-Wl,-rpath,$shrpdir"
8327                 ;;
8328         next)
8329                 # next doesn't like the default...
8330                 ;;
8331         haiku)
8332                 # Haiku doesn't like the default, either.
8333                 ;;
8334         hpux*)
8335                 # hpux doesn't like the default, either.
8336                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8337                 ;;
8338         cygwin)
8339                 # cygwin needs only ldlibpth
8340                 ;;
8341         *)
8342                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8343                 ;;
8344         esac
8345         case "$xxx" in
8346         '') ;;
8347         *)
8348                 # Only add $xxx if it isn't already in ccdlflags.
8349                 case " $ccdlflags " in
8350                 *" $xxx "*)     ;;
8351                 *)      ccdlflags="$ccdlflags $xxx"
8352                         cat <<EOM >&4
8353
8354 Adding $xxx to the flags
8355 passed to $ld so that the perl executable will find the
8356 installed shared $libperl.
8357
8358 EOM
8359                         ;;
8360                 esac
8361                 ;;
8362         esac
8363 fi
8364 # Fix ccdlflags in AIX for building external extensions.
8365 # (For building Perl itself bare -bE:perl.exp is needed,
8366 #  Makefile.SH takes care of this.)
8367 case "$osname" in
8368 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8369 esac
8370 # Respect a hint or command-line value.
8371 case "$shrpenv" in
8372 '') shrpenv="$tmp_shrpenv" ;;
8373 esac
8374 case "$ldlibpthname" in
8375 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8376 none)   ldlibpthname='' ;;
8377 esac
8378
8379 : determine where manual pages are on this system
8380 echo " "
8381 case "$sysman" in
8382 '') 
8383         syspath='/usr/share/man/man1 /usr/man/man1'
8384         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8385         syspath="$syspath /usr/man/u_man/man1"
8386         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8387         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8388         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8389         sysman=`./loc . /usr/man/man1 $syspath`
8390         ;;
8391 esac
8392 if $test -d "$sysman"; then
8393         echo "System manual is in $sysman." >&4
8394 else
8395         echo "Could not find manual pages in source form." >&4
8396 fi
8397
8398 : determine where manual pages go
8399 set man1dir man1dir none
8400 eval $prefixit
8401 $cat <<EOM
8402
8403 $spackage has manual pages available in source form.
8404 EOM
8405 case "$nroff" in
8406 nroff)
8407         echo "However, you don't have nroff, so they're probably useless to you."
8408         case "$man1dir" in
8409         '') man1dir="none";;
8410         esac;;
8411 esac
8412 echo "If you don't want the manual sources installed, answer 'none'."
8413 case "$man1dir" in
8414 ' ') dflt=none
8415         ;;
8416 '')
8417         lookpath="$prefixexp/share/man/man1"
8418         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8419         lookpath="$lookpath $prefixexp/man/p_man/man1"
8420         lookpath="$lookpath $prefixexp/man/u_man/man1"
8421         lookpath="$lookpath $prefixexp/man/man.1"
8422         case "$sysman" in
8423         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8424         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8425         esac
8426         set dflt
8427         eval $prefixup
8428         ;;
8429 *)  dflt="$man1dir"
8430         ;;
8431 esac
8432 echo " "
8433 fn=dn+~
8434 rp="Where do the main $spackage manual pages (source) go?"
8435 . ./getfile
8436 if $test "X$man1direxp" != "X$ansexp"; then
8437         installman1dir=''
8438 fi
8439 prefixvar=man1dir
8440 . ./setprefixvar
8441
8442 case "$man1dir" in
8443 '')     man1dir=' '
8444         installman1dir='';;
8445 esac
8446
8447 : What suffix to use on installed man pages
8448
8449 case "$man1dir" in
8450 ' ')
8451         man1ext='0'
8452         ;;
8453 *)
8454         rp="What suffix should be used for the main $spackage man pages?"
8455         case "$man1ext" in
8456         '')     case "$man1dir" in
8457                 *1)  dflt=1 ;;
8458                 *1p) dflt=1p ;;
8459                 *1pm) dflt=1pm ;;
8460                 *l) dflt=l;;
8461                 *n) dflt=n;;
8462                 *o) dflt=o;;
8463                 *p) dflt=p;;
8464                 *C) dflt=C;;
8465                 *L) dflt=L;;
8466                 *L1) dflt=L1;;
8467                 *) dflt=1;;
8468                 esac
8469                 ;;
8470         *)      dflt="$man1ext";;
8471         esac
8472         . ./myread
8473         man1ext="$ans"
8474         ;;
8475 esac
8476
8477 : see if we can have long filenames
8478 echo " "
8479 first=123456789abcdef
8480 $rm -f $first
8481 if (echo hi >$first) 2>/dev/null; then
8482         if $test -f 123456789abcde; then
8483                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8484                 val="$undef"
8485         else
8486                 echo 'You can have filenames longer than 14 characters.'>&4
8487                 val="$define"
8488         fi
8489 else
8490         $cat <<'EOM'
8491 You can't have filenames longer than 14 chars.
8492 You can't even think about them!
8493 EOM
8494         val="$undef"
8495 fi
8496 set d_flexfnam
8497 eval $setvar
8498 $rm -rf 123456789abcde*
8499
8500 : determine where library module manual pages go
8501 set man3dir man3dir none
8502 eval $prefixit
8503 $cat <<EOM
8504
8505 $spackage has manual pages for many of the library modules.
8506 EOM
8507
8508 case "$nroff" in
8509 nroff)
8510         $cat <<'EOM'
8511 However, you don't have nroff, so they're probably useless to you.
8512 EOM
8513         case "$man3dir" in
8514         '') man3dir="none";;
8515         esac;;
8516 esac
8517
8518 case "$d_flexfnam" in
8519 undef)
8520         $cat <<'EOM'
8521 However, your system can't handle the long file names like File::Basename.3.
8522 EOM
8523         case "$man3dir" in
8524         '') man3dir="none";;
8525         esac;;
8526 esac
8527
8528 echo "If you don't want the manual sources installed, answer 'none'."
8529 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8530 case "$man3dir" in
8531 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8532         if $test -d "$privlib/man/man3"; then
8533                 cat <<EOM >&4
8534
8535 WARNING:  Previous versions of perl installed man3 pages into
8536 $privlib/man/man3.  This version will suggest a
8537 new default of $dflt.
8538 EOM
8539                 tdflt=$dflt
8540                 dflt='n'
8541                 rp='Do you wish to preserve the old behavior?(y/n)'
8542                 . ./myread
8543                 case "$ans" in
8544                 y*) dflt="$privlib/man/man3" ;;
8545                 *)  dflt=$tdflt ;;
8546                 esac
8547     fi
8548         ;;
8549 *)      dflt="$man3dir" ;;
8550 esac
8551 case "$dflt" in
8552 ' ') dflt=none ;;
8553 esac
8554 echo " "
8555 fn=dn+~
8556 rp="Where do the $package library man pages (source) go?"
8557 . ./getfile
8558 prefixvar=man3dir
8559 . ./setprefixvar
8560
8561 case "$man3dir" in
8562 '')     man3dir=' '
8563         installman3dir='';;
8564 esac
8565
8566 : What suffix to use on installed man pages
8567 case "$man3dir" in
8568 ' ')
8569         man3ext='0'
8570         ;;
8571 *)
8572         rp="What suffix should be used for the $package library man pages?"
8573         case "$man3ext" in
8574         '')     case "$man3dir" in
8575                 *3)  dflt=3 ;;
8576                 *3p) dflt=3p ;;
8577                 *3pm) dflt=3pm ;;
8578                 *l) dflt=l;;
8579                 *n) dflt=n;;
8580                 *o) dflt=o;;
8581                 *p) dflt=p;;
8582                 *C) dflt=C;;
8583                 *L) dflt=L;;
8584                 *L3) dflt=L3;;
8585                 *) dflt=3;;
8586                 esac
8587                 ;;
8588         *)      dflt="$man3ext";;
8589         esac
8590         . ./myread
8591         man3ext="$ans"
8592         ;;
8593 esac
8594
8595 : see if we have to deal with yellow pages, now NIS.
8596 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8597         if $test -f /usr/etc/nibindd; then
8598                 echo " "
8599                 echo "I'm fairly confident you're on a NeXT."
8600                 echo " "
8601                 rp='Do you get the hosts file via NetInfo?'
8602                 dflt=y
8603                 case "$hostcat" in
8604                 nidump*) ;;
8605                 '') ;;
8606                 *) dflt=n;;
8607                 esac
8608                 . ./myread
8609                 case "$ans" in
8610                 y*) hostcat='nidump hosts .';;
8611                 *)      case "$hostcat" in
8612                         nidump*) hostcat='';;
8613                         esac
8614                         ;;
8615                 esac
8616         fi
8617         case "$hostcat" in
8618         nidump*) ;;
8619         *)
8620                 case "$hostcat" in
8621                 *ypcat*) dflt=y;;
8622                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8623                                 dflt=y
8624                         else
8625                                 dflt=n
8626                         fi;;
8627                 *) dflt=n;;
8628                 esac
8629                 echo " "
8630                 rp='Are you getting the hosts file via yellow pages?'
8631                 . ./myread
8632                 case "$ans" in
8633                 y*) hostcat='ypcat hosts';;
8634                 *) hostcat='cat /etc/hosts';;
8635                 esac
8636                 ;;
8637         esac
8638 fi
8639 case "$hostcat" in
8640 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8641 esac
8642 case "$groupcat" in
8643 '') test -f /etc/group && groupcat='cat /etc/group';;
8644 esac
8645 case "$passcat" in
8646 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8647 esac
8648
8649 : now get the host name
8650 echo " "
8651 echo "Figuring out host name..." >&4
8652 case "$myhostname" in
8653 '') cont=true
8654         echo 'Maybe "hostname" will work...'
8655         if tans=`sh -c hostname 2>&1` ; then
8656                 myhostname=$tans
8657                 phostname=hostname
8658                 cont=''
8659         fi
8660         ;;
8661 *) cont='';;
8662 esac
8663 if $test "$cont"; then
8664         if ./xenix; then
8665                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8666                 if tans=`cat /etc/systemid 2>&1` ; then
8667                         myhostname=$tans
8668                         phostname='cat /etc/systemid'
8669                         echo "Whadyaknow.  Xenix always was a bit strange..."
8670                         cont=''
8671                 fi
8672         elif $test -r /etc/systemid; then
8673                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8674         fi
8675 fi
8676 if $test "$cont"; then
8677         echo 'No, maybe "uuname -l" will work...'
8678         if tans=`sh -c 'uuname -l' 2>&1` ; then
8679                 myhostname=$tans
8680                 phostname='uuname -l'
8681         else
8682                 echo 'Strange.  Maybe "uname -n" will work...'
8683                 if tans=`sh -c 'uname -n' 2>&1` ; then
8684                         myhostname=$tans
8685                         phostname='uname -n'
8686                 else
8687                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8688                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8689                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8690                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8691                         else
8692                                 case "$myhostname" in
8693                                 '') echo "Does this machine have an identity crisis or something?"
8694                                         phostname='';;
8695                                 *)
8696                                         echo "Well, you said $myhostname before..."
8697                                         phostname='echo $myhostname';;
8698                                 esac
8699                         fi
8700                 fi
8701         fi
8702 fi
8703 case "$myhostname" in
8704 '') myhostname=noname ;;
8705 esac
8706 : you do not want to know about this
8707 set $myhostname
8708 myhostname=$1
8709
8710 : verify guess
8711 if $test "$myhostname" ; then
8712         dflt=y
8713         rp='Your host name appears to be "'$myhostname'".'" Right?"
8714         . ./myread
8715         case "$ans" in
8716         y*) ;;
8717         *) myhostname='';;
8718         esac
8719 fi
8720
8721 : bad guess or no guess
8722 while $test "X$myhostname" = X ; do
8723         dflt=''
8724         rp="Please type the (one word) name of your host:"
8725         . ./myread
8726         myhostname="$ans"
8727 done
8728
8729 : translate upper to lower if necessary
8730 case "$myhostname" in
8731 *[A-Z]*)
8732         echo "(Normalizing case in your host name)"
8733         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8734         ;;
8735 esac
8736
8737 case "$myhostname" in
8738 *.*)
8739         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8740         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8741         echo "(Trimming domain name from host name--host name is now $myhostname)"
8742         ;;
8743 *) case "$mydomain" in
8744         '')
8745                 {
8746                         test "X$hostcat" = "Xypcat hosts" &&
8747                         ypmatch "$myhostname" hosts 2>/dev/null |\
8748                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8749                         $test -s hosts
8750                 } || {
8751                         test "X$hostcat" != "X" &&
8752                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8753                                         /[       ]$myhostname[  . ]/p" > hosts
8754                 }
8755                 tmp_re="[       . ]"
8756                 if $test -f hosts; then
8757                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8758                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8759                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8760                                 hosts | $sort | $uniq | \
8761                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8762                         case `$echo X$dflt` in
8763                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8764                                 dflt=.
8765                                 ;;
8766                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8767                                 ;;
8768                         esac
8769                 else
8770                         echo "(I cannot locate a hosts database anywhere)"
8771                         dflt=.
8772                 fi
8773                 case "$dflt" in
8774                 .)
8775                         tans=`./loc resolv.conf X /etc /usr/etc`
8776                         if $test -f "$tans"; then
8777                                 echo "(Attempting domain name extraction from $tans)"
8778                                 dflt=.`$sed -n -e 's/   / /g' \
8779                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8780                                   -e 1q 2>/dev/null`
8781                                 case "$dflt" in
8782                                 .) dflt=.`$sed -n -e 's/        / /g' \
8783                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8784                                      -e 1q 2>/dev/null`
8785                                         ;;
8786                                 esac
8787                         fi
8788                         ;;
8789                 esac
8790                 case "$dflt" in
8791                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8792                         dflt=.`sh -c domainname 2>/dev/null`
8793                         case "$dflt" in
8794                         '') dflt='.';;
8795                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8796                         esac
8797                         ;;
8798                 esac
8799                 case "$dflt$osname" in
8800                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8801                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8802                         ;;
8803                 esac
8804                 case "$dflt" in
8805                 .) echo "(Lost all hope -- silly guess then)"
8806                         dflt='.nonet'
8807                         ;;
8808                 esac
8809                 $rm -f hosts
8810                 ;;
8811         *) dflt="$mydomain";;
8812         esac;;
8813 esac
8814 echo " "
8815 rp="What is your domain name?"
8816 . ./myread
8817 tans="$ans"
8818 case "$ans" in
8819 '') ;;
8820 .*) ;;
8821 *) tans=".$tans";;
8822 esac
8823 mydomain="$tans"
8824
8825 : translate upper to lower if necessary
8826 case "$mydomain" in
8827 *[A-Z]*)
8828         echo "(Normalizing case in your domain name)"
8829         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8830         ;;
8831 esac
8832
8833 : a little sanity check here
8834 case "$phostname" in
8835 '') ;;
8836 *)
8837         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8838         $myhostname$mydomain|$myhostname) ;;
8839         *)
8840                 case "$phostname" in
8841                 sed*)
8842                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8843                         ;;
8844                 *)
8845                         echo "(That doesn't agree with your $phostname command, by the way.)"
8846                         ;;
8847                 esac
8848         ;;
8849         esac
8850         ;;
8851 esac
8852
8853 : determine the e-mail address of the user who is running us
8854 $cat <<EOM
8855
8856 I need to get your e-mail address in Internet format if possible, i.e.
8857 something like user@host.domain. Please answer accurately since I have
8858 no easy means to double check it. The default value provided below
8859 is most probably close to reality but may not be valid from outside
8860 your organization...
8861
8862 EOM
8863 cont=x
8864 while test "$cont"; do
8865         case "$MAILDOMAIN" in
8866         '') maildomain="$myhostname$mydomain";;
8867         *)  maildomain="$MAILDOMAIN";;
8868         esac
8869         case "$cf_email" in
8870         '') dflt="$cf_by@$maildomain";;
8871         *)  dflt="$cf_email";;
8872         esac
8873         rp='What is your e-mail address?'
8874         . ./myread
8875         cf_email="$ans"
8876         case "$cf_email" in
8877         *@*.*) cont='' ;;
8878         *)
8879                 rp='Address does not look like an Internet one.  Use it anyway?'
8880                 case "$fastread" in
8881                 yes) dflt=y ;;
8882                 *) dflt=n ;;
8883                 esac
8884                 . ./myread
8885                 case "$ans" in
8886                 y*) cont='' ;;
8887                 *) echo " " ;;
8888                 esac
8889                 ;;
8890         esac
8891 done
8892
8893 : Ask e-mail of administrator
8894 $cat <<EOM
8895
8896 If you or somebody else will be maintaining perl at your site, please
8897 fill in the correct e-mail address here so that they may be contacted
8898 if necessary. Currently, the "perlbug" program included with perl
8899 will send mail to this address in addition to perlbug@perl.org. You may
8900 enter "none" for no administrator.
8901
8902 EOM
8903 case "$perladmin" in
8904 '') dflt="$cf_email";;
8905 *) dflt="$perladmin";;
8906 esac
8907 rp='Perl administrator e-mail address'
8908 . ./myread
8909 perladmin="$ans"
8910
8911 : determine whether to only install version-specific parts.
8912 echo " "
8913 $cat <<EOM
8914 Do you want to install only the version-specific parts of the perl
8915 distribution?  Usually you do *not* want to do this.
8916 EOM
8917 case "$versiononly" in
8918 "$define"|[Yy]*|true) dflt='y' ;;
8919 *) dflt='n';
8920 esac
8921 rp="Do you want to install only the version-specific parts of perl?"
8922 . ./myread
8923 case "$ans" in
8924 [yY]*)  val="$define";;
8925 *)      val="$undef" ;;
8926 esac
8927 set versiononly
8928 eval $setvar
8929
8930 case "$versiononly" in
8931 "$define") inc_version_list=''
8932            inc_version_list_init=0
8933            ;;
8934 esac
8935
8936 : figure out how to guarantee perl startup
8937 : XXX Note that this currently takes advantage of the bug that binexp ignores
8938 :     the Configure -Dinstallprefix setting, which in turn means that under
8939 :     relocatable @INC, initialinstalllocation is what binexp started as.
8940 case "$startperl" in
8941 '')
8942         case "$sharpbang" in
8943         *!)
8944                 $cat <<EOH
8945
8946 I can use the #! construct to start perl on your system. This will
8947 make startup of perl scripts faster, but may cause problems if you
8948 want to share those scripts and perl is not in a standard place
8949 ($initialinstalllocation/perl) on all your platforms. The alternative
8950 is to force a shell by starting the script with a single ':' character.
8951
8952 EOH
8953                 case "$versiononly" in
8954                 "$define")      dflt="$initialinstalllocation/perl$version";;
8955                 *)              dflt="$initialinstalllocation/perl";;
8956                 esac
8957                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8958                 . ./myread
8959                 case "$ans" in
8960                 none)   startperl=": # use perl";;
8961                 *)      startperl="#!$ans"
8962                         if $test 30 -lt `echo "$ans" | wc -c`; then
8963                                 $cat >&4 <<EOM
8964
8965 WARNING:  Some systems limit the #! command to 32 characters.
8966 If you experience difficulty running Perl scripts with #!, try
8967 installing Perl in a directory with a shorter pathname.
8968
8969 EOM
8970                         fi ;;
8971                 esac
8972                 ;;
8973         *) startperl=": # use perl"
8974                 ;;
8975         esac
8976         ;;
8977 esac
8978 echo "I'll use $startperl to start perl scripts."
8979
8980 : figure best path for perl in scripts
8981 case "$perlpath" in
8982 '')
8983         case "$versiononly" in
8984         "$define")      perlpath="$initialinstalllocation/perl$version";;
8985         *)              perlpath="$initialinstalllocation/perl";;
8986         esac
8987         case "$startperl" in
8988         *!*) ;;
8989         *)
8990                 $cat <<EOH
8991
8992 I will use the "eval 'exec'" idiom to start Perl on your system.
8993 I can use the full path of your Perl binary for this purpose, but
8994 doing so may cause problems if you want to share those scripts and
8995 Perl is not always in a standard place ($initialinstalllocation/perl).
8996
8997 EOH
8998                 dflt="$initialinstalllocation/perl"
8999                 rp="What path shall I use in \"eval 'exec'\"?"
9000                 . ./myread
9001                 perlpath="$ans"
9002                 ;;
9003         esac
9004         ;;
9005 esac
9006 case "$startperl" in
9007 *!*)    ;;
9008 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9009 esac
9010
9011 : determine where public executable scripts go
9012 set scriptdir scriptdir
9013 eval $prefixit
9014 case "$scriptdir" in
9015 '')
9016         dflt="$bin"
9017         : guess some guesses
9018         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9019         $test -d /usr/share/bin     && dflt=/usr/share/bin
9020         $test -d /usr/local/script  && dflt=/usr/local/script
9021         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9022         $test -d $prefixexp/script  && dflt=$prefixexp/script
9023         set dflt
9024         eval $prefixup
9025         ;;
9026 *)  dflt="$scriptdir"
9027         ;;
9028 esac
9029 $cat <<EOM
9030
9031 Some installations have a separate directory just for executable scripts so
9032 that they can mount it across multiple architectures but keep the scripts in
9033 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9034 Or you might just lump your scripts in with all your other executables.
9035
9036 EOM
9037 fn=d~
9038 rp='Where do you keep publicly executable scripts?'
9039 . ./getfile
9040 if $test "X$ansexp" != "X$scriptdirexp"; then
9041         installscript=''
9042 fi
9043 installscriptdir=''
9044 prefixvar=scriptdir
9045 . ./setprefixvar
9046 : A little fix up for an irregularly named variable.
9047 installscript="$installscriptdir"
9048
9049 : determine where add-on public executables go
9050 case "$sitebin" in
9051 '')     dflt=$siteprefix/bin ;;
9052 *)      dflt=$sitebin ;;
9053 esac
9054 fn=d~
9055 rp='Pathname where the add-on public executables should be installed?'
9056 . ./getfile
9057 prefixvar=sitebin
9058 . ./setprefixvar
9059
9060 : determine where add-on html pages go
9061 : There is no standard location, so try to copy the previously-selected
9062 : directory structure for the core html pages.
9063 case "$sitehtml1dir" in
9064 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9065 *)     dflt=$sitehtml1dir ;;
9066 esac
9067 case "$dflt" in
9068 ''|' ') dflt=none ;;
9069 esac
9070 fn=dn+~
9071 rp='Pathname where the site-specific html pages should be installed?'
9072 . ./getfile
9073 prefixvar=sitehtml1dir
9074 . ./setprefixvar
9075
9076 : determine where add-on library html pages go
9077 : There is no standard location, so try to copy the previously-selected
9078 : directory structure for the core html pages.
9079 case "$sitehtml3dir" in
9080 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9081 *)     dflt=$sitehtml3dir ;;
9082 esac
9083 case "$dflt" in
9084 ''|' ') dflt=none ;;
9085 esac
9086 fn=dn+~
9087 rp='Pathname where the site-specific library html pages should be installed?'
9088 . ./getfile
9089 prefixvar=sitehtml3dir
9090 . ./setprefixvar
9091
9092 : determine where add-on manual pages go
9093 case "$siteman1dir" in
9094 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9095 *)      dflt=$siteman1dir ;;
9096 esac
9097 case "$dflt" in
9098 ''|' ') dflt=none ;;
9099 esac
9100 fn=dn+~
9101 rp='Pathname where the site-specific manual pages should be installed?'
9102 . ./getfile
9103 prefixvar=siteman1dir
9104 . ./setprefixvar
9105
9106 : determine where add-on library man pages go
9107 case "$siteman3dir" in
9108 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9109 *)      dflt=$siteman3dir ;;
9110 esac
9111 case "$dflt" in
9112 ''|' ') dflt=none ;;
9113 esac
9114 fn=dn+~
9115 rp='Pathname where the site-specific library manual pages should be installed?'
9116 . ./getfile
9117 prefixvar=siteman3dir
9118 . ./setprefixvar
9119
9120 : determine where add-on public executable scripts go
9121 case "$sitescript" in
9122 '')     dflt=$siteprefix/script
9123         $test -d $dflt || dflt=$sitebin ;;
9124 *)  dflt="$sitescript" ;;
9125 esac
9126 fn=d~+
9127 rp='Pathname where add-on public executable scripts should be installed?'
9128 . ./getfile
9129 prefixvar=sitescript
9130 . ./setprefixvar
9131
9132 : Check if faststdio is requested and available
9133 case "$usefaststdio" in
9134 $define|true|[yY]*|'')
9135         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9136         case "$xversion" in
9137         [68])   dflt='y' ;;
9138         *)      dflt='n' ;;
9139         esac
9140         ;;
9141 *) dflt='n';;
9142 esac
9143 cat <<EOM
9144
9145 Perl can be built to use 'fast stdio', which means using the stdio
9146 library but also directly manipulating the stdio buffers to enable
9147 faster I/O.  Using stdio is better for backward compatibility (especially
9148 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9149 interface has been preferred instead of stdio.
9150
9151 If this doesn't make any sense to you, just accept the default '$dflt'.
9152 EOM
9153 rp='Use the "fast stdio" if available?'
9154 . ./myread
9155 case "$ans" in
9156 y|Y)    val="$define" ;;
9157 *)      val="$undef" ;;
9158 esac
9159 set usefaststdio
9160 eval $setvar
9161
9162
9163 : define an is-a-typedef? function
9164 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9165 case "$inclist" in
9166 "") inclist="sys/types.h";;
9167 esac;
9168 eval "varval=\$$var";
9169 case "$varval" in
9170 "")
9171         $rm -f temp.c;
9172         for inc in $inclist; do
9173                 echo "#include <$inc>" >>temp.c;
9174         done;
9175         echo "#ifdef $type" >> temp.c;
9176         echo "printf(\"We have $type\");" >> temp.c;
9177         echo "#endif" >> temp.c;
9178         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9179         if $contains $type temp.E >/dev/null 2>&1; then
9180                 eval "$var=\$type";
9181         else
9182                 eval "$var=\$def";
9183         fi;
9184         $rm -f temp.?;;
9185 *) eval "$var=\$varval";;
9186 esac'
9187
9188 : define an is-a-typedef? function that prompts if the type is not available.
9189 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9190 case "$inclist" in
9191 "") inclist="sys/types.h";;
9192 esac;
9193 eval "varval=\$$var";
9194 case "$varval" in
9195 "")
9196         $rm -f temp.c;
9197         for inc in $inclist; do
9198                 echo "#include <$inc>" >>temp.c;
9199         done;
9200         echo "#ifdef $type" >> temp.c;
9201         echo "printf(\"We have $type\");" >> temp.c;
9202         echo "#endif" >> temp.c;
9203         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9204         echo " " ;
9205         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9206         if $contains $type temp.E >/dev/null 2>&1; then
9207                 echo "$type found." >&4;
9208                 eval "$var=\$type";
9209         else
9210                 echo "$type NOT found." >&4;
9211                 dflt="$def";
9212                 . ./myread ;
9213                 eval "$var=\$ans";
9214         fi;
9215         $rm -f temp.?;;
9216 *) eval "$var=\$varval";;
9217 esac'
9218
9219 : see what type lseek is declared as in the kernel
9220 rp="What is the type used for lseek's offset on this system?"
9221 set off_t lseektype long stdio.h sys/types.h
9222 eval $typedef_ask
9223
9224 echo " "
9225 echo "Checking to see how big your file offsets are..." >&4
9226 $cat >try.c <<EOCP
9227 #include <sys/types.h>
9228 #include <stdio.h>
9229 int main()
9230 {
9231     printf("%d\n", (int)sizeof($lseektype));
9232     return(0);
9233 }
9234 EOCP
9235 set try
9236 if eval $compile_ok; then
9237         lseeksize=`$run ./try`
9238         echo "Your file offsets are $lseeksize bytes long."
9239 else
9240         dflt=$longsize
9241         echo " "
9242         echo "(I can't seem to compile the test program.  Guessing...)"
9243         rp="What is the size of your file offsets (in bytes)?"
9244         . ./myread
9245         lseeksize="$ans"
9246 fi
9247 $rm_try
9248
9249 : see what type file positions are declared as in the library
9250 rp="What is the type for file position used by fsetpos()?"
9251 set fpos_t fpostype long stdio.h sys/types.h
9252 eval $typedef_ask
9253
9254 : Check size for Fpos_t
9255 echo " "
9256 case "$fpostype" in
9257 *_t) zzz="$fpostype"    ;;
9258 *)   zzz="fpos_t"       ;;
9259 esac
9260 echo "Checking the size of $zzz..." >&4
9261 cat > try.c <<EOCP
9262 #include <sys/types.h>
9263 #include <stdio.h>
9264 #$i_stdlib I_STDLIB
9265 #ifdef I_STDLIB
9266 #include <stdlib.h>
9267 #endif
9268 int main() {
9269     printf("%d\n", (int)sizeof($fpostype));
9270     exit(0);
9271 }
9272 EOCP
9273 set try
9274 if eval $compile_ok; then
9275         yyy=`$run ./try`
9276         case "$yyy" in
9277         '')     fpossize=4
9278                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9279                 ;;
9280         *)      fpossize=$yyy
9281                 echo "Your $zzz is $fpossize bytes long."
9282                 ;;
9283         esac
9284 else
9285         dflt="$longsize"
9286         echo " " >&4
9287         echo "(I can't compile the test program.  Guessing...)" >&4
9288         rp="What is the size of your file positions (in bytes)?"
9289         . ./myread
9290         fpossize="$ans"
9291 fi
9292
9293 : Check for large file support
9294 # Backward compatibility (uselfs is deprecated).
9295 case "$uselfs" in
9296 "$define"|true|[yY]*)
9297         cat <<EOM >&4
9298
9299 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9300 EOM
9301         uselargefiles="$define"
9302         ;;
9303 esac
9304
9305 case "$lseeksize:$fpossize" in
9306 8:8) cat <<EOM
9307
9308 You can have files larger than 2 gigabytes.
9309 EOM
9310    val="$define" ;;
9311 *)    case "$uselargefiles" in
9312    "$undef"|false|[nN]*) dflt='n' ;;
9313    *)   dflt='y' ;;
9314    esac
9315    cat <<EOM
9316
9317 Perl can be built to understand large files (files larger than 2 gigabytes)
9318 on some systems.  To do so, Configure can be run with -Duselargefiles.
9319
9320 If this doesn't make any sense to you, just accept the default '$dflt'.
9321 EOM
9322    rp='Try to understand large files, if available?'
9323    . ./myread
9324    case "$ans" in
9325    y|Y)         val="$define" ;;
9326    *)           val="$undef"  ;;
9327    esac
9328    ;;
9329 esac
9330 set uselargefiles
9331 eval $setvar
9332 : Look for a hint-file generated 'call-back-unit'.  If the
9333 : user has specified that a large files perl is to be built,
9334 : we may need to set or change some other defaults.
9335 if $test -f uselargefiles.cbu; then
9336         echo "Your platform has some specific hints regarding large file builds, using them..."
9337         . ./uselargefiles.cbu
9338 fi
9339 case "$uselargefiles" in
9340 "$define")
9341         if $test -f uselargefiles.cbu; then
9342                 echo " "
9343                 echo "Rechecking to see how big your file offsets are..." >&4
9344                 $cat >try.c <<EOCP
9345 #include <sys/types.h>
9346 #include <stdio.h>
9347 int main()
9348 {
9349     printf("%d\n", (int)sizeof($lseektype));
9350     return(0);
9351 }
9352 EOCP
9353                 set try
9354                 if eval $compile_ok; then
9355                         lseeksize=`$run ./try`
9356                         $echo "Your file offsets are now $lseeksize bytes long."
9357                 else
9358                         dflt="$lseeksize"
9359                         echo " "
9360                         echo "(I can't seem to compile the test program.  Guessing...)"
9361                         rp="What is the size of your file offsets (in bytes)?"
9362                         . ./myread
9363                         lseeksize="$ans"
9364                 fi
9365                 case "$fpostype" in
9366                 *_t) zzz="$fpostype"    ;;
9367                 *)   zzz="fpos_t"       ;;
9368                 esac
9369                 $echo $n "Rechecking the size of $zzz...$c" >&4
9370                 $cat > try.c <<EOCP
9371 #include <sys/types.h>
9372 #include <stdio.h>
9373 #$i_stdlib I_STDLIB
9374 #ifdef I_STDLIB
9375 #include <stdlib.h>
9376 #endif
9377 int main() {
9378     printf("%d\n", (int)sizeof($fpostype));
9379     return(0);
9380 }
9381 EOCP
9382                 set try
9383                 if eval $compile_ok; then
9384                         yyy=`$run ./try`
9385                         dflt="$lseeksize"
9386                         case "$yyy" in
9387                         '')     echo " "
9388                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9389                                 ;;
9390                         *)      fpossize=$yyy
9391                                 echo " $fpossize bytes." >&4
9392                                 ;;
9393                         esac
9394                 else
9395                         dflt="$fpossize"
9396                         echo " "
9397                         echo "(I can't compile the test program.  Guessing...)" >&4
9398                         rp="What is the size of your file positions (in bytes)?"
9399                         . ./myread
9400                         fpossize="$ans"
9401                 fi
9402                 $rm_try
9403         fi
9404         ;;
9405 esac
9406
9407 : Check if we want perlio
9408 useperlio="$define"
9409
9410 : Set the vendorbin variables
9411 case "$vendorprefix" in
9412 '')     d_vendorbin="$undef"
9413         vendorbin=''
9414         vendorbinexp=''
9415         ;;
9416 *)      d_vendorbin="$define"
9417         : determine where vendor-supplied executables go.
9418         case "$vendorbin" in
9419         '') dflt=$vendorprefix/bin ;;
9420         *)      dflt="$vendorbin" ;;
9421         esac
9422         fn=d~+
9423         rp='Pathname for the vendor-supplied executables directory?'
9424         . ./getfile
9425         vendorbin="$ans"
9426         vendorbinexp="$ansexp"
9427         ;;
9428 esac
9429 prefixvar=vendorbin
9430 . ./installprefix
9431
9432 : Set the vendorhtml1dir variables
9433 case "$vendorprefix" in
9434 '')     vendorhtml1dir=''
9435         vendorhtml1direxp=''
9436         ;;
9437 *)      : determine where vendor-supplied html pages go.
9438         : There is no standard location, so try to copy the previously-selected
9439         : directory structure for the core html pages.
9440         : XXX Better default suggestions would be welcome.
9441         case "$vendorhtml1dir" in
9442         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9443         *)      dflt=$vendorhtml1dir ;;
9444         esac
9445         case "$dflt" in
9446         ''|' ') dflt=none ;;
9447         esac
9448         fn=dn+~
9449         rp='Pathname for the vendor-supplied html pages?'
9450         . ./getfile
9451         vendorhtml1dir="$ans"
9452         vendorhtml1direxp="$ansexp"
9453         ;;
9454 esac
9455 : Use ' ' for none so value is preserved next time through Configure
9456 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9457 prefixvar=vendorhtml1dir
9458 . ./installprefix
9459
9460 : Set the vendorhtml3dir variables
9461 case "$vendorprefix" in
9462 '')     vendorhtml3dir=''
9463         vendorhtml3direxp=''
9464         ;;
9465 *)      : determine where vendor-supplied module html pages go.
9466         : There is no standard location, so try to copy the previously-selected
9467         : directory structure for the core html pages.
9468         : XXX Better default suggestions would be welcome.
9469         case "$vendorhtml3dir" in
9470         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9471         *)      dflt=$vendorhtml3dir ;;
9472         esac
9473         case "$dflt" in
9474         ''|' ') dflt=none ;;
9475         esac
9476         fn=dn+~
9477         rp='Pathname for the vendor-supplied html pages?'
9478         . ./getfile
9479         vendorhtml3dir="$ans"
9480         vendorhtml3direxp="$ansexp"
9481         ;;
9482 esac
9483 : Use ' ' for none so value is preserved next time through Configure
9484 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9485 prefixvar=vendorhtml3dir
9486 . ./installprefix
9487
9488 : Set the vendorman1dir variables
9489 case "$vendorprefix" in
9490 '')     vendorman1dir=''
9491         vendorman1direxp=''
9492         ;;
9493 *)      : determine where vendor-supplied manual pages go.
9494         case "$vendorman1dir" in
9495         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9496         *)      dflt=$vendorman1dir ;;
9497         esac
9498         case "$dflt" in
9499         ''|' ') dflt=none ;;
9500         esac
9501         fn=nd~+
9502         rp='Pathname for the vendor-supplied manual section 1 pages?'
9503         . ./getfile
9504         vendorman1dir="$ans"
9505         vendorman1direxp="$ansexp"
9506         ;;
9507 esac
9508 : Use ' ' for none so value is preserved next time through Configure
9509 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9510 prefixvar=vendorman1dir
9511 . ./installprefix
9512
9513 : Set the vendorman3dir variables
9514 case "$vendorprefix" in
9515 '')     vendorman3dir=''
9516         vendorman3direxp=''
9517         ;;
9518 *)      : determine where vendor-supplied module manual pages go.
9519         case "$vendorman3dir" in
9520         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9521         *)      dflt=$vendorman3dir ;;
9522         esac
9523         case "$dflt" in
9524         ''|' ') dflt=none ;;
9525         esac
9526         fn=nd~+
9527         rp='Pathname for the vendor-supplied manual section 3 pages?'
9528         . ./getfile
9529         vendorman3dir="$ans"
9530         vendorman3direxp="$ansexp"
9531         ;;
9532 esac
9533 : Use ' ' for none so value is preserved next time through Configure
9534 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9535 prefixvar=vendorman3dir
9536 . ./installprefix
9537
9538 : Set the vendorscript variables
9539 case "$vendorprefix" in
9540 '')     d_vendorscript="$undef"
9541         vendorscript=''
9542         vendorscriptexp=''
9543         ;;
9544 *)      d_vendorscript="$define"
9545         : determine where vendor-supplied scripts go.
9546         case "$vendorscript" in
9547         '')     dflt=$vendorprefix/script
9548                 $test -d $dflt || dflt=$vendorbin ;;
9549         *)  dflt="$vendorscript" ;;
9550         esac
9551         $cat <<EOM
9552
9553 The installation process will create a directory for
9554 vendor-supplied scripts.
9555
9556 EOM
9557         fn=d~+
9558         rp='Pathname for the vendor-supplied scripts directory?'
9559         . ./getfile
9560         vendorscript="$ans"
9561         vendorscriptexp="$ansexp"
9562         ;;
9563 esac
9564 prefixvar=vendorscript
9565 . ./installprefix
9566
9567 : script used to emit important warnings
9568 cat >warn <<EOS
9569 $startsh
9570 if test \$# -gt 0; then
9571         echo "\$@" >msg
9572 else
9573         cat >msg
9574 fi
9575 echo "*** WARNING:" >&4
9576 sed -e 's/^/*** /' <msg >&4
9577 echo "*** " >&4
9578 cat msg >>config.msg
9579 echo " " >>config.msg
9580 rm -f msg
9581 EOS
9582 chmod +x warn
9583 $eunicefix warn
9584
9585 : see which of string.h or strings.h is needed
9586 echo " "
9587 strings=`./findhdr string.h`
9588 if $test "$strings" && $test -r "$strings"; then
9589         echo "Using <string.h> instead of <strings.h>." >&4
9590         val="$define"
9591 else
9592         val="$undef"
9593         strings=`./findhdr strings.h`
9594         if $test "$strings" && $test -r "$strings"; then
9595                 echo "Using <strings.h> instead of <string.h>." >&4
9596         else
9597                 ./warn "No string header found -- You'll surely have problems."
9598         fi
9599 fi
9600 set i_string
9601 eval $setvar
9602 case "$i_string" in
9603 "$undef") strings=`./findhdr strings.h`;;
9604 *)        strings=`./findhdr string.h`;;
9605 esac
9606
9607 : see if qgcvt exists
9608 set qgcvt d_qgcvt
9609 eval $inlibc
9610
9611 : Check print/scan long double stuff
9612 echo " "
9613
9614 if $test X"$d_longdbl" = X"$define"; then
9615
9616 echo "Checking how to print long doubles..." >&4
9617
9618 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9619         $cat >try.c <<'EOCP'
9620 #include <sys/types.h>
9621 #include <stdio.h>
9622 int main() {
9623   double d = 123.456;
9624   printf("%.3f\n", d);
9625 }
9626 EOCP
9627         set try
9628         if eval $compile; then
9629                 yyy=`$run ./try`
9630                 case "$yyy" in
9631                 123.456)
9632                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9633                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9634                         echo "We will use %f."
9635                         ;;
9636                 esac
9637         fi
9638 fi
9639
9640 if $test X"$sPRIfldbl" = X; then
9641         $cat >try.c <<'EOCP'
9642 #include <sys/types.h>
9643 #include <stdio.h>
9644 int main() {
9645   long double d = 123.456;
9646   printf("%.3Lf\n", d);
9647 }
9648 EOCP
9649         set try
9650         if eval $compile; then
9651                 yyy=`$run ./try`
9652                 case "$yyy" in
9653                 123.456)
9654                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9655                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9656                         echo "We will use %Lf."
9657                         ;;
9658                 esac
9659         fi
9660 fi
9661
9662 if $test X"$sPRIfldbl" = X; then
9663         $cat >try.c <<'EOCP'
9664 #include <sys/types.h>
9665 #include <stdio.h>
9666 int main() {
9667   long double d = 123.456;
9668   printf("%.3llf\n", d);
9669 }
9670 EOCP
9671         set try
9672         if eval $compile; then
9673                 yyy=`$run ./try`
9674                 case "$yyy" in
9675                 123.456)
9676                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9677                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9678                         echo "We will use %llf."
9679                         ;;
9680                 esac
9681         fi
9682 fi
9683
9684 if $test X"$sPRIfldbl" = X; then
9685         $cat >try.c <<'EOCP'
9686 #include <sys/types.h>
9687 #include <stdio.h>
9688 int main() {
9689   long double d = 123.456;
9690   printf("%.3lf\n", d);
9691 }
9692 EOCP
9693         set try
9694         if eval $compile; then
9695                 yyy=`$run ./try`
9696                 case "$yyy" in
9697                 123.456)
9698                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9699                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9700                         echo "We will use %lf."
9701                         ;;
9702                 esac
9703         fi
9704 fi
9705
9706 if $test X"$sPRIfldbl" = X; then
9707         echo "Cannot figure out how to print long doubles." >&4
9708 else
9709         sSCNfldbl=$sPRIfldbl    # expect consistency
9710 fi
9711
9712 $rm_try
9713
9714 fi # d_longdbl
9715
9716 case "$sPRIfldbl" in
9717 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9718         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9719         d_SCNfldbl="$undef";
9720         ;;
9721 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9722         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9723         d_SCNfldbl="$define";
9724         ;;
9725 esac
9726
9727 : Check how to convert floats to strings.
9728
9729 if test "X$d_Gconvert" = X; then
9730
9731 echo " "
9732 echo "Checking for an efficient way to convert floats to strings."
9733 echo " " > try.c
9734 case "$uselongdouble" in
9735 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9736 esac
9737 case "$d_longdbl" in
9738 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9739 esac
9740 case "$d_PRIgldbl" in
9741 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9742 esac
9743 $cat >>try.c <<EOP
9744 #ifdef TRY_gconvert
9745 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9746 char *myname = "gconvert";
9747 #endif
9748 #ifdef TRY_gcvt
9749 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9750 char *myname = "gcvt";
9751 #endif
9752 #ifdef TRY_qgcvt
9753 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9754 char *myname = "qgcvt";
9755 #define DOUBLETYPE long double
9756 #endif
9757 #ifdef TRY_sprintf
9758 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9759 #ifdef HAS_PRIgldbl
9760 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9761 #else
9762 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9763 #endif
9764 #else
9765 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9766 #endif
9767 char *myname = "sprintf";
9768 #endif
9769
9770 #ifndef DOUBLETYPE
9771 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9772 #define DOUBLETYPE long double
9773 #else
9774 #define DOUBLETYPE double
9775 #endif
9776 #endif
9777
9778 #include <stdio.h>
9779
9780 #$i_stdlib I_STDLIB
9781 #ifdef I_STDLIB
9782 #include <stdlib.h>
9783 #endif
9784 #$i_string I_STRING
9785 #ifdef I_STRING
9786 #  include <string.h>
9787 #else
9788 #  include <strings.h>
9789 #endif
9790
9791 int checkit(char *expect, char *got)
9792 {
9793     if (strcmp(expect, got)) {
9794                 printf("%s oddity:  Expected %s, got %s\n",
9795                         myname, expect, got);
9796                 exit(1);
9797         }
9798 }
9799
9800 int main()
9801 {
9802         char buf[64];
9803         buf[63] = '\0';
9804
9805         /* This must be 1st test on (which?) platform */
9806         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9807         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9808         checkit("0.1", buf);
9809
9810         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9811         checkit("0.01", buf);
9812
9813         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9814         checkit("0.001", buf);
9815
9816         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9817         checkit("0.0001", buf);
9818
9819         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9820         if (strlen(buf) > 5)
9821             checkit("9e-005", buf); /* for Microsoft ?? */
9822         else
9823             checkit("9e-05", buf);
9824
9825         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9826         checkit("1", buf);
9827
9828         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9829         checkit("1.1", buf);
9830
9831         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9832         checkit("1.01", buf);
9833
9834         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9835         checkit("1.001", buf);
9836
9837         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9838         checkit("1.0001", buf);
9839
9840         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9841         checkit("1.00001", buf);
9842
9843         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9844         checkit("1.000001", buf);
9845
9846         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9847         checkit("0", buf);
9848
9849         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9850         checkit("-1", buf);
9851
9852         /* Some Linux gcvt's give 1.e+5 here. */
9853         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9854         checkit("100000", buf);
9855
9856         /* Some Linux gcvt's give -1.e+5 here. */
9857         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9858         checkit("-100000", buf);
9859
9860         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9861         checkit("123.456", buf);
9862
9863         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9864         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9865         /* 34 should be enough to scare even long double
9866          * places into using the e notation. */
9867         if (strlen(buf) > 5)
9868             checkit("1e+034", buf); /* for Microsoft */
9869         else
9870             checkit("1e+34", buf);
9871
9872         /* For Perl, if you add additional tests here, also add them to
9873          * t/base/num.t for benefit of platforms not using Configure or
9874          * overriding d_Gconvert */
9875
9876         exit(0);
9877 }
9878 EOP
9879 : first add preferred functions to our list
9880 xxx_list=""
9881 for xxx_convert in $gconvert_preference; do
9882     case $xxx_convert in
9883     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9884     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9885     esac
9886 done
9887 : then add any others
9888 for xxx_convert in gconvert gcvt sprintf; do
9889     case "$xxx_list" in
9890     *$xxx_convert*) ;;
9891     *) xxx_list="$xxx_list $xxx_convert" ;;
9892     esac
9893 done
9894
9895 case "$d_longdbl$uselongdouble" in
9896 "$define$define")
9897     : again, add preferred functions to our list first
9898     xxx_ld_list=""
9899     for xxx_convert in $gconvert_ld_preference; do
9900         case $xxx_convert in
9901         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9902         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9903         esac
9904     done
9905     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9906     for xxx_convert in qgcvt sprintf $xxx_list; do
9907         case "$xxx_ld_list" in
9908         $xxx_convert*|*" $xxx_convert"*) ;;
9909         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9910         esac
9911     done
9912     : if sprintf cannot do long doubles, move it to the end
9913     if test "$d_PRIgldbl" != "$define"; then
9914         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9915     fi
9916     : if no qgcvt, remove it
9917     if test "$d_qgcvt" != "$define"; then
9918         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9919     fi
9920     : use the ld_list
9921     xxx_list="$xxx_ld_list"
9922     ;;
9923 esac
9924
9925 for xxx_convert in $xxx_list; do
9926         echo "Trying $xxx_convert..."
9927         $rm -f try try$_o core
9928         set try -DTRY_$xxx_convert
9929         if eval $compile; then
9930                 echo "$xxx_convert() found." >&4
9931                 if $run ./try; then
9932                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9933                         break;
9934                 else
9935                         echo "...But $xxx_convert didn't work as I expected."
9936                         xxx_convert=''
9937                 fi
9938         else
9939                 echo "$xxx_convert NOT found." >&4
9940         fi
9941 done
9942
9943 if test X$xxx_convert = X; then
9944     echo "*** WHOA THERE!!! ***" >&4
9945     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9946     xxx_convert=sprintf
9947 fi
9948
9949 case "$xxx_convert" in
9950 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9951 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9952 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9953 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9954    "$define$define$define")
9955       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9956    "$define$define$undef")
9957       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9958    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9959    esac
9960    ;;
9961 esac
9962
9963 fi
9964 $rm_try
9965
9966 : see if _fwalk exists
9967 set fwalk d__fwalk
9968 eval $inlibc
9969
9970 : Initialize h_fcntl
9971 h_fcntl=false
9972
9973 : Initialize h_sysfile
9974 h_sysfile=false
9975
9976 : access call always available on UNIX
9977 set access d_access
9978 eval $inlibc
9979
9980 : locate the flags for 'access()'
9981 case "$d_access" in
9982 "$define")
9983         echo " "
9984         $cat >access.c <<EOCP
9985 #include <sys/types.h>
9986 #ifdef I_FCNTL
9987 #include <fcntl.h>
9988 #endif
9989 #ifdef I_SYS_FILE
9990 #include <sys/file.h>
9991 #endif
9992 #ifdef I_UNISTD
9993 #include <unistd.h>
9994 #endif
9995 #$i_stdlib I_STDLIB
9996 #ifdef I_STDLIB
9997 #include <stdlib.h>
9998 #endif
9999 int main() {
10000         exit(R_OK);
10001 }
10002 EOCP
10003         : check sys/file.h first, no particular reason here
10004         if $test `./findhdr sys/file.h` && \
10005                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10006                 h_sysfile=true;
10007                 echo "<sys/file.h> defines the *_OK access constants." >&4
10008         elif $test `./findhdr fcntl.h` && \
10009                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10010                 h_fcntl=true;
10011                 echo "<fcntl.h> defines the *_OK access constants." >&4
10012         elif $test `./findhdr unistd.h` && \
10013                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10014                 echo "<unistd.h> defines the *_OK access constants." >&4
10015         else
10016                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10017         fi
10018         ;;
10019 esac
10020 $rm -f access*
10021
10022 : see if accessx exists
10023 set accessx d_accessx
10024 eval $inlibc
10025
10026 : see if aintl exists
10027 set aintl d_aintl
10028 eval $inlibc
10029
10030 : see if alarm exists
10031 set alarm d_alarm
10032 eval $inlibc
10033
10034 : see if 64bit time functions exists
10035
10036 set ctime64 d_ctime64
10037 eval $inlibc
10038
10039 set localtime64 d_localtime64
10040 eval $inlibc
10041
10042 set gmtime64 d_gmtime64
10043 eval $inlibc
10044
10045 set mktime64 d_mktime64
10046 eval $inlibc
10047
10048 set difftime64 d_difftime64
10049 eval $inlibc
10050
10051 set asctime64 d_asctime64
10052 eval $inlibc
10053
10054 : see if POSIX threads are available
10055 set pthread.h i_pthread
10056 eval $inhdr
10057
10058 : define a function to check prototypes
10059 $cat > protochk <<EOSH
10060 $startsh
10061 cc="$cc"
10062 optimize="$optimize"
10063 ccflags="$ccflags"
10064 prototype="$prototype"
10065 define="$define"
10066 rm_try="$rm_try"
10067 usethreads=$usethreads
10068 i_pthread=$i_pthread
10069 pthread_h_first=$pthread_h_first
10070 EOSH
10071
10072 $cat >> protochk <<'EOSH'
10073
10074 $rm_try
10075 foo="$1"
10076 shift
10077 while test $# -ge 2; do
10078         case "$1" in
10079                 $define) echo "#include <$2>" >> try.c ;;
10080                 literal) echo "$2" >> try.c ;;
10081         esac
10082     # Extra magic for the benefit of systems that need pthread.h
10083     # to be included early to correctly detect threadsafe functions.
10084     # Such functions must guarantee themselves, though, that the usethreads
10085     # and i_pthread have been defined, before calling protochk.
10086     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10087         echo "#include <pthread.h>" >> try.c
10088         pthread_h_done=yes
10089     fi
10090     shift 2
10091 done
10092 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10093 cat >> try.c <<'EOCP'
10094 #ifdef CAN_PROTOTYPE
10095 #define _(args) args
10096 #else
10097 #define _(args) ()
10098 #endif
10099 EOCP
10100 echo "$foo" >> try.c
10101 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10102 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10103 status=$?
10104 $rm_try
10105 exit $status
10106 EOSH
10107 chmod +x protochk
10108 $eunicefix protochk
10109
10110 : Define hasproto macro for Configure internal use
10111 hasproto='varname=$1; func=$2; shift; shift;
10112 while $test $# -ge 2; do
10113         case "$1" in
10114         $define) echo "#include <$2>";;
10115         esac ;
10116     shift 2;
10117 done > try.c;
10118 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10119 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10120         echo "$func() prototype found.";
10121         val="$define";
10122 else
10123         echo "$func() prototype NOT found.";
10124         val="$undef";
10125 fi;
10126 set $varname;
10127 eval $setvar;
10128 $rm_try tryout.c'
10129
10130 : see if sys/types.h has to be included
10131 set sys/types.h i_systypes
10132 eval $inhdr
10133
10134 : see if sys/select.h has to be included
10135 set sys/select.h i_sysselct
10136 eval $inhdr
10137
10138 : Define hasfield macro for Configure internal use
10139 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10140 while $test $# -ge 2; do
10141         case "$1" in
10142         $define) echo "#include <$2>";;
10143         esac ;
10144     shift 2;
10145 done > try.c;
10146 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10147 set try;
10148 if eval $compile; then
10149         val="$define";
10150 else
10151         val="$undef";
10152 fi;
10153 set $varname;
10154 eval $setvar;
10155 $rm_try'
10156
10157 : see if we should include time.h, sys/time.h, or both
10158 echo " "
10159 if test "X$timeincl" = X; then
10160         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10161         $echo $n "I'm now running the test program...$c"
10162         $cat >try.c <<EOCP
10163 #include <sys/types.h>
10164 #ifdef I_TIME
10165 #include <time.h>
10166 #endif
10167 #ifdef I_SYSTIME
10168 #ifdef SYSTIMEKERNEL
10169 #define KERNEL
10170 #endif
10171 #include <sys/time.h>
10172 #endif
10173 #ifdef I_SYSSELECT
10174 #include <sys/select.h>
10175 #endif
10176 #$i_stdlib I_STDLIB
10177 #ifdef I_STDLIB
10178 #include <stdlib.h>
10179 #endif
10180 int main()
10181 {
10182         struct tm foo;
10183 #ifdef S_TIMEVAL
10184         struct timeval bar;
10185 #endif
10186 #ifdef S_TIMEZONE
10187         struct timezone tzp;
10188 #endif
10189         if (foo.tm_sec == foo.tm_sec)
10190                 exit(0);
10191 #ifdef S_TIMEVAL
10192         if (bar.tv_sec == bar.tv_sec)
10193                 exit(0);
10194 #endif
10195         exit(1);
10196 }
10197 EOCP
10198         flags=''
10199         for s_timezone in '-DS_TIMEZONE' ''; do
10200         sysselect=''
10201         for s_timeval in '-DS_TIMEVAL' ''; do
10202         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10203         for i_time in '' '-DI_TIME'; do
10204         for i_systime in '-DI_SYSTIME' ''; do
10205                 case "$flags" in
10206                 '') $echo $n ".$c"
10207                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10208                         if eval $compile; then
10209                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10210                                 shift
10211                                 flags="$*"
10212                                 echo " "
10213                                 $echo $n "Succeeded with $flags$c"
10214                         fi
10215                         ;;
10216                 esac
10217         done
10218         done
10219         done
10220         done
10221         done
10222         timeincl=''
10223         echo " "
10224         case "$flags" in
10225         *SYSTIMEKERNEL*) i_systimek="$define"
10226                 timeincl=`./findhdr sys/time.h`
10227                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10228         *) i_systimek="$undef";;
10229         esac
10230         case "$flags" in
10231         *I_TIME*) i_time="$define"
10232                 timeincl=`./findhdr time.h`" $timeincl"
10233                 echo "We'll include <time.h>." >&4;;
10234         *) i_time="$undef";;
10235         esac
10236         case "$flags" in
10237         *I_SYSTIME*) i_systime="$define"
10238                 timeincl=`./findhdr sys/time.h`" $timeincl"
10239                 echo "We'll include <sys/time.h>." >&4;;
10240         *) i_systime="$undef";;
10241         esac
10242         $rm_try
10243 fi
10244 : see if struct tm knows about tm_zone
10245 case "$i_systime$i_time" in
10246 *$define*)
10247         echo " "
10248         echo "Checking to see if your struct tm has tm_zone field..." >&4
10249         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10250         eval $hasfield
10251         ;;
10252 *)      val="$undef"
10253         set d_tm_tm_zone
10254         eval $setvar
10255         ;;
10256 esac
10257 case "$d_tm_tm_zone" in
10258 "$define")      echo "Yes, it does."   ;;
10259 *)              echo "No, it doesn't." ;;
10260 esac
10261 : see if struct tm knows about tm_gmtoff
10262 case "$i_systime$i_time" in
10263 *$define*)
10264         echo " "
10265         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10266         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10267         eval $hasfield
10268         ;;
10269 *)      val="$undef"
10270         set d_tm_tm_gmtoff
10271         eval $setvar
10272         ;;
10273 esac
10274 case "$d_tm_tm_gmtoff" in
10275 "$define")      echo "Yes, it does."   ;;
10276 *)              echo "No, it doesn't." ;;
10277 esac
10278
10279 : see if asctime_r exists
10280 set asctime_r d_asctime_r
10281 eval $inlibc
10282 case "$d_asctime_r" in
10283 "$define")
10284         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10285         case "$d_asctime_r_proto:$usethreads" in
10286         ":define")      d_asctime_r_proto=define
10287                 set d_asctime_r_proto asctime_r $hdrs
10288                 eval $hasproto ;;
10289         *)      ;;
10290         esac
10291         case "$d_asctime_r_proto" in
10292         define)
10293         case "$asctime_r_proto" in
10294         ''|0) try='char* asctime_r(const struct tm*, char*);'
10295         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10296         esac
10297         case "$asctime_r_proto" in
10298         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10299         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10300         esac
10301         case "$asctime_r_proto" in
10302         ''|0) try='int asctime_r(const struct tm*, char*);'
10303         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10304         esac
10305         case "$asctime_r_proto" in
10306         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10307         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10308         esac
10309         case "$asctime_r_proto" in
10310         ''|0)   d_asctime_r=undef
10311                 asctime_r_proto=0
10312                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10313         * )     case "$asctime_r_proto" in
10314                 REENTRANT_PROTO*) ;;
10315                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10316                 esac
10317                 echo "Prototype: $try" ;;
10318         esac
10319         ;;
10320         *)      case "$usethreads" in
10321                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10322                 esac
10323                 d_asctime_r=undef
10324                 asctime_r_proto=0
10325                 ;;
10326         esac
10327         ;;
10328 *)      asctime_r_proto=0
10329         ;;
10330 esac
10331
10332 : see if atolf exists
10333 set atolf d_atolf
10334 eval $inlibc
10335
10336 : see if atoll exists
10337 set atoll d_atoll
10338 eval $inlibc
10339
10340 : Look for GCC-style attribute format
10341 case "$d_attribute_format" in
10342 '')
10343 echo " "
10344 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10345 $cat >attrib.c <<'EOCP'
10346 #include <stdio.h>
10347 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10348 EOCP
10349 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10350         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10351                 echo "Your C compiler doesn't support __attribute__((format))."
10352                 val="$undef"
10353         else
10354                 echo "Your C compiler supports __attribute__((format))."
10355                 val="$define"
10356         fi
10357 else
10358         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10359         val="$undef"
10360 fi
10361 ;;
10362 *) val="$d_attribute_format" ;;
10363 esac
10364 set d_attribute_format
10365 eval $setvar
10366 $rm -f attrib*
10367
10368 : Look for GCC-style attribute format with null format allowed
10369 case "$d_printf_format_null" in
10370 '') case "$d_attribute_format" in
10371     $define)
10372         echo " "
10373         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10374 $cat >attrib.c <<EOCP
10375 #include <stdio.h>
10376 #$i_stdlib I_STDLIB
10377 #ifdef I_STDLIB
10378 #include <stdlib.h>
10379 #endif
10380 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10381 int null_printf (char* pat,...) { return (int)pat; }
10382 int main () { exit(null_printf(NULL)); }
10383 EOCP
10384         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10385             : run the executable in case it produces a run-time warning
10386             if $run ./attrib >>attrib.out 2>&1; then
10387                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10388                     echo "Your C compiler doesn't allow __printf__ format to be null."
10389                     val="$undef"
10390                 else
10391                     echo "Your C compiler allows __printf__ format to be null."
10392                     val="$define"
10393                 fi
10394             else
10395             echo "Your C compiler executable failed with __printf__ format null."
10396             val="$undef"
10397         fi
10398     else
10399         echo "Your C compiler fails with __printf__ format null."
10400         val="$undef"
10401     fi
10402     ;;
10403     *)  val="$undef" ;;
10404     esac
10405 ;;
10406 *)  val="$d_printf_format_null" ;;
10407 esac
10408 set d_printf_format_null
10409 eval $setvar
10410 $rm -f attrib*
10411
10412 : Look for GCC-style attribute malloc
10413 case "$d_attribute_malloc" in
10414 '')
10415 echo " "
10416 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10417 $cat >attrib.c <<'EOCP'
10418 #include <stdio.h>
10419 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10420 EOCP
10421 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10422         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10423                 echo "Your C compiler doesn't support __attribute__((malloc))."
10424                 val="$undef"
10425         else
10426                 echo "Your C compiler supports __attribute__((malloc))."
10427                 val="$define"
10428         fi
10429 else
10430         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10431         val="$undef"
10432 fi
10433 ;;
10434 *) val="$d_attribute_malloc" ;;
10435 esac
10436 set d_attribute_malloc
10437 eval $setvar
10438 $rm -f attrib*
10439
10440 : Look for GCC-style attribute nonnull
10441 case "$d_attribute_nonnull" in
10442 '')
10443 echo " "
10444 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10445 $cat >attrib.c <<'EOCP'
10446 #include <stdio.h>
10447 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10448 EOCP
10449 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10450         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10451                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10452                 val="$undef"
10453         else
10454                 echo "Your C compiler supports __attribute__((nonnull))."
10455                 val="$define"
10456         fi
10457 else
10458         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10459         val="$undef"
10460 fi
10461 ;;
10462 *) val="$d_attribute_nonnull" ;;
10463 esac
10464 set d_attribute_nonnull
10465 eval $setvar
10466 $rm -f attrib*
10467
10468 : Look for GCC-style attribute noreturn
10469 case "$d_attribute_noreturn" in
10470 '')
10471 echo " "
10472 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10473 $cat >attrib.c <<'EOCP'
10474 #include <stdio.h>
10475 void fall_over_dead( void ) __attribute__((noreturn));
10476 EOCP
10477 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10478         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10479                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10480                 val="$undef"
10481         else
10482                 echo "Your C compiler supports __attribute__((noreturn))."
10483                 val="$define"
10484         fi
10485 else
10486         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10487         val="$undef"
10488 fi
10489 ;;
10490 *) val="$d_attribute_noreturn" ;;
10491 esac
10492 set d_attribute_noreturn
10493 eval $setvar
10494 $rm -f attrib*
10495
10496 : Look for GCC-style attribute pure
10497 case "$d_attribute_pure" in
10498 '')
10499 echo " "
10500 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10501 $cat >attrib.c <<'EOCP'
10502 #include <stdio.h>
10503 int square( int n ) __attribute__((pure));
10504 EOCP
10505 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10506         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10507                 echo "Your C compiler doesn't support __attribute__((pure))."
10508                 val="$undef"
10509         else
10510                 echo "Your C compiler supports __attribute__((pure))."
10511                 val="$define"
10512         fi
10513 else
10514         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10515         val="$undef"
10516 fi
10517 ;;
10518 *) val="$d_attribute_pure" ;;
10519 esac
10520 set d_attribute_pure
10521 eval $setvar
10522 $rm -f attrib*
10523
10524 : Look for GCC-style attribute unused
10525 case "$d_attribute_unused" in
10526 '')
10527 echo " "
10528 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10529 $cat >attrib.c <<'EOCP'
10530 #include <stdio.h>
10531 int do_something( int dummy __attribute__((unused)), int n );
10532 EOCP
10533 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10534         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10535                 echo "Your C compiler doesn't support __attribute__((unused))."
10536                 val="$undef"
10537         else
10538                 echo "Your C compiler supports __attribute__((unused))."
10539                 val="$define"
10540         fi
10541 else
10542         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10543         val="$undef"
10544 fi
10545 ;;
10546 *) val="$d_attribute_unused" ;;
10547 esac
10548 set d_attribute_unused
10549 eval $setvar
10550 $rm -f attrib*
10551
10552 : Look for GCC-style attribute deprecated
10553 case "$d_attribute_deprecated" in
10554 '')
10555 echo " "
10556 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10557 $cat >attrib.c <<'EOCP'
10558 #include <stdio.h>
10559 int I_am_deprecated(void) __attribute__((deprecated));
10560 EOCP
10561 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10562         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10563                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10564                 val="$undef"
10565         else
10566                 echo "Your C compiler supports __attribute__((deprecated))."
10567                 val="$define"
10568         fi
10569 else
10570         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10571         val="$undef"
10572 fi
10573 ;;
10574 *) val="$d_attribute_deprecated" ;;
10575 esac
10576 set d_attribute_deprecated
10577 eval $setvar
10578 $rm -f attrib*
10579
10580 : Look for GCC-style attribute warn_unused_result
10581 case "$d_attribute_warn_unused_result" in
10582 '')
10583 echo " "
10584 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10585 $cat >attrib.c <<'EOCP'
10586 #include <stdio.h>
10587 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10588 EOCP
10589 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10590         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10591                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10592                 val="$undef"
10593         else
10594                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10595                 val="$define"
10596         fi
10597 else
10598         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10599         val="$undef"
10600 fi
10601 ;;
10602 *) val="$d_attribute_warn_unused_result" ;;
10603 esac
10604 set d_attribute_warn_unused_result
10605 eval $setvar
10606 $rm -f attrib*
10607
10608 : see if bcmp exists
10609 set bcmp d_bcmp
10610 eval $inlibc
10611
10612 : see if bcopy exists
10613 set bcopy d_bcopy
10614 eval $inlibc
10615
10616 : see if getpgrp exists
10617 set getpgrp d_getpgrp
10618 eval $inlibc
10619
10620 case "$d_getpgrp" in
10621 "$define")
10622         echo " "
10623         echo "Checking to see which flavor of getpgrp is in use..."
10624         $cat >try.c <<EOP
10625 #$i_unistd I_UNISTD
10626 #include <sys/types.h>
10627 #ifdef I_UNISTD
10628 #  include <unistd.h>
10629 #endif
10630 #$i_stdlib I_STDLIB
10631 #ifdef I_STDLIB
10632 #include <stdlib.h>
10633 #endif
10634 int main()
10635 {
10636         if (getuid() == 0) {
10637                 printf("(I see you are running Configure as super-user...)\n");
10638                 setuid(1);
10639         }
10640 #ifdef TRY_BSD_PGRP
10641         if (getpgrp(1) == 0)
10642                 exit(0);
10643 #else
10644         if (getpgrp() > 0)
10645                 exit(0);
10646 #endif
10647         exit(1);
10648 }
10649 EOP
10650         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10651                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10652                 val="$define"
10653         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10654                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10655                 val="$undef"
10656         else
10657                 echo "I can't seem to compile and run the test program."
10658                 if ./usg; then
10659                         xxx="a USG one, i.e. you use getpgrp()."
10660                 else
10661                         # SVR4 systems can appear rather BSD-ish.
10662                         case "$i_unistd" in
10663                         $undef)
10664                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10665                                 val="$define"
10666                                 ;;
10667                         $define)
10668                                 xxx="probably a USG one, i.e. you use getpgrp()."
10669                                 val="$undef"
10670                                 ;;
10671                         esac
10672                 fi
10673                 echo "Assuming your getpgrp is $xxx" >&4
10674         fi
10675         ;;
10676 *) val="$undef";;
10677 esac
10678 set d_bsdgetpgrp
10679 eval $setvar
10680 $rm_try
10681
10682 : see if setpgrp exists
10683 set setpgrp d_setpgrp
10684 eval $inlibc
10685
10686 case "$d_setpgrp" in
10687 "$define")
10688         echo " "
10689         echo "Checking to see which flavor of setpgrp is in use..."
10690         $cat >try.c <<EOP
10691 #$i_unistd I_UNISTD
10692 #include <sys/types.h>
10693 #ifdef I_UNISTD
10694 #  include <unistd.h>
10695 #endif
10696 #$i_stdlib I_STDLIB
10697 #ifdef I_STDLIB
10698 #include <stdlib.h>
10699 #endif
10700 int main()
10701 {
10702         if (getuid() == 0) {
10703                 printf("(I see you are running Configure as super-user...)\n");
10704                 setuid(1);
10705         }
10706 #ifdef TRY_BSD_PGRP
10707         if (-1 == setpgrp(1, 1))
10708                 exit(0);
10709 #else
10710         if (setpgrp() != -1)
10711                 exit(0);
10712 #endif
10713         exit(1);
10714 }
10715 EOP
10716         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10717                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10718                 val="$define"
10719         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10720                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10721                 val="$undef"
10722         else
10723                 echo "(I can't seem to compile and run the test program.)"
10724                 if ./usg; then
10725                         xxx="a USG one, i.e. you use setpgrp()."
10726                 else
10727                         # SVR4 systems can appear rather BSD-ish.
10728                         case "$i_unistd" in
10729                         $undef)
10730                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10731                                 val="$define"
10732                                 ;;
10733                         $define)
10734                                 xxx="probably a USG one, i.e. you use setpgrp()."
10735                                 val="$undef"
10736                                 ;;
10737                         esac
10738                 fi
10739                 echo "Assuming your setpgrp is $xxx" >&4
10740         fi
10741         ;;
10742 *) val="$undef";;
10743 esac
10744 set d_bsdsetpgrp
10745 eval $setvar
10746 $rm_try
10747
10748 : Look for GCC-style __builtin_choose_expr
10749 case "$d_builtin_choose_expr" in
10750 '')
10751     echo " "
10752     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10753     $cat >try.c <<'EOCP'
10754 #include <assert.h>
10755 #include <stdlib.h>
10756 #include <stdio.h>
10757
10758 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10759
10760 int main(void) {
10761     assert( SYRINX(1) == 2112 );
10762     assert( SYRINX(1) != 5150 );
10763     assert( SYRINX(0) == 5150 );
10764     assert( SYRINX(0) != 2112 );
10765     puts( "All good!" );
10766     exit(0);
10767 }
10768
10769 EOCP
10770     set try
10771     if eval $compile && $run ./try; then
10772         echo "Your C compiler supports __builtin_choose_expr."
10773         val="$define"
10774     else
10775         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10776         val="$undef"
10777     fi
10778 ;;
10779 *) val="$d_builtin_choose_expr" ;;
10780 esac
10781
10782 set d_builtin_choose_expr
10783 eval $setvar
10784 $rm_try
10785
10786 : Look for GCC-style __builtin_expect
10787 case "$d_builtin_expect" in
10788 '')
10789     echo " "
10790     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10791     $cat >try.c <<'EOCP'
10792 int main(void) {
10793     int n = 50;
10794     if ( __builtin_expect(n, 0) ) n = 1;
10795     /* Remember shell exit code truth is 0, C truth is non-zero */
10796     return !(n == 1);
10797 }
10798 EOCP
10799     set try
10800     if eval $compile && $run ./try; then
10801         echo "Your C compiler supports __builtin_expect."
10802         val="$define"
10803     else
10804         echo "Your C compiler doesn't seem to understand __builtin_expect."
10805         val="$undef"
10806     fi
10807     ;;
10808 *) val="$d_builtin_expect" ;;
10809 esac
10810
10811 set d_builtin_expect
10812 eval $setvar
10813 $rm_try
10814
10815 : see if bzero exists
10816 set bzero d_bzero
10817 eval $inlibc
10818
10819 : see if stdarg is available
10820 echo " "
10821 if $test `./findhdr stdarg.h`; then
10822         echo "<stdarg.h> found." >&4
10823         valstd="$define"
10824 else
10825         echo "<stdarg.h> NOT found." >&4
10826         valstd="$undef"
10827 fi
10828
10829 : see if varags is available
10830 echo " "
10831 if $test `./findhdr varargs.h`; then
10832         echo "<varargs.h> found." >&4
10833 else
10834         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10835 fi
10836
10837 : set up the varargs testing programs
10838 $cat > varargs.c <<EOP
10839 #ifdef I_STDARG
10840 #include <stdarg.h>
10841 #endif
10842 #ifdef I_VARARGS
10843 #include <varargs.h>
10844 #endif
10845
10846 #ifdef I_STDARG
10847 int f(char *p, ...)
10848 #else
10849 int f(va_alist)
10850 va_dcl
10851 #endif
10852 {
10853         va_list ap;
10854 #ifndef I_STDARG
10855         char *p;
10856 #endif
10857 #ifdef I_STDARG
10858         va_start(ap,p);
10859 #else
10860         va_start(ap);
10861         p = va_arg(ap, char *);
10862 #endif
10863         va_end(ap);
10864         return 0;
10865 }
10866 EOP
10867 $cat > varargs <<EOP
10868 $startsh
10869 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10870         echo "true"
10871 else
10872         echo "false"
10873 fi
10874 $rm -f varargs$_o
10875 EOP
10876 chmod +x varargs
10877
10878 : now check which varargs header should be included
10879 echo " "
10880 i_varhdr=''
10881 case "$valstd" in
10882 "$define")
10883         if `./varargs I_STDARG`; then
10884                 val='stdarg.h'
10885         elif `./varargs I_VARARGS`; then
10886                 val='varargs.h'
10887         fi
10888         ;;
10889 *)
10890         if `./varargs I_VARARGS`; then
10891                 val='varargs.h'
10892         fi
10893         ;;
10894 esac
10895 case "$val" in
10896 '')
10897 echo "I could not find the definition for va_dcl... You have problems..." >&4
10898         val="$undef"; set i_stdarg; eval $setvar
10899         val="$undef"; set i_varargs; eval $setvar
10900         ;;
10901 *)
10902         set i_varhdr
10903         eval $setvar
10904         case "$i_varhdr" in
10905         stdarg.h)
10906                 val="$define"; set i_stdarg; eval $setvar
10907                 val="$undef"; set i_varargs; eval $setvar
10908                 ;;
10909         varargs.h)
10910                 val="$undef"; set i_stdarg; eval $setvar
10911                 val="$define"; set i_varargs; eval $setvar
10912                 ;;
10913         esac
10914         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10915 esac
10916 $rm -f varargs*
10917
10918 : see if the Compiler supports C99 variadic macros
10919 case "$i_stdarg$i_stdlib" in
10920     "$define$define")
10921     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10922     $cat >try.c <<EOCP
10923 #include <stdio.h>
10924 #include <stdarg.h>
10925
10926 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10927
10928 int main() {
10929   char buf[20];
10930   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10931   puts(buf);
10932   return 0;
10933 }
10934 EOCP
10935     set try
10936     if eval $compile && $run ./try 2>&1 >/dev/null; then
10937         case "`$run ./try`" in
10938             "123 456 789")
10939             echo "You have C99 variadic macros." >&4
10940             d_c99_variadic_macros="$define"
10941             ;;
10942             *)
10943             echo "You don't have functional C99 variadic macros." >&4
10944             d_c99_variadic_macros="$undef"
10945             ;;
10946         esac
10947     else
10948         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10949         d_c99_variadic_macros="$undef"
10950     fi
10951     $rm_try
10952     ;;
10953     *)
10954     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10955     d_c99_variadic_macros="$undef"
10956     ;;
10957 esac
10958
10959 : see if signal is declared as pointer to function returning int or void
10960 echo " "
10961 xxx=`./findhdr signal.h`
10962 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10963 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10964         echo "You have int (*signal())() instead of void." >&4
10965         val="$undef"
10966 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10967         echo "You have void (*signal())()." >&4
10968         val="$define"
10969 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10970         echo "You have int (*signal())() instead of void." >&4
10971         val="$undef"
10972 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10973         echo "You have void (*signal())()." >&4
10974         val="$define"
10975 else
10976         case "$d_voidsig" in
10977         '')
10978         echo "I can't determine whether signal handler returns void or int..." >&4
10979                 dflt=void
10980                 rp="What type does your signal handler return?"
10981                 . ./myread
10982                 case "$ans" in
10983                 v*) val="$define";;
10984                 *) val="$undef";;
10985                 esac;;
10986         "$define")
10987                 echo "As you already told me, signal handler returns void." >&4
10988                 val="$define"
10989                 ;;
10990         *)      echo "As you already told me, signal handler returns int." >&4
10991                 val="$undef"
10992                 ;;
10993         esac
10994 fi
10995 set d_voidsig
10996 eval $setvar
10997 case "$d_voidsig" in
10998 "$define") signal_t="void";;
10999 *) signal_t="int";;
11000 esac
11001 $rm -f $$.tmp
11002
11003 : check for ability to cast large floats to 32-bit ints.
11004 echo " "
11005 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11006 if $test "$intsize" -ge 4; then
11007         xxx=int
11008 else
11009         xxx=long
11010 fi
11011 $cat >try.c <<EOCP
11012 #include <stdio.h>
11013 #$i_stdlib I_STDLIB
11014 #ifdef I_STDLIB
11015 #include <stdlib.h>
11016 #endif
11017 #include <sys/types.h>
11018 #include <signal.h>
11019 $signal_t blech(int s) { exit(3); }
11020 int main()
11021 {
11022         $xxx i32;
11023         double f, g;
11024         int result = 0;
11025         char str[16];
11026         signal(SIGFPE, blech);
11027
11028         /* Don't let compiler optimize the test away.  Store the number
11029            in a writable string for gcc to pass to sscanf under HP-UX.
11030         */
11031         sprintf(str, "2147483647");
11032         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11033         g = 10 * f;
11034         i32  = ($xxx) g;
11035
11036         /* x86 processors will probably give 0x8000 0000, which is a
11037            sign change.  We don't want that.  We want to mimic SPARC
11038            behavior here, which is to preserve the sign and give
11039            back 0x7fff ffff.
11040         */
11041         if (i32 != ($xxx) f)
11042                 result |= 1;
11043         exit(result);
11044 }
11045 EOCP
11046 set try
11047 if eval $compile_ok; then
11048         $run ./try
11049         yyy=$?
11050 else
11051         echo "(I can't seem to compile the test program--assuming it can't)"
11052         yyy=1
11053 fi
11054 case "$yyy" in
11055 0)      val="$define"
11056         echo "Yup, it can."
11057         ;;
11058 *)      val="$undef"
11059         echo "Nope, it can't."
11060         ;;
11061 esac
11062 set d_casti32
11063 eval $setvar
11064 $rm_try
11065
11066 : check for ability to cast negative floats to unsigned
11067 echo " "
11068 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11069 $cat >try.c <<EOCP
11070 #include <stdio.h>
11071 #$i_stdlib I_STDLIB
11072 #ifdef I_STDLIB
11073 #include <stdlib.h>
11074 #endif
11075 #include <sys/types.h>
11076 #include <signal.h>
11077 $signal_t blech(int s) { exit(7); }
11078 $signal_t blech_in_list(int s) { exit(4); }
11079 unsigned long dummy_long(unsigned long p) { return p; }
11080 unsigned int dummy_int(unsigned int p) { return p; }
11081 unsigned short dummy_short(unsigned short p) { return p; }
11082 int main()
11083 {
11084         double f;
11085         unsigned long along;
11086         unsigned int aint;
11087         unsigned short ashort;
11088         int result = 0;
11089         char str[16];
11090
11091         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11092            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11093            optimized the whole file away
11094         */
11095         /* Store the number in a writable string for gcc to pass to
11096            sscanf under HP-UX.
11097         */
11098         sprintf(str, "-123");
11099         sscanf(str, "%lf", &f);  /* f = -123.; */
11100
11101         signal(SIGFPE, blech);
11102         along = (unsigned long)f;
11103         aint = (unsigned int)f;
11104         ashort = (unsigned short)f;
11105         if (along != (unsigned long)-123)
11106                 result |= 1;
11107         if (aint != (unsigned int)-123)
11108                 result |= 1;
11109         if (ashort != (unsigned short)-123)
11110                 result |= 1;
11111         sprintf(str, "1073741824.");
11112         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11113         f = f + f;
11114         along = 0;
11115         along = (unsigned long)f;
11116         if (along != 0x80000000)
11117                 result |= 2;
11118         f -= 1.;
11119         along = 0;
11120         along = (unsigned long)f;
11121         if (along != 0x7fffffff)
11122                 result |= 1;
11123         f += 2.;
11124         along = 0;
11125         along = (unsigned long)f;
11126         if (along != 0x80000001)
11127                 result |= 2;
11128         if (result)
11129                 exit(result);
11130         signal(SIGFPE, blech_in_list);
11131         sprintf(str, "123.");
11132         sscanf(str, "%lf", &f);  /* f = 123.; */
11133         along = dummy_long((unsigned long)f);
11134         aint = dummy_int((unsigned int)f);
11135         ashort = dummy_short((unsigned short)f);
11136         if (along != (unsigned long)123)
11137                 result |= 4;
11138         if (aint != (unsigned int)123)
11139                 result |= 4;
11140         if (ashort != (unsigned short)123)
11141                 result |= 4;
11142         exit(result);
11143
11144 }
11145 EOCP
11146 set try
11147 if eval $compile_ok; then
11148         $run ./try
11149         castflags=$?
11150 else
11151         echo "(I can't seem to compile the test program--assuming it can't)"
11152         castflags=7
11153 fi
11154 case "$castflags" in
11155 0)      val="$define"
11156         echo "Yup, it can."
11157         ;;
11158 *)      val="$undef"
11159         echo "Nope, it can't."
11160         ;;
11161 esac
11162 set d_castneg
11163 eval $setvar
11164 $rm_try
11165
11166 : see if vprintf exists
11167 echo " "
11168 if set vprintf val -f d_vprintf; eval $csym; $val; then
11169         echo 'vprintf() found.' >&4
11170         val="$define"
11171         $cat >try.c <<EOF
11172 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11173 #$i_varargs I_VARARGS
11174
11175 #$i_stdlib I_STDLIB
11176 #$i_unistd I_UNISTD
11177
11178 #ifdef I_STDARG
11179 #  include <stdarg.h>
11180 #else /* I_VARARGS */
11181 #  include <varargs.h>
11182 #endif
11183
11184 #ifdef I_UNISTD
11185 #  include <unistd.h>
11186 #endif
11187
11188 #ifdef I_STDLIB
11189 #  include <stdlib.h>
11190 #endif
11191
11192 #include <stdio.h> /* vsprintf prototype */
11193
11194 #ifdef I_STDARG
11195 void xxx(int n, ...)
11196 {
11197     va_list args;
11198     char buf[10];
11199     va_start(args, n);
11200     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11201 }
11202 int main() { xxx(1, "foo"); }
11203
11204 #else /* I_VARARGS */
11205
11206 xxx(va_alist)
11207 va_dcl
11208 {
11209     va_list args;
11210     char buf[10];
11211     va_start(args);
11212     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11213 }
11214 int main() { xxx("foo"); }
11215
11216 #endif
11217
11218 EOF
11219         set try
11220         if eval $compile_ok; then
11221                 if $run ./try; then
11222                         echo "Your vsprintf() returns (int)." >&4
11223                         val2="$undef"
11224                 else
11225                         echo "Your vsprintf() returns (char*)." >&4
11226                         val2="$define"
11227                 fi
11228         else
11229                 echo 'I am unable to compile the vsprintf() test program.' >&4
11230                 # We shouldn't get here.  If we do, assume the standard signature,
11231                 # not the old BSD one.
11232                 echo 'Guessing that vsprintf() returns (int).' >&4
11233                 val2="$undef"
11234         fi
11235 else
11236         echo 'vprintf() NOT found.' >&4
11237         val="$undef"
11238         val2="$undef"
11239 fi
11240 $rm_try
11241 set d_vprintf
11242 eval $setvar
11243 val=$val2
11244 set d_charvspr
11245 eval $setvar
11246
11247 : see if chown exists
11248 set chown d_chown
11249 eval $inlibc
11250
11251 : see if chroot exists
11252 set chroot d_chroot
11253 eval $inlibc
11254
11255 : see if chsize exists
11256 set chsize d_chsize
11257 eval $inlibc
11258
11259 : see if class exists
11260 set class d_class
11261 eval $inlibc
11262
11263 : see if clearenv exists
11264 set clearenv d_clearenv
11265 eval $inlibc
11266
11267 : Define hasstruct macro for Configure internal use
11268 hasstruct='varname=$1; struct=$2; shift; shift;
11269 while $test $# -ge 2; do
11270         case "$1" in
11271         $define) echo "#include <$2>";;
11272         esac ;
11273     shift 2;
11274 done > try.c;
11275 echo "int main () { struct $struct foo; }" >> try.c;
11276 set try;
11277 if eval $compile; then
11278         val="$define";
11279 else
11280         val="$undef";
11281 fi;
11282 set $varname;
11283 eval $setvar;
11284 $rm_try'
11285
11286 : see whether socket exists
11287 socketlib=''
11288 sockethdr=''
11289 echo " "
11290 $echo $n "Hmm... $c" >&4
11291 if set socket val -f d_socket; eval $csym; $val; then
11292         echo "Looks like you have Berkeley networking support." >&4
11293         d_socket="$define"
11294         if set setsockopt val -f; eval $csym; $val; then
11295                 d_oldsock="$undef"
11296         else
11297                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11298                 d_oldsock="$define"
11299         fi
11300 else
11301         if $contains socklib libc.list >/dev/null 2>&1; then
11302                 echo "Looks like you have Berkeley networking support." >&4
11303                 d_socket="$define"
11304                 : we will have to assume that it supports the 4.2 BSD interface
11305                 d_oldsock="$undef"
11306         else
11307                 echo "You don't have Berkeley networking in libc$_a..." >&4
11308                 if test "X$d_socket" = "X$define"; then
11309                    echo "...but you seem to believe that you have sockets." >&4
11310                 else
11311                         for net in net socket
11312                         do
11313                                 if test -f /usr/lib/lib$net$_a; then
11314                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11315                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11316                                         if $contains socket libc.list >/dev/null 2>&1; then
11317                                                 d_socket="$define"
11318                                                 socketlib="-l$net"
11319                                                 case "$net" in
11320                                                 net)
11321                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11322                                                         sockethdr="-I/usr/netinclude"
11323                                                         ;;
11324                                                 esac
11325                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11326                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11327                                                         d_oldsock="$undef"
11328                                                 else
11329                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11330                                                         d_oldsock="$define"
11331                                                 fi
11332                                                 break
11333                                         fi
11334                                 fi
11335                         done
11336                         if test "X$d_socket" != "X$define"; then
11337                            echo "or anywhere else I see." >&4
11338                            d_socket="$undef"
11339                            d_oldsock="$undef"
11340                         fi
11341                 fi
11342         fi
11343 fi
11344
11345 : see if socketpair exists
11346 set socketpair d_sockpair
11347 eval $inlibc
11348
11349
11350 echo " "
11351 echo "Checking the availability sa_len in the sock struct ..." >&4
11352 $cat >try.c <<EOF
11353 #include <sys/types.h>
11354 #include <sys/socket.h>
11355 int main() {
11356 struct sockaddr sa;
11357 return (sa.sa_len);
11358 }
11359 EOF
11360 val="$undef"
11361 set try; if eval $compile; then
11362         val="$define"
11363 fi
11364 set d_sockaddr_sa_len; eval $setvar
11365 $rm_try
11366
11367 echo " "
11368 echo "Checking the availability struct sockaddr_in6 ..." >&4
11369 $cat >try.c <<EOF
11370 #include <sys/types.h>
11371 #include <sys/socket.h>
11372 #include <netinet/in.h>
11373 int main() {
11374 struct sockaddr_in6 sin6;
11375 return (sin6.sin6_family);
11376 }
11377 EOF
11378 val="$undef"
11379 set try; if eval $compile; then
11380         val="$define"
11381 fi
11382 set d_sockaddr_in6; eval $setvar
11383 $rm_try
11384
11385 echo " "
11386 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11387 $cat >try.c <<EOF
11388 #include <sys/types.h>
11389 #include <sys/socket.h>
11390 #include <netinet/in.h>
11391 int main() {
11392 struct sockaddr_in6 sin6;
11393 return (sin6.sin6_scope_id);
11394 }
11395 EOF
11396 val="$undef"
11397 set try; if eval $compile; then
11398         val="$define"
11399 fi
11400 set d_sin6_scope_id; eval $setvar
11401 $rm_try
11402
11403 echo " "
11404 echo "Checking the availability struct ip_mreq ..." >&4
11405 $cat >try.c <<EOF
11406 #include <sys/types.h>
11407 #include <sys/socket.h>
11408 #include <netinet/in.h>
11409 int main() {
11410 struct ip_mreq mreq;
11411 return (mreq.imr_multiaddr.s_addr);
11412 }
11413 EOF
11414 val="$undef"
11415 set try; if eval $compile; then
11416        val="$define"
11417 fi
11418 set d_ip_mreq; eval $setvar
11419 $rm_try
11420
11421 echo " "
11422 echo "Checking the availability struct ip_mreq_source ..." >&4
11423 $cat >try.c <<EOF
11424 #include <sys/types.h>
11425 #include <sys/socket.h>
11426 #include <netinet/in.h>
11427 int main() {
11428 struct ip_mreq_source mreq;
11429 return (mreq.imr_multiaddr.s_addr);
11430 }
11431 EOF
11432 val="$undef"
11433 set try; if eval $compile; then
11434        val="$define"
11435 fi
11436 set d_ip_mreq_source; eval $setvar
11437 $rm_try
11438
11439 echo " "
11440 echo "Checking the availability struct ipv6_mreq ..." >&4
11441 $cat >try.c <<EOF
11442 #include <sys/types.h>
11443 #include <sys/socket.h>
11444 #include <netinet/in.h>
11445 int main() {
11446 struct ipv6_mreq mreq;
11447 return (mreq.ipv6mr_interface);
11448 }
11449 EOF
11450 val="$undef"
11451 set try; if eval $compile; then
11452         val="$define"
11453 fi
11454 set d_ipv6_mreq; eval $setvar
11455 $rm_try
11456
11457 echo " "
11458 echo "Checking the availability struct ipv6_mreq_source ..." >&4
11459 $cat >try.c <<EOF
11460 #include <sys/types.h>
11461 #include <sys/socket.h>
11462 #include <netinet/in.h>
11463 int main() {
11464 struct ipv6_mreq_source mreq;
11465 return (mreq.imr_multiaddr.s_addr);
11466 }
11467 EOF
11468 val="$undef"
11469 set try; if eval $compile; then
11470        val="$define"
11471 fi
11472 set d_ipv6_mreq_source; eval $setvar
11473 $rm_try
11474
11475 echo " "
11476 echo "Checking the availability of certain socket constants..." >&4
11477 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11478         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11479         $cat >try.c <<EOF
11480 #include <sys/types.h>
11481 #include <sys/socket.h>
11482 int main() {
11483     int i = $ENUM;
11484 }
11485 EOF
11486         val="$undef"
11487         set try; if eval $compile; then
11488                 val="$define"
11489         fi
11490         set d_${enum}; eval $setvar
11491         $rm_try
11492 done
11493
11494 : see if this is a sys/uio.h system
11495 set sys/uio.h i_sysuio
11496 eval $inhdr
11497
11498 : Check for cmsghdr support
11499 echo " "
11500 echo "Checking to see if your system supports struct cmsghdr..." >&4
11501 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11502 eval $hasstruct
11503 case "$d_cmsghdr_s" in
11504 "$define")      echo "Yes, it does."   ;;
11505 *)              echo "No, it doesn't." ;;
11506 esac
11507
11508
11509 : check for const keyword
11510 echo " "
11511 echo 'Checking to see if your C compiler knows about "const"...' >&4
11512 $cat >const.c <<'EOCP'
11513 typedef struct spug { int drokk; } spug;
11514 int main()
11515 {
11516         const char *foo;
11517         const spug y = { 0 };
11518 }
11519 EOCP
11520 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11521         val="$define"
11522         echo "Yup, it does."
11523 else
11524         val="$undef"
11525         echo "Nope, it doesn't."
11526 fi
11527 set d_const
11528 eval $setvar
11529
11530 : see if copysignl exists
11531 set copysignl d_copysignl
11532 eval $inlibc
11533
11534 : see if crypt exists
11535 echo " "
11536 set crypt d_crypt
11537 eval $inlibc
11538 case "$d_crypt" in
11539 $define) cryptlib='' ;;
11540 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11541                 echo 'crypt() found.' >&4
11542                 val="$define"
11543                 cryptlib=''
11544         else
11545                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11546                 if $test -z "$cryptlib"; then
11547                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11548                 else
11549                         cryptlib=-lcrypt
11550                 fi
11551                 if $test -z "$cryptlib"; then
11552                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11553                 else
11554                         cryptlib=-lcrypt
11555                 fi
11556                 if $test -z "$cryptlib"; then
11557                         cryptlib=`./loc libcrypt$_a "" $libpth`
11558                 else
11559                         cryptlib=-lcrypt
11560                 fi
11561                 if $test -z "$cryptlib"; then
11562                         echo 'crypt() NOT found.' >&4
11563                         val="$undef"
11564                 else
11565                         val="$define"
11566                 fi
11567         fi
11568         set d_crypt
11569         eval $setvar
11570         ;;
11571 esac
11572
11573 : see if this is a crypt.h system
11574 set crypt.h i_crypt
11575 eval $inhdr
11576
11577 : see if crypt_r exists
11578 set crypt_r d_crypt_r
11579 eval $inlibc
11580 case "$d_crypt_r" in
11581 "$define")
11582         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11583         case "$d_crypt_r_proto:$usethreads" in
11584         ":define")      d_crypt_r_proto=define
11585                 set d_crypt_r_proto crypt_r $hdrs
11586                 eval $hasproto ;;
11587         *)      ;;
11588         esac
11589         case "$d_crypt_r_proto" in
11590         define)
11591         case "$crypt_r_proto" in
11592         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11593         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11594         esac
11595         case "$crypt_r_proto" in
11596         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11597         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11598         esac
11599         case "$crypt_r_proto" in
11600         ''|0)   d_crypt_r=undef
11601                 crypt_r_proto=0
11602                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11603         * )     case "$crypt_r_proto" in
11604                 REENTRANT_PROTO*) ;;
11605                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11606                 esac
11607                 echo "Prototype: $try" ;;
11608         esac
11609         ;;
11610         *)      case "$usethreads" in
11611                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11612                 esac
11613                 d_crypt_r=undef
11614                 crypt_r_proto=0
11615                 ;;
11616         esac
11617         ;;
11618 *)      crypt_r_proto=0
11619         ;;
11620 esac
11621
11622 : get csh whereabouts
11623 case "$csh" in
11624 'csh') val="$undef" ;;
11625 *) val="$define" ;;
11626 esac
11627 set d_csh
11628 eval $setvar
11629 : Respect a hint or command line value for full_csh.
11630 case "$full_csh" in
11631 '') full_csh=$csh ;;
11632 esac
11633
11634 : see if ctermid exists
11635 set ctermid d_ctermid
11636 eval $inlibc
11637
11638 : see if ctermid_r exists
11639 set ctermid_r d_ctermid_r
11640 eval $inlibc
11641 case "$d_ctermid_r" in
11642 "$define")
11643         hdrs="$i_systypes sys/types.h define stdio.h "
11644         case "$d_ctermid_r_proto:$usethreads" in
11645         ":define")      d_ctermid_r_proto=define
11646                 set d_ctermid_r_proto ctermid_r $hdrs
11647                 eval $hasproto ;;
11648         *)      ;;
11649         esac
11650         case "$d_ctermid_r_proto" in
11651         define)
11652         case "$ctermid_r_proto" in
11653         ''|0) try='char* ctermid_r(char*);'
11654         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11655         esac
11656         case "$ctermid_r_proto" in
11657         ''|0)   d_ctermid_r=undef
11658                 ctermid_r_proto=0
11659                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11660         * )     case "$ctermid_r_proto" in
11661                 REENTRANT_PROTO*) ;;
11662                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11663                 esac
11664                 echo "Prototype: $try" ;;
11665         esac
11666         ;;
11667         *)      case "$usethreads" in
11668                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11669                 esac
11670                 d_ctermid_r=undef
11671                 ctermid_r_proto=0
11672                 ;;
11673         esac
11674         ;;
11675 *)      ctermid_r_proto=0
11676         ;;
11677 esac
11678
11679 : see if ctime_r exists
11680 set ctime_r d_ctime_r
11681 eval $inlibc
11682 case "$d_ctime_r" in
11683 "$define")
11684         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11685         case "$d_ctime_r_proto:$usethreads" in
11686         ":define")      d_ctime_r_proto=define
11687                 set d_ctime_r_proto ctime_r $hdrs
11688                 eval $hasproto ;;
11689         *)      ;;
11690         esac
11691         case "$d_ctime_r_proto" in
11692         define)
11693         case "$ctime_r_proto" in
11694         ''|0) try='char* ctime_r(const time_t*, char*);'
11695         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11696         esac
11697         case "$ctime_r_proto" in
11698         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11699         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11700         esac
11701         case "$ctime_r_proto" in
11702         ''|0) try='int ctime_r(const time_t*, char*);'
11703         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11704         esac
11705         case "$ctime_r_proto" in
11706         ''|0) try='int ctime_r(const time_t*, char*, int);'
11707         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11708         esac
11709         case "$ctime_r_proto" in
11710         ''|0)   d_ctime_r=undef
11711                 ctime_r_proto=0
11712                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11713         * )     case "$ctime_r_proto" in
11714                 REENTRANT_PROTO*) ;;
11715                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11716                 esac
11717                 echo "Prototype: $try" ;;
11718         esac
11719         ;;
11720         *)      case "$usethreads" in
11721                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11722                 esac
11723                 d_ctime_r=undef
11724                 ctime_r_proto=0
11725                 ;;
11726         esac
11727         ;;
11728 *)      ctime_r_proto=0
11729         ;;
11730 esac
11731
11732 : see if cuserid exists
11733 set cuserid d_cuserid
11734 eval $inlibc
11735
11736 : see if this is a limits.h system
11737 set limits.h i_limits
11738 eval $inhdr
11739
11740 : see if this is a float.h system
11741 set float.h i_float
11742 eval $inhdr
11743
11744 : See if number of significant digits in a double precision number is known
11745 echo " "
11746 $cat >dbl_dig.c <<EOM
11747 #$i_limits I_LIMITS
11748 #$i_float I_FLOAT
11749 #ifdef I_LIMITS
11750 #include <limits.h>
11751 #endif
11752 #ifdef I_FLOAT
11753 #include <float.h>
11754 #endif
11755 #ifdef DBL_DIG
11756 printf("Contains DBL_DIG");
11757 #endif
11758 EOM
11759 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11760 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11761         echo "DBL_DIG found." >&4
11762         val="$define"
11763 else
11764         echo "DBL_DIG NOT found." >&4
11765         val="$undef"
11766 fi
11767 $rm -f dbl_dig.?
11768 set d_dbl_dig
11769 eval $setvar
11770
11771 : see if dbm.h is available
11772 : see if dbmclose exists
11773 set dbmclose d_dbmclose
11774 eval $inlibc
11775
11776 case "$d_dbmclose" in
11777 $define)
11778         set dbm.h i_dbm
11779         eval $inhdr
11780         case "$i_dbm" in
11781         $define)
11782                 val="$undef"
11783                 set i_rpcsvcdbm
11784                 eval $setvar
11785                 ;;
11786         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11787                 eval $inhdr
11788                 ;;
11789         esac
11790         ;;
11791 *)      echo "We won't be including <dbm.h>"
11792         val="$undef"
11793         set i_dbm
11794         eval $setvar
11795         val="$undef"
11796         set i_rpcsvcdbm
11797         eval $setvar
11798         ;;
11799 esac
11800
11801 : see if prototype for dbminit is available
11802 echo " "
11803 set d_dbminitproto dbminit $i_dbm dbm.h
11804 eval $hasproto
11805
11806 : see if difftime exists
11807 set difftime d_difftime
11808 eval $inlibc
11809
11810 : see if this is a dirent system
11811 echo " "
11812 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11813         val="$define"
11814         echo "<dirent.h> found." >&4
11815 else
11816         val="$undef"
11817         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11818                 echo "<sys/dir.h> found." >&4
11819                 echo " "
11820         else
11821                 xinc=`./findhdr sys/ndir.h`
11822         fi
11823         echo "<dirent.h> NOT found." >&4
11824 fi
11825 set i_dirent
11826 eval $setvar
11827
11828 : Look for type of directory structure.
11829 echo " "
11830 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11831
11832 case "$direntrytype" in
11833 ''|' ')
11834         case "$i_dirent" in
11835         $define) guess1='struct dirent' ;;
11836         *) guess1='struct direct'  ;;
11837         esac
11838         ;;
11839 *)      guess1="$direntrytype"
11840         ;;
11841 esac
11842
11843 case "$guess1" in
11844 'struct dirent') guess2='struct direct' ;;
11845 *) guess2='struct dirent' ;;
11846 esac
11847
11848 if $contains "$guess1" try.c >/dev/null 2>&1; then
11849         direntrytype="$guess1"
11850         echo "Your directory entries are $direntrytype." >&4
11851 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11852         direntrytype="$guess2"
11853         echo "Your directory entries seem to be $direntrytype." >&4
11854 else
11855         echo "I don't recognize your system's directory entries." >&4
11856         rp="What type is used for directory entries on this system?"
11857         dflt="$guess1"
11858         . ./myread
11859         direntrytype="$ans"
11860 fi
11861 $rm_try
11862
11863 : see if the directory entry stores field length
11864 echo " "
11865 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11866 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11867         echo "Good, your directory entry keeps length information in d_namlen." >&4
11868         val="$define"
11869 else
11870         echo "Your directory entry does not know about the d_namlen field." >&4
11871         val="$undef"
11872 fi
11873 set d_dirnamlen
11874 eval $setvar
11875 $rm_try
11876
11877 : Look for DIR.dd_fd
11878 case "$i_dirent" in
11879 "$define")
11880     echo "Checking to see if DIR has a dd_fd member variable" >&4
11881     $cat >try.c <<EOCP
11882 #$i_stdlib I_STDLIB
11883 #ifdef I_STDLIB
11884 #include <stdlib.h>
11885 #endif
11886 #include <dirent.h>
11887
11888 int main() {
11889     DIR dir;
11890     dir.dd_fd = 1;
11891     return 0;
11892 }
11893 EOCP
11894     val=$undef
11895     set try
11896     if eval $compile; then
11897         echo "Yes, it does."
11898         val="$define"
11899     else
11900         echo "No, it does not."
11901         val="$undef"
11902     fi
11903     ;;
11904 *)
11905     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11906     val="$undef"
11907     ;;
11908 esac
11909 set d_dir_dd_fd
11910 eval $setvar
11911 $rm_try
11912
11913 : see if this is an sysdir system
11914 set sys/dir.h i_sysdir
11915 eval $inhdr
11916
11917 : see if this is an sysndir system
11918 set sys/ndir.h i_sysndir
11919 eval $inhdr
11920
11921 : Look for dirfd
11922 echo " "
11923 $cat >dirfd.c <<EOM
11924 #include <stdio.h>
11925 #$i_stdlib I_STDLIB
11926 #ifdef I_STDLIB
11927 #include <stdlib.h>
11928 #endif
11929 #$i_dirent I_DIRENT             /**/
11930 #$i_sysdir I_SYS_DIR            /**/
11931 #$i_sysndir I_SYS_NDIR          /**/
11932 #$i_systypes I_SYS_TYPES        /**/
11933 #if defined(I_SYS_TYPES)
11934 #include <sys/types.h>
11935 #endif
11936 #if defined(I_DIRENT)
11937 #include <dirent.h>
11938 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11939 #include <sys/dir.h>
11940 #endif
11941 #else
11942 #ifdef I_SYS_NDIR
11943 #include <sys/ndir.h>
11944 #else
11945 #ifdef I_SYS_DIR
11946 #ifdef hp9000s500
11947 #include <ndir.h>       /* may be wrong in the future */
11948 #else
11949 #include <sys/dir.h>
11950 #endif
11951 #endif
11952 #endif
11953 #endif 
11954 int main() {
11955         DIR *dirp = opendir(".");
11956         if (dirfd(dirp) >= 0)
11957                 exit(0);
11958         else
11959                 exit(1);
11960 }
11961 EOM
11962 val=$undef
11963 set dirfd
11964 if eval $compile; then
11965         val="$define"
11966 fi
11967 case "$val" in
11968 $define)        echo "dirfd() found." >&4       ;;
11969 *)              echo "dirfd() NOT found." >&4   ;;
11970 esac
11971 set d_dirfd
11972 eval $setvar
11973 $rm -f dirfd*
11974
11975 : see if dlerror exists
11976 xxx_runnm="$runnm"
11977 runnm=false
11978 set dlerror d_dlerror
11979 eval $inlibc
11980 runnm="$xxx_runnm"
11981
11982 : see if dlfcn is available
11983 set dlfcn.h i_dlfcn
11984 eval $inhdr
11985
11986 : Check what extension to use for shared libs
11987 case "$usedl" in
11988 $define|y|true)
11989         $cat << EOM
11990
11991 On a few systems, the dynamically loaded modules that perl generates and uses
11992 will need a different extension than shared libs. The default will probably
11993 be appropriate.
11994
11995 EOM
11996         case "$dlext" in
11997         '')     dflt="$so" ;;
11998         *)      dflt="$dlext" ;;
11999         esac
12000         rp='What is the extension of dynamically loaded modules'
12001         . ./myread
12002         dlext="$ans"
12003         ;;
12004 *)
12005         dlext="none"
12006         ;;
12007 esac
12008
12009 : Check if dlsym need a leading underscore
12010 echo " "
12011 val="$undef"
12012
12013 case "$dlsrc" in
12014 dl_dlopen.xs)
12015         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12016         $cat >dyna.c <<'EOM'
12017 fred () { }
12018 EOM
12019
12020 $cat >fred.c<<EOM
12021
12022 #include <stdio.h>
12023 #$i_stdlib I_STDLIB
12024 #ifdef I_STDLIB
12025 #include <stdlib.h>
12026 #endif
12027 #$i_dlfcn I_DLFCN
12028 #ifdef I_DLFCN
12029 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12030 #else
12031 #include <sys/types.h>
12032 #include <nlist.h>
12033 #include <link.h>
12034 #endif
12035
12036 extern int fred() ;
12037
12038 int main()
12039 {
12040     void * handle ;
12041     void * symbol ;
12042 #ifndef RTLD_LAZY
12043     int mode = 1 ;
12044 #else
12045     int mode = RTLD_LAZY ;
12046 #endif
12047     handle = dlopen("./dyna.$dlext", mode) ;
12048     if (handle == NULL) {
12049         printf ("1\n") ;
12050         fflush (stdout) ;
12051         exit(0);
12052     }
12053     symbol = dlsym(handle, "fred") ;
12054     if (symbol == NULL) {
12055         /* try putting a leading underscore */
12056         symbol = dlsym(handle, "_fred") ;
12057         if (symbol == NULL) {
12058             printf ("2\n") ;
12059             fflush (stdout) ;
12060             exit(0);
12061         }
12062         printf ("3\n") ;
12063     }
12064     else
12065         printf ("4\n") ;
12066     fflush (stdout) ;
12067     exit(0);
12068 }
12069 EOM
12070         : Call the object file tmp-dyna.o in case dlext=o.
12071         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12072                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12073                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12074                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12075                 xxx=`$run ./fred`
12076                 case $xxx in
12077                 1)      echo "Test program failed using dlopen." >&4
12078                         echo "Perhaps you should not use dynamic loading." >&4;;
12079                 2)      echo "Test program failed using dlsym." >&4
12080                         echo "Perhaps you should not use dynamic loading." >&4;;
12081                 3)      echo "dlsym needs a leading underscore" >&4
12082                         val="$define" ;;
12083                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12084                 esac
12085         else
12086                 echo "I can't compile and run the test program." >&4
12087                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12088         fi
12089         ;;
12090 esac
12091
12092 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12093
12094 set d_dlsymun
12095 eval $setvar
12096
12097 : see if drand48_r exists
12098 set drand48_r d_drand48_r
12099 eval $inlibc
12100 case "$d_drand48_r" in
12101 "$define")
12102         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12103         case "$d_drand48_r_proto:$usethreads" in
12104         ":define")      d_drand48_r_proto=define
12105                 set d_drand48_r_proto drand48_r $hdrs
12106                 eval $hasproto ;;
12107         *)      ;;
12108         esac
12109         case "$d_drand48_r_proto" in
12110         define)
12111         case "$drand48_r_proto" in
12112         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12113         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12114         esac
12115         case "$drand48_r_proto" in
12116         ''|0)   d_drand48_r=undef
12117                 drand48_r_proto=0
12118                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12119         * )     case "$drand48_r_proto" in
12120                 REENTRANT_PROTO*) ;;
12121                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12122                 esac
12123                 echo "Prototype: $try" ;;
12124         esac
12125         ;;
12126         *)      case "$usethreads" in
12127                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12128                 esac
12129                 d_drand48_r=undef
12130                 drand48_r_proto=0
12131                 ;;
12132         esac
12133         ;;
12134 *)      drand48_r_proto=0
12135         ;;
12136 esac
12137
12138 : see if prototype for drand48 is available
12139 echo " "
12140 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12141 eval $hasproto
12142
12143 : see if dup2 exists
12144 set dup2 d_dup2
12145 eval $inlibc
12146
12147 : see if eaccess exists
12148 set eaccess d_eaccess
12149 eval $inlibc
12150
12151 : see if endgrent exists
12152 set endgrent d_endgrent
12153 eval $inlibc
12154
12155 : see if this is an grp system
12156 set grp.h i_grp
12157 eval $inhdr
12158
12159 case "$i_grp" in
12160 $define)
12161         xxx=`./findhdr grp.h`
12162         $cppstdin $cppflags $cppminus < $xxx >$$.h
12163
12164         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12165                 val="$define"
12166         else
12167                 val="$undef"
12168         fi
12169         set d_grpasswd
12170         eval $setvar
12171
12172         $rm -f $$.h
12173         ;;
12174 *)
12175         val="$undef";
12176         set d_grpasswd; eval $setvar
12177         ;;
12178 esac
12179
12180 : see if endgrent_r exists
12181 set endgrent_r d_endgrent_r
12182 eval $inlibc
12183 case "$d_endgrent_r" in
12184 "$define")
12185         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12186         case "$d_endgrent_r_proto:$usethreads" in
12187         ":define")      d_endgrent_r_proto=define
12188                 set d_endgrent_r_proto endgrent_r $hdrs
12189                 eval $hasproto ;;
12190         *)      ;;
12191         esac
12192         case "$d_endgrent_r_proto" in
12193         define)
12194         case "$endgrent_r_proto" in
12195         ''|0) try='int endgrent_r(FILE**);'
12196         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12197         esac
12198         case "$endgrent_r_proto" in
12199         ''|0) try='void endgrent_r(FILE**);'
12200         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12201         esac
12202         case "$endgrent_r_proto" in
12203         ''|0)   d_endgrent_r=undef
12204                 endgrent_r_proto=0
12205                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12206         * )     case "$endgrent_r_proto" in
12207                 REENTRANT_PROTO*) ;;
12208                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12209                 esac
12210                 echo "Prototype: $try" ;;
12211         esac
12212         ;;
12213         *)      case "$usethreads" in
12214                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12215                 esac
12216                 d_endgrent_r=undef
12217                 endgrent_r_proto=0
12218                 ;;
12219         esac
12220         ;;
12221 *)      endgrent_r_proto=0
12222         ;;
12223 esac
12224
12225 : see if endhostent exists
12226 set endhostent d_endhent
12227 eval $inlibc
12228
12229 : see if this is a netdb.h system
12230 set netdb.h i_netdb
12231 eval $inhdr
12232
12233 : see if endhostent_r exists
12234 set endhostent_r d_endhostent_r
12235 eval $inlibc
12236 case "$d_endhostent_r" in
12237 "$define")
12238         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12239         case "$d_endhostent_r_proto:$usethreads" in
12240         ":define")      d_endhostent_r_proto=define
12241                 set d_endhostent_r_proto endhostent_r $hdrs
12242                 eval $hasproto ;;
12243         *)      ;;
12244         esac
12245         case "$d_endhostent_r_proto" in
12246         define)
12247         case "$endhostent_r_proto" in
12248         ''|0) try='int endhostent_r(struct hostent_data*);'
12249         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12250         esac
12251         case "$endhostent_r_proto" in
12252         ''|0) try='void endhostent_r(struct hostent_data*);'
12253         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12254         esac
12255         case "$endhostent_r_proto" in
12256         ''|0)   d_endhostent_r=undef
12257                 endhostent_r_proto=0
12258                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12259         * )     case "$endhostent_r_proto" in
12260                 REENTRANT_PROTO*) ;;
12261                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12262                 esac
12263                 echo "Prototype: $try" ;;
12264         esac
12265         ;;
12266         *)      case "$usethreads" in
12267                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12268                 esac
12269                 d_endhostent_r=undef
12270                 endhostent_r_proto=0
12271                 ;;
12272         esac
12273         ;;
12274 *)      endhostent_r_proto=0
12275         ;;
12276 esac
12277
12278 : see if endnetent exists
12279 set endnetent d_endnent
12280 eval $inlibc
12281
12282 : see if endnetent_r exists
12283 set endnetent_r d_endnetent_r
12284 eval $inlibc
12285 case "$d_endnetent_r" in
12286 "$define")
12287         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12288         case "$d_endnetent_r_proto:$usethreads" in
12289         ":define")      d_endnetent_r_proto=define
12290                 set d_endnetent_r_proto endnetent_r $hdrs
12291                 eval $hasproto ;;
12292         *)      ;;
12293         esac
12294         case "$d_endnetent_r_proto" in
12295         define)
12296         case "$endnetent_r_proto" in
12297         ''|0) try='int endnetent_r(struct netent_data*);'
12298         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12299         esac
12300         case "$endnetent_r_proto" in
12301         ''|0) try='void endnetent_r(struct netent_data*);'
12302         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12303         esac
12304         case "$endnetent_r_proto" in
12305         ''|0)   d_endnetent_r=undef
12306                 endnetent_r_proto=0
12307                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12308         * )     case "$endnetent_r_proto" in
12309                 REENTRANT_PROTO*) ;;
12310                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12311                 esac
12312                 echo "Prototype: $try" ;;
12313         esac
12314         ;;
12315         *)      case "$usethreads" in
12316                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12317                 esac
12318                 d_endnetent_r=undef
12319                 endnetent_r_proto=0
12320                 ;;
12321         esac
12322         ;;
12323 *)      endnetent_r_proto=0
12324         ;;
12325 esac
12326
12327 : see if endprotoent exists
12328 set endprotoent d_endpent
12329 eval $inlibc
12330
12331 : see if endprotoent_r exists
12332 set endprotoent_r d_endprotoent_r
12333 eval $inlibc
12334 case "$d_endprotoent_r" in
12335 "$define")
12336         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12337         case "$d_endprotoent_r_proto:$usethreads" in
12338         ":define")      d_endprotoent_r_proto=define
12339                 set d_endprotoent_r_proto endprotoent_r $hdrs
12340                 eval $hasproto ;;
12341         *)      ;;
12342         esac
12343         case "$d_endprotoent_r_proto" in
12344         define)
12345         case "$endprotoent_r_proto" in
12346         ''|0) try='int endprotoent_r(struct protoent_data*);'
12347         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12348         esac
12349         case "$endprotoent_r_proto" in
12350         ''|0) try='void endprotoent_r(struct protoent_data*);'
12351         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12352         esac
12353         case "$endprotoent_r_proto" in
12354         ''|0)   d_endprotoent_r=undef
12355                 endprotoent_r_proto=0
12356                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12357         * )     case "$endprotoent_r_proto" in
12358                 REENTRANT_PROTO*) ;;
12359                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12360                 esac
12361                 echo "Prototype: $try" ;;
12362         esac
12363         ;;
12364         *)      case "$usethreads" in
12365                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12366                 esac
12367                 d_endprotoent_r=undef
12368                 endprotoent_r_proto=0
12369                 ;;
12370         esac
12371         ;;
12372 *)      endprotoent_r_proto=0
12373         ;;
12374 esac
12375
12376 : see if endpwent exists
12377 set endpwent d_endpwent
12378 eval $inlibc
12379
12380 : see if this is a pwd.h system
12381 set pwd.h i_pwd
12382 eval $inhdr
12383
12384 case "$i_pwd" in
12385 $define)
12386         xxx=`./findhdr pwd.h`
12387         $cppstdin $cppflags $cppminus < $xxx >$$.h
12388
12389         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12390                 val="$define"
12391         else
12392                 val="$undef"
12393         fi
12394         set d_pwquota
12395         eval $setvar
12396
12397         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12398                 val="$define"
12399         else
12400                 val="$undef"
12401         fi
12402         set d_pwage
12403         eval $setvar
12404
12405         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12406                 val="$define"
12407         else
12408                 val="$undef"
12409         fi
12410         set d_pwchange
12411         eval $setvar
12412
12413         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12414                 val="$define"
12415         else
12416                 val="$undef"
12417         fi
12418         set d_pwclass
12419         eval $setvar
12420
12421         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12422                 val="$define"
12423         else
12424                 val="$undef"
12425         fi
12426         set d_pwexpire
12427         eval $setvar
12428
12429         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12430                 val="$define"
12431         else
12432                 val="$undef"
12433         fi
12434         set d_pwcomment
12435         eval $setvar
12436
12437         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12438                 val="$define"
12439         else
12440                 val="$undef"
12441         fi
12442         set d_pwgecos
12443         eval $setvar
12444
12445         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12446                 val="$define"
12447         else
12448                 val="$undef"
12449         fi
12450         set d_pwpasswd
12451         eval $setvar
12452
12453         $rm -f $$.h
12454         ;;
12455 *)
12456         val="$undef"; 
12457         set d_pwquota; eval $setvar
12458         set d_pwage; eval $setvar
12459         set d_pwchange; eval $setvar
12460         set d_pwclass; eval $setvar
12461         set d_pwexpire; eval $setvar
12462         set d_pwcomment; eval $setvar
12463         set d_pwgecos; eval $setvar
12464         set d_pwpasswd; eval $setvar
12465         ;;
12466 esac
12467
12468 : see if endpwent_r exists
12469 set endpwent_r d_endpwent_r
12470 eval $inlibc
12471 case "$d_endpwent_r" in
12472 "$define")
12473         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12474         case "$d_endpwent_r_proto:$usethreads" in
12475         ":define")      d_endpwent_r_proto=define
12476                 set d_endpwent_r_proto endpwent_r $hdrs
12477                 eval $hasproto ;;
12478         *)      ;;
12479         esac
12480         case "$d_endpwent_r_proto" in
12481         define)
12482         case "$endpwent_r_proto" in
12483         ''|0) try='int endpwent_r(FILE**);'
12484         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12485         esac
12486         case "$endpwent_r_proto" in
12487         ''|0) try='void endpwent_r(FILE**);'
12488         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12489         esac
12490         case "$endpwent_r_proto" in
12491         ''|0)   d_endpwent_r=undef
12492                 endpwent_r_proto=0
12493                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12494         * )     case "$endpwent_r_proto" in
12495                 REENTRANT_PROTO*) ;;
12496                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12497                 esac
12498                 echo "Prototype: $try" ;;
12499         esac
12500         ;;
12501         *)      case "$usethreads" in
12502                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12503                 esac
12504                 d_endpwent_r=undef
12505                 endpwent_r_proto=0
12506                 ;;
12507         esac
12508         ;;
12509 *)      endpwent_r_proto=0
12510         ;;
12511 esac
12512
12513 : see if endservent exists
12514 set endservent d_endsent
12515 eval $inlibc
12516
12517 : see if endservent_r exists
12518 set endservent_r d_endservent_r
12519 eval $inlibc
12520 case "$d_endservent_r" in
12521 "$define")
12522         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12523         case "$d_endservent_r_proto:$usethreads" in
12524         ":define")      d_endservent_r_proto=define
12525                 set d_endservent_r_proto endservent_r $hdrs
12526                 eval $hasproto ;;
12527         *)      ;;
12528         esac
12529         case "$d_endservent_r_proto" in
12530         define)
12531         case "$endservent_r_proto" in
12532         ''|0) try='int endservent_r(struct servent_data*);'
12533         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12534         esac
12535         case "$endservent_r_proto" in
12536         ''|0) try='void endservent_r(struct servent_data*);'
12537         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12538         esac
12539         case "$endservent_r_proto" in
12540         ''|0)   d_endservent_r=undef
12541                 endservent_r_proto=0
12542                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12543         * )     case "$endservent_r_proto" in
12544                 REENTRANT_PROTO*) ;;
12545                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12546                 esac
12547                 echo "Prototype: $try" ;;
12548         esac
12549         ;;
12550         *)      case "$usethreads" in
12551                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12552                 esac
12553                 d_endservent_r=undef
12554                 endservent_r_proto=0
12555                 ;;
12556         esac
12557         ;;
12558 *)      endservent_r_proto=0
12559         ;;
12560 esac
12561
12562 : Locate the flags for 'open()'
12563 echo " "
12564 $cat >try.c <<EOCP
12565 #include <sys/types.h>
12566 #ifdef I_FCNTL
12567 #include <fcntl.h>
12568 #endif
12569 #ifdef I_SYS_FILE
12570 #include <sys/file.h>
12571 #endif
12572 #$i_stdlib I_STDLIB
12573 #ifdef I_STDLIB
12574 #include <stdlib.h>
12575 #endif
12576 int main() {
12577         if(O_RDONLY);
12578 #ifdef O_TRUNC
12579         exit(0);
12580 #else
12581         exit(1);
12582 #endif
12583 }
12584 EOCP
12585 : check sys/file.h first to get FREAD on Sun
12586 if $test `./findhdr sys/file.h` && \
12587                 set try -DI_SYS_FILE && eval $compile; then
12588         h_sysfile=true;
12589         echo "<sys/file.h> defines the O_* constants..." >&4
12590         if $run ./try; then
12591                 echo "and you have the 3 argument form of open()." >&4
12592                 val="$define"
12593         else
12594                 echo "but not the 3 argument form of open().  Oh, well." >&4
12595                 val="$undef"
12596         fi
12597 elif $test `./findhdr fcntl.h` && \
12598                 set try -DI_FCNTL && eval $compile; then
12599         h_fcntl=true;
12600         echo "<fcntl.h> defines the O_* constants..." >&4
12601         if $run ./try; then
12602                 echo "and you have the 3 argument form of open()." >&4
12603                 val="$define"
12604         else
12605                 echo "but not the 3 argument form of open().  Oh, well." >&4
12606                 val="$undef"
12607         fi
12608 else
12609         val="$undef"
12610         echo "I can't find the O_* constant definitions!  You got problems." >&4
12611 fi
12612 set d_open3
12613 eval $setvar
12614 $rm_try
12615
12616 : see if this is a sys/file.h system
12617 val=''
12618 set sys/file.h val
12619 eval $inhdr
12620
12621 : do we need to include sys/file.h ?
12622 case "$val" in
12623 "$define")
12624         echo " "
12625         if $h_sysfile; then
12626                 val="$define"
12627                 echo "We'll be including <sys/file.h>." >&4
12628         else
12629                 val="$undef"
12630                 echo "We won't be including <sys/file.h>." >&4
12631         fi
12632         ;;
12633 *)
12634         h_sysfile=false
12635         ;;
12636 esac
12637 set i_sysfile
12638 eval $setvar
12639
12640 : see if fcntl.h is there
12641 val=''
12642 set fcntl.h val
12643 eval $inhdr
12644
12645 : see if we can include fcntl.h
12646 case "$val" in
12647 "$define")
12648         echo " "
12649         if $h_fcntl; then
12650                 val="$define"
12651                 echo "We'll be including <fcntl.h>." >&4
12652         else
12653                 val="$undef"
12654                 if $h_sysfile; then
12655         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12656                 else
12657                         echo "We won't be including <fcntl.h>." >&4
12658                 fi
12659         fi
12660         ;;
12661 *)
12662         h_fcntl=false
12663         val="$undef"
12664         ;;
12665 esac
12666 set i_fcntl
12667 eval $setvar
12668
12669 : see if fork exists
12670 set fork d_fork
12671 eval $inlibc
12672
12673 : see if pipe exists
12674 set pipe d_pipe
12675 eval $inlibc
12676
12677 : check for non-blocking I/O stuff
12678 case "$h_sysfile" in
12679 true) echo "#include <sys/file.h>" > head.c;;
12680 *)
12681        case "$h_fcntl" in
12682        true) echo "#include <fcntl.h>" > head.c;;
12683        *) echo "#include <sys/fcntl.h>" > head.c;;
12684        esac
12685        ;;
12686 esac
12687 echo " "
12688 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12689 case "$o_nonblock" in
12690 '')
12691         $cat head.c > try.c
12692         $cat >>try.c <<EOCP
12693 #include <stdio.h>
12694 #$i_stdlib I_STDLIB
12695 #ifdef I_STDLIB
12696 #include <stdlib.h>
12697 #endif
12698 #$i_fcntl I_FCNTL
12699 #ifdef I_FCNTL
12700 #include <fcntl.h>
12701 #endif
12702 int main() {
12703 #ifdef O_NONBLOCK
12704         printf("O_NONBLOCK\n");
12705         exit(0);
12706 #endif
12707 #ifdef O_NDELAY
12708         printf("O_NDELAY\n");
12709         exit(0);
12710 #endif
12711 #ifdef FNDELAY
12712         printf("FNDELAY\n");
12713         exit(0);
12714 #endif
12715         exit(0);
12716 }
12717 EOCP
12718         set try
12719         if eval $compile_ok; then
12720                 o_nonblock=`$run ./try`
12721                 case "$o_nonblock" in
12722                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12723                 *) echo "Seems like we can use $o_nonblock.";;
12724                 esac
12725         else
12726                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12727         fi
12728         ;;
12729 *) echo "Using $hint value $o_nonblock.";;
12730 esac
12731 $rm_try
12732
12733 echo " "
12734 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12735 case "$eagain" in
12736 '')
12737         case "$d_fork:$d_pipe" in
12738         define:define)
12739         $cat head.c > try.c
12740         $cat >>try.c <<EOCP
12741 #include <errno.h>
12742 #include <sys/types.h>
12743 #include <signal.h>
12744 #include <stdio.h>
12745 #$i_stdlib I_STDLIB
12746 #ifdef I_STDLIB
12747 #include <stdlib.h>
12748 #endif
12749 #$i_fcntl I_FCNTL
12750 #ifdef I_FCNTL
12751 #include <fcntl.h>
12752 #endif
12753 #define MY_O_NONBLOCK $o_nonblock
12754 #ifndef errno  /* XXX need better Configure test */
12755 extern int errno;
12756 #endif
12757 #$i_unistd I_UNISTD
12758 #ifdef I_UNISTD
12759 #include <unistd.h>
12760 #endif
12761 #$i_string I_STRING
12762 #ifdef I_STRING
12763 #include <string.h>
12764 #else
12765 #include <strings.h>
12766 #endif
12767 $signal_t blech(int x) { exit(3); }
12768 EOCP
12769         $cat >> try.c <<'EOCP'
12770 int main()
12771 {
12772         int pd[2];
12773         int pu[2];
12774         char buf[1];
12775         char string[100];
12776
12777         pipe(pd);       /* Down: child -> parent */
12778         pipe(pu);       /* Up: parent -> child */
12779         if (0 != fork()) {
12780                 int ret;
12781                 close(pd[1]);   /* Parent reads from pd[0] */
12782                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12783 #ifdef F_SETFL
12784                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12785                         exit(1);
12786 #else
12787                 exit(4);
12788 #endif
12789                 signal(SIGALRM, blech);
12790                 alarm(5);
12791                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12792                         exit(2);
12793                 sprintf(string, "%d\n", ret);
12794                 write(2, string, strlen(string));
12795                 alarm(0);
12796 #ifdef EAGAIN
12797                 if (errno == EAGAIN) {
12798                         printf("EAGAIN\n");
12799                         goto ok;
12800                 }
12801 #endif
12802 #ifdef EWOULDBLOCK
12803                 if (errno == EWOULDBLOCK)
12804                         printf("EWOULDBLOCK\n");
12805 #endif
12806         ok:
12807                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12808                 sleep(2);                               /* Give it time to close our pipe */
12809                 alarm(5);
12810                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12811                 alarm(0);
12812                 sprintf(string, "%d\n", ret);
12813                 write(4, string, strlen(string));
12814                 exit(0);
12815         }
12816
12817         close(pd[0]);                   /* We write to pd[1] */
12818         close(pu[1]);                   /* We read from pu[0] */
12819         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12820         close(pd[1]);                   /* Pipe pd is now fully closed! */
12821         exit(0);                                /* Bye bye, thank you for playing! */
12822 }
12823 EOCP
12824         set try
12825         if eval $compile_ok; then
12826                 echo "$startsh" >mtry
12827                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12828                 chmod +x mtry
12829                 ./mtry >/dev/null 2>&1
12830                 case $? in
12831                 0) eagain=`$cat try.out`;;
12832                 1) echo "Could not perform non-blocking setting!";;
12833                 2) echo "I did a successful read() for something that was not there!";;
12834                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12835                 4) echo "Could not find F_SETFL!";;
12836                 *) echo "Something terribly wrong happened during testing.";;
12837                 esac
12838                 rd_nodata=`$cat try.ret`
12839                 echo "A read() system call with no data present returns $rd_nodata."
12840                 case "$rd_nodata" in
12841                 0|-1) ;;
12842                 *)
12843                         echo "(That's peculiar, fixing that to be -1.)"
12844                         rd_nodata=-1
12845                         ;;
12846                 esac
12847                 case "$eagain" in
12848                 '')
12849                         echo "Forcing errno EAGAIN on read() with no data available."
12850                         eagain=EAGAIN
12851                         ;;
12852                 *)
12853                         echo "Your read() sets errno to $eagain when no data is available."
12854                         ;;
12855                 esac
12856                 status=`$cat try.err`
12857                 case "$status" in
12858                 0) echo "And it correctly returns 0 to signal EOF.";;
12859                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12860                 *) echo "However, your read() returns '$status' on EOF??";;
12861                 esac
12862                 val="$define"
12863                 if test "$status" = "$rd_nodata"; then
12864                         echo "WARNING: you can't distinguish between EOF and no data!"
12865                         val="$undef"
12866                 fi
12867         else
12868                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12869                 eagain=EAGAIN
12870         fi
12871         ;;
12872         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12873                 eagain=EAGAIN
12874                 val="$define"
12875                 ;;
12876         esac
12877         set d_eofnblk
12878         eval $setvar
12879         ;;
12880 *)
12881         echo "Using $hint value $eagain."
12882         echo "Your read() returns $rd_nodata when no data is present."
12883         case "$d_eofnblk" in
12884         "$define") echo "And you can see EOF because read() returns 0.";;
12885         "$undef") echo "But you can't see EOF status from read() returned value.";;
12886         *)
12887                 echo "(Assuming you can't see EOF status from read anyway.)"
12888                 d_eofnblk=$undef
12889                 ;;
12890         esac
12891         ;;
12892 esac
12893 $rm_try head.c mtry
12894
12895 : see if _ptr and _cnt from stdio act std
12896 echo " "
12897
12898 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12899         echo "(Looks like you have stdio.h from BSD.)"
12900         case "$stdio_ptr" in
12901         '') stdio_ptr='((fp)->_p)'
12902                 ptr_lval=$define
12903                 ;;
12904         *)      ptr_lval=$d_stdio_ptr_lval;;
12905         esac
12906         case "$stdio_cnt" in
12907         '') stdio_cnt='((fp)->_r)'
12908                 cnt_lval=$define
12909                 ;;
12910         *)      cnt_lval=$d_stdio_cnt_lval;;
12911         esac
12912         case "$stdio_base" in
12913         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12914         esac
12915         case "$stdio_bufsiz" in
12916         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12917         esac
12918 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12919         echo "(Looks like you have stdio.h from Linux.)"
12920         case "$stdio_ptr" in
12921         '') stdio_ptr='((fp)->_IO_read_ptr)'
12922                 ptr_lval=$define
12923                 ;;
12924         *)      ptr_lval=$d_stdio_ptr_lval;;
12925         esac
12926         case "$stdio_cnt" in
12927         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12928                 cnt_lval=$undef
12929                 ;;
12930         *)      cnt_lval=$d_stdio_cnt_lval;;
12931         esac
12932         case "$stdio_base" in
12933         '') stdio_base='((fp)->_IO_read_base)';;
12934         esac
12935         case "$stdio_bufsiz" in
12936         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12937         esac
12938 else
12939         case "$stdio_ptr" in
12940         '') stdio_ptr='((fp)->_ptr)'
12941                 ptr_lval=$define
12942                 ;;
12943         *)      ptr_lval=$d_stdio_ptr_lval;;
12944         esac
12945         case "$stdio_cnt" in
12946         '') stdio_cnt='((fp)->_cnt)'
12947                 cnt_lval=$define
12948                 ;;
12949         *)      cnt_lval=$d_stdio_cnt_lval;;
12950         esac
12951         case "$stdio_base" in
12952         '') stdio_base='((fp)->_base)';;
12953         esac
12954         case "$stdio_bufsiz" in
12955         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12956         esac
12957 fi
12958
12959 : test whether _ptr and _cnt really work
12960 echo "Checking how std your stdio is..." >&4
12961 $cat >try.c <<EOP
12962 #include <stdio.h>
12963 #$i_stdlib I_STDLIB
12964 #ifdef I_STDLIB
12965 #include <stdlib.h>
12966 #endif
12967 #define FILE_ptr(fp)    $stdio_ptr
12968 #define FILE_cnt(fp)    $stdio_cnt
12969 int main() {
12970         FILE *fp = fopen("try.c", "r");
12971         char c = getc(fp);
12972         if (
12973                 18 <= FILE_cnt(fp) &&
12974                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12975         )
12976                 exit(0);
12977         exit(1);
12978 }
12979 EOP
12980 val="$undef"
12981 set try
12982 if eval $compile && $to try.c; then
12983         if $run ./try; then
12984                 echo "Your stdio acts pretty std."
12985                 val="$define"
12986         else
12987                 echo "Your stdio isn't very std."
12988         fi
12989 else
12990         echo "Your stdio doesn't appear very std."
12991 fi
12992 $rm_try
12993
12994 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12995 # direct buffer manipulation no longer works.  The Configure tests
12996 # should be changed to correctly detect this, but until then,
12997 # the following check should at least let perl compile and run.
12998 # (This quick fix should be updated before 5.8.1.)
12999 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13000 # A. Dougherty, June 3, 2002.
13001 case "$d_gnulibc" in
13002 $define)
13003         case "$gnulibc_version" in
13004         2.[01]*)  ;;
13005         2.2) ;;
13006         2.2.[0-9]) ;;
13007         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13008                 val="$undef"
13009                 ;;
13010         esac
13011         ;;
13012 esac
13013 set d_stdstdio
13014 eval $setvar
13015
13016 : Can _ptr be used as an lvalue?
13017 case "$d_stdstdio$ptr_lval" in
13018 $define$define) val=$define ;;
13019 *) val=$undef ;;
13020 esac
13021 set d_stdio_ptr_lval
13022 eval $setvar
13023
13024 : Can _cnt be used as an lvalue?
13025 case "$d_stdstdio$cnt_lval" in
13026 $define$define) val=$define ;;
13027 *) val=$undef ;;
13028 esac
13029 set d_stdio_cnt_lval
13030 eval $setvar
13031
13032
13033 : test whether setting _ptr sets _cnt as a side effect
13034 d_stdio_ptr_lval_sets_cnt="$undef"
13035 d_stdio_ptr_lval_nochange_cnt="$undef"
13036 case "$d_stdio_ptr_lval$d_stdstdio" in
13037 $define$define)
13038         echo "Checking to see what happens if we set the stdio ptr..." >&4
13039 $cat >try.c <<EOP
13040 #include <stdio.h>
13041 /* Can we scream? */
13042 /* Eat dust sed :-) */
13043 /* In the buffer space, no one can hear you scream. */
13044 #$i_stdlib I_STDLIB
13045 #ifdef I_STDLIB
13046 #include <stdlib.h>
13047 #endif
13048 #define FILE_ptr(fp)    $stdio_ptr
13049 #define FILE_cnt(fp)    $stdio_cnt
13050 #include <sys/types.h>
13051 int main() {
13052         FILE *fp = fopen("try.c", "r");
13053         int c;
13054         char *ptr;
13055         size_t cnt;
13056         if (!fp) {
13057             puts("Fail even to read");
13058             exit(1);
13059         }
13060         c = getc(fp); /* Read away the first # */
13061         if (c == EOF) {
13062             puts("Fail even to read");
13063             exit(1);
13064         }
13065         if (!(
13066                 18 <= FILE_cnt(fp) &&
13067                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13068         )) {
13069                 puts("Fail even to read");
13070                 exit (1);
13071         }
13072         ptr = (char*) FILE_ptr(fp);
13073         cnt = (size_t)FILE_cnt(fp);
13074
13075         FILE_ptr(fp) += 42;
13076
13077         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13078                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13079                 exit (1);
13080         }
13081         if (FILE_cnt(fp) <= 20) {
13082                 printf ("Fail (<20 chars to test)");
13083                 exit (1);
13084         }
13085         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13086                 puts("Fail compare");
13087                 exit (1);
13088         }
13089         if (cnt == FILE_cnt(fp)) {
13090                 puts("Pass_unchanged");
13091                 exit (0);
13092         }
13093         if (FILE_cnt(fp) == (cnt - 42)) {
13094                 puts("Pass_changed");
13095                 exit (0);
13096         }
13097         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13098         return 1;
13099
13100 }
13101 EOP
13102         set try
13103         if eval $compile && $to try.c; then
13104                 case `$run ./try` in
13105                 Pass_changed)
13106                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13107                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13108                 Pass_unchanged)
13109                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13110                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13111                 Fail*)
13112                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13113                 *)
13114                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13115         esac
13116         else
13117                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13118         fi
13119         $rm_try
13120         ;;
13121 esac
13122
13123 : see if _base is also standard
13124 val="$undef"
13125 case "$d_stdstdio" in
13126 $define)
13127         $cat >try.c <<EOP
13128 #include <stdio.h>
13129 #$i_stdlib I_STDLIB
13130 #ifdef I_STDLIB
13131 #include <stdlib.h>
13132 #endif
13133 #define FILE_base(fp)   $stdio_base
13134 #define FILE_bufsiz(fp) $stdio_bufsiz
13135 int main() {
13136         FILE *fp = fopen("try.c", "r");
13137         char c = getc(fp);
13138         if (
13139                 19 <= FILE_bufsiz(fp) &&
13140                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13141         )
13142                 exit(0);
13143         exit(1);
13144 }
13145 EOP
13146         set try
13147         if eval $compile && $to try.c; then
13148                 if $run ./try; then
13149                         echo "And its _base field acts std."
13150                         val="$define"
13151                 else
13152                         echo "But its _base field isn't std."
13153                 fi
13154         else
13155                 echo "However, it seems to be lacking the _base field."
13156         fi
13157         $rm_try
13158         ;;
13159 esac
13160 set d_stdiobase
13161 eval $setvar
13162
13163 : see if fast_stdio exists
13164 val="$undef"
13165 case "$d_stdstdio:$d_stdio_ptr_lval" in
13166 "$define:$define")
13167         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13168         *$define*)
13169                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13170                 val="$define"
13171                 ;;
13172         esac
13173         ;;
13174 esac
13175 set d_faststdio
13176 eval $setvar
13177
13178
13179
13180 : see if fchdir exists
13181 set fchdir d_fchdir
13182 eval $inlibc
13183
13184 : see if fchmod exists
13185 set fchmod d_fchmod
13186 eval $inlibc
13187
13188 : see if fchown exists
13189 set fchown d_fchown
13190 eval $inlibc
13191
13192 : see if this is an fcntl system
13193 set fcntl d_fcntl
13194 eval $inlibc
13195
13196 : See if fcntl-based locking works.
13197 echo " "
13198 $cat >try.c <<EOCP
13199 #$i_stdlib I_STDLIB
13200 #ifdef I_STDLIB
13201 #include <stdlib.h>
13202 #endif
13203 #include <unistd.h>
13204 #include <fcntl.h>
13205 #include <signal.h>
13206 $signal_t blech(int x) { exit(3); }
13207 int main() {
13208 #if defined(F_SETLK) && defined(F_SETLKW)
13209      struct flock flock;
13210      int retval, fd;
13211      fd = open("try.c", O_RDONLY);
13212      flock.l_type = F_RDLCK;
13213      flock.l_whence = SEEK_SET;
13214      flock.l_start = flock.l_len = 0;
13215      signal(SIGALRM, blech);
13216      alarm(10);
13217      retval = fcntl(fd, F_SETLK, &flock);
13218      close(fd);
13219      (retval < 0 ? exit(2) : exit(0));
13220 #else
13221      exit(2);
13222 #endif
13223 }
13224 EOCP
13225 echo "Checking if fcntl-based file locking works... "
13226 case "$d_fcntl" in
13227 "$define")
13228         set try
13229         if eval $compile_ok; then
13230                 if $run ./try; then
13231                         echo "Yes, it seems to work."
13232                         val="$define"
13233                 else
13234                         echo "Nope, it didn't work."
13235                         val="$undef"
13236                         case "$?" in
13237                         3) $cat >&4 <<EOM
13238 ***
13239 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13240 *** This is (almost) impossible.
13241 *** If your NFS lock daemons are not feeling well, something like
13242 *** this may happen, please investigate.  Cannot continue, aborting.
13243 ***
13244 EOM
13245                                 exit 1
13246                                 ;;
13247                         esac
13248                 fi
13249         else
13250                 echo "I'm unable to compile the test program, so I'll assume not."
13251                 val="$undef"
13252         fi
13253         ;;
13254 *) val="$undef";
13255         echo "Nope, since you don't even have fcntl()."
13256         ;;
13257 esac
13258 set d_fcntl_can_lock
13259 eval $setvar
13260 $rm_try
13261
13262 : check for fd_set items
13263 $cat <<EOM
13264
13265 Checking to see how well your C compiler handles fd_set and friends ...
13266 EOM
13267 $cat >try.c <<EOCP
13268 #$i_stdlib I_STDLIB
13269 #ifdef I_STDLIB
13270 #include <stdlib.h>
13271 #endif
13272 #$i_systime I_SYS_TIME
13273 #$i_sysselct I_SYS_SELECT
13274 #$d_socket HAS_SOCKET
13275 #include <sys/types.h>
13276 #ifdef HAS_SOCKET
13277 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13278 #endif
13279 #ifdef I_SYS_TIME
13280 #include <sys/time.h>
13281 #endif
13282 #ifdef I_SYS_SELECT
13283 #include <sys/select.h>
13284 #endif
13285 int main() {
13286         fd_set fds;
13287
13288 #ifdef TRYBITS
13289         if(fds.fds_bits);
13290 #endif
13291
13292 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13293         exit(0);
13294 #else
13295         exit(1);
13296 #endif
13297 }
13298 EOCP
13299 set try -DTRYBITS
13300 if eval $compile; then
13301         d_fds_bits="$define"
13302         d_fd_set="$define"
13303         echo "Well, your system knows about the normal fd_set typedef..." >&4
13304         if $run ./try; then
13305                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13306                 d_fd_macros="$define"
13307         else
13308                 $cat >&4 <<'EOM'
13309 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13310 EOM
13311                 d_fd_macros="$undef"
13312         fi
13313 else
13314         $cat <<'EOM'
13315 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13316 EOM
13317         set try
13318         if eval $compile; then
13319                 d_fds_bits="$undef"
13320                 d_fd_set="$define"
13321                 echo "Well, your system has some sort of fd_set available..." >&4
13322                 if $run ./try; then
13323                         echo "and you have the normal fd_set macros." >&4
13324                         d_fd_macros="$define"
13325                 else
13326                         $cat <<'EOM'
13327 but not the normal fd_set macros!  Gross!  More work for me...
13328 EOM
13329                         d_fd_macros="$undef"
13330                 fi
13331         else
13332         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13333                 d_fd_set="$undef"
13334                 d_fds_bits="$undef"
13335                 d_fd_macros="$undef"
13336         fi
13337 fi
13338 $rm_try
13339
13340 : see if fgetpos exists
13341 set fgetpos d_fgetpos
13342 eval $inlibc
13343
13344 : see if finite exists
13345 set finite d_finite
13346 eval $inlibc
13347
13348 : see if finitel exists
13349 set finitel d_finitel
13350 eval $inlibc
13351
13352 : see if flock exists
13353 set flock d_flock
13354 eval $inlibc
13355
13356 : see if prototype for flock is available
13357 echo " "
13358 set d_flockproto flock $i_sysfile sys/file.h
13359 eval $hasproto
13360
13361 : see if fp_class exists
13362 set fp_class d_fp_class
13363 eval $inlibc
13364
13365 : see if pathconf exists
13366 set pathconf d_pathconf
13367 eval $inlibc
13368
13369 : see if fpathconf exists
13370 set fpathconf d_fpathconf
13371 eval $inlibc
13372
13373 : see if fpclass exists
13374 set fpclass d_fpclass
13375 eval $inlibc
13376
13377 : see if fpclassify exists
13378 set fpclassify d_fpclassify
13379 eval $inlibc
13380
13381 : see if fpclassl exists
13382 set fpclassl d_fpclassl
13383 eval $inlibc
13384
13385 : check for fpos64_t
13386 echo " "
13387 echo "Checking to see if you have fpos64_t..." >&4
13388 $cat >try.c <<EOCP
13389 #include <stdio.h>
13390 int main() { fpos64_t x = 7; }
13391 EOCP
13392 set try
13393 if eval $compile; then
13394         val="$define"
13395         echo "You have fpos64_t."
13396 else
13397         val="$undef"
13398         echo "You do not have fpos64_t."
13399         case "$fpossize" in
13400         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13401         esac
13402 fi
13403 $rm_try
13404 set d_fpos64_t
13405 eval $setvar
13406
13407 : see if frexpl exists
13408 set frexpl d_frexpl
13409 eval $inlibc
13410
13411 : see if this is a sys/param system
13412 set sys/param.h i_sysparam
13413 eval $inhdr
13414
13415 : see if this is a sys/mount.h system
13416 set sys/mount.h i_sysmount
13417 eval $inhdr
13418
13419 : Check for fs_data_s
13420 echo " "
13421 echo "Checking to see if your system supports struct fs_data..." >&4
13422 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13423 eval $hasstruct
13424 case "$d_fs_data_s" in
13425 "$define")      echo "Yes, it does."   ;;
13426 *)              echo "No, it doesn't." ;;
13427 esac
13428
13429 : see if fseeko exists
13430 set fseeko d_fseeko
13431 eval $inlibc
13432 case "$longsize" in
13433 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13434 esac
13435
13436 : see if fsetpos exists
13437 set fsetpos d_fsetpos
13438 eval $inlibc
13439
13440 : see if fstatfs exists
13441 set fstatfs d_fstatfs
13442 eval $inlibc
13443
13444 : see if statvfs exists
13445 set statvfs d_statvfs
13446 eval $inlibc
13447
13448 : see if fstatvfs exists
13449 set fstatvfs d_fstatvfs
13450 eval $inlibc
13451
13452
13453 : see if fsync exists
13454 set fsync d_fsync
13455 eval $inlibc
13456
13457 : see if ftello exists
13458 set ftello d_ftello
13459 eval $inlibc
13460 case "$longsize" in
13461 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13462 esac
13463
13464 : check for a working futimes
13465 d_futimes="$undef"
13466 echo " "
13467 echo "Checking if you have a working futimes()" >&4
13468 $cat >try.c <<EOCP
13469 #include <stdio.h>
13470 #include <sys/time.h>
13471 #include <errno.h>
13472 #include <fcntl.h>
13473
13474 int main ()
13475 {
13476     int fd, rv;
13477     fd = open ("try.c", O_RDWR);
13478     if (-1 == fd) exit (1);
13479     rv = futimes (fd, NULL);
13480     exit (rv == -1 ? errno : 0);
13481 }
13482 EOCP
13483 set try
13484 if eval $compile; then
13485     `$run ./try`
13486     rc=$?
13487     case "$rc" in
13488         0)  echo "Yes, you have" >&4
13489             d_futimes="$define"
13490             ;;
13491         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13492             ;;
13493     esac
13494 else
13495     echo "No, it does not (probably harmless)" >&4
13496 fi
13497 $rm_try
13498
13499 : see if ndbm.h is available
13500 set ndbm.h i_ndbm
13501 eval $inhdr
13502 : Compatibility location for RedHat 7.1
13503 set gdbm/ndbm.h i_gdbmndbm
13504 eval $inhdr
13505 : Compatibility location for Debian 4.0
13506 set gdbm-ndbm.h i_gdbm_ndbm
13507 eval $inhdr
13508
13509 val="$undef"
13510 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13511         : see if dbm_open exists
13512         set dbm_open d_dbm_open
13513         eval $inlibc
13514         case "$d_dbm_open" in
13515         $undef)
13516                 i_ndbm="$undef"
13517                 i_gdbmndbm="$undef"
13518                 i_gdbm_ndbm="$undef"
13519                 echo "We won't be including <ndbm.h>"
13520                 val="$undef"
13521                 ;;
13522         *) val="$define"
13523            ;;
13524         esac
13525 fi
13526 set d_ndbm
13527 eval $setvar
13528
13529 ndbm_hdr_protochk='name=$1; hdr=$2;
13530 eval "ihdr=\$""i_$name";
13531 val="$undef";
13532 if $test "$ihdr" = "$define"; then
13533         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13534         case "$d_cplusplus" in
13535         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13536         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13537         esac;
13538         case "$val" in
13539         $define) $echo "Your <$hdr> seems to have prototypes";;
13540         *) $echo "Your <$hdr> does not seem to have prototypes";;
13541         esac;
13542 fi;
13543 set "d_${name}_h_uses_prototypes";
13544 eval $setvar'
13545
13546 set ndbm ndbm.h
13547 eval $ndbm_hdr_protochk
13548 set gdbmndbm gdbm/ndbm.h
13549 eval $ndbm_hdr_protochk
13550 set gdbm_ndbm gdbm-ndbm.h
13551 eval $ndbm_hdr_protochk
13552
13553 : see if getaddrinfo exists
13554 set getaddrinfo d_getaddrinfo
13555 eval $inlibc
13556
13557 : see if getcwd exists
13558 set getcwd d_getcwd
13559 eval $inlibc
13560
13561 : see if getespwnam exists
13562 set getespwnam d_getespwnam
13563 eval $inlibc
13564
13565 : see if getfsstat exists
13566 set getfsstat d_getfsstat
13567 eval $inlibc
13568
13569 : see if getgrent exists
13570 set getgrent d_getgrent
13571 eval $inlibc
13572
13573 : see if getgrent_r exists
13574 set getgrent_r d_getgrent_r
13575 eval $inlibc
13576 case "$d_getgrent_r" in
13577 "$define")
13578         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13579         case "$d_getgrent_r_proto:$usethreads" in
13580         ":define")      d_getgrent_r_proto=define
13581                 set d_getgrent_r_proto getgrent_r $hdrs
13582                 eval $hasproto ;;
13583         *)      ;;
13584         esac
13585         case "$d_getgrent_r_proto" in
13586         define)
13587         case "$getgrent_r_proto" in
13588         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13589         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13590         esac
13591         case "$getgrent_r_proto" in
13592         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13593         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13594         esac
13595         case "$getgrent_r_proto" in
13596         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13597         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13598         esac
13599         case "$getgrent_r_proto" in
13600         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13601         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13602         esac
13603         case "$getgrent_r_proto" in
13604         ''|0) try='int getgrent_r(struct group*, char*, int);'
13605         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13606         esac
13607         case "$getgrent_r_proto" in
13608         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13609         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13610         esac
13611         case "$getgrent_r_proto" in
13612         ''|0)   d_getgrent_r=undef
13613                 getgrent_r_proto=0
13614                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13615         * )     case "$getgrent_r_proto" in
13616                 REENTRANT_PROTO*) ;;
13617                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13618                 esac
13619                 echo "Prototype: $try" ;;
13620         esac
13621         ;;
13622         *)      case "$usethreads" in
13623                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13624                 esac
13625                 d_getgrent_r=undef
13626                 getgrent_r_proto=0
13627                 ;;
13628         esac
13629         ;;
13630 *)      getgrent_r_proto=0
13631         ;;
13632 esac
13633
13634 : see if getgrgid_r exists
13635 set getgrgid_r d_getgrgid_r
13636 eval $inlibc
13637 case "$d_getgrgid_r" in
13638 "$define")
13639         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13640         case "$d_getgrgid_r_proto:$usethreads" in
13641         ":define")      d_getgrgid_r_proto=define
13642                 set d_getgrgid_r_proto getgrgid_r $hdrs
13643                 eval $hasproto ;;
13644         *)      ;;
13645         esac
13646         case "$d_getgrgid_r_proto" in
13647         define)
13648         case "$getgrgid_r_proto" in
13649         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13650         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13651         esac
13652         case "$getgrgid_r_proto" in
13653         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13654         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13655         esac
13656         case "$getgrgid_r_proto" in
13657         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13658         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13659         esac
13660         case "$getgrgid_r_proto" in
13661         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13662         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13663         esac
13664         case "$getgrgid_r_proto" in
13665         ''|0)   d_getgrgid_r=undef
13666                 getgrgid_r_proto=0
13667                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13668         * )     case "$getgrgid_r_proto" in
13669                 REENTRANT_PROTO*) ;;
13670                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13671                 esac
13672                 echo "Prototype: $try" ;;
13673         esac
13674         ;;
13675         *)      case "$usethreads" in
13676                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13677                 esac
13678                 d_getgrgid_r=undef
13679                 getgrgid_r_proto=0
13680                 ;;
13681         esac
13682         ;;
13683 *)      getgrgid_r_proto=0
13684         ;;
13685 esac
13686
13687 : see if getgrnam_r exists
13688 set getgrnam_r d_getgrnam_r
13689 eval $inlibc
13690 case "$d_getgrnam_r" in
13691 "$define")
13692         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13693         case "$d_getgrnam_r_proto:$usethreads" in
13694         ":define")      d_getgrnam_r_proto=define
13695                 set d_getgrnam_r_proto getgrnam_r $hdrs
13696                 eval $hasproto ;;
13697         *)      ;;
13698         esac
13699         case "$d_getgrnam_r_proto" in
13700         define)
13701         case "$getgrnam_r_proto" in
13702         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13703         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13704         esac
13705         case "$getgrnam_r_proto" in
13706         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13707         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13708         esac
13709         case "$getgrnam_r_proto" in
13710         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13711         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13712         esac
13713         case "$getgrnam_r_proto" in
13714         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13715         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13716         esac
13717         case "$getgrnam_r_proto" in
13718         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13719         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13720         esac
13721         case "$getgrnam_r_proto" in
13722         ''|0)   d_getgrnam_r=undef
13723                 getgrnam_r_proto=0
13724                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13725         * )     case "$getgrnam_r_proto" in
13726                 REENTRANT_PROTO*) ;;
13727                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13728                 esac
13729                 echo "Prototype: $try" ;;
13730         esac
13731         ;;
13732         *)      case "$usethreads" in
13733                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13734                 esac
13735                 d_getgrnam_r=undef
13736                 getgrnam_r_proto=0
13737                 ;;
13738         esac
13739         ;;
13740 *)      getgrnam_r_proto=0
13741         ;;
13742 esac
13743
13744 : see if gethostbyaddr exists
13745 set gethostbyaddr d_gethbyaddr
13746 eval $inlibc
13747
13748 : see if gethostbyname exists
13749 set gethostbyname d_gethbyname
13750 eval $inlibc
13751
13752 : see if gethostent exists
13753 set gethostent d_gethent
13754 eval $inlibc
13755
13756 : see how we will look up host name
13757 echo " "
13758 call=''
13759 if set gethostname val -f d_gethname; eval $csym; $val; then
13760         echo 'gethostname() found.' >&4
13761         d_gethname="$define"
13762         call=gethostname
13763 fi
13764 if set uname val -f d_uname; eval $csym; $val; then
13765         if ./xenix; then
13766                 $cat <<'EOM'
13767 uname() was found, but you're running xenix, and older versions of xenix
13768 have a broken uname(). If you don't really know whether your xenix is old
13769 enough to have a broken system call, use the default answer.
13770
13771 EOM
13772                 dflt=y
13773                 case "$d_uname" in
13774                 "$define") dflt=n;;
13775                 esac
13776                 rp='Is your uname() broken?'
13777                 . ./myread
13778                 case "$ans" in
13779                 n*) d_uname="$define"; call=uname;;
13780                 esac
13781         else
13782                 echo 'uname() found.' >&4
13783                 d_uname="$define"
13784                 case "$call" in
13785                 '') call=uname ;;
13786                 esac
13787         fi
13788 fi
13789 case "$d_gethname" in
13790 '') d_gethname="$undef";;
13791 esac
13792 case "$d_uname" in
13793 '') d_uname="$undef";;
13794 esac
13795 case "$d_uname$d_gethname" in
13796 *define*)
13797         dflt=n
13798         cat <<EOM
13799
13800 Every now and then someone has a $call() that lies about the hostname
13801 but can't be fixed for political or economic reasons.  If you wish, I can
13802 pretend $call() isn't there and maybe compute hostname at run-time
13803 thanks to the '$phostname' command.
13804
13805 EOM
13806         rp="Shall I ignore $call() from now on?"
13807         . ./myread
13808         case "$ans" in
13809         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13810         esac;;
13811 esac
13812 case "$phostname" in
13813 '') aphostname='';;
13814 *) case "$aphostname" in
13815         /*) ;;
13816         *) set X $phostname
13817                 shift
13818                 file=$1
13819                 shift
13820                 file=`./loc $file $file $pth`
13821                 aphostname=`echo $file $*`
13822                 ;;
13823         esac
13824         ;;
13825 esac
13826 case "$d_uname$d_gethname" in
13827 *define*) ;;
13828 *)
13829         case "$phostname" in
13830         '')
13831                 echo "There will be no way for $package to get your hostname." >&4;;
13832         *)
13833         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13834                 ;;
13835         esac;;
13836 esac
13837 case "$d_phostname" in
13838 '') d_phostname="$undef";;
13839 esac
13840
13841 : see if gethostbyaddr_r exists
13842 set gethostbyaddr_r d_gethostbyaddr_r
13843 eval $inlibc
13844 case "$d_gethostbyaddr_r" in
13845 "$define")
13846         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13847         case "$d_gethostbyaddr_r_proto:$usethreads" in
13848         ":define")      d_gethostbyaddr_r_proto=define
13849                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13850                 eval $hasproto ;;
13851         *)      ;;
13852         esac
13853         case "$d_gethostbyaddr_r_proto" in
13854         define)
13855         case "$gethostbyaddr_r_proto" in
13856         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13857         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13858         esac
13859         case "$gethostbyaddr_r_proto" in
13860         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13861         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13862         esac
13863         case "$gethostbyaddr_r_proto" in
13864         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13865         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13866         esac
13867         case "$gethostbyaddr_r_proto" in
13868         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13869         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13870         esac
13871         case "$gethostbyaddr_r_proto" in
13872         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13873         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13874         esac
13875         case "$gethostbyaddr_r_proto" in
13876         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13877         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13878         esac
13879         case "$gethostbyaddr_r_proto" in
13880         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13881         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13882         esac
13883         case "$gethostbyaddr_r_proto" in
13884         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13885         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13886         esac
13887         case "$gethostbyaddr_r_proto" in
13888         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13889         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13890         esac
13891         case "$gethostbyaddr_r_proto" in
13892         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13893         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13894         esac
13895         case "$gethostbyaddr_r_proto" in
13896         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13897         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13898         esac
13899         case "$gethostbyaddr_r_proto" in
13900         ''|0)   d_gethostbyaddr_r=undef
13901                 gethostbyaddr_r_proto=0
13902                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13903         * )     case "$gethostbyaddr_r_proto" in
13904                 REENTRANT_PROTO*) ;;
13905                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13906                 esac
13907                 echo "Prototype: $try" ;;
13908         esac
13909         ;;
13910         *)      case "$usethreads" in
13911                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13912                 esac
13913                 d_gethostbyaddr_r=undef
13914                 gethostbyaddr_r_proto=0
13915                 ;;
13916         esac
13917         ;;
13918 *)      gethostbyaddr_r_proto=0
13919         ;;
13920 esac
13921
13922 : see if gethostbyname_r exists
13923 set gethostbyname_r d_gethostbyname_r
13924 eval $inlibc
13925 case "$d_gethostbyname_r" in
13926 "$define")
13927         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13928         case "$d_gethostbyname_r_proto:$usethreads" in
13929         ":define")      d_gethostbyname_r_proto=define
13930                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13931                 eval $hasproto ;;
13932         *)      ;;
13933         esac
13934         case "$d_gethostbyname_r_proto" in
13935         define)
13936         case "$gethostbyname_r_proto" in
13937         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13938         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13939         esac
13940         case "$gethostbyname_r_proto" in
13941         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13942         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13943         esac
13944         case "$gethostbyname_r_proto" in
13945         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13946         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13947         esac
13948         case "$gethostbyname_r_proto" in
13949         ''|0)   d_gethostbyname_r=undef
13950                 gethostbyname_r_proto=0
13951                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13952         * )     case "$gethostbyname_r_proto" in
13953                 REENTRANT_PROTO*) ;;
13954                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13955                 esac
13956                 echo "Prototype: $try" ;;
13957         esac
13958         ;;
13959         *)      case "$usethreads" in
13960                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13961                 esac
13962                 d_gethostbyname_r=undef
13963                 gethostbyname_r_proto=0
13964                 ;;
13965         esac
13966         ;;
13967 *)      gethostbyname_r_proto=0
13968         ;;
13969 esac
13970
13971 : see if gethostent_r exists
13972 set gethostent_r d_gethostent_r
13973 eval $inlibc
13974 case "$d_gethostent_r" in
13975 "$define")
13976         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13977         case "$d_gethostent_r_proto:$usethreads" in
13978         ":define")      d_gethostent_r_proto=define
13979                 set d_gethostent_r_proto gethostent_r $hdrs
13980                 eval $hasproto ;;
13981         *)      ;;
13982         esac
13983         case "$d_gethostent_r_proto" in
13984         define)
13985         case "$gethostent_r_proto" in
13986         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13987         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13988         esac
13989         case "$gethostent_r_proto" in
13990         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13991         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13992         esac
13993         case "$gethostent_r_proto" in
13994         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13995         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13996         esac
13997         case "$gethostent_r_proto" in
13998         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13999         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14000         esac
14001         case "$gethostent_r_proto" in
14002         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14003         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14004         esac
14005         case "$gethostent_r_proto" in
14006         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14007         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14008         esac
14009         case "$gethostent_r_proto" in
14010         ''|0)   d_gethostent_r=undef
14011                 gethostent_r_proto=0
14012                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14013         * )     case "$gethostent_r_proto" in
14014                 REENTRANT_PROTO*) ;;
14015                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14016                 esac
14017                 echo "Prototype: $try" ;;
14018         esac
14019         ;;
14020         *)      case "$usethreads" in
14021                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14022                 esac
14023                 d_gethostent_r=undef
14024                 gethostent_r_proto=0
14025                 ;;
14026         esac
14027         ;;
14028 *)      gethostent_r_proto=0
14029         ;;
14030 esac
14031
14032 : see if prototypes for various gethostxxx netdb.h functions are available
14033 echo " "
14034 set d_gethostprotos gethostent $i_netdb netdb.h
14035 eval $hasproto
14036
14037 : see if getitimer exists
14038 set getitimer d_getitimer
14039 eval $inlibc
14040
14041 : see if getlogin exists
14042 set getlogin d_getlogin
14043 eval $inlibc
14044
14045 : see if getlogin_r exists
14046 set getlogin_r d_getlogin_r
14047 eval $inlibc
14048 case "$d_getlogin_r" in
14049 "$define")
14050         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14051         case "$d_getlogin_r_proto:$usethreads" in
14052         ":define")      d_getlogin_r_proto=define
14053                 set d_getlogin_r_proto getlogin_r $hdrs
14054                 eval $hasproto ;;
14055         *)      ;;
14056         esac
14057         case "$d_getlogin_r_proto" in
14058         define)
14059         case "$getlogin_r_proto" in
14060         ''|0) try='int getlogin_r(char*, size_t);'
14061         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14062         esac
14063         case "$getlogin_r_proto" in
14064         ''|0) try='int getlogin_r(char*, int);'
14065         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14066         esac
14067         case "$getlogin_r_proto" in
14068         ''|0) try='char* getlogin_r(char*, size_t);'
14069         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14070         esac
14071         case "$getlogin_r_proto" in
14072         ''|0) try='char* getlogin_r(char*, int);'
14073         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14074         esac
14075         case "$getlogin_r_proto" in
14076         ''|0)   d_getlogin_r=undef
14077                 getlogin_r_proto=0
14078                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14079         * )     case "$getlogin_r_proto" in
14080                 REENTRANT_PROTO*) ;;
14081                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14082                 esac
14083                 echo "Prototype: $try" ;;
14084         esac
14085         ;;
14086         *)      case "$usethreads" in
14087                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14088                 esac
14089                 d_getlogin_r=undef
14090                 getlogin_r_proto=0
14091                 ;;
14092         esac
14093         ;;
14094 *)      getlogin_r_proto=0
14095         ;;
14096 esac
14097
14098 : see if getmnt exists
14099 set getmnt d_getmnt
14100 eval $inlibc
14101
14102 : see if getmntent exists
14103 set getmntent d_getmntent
14104 eval $inlibc
14105
14106 : see if getnameinfo exists
14107 set getnameinfo d_getnameinfo
14108 eval $inlibc
14109
14110 : see if getnetbyaddr exists
14111 set getnetbyaddr d_getnbyaddr
14112 eval $inlibc
14113
14114 : see if getnetbyname exists
14115 set getnetbyname d_getnbyname
14116 eval $inlibc
14117
14118 : see if getnetent exists
14119 set getnetent d_getnent
14120 eval $inlibc
14121
14122 : see if getnetbyaddr_r exists
14123 set getnetbyaddr_r d_getnetbyaddr_r
14124 eval $inlibc
14125 case "$d_getnetbyaddr_r" in
14126 "$define")
14127         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14128         case "$d_getnetbyaddr_r_proto:$usethreads" in
14129         ":define")      d_getnetbyaddr_r_proto=define
14130                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14131                 eval $hasproto ;;
14132         *)      ;;
14133         esac
14134         case "$d_getnetbyaddr_r_proto" in
14135         define)
14136         case "$getnetbyaddr_r_proto" in
14137         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14138         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14139         esac
14140         case "$getnetbyaddr_r_proto" in
14141         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14142         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14143         esac
14144         case "$getnetbyaddr_r_proto" in
14145         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14146         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14147         esac
14148         case "$getnetbyaddr_r_proto" in
14149         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14150         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14151         esac
14152         case "$getnetbyaddr_r_proto" in
14153         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14154         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14155         esac
14156         case "$getnetbyaddr_r_proto" in
14157         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14158         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14159         esac
14160         case "$getnetbyaddr_r_proto" in
14161         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14162         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14163         esac
14164         case "$getnetbyaddr_r_proto" in
14165         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14166         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14167         esac
14168         case "$getnetbyaddr_r_proto" in
14169         ''|0)   d_getnetbyaddr_r=undef
14170                 getnetbyaddr_r_proto=0
14171                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14172         * )     case "$getnetbyaddr_r_proto" in
14173                 REENTRANT_PROTO*) ;;
14174                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14175                 esac
14176                 echo "Prototype: $try" ;;
14177         esac
14178         ;;
14179         *)      case "$usethreads" in
14180                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14181                 esac
14182                 d_getnetbyaddr_r=undef
14183                 getnetbyaddr_r_proto=0
14184                 ;;
14185         esac
14186         ;;
14187 *)      getnetbyaddr_r_proto=0
14188         ;;
14189 esac
14190
14191 : see if getnetbyname_r exists
14192 set getnetbyname_r d_getnetbyname_r
14193 eval $inlibc
14194 case "$d_getnetbyname_r" in
14195 "$define")
14196         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14197         case "$d_getnetbyname_r_proto:$usethreads" in
14198         ":define")      d_getnetbyname_r_proto=define
14199                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14200                 eval $hasproto ;;
14201         *)      ;;
14202         esac
14203         case "$d_getnetbyname_r_proto" in
14204         define)
14205         case "$getnetbyname_r_proto" in
14206         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14207         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14208         esac
14209         case "$getnetbyname_r_proto" in
14210         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14211         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14212         esac
14213         case "$getnetbyname_r_proto" in
14214         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14215         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14216         esac
14217         case "$getnetbyname_r_proto" in
14218         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14219         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14220         esac
14221         case "$getnetbyname_r_proto" in
14222         ''|0)   d_getnetbyname_r=undef
14223                 getnetbyname_r_proto=0
14224                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14225         * )     case "$getnetbyname_r_proto" in
14226                 REENTRANT_PROTO*) ;;
14227                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14228                 esac
14229                 echo "Prototype: $try" ;;
14230         esac
14231         ;;
14232         *)      case "$usethreads" in
14233                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14234                 esac
14235                 d_getnetbyname_r=undef
14236                 getnetbyname_r_proto=0
14237                 ;;
14238         esac
14239         ;;
14240 *)      getnetbyname_r_proto=0
14241         ;;
14242 esac
14243
14244 : see if getnetent_r exists
14245 set getnetent_r d_getnetent_r
14246 eval $inlibc
14247 case "$d_getnetent_r" in
14248 "$define")
14249         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14250         case "$d_getnetent_r_proto:$usethreads" in
14251         ":define")      d_getnetent_r_proto=define
14252                 set d_getnetent_r_proto getnetent_r $hdrs
14253                 eval $hasproto ;;
14254         *)      ;;
14255         esac
14256         case "$d_getnetent_r_proto" in
14257         define)
14258         case "$getnetent_r_proto" in
14259         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14260         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14261         esac
14262         case "$getnetent_r_proto" in
14263         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14264         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14265         esac
14266         case "$getnetent_r_proto" in
14267         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14268         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14269         esac
14270         case "$getnetent_r_proto" in
14271         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14272         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14273         esac
14274         case "$getnetent_r_proto" in
14275         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14276         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14277         esac
14278         case "$getnetent_r_proto" in
14279         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14280         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14281         esac
14282         case "$getnetent_r_proto" in
14283         ''|0)   d_getnetent_r=undef
14284                 getnetent_r_proto=0
14285                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14286         * )     case "$getnetent_r_proto" in
14287                 REENTRANT_PROTO*) ;;
14288                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14289                 esac
14290                 echo "Prototype: $try" ;;
14291         esac
14292         ;;
14293         *)      case "$usethreads" in
14294                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14295                 esac
14296                 d_getnetent_r=undef
14297                 getnetent_r_proto=0
14298                 ;;
14299         esac
14300         ;;
14301 *)      getnetent_r_proto=0
14302         ;;
14303 esac
14304
14305 : see if prototypes for various getnetxxx netdb.h functions are available
14306 echo " "
14307 set d_getnetprotos getnetent $i_netdb netdb.h
14308 eval $hasproto
14309
14310 : see if getpagesize exists
14311 set getpagesize d_getpagsz
14312 eval $inlibc
14313
14314 : Optional checks for getprotobyname and getprotobynumber
14315
14316 : see if getprotobyname exists
14317 set getprotobyname d_getpbyname
14318 eval $inlibc
14319
14320 : see if getprotobynumber exists
14321 set getprotobynumber d_getpbynumber
14322 eval $inlibc
14323
14324 : see if getprotoent exists
14325 set getprotoent d_getpent
14326 eval $inlibc
14327
14328 : see if getpgid exists
14329 set getpgid d_getpgid
14330 eval $inlibc
14331
14332 : see if getpgrp2 exists
14333 set getpgrp2 d_getpgrp2
14334 eval $inlibc
14335
14336 : see if getppid exists
14337 set getppid d_getppid
14338 eval $inlibc
14339
14340 : see if getpriority exists
14341 set getpriority d_getprior
14342 eval $inlibc
14343
14344 : see if getprotobyname_r exists
14345 set getprotobyname_r d_getprotobyname_r
14346 eval $inlibc
14347 case "$d_getprotobyname_r" in
14348 "$define")
14349         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14350         case "$d_getprotobyname_r_proto:$usethreads" in
14351         ":define")      d_getprotobyname_r_proto=define
14352                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14353                 eval $hasproto ;;
14354         *)      ;;
14355         esac
14356         case "$d_getprotobyname_r_proto" in
14357         define)
14358         case "$getprotobyname_r_proto" in
14359         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14360         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14361         esac
14362         case "$getprotobyname_r_proto" in
14363         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14364         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14365         esac
14366         case "$getprotobyname_r_proto" in
14367         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14368         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14369         esac
14370         case "$getprotobyname_r_proto" in
14371         ''|0)   d_getprotobyname_r=undef
14372                 getprotobyname_r_proto=0
14373                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14374         * )     case "$getprotobyname_r_proto" in
14375                 REENTRANT_PROTO*) ;;
14376                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14377                 esac
14378                 echo "Prototype: $try" ;;
14379         esac
14380         ;;
14381         *)      case "$usethreads" in
14382                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14383                 esac
14384                 d_getprotobyname_r=undef
14385                 getprotobyname_r_proto=0
14386                 ;;
14387         esac
14388         ;;
14389 *)      getprotobyname_r_proto=0
14390         ;;
14391 esac
14392
14393 : see if getprotobynumber_r exists
14394 set getprotobynumber_r d_getprotobynumber_r
14395 eval $inlibc
14396 case "$d_getprotobynumber_r" in
14397 "$define")
14398         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14399         case "$d_getprotobynumber_r_proto:$usethreads" in
14400         ":define")      d_getprotobynumber_r_proto=define
14401                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14402                 eval $hasproto ;;
14403         *)      ;;
14404         esac
14405         case "$d_getprotobynumber_r_proto" in
14406         define)
14407         case "$getprotobynumber_r_proto" in
14408         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14409         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14410         esac
14411         case "$getprotobynumber_r_proto" in
14412         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14413         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14414         esac
14415         case "$getprotobynumber_r_proto" in
14416         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14417         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14418         esac
14419         case "$getprotobynumber_r_proto" in
14420         ''|0)   d_getprotobynumber_r=undef
14421                 getprotobynumber_r_proto=0
14422                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14423         * )     case "$getprotobynumber_r_proto" in
14424                 REENTRANT_PROTO*) ;;
14425                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14426                 esac
14427                 echo "Prototype: $try" ;;
14428         esac
14429         ;;
14430         *)      case "$usethreads" in
14431                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14432                 esac
14433                 d_getprotobynumber_r=undef
14434                 getprotobynumber_r_proto=0
14435                 ;;
14436         esac
14437         ;;
14438 *)      getprotobynumber_r_proto=0
14439         ;;
14440 esac
14441
14442 : see if getprotoent_r exists
14443 set getprotoent_r d_getprotoent_r
14444 eval $inlibc
14445 case "$d_getprotoent_r" in
14446 "$define")
14447         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14448         case "$d_getprotoent_r_proto:$usethreads" in
14449         ":define")      d_getprotoent_r_proto=define
14450                 set d_getprotoent_r_proto getprotoent_r $hdrs
14451                 eval $hasproto ;;
14452         *)      ;;
14453         esac
14454         case "$d_getprotoent_r_proto" in
14455         define)
14456         case "$getprotoent_r_proto" in
14457         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14458         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14459         esac
14460         case "$getprotoent_r_proto" in
14461         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14462         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14463         esac
14464         case "$getprotoent_r_proto" in
14465         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14466         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14467         esac
14468         case "$getprotoent_r_proto" in
14469         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14470         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14471         esac
14472         case "$getprotoent_r_proto" in
14473         ''|0)   d_getprotoent_r=undef
14474                 getprotoent_r_proto=0
14475                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14476         * )     case "$getprotoent_r_proto" in
14477                 REENTRANT_PROTO*) ;;
14478                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14479                 esac
14480                 echo "Prototype: $try" ;;
14481         esac
14482         ;;
14483         *)      case "$usethreads" in
14484                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14485                 esac
14486                 d_getprotoent_r=undef
14487                 getprotoent_r_proto=0
14488                 ;;
14489         esac
14490         ;;
14491 *)      getprotoent_r_proto=0
14492         ;;
14493 esac
14494
14495 : see if prototypes for various getprotoxxx netdb.h functions are available
14496 echo " "
14497 set d_getprotoprotos getprotoent $i_netdb netdb.h
14498 eval $hasproto
14499
14500 : see if getprpwnam exists
14501 set getprpwnam d_getprpwnam
14502 eval $inlibc
14503
14504 : see if getpwent exists
14505 set getpwent d_getpwent
14506 eval $inlibc
14507
14508 : see if getpwent_r exists
14509 set getpwent_r d_getpwent_r
14510 eval $inlibc
14511 case "$d_getpwent_r" in
14512 "$define")
14513         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14514         case "$d_getpwent_r_proto:$usethreads" in
14515         ":define")      d_getpwent_r_proto=define
14516                 set d_getpwent_r_proto getpwent_r $hdrs
14517                 eval $hasproto ;;
14518         *)      ;;
14519         esac
14520         case "$d_getpwent_r_proto" in
14521         define)
14522         case "$getpwent_r_proto" in
14523         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14524         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14525         esac
14526         case "$getpwent_r_proto" in
14527         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14528         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14529         esac
14530         case "$getpwent_r_proto" in
14531         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14532         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14533         esac
14534         case "$getpwent_r_proto" in
14535         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14536         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14537         esac
14538         case "$getpwent_r_proto" in
14539         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14540         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14541         esac
14542         case "$getpwent_r_proto" in
14543         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14544         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14545         esac
14546         case "$getpwent_r_proto" in
14547         ''|0)   d_getpwent_r=undef
14548                 getpwent_r_proto=0
14549                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14550         * )     case "$getpwent_r_proto" in
14551                 REENTRANT_PROTO*) ;;
14552                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14553                 esac
14554                 echo "Prototype: $try" ;;
14555         esac
14556         ;;
14557         *)      case "$usethreads" in
14558                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14559                 esac
14560                 d_getpwent_r=undef
14561                 getpwent_r_proto=0
14562                 ;;
14563         esac
14564         ;;
14565 *)      getpwent_r_proto=0
14566         ;;
14567 esac
14568
14569 : see if getpwnam_r exists
14570 set getpwnam_r d_getpwnam_r
14571 eval $inlibc
14572 case "$d_getpwnam_r" in
14573 "$define")
14574         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14575         case "$d_getpwnam_r_proto:$usethreads" in
14576         ":define")      d_getpwnam_r_proto=define
14577                 set d_getpwnam_r_proto getpwnam_r $hdrs
14578                 eval $hasproto ;;
14579         *)      ;;
14580         esac
14581         case "$d_getpwnam_r_proto" in
14582         define)
14583         case "$getpwnam_r_proto" in
14584         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14585         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14586         esac
14587         case "$getpwnam_r_proto" in
14588         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14589         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14590         esac
14591         case "$getpwnam_r_proto" in
14592         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14593         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14594         esac
14595         case "$getpwnam_r_proto" in
14596         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14597         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14598         esac
14599         case "$getpwnam_r_proto" in
14600         ''|0)   d_getpwnam_r=undef
14601                 getpwnam_r_proto=0
14602                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14603         * )     case "$getpwnam_r_proto" in
14604                 REENTRANT_PROTO*) ;;
14605                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14606                 esac
14607                 echo "Prototype: $try" ;;
14608         esac
14609         ;;
14610         *)      case "$usethreads" in
14611                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14612                 esac
14613                 d_getpwnam_r=undef
14614                 getpwnam_r_proto=0
14615                 ;;
14616         esac
14617         ;;
14618 *)      getpwnam_r_proto=0
14619         ;;
14620 esac
14621
14622 : see if getpwuid_r exists
14623 set getpwuid_r d_getpwuid_r
14624 eval $inlibc
14625 case "$d_getpwuid_r" in
14626 "$define")
14627         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14628         case "$d_getpwuid_r_proto:$usethreads" in
14629         ":define")      d_getpwuid_r_proto=define
14630                 set d_getpwuid_r_proto getpwuid_r $hdrs
14631                 eval $hasproto ;;
14632         *)      ;;
14633         esac
14634         case "$d_getpwuid_r_proto" in
14635         define)
14636         case "$getpwuid_r_proto" in
14637         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14638         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14639         esac
14640         case "$getpwuid_r_proto" in
14641         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14642         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14643         esac
14644         case "$getpwuid_r_proto" in
14645         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14646         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14647         esac
14648         case "$getpwuid_r_proto" in
14649         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14650         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14651         esac
14652         case "$getpwuid_r_proto" in
14653         ''|0)   d_getpwuid_r=undef
14654                 getpwuid_r_proto=0
14655                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14656         * )     case "$getpwuid_r_proto" in
14657                 REENTRANT_PROTO*) ;;
14658                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14659                 esac
14660                 echo "Prototype: $try" ;;
14661         esac
14662         ;;
14663         *)      case "$usethreads" in
14664                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14665                 esac
14666                 d_getpwuid_r=undef
14667                 getpwuid_r_proto=0
14668                 ;;
14669         esac
14670         ;;
14671 *)      getpwuid_r_proto=0
14672         ;;
14673 esac
14674
14675 : Optional checks for getsbyname and getsbyport
14676
14677 : see if getservbyname exists
14678 set getservbyname d_getsbyname
14679 eval $inlibc
14680
14681 : see if getservbyport exists
14682 set getservbyport d_getsbyport
14683 eval $inlibc
14684
14685 : see if getservent exists
14686 set getservent d_getsent
14687 eval $inlibc
14688
14689 : see if getservbyname_r exists
14690 set getservbyname_r d_getservbyname_r
14691 eval $inlibc
14692 case "$d_getservbyname_r" in
14693 "$define")
14694         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14695         case "$d_getservbyname_r_proto:$usethreads" in
14696         ":define")      d_getservbyname_r_proto=define
14697                 set d_getservbyname_r_proto getservbyname_r $hdrs
14698                 eval $hasproto ;;
14699         *)      ;;
14700         esac
14701         case "$d_getservbyname_r_proto" in
14702         define)
14703         case "$getservbyname_r_proto" in
14704         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14705         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14706         esac
14707         case "$getservbyname_r_proto" in
14708         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14709         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14710         esac
14711         case "$getservbyname_r_proto" in
14712         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14713         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14714         esac
14715         case "$getservbyname_r_proto" in
14716         ''|0)   d_getservbyname_r=undef
14717                 getservbyname_r_proto=0
14718                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14719         * )     case "$getservbyname_r_proto" in
14720                 REENTRANT_PROTO*) ;;
14721                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14722                 esac
14723                 echo "Prototype: $try" ;;
14724         esac
14725         ;;
14726         *)      case "$usethreads" in
14727                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14728                 esac
14729                 d_getservbyname_r=undef
14730                 getservbyname_r_proto=0
14731                 ;;
14732         esac
14733         ;;
14734 *)      getservbyname_r_proto=0
14735         ;;
14736 esac
14737
14738 : see if getservbyport_r exists
14739 set getservbyport_r d_getservbyport_r
14740 eval $inlibc
14741 case "$d_getservbyport_r" in
14742 "$define")
14743         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14744         case "$d_getservbyport_r_proto:$usethreads" in
14745         ":define")      d_getservbyport_r_proto=define
14746                 set d_getservbyport_r_proto getservbyport_r $hdrs
14747                 eval $hasproto ;;
14748         *)      ;;
14749         esac
14750         case "$d_getservbyport_r_proto" in
14751         define)
14752         case "$getservbyport_r_proto" in
14753         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14754         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14755         esac
14756         case "$getservbyport_r_proto" in
14757         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14758         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14759         esac
14760         case "$getservbyport_r_proto" in
14761         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14762         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14763         esac
14764         case "$getservbyport_r_proto" in
14765         ''|0)   d_getservbyport_r=undef
14766                 getservbyport_r_proto=0
14767                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14768         * )     case "$getservbyport_r_proto" in
14769                 REENTRANT_PROTO*) ;;
14770                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14771                 esac
14772                 echo "Prototype: $try" ;;
14773         esac
14774         ;;
14775         *)      case "$usethreads" in
14776                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14777                 esac
14778                 d_getservbyport_r=undef
14779                 getservbyport_r_proto=0
14780                 ;;
14781         esac
14782         ;;
14783 *)      getservbyport_r_proto=0
14784         ;;
14785 esac
14786
14787 : see if getservent_r exists
14788 set getservent_r d_getservent_r
14789 eval $inlibc
14790 case "$d_getservent_r" in
14791 "$define")
14792         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14793         case "$d_getservent_r_proto:$usethreads" in
14794         ":define")      d_getservent_r_proto=define
14795                 set d_getservent_r_proto getservent_r $hdrs
14796                 eval $hasproto ;;
14797         *)      ;;
14798         esac
14799         case "$d_getservent_r_proto" in
14800         define)
14801         case "$getservent_r_proto" in
14802         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14803         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14804         esac
14805         case "$getservent_r_proto" in
14806         ''|0) try='int getservent_r(struct servent*, char*, int);'
14807         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14808         esac
14809         case "$getservent_r_proto" in
14810         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14811         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14812         esac
14813         case "$getservent_r_proto" in
14814         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14815         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14816         esac
14817         case "$getservent_r_proto" in
14818         ''|0)   d_getservent_r=undef
14819                 getservent_r_proto=0
14820                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14821         * )     case "$getservent_r_proto" in
14822                 REENTRANT_PROTO*) ;;
14823                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14824                 esac
14825                 echo "Prototype: $try" ;;
14826         esac
14827         ;;
14828         *)      case "$usethreads" in
14829                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14830                 esac
14831                 d_getservent_r=undef
14832                 getservent_r_proto=0
14833                 ;;
14834         esac
14835         ;;
14836 *)      getservent_r_proto=0
14837         ;;
14838 esac
14839
14840 : see if prototypes for various getservxxx netdb.h functions are available
14841 echo " "
14842 set d_getservprotos getservent $i_netdb netdb.h
14843 eval $hasproto
14844
14845 : see if getspnam exists
14846 set getspnam d_getspnam
14847 eval $inlibc
14848
14849 : see if this is a shadow.h system
14850 set shadow.h i_shadow
14851 eval $inhdr
14852
14853 : see if getspnam_r exists
14854 set getspnam_r d_getspnam_r
14855 eval $inlibc
14856 case "$d_getspnam_r" in
14857 "$define")
14858         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14859         case "$d_getspnam_r_proto:$usethreads" in
14860         ":define")      d_getspnam_r_proto=define
14861                 set d_getspnam_r_proto getspnam_r $hdrs
14862                 eval $hasproto ;;
14863         *)      ;;
14864         esac
14865         case "$d_getspnam_r_proto" in
14866         define)
14867         case "$getspnam_r_proto" in
14868         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14869         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14870         esac
14871         case "$getspnam_r_proto" in
14872         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14873         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14874         esac
14875         case "$getspnam_r_proto" in
14876         ''|0)   d_getspnam_r=undef
14877                 getspnam_r_proto=0
14878                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14879         * )     case "$getspnam_r_proto" in
14880                 REENTRANT_PROTO*) ;;
14881                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14882                 esac
14883                 echo "Prototype: $try" ;;
14884         esac
14885         ;;
14886         *)      case "$usethreads" in
14887                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14888                 esac
14889                 d_getspnam_r=undef
14890                 getspnam_r_proto=0
14891                 ;;
14892         esac
14893         ;;
14894 *)      getspnam_r_proto=0
14895         ;;
14896 esac
14897
14898 : see if gettimeofday or ftime exists
14899 set gettimeofday d_gettimeod
14900 eval $inlibc
14901 case "$d_gettimeod" in
14902 "$undef")
14903         set ftime d_ftime 
14904         eval $inlibc
14905         ;;
14906 *)
14907         val="$undef"; set d_ftime; eval $setvar
14908         ;;
14909 esac
14910 case "$d_gettimeod$d_ftime" in
14911 "$undef$undef")
14912         echo " "
14913         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14914         ;;
14915 esac
14916
14917 : see if gmtime_r exists
14918 set gmtime_r d_gmtime_r
14919 eval $inlibc
14920 case "$d_gmtime_r" in
14921 "$define")
14922         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14923         case "$d_gmtime_r_proto:$usethreads" in
14924         ":define")      d_gmtime_r_proto=define
14925                 set d_gmtime_r_proto gmtime_r $hdrs
14926                 eval $hasproto ;;
14927         *)      ;;
14928         esac
14929         case "$d_gmtime_r_proto" in
14930         define)
14931         case "$gmtime_r_proto" in
14932         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14933         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14934         esac
14935         case "$gmtime_r_proto" in
14936         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14937         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14938         esac
14939         case "$gmtime_r_proto" in
14940         ''|0)   d_gmtime_r=undef
14941                 gmtime_r_proto=0
14942                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14943         * )     case "$gmtime_r_proto" in
14944                 REENTRANT_PROTO*) ;;
14945                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14946                 esac
14947                 echo "Prototype: $try" ;;
14948         esac
14949         ;;
14950         *)      case "$usethreads" in
14951                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14952                 esac
14953                 d_gmtime_r=undef
14954                 gmtime_r_proto=0
14955                 ;;
14956         esac
14957         ;;
14958 *)      gmtime_r_proto=0
14959         ;;
14960 esac
14961
14962 : see if hasmntopt exists
14963 set hasmntopt d_hasmntopt
14964 eval $inlibc
14965
14966 : see if this is a netinet/in.h or sys/in.h system
14967 set netinet/in.h i_niin sys/in.h i_sysin
14968 eval $inhdr
14969
14970 : see if arpa/inet.h has to be included
14971 set arpa/inet.h i_arpainet
14972 eval $inhdr
14973
14974 : see if htonl --and friends-- exists
14975 val=''
14976 set htonl val
14977 eval $inlibc
14978
14979 : Maybe they are macros.
14980 case "$val" in
14981 $undef)
14982         $cat >htonl.c <<EOM
14983 #include <stdio.h>
14984 #include <sys/types.h>
14985 #$i_niin I_NETINET_IN
14986 #$i_sysin I_SYS_IN
14987 #$i_arpainet I_ARPA_INET
14988 #ifdef I_NETINET_IN
14989 #include <netinet/in.h>
14990 #endif
14991 #ifdef I_SYS_IN
14992 #include <sys/in.h>
14993 #endif
14994 #ifdef I_ARPA_INET
14995 #include <arpa/inet.h>
14996 #endif
14997 #ifdef htonl
14998 printf("Defined as a macro.");
14999 #endif
15000 EOM
15001         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15002         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15003                 val="$define"
15004                 echo "But it seems to be defined as a macro." >&4
15005         fi
15006         $rm -f htonl.?
15007         ;;
15008 esac
15009 set d_htonl
15010 eval $setvar
15011
15012 : see if ilogbl exists
15013 set ilogbl d_ilogbl
15014 eval $inlibc
15015
15016 : index or strchr
15017 echo " "
15018 if set index val -f; eval $csym; $val; then
15019         if set strchr val -f d_strchr; eval $csym; $val; then
15020                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15021                         val="$define"
15022                         vali="$undef"
15023                         echo "strchr() found." >&4
15024                 else
15025                         val="$undef"
15026                         vali="$define"
15027                         echo "index() found." >&4
15028                 fi
15029         else
15030                 val="$undef"
15031                 vali="$define"
15032                 echo "index() found." >&4
15033         fi
15034 else
15035         if set strchr val -f d_strchr; eval $csym; $val; then
15036                 val="$define"
15037                 vali="$undef"
15038                 echo "strchr() found." >&4
15039         else
15040                 echo "No index() or strchr() found!" >&4
15041                 val="$undef"
15042                 vali="$undef"
15043         fi
15044 fi
15045 set d_strchr; eval $setvar
15046 val="$vali"
15047 set d_index; eval $setvar
15048
15049 : check whether inet_aton exists
15050 set inet_aton d_inetaton
15051 eval $inlibc
15052
15053 : see if inet_ntop exists
15054 set inet_ntop d_inetntop
15055 eval $inlibc
15056
15057 : see if inet_pton exists
15058 set inet_pton d_inetpton
15059 eval $inlibc
15060
15061 : Look for isascii
15062 echo " "
15063 $cat >isascii.c <<EOCP
15064 #include <stdio.h>
15065 #include <ctype.h>
15066 #$i_stdlib I_STDLIB
15067 #ifdef I_STDLIB
15068 #include <stdlib.h>
15069 #endif
15070 int main() {
15071         int c = 'A';
15072         if (isascii(c))
15073                 exit(0);
15074         else
15075                 exit(1);
15076 }
15077 EOCP
15078 set isascii
15079 if eval $compile; then
15080         echo "isascii() found." >&4
15081         val="$define"
15082 else
15083         echo "isascii() NOT found." >&4
15084         val="$undef"
15085 fi
15086 set d_isascii
15087 eval $setvar
15088 $rm -f isascii*
15089
15090 : Look for isblank
15091 echo " "
15092 $cat >isblank.c <<'EOCP'
15093 #include <stdio.h>
15094 #include <ctype.h>
15095 int main() {
15096         int c = ' ';
15097         if (isblank(c))
15098                 return 0 ;
15099         else
15100                 return 1 ;
15101 }
15102 EOCP
15103 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15104         echo "isblank() found." >&4
15105         val="$define"
15106 else
15107         echo "isblank() NOT found." >&4
15108         val="$undef"
15109 fi
15110 set d_isblank
15111 eval $setvar
15112 $rm -f isblank*
15113
15114 : see if isfinite exists
15115 set isfinite d_isfinite
15116 eval $inlibc
15117
15118 : see if isinf exists
15119 set isinf d_isinf
15120 eval $inlibc
15121
15122 : see if isnan exists
15123 set isnan d_isnan
15124 eval $inlibc
15125
15126 : see if isnanl exists
15127 set isnanl d_isnanl
15128 eval $inlibc
15129
15130 : see if killpg exists
15131 set killpg d_killpg
15132 eval $inlibc
15133
15134 : see if lchown exists
15135 echo " "
15136 $cat > try.c <<'EOCP'
15137 /* System header to define __stub macros and hopefully few prototypes,
15138     which can conflict with char lchown(); below.  */
15139 #include <assert.h>
15140 /* Override any gcc2 internal prototype to avoid an error.  */
15141 /* We use char because int might match the return type of a gcc2
15142    builtin and then its argument prototype would still apply.  */
15143 char lchown();
15144 int main() {
15145     /*  The GNU C library defines this for functions which it implements
15146         to always fail with ENOSYS.  Some functions are actually named
15147         something starting with __ and the normal name is an alias.  */
15148 #if defined (__stub_lchown) || defined (__stub___lchown)
15149 choke me
15150 #else
15151 lchown();
15152 #endif
15153 ; return 0; }
15154 EOCP
15155 set try
15156 if eval $compile; then
15157     $echo "lchown() found." >&4
15158     val="$define"
15159 else
15160     $echo "lchown() NOT found." >&4
15161     val="$undef"
15162 fi
15163 set d_lchown
15164 eval $setvar
15165
15166 : See if number of significant digits in a double precision number is known
15167 echo " "
15168 $cat >ldbl_dig.c <<EOM
15169 #$i_limits I_LIMITS
15170 #$i_float I_FLOAT
15171 #ifdef I_LIMITS
15172 #include <limits.h>
15173 #endif
15174 #ifdef I_FLOAT
15175 #include <float.h>
15176 #endif
15177 #ifdef LDBL_DIG
15178 printf("Contains LDBL_DIG");
15179 #endif
15180 EOM
15181 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15182 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15183         echo "LDBL_DIG found." >&4
15184         val="$define"
15185 else
15186         echo "LDBL_DIG NOT found." >&4
15187         val="$undef"
15188 fi
15189 $rm -f ldbl_dig.?
15190 set d_ldbl_dig
15191 eval $setvar
15192
15193 : see if this is a math.h system
15194 set math.h i_math
15195 eval $inhdr
15196
15197 : check to see if math.h defines _LIB_VERSION
15198 d_libm_lib_version="$undef"
15199 case $i_math in
15200     $define)
15201         echo " "
15202         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15203         $cat >try.c <<EOCP
15204 #include <unistd.h>
15205 #include <math.h>
15206 int main (int argc, char *argv[])
15207 {
15208     printf ("%d\n", _LIB_VERSION);
15209     return (0);
15210     } /* main */
15211 EOCP
15212         set try
15213         if eval $compile; then
15214             foo=`$run ./try`
15215             echo "Yes, it does ($foo)" >&4
15216             d_libm_lib_version="$define"
15217         else
15218             echo "No, it does not (probably harmless)" >&4
15219             fi
15220         $rm_try
15221         ;;
15222
15223     esac
15224
15225 : see if link exists
15226 set link d_link
15227 eval $inlibc
15228
15229 : see if localtime_r exists
15230 set localtime_r d_localtime_r
15231 eval $inlibc
15232 case "$d_localtime_r" in
15233 "$define")
15234         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15235         case "$d_localtime_r_proto:$usethreads" in
15236         ":define")      d_localtime_r_proto=define
15237                 set d_localtime_r_proto localtime_r $hdrs
15238                 eval $hasproto ;;
15239         *)      ;;
15240         esac
15241         case "$d_localtime_r_proto" in
15242         define)
15243         case "$localtime_r_proto" in
15244         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15245         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15246         esac
15247         case "$localtime_r_proto" in
15248         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15249         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15250         esac
15251         case "$localtime_r_proto" in
15252         ''|0)   d_localtime_r=undef
15253                 localtime_r_proto=0
15254                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15255         * )     case "$localtime_r_proto" in
15256                 REENTRANT_PROTO*) ;;
15257                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15258                 esac
15259                 echo "Prototype: $try" ;;
15260         esac
15261         ;;
15262         *)      case "$usethreads" in
15263                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15264                 esac
15265                 d_localtime_r=undef
15266                 localtime_r_proto=0
15267                 ;;
15268         esac
15269         ;;
15270 *)      localtime_r_proto=0
15271         ;;
15272 esac
15273
15274 : see if localtime_r calls tzset
15275 case "$localtime_r_proto" in
15276 REENTRANT_PROTO*)
15277         $cat >try.c <<EOCP
15278 /*  Does our libc's localtime_r call tzset ?
15279  *  return 0 if so, 1 otherwise.
15280  */
15281 #$i_systypes    I_SYS_TYPES
15282 #$i_unistd      I_UNISTD
15283 #$i_time        I_TIME
15284 #$i_stdlib      I_STDLIB
15285 #$i_string      I_STRING
15286 #$i_malloc      I_MALLOC
15287 #ifdef I_SYS_TYPES
15288 #  include <sys/types.h>
15289 #endif
15290 #ifdef I_UNISTD
15291 #  include <unistd.h>
15292 #endif
15293 #ifdef I_TIME
15294 #  include <time.h>
15295 #endif
15296 #ifdef I_STDLIB
15297 #include <stdlib.h>
15298 #endif
15299 #ifdef I_STRING
15300 #  include <string.h>
15301 #else
15302 #  include <strings.h>
15303 #endif
15304 #ifdef I_MALLOC
15305 #  include <malloc.h>
15306 #endif
15307 int main()
15308 {
15309     time_t t = time(0L);
15310     char w_tz[]="TZ" "=GMT+5",
15311          e_tz[]="TZ" "=GMT-5",
15312         *tz_e = (char*)malloc(16),
15313         *tz_w = (char*)malloc(16);
15314     struct tm tm_e, tm_w;
15315     memset(&tm_e,'\0',sizeof(struct tm));
15316     memset(&tm_w,'\0',sizeof(struct tm));
15317     strcpy(tz_e,e_tz);
15318     strcpy(tz_w,w_tz);
15319
15320     putenv(tz_e);
15321     localtime_r(&t, &tm_e);
15322
15323     putenv(tz_w);
15324     localtime_r(&t, &tm_w);
15325
15326     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15327         return 1;
15328     return 0;
15329 }
15330 EOCP
15331         set try
15332         if eval $compile; then
15333             if $run ./try; then
15334                 d_localtime_r_needs_tzset=undef;
15335             else
15336                 d_localtime_r_needs_tzset=define;
15337             fi;
15338         else
15339             d_localtime_r_needs_tzset=undef;
15340         fi;
15341      ;;
15342   *)
15343      d_localtime_r_needs_tzset=undef;
15344      ;;
15345 esac
15346 $rm_try
15347
15348 : see if localeconv exists
15349 set localeconv d_locconv
15350 eval $inlibc
15351
15352 : see if lockf exists
15353 set lockf d_lockf
15354 eval $inlibc
15355
15356 : see if prototype for lseek is available
15357 echo " "
15358 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15359 eval $hasproto
15360
15361 : see if lstat exists
15362 set lstat d_lstat
15363 eval $inlibc
15364
15365 : see if madvise exists
15366 set madvise d_madvise
15367 eval $inlibc
15368
15369 : see if malloc_size exists
15370 set malloc_size d_malloc_size
15371 eval $inlibc
15372
15373 : see if malloc_size_good exists
15374 set malloc_good_size d_malloc_good_size
15375 eval $inlibc
15376
15377 : see if mblen exists
15378 set mblen d_mblen
15379 eval $inlibc
15380
15381 : see if mbstowcs exists
15382 set mbstowcs d_mbstowcs
15383 eval $inlibc
15384
15385 : see if mbtowc exists
15386 set mbtowc d_mbtowc
15387 eval $inlibc
15388
15389 : see if memchr exists
15390 set memchr d_memchr
15391 eval $inlibc
15392
15393 : see if memcmp exists
15394 set memcmp d_memcmp
15395 eval $inlibc
15396
15397 : see if memcpy exists
15398 set memcpy d_memcpy
15399 eval $inlibc
15400
15401 : see if memmove exists
15402 set memmove d_memmove
15403 eval $inlibc
15404
15405 : see if memset exists
15406 set memset d_memset
15407 eval $inlibc
15408
15409 : see if mkdir exists
15410 set mkdir d_mkdir
15411 eval $inlibc
15412
15413 : see if mkdtemp exists
15414 set mkdtemp d_mkdtemp
15415 eval $inlibc
15416
15417 : see if mkfifo exists
15418 set mkfifo d_mkfifo
15419 eval $inlibc
15420
15421 : see if mkstemp exists
15422 set mkstemp d_mkstemp
15423 eval $inlibc
15424
15425 : see if mkstemps exists
15426 set mkstemps d_mkstemps
15427 eval $inlibc
15428
15429 : see if mktime exists
15430 set mktime d_mktime
15431 eval $inlibc
15432
15433 : see if this is a sys/mman.h system
15434 set sys/mman.h i_sysmman
15435 eval $inhdr
15436
15437 : see if mmap exists
15438 set mmap d_mmap
15439 eval $inlibc
15440 : see what shmat returns
15441 : default to something harmless
15442 mmaptype='void *'
15443 case "$i_sysmman$d_mmap" in
15444 "$define$define")
15445         $cat >mmap.c <<'END'
15446 #include <sys/mman.h>
15447 void *mmap();
15448 END
15449         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15450                 mmaptype='void *'
15451         else
15452                 mmaptype='caddr_t'
15453         fi
15454         echo "and it returns ($mmaptype)." >&4
15455         ;;
15456 esac
15457
15458
15459
15460 : see if sqrtl exists
15461 set sqrtl d_sqrtl
15462 eval $inlibc
15463
15464 : see if scalbnl exists
15465 set scalbnl d_scalbnl
15466 eval $inlibc
15467
15468 : see if modfl exists
15469 set modfl d_modfl
15470 eval $inlibc
15471
15472 : see if prototype for modfl is available
15473 echo " "
15474 set d_modflproto modfl $i_math math.h
15475 eval $hasproto
15476
15477 d_modfl_pow32_bug="$undef"
15478
15479 case "$d_longdbl$d_modfl" in
15480 $define$define)
15481         $cat <<EOM
15482 Checking to see whether your modfl() is okay for large values...
15483 EOM
15484 $cat >try.c <<EOCP
15485 #include <math.h>
15486 #include <stdio.h>
15487 EOCP
15488 if $test "X$d_modflproto" != "X$define"; then
15489         $cat >>try.c <<EOCP
15490 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15491 long double modfl (long double, long double *);
15492 EOCP
15493 fi
15494 $cat >>try.c <<EOCP
15495 int main() {
15496     long double nv = 4294967303.15;
15497     long double v, w;
15498     v = modfl(nv, &w);
15499 #ifdef __GLIBC__
15500     printf("glibc");
15501 #endif
15502     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15503     return 0;
15504 }
15505 EOCP
15506         case "$osname:$gccversion" in
15507         aix:)   saveccflags="$ccflags"
15508                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15509         esac
15510         set try
15511         if eval $compile; then
15512                 foo=`$run ./try`
15513                 case "$foo" in
15514                 *" 4294967303.150000 1.150000 4294967302.000000")
15515                         echo >&4 "Your modfl() is broken for large values."
15516                         d_modfl_pow32_bug="$define"
15517                         case "$foo" in
15518                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15519                         ;;
15520                         esac
15521                         ;;
15522                 *" 4294967303.150000 0.150000 4294967303.000000")
15523                         echo >&4 "Your modfl() seems okay for large values."
15524                         ;;
15525                 *)      echo >&4 "I don't understand your modfl() at all."
15526                         d_modfl="$undef"
15527                         ;;
15528                 esac
15529                 $rm_try
15530         else
15531                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15532                 d_modfl="$undef"
15533         fi
15534         case "$osname:$gccversion" in
15535         aix:)   ccflags="$saveccflags" ;; # restore
15536         esac
15537         ;;
15538 esac
15539
15540 if $test "$uselongdouble" = "$define"; then
15541     message=""
15542     if $test "$d_sqrtl" != "$define"; then
15543         message="$message sqrtl"
15544     fi
15545     if $test "$d_modfl" != "$define"; then
15546         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15547             echo "You have both aintl and copysignl, so I can emulate modfl."
15548         else
15549             message="$message modfl"
15550         fi
15551     fi
15552     if $test "$d_frexpl" != "$define"; then
15553         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15554             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15555         else
15556             message="$message frexpl"
15557         fi
15558     fi
15559
15560     if $test "$message" != ""; then
15561         $cat <<EOM >&4
15562
15563 *** You requested the use of long doubles but you do not seem to have
15564 *** the following mathematical functions needed for long double support:
15565 ***    $message
15566 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15567 *** Cannot continue, aborting.
15568
15569 EOM
15570
15571         exit 1
15572     fi
15573 fi
15574
15575 : see if mprotect exists
15576 set mprotect d_mprotect
15577 eval $inlibc
15578
15579 : see if msgctl exists
15580 set msgctl d_msgctl
15581 eval $inlibc
15582
15583 : see if msgget exists
15584 set msgget d_msgget
15585 eval $inlibc
15586
15587 : see if msgsnd exists
15588 set msgsnd d_msgsnd
15589 eval $inlibc
15590
15591 : see if msgrcv exists
15592 set msgrcv d_msgrcv
15593 eval $inlibc
15594
15595 : see how much of the 'msg*(2)' library is present.
15596 h_msg=true
15597 echo " "
15598 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15599 *"$undef"*) h_msg=false;;
15600 esac
15601 case "$osname" in
15602 freebsd)
15603     case "`ipcs 2>&1`" in
15604     "SVID messages"*"not configured"*)
15605         echo "Your $osname does not have the msg*(2) configured." >&4
15606         h_msg=false
15607         val="$undef"
15608         set msgctl d_msgctl
15609         eval $setvar
15610         set msgget d_msgget
15611         eval $setvar
15612         set msgsnd d_msgsnd
15613         eval $setvar
15614         set msgrcv d_msgrcv
15615         eval $setvar
15616         ;;
15617     esac
15618     ;;
15619 esac
15620 : we could also check for sys/ipc.h ...
15621 if $h_msg && $test `./findhdr sys/msg.h`; then
15622         echo "You have the full msg*(2) library." >&4
15623         val="$define"
15624 else
15625         echo "You don't have the full msg*(2) library." >&4
15626         val="$undef"
15627 fi
15628 set d_msg
15629 eval $setvar
15630
15631 : Check for msghdr_s
15632 echo " "
15633 echo "Checking to see if your system supports struct msghdr..." >&4
15634 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15635 eval $hasstruct
15636 case "$d_msghdr_s" in
15637 "$define")      echo "Yes, it does."   ;;
15638 *)              echo "No, it doesn't." ;;
15639 esac
15640
15641
15642 : see if msync exists
15643 set msync d_msync
15644 eval $inlibc
15645
15646 : see if munmap exists
15647 set munmap d_munmap
15648 eval $inlibc
15649
15650 : see if nice exists
15651 set nice d_nice
15652 eval $inlibc
15653
15654 : see if this is a langinfo.h system
15655 set langinfo.h i_langinfo
15656 eval $inhdr
15657
15658 : see if nl_langinfo exists
15659 set nl_langinfo d_nl_langinfo
15660 eval $inlibc
15661
15662 : check for volatile keyword
15663 echo " "
15664 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15665 $cat >try.c <<'EOCP'
15666 int main()
15667 {
15668         typedef struct _goo_struct goo_struct;
15669         goo_struct * volatile goo = ((goo_struct *)0);
15670         struct _goo_struct {
15671                 long long_int;
15672                 int reg_int;
15673                 char char_var;
15674         };
15675         typedef unsigned short foo_t;
15676         char *volatile foo;
15677         volatile int bar;
15678         volatile foo_t blech;
15679         foo = foo;
15680 }
15681 EOCP
15682 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15683         val="$define"
15684         echo "Yup, it does."
15685 else
15686         val="$undef"
15687         echo "Nope, it doesn't."
15688 fi
15689 set d_volatile
15690 eval $setvar
15691 $rm_try
15692
15693 : Check basic sizes
15694 echo " "
15695 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15696
15697 case "$use64bitint:$d_quad:$quadtype" in
15698 define:define:?*)
15699         ivtype="$quadtype"
15700         uvtype="$uquadtype"
15701         ivsize=8
15702         uvsize=8
15703         ;;
15704 *)      ivtype="long"
15705         uvtype="unsigned long"
15706         ivsize=$longsize
15707         uvsize=$longsize
15708         ;;
15709 esac
15710
15711 case "$uselongdouble:$d_longdbl" in
15712 define:define)
15713         nvtype="long double"
15714         nvsize=$longdblsize
15715         ;;
15716 *)      nvtype=double
15717         nvsize=$doublesize
15718         ;;
15719 esac
15720
15721 $echo "(IV will be "$ivtype", $ivsize bytes)"
15722 $echo "(UV will be "$uvtype", $uvsize bytes)"
15723 $echo "(NV will be "$nvtype", $nvsize bytes)"
15724
15725 $cat >try.c <<EOCP
15726 #$i_inttypes I_INTTYPES
15727 #ifdef I_INTTYPES
15728 #include <inttypes.h>
15729 #endif
15730 #include <stdio.h>
15731 int main() {
15732 #ifdef INT8
15733    int8_t i =  INT8_MAX;
15734   uint8_t u = UINT8_MAX;
15735   printf("int8_t\n");
15736 #endif
15737 #ifdef INT16
15738    int16_t i =  INT16_MAX;
15739   uint16_t i = UINT16_MAX;
15740   printf("int16_t\n");
15741 #endif
15742 #ifdef INT32
15743    int32_t i =  INT32_MAX;
15744   uint32_t u = UINT32_MAX;
15745   printf("int32_t\n");
15746 #endif
15747 }
15748 EOCP
15749
15750 i8type="signed char"
15751 u8type="unsigned char"
15752 i8size=1
15753 u8size=1
15754
15755 case "$i16type" in
15756 '')     case "$shortsize" in
15757         2)      i16type=short
15758                 u16type="unsigned short"
15759                 i16size=$shortsize
15760                 u16size=$shortsize
15761                 ;;
15762         esac
15763         ;;
15764 esac
15765 case "$i16type" in
15766 '')     set try -DINT16
15767         if eval $compile; then
15768                 case "`$run ./try`" in
15769                 int16_t)
15770                         i16type=int16_t
15771                         u16type=uint16_t
15772                         i16size=2
15773                         u16size=2
15774                         ;;
15775                 esac
15776         fi
15777         ;;
15778 esac
15779 case "$i16type" in
15780 '')     if $test $shortsize -ge 2; then
15781                 i16type=short
15782                 u16type="unsigned short"
15783                 i16size=$shortsize
15784                 u16size=$shortsize
15785         fi
15786         ;;
15787 esac
15788
15789 case "$i32type" in
15790 '')     case "$longsize" in
15791         4)      i32type=long
15792                 u32type="unsigned long"
15793                 i32size=$longsize
15794                 u32size=$longsize
15795                 ;;
15796         *)      case "$intsize" in
15797                 4)      i32type=int
15798                         u32type="unsigned int"
15799                         i32size=$intsize
15800                         u32size=$intsize
15801                         ;;
15802                 esac
15803                 ;;
15804         esac
15805         ;;
15806 esac
15807 case "$i32type" in
15808 '')     set try -DINT32
15809         if eval $compile; then
15810                 case "`$run ./try`" in
15811                 int32_t)
15812                         i32type=int32_t
15813                         u32type=uint32_t
15814                         i32size=4
15815                         u32size=4
15816                         ;;
15817                 esac
15818         fi
15819         ;;
15820 esac
15821 case "$i32type" in
15822 '')     if $test $intsize -ge 4; then
15823                 i32type=int
15824                 u32type="unsigned int"
15825                 i32size=$intsize
15826                 u32size=$intsize
15827         fi
15828         ;;
15829 esac
15830
15831 case "$i64type" in
15832 '')     case "$d_quad:$quadtype" in
15833         define:?*)
15834                 i64type="$quadtype"
15835                 u64type="$uquadtype"
15836                 i64size=8
15837                 u64size=8
15838                 ;;
15839         esac
15840         ;;
15841 esac
15842
15843 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15844 : volatile so that the compiler has to store it out to memory.
15845 if test X"$d_volatile" = X"$define"; then
15846         volatile=volatile
15847 fi
15848 $cat <<EOP >try.c
15849 #include <stdio.h>
15850 #$i_stdlib I_STDLIB
15851 #ifdef I_STDLIB
15852 #include <stdlib.h>
15853 #endif
15854 #include <sys/types.h>
15855 #include <signal.h>
15856 #ifdef SIGFPE
15857 $volatile int bletched = 0;
15858 $signal_t blech(int s) { bletched = 1; }
15859 #endif
15860 int main() {
15861     $uvtype u = 0;
15862     $nvtype d;
15863     int     n = 8 * $uvsize;
15864     int     i;
15865 #ifdef SIGFPE
15866     signal(SIGFPE, blech);
15867 #endif
15868
15869     for (i = 0; i < n; i++) {
15870       u = u << 1 | ($uvtype)1;
15871       d = ($nvtype)u;
15872       if (($uvtype)d != u)
15873         break;
15874       if (d <= 0)
15875         break;
15876       d = ($nvtype)(u - 1);
15877       if (($uvtype)d != (u - 1))
15878         break;
15879 #ifdef SIGFPE
15880       if (bletched)
15881         break;
15882 #endif
15883     }
15884     printf("%d\n", ((i == n) ? -n : i));
15885     exit(0);
15886 }
15887 EOP
15888 set try
15889
15890 d_nv_preserves_uv="$undef"
15891 if eval $compile; then
15892         nv_preserves_uv_bits="`$run ./try`"
15893 fi
15894 case "$nv_preserves_uv_bits" in
15895 \-[1-9]*)
15896         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15897         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15898         d_nv_preserves_uv="$define"
15899         ;;
15900 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15901         d_nv_preserves_uv="$undef" ;;
15902 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15903         nv_preserves_uv_bits="0" ;;
15904 esac
15905 $rm_try
15906
15907 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15908 : volatile so that the compiler has to store it out to memory.
15909 if test X"$d_volatile" = X"$define"; then
15910         volatile=volatile
15911 fi
15912 $cat <<EOP >try.c
15913 #include <stdio.h>
15914
15915 typedef $nvtype NV;
15916
15917 int
15918 main() {
15919   NV value = 2;
15920   int count = 1;
15921
15922   while(count < 256) {
15923     $volatile NV up = value + 1.0;
15924     $volatile NV negated = -value;
15925     $volatile NV down = negated - 1.0;
15926     $volatile NV got_up = up - value;
15927     int up_good = got_up == 1.0;
15928     int got_down = down - negated;
15929     int down_good = got_down == -1.0;
15930
15931     if (down_good != up_good) {
15932       fprintf(stderr,
15933               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15934               up_good, (double) got_up, down_good, (double) got_down,
15935               count, (double) value);
15936       return 1;
15937     }
15938     if (!up_good) {
15939       while (1) {
15940         if (count > 8) {
15941           count -= 8;
15942           fputs("256.0", stdout);
15943         } else {
15944           count--;
15945           fputs("2.0", stdout);
15946         }
15947         if (!count) {
15948           puts("");
15949           return 0;
15950         }
15951         fputs("*", stdout);
15952       }
15953     }
15954     value *= 2;
15955     ++count;
15956   }
15957   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15958           count, (double) value);
15959   return 1;
15960 }
15961 EOP
15962 set try
15963
15964 nv_overflows_integers_at='0'
15965 if eval $compile; then
15966     xxx="`$run ./try`"
15967     case "$?" in
15968         0)
15969             case "$xxx" in
15970                 2*)  cat >&4 <<EOM
15971 The largest integer your NVs can preserve is equal to $xxx
15972 EOM
15973                     nv_overflows_integers_at="$xxx"
15974                     ;;
15975                 *)  cat >&4 <<EOM
15976 Cannot determine the largest integer value your NVs can hold, unexpected output
15977 '$xxx'
15978 EOM
15979                     ;;
15980             esac
15981             ;;
15982         *)  cat >&4 <<EOM
15983 Cannot determine the largest integer value your NVs can hold
15984 EOM
15985             ;;
15986     esac
15987 fi
15988 $rm_try
15989
15990 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15991 : volatile so that the compiler has to store it out to memory.
15992 if test X"$d_volatile" = X"$define"; then
15993         volatile=volatile
15994 fi
15995 $cat <<EOP >try.c
15996 #include <stdio.h>
15997 #$i_stdlib I_STDLIB
15998 #ifdef I_STDLIB
15999 #include <stdlib.h>
16000 #endif
16001 #$i_string I_STRING
16002 #ifdef I_STRING
16003 #  include <string.h>
16004 #else
16005 #  include <strings.h>
16006 #endif
16007 #include <sys/types.h>
16008 #include <signal.h>
16009 #ifdef SIGFPE
16010 $volatile int bletched = 0;
16011 $signal_t blech(int s) { bletched = 1; }
16012 #endif
16013
16014 int checkit($nvtype d, char *where) {
16015     unsigned char *p = (char *)&d;
16016     unsigned char *end = p + sizeof(d);
16017     int fail = 0;
16018
16019     while (p < end)
16020         fail += *p++;
16021
16022     if (!fail)
16023         return 0;
16024
16025     p = (char *)&d;
16026     printf("No - %s: 0x", where);
16027     while (p < end)
16028         printf ("%02X", *p++);
16029     printf("\n");
16030     return 1;
16031 }
16032
16033 int main(int argc, char **argv) {
16034     $nvtype d = 0.0;
16035     int fail = 0;
16036     fail += checkit(d, "0.0");
16037
16038     /* The compiler shouldn't be assuming that bletched is 0  */
16039     d = bletched;
16040
16041     fail += checkit(d, "bleched");
16042
16043 #ifdef SIGFPE
16044     signal(SIGFPE, blech);
16045 #endif
16046
16047     /* Paranoia - the compiler should have no way of knowing that ANSI says
16048        that argv[argc] will always be NULL.  Actually, if it did assume this it
16049        would be buggy, as this is C and main() can be called from elsewhere in
16050        the program.  */
16051     d = argv[argc] ? 1 : 0;
16052
16053     if (d) {
16054         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16055     }
16056
16057     fail += checkit(d, "ternary");
16058
16059     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16060
16061     if (d != 0.0) {
16062         printf("No - memset doesn't give 0.0\n");
16063         /* This might just blow up:  */
16064         printf("(gives %g)\n", d);
16065         return 1;
16066     }
16067
16068 #ifdef SIGFPE
16069     if (bletched) {
16070         printf("No - something bleched\n");
16071         return 1;
16072     }
16073 #endif
16074     if (fail) {
16075       printf("No - %d fail(s)\n", fail);
16076       return 1;
16077     }
16078     printf("Yes\n");
16079     return 0;
16080 }
16081 EOP
16082 set try
16083
16084 d_nv_zero_is_allbits_zero="$undef"
16085 if eval $compile; then
16086     xxx="`$run ./try`"
16087     case "$?" in
16088         0)
16089             case "$xxx" in
16090                 Yes)  cat >&4 <<EOM
16091 0.0 is represented as all bits zero in memory
16092 EOM
16093                     d_nv_zero_is_allbits_zero="$define"
16094                     ;;
16095                 *)  cat >&4 <<EOM
16096 0.0 is not represented as all bits zero in memory
16097 EOM
16098                     d_nv_zero_is_allbits_zero="$undef"
16099                     ;;
16100             esac
16101             ;;
16102         *)  cat >&4 <<EOM
16103 0.0 is not represented as all bits zero in memory
16104 EOM
16105             d_nv_zero_is_allbits_zero="$undef"
16106             ;;
16107     esac
16108 fi
16109 $rm_try
16110
16111 : check for off64_t
16112 echo " "
16113 echo "Checking to see if you have off64_t..." >&4
16114 $cat >try.c <<EOCP
16115 #include <sys/types.h>
16116 #include <unistd.h>
16117 int main() { off64_t x = 7; }
16118 EOCP
16119 set try
16120 if eval $compile; then
16121         val="$define"
16122         echo "You have off64_t."
16123 else
16124         val="$undef"
16125         echo "You do not have off64_t."
16126         case "$lseeksize" in
16127         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16128         esac
16129 fi
16130 $rm_try
16131 set d_off64_t
16132 eval $setvar
16133
16134 : how to create joinable pthreads
16135 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16136         echo " "
16137         echo "Checking what constant to use for creating joinable pthreads..." >&4
16138         $cat >try.c <<'EOCP'
16139 #include <pthread.h>
16140 int main() {
16141     int detachstate = JOINABLE;
16142 }
16143 EOCP
16144         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16145         if eval $compile; then
16146                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16147                 val="$undef" # Yes, undef.
16148                 set d_old_pthread_create_joinable
16149                 eval $setvar
16150                 val=""
16151                 set old_pthread_create_joinable
16152                 eval $setvar
16153         else
16154                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16155                 if eval $compile; then
16156                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16157                         val="$define"
16158                         set d_old_pthread_create_joinable
16159                         eval $setvar
16160                         val=PTHREAD_CREATE_UNDETACHED
16161                         set old_pthread_create_joinable
16162                         eval $setvar
16163                 else
16164                         set try -DJOINABLE=__UNDETACHED
16165                         if eval $compile; then
16166                                 echo "You seem to use __UNDETACHED." >&4
16167                                 val="$define"
16168                                 set d_old_pthread_create_joinable
16169                                 eval $setvar
16170                                 val=__UNDETACHED
16171                                 set old_pthread_create_joinable
16172                                 eval $setvar
16173                         else
16174                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16175                                 val="$define"
16176                                 set d_old_pthread_create_joinable
16177                                 eval $setvar
16178                                 val=0
16179                                 set old_pthread_create_joinable
16180                                 eval $setvar
16181                         fi
16182                 fi
16183         fi
16184         $rm_try
16185 else
16186     d_old_pthread_create_joinable="$undef"
16187     old_pthread_create_joinable=""
16188 fi
16189
16190 : see if pause exists
16191 set pause d_pause
16192 eval $inlibc
16193
16194 : see if poll exists
16195 set poll d_poll
16196 eval $inlibc
16197
16198 : see if prctl exists
16199 set prctl d_prctl
16200 eval $inlibc
16201
16202 : see if prctl supports PR_SET_NAME
16203 d_prctl_set_name=$undef
16204 case $d_prctl in
16205     $define)
16206         $cat >try.c <<EOM
16207 #include <sys/prctl.h>
16208
16209 int main (int argc, char *argv[])
16210 {
16211     return (prctl (PR_SET_NAME, "Test"));
16212     } /* main */
16213 EOM
16214         set try
16215         if eval $compile_ok && $run ./try; then
16216             echo "Your prctl (PR_SET_NAME, ...) works"
16217             d_prctl_set_name=$define
16218             fi
16219         $rm_try
16220         ;;
16221     esac
16222
16223 : see if readlink exists
16224 set readlink d_readlink
16225 eval $inlibc
16226
16227 : Check if exe is symlink to abs path of executing program
16228 echo " "
16229 procselfexe=''
16230 val="$undef"
16231 case "$d_readlink" in
16232     "$define")
16233         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16234         : more tidy to avoid an extra level of symlink
16235         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16236         while test $# -gt 0; do
16237             type=$1; try=$2
16238             shift; shift
16239             if $issymlink $try; then
16240                 $ls -l $try > reflect
16241                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16242                     echo "You have $type-like $try."
16243                     procselfexe='"'$try'"'
16244                     val="$define"
16245                     : This will break out of the loop
16246                     set X; shift
16247                 fi
16248             fi
16249         done
16250         ;;
16251 esac
16252 $rm -f reflect
16253 set d_procselfexe
16254 eval $setvar
16255
16256 : backward compatibility for d_hvfork
16257 if test X$d_hvfork != X; then
16258         d_vfork="$d_hvfork"
16259         d_hvfork=''
16260 fi
16261 : see if there is a vfork
16262 val=''
16263 set vfork val
16264 eval $inlibc
16265
16266 d_pseudofork=$undef
16267
16268 : Ok, but do we want to use it. vfork is reportedly unreliable in
16269 : perl on Solaris 2.x, and probably elsewhere.
16270 case "$val" in
16271 $define)
16272         echo " "
16273         case "$usevfork" in
16274         false) dflt='n';;
16275         *) dflt='y';;
16276         esac
16277         cat <<'EOM'
16278
16279 Perl can only use a vfork() that doesn't suffer from strict
16280 restrictions on calling functions or modifying global data in
16281 the child.  For example, glibc-2.1 contains such a vfork()
16282 that is unsuitable.  If your system provides a proper fork()
16283 call, chances are that you do NOT want perl to use vfork().
16284
16285 EOM
16286         rp="Do you still want to use vfork()?"
16287         . ./myread
16288         case "$ans" in
16289         y|Y) ;;
16290         *)
16291                 echo "Ok, we won't use vfork()."
16292                 val="$undef"
16293                 ;;
16294         esac
16295         ;;
16296 esac
16297 set d_vfork
16298 eval $setvar
16299 case "$d_vfork" in
16300 $define) usevfork='true';;
16301 *) usevfork='false';;
16302 esac
16303
16304 : see whether the pthread_atfork exists
16305 $cat >try.c <<EOP
16306 #include <pthread.h>
16307 #include <stdio.h>
16308 int main() {
16309 #ifdef  PTHREAD_ATFORK
16310         pthread_atfork(NULL,NULL,NULL);
16311 #endif
16312 }
16313 EOP
16314
16315 : see if pthread_atfork exists
16316 set try -DPTHREAD_ATFORK
16317 if eval $compile; then
16318     val="$define"
16319 else
16320     val="$undef"
16321 fi
16322 case "$usethreads" in
16323 $define)
16324         case "$val" in
16325         $define) echo 'pthread_atfork found.' >&4        ;;
16326         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16327         esac
16328 esac
16329 set d_pthread_atfork
16330 eval $setvar
16331
16332 : see if pthread_attr_setscope exists
16333 set pthread_attr_setscope d_pthread_attr_setscope
16334 eval $inlibc
16335
16336 : see whether the various POSIXish _yields exist
16337 $cat >try.c <<EOP
16338 #include <pthread.h>
16339 #include <stdio.h>
16340 int main() {
16341 #ifdef SCHED_YIELD
16342         sched_yield();
16343 #else
16344 #ifdef PTHREAD_YIELD
16345         pthread_yield();
16346 #else
16347 #ifdef PTHREAD_YIELD_NULL
16348         pthread_yield(NULL);
16349 #endif
16350 #endif
16351 #endif
16352 }
16353 EOP
16354 : see if sched_yield exists
16355 set try -DSCHED_YIELD
16356 if eval $compile; then
16357     val="$define"
16358     sched_yield='sched_yield()'
16359 else
16360     val="$undef"
16361 fi
16362 case "$usethreads" in
16363 $define)
16364         case "$val" in
16365         $define) echo 'sched_yield() found.' >&4        ;;
16366         *)       echo 'sched_yield() NOT found.' >&4    ;;
16367         esac
16368 esac
16369 set d_sched_yield
16370 eval $setvar
16371
16372 : see if pthread_yield exists
16373 set try -DPTHREAD_YIELD
16374 if eval $compile; then
16375     val="$define"
16376     case "$sched_yield" in
16377     '') sched_yield='pthread_yield()' ;;
16378     esac
16379 else
16380     set try -DPTHREAD_YIELD_NULL
16381     if eval $compile; then
16382         val="$define"
16383         case "$sched_yield" in
16384         '') sched_yield='pthread_yield(NULL)' ;;
16385         esac
16386     else
16387         val="$undef"
16388     fi
16389 fi
16390 case "$usethreads" in
16391 $define)
16392         case "$val" in
16393         $define) echo 'pthread_yield() found.' >&4      ;;
16394         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16395         esac
16396         ;;
16397 esac
16398 set d_pthread_yield
16399 eval $setvar
16400 case "$sched_yield" in
16401 '') sched_yield=undef ;;
16402 esac
16403 $rm_try
16404
16405 : see if random_r exists
16406 set random_r d_random_r
16407 eval $inlibc
16408 case "$d_random_r" in
16409 "$define")
16410         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16411         case "$d_random_r_proto:$usethreads" in
16412         ":define")      d_random_r_proto=define
16413                 set d_random_r_proto random_r $hdrs
16414                 eval $hasproto ;;
16415         *)      ;;
16416         esac
16417         case "$d_random_r_proto" in
16418         define)
16419         case "$random_r_proto" in
16420         ''|0) try='int random_r(int*, struct random_data*);'
16421         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16422         esac
16423         case "$random_r_proto" in
16424         ''|0) try='int random_r(long*, struct random_data*);'
16425         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16426         esac
16427         case "$random_r_proto" in
16428         ''|0) try='int random_r(struct random_data*, int32_t*);'
16429         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16430         esac
16431         case "$random_r_proto" in
16432         ''|0)   d_random_r=undef
16433                 random_r_proto=0
16434                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16435         * )     case "$random_r_proto" in
16436                 REENTRANT_PROTO*) ;;
16437                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16438                 esac
16439                 echo "Prototype: $try" ;;
16440         esac
16441         ;;
16442         *)      case "$usethreads" in
16443                 define) echo "random_r has no prototype, not using it." >&4 ;;
16444                 esac
16445                 d_random_r=undef
16446                 random_r_proto=0
16447                 ;;
16448         esac
16449         ;;
16450 *)      random_r_proto=0
16451         ;;
16452 esac
16453
16454 : see if readdir and friends exist
16455 set readdir d_readdir
16456 eval $inlibc
16457 set seekdir d_seekdir
16458 eval $inlibc
16459 set telldir d_telldir
16460 eval $inlibc
16461 set rewinddir d_rewinddir
16462 eval $inlibc
16463
16464 : see if readdir64_r exists
16465 set readdir64_r d_readdir64_r
16466 eval $inlibc
16467 case "$d_readdir64_r" in
16468 "$define")
16469         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16470         case "$d_readdir64_r_proto:$usethreads" in
16471         ":define")      d_readdir64_r_proto=define
16472                 set d_readdir64_r_proto readdir64_r $hdrs
16473                 eval $hasproto ;;
16474         *)      ;;
16475         esac
16476         case "$d_readdir64_r_proto" in
16477         define)
16478         case "$readdir64_r_proto" in
16479         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16480         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16481         esac
16482         case "$readdir64_r_proto" in
16483         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16484         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16485         esac
16486         case "$readdir64_r_proto" in
16487         ''|0)   d_readdir64_r=undef
16488                 readdir64_r_proto=0
16489                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16490         * )     case "$readdir64_r_proto" in
16491                 REENTRANT_PROTO*) ;;
16492                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16493                 esac
16494                 echo "Prototype: $try" ;;
16495         esac
16496         ;;
16497         *)      case "$usethreads" in
16498                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16499                 esac
16500                 d_readdir64_r=undef
16501                 readdir64_r_proto=0
16502                 ;;
16503         esac
16504         ;;
16505 *)      readdir64_r_proto=0
16506         ;;
16507 esac
16508
16509 : see if readdir_r exists
16510 set readdir_r d_readdir_r
16511 eval $inlibc
16512 case "$d_readdir_r" in
16513 "$define")
16514         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16515         case "$d_readdir_r_proto:$usethreads" in
16516         ":define")      d_readdir_r_proto=define
16517                 set d_readdir_r_proto readdir_r $hdrs
16518                 eval $hasproto ;;
16519         *)      ;;
16520         esac
16521         case "$d_readdir_r_proto" in
16522         define)
16523         case "$readdir_r_proto" in
16524         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16525         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16526         esac
16527         case "$readdir_r_proto" in
16528         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16529         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16530         esac
16531         case "$readdir_r_proto" in
16532         ''|0)   d_readdir_r=undef
16533                 readdir_r_proto=0
16534                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16535         * )     case "$readdir_r_proto" in
16536                 REENTRANT_PROTO*) ;;
16537                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16538                 esac
16539                 echo "Prototype: $try" ;;
16540         esac
16541         ;;
16542         *)      case "$usethreads" in
16543                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16544                 esac
16545                 d_readdir_r=undef
16546                 readdir_r_proto=0
16547                 ;;
16548         esac
16549         ;;
16550 *)      readdir_r_proto=0
16551         ;;
16552 esac
16553
16554 : see if readv exists
16555 set readv d_readv
16556 eval $inlibc
16557
16558 : see if recvmsg exists
16559 set recvmsg d_recvmsg
16560 eval $inlibc
16561
16562 : see if rename exists
16563 set rename d_rename
16564 eval $inlibc
16565
16566 : see if rmdir exists
16567 set rmdir d_rmdir
16568 eval $inlibc
16569
16570 : see if memory.h is available.
16571 val=''
16572 set memory.h val
16573 eval $inhdr
16574
16575 : See if it conflicts with string.h
16576 case "$val" in
16577 $define)
16578         case "$strings" in
16579         '') ;;
16580         *)
16581                 $cppstdin $cppflags $cppminus < $strings > mem.h
16582                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16583                         echo " "
16584                         echo "We won't be including <memory.h>."
16585                         val="$undef"
16586                 fi
16587                 $rm -f mem.h
16588                 ;;
16589         esac
16590 esac
16591 set i_memory
16592 eval $setvar
16593
16594 : can bcopy handle overlapping blocks?
16595 echo " "
16596 val="$undef"
16597 case "$d_memmove" in
16598 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16599 *)      case "$d_bcopy" in
16600         "$define")
16601                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16602                 $cat >try.c <<EOCP
16603 #$i_memory I_MEMORY
16604 #$i_stdlib I_STDLIB
16605 #$i_string I_STRING
16606 #$i_unistd I_UNISTD
16607 EOCP
16608         $cat >>try.c <<'EOCP'
16609 #include <stdio.h>
16610 #ifdef I_MEMORY
16611 #  include <memory.h>
16612 #endif
16613 #ifdef I_STDLIB
16614 #  include <stdlib.h>
16615 #endif
16616 #ifdef I_STRING
16617 #  include <string.h>
16618 #else
16619 #  include <strings.h>
16620 #endif
16621 #ifdef I_UNISTD
16622 #  include <unistd.h>  /* Needed for NetBSD */
16623 #endif
16624 int main()
16625 {
16626 char buf[128], abc[128];
16627 char *b;
16628 int len;
16629 int off;
16630 int align;
16631
16632 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16633    try to store the string in read-only memory. */
16634 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16635
16636 for (align = 7; align >= 0; align--) {
16637         for (len = 36; len; len--) {
16638                 b = buf+align;
16639                 bcopy(abc, b, len);
16640                 for (off = 1; off <= len; off++) {
16641                         bcopy(b, b+off, len);
16642                         bcopy(b+off, b, len);
16643                         if (bcmp(b, abc, len))
16644                                 exit(1);
16645                 }
16646         }
16647 }
16648 exit(0);
16649 }
16650 EOCP
16651                 set try
16652                 if eval $compile_ok; then
16653                         if $run ./try 2>/dev/null; then
16654                                 echo "Yes, it can."
16655                                 val="$define"
16656                         else
16657                                 echo "It can't, sorry."
16658                         fi
16659                 else
16660                         echo "(I can't compile the test program, so we'll assume not...)"
16661                 fi
16662                 ;;
16663         esac
16664         $rm_try
16665         ;;
16666 esac
16667 set d_safebcpy
16668 eval $setvar
16669
16670 : can memcpy handle overlapping blocks?
16671 echo " "
16672 val="$undef"
16673 case "$d_memmove" in
16674 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16675 *)      case "$d_memcpy" in
16676         "$define")
16677                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16678                 $cat >try.c <<EOCP
16679 #$i_memory I_MEMORY
16680 #$i_stdlib I_STDLIB
16681 #$i_string I_STRING
16682 #$i_unistd I_UNISTD
16683 EOCP
16684         $cat >>try.c <<'EOCP'
16685 #include <stdio.h>
16686 #ifdef I_MEMORY
16687 #  include <memory.h>
16688 #endif
16689 #ifdef I_STDLIB
16690 #  include <stdlib.h>
16691 #endif
16692 #ifdef I_STRING
16693 #  include <string.h>
16694 #else
16695 #  include <strings.h>
16696 #endif
16697 #ifdef I_UNISTD
16698 #  include <unistd.h>  /* Needed for NetBSD */
16699 #endif
16700 int main()
16701 {
16702 char buf[128], abc[128];
16703 char *b;
16704 int len;
16705 int off;
16706 int align;
16707
16708 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16709    try to store the string in read-only memory. */
16710 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16711
16712 for (align = 7; align >= 0; align--) {
16713         for (len = 36; len; len--) {
16714                 b = buf+align;
16715                 memcpy(b, abc, len);
16716                 for (off = 1; off <= len; off++) {
16717                         memcpy(b+off, b, len);
16718                         memcpy(b, b+off, len);
16719                         if (memcmp(b, abc, len))
16720                                 exit(1);
16721                 }
16722         }
16723 }
16724 exit(0);
16725 }
16726 EOCP
16727                 set try
16728                 if eval $compile_ok; then
16729                         if $run ./try 2>/dev/null; then
16730                                 echo "Yes, it can."
16731                                 val="$define"
16732                         else
16733                                 echo "It can't, sorry."
16734                         fi
16735                 else
16736                         echo "(I can't compile the test program, so we'll assume not...)"
16737                 fi
16738                 ;;
16739         esac
16740         $rm_try
16741         ;;
16742 esac
16743 set d_safemcpy
16744 eval $setvar
16745
16746 : can memcmp be trusted to compare relative magnitude?
16747 val="$undef"
16748 case "$d_memcmp" in
16749 "$define")
16750         echo " "
16751         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16752         $cat >try.c <<EOCP
16753 #$i_memory I_MEMORY
16754 #$i_stdlib I_STDLIB
16755 #$i_string I_STRING
16756 #$i_unistd I_UNISTD
16757 EOCP
16758         $cat >>try.c <<'EOCP'
16759 #include <stdio.h>
16760 #ifdef I_MEMORY
16761 #  include <memory.h>
16762 #endif
16763 #ifdef I_STDLIB
16764 #  include <stdlib.h>
16765 #endif
16766 #ifdef I_STRING
16767 #  include <string.h>
16768 #else
16769 #  include <strings.h>
16770 #endif
16771 #ifdef I_UNISTD
16772 #  include <unistd.h>  /* Needed for NetBSD */
16773 #endif
16774 int main()
16775 {
16776 char a = -1;
16777 char b = 0;
16778 if ((a < b) && memcmp(&a, &b, 1) < 0)
16779         exit(1);
16780 exit(0);
16781 }
16782 EOCP
16783         set try
16784         if eval $compile_ok; then
16785                 if $run ./try 2>/dev/null; then
16786                         echo "Yes, it can."
16787                         val="$define"
16788                 else
16789                         echo "No, it can't (it uses signed chars)."
16790                 fi
16791         else
16792                 echo "(I can't compile the test program, so we'll assume not...)"
16793         fi
16794         ;;
16795 esac
16796 $rm_try
16797 set d_sanemcmp
16798 eval $setvar
16799
16800 : see if prototype for sbrk is available
16801 echo " "
16802 set d_sbrkproto sbrk $i_unistd unistd.h
16803 eval $hasproto
16804
16805 : see if select exists
16806 set select d_select
16807 eval $inlibc
16808
16809 : see if semctl exists
16810 set semctl d_semctl
16811 eval $inlibc
16812
16813 : see if semget exists
16814 set semget d_semget
16815 eval $inlibc
16816
16817 : see if semop exists
16818 set semop d_semop
16819 eval $inlibc
16820
16821 : see how much of the 'sem*(2)' library is present.
16822 h_sem=true
16823 echo " "
16824 case "$d_semctl$d_semget$d_semop" in
16825 *"$undef"*) h_sem=false;;
16826 esac
16827 case "$osname" in
16828 freebsd)
16829     case "`ipcs 2>&1`" in
16830     "SVID messages"*"not configured"*)
16831         echo "Your $osname does not have the sem*(2) configured." >&4
16832         h_sem=false
16833         val="$undef"
16834         set semctl d_semctl
16835         eval $setvar
16836         set semget d_semget
16837         eval $setvar
16838         set semop d_semop
16839         eval $setvar
16840         ;;
16841     esac
16842     ;;
16843 esac
16844 : we could also check for sys/ipc.h ...
16845 if $h_sem && $test `./findhdr sys/sem.h`; then
16846         echo "You have the full sem*(2) library." >&4
16847         val="$define"
16848 else
16849         echo "You don't have the full sem*(2) library." >&4
16850         val="$undef"
16851 fi
16852 set d_sem
16853 eval $setvar
16854
16855 : see whether sys/sem.h defines union semun
16856 echo " "
16857 $cat > try.c <<'END'
16858 #include <sys/types.h>
16859 #include <sys/ipc.h>
16860 #include <sys/sem.h>
16861 int main () { union semun semun; semun.buf = 0; }
16862 END
16863 set try
16864 if eval $compile; then
16865     echo "You have union semun in <sys/sem.h>." >&4
16866     val="$define"
16867 else
16868     echo "You do not have union semun in <sys/sem.h>." >&4
16869     val="$undef"
16870 fi
16871 $rm_try
16872 set d_union_semun
16873 eval $setvar
16874
16875 : see how to do semctl IPC_STAT
16876 case "$d_sem" in
16877 $define)
16878     echo " "
16879     $cat > tryh.h <<END
16880 #ifndef S_IRUSR
16881 #   ifdef S_IREAD
16882 #       define S_IRUSR S_IREAD
16883 #       define S_IWUSR S_IWRITE
16884 #       define S_IXUSR S_IEXEC
16885 #   else
16886 #       define S_IRUSR 0400
16887 #       define S_IWUSR 0200
16888 #       define S_IXUSR 0100
16889 #   endif
16890 #   define S_IRGRP (S_IRUSR>>3)
16891 #   define S_IWGRP (S_IWUSR>>3)
16892 #   define S_IXGRP (S_IXUSR>>3)
16893 #   define S_IROTH (S_IRUSR>>6)
16894 #   define S_IWOTH (S_IWUSR>>6)
16895 #   define S_IXOTH (S_IXUSR>>6)
16896 #endif
16897 #ifndef S_IRWXU
16898 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16899 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16900 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16901 #endif
16902 END
16903     : see whether semctl IPC_STAT can use union semun
16904     case "$d_semctl_semun" in
16905     '')
16906       val="$undef"
16907       $cat > try.c <<END
16908 #include <sys/types.h>
16909 #include <sys/ipc.h>
16910 #include <sys/sem.h>
16911 #include <sys/stat.h>
16912 #include <stdio.h>
16913 #include <errno.h>
16914 #include "tryh.h"
16915 #ifndef errno
16916 extern int errno;
16917 #endif
16918 #$d_union_semun HAS_UNION_SEMUN
16919 int main() {
16920     union semun
16921 #ifndef HAS_UNION_SEMUN
16922     {
16923         int val;
16924         struct semid_ds *buf;
16925         unsigned short *array;
16926     }
16927 #endif
16928     arg;
16929     int sem, st;
16930
16931 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16932     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16933     if (sem > -1) {
16934         struct semid_ds argbuf;
16935         arg.buf = &argbuf;
16936 #       ifdef IPC_STAT
16937         st = semctl(sem, 0, IPC_STAT, arg);
16938         if (st == 0)
16939             printf("semun\n");
16940         else
16941 #       endif /* IPC_STAT */
16942             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16943 #       ifdef IPC_RMID
16944         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16945 #       endif /* IPC_RMID */
16946             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16947     } else
16948 #endif /* IPC_PRIVATE && ... */
16949         printf("semget failed: errno = %d\n", errno);
16950   return 0;
16951 }
16952 END
16953       set try
16954       if eval $compile; then
16955           xxx=`$run ./try`
16956           case "$xxx" in
16957           semun) val="$define" ;;
16958           esac
16959       fi
16960       $rm_try
16961       set d_semctl_semun
16962       eval $setvar
16963       ;;
16964     esac
16965     case "$d_semctl_semun" in
16966     $define)
16967         echo "You can use union semun for semctl IPC_STAT." >&4
16968         also='also'
16969         ;;
16970     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16971         also=''
16972         ;;
16973     esac
16974
16975     : see whether semctl IPC_STAT can use struct semid_ds pointer
16976     case "$d_semctl_semid_ds" in
16977     '')
16978       val="$undef"
16979       $cat > try.c <<'END'
16980 #include <sys/types.h>
16981 #include <sys/ipc.h>
16982 #include <sys/sem.h>
16983 #include <sys/stat.h>
16984 #include "tryh.h"
16985 #include <stdio.h>
16986 #include <errno.h>
16987 #ifndef errno
16988 extern int errno;
16989 #endif
16990 int main() {
16991     struct semid_ds arg;
16992     int sem, st;
16993
16994 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16995     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16996     if (sem > -1) {
16997 #       ifdef IPC_STAT
16998         st = semctl(sem, 0, IPC_STAT, &arg);
16999         if (st == 0)
17000             printf("semid_ds\n");
17001         else
17002 #       endif /* IPC_STAT */
17003             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17004 #       ifdef IPC_RMID
17005         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17006 #       endif /* IPC_RMID */
17007             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17008     } else
17009 #endif /* IPC_PRIVATE && ... */
17010         printf("semget failed: errno = %d\n", errno);
17011
17012     return 0;
17013 }
17014 END
17015       set try
17016       if eval $compile; then
17017           xxx=`$run ./try`
17018           case "$xxx" in
17019           semid_ds) val="$define" ;;
17020           esac
17021       fi
17022       $rm_try
17023       set d_semctl_semid_ds
17024       eval $setvar
17025       ;;
17026     esac
17027     case "$d_semctl_semid_ds" in
17028     $define)
17029         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17030         ;;
17031     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17032         ;;
17033     esac
17034     ;;
17035 *)  val="$undef"
17036
17037     # We do not have the full sem*(2) library, so assume we can not
17038     # use either.
17039
17040     set d_semctl_semun
17041     eval $setvar
17042
17043     set d_semctl_semid_ds
17044     eval $setvar
17045     ;;
17046 esac
17047 $rm_try tryh.h
17048
17049 : see if sendmsg exists
17050 set sendmsg d_sendmsg
17051 eval $inlibc
17052
17053 : see if setegid exists
17054 set setegid d_setegid
17055 eval $inlibc
17056
17057 : see if seteuid exists
17058 set seteuid d_seteuid
17059 eval $inlibc
17060
17061 : see if setgrent exists
17062 set setgrent d_setgrent
17063 eval $inlibc
17064
17065 : see if setgrent_r exists
17066 set setgrent_r d_setgrent_r
17067 eval $inlibc
17068 case "$d_setgrent_r" in
17069 "$define")
17070         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17071         case "$d_setgrent_r_proto:$usethreads" in
17072         ":define")      d_setgrent_r_proto=define
17073                 set d_setgrent_r_proto setgrent_r $hdrs
17074                 eval $hasproto ;;
17075         *)      ;;
17076         esac
17077         case "$d_setgrent_r_proto" in
17078         define)
17079         case "$setgrent_r_proto" in
17080         ''|0) try='int setgrent_r(FILE**);'
17081         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17082         esac
17083         case "$setgrent_r_proto" in
17084         ''|0) try='void setgrent_r(FILE**);'
17085         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17086         esac
17087         case "$setgrent_r_proto" in
17088         ''|0)   d_setgrent_r=undef
17089                 setgrent_r_proto=0
17090                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17091         * )     case "$setgrent_r_proto" in
17092                 REENTRANT_PROTO*) ;;
17093                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17094                 esac
17095                 echo "Prototype: $try" ;;
17096         esac
17097         ;;
17098         *)      case "$usethreads" in
17099                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17100                 esac
17101                 d_setgrent_r=undef
17102                 setgrent_r_proto=0
17103                 ;;
17104         esac
17105         ;;
17106 *)      setgrent_r_proto=0
17107         ;;
17108 esac
17109
17110 : see if sethostent exists
17111 set sethostent d_sethent
17112 eval $inlibc
17113
17114 : see if sethostent_r exists
17115 set sethostent_r d_sethostent_r
17116 eval $inlibc
17117 case "$d_sethostent_r" in
17118 "$define")
17119         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17120         case "$d_sethostent_r_proto:$usethreads" in
17121         ":define")      d_sethostent_r_proto=define
17122                 set d_sethostent_r_proto sethostent_r $hdrs
17123                 eval $hasproto ;;
17124         *)      ;;
17125         esac
17126         case "$d_sethostent_r_proto" in
17127         define)
17128         case "$sethostent_r_proto" in
17129         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17130         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17131         esac
17132         case "$sethostent_r_proto" in
17133         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17134         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17135         esac
17136         case "$sethostent_r_proto" in
17137         ''|0)   d_sethostent_r=undef
17138                 sethostent_r_proto=0
17139                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17140         * )     case "$sethostent_r_proto" in
17141                 REENTRANT_PROTO*) ;;
17142                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17143                 esac
17144                 echo "Prototype: $try" ;;
17145         esac
17146         ;;
17147         *)      case "$usethreads" in
17148                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17149                 esac
17150                 d_sethostent_r=undef
17151                 sethostent_r_proto=0
17152                 ;;
17153         esac
17154         ;;
17155 *)      sethostent_r_proto=0
17156         ;;
17157 esac
17158
17159 : see if setitimer exists
17160 set setitimer d_setitimer
17161 eval $inlibc
17162
17163 : see if setlinebuf exists
17164 set setlinebuf d_setlinebuf
17165 eval $inlibc
17166
17167 : see if setlocale exists
17168 set setlocale d_setlocale
17169 eval $inlibc
17170
17171 : see if locale.h is available
17172 set locale.h i_locale
17173 eval $inhdr
17174
17175 : see if setlocale_r exists
17176 set setlocale_r d_setlocale_r
17177 eval $inlibc
17178 case "$d_setlocale_r" in
17179 "$define")
17180         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17181         case "$d_setlocale_r_proto:$usethreads" in
17182         ":define")      d_setlocale_r_proto=define
17183                 set d_setlocale_r_proto setlocale_r $hdrs
17184                 eval $hasproto ;;
17185         *)      ;;
17186         esac
17187         case "$d_setlocale_r_proto" in
17188         define)
17189         case "$setlocale_r_proto" in
17190         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17191         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17192         esac
17193         case "$setlocale_r_proto" in
17194         ''|0)   d_setlocale_r=undef
17195                 setlocale_r_proto=0
17196                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17197         * )     case "$setlocale_r_proto" in
17198                 REENTRANT_PROTO*) ;;
17199                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17200                 esac
17201                 echo "Prototype: $try" ;;
17202         esac
17203         ;;
17204         *)      case "$usethreads" in
17205                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17206                 esac
17207                 d_setlocale_r=undef
17208                 setlocale_r_proto=0
17209                 ;;
17210         esac
17211         ;;
17212 *)      setlocale_r_proto=0
17213         ;;
17214 esac
17215
17216 : see if setnetent exists
17217 set setnetent d_setnent
17218 eval $inlibc
17219
17220 : see if setnetent_r exists
17221 set setnetent_r d_setnetent_r
17222 eval $inlibc
17223 case "$d_setnetent_r" in
17224 "$define")
17225         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17226         case "$d_setnetent_r_proto:$usethreads" in
17227         ":define")      d_setnetent_r_proto=define
17228                 set d_setnetent_r_proto setnetent_r $hdrs
17229                 eval $hasproto ;;
17230         *)      ;;
17231         esac
17232         case "$d_setnetent_r_proto" in
17233         define)
17234         case "$setnetent_r_proto" in
17235         ''|0) try='int setnetent_r(int, struct netent_data*);'
17236         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17237         esac
17238         case "$setnetent_r_proto" in
17239         ''|0) try='void setnetent_r(int, struct netent_data*);'
17240         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17241         esac
17242         case "$setnetent_r_proto" in
17243         ''|0)   d_setnetent_r=undef
17244                 setnetent_r_proto=0
17245                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17246         * )     case "$setnetent_r_proto" in
17247                 REENTRANT_PROTO*) ;;
17248                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17249                 esac
17250                 echo "Prototype: $try" ;;
17251         esac
17252         ;;
17253         *)      case "$usethreads" in
17254                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17255                 esac
17256                 d_setnetent_r=undef
17257                 setnetent_r_proto=0
17258                 ;;
17259         esac
17260         ;;
17261 *)      setnetent_r_proto=0
17262         ;;
17263 esac
17264
17265 : see if setprotoent exists
17266 set setprotoent d_setpent
17267 eval $inlibc
17268
17269 : see if setpgid exists
17270 set setpgid d_setpgid
17271 eval $inlibc
17272
17273 : see if setpgrp2 exists
17274 set setpgrp2 d_setpgrp2
17275 eval $inlibc
17276
17277 : see if setpriority exists
17278 set setpriority d_setprior
17279 eval $inlibc
17280
17281 : see if setproctitle exists
17282 set setproctitle d_setproctitle
17283 eval $inlibc
17284
17285 : see if setprotoent_r exists
17286 set setprotoent_r d_setprotoent_r
17287 eval $inlibc
17288 case "$d_setprotoent_r" in
17289 "$define")
17290         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17291         case "$d_setprotoent_r_proto:$usethreads" in
17292         ":define")      d_setprotoent_r_proto=define
17293                 set d_setprotoent_r_proto setprotoent_r $hdrs
17294                 eval $hasproto ;;
17295         *)      ;;
17296         esac
17297         case "$d_setprotoent_r_proto" in
17298         define)
17299         case "$setprotoent_r_proto" in
17300         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17301         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17302         esac
17303         case "$setprotoent_r_proto" in
17304         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17305         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17306         esac
17307         case "$setprotoent_r_proto" in
17308         ''|0)   d_setprotoent_r=undef
17309                 setprotoent_r_proto=0
17310                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17311         * )     case "$setprotoent_r_proto" in
17312                 REENTRANT_PROTO*) ;;
17313                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17314                 esac
17315                 echo "Prototype: $try" ;;
17316         esac
17317         ;;
17318         *)      case "$usethreads" in
17319                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17320                 esac
17321                 d_setprotoent_r=undef
17322                 setprotoent_r_proto=0
17323                 ;;
17324         esac
17325         ;;
17326 *)      setprotoent_r_proto=0
17327         ;;
17328 esac
17329
17330 : see if setpwent exists
17331 set setpwent d_setpwent
17332 eval $inlibc
17333
17334 : see if setpwent_r exists
17335 set setpwent_r d_setpwent_r
17336 eval $inlibc
17337 case "$d_setpwent_r" in
17338 "$define")
17339         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17340         case "$d_setpwent_r_proto:$usethreads" in
17341         ":define")      d_setpwent_r_proto=define
17342                 set d_setpwent_r_proto setpwent_r $hdrs
17343                 eval $hasproto ;;
17344         *)      ;;
17345         esac
17346         case "$d_setpwent_r_proto" in
17347         define)
17348         case "$setpwent_r_proto" in
17349         ''|0) try='int setpwent_r(FILE**);'
17350         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17351         esac
17352         case "$setpwent_r_proto" in
17353         ''|0) try='void setpwent_r(FILE**);'
17354         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17355         esac
17356         case "$setpwent_r_proto" in
17357         ''|0)   d_setpwent_r=undef
17358                 setpwent_r_proto=0
17359                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17360         * )     case "$setpwent_r_proto" in
17361                 REENTRANT_PROTO*) ;;
17362                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17363                 esac
17364                 echo "Prototype: $try" ;;
17365         esac
17366         ;;
17367         *)      case "$usethreads" in
17368                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17369                 esac
17370                 d_setpwent_r=undef
17371                 setpwent_r_proto=0
17372                 ;;
17373         esac
17374         ;;
17375 *)      setpwent_r_proto=0
17376         ;;
17377 esac
17378
17379 : see if setregid exists
17380 set setregid d_setregid
17381 eval $inlibc
17382 set setresgid d_setresgid
17383 eval $inlibc
17384
17385 : see if setreuid exists
17386 set setreuid d_setreuid
17387 eval $inlibc
17388 set setresuid d_setresuid
17389 eval $inlibc
17390
17391 : see if setrgid exists
17392 set setrgid d_setrgid
17393 eval $inlibc
17394
17395 : see if setruid exists
17396 set setruid d_setruid
17397 eval $inlibc
17398
17399 : see if setservent exists
17400 set setservent d_setsent
17401 eval $inlibc
17402
17403 : see if setservent_r exists
17404 set setservent_r d_setservent_r
17405 eval $inlibc
17406 case "$d_setservent_r" in
17407 "$define")
17408         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17409         case "$d_setservent_r_proto:$usethreads" in
17410         ":define")      d_setservent_r_proto=define
17411                 set d_setservent_r_proto setservent_r $hdrs
17412                 eval $hasproto ;;
17413         *)      ;;
17414         esac
17415         case "$d_setservent_r_proto" in
17416         define)
17417         case "$setservent_r_proto" in
17418         ''|0) try='int setservent_r(int, struct servent_data*);'
17419         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17420         esac
17421         case "$setservent_r_proto" in
17422         ''|0) try='void setservent_r(int, struct servent_data*);'
17423         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17424         esac
17425         case "$setservent_r_proto" in
17426         ''|0)   d_setservent_r=undef
17427                 setservent_r_proto=0
17428                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17429         * )     case "$setservent_r_proto" in
17430                 REENTRANT_PROTO*) ;;
17431                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17432                 esac
17433                 echo "Prototype: $try" ;;
17434         esac
17435         ;;
17436         *)      case "$usethreads" in
17437                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17438                 esac
17439                 d_setservent_r=undef
17440                 setservent_r_proto=0
17441                 ;;
17442         esac
17443         ;;
17444 *)      setservent_r_proto=0
17445         ;;
17446 esac
17447
17448 : see if setsid exists
17449 set setsid d_setsid
17450 eval $inlibc
17451
17452 : see if setvbuf exists
17453 set setvbuf d_setvbuf
17454 eval $inlibc
17455
17456 : see if sfio.h is available
17457 set sfio.h i_sfio
17458 eval $inhdr
17459
17460 : see if sfio library is available
17461 case "$i_sfio" in
17462 $define)
17463         val=''
17464         set sfreserve val
17465         eval $inlibc
17466         ;;
17467 *)
17468         val="$undef"
17469         ;;
17470 esac
17471 : Ok, but do we want to use it.
17472 case "$val" in
17473 $define)
17474         case "$usesfio" in
17475         true|$define|[yY]*) dflt='y';;
17476         *) dflt='n';;
17477         esac
17478         echo "$package can use the sfio library, but it is experimental."
17479         rp="You seem to have sfio available, do you want to try using it?"
17480         . ./myread
17481         case "$ans" in
17482         y|Y)    echo "Ok, turning on sfio then."
17483                 val="$define"
17484                 ;;
17485         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17486                 val="$undef"
17487                 ;;
17488         esac
17489         ;;
17490 *)      case "$usesfio" in
17491         true|$define|[yY]*)
17492                 echo "Sorry, cannot find sfio on this machine." >&4
17493                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17494                 val="$undef"
17495                 ;;
17496         esac
17497         ;;
17498 esac
17499 set d_sfio
17500 eval $setvar
17501 case "$d_sfio" in
17502 $define) usesfio='true';;
17503 *) usesfio='false';;
17504 esac
17505 case "$d_sfio" in
17506 $define) ;;
17507 *)      : Remove sfio from list of libraries to use
17508         case "$libs" in
17509         *-lsfio*)
17510                 echo "Removing unneeded -lsfio from library list" >&4
17511                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17512                 shift
17513                 libs="$*"
17514                 echo "libs = $libs" >&4
17515                 ;;
17516         esac
17517 ;;
17518 esac
17519
17520
17521 : see if shmctl exists
17522 set shmctl d_shmctl
17523 eval $inlibc
17524
17525 : see if shmget exists
17526 set shmget d_shmget
17527 eval $inlibc
17528
17529 : see if shmat exists
17530 set shmat d_shmat
17531 eval $inlibc
17532 : see what shmat returns
17533 case "$d_shmat" in
17534 "$define")
17535         $cat >shmat.c <<'END'
17536 #include <sys/shm.h>
17537 void *shmat();
17538 END
17539         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17540                 shmattype='void *'
17541         else
17542                 shmattype='char *'
17543         fi
17544         echo "and it returns ($shmattype)." >&4
17545         : see if a prototype for shmat is available
17546         xxx=`./findhdr sys/shm.h`
17547         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17548         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17549                 val="$define"
17550         else
17551                 val="$undef"
17552         fi
17553         $rm -f shmat.[co]
17554         ;;
17555 *)
17556         val="$undef"
17557         ;;
17558 esac
17559 set d_shmatprototype
17560 eval $setvar
17561
17562 : see if shmdt exists
17563 set shmdt d_shmdt
17564 eval $inlibc
17565
17566 : see how much of the 'shm*(2)' library is present.
17567 h_shm=true
17568 echo " "
17569 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17570 *"$undef"*) h_shm=false;;
17571 esac
17572 case "$osname" in
17573 freebsd)
17574     case "`ipcs 2>&1`" in
17575     "SVID shared memory"*"not configured"*)
17576         echo "Your $osname does not have the shm*(2) configured." >&4
17577         h_shm=false
17578         val="$undef"
17579         set shmctl d_shmctl
17580         evat $setvar
17581         set shmget d_shmget
17582         evat $setvar
17583         set shmat d_shmat
17584         evat $setvar
17585         set shmdt d_shmdt
17586         evat $setvar
17587         ;;
17588     esac
17589     ;;
17590 esac
17591 : we could also check for sys/ipc.h ...
17592 if $h_shm && $test `./findhdr sys/shm.h`; then
17593         echo "You have the full shm*(2) library." >&4
17594         val="$define"
17595 else
17596         echo "You don't have the full shm*(2) library." >&4
17597         val="$undef"
17598 fi
17599 set d_shm
17600 eval $setvar
17601
17602 : see if we have sigaction
17603 echo " "
17604 if set sigaction val -f d_sigaction; eval $csym; $val; then
17605         echo 'sigaction() found.' >&4
17606         $cat > try.c <<EOP
17607 #include <stdio.h>
17608 #include <sys/types.h>
17609 #include <signal.h>
17610 #$i_stdlib I_STDLIB
17611 #ifdef I_STDLIB
17612 #include <stdlib.h>
17613 #endif
17614 int main()
17615 {
17616     struct sigaction act, oact;
17617     act.sa_flags = 0;
17618     oact.sa_handler = 0;
17619     /* so that act and oact are used */
17620     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17621 }
17622 EOP
17623         set try
17624         if eval $compile_ok; then
17625                 val="$define"
17626         else
17627                 echo "But you don't seem to have a useable struct sigaction." >&4
17628                 val="$undef"
17629         fi
17630 else
17631         echo 'sigaction NOT found.' >&4
17632         val="$undef"
17633 fi
17634 set d_sigaction; eval $setvar
17635 $rm_try
17636
17637 : see if this is a sunmath.h system
17638 set sunmath.h i_sunmath
17639 eval $inhdr
17640
17641 : see if signbit exists
17642 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17643 $cat >try.c <<EOCP
17644 #$i_math I_MATH
17645 #$i_sunmath I_SUNMATH
17646 #ifdef I_MATH
17647 #  include <math.h>
17648 #endif
17649 #ifdef I_SUNMATH  /* Solaris special math library */
17650 #  include <sunmath.h>
17651 #endif
17652 #define NV $nvtype
17653 int main(int argc, char **argv)
17654 {
17655     NV x = 0.0;
17656     NV y = -0.0;
17657     if ((signbit(x) == 0) && (signbit(y) != 0))
17658         return 0;
17659     else
17660         return 1;
17661 }
17662 EOCP
17663 val="$undef"
17664 set try
17665 if eval $compile; then
17666     if $run ./try; then
17667         $echo "Yes." >&4
17668         val="$define"
17669     else
17670         $echo "Signbit seems to be available, but doesn't work as I expected."
17671         $echo "I won't use it." >&4
17672         val="$undef"
17673     fi
17674 else
17675     $echo "Nope." >&4
17676     dflt="$undef"
17677 fi
17678 set d_signbit
17679 eval $setvar
17680 $rm_try
17681
17682 : see if sigprocmask exists
17683 set sigprocmask d_sigprocmask
17684 eval $inlibc
17685
17686 : see if sigsetjmp exists
17687 echo " "
17688 case "$d_sigsetjmp" in
17689 '')
17690         $cat >try.c <<EOP
17691 #include <setjmp.h>
17692 #$i_stdlib I_STDLIB
17693 #ifdef I_STDLIB
17694 #include <stdlib.h>
17695 #endif
17696 sigjmp_buf env;
17697 int set = 1;
17698 int main()
17699 {
17700         if (sigsetjmp(env,1))
17701                 exit(set);
17702         set = 0;
17703         siglongjmp(env, 1);
17704         exit(1);
17705 }
17706 EOP
17707         set try
17708         if eval $compile; then
17709                 if $run ./try >/dev/null 2>&1; then
17710                         echo "POSIX sigsetjmp found." >&4
17711                         val="$define"
17712                 else
17713                         $cat >&4 <<EOM
17714 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17715 I'll ignore them.
17716 EOM
17717                         val="$undef"
17718                 fi
17719         else
17720                 echo "sigsetjmp not found." >&4
17721                 val="$undef"
17722         fi
17723         ;;
17724 *) val="$d_sigsetjmp"
17725         case "$d_sigsetjmp" in
17726         $define) echo "POSIX sigsetjmp found." >&4;;
17727         $undef) echo "sigsetjmp not found." >&4;;
17728         esac
17729         ;;
17730 esac
17731 set d_sigsetjmp
17732 eval $setvar
17733 $rm_try
17734
17735 : see if snprintf exists
17736 set snprintf d_snprintf
17737 eval $inlibc
17738
17739 : see if vsnprintf exists
17740 set vsnprintf d_vsnprintf
17741 eval $inlibc
17742
17743 case "$d_snprintf-$d_vsnprintf" in
17744 "$define-$define")
17745     $cat <<EOM
17746 Checking whether your snprintf() and vsnprintf() work okay...
17747 EOM
17748     $cat >try.c <<'EOCP'
17749 /* v?snprintf testing logic courtesy of Russ Allbery.
17750  * According to C99:
17751  * - if the buffer is too short it still must be \0-terminated
17752  * - if the buffer is too short the potentially required length
17753  *   must be returned and not -1
17754  * - if the buffer is NULL the potentially required length
17755  *   must be returned and not -1 or core dump
17756  */
17757 #include <stdio.h>
17758 #include <stdarg.h>
17759
17760 char buf[2];
17761
17762 int test (char *format, ...)
17763 {
17764     va_list args;
17765     int count;
17766
17767     va_start (args, format);
17768     count = vsnprintf (buf, sizeof buf, format, args);
17769     va_end (args);
17770     return count;
17771 }
17772
17773 int main ()
17774 {
17775     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17776              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17777 }
17778 EOCP
17779     set try
17780     if eval $compile; then
17781         `$run ./try`
17782         case "$?" in
17783         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17784         *) cat <<EOM >&4
17785 Your snprintf() and snprintf() don't seem to be working okay.
17786 EOM
17787            d_snprintf="$undef"
17788            d_vsnprintf="$undef"
17789            ;;
17790         esac
17791     else
17792         echo "(I can't seem to compile the test program--assuming they don't)"
17793         d_snprintf="$undef"
17794         d_vsnprintf="$undef"
17795     fi
17796     $rm_try
17797     ;;
17798 esac
17799
17800 : see if sockatmark exists
17801 set sockatmark d_sockatmark
17802 eval $inlibc
17803
17804 : see if prototype for sockatmark is available
17805 echo " "
17806 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17807 eval $hasproto
17808
17809 : see if socks5_init exists
17810 set socks5_init d_socks5_init
17811 eval $inlibc
17812
17813 : see if sprintf returns the length of the string in the buffer as per ANSI
17814 $echo "Checking whether sprintf returns the length of the string..." >&4
17815 $cat <<EOP >try.c
17816 #include <stdio.h>
17817 #$i_stdlib I_STDLIB
17818 #ifdef I_STDLIB
17819 #include <stdlib.h>
17820 #endif
17821 #$i_string I_STRING
17822 #ifdef I_STRING
17823 #  include <string.h>
17824 #else
17825 #  include <strings.h>
17826 #endif
17827 #$i_math I_MATH
17828 #ifdef I_MATH
17829 #include <math.h>
17830 #endif
17831
17832 char buffer[256];
17833
17834 int check (size_t expect, int test) {
17835   size_t got = strlen(buffer);
17836   if (expect == got)
17837     return 0;
17838
17839   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17840        test, buffer);
17841   exit (test);
17842 }
17843
17844 int main(int argc, char **argv) {
17845   int test = 0;
17846
17847   check(sprintf(buffer, ""), ++test);
17848   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17849   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17850
17851   return 0;
17852 }
17853 EOP
17854 set try
17855
17856 if eval $compile; then
17857     xxx="`$run ./try`"
17858     case "$?" in
17859         0) cat >&4 <<EOM
17860 sprintf returns the length of the string (as ANSI says it should)
17861 EOM
17862         d_sprintf_returns_strlen="$define"
17863         ;;
17864         *) cat >&4 <<EOM
17865 sprintf does not return the length of the string (how old is this system?)
17866 EOM
17867         d_sprintf_returns_strlen="$undef"
17868         ;;
17869     esac
17870 else
17871     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17872     d_sprintf_returns_strlen="$undef"
17873 fi
17874 $rm_try
17875
17876 : see if srand48_r exists
17877 set srand48_r d_srand48_r
17878 eval $inlibc
17879 case "$d_srand48_r" in
17880 "$define")
17881         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17882         case "$d_srand48_r_proto:$usethreads" in
17883         ":define")      d_srand48_r_proto=define
17884                 set d_srand48_r_proto srand48_r $hdrs
17885                 eval $hasproto ;;
17886         *)      ;;
17887         esac
17888         case "$d_srand48_r_proto" in
17889         define)
17890         case "$srand48_r_proto" in
17891         ''|0) try='int srand48_r(long, struct drand48_data*);'
17892         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17893         esac
17894         case "$srand48_r_proto" in
17895         ''|0)   d_srand48_r=undef
17896                 srand48_r_proto=0
17897                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17898         * )     case "$srand48_r_proto" in
17899                 REENTRANT_PROTO*) ;;
17900                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17901                 esac
17902                 echo "Prototype: $try" ;;
17903         esac
17904         ;;
17905         *)      case "$usethreads" in
17906                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17907                 esac
17908                 d_srand48_r=undef
17909                 srand48_r_proto=0
17910                 ;;
17911         esac
17912         ;;
17913 *)      srand48_r_proto=0
17914         ;;
17915 esac
17916
17917 : see if srandom_r exists
17918 set srandom_r d_srandom_r
17919 eval $inlibc
17920 case "$d_srandom_r" in
17921 "$define")
17922         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17923         case "$d_srandom_r_proto:$usethreads" in
17924         ":define")      d_srandom_r_proto=define
17925                 set d_srandom_r_proto srandom_r $hdrs
17926                 eval $hasproto ;;
17927         *)      ;;
17928         esac
17929         case "$d_srandom_r_proto" in
17930         define)
17931         case "$srandom_r_proto" in
17932         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17933         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17934         esac
17935         case "$srandom_r_proto" in
17936         ''|0)   d_srandom_r=undef
17937                 srandom_r_proto=0
17938                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17939         * )     case "$srandom_r_proto" in
17940                 REENTRANT_PROTO*) ;;
17941                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17942                 esac
17943                 echo "Prototype: $try" ;;
17944         esac
17945         ;;
17946         *)      case "$usethreads" in
17947                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17948                 esac
17949                 d_srandom_r=undef
17950                 srandom_r_proto=0
17951                 ;;
17952         esac
17953         ;;
17954 *)      srandom_r_proto=0
17955         ;;
17956 esac
17957
17958 : see if prototype for setresgid is available
17959 echo " "
17960 set d_sresgproto setresgid $i_unistd unistd.h
17961 eval $hasproto
17962
17963 : see if prototype for setresuid is available
17964 echo " "
17965 set d_sresuproto setresuid $i_unistd unistd.h
17966 eval $hasproto
17967
17968 : see if sys/stat.h is available
17969 set sys/stat.h i_sysstat
17970 eval $inhdr
17971
17972 : see if stat knows about block sizes
17973 echo " "
17974 echo "Checking to see if your struct stat has st_blocks field..." >&4
17975 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17976 eval $hasfield
17977
17978 : see if this is a sys/vfs.h system
17979 set sys/vfs.h i_sysvfs
17980 eval $inhdr
17981
17982 : see if this is a sys/statfs.h system
17983 set sys/statfs.h i_sysstatfs
17984 eval $inhdr
17985
17986 : Check for statfs_s
17987 echo " "
17988 echo "Checking to see if your system supports struct statfs..." >&4
17989 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
17990 eval $hasstruct
17991 case "$d_statfs_s" in
17992 "$define")      echo "Yes, it does."   ;;
17993 *)              echo "No, it doesn't." ;;
17994 esac
17995
17996
17997 : see if struct statfs knows about f_flags
17998 case "$d_statfs_s" in
17999 define)
18000         echo " "
18001         echo "Checking to see if your struct statfs has f_flags field..." >&4
18002         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
18003         eval $hasfield
18004         ;;
18005 *)      val="$undef"
18006         set d_statfs_f_flags
18007         eval $setvar
18008         ;;
18009 esac
18010 case "$d_statfs_f_flags" in
18011 "$define")      echo "Yes, it does."   ;;
18012 *)              echo "No, it doesn't." ;;
18013 esac
18014
18015 : see what flavor, if any, of static inline is supported
18016 echo " "
18017 echo "Checking to see if your system supports static inline..."
18018 $cat > try.c <<'EOCP'
18019 #include <stdlib.h>
18020 extern int f_via_a(int x);
18021 extern int f_via_b(int x);
18022 int main(int argc, char **argv)
18023 {
18024     int y;
18025
18026     y = f_via_a(0);
18027 #ifdef USE_B
18028     y = f_via_b(0);
18029 #endif
18030     if (y == 42) {
18031         return EXIT_SUCCESS;
18032     }
18033     else {
18034         return EXIT_FAILURE;
18035     }
18036 }
18037 EOCP
18038 $cat > a.c <<'EOCP'
18039 static INLINE int f(int x) {
18040     int y;
18041     y = x + 42;
18042     return y;
18043 }
18044
18045 int f_via_a(int x)
18046 {
18047     return f(x);
18048 }
18049 EOCP
18050 $cat > b.c <<'EOCP'
18051 extern int f(int x);
18052
18053 int f_via_b(int x)
18054 {
18055     return f(x);
18056 }
18057 EOCP
18058
18059 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18060 case "$perl_static_inline" in
18061 '')     # Check the various possibilities, and break out on success.
18062         # For gcc, prefer __inline__, which will still permit 
18063         # cflags.SH to add in -ansi.
18064         case "$gccversion" in
18065                 '') xxx="inline __inline__ __inline _inline";;
18066                 *)  xxx="__inline__ inline __inline _inline";;
18067         esac
18068         for inline in $xxx; do
18069                 set try -DINLINE=$inline a.c
18070                 if eval $compile && $run ./try; then
18071                         # Now make sure there is no external linkage of static
18072                         # functions
18073                         set try -DINLINE=$inline -DUSE_B a.c b.c
18074                         if eval $compile && $run ./try; then
18075                                 $echo "Your compiler supports static $inline, " >&4
18076                                 $echo "but it also creates an external definition," >&4
18077                                 $echo "so I won't use it." >&4
18078                                 val=$undef
18079                         else
18080                                 $echo "Your compiler supports static $inline." >&4
18081                                 val=$define
18082                                 perl_static_inline="static $inline";
18083                                 break;
18084                         fi
18085                 else
18086                         $echo "Your compiler does NOT support static $inline." >&4
18087                         val="$undef"
18088                 fi
18089         done
18090         ;;
18091 *inline*) # Some variant of inline exists.
18092         echo "Keeping your $hint value of $perl_static_inline."
18093         val=$define
18094         ;;
18095 static)  # No inline capabilities
18096         echo "Keeping your $hint value of $perl_static_inline."
18097         val=$undef
18098         ;;
18099 *)  # Unrecognized previous value -- blindly trust the supplied
18100         # value and hope it makes sense.  Use old value for
18101         # d_static_inline, if there is one.
18102         echo "Keeping your $hint value of $perl_static_inline."
18103         case "$d_static_inline" in
18104                 '') val=$define ;;
18105                 *)  val=$d_static_inline ;;
18106         esac
18107         ;;
18108 esac
18109 # Fallback to plain 'static' if nothing worked.
18110 case "$perl_static_inline" in
18111 '')
18112         perl_static_inline="static"
18113         val=$undef
18114         ;;
18115 esac
18116 set d_static_inline
18117 eval $setvar
18118 $rm -f a.[co] b.[co]
18119 $rm_try
18120
18121 : Check stream access
18122 $cat >&4 <<EOM
18123 Checking how to access stdio streams by file descriptor number...
18124 EOM
18125 case "$stdio_stream_array" in
18126 '')     $cat >try.c <<EOCP
18127 #include <stdio.h>
18128 int main() {
18129   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18130     printf("yes\n");
18131 }
18132 EOCP
18133         for s in _iob __iob __sF
18134         do
18135                 set try -DSTDIO_STREAM_ARRAY=$s
18136                 if eval $compile; then
18137                         case "`$run ./try`" in
18138                         yes)    stdio_stream_array=$s; break ;;
18139                         esac
18140                 fi
18141         done
18142         $rm_try
18143 esac
18144 case "$stdio_stream_array" in
18145 '')     $cat >&4 <<EOM
18146 I can't figure out how to access stdio streams by file descriptor number.
18147 EOM
18148         d_stdio_stream_array="$undef"
18149         ;;
18150 *)      $cat >&4 <<EOM
18151 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18152 EOM
18153         d_stdio_stream_array="$define"
18154         ;;
18155 esac
18156
18157 : see if strcoll exists
18158 set strcoll d_strcoll
18159 eval $inlibc
18160
18161 : check for structure copying
18162 echo " "
18163 echo "Checking to see if your C compiler can copy structs..." >&4
18164 $cat >try.c <<'EOCP'
18165 int main()
18166 {
18167         struct blurfl {
18168                 int dyick;
18169         } foo, bar;
18170
18171         foo = bar;
18172 }
18173 EOCP
18174 if $cc -c try.c >/dev/null 2>&1 ; then
18175         val="$define"
18176         echo "Yup, it can."
18177 else
18178         val="$undef"
18179         echo "Nope, it can't."
18180 fi
18181 set d_strctcpy
18182 eval $setvar
18183 $rm_try
18184
18185 : see if strerror and/or sys_errlist[] exist
18186 echo " "
18187 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18188     if set strerror val -f d_strerror; eval $csym; $val; then
18189                 echo 'strerror() found.' >&4
18190                 d_strerror="$define"
18191                 d_strerrm='strerror(e)'
18192                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18193                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
18194                         d_syserrlst="$define"
18195                 else
18196                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
18197                         d_syserrlst="$undef"
18198                 fi
18199     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18200                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18201                 echo 'strerror() found in string header.' >&4
18202                 d_strerror="$define"
18203                 d_strerrm='strerror(e)'
18204                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18205                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18206                                 d_syserrlst="$define"
18207                 else
18208                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18209                         d_syserrlst="$undef"
18210                 fi
18211     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18212                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18213                 d_strerror="$undef"
18214                 d_syserrlst="$define"
18215                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18216     else
18217                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18218                 d_strerror="$undef"
18219                 d_syserrlst="$undef"
18220                 d_strerrm='"unknown"'
18221     fi
18222 fi
18223
18224 : see if strerror_r exists
18225 set strerror_r d_strerror_r
18226 eval $inlibc
18227 case "$d_strerror_r" in
18228 "$define")
18229         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18230         case "$d_strerror_r_proto:$usethreads" in
18231         ":define")      d_strerror_r_proto=define
18232                 set d_strerror_r_proto strerror_r $hdrs
18233                 eval $hasproto ;;
18234         *)      ;;
18235         esac
18236         case "$d_strerror_r_proto" in
18237         define)
18238         case "$strerror_r_proto" in
18239         ''|0) try='int strerror_r(int, char*, size_t);'
18240         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18241         esac
18242         case "$strerror_r_proto" in
18243         ''|0) try='int strerror_r(int, char*, int);'
18244         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18245         esac
18246         case "$strerror_r_proto" in
18247         ''|0) try='char* strerror_r(int, char*, size_t);'
18248         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18249         esac
18250         case "$strerror_r_proto" in
18251         ''|0)   d_strerror_r=undef
18252                 strerror_r_proto=0
18253                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18254         * )     case "$strerror_r_proto" in
18255                 REENTRANT_PROTO*) ;;
18256                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18257                 esac
18258                 echo "Prototype: $try" ;;
18259         esac
18260         ;;
18261         *)      case "$usethreads" in
18262                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18263                 esac
18264                 d_strerror_r=undef
18265                 strerror_r_proto=0
18266                 ;;
18267         esac
18268         ;;
18269 *)      strerror_r_proto=0
18270         ;;
18271 esac
18272
18273 : see if strftime exists
18274 set strftime d_strftime
18275 eval $inlibc
18276
18277 : see if strlcat exists
18278 set strlcat d_strlcat
18279 eval $inlibc
18280
18281 : see if strlcpy exists
18282 set strlcpy d_strlcpy
18283 eval $inlibc
18284
18285 : see if strtod exists
18286 set strtod d_strtod
18287 eval $inlibc
18288
18289 : see if strtol exists
18290 set strtol d_strtol
18291 eval $inlibc
18292
18293 : see if strtold exists
18294 set strtold d_strtold
18295 eval $inlibc
18296
18297 : see if strtoll exists
18298 set strtoll d_strtoll
18299 eval $inlibc
18300
18301 case "$d_longlong-$d_strtoll" in
18302 "$define-$define")
18303         $cat <<EOM
18304 Checking whether your strtoll() works okay...
18305 EOM
18306         $cat >try.c <<'EOCP'
18307 #include <errno.h>
18308 #ifdef __hpux
18309 #define strtoll __strtoll
18310 #endif
18311 #ifdef __EMX__
18312 #define strtoll _strtoll
18313 #endif
18314 #include <stdio.h>
18315 extern long long int strtoll(char *s, char **, int);
18316 static int bad = 0;
18317 int check(char *s, long long ell, int een) {
18318         long long gll;
18319         errno = 0;
18320         gll = strtoll(s, 0, 10);
18321         if (!((gll == ell) && (errno == een)))
18322                 bad++;
18323 }
18324 int main() {
18325         check(" 1",                                      1LL, 0);
18326         check(" 0",                                      0LL, 0);
18327         check("-1",                                     -1LL, 0);
18328         check("-9223372036854775808", -9223372036854775808LL, 0);
18329         check("-9223372036854775808", -9223372036854775808LL, 0);
18330         check(" 9223372036854775807",  9223372036854775807LL, 0);
18331         check("-9223372036854775808", -9223372036854775808LL, 0);
18332         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18333         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18334         if (!bad)
18335                 printf("ok\n");
18336 }
18337 EOCP
18338         set try
18339         if eval $compile; then
18340                 yyy=`$run ./try`
18341                 case "$yyy" in
18342                 ok) echo "Your strtoll() seems to be working okay." ;;
18343                 *) cat <<EOM >&4
18344 Your strtoll() doesn't seem to be working okay.
18345 EOM
18346                    d_strtoll="$undef"
18347                    ;;
18348                 esac
18349         else
18350                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18351                 d_strtoll="$undef"
18352         fi
18353         ;;
18354 esac
18355
18356 : see if strtoq exists
18357 set strtoq d_strtoq
18358 eval $inlibc
18359
18360 : see if strtoul exists
18361 set strtoul d_strtoul
18362 eval $inlibc
18363
18364 case "$d_strtoul" in
18365 "$define")
18366         $cat <<EOM
18367 Checking whether your strtoul() works okay...
18368 EOM
18369         $cat >try.c <<'EOCP'
18370 #include <errno.h>
18371 #include <stdio.h>
18372 extern unsigned long int strtoul(char *s, char **, int);
18373 static int bad = 0;
18374 void check(char *s, unsigned long eul, int een) {
18375         unsigned long gul;
18376         errno = 0;
18377         gul = strtoul(s, 0, 10);
18378         if (!((gul == eul) && (errno == een)))
18379                 bad++;
18380 }
18381 int main() {
18382         check(" 1", 1L, 0);
18383         check(" 0", 0L, 0);
18384 EOCP
18385         case "$longsize" in
18386         8)
18387             $cat >>try.c <<'EOCP'
18388         check("18446744073709551615", 18446744073709551615UL, 0);
18389         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18390 #if 0 /* strtoul() for /^-/ strings is undefined. */
18391         check("-1", 18446744073709551615UL, 0);
18392         check("-18446744073709551614", 2, 0);
18393         check("-18446744073709551615", 1, 0);
18394         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18395         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18396 #endif
18397 EOCP
18398                 ;;
18399         4)
18400                     $cat >>try.c <<'EOCP'
18401         check("4294967295", 4294967295UL, 0);
18402         check("4294967296", 4294967295UL, ERANGE);
18403 #if 0 /* strtoul() for /^-/ strings is undefined. */
18404         check("-1", 4294967295UL, 0);
18405         check("-4294967294", 2, 0);
18406         check("-4294967295", 1, 0);
18407         check("-4294967296", 4294967295UL, ERANGE);
18408         check("-4294967297", 4294967295UL, ERANGE);
18409 #endif
18410 EOCP
18411                 ;;
18412         *)
18413 : Should we write these tests to be more portable by sprintf-ing
18414 : ~0 and then manipulating that char string as input for strtol?
18415                 ;;
18416         esac
18417         $cat >>try.c <<'EOCP'
18418         if (!bad)
18419                 printf("ok\n");
18420         return 0;
18421 }
18422 EOCP
18423         set try
18424         if eval $compile; then
18425                 case "`$run ./try`" in
18426                 ok) echo "Your strtoul() seems to be working okay." ;;
18427                 *) cat <<EOM >&4
18428 Your strtoul() doesn't seem to be working okay.
18429 EOM
18430                    d_strtoul="$undef"
18431                    ;;
18432                 esac
18433         else
18434                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18435                 d_strtoul="$undef"
18436         fi
18437         ;;
18438 esac
18439
18440 : see if strtoull exists
18441 set strtoull d_strtoull
18442 eval $inlibc
18443
18444 case "$d_longlong-$d_strtoull" in
18445 "$define-$define")
18446         $cat <<EOM
18447 Checking whether your strtoull() works okay...
18448 EOM
18449         $cat >try.c <<'EOCP'
18450 #include <errno.h>
18451 #ifdef __hpux
18452 #define strtoull __strtoull
18453 #endif
18454 #include <stdio.h>
18455 extern unsigned long long int strtoull(char *s, char **, int);
18456 static int bad = 0;
18457 int check(char *s, long long eull, int een) {
18458         long long gull;
18459         errno = 0;
18460         gull = strtoull(s, 0, 10);
18461         if (!((gull == eull) && (errno == een)))
18462                 bad++;
18463 }
18464 int main() {
18465         check(" 1",                                        1LL, 0);
18466         check(" 0",                                        0LL, 0);
18467         check("18446744073709551615",  18446744073709551615ULL, 0);
18468         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18469 #if 0 /* strtoull() for /^-/ strings is undefined. */
18470         check("-1",                    18446744073709551615ULL, 0);
18471         check("-18446744073709551614",                     2LL, 0);
18472         check("-18446744073709551615",                     1LL, 0);
18473         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18474         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18475 #endif
18476         if (!bad)
18477                 printf("ok\n");
18478 }
18479 EOCP
18480         set try
18481         if eval $compile; then
18482                 case "`$run ./try`" in
18483                 ok) echo "Your strtoull() seems to be working okay." ;;
18484                 *) cat <<EOM >&4
18485 Your strtoull() doesn't seem to be working okay.
18486 EOM
18487                    d_strtoull="$undef"
18488                    ;;
18489                 esac
18490         else
18491                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18492                 d_strtoull="$undef"
18493         fi
18494         ;;
18495 esac
18496
18497 : see if strtouq exists
18498 set strtouq d_strtouq
18499 eval $inlibc
18500
18501 case "$d_strtouq" in
18502 "$define")
18503         $cat <<EOM
18504 Checking whether your strtouq() works okay...
18505 EOM
18506         $cat >try.c <<'EOCP'
18507 #include <errno.h>
18508 #include <stdio.h>
18509 extern unsigned long long int strtouq(char *s, char **, int);
18510 static int bad = 0;
18511 void check(char *s, unsigned long long eull, int een) {
18512         unsigned long long gull;
18513         errno = 0;
18514         gull = strtouq(s, 0, 10);
18515         if (!((gull == eull) && (errno == een)))
18516                 bad++;
18517 }
18518 int main() {
18519         check(" 1",                                        1LL, 0);
18520         check(" 0",                                        0LL, 0);
18521         check("18446744073709551615",  18446744073709551615ULL, 0);
18522         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18523 #if 0 /* strtouq() for /^-/ strings is undefined. */
18524         check("-1",                    18446744073709551615ULL, 0);
18525         check("-18446744073709551614",                     2LL, 0);
18526         check("-18446744073709551615",                     1LL, 0);
18527         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18528         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18529 #endif
18530         if (!bad)
18531                 printf("ok\n");
18532         return 0;
18533 }
18534 EOCP
18535         set try
18536         if eval $compile; then
18537                 case "`$run ./try`" in
18538                 ok) echo "Your strtouq() seems to be working okay." ;;
18539                 *) cat <<EOM >&4
18540 Your strtouq() doesn't seem to be working okay.
18541 EOM
18542                    d_strtouq="$undef"
18543                    ;;
18544                 esac
18545         else
18546                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18547                 d_strtouq="$undef"
18548         fi
18549         ;;
18550 esac
18551
18552 : see if strxfrm exists
18553 set strxfrm d_strxfrm
18554 eval $inlibc
18555
18556 : see if symlink exists
18557 set symlink d_symlink
18558 eval $inlibc
18559
18560 : see if syscall exists
18561 set syscall d_syscall
18562 eval $inlibc
18563
18564 : see if prototype for syscall is available
18565 echo " "
18566 set d_syscallproto syscall $i_unistd unistd.h
18567 eval $hasproto
18568
18569 : see if sysconf exists
18570 set sysconf d_sysconf
18571 eval $inlibc
18572
18573 : see if system exists
18574 set system d_system
18575 eval $inlibc
18576
18577 : see if tcgetpgrp exists
18578 set tcgetpgrp d_tcgetpgrp
18579 eval $inlibc
18580
18581 : see if tcsetpgrp exists
18582 set tcsetpgrp d_tcsetpgrp
18583 eval $inlibc
18584
18585 : see if prototype for telldir is available
18586 echo " "
18587 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18588 eval $hasproto
18589
18590 : see if time exists
18591 echo " "
18592 if test "X$d_time" = X -o X"$timetype" = X; then
18593     if set time val -f d_time; eval $csym; $val; then
18594                 echo 'time() found.' >&4
18595                 val="$define"
18596                 rp="What is the type returned by time() on this system?"
18597                 set time_t timetype long stdio.h sys/types.h
18598                 eval $typedef_ask
18599     else
18600                 echo 'time() not found, hope that will do.' >&4
18601                 val="$undef"
18602                 timetype='int';
18603     fi
18604     set d_time
18605     eval $setvar
18606 fi
18607
18608 : see if timegm exists
18609 set timegm d_timegm
18610 eval $inlibc
18611
18612 : see if this is a sys/times.h system
18613 set sys/times.h i_systimes
18614 eval $inhdr
18615
18616 : see if times exists
18617 echo " "
18618 if set times val -f d_times; eval $csym; $val; then
18619         echo 'times() found.' >&4
18620         d_times="$define"
18621         inc=''
18622         case "$i_systimes" in
18623         "$define") inc='sys/times.h';;
18624         esac
18625         rp="What is the type returned by times() on this system?"
18626         set clock_t clocktype long stdio.h sys/types.h $inc
18627         eval $typedef_ask
18628 else
18629         echo 'times() NOT found, hope that will do.' >&4
18630         d_times="$undef"
18631         clocktype='int'
18632 fi
18633
18634 : see if tmpnam_r exists
18635 set tmpnam_r d_tmpnam_r
18636 eval $inlibc
18637 case "$d_tmpnam_r" in
18638 "$define")
18639         hdrs="$i_systypes sys/types.h define stdio.h "
18640         case "$d_tmpnam_r_proto:$usethreads" in
18641         ":define")      d_tmpnam_r_proto=define
18642                 set d_tmpnam_r_proto tmpnam_r $hdrs
18643                 eval $hasproto ;;
18644         *)      ;;
18645         esac
18646         case "$d_tmpnam_r_proto" in
18647         define)
18648         case "$tmpnam_r_proto" in
18649         ''|0) try='char* tmpnam_r(char*);'
18650         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18651         esac
18652         case "$tmpnam_r_proto" in
18653         ''|0)   d_tmpnam_r=undef
18654                 tmpnam_r_proto=0
18655                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18656         * )     case "$tmpnam_r_proto" in
18657                 REENTRANT_PROTO*) ;;
18658                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18659                 esac
18660                 echo "Prototype: $try" ;;
18661         esac
18662         ;;
18663         *)      case "$usethreads" in
18664                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18665                 esac
18666                 d_tmpnam_r=undef
18667                 tmpnam_r_proto=0
18668                 ;;
18669         esac
18670         ;;
18671 *)      tmpnam_r_proto=0
18672         ;;
18673 esac
18674
18675 : see if truncate exists
18676 set truncate d_truncate
18677 eval $inlibc
18678
18679 : see if ttyname_r exists
18680 set ttyname_r d_ttyname_r
18681 eval $inlibc
18682 case "$d_ttyname_r" in
18683 "$define")
18684         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18685         case "$d_ttyname_r_proto:$usethreads" in
18686         ":define")      d_ttyname_r_proto=define
18687                 set d_ttyname_r_proto ttyname_r $hdrs
18688                 eval $hasproto ;;
18689         *)      ;;
18690         esac
18691         case "$d_ttyname_r_proto" in
18692         define)
18693         case "$ttyname_r_proto" in
18694         ''|0) try='int ttyname_r(int, char*, size_t);'
18695         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18696         esac
18697         case "$ttyname_r_proto" in
18698         ''|0) try='int ttyname_r(int, char*, int);'
18699         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18700         esac
18701         case "$ttyname_r_proto" in
18702         ''|0) try='char* ttyname_r(int, char*, int);'
18703         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18704         esac
18705         case "$ttyname_r_proto" in
18706         ''|0)   d_ttyname_r=undef
18707                 ttyname_r_proto=0
18708                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18709         * )     case "$ttyname_r_proto" in
18710                 REENTRANT_PROTO*) ;;
18711                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18712                 esac
18713                 echo "Prototype: $try" ;;
18714         esac
18715         ;;
18716         *)      case "$usethreads" in
18717                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18718                 esac
18719                 d_ttyname_r=undef
18720                 ttyname_r_proto=0
18721                 ;;
18722         esac
18723         ;;
18724 *)      ttyname_r_proto=0
18725         ;;
18726 esac
18727
18728 : see if tzname[] exists
18729 echo " "
18730 if set tzname val -a d_tzname; eval $csym; $val; then
18731         val="$define"
18732         echo 'tzname[] found.' >&4
18733 else
18734         val="$undef"
18735         echo 'tzname[] NOT found.' >&4
18736 fi
18737 set d_tzname
18738 eval $setvar
18739
18740 : Check if is a multiplatform env
18741 case "$osname" in
18742 next|darwin) multiarch="$define" ;;
18743 esac
18744 case "$multiarch" in
18745 ''|[nN]*) multiarch="$undef" ;;
18746 esac
18747
18748 : check for ordering of bytes in a UV
18749 echo " "
18750 case "$usecrosscompile$multiarch" in
18751 *$define*)
18752         $cat <<EOM
18753 You seem to be either cross-compiling or doing a multiarchitecture build,
18754 skipping the byteorder check.
18755
18756 EOM
18757         byteorder='ffff'
18758         ;;
18759 *)
18760         case "$byteorder" in
18761         '')
18762                 $cat <<'EOM'
18763 In the following, larger digits indicate more significance.  A big-endian
18764 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18765 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18766 machines may have weird orders like 3412.  A Cray will report 87654321,
18767 an Alpha will report 12345678. If the test program works the default is
18768 probably right.
18769 I'm now running the test program...
18770 EOM
18771                 $cat >try.c <<EOCP
18772 #include <stdio.h>
18773 #$i_stdlib I_STDLIB
18774 #ifdef I_STDLIB
18775 #include <stdlib.h>
18776 #endif
18777 #include <sys/types.h>
18778 typedef $uvtype UV;
18779 int main()
18780 {
18781         int i;
18782         union {
18783                 UV l;
18784                 char c[$uvsize];
18785         } u;
18786
18787         if ($uvsize > 4)
18788                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18789         else
18790                 u.l = (UV)0x04030201;
18791         for (i = 0; i < $uvsize; i++)
18792                 printf("%c", u.c[i]+'0');
18793         printf("\n");
18794         exit(0);
18795 }
18796 EOCP
18797                 xxx_prompt=y
18798                 set try
18799                 if eval $compile && $run ./try > /dev/null; then
18800                         dflt=`$run ./try`
18801                         case "$dflt" in
18802                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18803                                 echo "(The test program ran ok.)"
18804                                 echo "byteorder=$dflt"
18805                                 xxx_prompt=n
18806                         ;;
18807                         ????|????????) echo "(The test program ran ok.)" ;;
18808                         *) echo "(The test program didn't run right for some reason.)" ;;
18809                         esac
18810                 else
18811                         dflt='4321'
18812                         cat <<'EOM'
18813 (I can't seem to compile the test program.  Guessing big-endian...)
18814 EOM
18815                 fi
18816                 case "$xxx_prompt" in
18817                 y)
18818                         rp="What is the order of bytes in $uvtype?"
18819                         . ./myread
18820                         byteorder="$ans"
18821                         ;;
18822                 *)      byteorder=$dflt
18823                         ;;
18824                 esac
18825                 ;;
18826         esac
18827         $rm_try
18828         ;;
18829 esac
18830
18831 : Checking 32bit alignedness
18832 $cat <<EOM
18833
18834 Checking to see whether you can access character data unalignedly...
18835 EOM
18836 case "$d_u32align" in
18837 '')   $cat >try.c <<EOCP
18838 #include <stdio.h>
18839 #$i_stdlib I_STDLIB
18840 #ifdef I_STDLIB
18841 #include <stdlib.h>
18842 #endif
18843 #define U32 $u32type
18844 #define BYTEORDER 0x$byteorder
18845 #define U8 $u8type
18846 #include <signal.h>
18847 #ifdef SIGBUS
18848 $signal_t bletch(int s) { exit(4); }
18849 #endif
18850 int main() {
18851 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18852     volatile U8 buf[8];
18853     volatile U32 *up;
18854     int i;
18855
18856     if (sizeof(U32) != 4) {
18857         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18858         exit(1);
18859     }
18860
18861     fflush(stdout);
18862
18863 #ifdef SIGBUS
18864     signal(SIGBUS, bletch);
18865 #endif
18866
18867     buf[0] = 0;
18868     buf[1] = 0;
18869     buf[2] = 0;
18870     buf[3] = 1;
18871     buf[4] = 0;
18872     buf[5] = 0;
18873     buf[6] = 0;
18874     buf[7] = 1;
18875
18876     for (i = 0; i < 4; i++) {
18877         up = (U32*)(buf + i);
18878         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18879                (*up == 1 << (8*(3-i)))  /* little-endian */
18880               )
18881            )
18882         {
18883             printf("read failed (%x)\n", *up);
18884             exit(2);
18885         }
18886     }
18887
18888     /* write test */
18889     for (i = 0; i < 4; i++) {
18890         up = (U32*)(buf + i);
18891         *up = 0xBeef;
18892         if (*up != 0xBeef) {
18893             printf("write failed (%x)\n", *up);
18894             exit(3);
18895         }
18896     }
18897
18898     exit(0);
18899 #else
18900     printf("1\n");
18901     exit(1);
18902 #endif
18903     return 0;
18904 }
18905 EOCP
18906 set try
18907 if eval $compile_ok; then
18908         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18909         $run ./try 2>&1 >/dev/null
18910         case "$?" in
18911         0)      cat >&4 <<EOM
18912 You can access character data pretty unalignedly.
18913 EOM
18914                 d_u32align="$undef"
18915                 ;;
18916         *)      cat >&4 <<EOM
18917 It seems that you must access character data in an aligned manner.
18918 EOM
18919                 d_u32align="$define"
18920                 ;;
18921         esac
18922 else
18923         rp='Can you access character data at unaligned addresses?'
18924         dflt='n'
18925         . ./myread
18926         case "$ans" in
18927         [yY]*)  d_u32align="$undef"  ;;
18928         *)      d_u32align="$define" ;;
18929         esac
18930 fi
18931 $rm_try
18932 ;;
18933 esac
18934
18935 : see if ualarm exists
18936 set ualarm d_ualarm
18937 eval $inlibc
18938
18939 : see if umask exists
18940 set umask d_umask
18941 eval $inlibc
18942
18943 : see if unordered exists
18944 set unordered d_unordered
18945 eval $inlibc
18946
18947 : see if unsetenv exists
18948 set unsetenv d_unsetenv
18949 eval $inlibc
18950
18951 : see if usleep exists
18952 set usleep d_usleep
18953 eval $inlibc
18954
18955 : see if prototype for usleep is available
18956 echo " "
18957 set d_usleepproto usleep $i_unistd unistd.h
18958 eval $hasproto
18959
18960 : see if ustat exists
18961 set ustat d_ustat
18962 eval $inlibc
18963
18964 : see if closedir exists
18965 set closedir d_closedir
18966 eval $inlibc
18967
18968 case "$d_closedir" in
18969 "$define")
18970         echo " "
18971         echo "Checking whether closedir() returns a status..." >&4
18972         cat > try.c <<EOM
18973 #$i_dirent I_DIRENT             /**/
18974 #$i_sysdir I_SYS_DIR            /**/
18975 #$i_sysndir I_SYS_NDIR          /**/
18976 #$i_systypes I_SYS_TYPES        /**/
18977
18978 #if defined(I_SYS_TYPES)
18979 #include <sys/types.h>
18980 #endif
18981 #if defined(I_DIRENT)
18982 #include <dirent.h>
18983 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18984 #include <sys/dir.h>
18985 #endif
18986 #else
18987 #ifdef I_SYS_NDIR
18988 #include <sys/ndir.h>
18989 #else
18990 #ifdef I_SYS_DIR
18991 #ifdef hp9000s500
18992 #include <ndir.h>       /* may be wrong in the future */
18993 #else
18994 #include <sys/dir.h>
18995 #endif
18996 #endif
18997 #endif
18998 #endif
18999 int main() { return closedir(opendir(".")); }
19000 EOM
19001         set try
19002         if eval $compile_ok; then
19003                 if $run ./try > /dev/null 2>&1 ; then
19004                         echo "Yes, it does."
19005                         val="$undef"
19006                 else
19007                         echo "No, it doesn't."
19008                         val="$define"
19009                 fi
19010         else
19011                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19012                 val="$define"
19013         fi
19014         ;;
19015 *)
19016         val="$undef";
19017         ;;
19018 esac
19019 set d_void_closedir
19020 eval $setvar
19021 $rm_try
19022
19023 : see if there is a wait4
19024 set wait4 d_wait4
19025 eval $inlibc
19026
19027 : see if waitpid exists
19028 set waitpid d_waitpid
19029 eval $inlibc
19030
19031 : see if wcstombs exists
19032 set wcstombs d_wcstombs
19033 eval $inlibc
19034
19035 : see if wctomb exists
19036 set wctomb d_wctomb
19037 eval $inlibc
19038
19039 : see if writev exists
19040 set writev d_writev
19041 eval $inlibc
19042
19043 : preserve RCS keywords in files with variable substitution, grrr
19044 Date='$Date'
19045 Id='$Id'
19046 Log='$Log'
19047 RCSfile='$RCSfile'
19048 Revision='$Revision'
19049
19050 : check for alignment requirements
19051 echo " "
19052 case "$usecrosscompile" in
19053 *$define*)
19054         $cat <<EOM
19055 You seem to be cross-compiling.  Skipping the memory alignment check.
19056
19057 EOM
19058         case "$alignbytes" in
19059         '') alignbytes=8 ;;
19060         esac
19061         ;;
19062 *)
19063         case "$alignbytes" in
19064         '') echo "Checking alignment constraints..." >&4
19065                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
19066                         $cat >try.c <<'EOCP'
19067 typedef long double NV;
19068 EOCP
19069                 else
19070                         $cat >try.c <<'EOCP'
19071 typedef double NV;
19072 EOCP
19073                 fi
19074                 $cat >>try.c <<'EOCP'
19075 #include <stdio.h>
19076 struct foobar {
19077         char foo;
19078         NV bar;
19079 } try_algn;
19080 int main()
19081 {
19082     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19083     return(0);
19084 }
19085 EOCP
19086                 set try
19087                 if eval $compile_ok; then
19088                         dflt=`$run ./try`
19089                 else
19090                         dflt='8'
19091                         echo "(I can't seem to compile the test program...)"
19092                 fi
19093                 case "$multiarch" in
19094                 *$define*)
19095                         : The usual safe value is 8, but Darwin with -Duselongdouble
19096                         : needs 16.  Hence, we will take 8 as a minimum, but allow
19097                         : Configure to pick a larger value if needed.
19098                         if $test "$dflt" -lt 8; then
19099                             dflt='8'
19100                                 echo "Setting alignment to 8 for multiarch support.">&4
19101                         fi
19102                         ;;
19103                 esac
19104                 ;;
19105         *) dflt="$alignbytes"
19106                 ;;
19107         esac
19108         rp="Doubles must be aligned on a how-many-byte boundary?"
19109         . ./myread
19110         alignbytes="$ans"
19111         $rm_try
19112         ;;
19113 esac
19114
19115
19116 : set the base revision
19117 baserev=5.0
19118
19119 : length of character in bytes. Is always 1, otherwise it isnt C
19120 : This used to be a test using sizeof
19121 charsize=1
19122
19123 : Check for the number of bits in a character
19124 case "$charbits" in
19125 '')     echo "Checking how long a character is (in bits)..." >&4
19126         $cat >try.c <<EOCP
19127 #include <stdio.h>
19128 int main ()
19129 {
19130     int n;
19131     unsigned char c;
19132     for (c = 1, n = 0; c; c <<= 1, n++) ;
19133     printf ("%d\n", n);
19134     return (0);
19135     }
19136 EOCP
19137         set try
19138         if eval $compile_ok; then
19139                 dflt=`$run ./try`
19140         else
19141                 dflt='8'
19142                 echo "(I can't seem to compile the test program.  Guessing...)"
19143         fi
19144         ;;
19145 *)
19146         dflt="$charbits"
19147         ;;
19148 esac
19149 rp="What is the length of a character (in bits)?"
19150 . ./myread
19151 charbits="$ans"
19152 $rm_try
19153 case "$charbits" in
19154 8)      ;;
19155 *)      cat >&4 << EOM
19156 Your system has an unsigned character size of $charbits bits, which
19157 is rather unusual (normally it is 8 bits).  Perl likely will not work
19158 correctly on your system, with subtle bugs in various places.
19159 EOM
19160         rp='Do you really want to continue?'
19161         dflt='n'
19162         . ./myread
19163         case "$ans" in
19164                 [yY])   echo >&4 "Okay, continuing."    ;;
19165                 *)      exit 1                          ;;
19166         esac
19167 esac
19168
19169 : how do we concatenate cpp tokens here?
19170 echo " "
19171 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19172 $cat >cpp_stuff.c <<'EOCP'
19173 #define RCAT(a,b)a/**/b
19174 #define ACAT(a,b)a ## b
19175 RCAT(Rei,ser)
19176 ACAT(Cir,cus)
19177 EOCP
19178 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19179 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19180         echo "Oh!  Smells like ANSI's been here." >&4
19181         echo "We can catify or stringify, separately or together!"
19182         cpp_stuff=42
19183 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19184         echo "Ah, yes!  The good old days!" >&4
19185         echo "However, in the good old days we don't know how to stringify and"
19186         echo "catify at the same time."
19187         cpp_stuff=1
19188 else
19189         $cat >&4 <<EOM
19190 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19191 You're going to have to edit the values of CAT[2-5] in config.h...
19192 EOM
19193         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19194 fi
19195 $rm -f cpp_stuff.*
19196
19197 : see if this is a db.h system
19198 set db.h i_db
19199 eval $inhdr
19200
19201 case "$i_db" in
19202 $define)
19203         : Check db version.
19204         echo " "
19205         echo "Checking Berkeley DB version ..." >&4
19206         $cat >try.c <<EOCP
19207 #$d_const HASCONST
19208 #ifndef HASCONST
19209 #define const
19210 #endif
19211 #include <sys/types.h>
19212 #include <stdio.h>
19213 #$i_stdlib I_STDLIB
19214 #ifdef I_STDLIB
19215 #include <stdlib.h>
19216 #endif
19217 #include <db.h>
19218 int main(int argc, char *argv[])
19219 {
19220 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19221     int Major, Minor, Patch ;
19222     unsigned long Version ;
19223     (void)db_version(&Major, &Minor, &Patch) ;
19224     if (argc == 2) {
19225         printf("%d %d %d %d %d %d\n",
19226                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19227                Major, Minor, Patch);
19228         exit(0);
19229     }
19230     printf("You have Berkeley DB Version 2 or greater.\n");
19231
19232     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19233                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19234     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19235                 Major, Minor, Patch) ;
19236
19237     /* check that db.h & libdb are compatible */
19238     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19239         printf("db.h and libdb are incompatible.\n") ;
19240         exit(3);
19241     }
19242
19243     printf("db.h and libdb are compatible.\n") ;
19244
19245     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19246                 + DB_VERSION_PATCH ;
19247
19248     /* needs to be >= 2.3.4 */
19249     if (Version < 2003004) {
19250     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19251         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19252         exit(2);
19253     }
19254
19255     exit(0);
19256 #else
19257 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19258     if (argc == 2) {
19259         printf("1 0 0\n");
19260         exit(0);
19261     }
19262     printf("You have Berkeley DB Version 1.\n");
19263     exit(0);    /* DB version < 2: the coast is clear. */
19264 #else
19265     exit(1);    /* <db.h> not Berkeley DB? */
19266 #endif
19267 #endif
19268 }
19269 EOCP
19270         set try
19271         if eval $compile_ok && $run ./try; then
19272                 echo 'Looks OK.' >&4
19273                 set `$run ./try 1`
19274                 db_version_major=$1
19275                 db_version_minor=$2
19276                 db_version_patch=$3
19277         else
19278                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19279                 i_db=$undef
19280                 case " $libs " in
19281                 *"-ldb "*)
19282                         : Remove db from list of libraries to use
19283                         echo "Removing unusable -ldb from library list" >&4
19284                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19285                         shift
19286                         libs="$*"
19287                         echo "libs = $libs" >&4
19288                         ;;
19289                 esac
19290         fi
19291         $rm_try
19292         ;;
19293 esac
19294
19295 case "$i_db" in
19296 define)
19297         : Check the return type needed for hash
19298         echo " "
19299         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19300         $cat >try.c <<EOCP
19301 #$d_const HASCONST
19302 #ifndef HASCONST
19303 #define const
19304 #endif
19305 #include <sys/types.h>
19306 #include <db.h>
19307
19308 #ifndef DB_VERSION_MAJOR
19309 u_int32_t hash_cb (ptr, size)
19310 const void *ptr;
19311 size_t size;
19312 {
19313 }
19314 HASHINFO info;
19315 int main()
19316 {
19317         info.hash = hash_cb;
19318 }
19319 #endif
19320 EOCP
19321         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19322                 if $contains warning try.out >>/dev/null 2>&1 ; then
19323                         db_hashtype='int'
19324                 else
19325                         db_hashtype='u_int32_t'
19326                 fi
19327         else
19328                 : XXX Maybe we should just give up here.
19329                 db_hashtype=u_int32_t
19330                 $cat try.out >&4
19331                 echo "Help:  I can't seem to compile the db test program." >&4
19332                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19333         fi
19334         $rm_try
19335         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19336         ;;
19337 *)      db_hashtype=u_int32_t
19338         ;;
19339 esac
19340 case "$i_db" in
19341 define)
19342         : Check the return type needed for prefix
19343         echo " "
19344         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19345         cat >try.c <<EOCP
19346 #$d_const HASCONST
19347 #ifndef HASCONST
19348 #define const
19349 #endif
19350 #include <sys/types.h>
19351 #include <db.h>
19352
19353 #ifndef DB_VERSION_MAJOR
19354 size_t prefix_cb (key1, key2)
19355 const DBT *key1;
19356 const DBT *key2;
19357 {
19358 }
19359 BTREEINFO info;
19360 int main()
19361 {
19362         info.prefix = prefix_cb;
19363 }
19364 #endif
19365 EOCP
19366         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19367                 if $contains warning try.out >>/dev/null 2>&1 ; then
19368                         db_prefixtype='int'
19369                 else
19370                         db_prefixtype='size_t'
19371                 fi
19372         else
19373                 db_prefixtype='size_t'
19374                 : XXX Maybe we should just give up here.
19375                 $cat try.out >&4
19376                 echo "Help:  I can't seem to compile the db test program." >&4
19377                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19378         fi
19379         $rm_try
19380         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19381         ;;
19382 *)      db_prefixtype='size_t'
19383         ;;
19384 esac
19385
19386 : How can we generate normalized random numbers ?
19387 echo " "
19388 echo "Looking for a random number function..." >&4
19389 case "$randfunc" in
19390 '')
19391         if set drand48 val -f; eval $csym; $val; then
19392                 dflt="drand48"
19393                 echo "Good, found drand48()." >&4
19394         elif set random val -f; eval $csym; $val; then
19395                 dflt="random"
19396                 echo "OK, found random()." >&4
19397         else
19398                 dflt="rand"
19399                 echo "Yick, looks like I have to use rand()." >&4
19400         fi
19401         echo " "
19402         ;;
19403 *)
19404         dflt="$randfunc"
19405         ;;
19406 esac
19407 cont=true
19408
19409 case "$ccflags" in
19410 *-Dmy_rand=*|*-Dmy_srand=*)
19411         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19412         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19413         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19414         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19415         ;;
19416 esac
19417
19418 while $test "$cont"; do
19419         rp="Use which function to generate random numbers?"
19420         . ./myread
19421         if $test "$ans" = "$dflt"; then
19422                 : null
19423         else
19424                 randbits=''
19425         fi
19426         randfunc="$ans"
19427         if set $ans val -f; eval $csym; $val; then
19428                 cont=''
19429         else
19430                 dflt=y
19431                 rp="I cannot find function $ans. Use that name anyway?"
19432                 . ./myread
19433                 dflt=rand
19434                 case "$ans" in
19435                         [yY]*) cont='';;
19436                 esac
19437         fi
19438         case "$cont" in
19439         '')
19440                 case "$randfunc" in
19441                 drand48)
19442                         drand01="drand48()"
19443                         seedfunc="srand48"
19444                         randbits=48
19445                         randseedtype=long
19446                         ;;
19447                 rand|random)
19448                         case "$randbits" in
19449                         '')
19450 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19451                                 $cat >try.c <<EOCP
19452 #$i_unistd I_UNISTD
19453 #$i_stdlib I_STDLIB
19454 #include <stdio.h>
19455 #ifdef I_UNISTD
19456 #  include <unistd.h>
19457 #endif
19458 #ifdef I_STDLIB
19459 #  include <stdlib.h>
19460 #endif
19461 int main()
19462 {
19463         int i;
19464         unsigned long tmp;
19465         unsigned long max = 0L;
19466
19467         for (i = 1000; i; i--) {
19468                 tmp = (unsigned long) $randfunc();
19469                 if (tmp > max) max = tmp;
19470         }
19471         for (i = 0; max; i++)
19472                 max /= 2;
19473         printf("%d\n",i);
19474 }
19475 EOCP
19476                                 set try
19477                                 if eval $compile_ok; then
19478                                         dflt=`try`
19479                                 else
19480                                         dflt='?'
19481                                         echo "(I can't seem to compile the test program...)"
19482                                 fi
19483                                 ;;
19484                         *)
19485                                 dflt="$randbits"
19486                                 ;;
19487                         esac
19488                         rp="How many bits does your $randfunc() function produce?"
19489                         . ./myread
19490                         randbits="$ans"
19491                         $rm_try
19492                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19493                         seedfunc="s$randfunc"
19494                         randseedtype=unsigned
19495                         ;;
19496                 *)
19497                         dflt="31"
19498                         rp="How many bits does your $randfunc() function produce?"
19499                         . ./myread
19500                         randbits="$ans"
19501                         seedfunc="s$randfunc"
19502                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19503                         if set $seedfunc val -f; eval $csym; $val; then
19504                                 echo "(Using $seedfunc() to seed random generator)"
19505                         else
19506                                 echo "(Warning: no $seedfunc() to seed random generator)"
19507                                 seedfunc=rand
19508                         fi
19509                         randseedtype=unsigned
19510                         ;;
19511                 esac
19512                 ;;
19513         esac
19514 done
19515
19516 : Determine if this is an EBCDIC system
19517 echo " "
19518 echo "Determining whether or not we are on an EBCDIC system..." >&4
19519 $cat >try.c <<'EOM'
19520 int main()
19521 {
19522   if ('M'==0xd4) return 0;
19523   return 1;
19524 }
19525 EOM
19526
19527 val=$undef
19528 set try
19529 if eval $compile_ok; then
19530         if $run ./try; then
19531                 echo "You seem to speak EBCDIC." >&4
19532                 val="$define"
19533         else
19534                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19535         fi
19536 else
19537         echo "I'm unable to compile the test program." >&4
19538         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19539 fi
19540 $rm_try
19541 set ebcdic
19542 eval $setvar
19543
19544 : Check how to flush
19545 echo " "
19546 $cat >&4 <<EOM
19547 Checking how to flush all pending stdio output...
19548 EOM
19549 # I only know how to find the first 32 possibly open files on SunOS.
19550 # See also hints/sunos_4_1.sh and util.c  --AD
19551 case "$osname" in
19552 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19553 esac
19554 $cat >>try.c <<EOCP
19555 #include <stdio.h>
19556 #$i_stdlib I_STDLIB
19557 #ifdef I_STDLIB
19558 #include <stdlib.h>
19559 #endif
19560 #$i_unistd I_UNISTD
19561 #ifdef I_UNISTD
19562 # include <unistd.h>
19563 #endif
19564 #$d_sysconf HAS_SYSCONF
19565 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19566 #ifdef HAS_STDIO_STREAM_ARRAY
19567 # define STDIO_STREAM_ARRAY $stdio_stream_array
19568 #endif
19569 int main() {
19570   FILE* p;
19571   unlink("try.out");
19572   p = fopen("try.out", "w");
19573 #ifdef TRY_FPUTC
19574   fputc('x', p);
19575 #else
19576 # ifdef TRY_FPRINTF
19577   fprintf(p, "x");
19578 # endif
19579 #endif
19580 #ifdef TRY_FFLUSH_NULL
19581   fflush(NULL);
19582 #endif
19583 #ifdef TRY_FFLUSH_ALL
19584   {
19585     long open_max = -1;
19586 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19587     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19588 # else
19589 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19590     open_max = sysconf(_SC_OPEN_MAX);
19591 #  else
19592 #   ifdef FOPEN_MAX
19593     open_max = FOPEN_MAX;
19594 #   else
19595 #    ifdef OPEN_MAX
19596     open_max = OPEN_MAX;
19597 #    else
19598 #     ifdef _NFILE
19599     open_max = _NFILE;
19600 #     endif
19601 #    endif
19602 #   endif
19603 #  endif
19604 # endif
19605 # ifdef HAS_STDIO_STREAM_ARRAY
19606     if (open_max > 0) {
19607       long i;
19608       for (i = 0; i < open_max; i++)
19609             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19610                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19611                 STDIO_STREAM_ARRAY[i]._flag)
19612                 fflush(&STDIO_STREAM_ARRAY[i]);
19613     }
19614   }
19615 # endif
19616 #endif
19617   _exit(42);
19618 }
19619 EOCP
19620 : first we have to find out how _not_ to flush
19621 $to try.c
19622 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19623     output=''
19624     set try -DTRY_FPUTC
19625     if eval $compile; then
19626             $run ./try 2>/dev/null
19627             code="$?"
19628             $from try.out
19629             if $test ! -s try.out -a "X$code" = X42; then
19630                 output=-DTRY_FPUTC
19631             fi
19632     fi
19633     case "$output" in
19634     '')
19635             set try -DTRY_FPRINTF
19636             if eval $compile; then
19637                     $run ./try 2>/dev/null
19638                     code="$?"
19639                     $from try.out
19640                     if $test ! -s try.out -a "X$code" = X42; then
19641                         output=-DTRY_FPRINTF
19642                     fi
19643             fi
19644         ;;
19645     esac
19646 fi
19647 : check for fflush NULL behaviour
19648 case "$fflushNULL" in
19649 '')     set try -DTRY_FFLUSH_NULL $output
19650         if eval $compile; then
19651                 $run ./try 2>/dev/null
19652                 code="$?"
19653                 $from try.out
19654                 if $test -s try.out -a "X$code" = X42; then
19655                         fflushNULL="`$cat try.out`"
19656                 else
19657                         if $test "X$code" != X42; then
19658                                 $cat >&4 <<EOM
19659 (If this test failed, don't worry, we'll try another method shortly.)
19660 EOM
19661                         fi
19662                 fi
19663         fi
19664         $rm -f core try.core core.try.*
19665         case "$fflushNULL" in
19666         x)      $cat >&4 <<EOM
19667 Your fflush(NULL) works okay for output streams.
19668 Let's see if it clobbers input pipes...
19669 EOM
19670 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19671 # bug that improperly flushes the input end of pipes.  So we avoid the
19672 # autoflush on fork/system/exec support for now. :-(
19673 $cat >tryp.c <<EOCP
19674 #include <stdio.h>
19675 int
19676 main(int argc, char **argv)
19677 {
19678     char buf[1024];
19679     int i;
19680     char *bp = buf;
19681     while (1) {
19682         while ((i = getc(stdin)) != -1
19683                && (*bp++ = i) != '\n'
19684                && bp < &buf[1024])
19685         /* DO NOTHING */ ;
19686         *bp = '\0';
19687         fprintf(stdout, "%s", buf);
19688         fflush(NULL);
19689         if (i == -1)
19690             return 0;
19691         bp = buf;
19692     }
19693 }
19694 EOCP
19695                 fflushNULL="$define"
19696                 set tryp
19697                 if eval $compile; then
19698                     $rm -f tryp.out
19699                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19700                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19701                        $cat >&4 <<EOM
19702 fflush(NULL) seems to behave okay with input streams.
19703 EOM
19704                         fflushNULL="$define"
19705                     else
19706                         $cat >&4 <<EOM
19707 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19708 EOM
19709                         fflushNULL="$undef"
19710                     fi
19711                 fi
19712                 $rm -f core tryp.c tryp.core core.tryp.*
19713                 ;;
19714         '')     $cat >&4 <<EOM
19715 Your fflush(NULL) isn't working (contrary to ANSI C).
19716 EOM
19717                 fflushNULL="$undef"
19718                 ;;
19719         *)      $cat >&4 <<EOM
19720 Cannot figure out whether your fflush(NULL) works or not.
19721 I'm assuming it doesn't (contrary to ANSI C).
19722 EOM
19723                 fflushNULL="$undef"
19724                 ;;
19725         esac
19726         ;;
19727 $define|true|[yY]*)
19728         fflushNULL="$define"
19729         ;;
19730 *)
19731         fflushNULL="$undef"
19732         ;;
19733 esac
19734 : check explicit looping only if NULL did not work, and if the pipe
19735 : bug does not show up on an explicit flush too
19736 case "$fflushNULL" in
19737 "$undef")
19738         $cat >tryp.c <<EOCP
19739 #include <stdio.h>
19740 int
19741 main(int argc, char **argv)
19742 {
19743     char buf[1024];
19744     int i;
19745     char *bp = buf;
19746     while (1) {
19747         while ((i = getc(stdin)) != -1
19748                && (*bp++ = i) != '\n'
19749                && bp < &buf[1024])
19750         /* DO NOTHING */ ;
19751         *bp = '\0';
19752         fprintf(stdout, "%s", buf);
19753         fflush(stdin);
19754         if (i == -1)
19755             return 0;
19756         bp = buf;
19757     }
19758 }
19759 EOCP
19760         set tryp
19761         if eval $compile; then
19762             $rm -f tryp.out
19763             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19764             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19765                $cat >&4 <<EOM
19766 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19767 EOM
19768                 : now check for fflushall behaviour
19769                 case "$fflushall" in
19770                 '')     set try -DTRY_FFLUSH_ALL $output
19771                         if eval $compile; then
19772                                 $cat >&4 <<EOM
19773 (Now testing the other method--but note that this also may fail.)
19774 EOM
19775                                 $run ./try 2>/dev/null
19776                                 code=$?
19777                                 $from try.out
19778                                 if $test -s try.out -a "X$code" = X42; then
19779                                         fflushall="`$cat try.out`"
19780                                 fi
19781                         fi
19782                         $rm_try
19783                         case "$fflushall" in
19784                         x)      $cat >&4 <<EOM
19785 Whew. Flushing explicitly all the stdio streams works.
19786 EOM
19787                                 fflushall="$define"
19788                                 ;;
19789                         '')     $cat >&4 <<EOM
19790 Sigh. Flushing explicitly all the stdio streams doesn't work.
19791 EOM
19792                                 fflushall="$undef"
19793                                 ;;
19794                         *)      $cat >&4 <<EOM
19795 Cannot figure out whether flushing stdio streams explicitly works or not.
19796 I'm assuming it doesn't.
19797 EOM
19798                                 fflushall="$undef"
19799                                 ;;
19800                         esac
19801                         ;;
19802                 "$define"|true|[yY]*)
19803                         fflushall="$define"
19804                         ;;
19805                 *)
19806                         fflushall="$undef"
19807                         ;;
19808                 esac
19809             else
19810                 $cat >&4 <<EOM
19811 All is futile.  Even fflush(stdin) clobbers input pipes!
19812 EOM
19813                 fflushall="$undef"
19814             fi
19815         else
19816             fflushall="$undef"
19817         fi
19818         $rm -f core tryp.c tryp.core core.tryp.*
19819         ;;
19820 *)      fflushall="$undef"
19821         ;;
19822 esac
19823
19824 case "$fflushNULL$fflushall" in
19825 undefundef)
19826         $cat <<EOM
19827 OK, I give up.  I cannot figure out how to flush pending stdio output.
19828 We won't be flushing handles at all before fork/exec/popen.
19829 EOM
19830         ;;
19831 esac
19832 $rm_try tryp
19833
19834 : Store the full pathname to the ar program for use in the C program
19835 : Respect a hint or command line value for full_ar.
19836 case "$full_ar" in
19837 '') full_ar=$ar ;;
19838 esac
19839
19840 : Store the full pathname to the sed program for use in the C program
19841 full_sed=$sed
19842
19843 : see what type gids are declared as in the kernel
19844 echo " "
19845 echo "Looking for the type for group ids returned by getgid()."
19846 set gid_t gidtype xxx stdio.h sys/types.h
19847 eval $typedef
19848 case "$gidtype" in
19849 xxx)
19850         xxx=`./findhdr sys/user.h`
19851         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19852         case $1 in
19853         unsigned) dflt="$1 $2" ;;
19854         *) dflt="$1" ;;
19855         esac
19856         ;;
19857 *) dflt="$gidtype";;
19858 esac
19859 case "$gidtype" in
19860 gid_t) echo "gid_t found." ;;
19861 *)      rp="What is the type for group ids returned by getgid()?"
19862         . ./myread
19863         gidtype="$ans"
19864         ;;
19865 esac
19866
19867 : Check the size of GID
19868 echo " "
19869 case "$gidtype" in
19870 *_t) zzz="$gidtype"     ;;
19871 *)   zzz="gid"          ;;
19872 esac
19873 echo "Checking the size of $zzz..." >&4
19874 cat > try.c <<EOCP
19875 #include <sys/types.h>
19876 #include <stdio.h>
19877 #$i_stdlib I_STDLIB
19878 #ifdef I_STDLIB
19879 #include <stdlib.h>
19880 #endif
19881 int main() {
19882     printf("%d\n", (int)sizeof($gidtype));
19883     exit(0);
19884 }
19885 EOCP
19886 set try
19887 if eval $compile_ok; then
19888         yyy=`$run ./try`
19889         case "$yyy" in
19890         '')     gidsize=4
19891                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19892                 ;;
19893         *)      gidsize=$yyy
19894                 echo "Your $zzz is $gidsize bytes long."
19895                 ;;
19896         esac
19897 else
19898         gidsize=4
19899         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19900 fi
19901
19902
19903 : Check if GID is signed
19904 echo " "
19905 case "$gidtype" in
19906 *_t) zzz="$gidtype"     ;;
19907 *)   zzz="gid"          ;;
19908 esac
19909 echo "Checking the sign of $zzz..." >&4
19910 cat > try.c <<EOCP
19911 #include <sys/types.h>
19912 #include <stdio.h>
19913 int main() {
19914         $gidtype foo = -1;
19915         if (foo < 0)
19916                 printf("-1\n");
19917         else
19918                 printf("1\n");
19919 }
19920 EOCP
19921 set try
19922 if eval $compile; then
19923         yyy=`$run ./try`
19924         case "$yyy" in
19925         '')     gidsign=1
19926                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19927                 ;;
19928         *)      gidsign=$yyy
19929                 case "$gidsign" in
19930                  1) echo "Your $zzz is unsigned." ;;
19931                 -1) echo "Your $zzz is signed."   ;;
19932                 esac
19933                 ;;
19934         esac
19935 else
19936         gidsign=1
19937         echo "(I can't compile the test program--guessing unsigned.)" >&4
19938 fi
19939
19940
19941 : Check 64bit sizes
19942 echo " "
19943
19944 if $test X"$quadtype" != X; then
19945
19946 echo "Checking how to print 64-bit integers..." >&4
19947
19948 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19949         $cat >try.c <<'EOCP'
19950 #include <sys/types.h>
19951 #include <stdio.h>
19952 int main() {
19953   int q = 12345678901;
19954   printf("%ld\n", q);
19955 }
19956 EOCP
19957         set try
19958         if eval $compile; then
19959                 yyy=`$run ./try`
19960                 case "$yyy" in
19961                 12345678901)
19962                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19963                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19964                         echo "We will use %d."
19965                         ;;
19966                 esac
19967         fi
19968 fi
19969
19970 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19971         $cat >try.c <<'EOCP'
19972 #include <sys/types.h>
19973 #include <stdio.h>
19974 int main() {
19975   long q = 12345678901;
19976   printf("%ld\n", q);
19977 }
19978 EOCP
19979         set try
19980         if eval $compile; then
19981                 yyy=`$run ./try`
19982                 case "$yyy" in
19983                 12345678901)
19984                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19985                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19986                         echo "We will use %ld."
19987                         ;;
19988                 esac
19989         fi
19990 fi
19991
19992 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19993         $cat >try.c <<'EOCP'
19994 #include <sys/types.h>
19995 #include <inttypes.h>
19996 #include <stdio.h>
19997 int main() {
19998   int64_t q = 12345678901;
19999   printf("%" PRId64 "\n", q);
20000 }
20001 EOCP
20002         set try
20003         if eval $compile; then
20004                 yyy=`$run ./try`
20005                 case "$yyy" in
20006                 12345678901)
20007                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20008                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20009                         echo "We will use the C9X style."
20010                         ;;
20011                 esac
20012         fi
20013 fi
20014
20015 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20016         $cat >try.c <<EOCP
20017 #include <sys/types.h>
20018 #include <stdio.h>
20019 int main() {
20020   $quadtype q = 12345678901;
20021   printf("%Ld\n", q);
20022 }
20023 EOCP
20024         set try
20025         if eval $compile; then
20026                 yyy=`$run ./try`
20027                 case "$yyy" in
20028                 12345678901)
20029                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20030                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20031                         echo "We will use %Ld."
20032                         ;;
20033                 esac
20034         fi
20035 fi
20036
20037 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20038         $cat >try.c <<'EOCP'
20039 #include <sys/types.h>
20040 #include <stdio.h>
20041 int main() {
20042   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20043   printf("%lld\n", q);
20044 }
20045 EOCP
20046         set try
20047         if eval $compile; then
20048                 yyy=`$run ./try`
20049                 case "$yyy" in
20050                 12345678901)
20051                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20052                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20053                         echo "We will use the %lld style."
20054                         ;;
20055                 esac
20056         fi
20057 fi
20058
20059 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20060         $cat >try.c <<EOCP
20061 #include <sys/types.h>
20062 #include <stdio.h>
20063 int main() {
20064   $quadtype q = 12345678901;
20065   printf("%qd\n", q);
20066 }
20067 EOCP
20068         set try
20069         if eval $compile; then
20070                 yyy=`$run ./try`
20071                 case "$yyy" in
20072                 12345678901)
20073                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20074                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20075                         echo "We will use %qd."
20076                         ;;
20077                 esac
20078         fi
20079 fi
20080
20081 if $test X"$sPRId64" = X; then
20082         echo "Cannot figure out how to print 64-bit integers." >&4
20083 fi
20084 $rm_try
20085
20086 fi
20087
20088 case "$sPRId64" in
20089 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20090         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20091         ;;
20092 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20093         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20094         ;;
20095 esac
20096
20097 : Check format strings for internal types
20098 echo " "
20099 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20100
20101 if $test X"$ivsize" = X8; then
20102         ivdformat="$sPRId64"
20103         uvuformat="$sPRIu64"
20104         uvoformat="$sPRIo64"
20105         uvxformat="$sPRIx64"
20106         uvXUformat="$sPRIXU64"
20107 else
20108         if $test X"$ivsize" = X"$longsize"; then
20109                 ivdformat='"ld"'
20110                 uvuformat='"lu"'
20111                 uvoformat='"lo"'
20112                 uvxformat='"lx"'
20113                 uvXUformat='"lX"'
20114         else
20115                 if $test X"$ivsize" = X"$intsize"; then
20116                         ivdformat='"d"'
20117                         uvuformat='"u"'
20118                         uvoformat='"o"'
20119                         uvxformat='"x"'
20120                         uvXUformat='"X"'
20121                 else
20122                         : far out
20123                         if $test X"$ivsize" = X"$shortsize"; then
20124                                 ivdformat='"hd"'
20125                                 uvuformat='"hu"'
20126                                 uvoformat='"ho"'
20127                                 uvxformat='"hx"'
20128                                 uvXUformat='"hX"'
20129                         fi
20130                 fi
20131         fi
20132 fi
20133
20134 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20135         nveformat="$sPRIeldbl"
20136         nvfformat="$sPRIfldbl"
20137         nvgformat="$sPRIgldbl"
20138         nvEUformat="$sPRIEUldbl"
20139         nvFUformat="$sPRIFUldbl"
20140         nvGUformat="$sPRIGUldbl"
20141 else
20142         nveformat='"e"'
20143         nvfformat='"f"'
20144         nvgformat='"g"'
20145         nvEUformat='"E"'
20146         nvFUformat='"F"'
20147         nvGUformat='"G"'
20148 fi
20149
20150 case "$ivdformat" in
20151 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20152     exit 1
20153     ;;
20154 esac
20155
20156 : Check format string for GID
20157
20158 echo " "
20159 $echo "Checking the format string to be used for gids..." >&4
20160
20161 case "$gidsign" in
20162 -1)     if $test X"$gidsize" = X"$ivsize"; then
20163                 gidformat="$ivdformat"
20164         else
20165                 if $test X"$gidsize" = X"$longsize"; then
20166                         gidformat='"ld"'
20167                 else
20168                         if $test X"$gidsize" = X"$intsize"; then
20169                                 gidformat='"d"'
20170                         else
20171                                 if $test X"$gidsize" = X"$shortsize"; then
20172                                         gidformat='"hd"'
20173                                 fi
20174                         fi
20175                 fi
20176         fi
20177         ;;
20178 *)      if $test X"$gidsize" = X"$uvsize"; then
20179                 gidformat="$uvuformat"
20180         else
20181                 if $test X"$gidsize" = X"$longsize"; then
20182                         gidformat='"lu"'
20183                 else
20184                         if $test X"$gidsize" = X"$intsize"; then
20185                                 gidformat='"u"'
20186                         else
20187                                 if $test X"$gidsize" = X"$shortsize"; then
20188                                         gidformat='"hu"'
20189                                 fi
20190                         fi
20191                 fi
20192         fi
20193         ;;
20194 esac
20195
20196 : see if getgroups exists
20197 set getgroups d_getgrps
20198 eval $inlibc
20199
20200 : see if setgroups exists
20201 set setgroups d_setgrps
20202 eval $inlibc
20203
20204 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20205 echo " "
20206 case "$d_getgrps$d_setgrps" in
20207 *define*)
20208         case "$groupstype" in
20209         '') dflt="$gidtype" ;;
20210         *)  dflt="$groupstype" ;;
20211         esac
20212         $cat <<EOM
20213 What type of pointer is the second argument to getgroups() and setgroups()?
20214 Usually this is the same as group ids, $gidtype, but not always.
20215
20216 EOM
20217         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20218         . ./myread
20219         groupstype="$ans"
20220         ;;
20221 *)  groupstype="$gidtype";;
20222 esac
20223
20224 : MAD = Misc Attribute Definition
20225
20226 if $test $patchlevel -lt 9; then
20227 : MAD is not available in 5.8.x or earlier.
20228     ans=n;
20229 else
20230     case "$mad" in
20231     $define|true|[yY]*) dflt='y' ;;
20232     *)                  dflt='n' ;;
20233     esac
20234     cat <<EOM
20235
20236 Would you like to build with Misc Attribute Decoration? This is development
20237 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20238 overhead on the interpreter.
20239
20240 If this doesn't make any sense to you, just accept the default '$dflt'.
20241 EOM
20242     rp='Build Perl with MAD?'
20243     . ./myread
20244 fi
20245 case "$ans" in
20246 y|Y)    val="$define"
20247         madlyh='madly.h madly.act madly.tab'
20248         madlysrc='madly.c'
20249         madlyobj="madly$_o" ;;
20250 *)      val="$undef"
20251         madlyh=''
20252         madlysrc=''
20253         madlyobj='' ;;
20254 esac
20255 set mad
20256 eval $setvar
20257
20258 : check whether make sets MAKE
20259 echo " "
20260 echo "Checking if your $make program sets \$(MAKE)..." >&4
20261 case "$make_set_make" in
20262 '')
20263         $sed 's/^X //' > testmake.mak << 'EOF'
20264 Xall:
20265 X       @echo 'maketemp="$(MAKE)"'
20266 EOF
20267         case "`$make -f testmake.mak 2>/dev/null`" in
20268         *maketemp=*) make_set_make='#' ;;
20269         *)      make_set_make="MAKE=$make" ;;
20270         esac
20271         $rm -f testmake.mak
20272         ;;
20273 esac
20274 case "$make_set_make" in
20275 '#') echo "Yup, it does.";;
20276 *) echo "Nope, it doesn't.";;
20277 esac
20278
20279 : see what type is used for mode_t
20280 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20281 set mode_t modetype int stdio.h sys/types.h
20282 eval $typedef_ask
20283
20284 : see if we need va_copy
20285 echo " "
20286 case "$i_stdarg" in
20287 "$define")
20288         $cat >try.c <<EOCP
20289 #include <stdarg.h>
20290 #include <stdio.h>
20291 #$i_stdlib I_STDLIB
20292 #ifdef I_STDLIB
20293 #include <stdlib.h>
20294 #endif
20295 #include <signal.h>
20296
20297 int
20298 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20299 {
20300   return vfprintf(f, fmt, *valp);
20301 }
20302
20303 int
20304 myvfprintf(FILE *f, const  char *fmt, va_list val)
20305 {
20306   return ivfprintf(f, fmt, &val);
20307 }
20308
20309 int
20310 myprintf(char *fmt, ...)
20311 {
20312   va_list val;
20313   va_start(val, fmt);
20314   return myvfprintf(stdout, fmt, val);
20315 }
20316
20317 int
20318 main(int ac, char **av)
20319 {
20320   signal(SIGSEGV, exit);
20321
20322   myprintf("%s%cs all right, then\n", "that", '\'');
20323   exit(0);
20324 }
20325 EOCP
20326         set try
20327         if eval $compile && $run ./try 2>&1 >/dev/null; then
20328                 case "`$run ./try`" in
20329                 "that's all right, then")
20330                         okay=yes
20331                         ;;
20332                 esac
20333         fi
20334         case "$okay" in
20335         yes)    echo "It seems that you don't need va_copy()." >&4
20336                 need_va_copy="$undef"
20337                 ;;
20338         *)      echo "It seems that va_copy() or similar will be needed." >&4
20339                 need_va_copy="$define"
20340                 ;;
20341         esac
20342         $rm_try
20343         ;;
20344 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20345         ;;
20346 esac
20347
20348 : see what type is used for size_t
20349 rp="What is the type used for the length parameter for string functions?"
20350 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20351 eval $typedef_ask
20352
20353 : check for type of arguments to gethostbyaddr. 
20354 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20355         case "$d_gethbyaddr" in
20356         $define)
20357                 $cat <<EOM
20358
20359 Checking to see what type of arguments are accepted by gethostbyaddr().
20360 EOM
20361                 hdrs="$define sys/types.h
20362                         $d_socket sys/socket.h 
20363                         $i_niin netinet/in.h 
20364                         $i_netdb netdb.h
20365                         $i_unistd unistd.h"
20366                 : The first arg can 'char *' or 'void *'
20367                 : The second arg is some of integral type
20368                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20369                         for yyy in size_t long int; do
20370                                 case "$netdb_host_type" in
20371                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20372                                         if ./protochk "$try" $hdrs; then
20373                                                 echo "Your system accepts $xxx for the first arg."
20374                                                 echo "...and $yyy for the second arg."
20375                                                 netdb_host_type="$xxx"
20376                                                 netdb_hlen_type="$yyy"
20377                                         fi
20378                                         ;;
20379                                 esac
20380                         done
20381                 done
20382                 : In case none of those worked, prompt the user.
20383                 case "$netdb_host_type" in
20384                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20385                         dflt='char *'
20386                         . ./myread
20387                         netdb_host_type=$ans
20388                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20389                         dflt="$sizetype"
20390                         . ./myread
20391                         netdb_hlen_type=$ans
20392                         ;;
20393                 esac
20394                 ;;
20395         *)      : no gethostbyaddr, so pick harmless defaults
20396                 netdb_host_type='char *'
20397                 netdb_hlen_type="$sizetype"
20398                 ;;
20399         esac
20400         # Remove the "const" if needed. -- but then we'll have a 
20401         # prototype clash!
20402         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20403 fi
20404
20405 : check for type of argument to gethostbyname. 
20406 if test "X$netdb_name_type" = X ; then
20407         case "$d_gethbyname" in
20408         $define)
20409                 $cat <<EOM
20410
20411 Checking to see what type of argument is accepted by gethostbyname().
20412 EOM
20413                 hdrs="$define sys/types.h
20414                         $d_socket sys/socket.h 
20415                         $i_niin netinet/in.h 
20416                         $i_netdb netdb.h
20417                         $i_unistd unistd.h"
20418                 for xxx in "const char *" "char *"; do
20419                         case "$netdb_name_type" in
20420                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20421                                 if ./protochk "$try" $hdrs; then
20422                                         echo "Your system accepts $xxx."
20423                                         netdb_name_type="$xxx"
20424                                 fi
20425                                 ;;
20426                         esac
20427                 done
20428                 : In case none of those worked, prompt the user.
20429                 case "$netdb_name_type" in
20430                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20431                         dflt='char *'
20432                         . ./myread
20433                         netdb_name_type=$ans
20434                         ;;
20435                 esac
20436                 ;;
20437         *)      : no gethostbyname, so pick harmless default
20438                 netdb_name_type='char *'
20439                 ;;
20440         esac
20441 fi
20442
20443 : check for type of 1st argument to getnetbyaddr. 
20444 if test "X$netdb_net_type" = X ; then
20445         case "$d_getnbyaddr" in
20446         $define)
20447                 $cat <<EOM
20448
20449 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20450 EOM
20451                 hdrs="$define sys/types.h
20452                         $d_socket sys/socket.h 
20453                         $i_niin netinet/in.h 
20454                         $i_netdb netdb.h
20455                         $i_unistd unistd.h"
20456                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20457                         case "$netdb_net_type" in
20458                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20459                                 if ./protochk "$try" $hdrs; then
20460                                         echo "Your system accepts $xxx."
20461                                         netdb_net_type="$xxx"
20462                                 fi
20463                                 ;;
20464                         esac
20465                 done
20466                 : In case none of those worked, prompt the user.
20467                 case "$netdb_net_type" in
20468                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20469                         dflt='long'
20470                         . ./myread
20471                         netdb_net_type=$ans
20472                         ;;
20473                 esac
20474                 ;;
20475         *)      : no getnetbyaddr, so pick harmless default
20476                 netdb_net_type='long'
20477                 ;;
20478         esac
20479 fi
20480 : locate the preferred pager for this system
20481 fn=f/
20482 case "$pager" in
20483 '')
20484         dflt=''
20485         case "$pg" in
20486         /*) dflt=$pg;;
20487         [a-zA-Z]:/*) dflt=$pg;;
20488         esac
20489         case "$more" in
20490         /*) dflt=$more;;
20491         [a-zA-Z]:/*) dflt=$more;;
20492         esac
20493         case "$less" in
20494         /*) dflt=$less;;
20495         [a-zA-Z]:/*) dflt=$less;;
20496         esac
20497         case "$dflt" in
20498         '') dflt=/usr/ucb/more;;
20499         esac
20500         ;;
20501 *)      dflt="$pager"
20502         ;;
20503 esac
20504 fn="f/($dflt)"
20505 echo " "
20506 rp='What pager is used on your system?'
20507 . ./getfile
20508 pager="$ans"
20509
20510 : see what type pids are declared as in the kernel
20511 rp="What is the type of process ids on this system?"
20512 set pid_t pidtype int stdio.h sys/types.h
20513 eval $typedef_ask
20514
20515 : see if ar generates random libraries by itself
20516 echo " "
20517 echo "Checking how to generate random libraries on your machine..." >&4
20518 echo 'int bar1() { return bar2(); }' > bar1.c
20519 echo 'int bar2() { return 2; }' > bar2.c
20520 $cat > foo.c <<EOP
20521 #$i_stdlib I_STDLIB
20522 #ifdef I_STDLIB
20523 #include <stdlib.h>
20524 #endif
20525 int main() { printf("%d\n", bar1()); exit(0); }
20526 EOP
20527 $cc $ccflags -c bar1.c >/dev/null 2>&1
20528 $cc $ccflags -c bar2.c >/dev/null 2>&1
20529 $cc $ccflags -c foo.c >/dev/null 2>&1
20530 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20531 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20532         $run ./foobar >/dev/null 2>&1; then
20533         echo "$ar appears to generate random libraries itself."
20534         orderlib=false
20535         if [ "X$ranlib" = "X" ]; then
20536             ranlib=":"
20537         fi
20538 elif $ar s bar$_a >/dev/null 2>&1 &&
20539         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20540         $run ./foobar >/dev/null 2>&1; then
20541                 echo "a table of contents needs to be added with '$ar s'."
20542                 orderlib=false
20543                 ranlib="$ar s"
20544 elif $ar ts bar$_a >/dev/null 2>&1 &&
20545         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20546         $run ./foobar >/dev/null 2>&1; then
20547                 echo "a table of contents needs to be added with '$ar ts'."
20548                 orderlib=false
20549                 ranlib="$ar ts"
20550 else
20551         case "$ranlib" in
20552         :) ranlib='';;
20553         '')
20554                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20555                 $test -f $ranlib || ranlib=''
20556                 ;;
20557         esac
20558         if $test -n "$ranlib"; then
20559                 echo "your system has '$ranlib'; we'll use that."
20560                 orderlib=false
20561         else
20562                 echo "your system doesn't seem to support random libraries"
20563                 echo "so we'll use lorder and tsort to order the libraries."
20564                 orderlib=true
20565                 ranlib=":"
20566         fi
20567 fi
20568 $rm -f foo* bar*
20569
20570 : see if this is a values.h system
20571 set values.h i_values
20572 eval $inhdr
20573
20574 : Check the max offset that gmtime and localtime accept
20575 echo "Checking max offsets that gmtime () accepts"
20576
20577 case $i_values in
20578     define) yyy="#include <values.h>" ;;
20579     *)      yyy="" ;;
20580     esac
20581
20582 case "$sGMTIME_min/$sGMTIME_max" in
20583     0/0|/)
20584         $cat >try.c <<EOCP
20585 #include <sys/types.h>
20586 #include <stdio.h>
20587 #include <time.h>
20588 $yyy
20589
20590 int i;
20591 struct tm *tmp;
20592 time_t pt;
20593
20594 void gm_check (time_t t, int min_year, int max_year)
20595 {
20596     tmp = gmtime (&t);
20597     if ( tmp == NULL ||
20598         /* Check tm_year overflow */
20599          tmp->tm_year < min_year || tmp->tm_year > max_year)
20600         tmp = NULL;
20601     else
20602         pt = t;
20603     } /* gm_check */
20604
20605 int check_max ()
20606 {
20607     tmp = NULL;
20608     pt  = 0;
20609 #ifdef MAXLONG
20610     gm_check (MAXLONG, 69, 0x7fffffff);
20611 #endif
20612     if (tmp == NULL || tmp->tm_year < 0) {
20613         for (i = 63; i >= 0; i--) {
20614             time_t x = pt | ((time_t)1 << i);
20615             if (x < 0 || x < pt) continue;
20616             gm_check (x, 69, 0x7fffffff);
20617             }
20618         }
20619     printf ("sGMTIME_max=%ld\n", pt);
20620     return (0);
20621     } /* check_max */
20622
20623 int check_min ()
20624 {
20625     tmp = NULL;
20626     pt  = 0;
20627 #ifdef MINLONG
20628     gm_check (MINLONG, -1900, 70);
20629 #endif
20630     if (tmp == NULL) {
20631         for (i = 36; i >= 0; i--) {
20632             time_t x = pt - ((time_t)1 << i);
20633             if (x > 0) continue;
20634             gm_check (x, -1900, 70);
20635             }
20636         }
20637     printf ("sGMTIME_min=%ld\n", pt);
20638     return (0);
20639     } /* check_min */
20640
20641 int main (int argc, char *argv[])
20642 {
20643     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20644     check_max ();
20645     check_min ();
20646     return (0);
20647     } /* main */
20648 EOCP
20649         set try
20650         if eval $compile; then
20651             eval `$run ./try`
20652         else
20653             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20654             fi
20655         $rm_try
20656         ;;
20657     esac
20658
20659 echo "Checking max offsets that localtime () accepts"
20660
20661 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20662     0/0|/)
20663         $cat >try.c <<EOCP
20664 #include <sys/types.h>
20665 #include <stdio.h>
20666 #include <time.h>
20667 $yyy
20668
20669 int i;
20670 struct tm *tmp;
20671 time_t pt;
20672
20673 void local_check (time_t t, int min_year, int max_year)
20674 {
20675     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20676         tmp = NULL;
20677     else
20678         tmp = localtime (&t);
20679     if ( tmp == NULL ||
20680         /* Check tm_year overflow */
20681          tmp->tm_year < min_year || tmp->tm_year > max_year)
20682         tmp = NULL;
20683     else
20684         pt = t;
20685     } /* local_check */
20686
20687 int check_max ()
20688 {
20689     tmp = NULL;
20690     pt  = 0;
20691 #ifdef MAXLONG
20692     local_check (MAXLONG, 69, 0x7fffffff);
20693 #endif
20694     if (tmp == NULL || tmp->tm_year < 0) {
20695         for (i = 63; i >= 0; i--) {
20696             time_t x = pt | ((time_t)1 << i);
20697             if (x < 0 || x < pt) continue;
20698             local_check (x, 69, 0x7fffffff);
20699             }
20700         }
20701     printf ("sLOCALTIME_max=%ld\n", pt);
20702     return (0);
20703    } /* check_max */
20704
20705 int check_min ()
20706 {
20707     tmp = NULL;
20708     pt  = 0;
20709 #ifdef MINLONG
20710     local_check (MINLONG, -1900, 70);
20711 #endif
20712     if (tmp == NULL) {
20713         for (i = 36; i >= 0; i--) {
20714             time_t x = pt - ((time_t)1 << i);
20715             if (x > 0) continue;
20716             local_check (x, -1900, 70);
20717             }
20718         }
20719     printf ("sLOCALTIME_min=%ld\n", pt);
20720     return (0);
20721     } /* check_min */
20722
20723 int main (int argc, char *argv[])
20724 {
20725     check_max ();
20726     check_min ();
20727     return (0);
20728     } /* main */
20729 EOCP
20730         set try
20731         if eval $compile; then
20732             eval `$run ./try`
20733         else
20734             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20735             fi
20736         $rm_try
20737         ;;
20738     esac
20739
20740 : check for type of arguments to select.
20741 case "$selecttype" in
20742 '') case "$d_select" in
20743         $define)
20744                 echo " "
20745                 $cat <<EOM
20746 Checking to see what type of arguments are accepted by select().
20747 EOM
20748                 hdrs="$define sys/types.h
20749                         $i_systime sys/time.h
20750                         $i_sysselct sys/select.h
20751                         $d_socket sys/socket.h"
20752                 : The first arg can be int, unsigned, or size_t
20753                 : The last arg may or may not be 'const'
20754                 val=''
20755                 : void pointer has been seen but using that
20756                 : breaks the selectminbits test
20757                 for xxx in 'fd_set *' 'int *'; do
20758                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20759                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20760                                         case "$val" in
20761                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20762                                                 if ./protochk "$try" $hdrs; then
20763                                                         echo "Your system accepts $xxx."
20764                                                         val="$xxx"
20765                                                 fi
20766                                                 ;;
20767                                         esac
20768                                 done
20769                         done
20770                 done
20771                 case "$val" in
20772                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20773                         case "$d_fd_set" in
20774                                 $define) dflt="fd_set *" ;;
20775                                 *)              dflt="int *" ;;
20776                         esac
20777                         . ./myread
20778                         val=$ans
20779                         ;;
20780                 esac
20781                 selecttype="$val"
20782                 ;;
20783         *)      : no select, so pick a harmless default
20784                 selecttype='int *'
20785                 ;;
20786         esac
20787         ;;
20788 esac
20789
20790 : check for the select 'width'
20791 case "$selectminbits" in
20792 '') safebits=`expr $ptrsize \* 8`
20793     case "$d_select" in
20794         $define)
20795                 $cat <<EOM
20796
20797 Checking to see on how many bits at a time your select() operates...
20798 EOM
20799                 $cat >try.c <<EOCP
20800 #include <sys/types.h>
20801 #$i_time I_TIME
20802 #$i_systime I_SYS_TIME
20803 #$i_systimek I_SYS_TIME_KERNEL
20804 #ifdef I_TIME
20805 #   include <time.h>
20806 #endif
20807 #ifdef I_SYS_TIME
20808 #   ifdef I_SYS_TIME_KERNEL
20809 #       define KERNEL
20810 #   endif
20811 #   include <sys/time.h>
20812 #   ifdef I_SYS_TIME_KERNEL
20813 #       undef KERNEL
20814 #   endif
20815 #endif
20816 #$i_sysselct I_SYS_SELECT
20817 #ifdef I_SYS_SELECT
20818 #include <sys/select.h>
20819 #endif
20820 #$d_socket HAS_SOCKET
20821 #ifdef HAS_SOCKET
20822 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20823 #endif
20824 #include <stdio.h>
20825 #$i_stdlib I_STDLIB
20826 #ifdef I_STDLIB
20827 #include <stdlib.h>
20828 #endif
20829 $selecttype b;
20830 #define S sizeof(*(b))
20831 #define MINBITS 64
20832 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20833 #define NBITS  (NBYTES * 8)
20834 int main() {
20835     char *s = (char *)malloc(NBYTES);
20836     struct timeval t;
20837     int i;
20838     FILE* fp;
20839     int fd;
20840
20841     if (!s)
20842         exit(1);
20843     fclose(stdin);
20844     fp = fopen("try.c", "r");
20845     if (fp == 0)
20846       exit(2);
20847     fd = fileno(fp);
20848     if (fd < 0)
20849       exit(3);
20850     b = ($selecttype)s;
20851     for (i = 0; i < NBITS; i++)
20852         FD_SET(i, b);
20853     t.tv_sec  = 0;
20854     t.tv_usec = 0;
20855     select(fd + 1, b, 0, 0, &t);
20856     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20857     free(s);
20858     printf("%d\n", i + 1);
20859     return 0;
20860 }
20861 EOCP
20862                 set try
20863                 if eval $compile_ok; then
20864                         selectminbits=`$run ./try`
20865                         case "$selectminbits" in
20866                         '')     cat >&4 <<EOM
20867 Cannot figure out on how many bits at a time your select() operates.
20868 I'll play safe and guess it is $safebits bits.
20869 EOM
20870                                 selectminbits=$safebits
20871                                 bits="$safebits bits"
20872                                 ;;
20873                         1)      bits="1 bit" ;;
20874                         *)      bits="$selectminbits bits" ;;
20875                         esac
20876                         echo "Your select() operates on $bits at a time." >&4
20877                 else
20878                         rp='What is the minimum number of bits your select() operates on?'
20879                         case "$byteorder" in
20880                         12345678)       dflt=64 ;;
20881                         1234)           dflt=32 ;;
20882                         *)              dflt=1  ;;
20883                         esac
20884                         . ./myread
20885                         val=$ans
20886                         selectminbits="$val"
20887                 fi
20888                 $rm_try
20889                 ;;
20890         *)      : no select, so pick a harmless default
20891                 selectminbits=$safebits
20892                 ;;
20893         esac
20894         ;;
20895 esac
20896
20897 : Trace out the files included by signal.h, then look for SIGxxx names.
20898 if [ "X$fieldn" = X ]; then
20899         : Just make some guesses.  We check them later.
20900         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20901 else
20902         xxx=`echo '#include <signal.h>' |
20903         $cppstdin $cppminus $cppflags 2>/dev/null |
20904         $grep '^[       ]*#.*include' |
20905         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20906                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20907 fi
20908 xxxfiles=''
20909 for xx in $xxx /dev/null ; do
20910         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20911 done
20912 case "$xxxfiles" in
20913 '')     xxxfiles=`./findhdr signal.h` ;;
20914 esac
20915 xxx=`awk '
20916 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20917         print substr($2, 4, 20)
20918 }
20919 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20920         print substr($3, 4, 20)
20921 }' $xxxfiles`
20922 : Append some common names just in case the awk scan failed.
20923 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20924 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20925 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20926 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20927 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20928
20929 : generate a few handy files for later
20930 $cat > signal.c <<EOCP
20931 #include <sys/types.h>
20932 #include <signal.h>
20933 #$i_stdlib I_STDLIB
20934 #ifdef I_STDLIB
20935 #include <stdlib.h>
20936 #endif
20937 #include <stdio.h>
20938 int main() {
20939
20940 /* Strange style to avoid deeply-nested #if/#else/#endif */
20941 #ifndef NSIG
20942 #  ifdef _NSIG
20943 #    define NSIG (_NSIG)
20944 #  endif
20945 #endif
20946
20947 #ifndef NSIG
20948 #  ifdef SIGMAX
20949 #    define NSIG (SIGMAX+1)
20950 #  endif
20951 #endif
20952
20953 #ifndef NSIG
20954 #  ifdef SIG_MAX
20955 #    define NSIG (SIG_MAX+1)
20956 #  endif
20957 #endif
20958
20959 #ifndef NSIG
20960 #  ifdef _SIG_MAX
20961 #    define NSIG (_SIG_MAX+1)
20962 #  endif
20963 #endif
20964
20965 #ifndef NSIG
20966 #  ifdef MAXSIG
20967 #    define NSIG (MAXSIG+1)
20968 #  endif
20969 #endif
20970
20971 #ifndef NSIG
20972 #  ifdef MAX_SIG
20973 #    define NSIG (MAX_SIG+1)
20974 #  endif
20975 #endif
20976
20977 #ifndef NSIG
20978 #  ifdef SIGARRAYSIZE
20979 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20980 #  endif
20981 #endif
20982
20983 #ifndef NSIG
20984 #  ifdef _sys_nsig
20985 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20986 #  endif
20987 #endif
20988
20989 /* Default to some arbitrary number that's big enough to get most
20990    of the common signals.
20991 */
20992 #ifndef NSIG
20993 #    define NSIG 50
20994 #endif
20995
20996 printf("NSIG %d\n", NSIG);
20997
20998 #ifndef JUST_NSIG
20999
21000 EOCP
21001
21002 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21003 {
21004         printf "#ifdef SIG"; printf $1; printf "\n"
21005         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21006         printf $1; printf ");\n"
21007         printf "#endif\n"
21008 }
21009 END {
21010         printf "#endif /* JUST_NSIG */\n";
21011         printf "exit(0);\n}\n";
21012 }
21013 ' >>signal.c
21014 $cat >signal.awk <<'EOP'
21015 BEGIN { ndups = 0 }
21016 $1 ~ /^NSIG$/ { nsig = $2 }
21017 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21018     if ($2 > maxsig) { maxsig = $2 }
21019     if (sig_name[$2]) {
21020         dup_name[ndups] = $1
21021         dup_num[ndups] = $2
21022         ndups++
21023     }
21024     else {
21025         sig_name[$2] = $1
21026         sig_num[$2] = $2
21027     }
21028 }
21029 END {
21030     if (nsig == 0) {
21031         nsig = maxsig + 1
21032     }
21033     printf("NSIG %d\n", nsig);
21034     for (n = 1; n < nsig; n++) {
21035         if (sig_name[n]) {
21036             printf("%s %d\n", sig_name[n], sig_num[n])
21037         }
21038         else {
21039             printf("NUM%d %d\n", n, n)
21040         }
21041     }
21042     for (n = 0; n < ndups; n++) {
21043         printf("%s %d\n", dup_name[n], dup_num[n])
21044     }
21045 }
21046 EOP
21047 $cat >signal_cmd <<EOS
21048 $startsh
21049 if $test -s signal.lst; then
21050     echo "Using your existing signal.lst file"
21051         exit 0
21052 fi
21053 xxx="$xxx"
21054 EOS
21055 $cat >>signal_cmd <<'EOS'
21056
21057 set signal
21058 if eval $compile_ok; then
21059         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21060                 $uniq | $awk -f signal.awk >signal.lst
21061 else
21062         echo "(I can't seem be able to compile the whole test program)" >&4
21063         echo "(I'll try it in little pieces.)" >&4
21064         set signal -DJUST_NSIG
21065         if eval $compile_ok; then
21066                 $run ./signal$_exe > signal.nsg
21067                 $cat signal.nsg
21068         else
21069                 echo "I can't seem to figure out how many signals you have." >&4
21070                 echo "Guessing 50." >&4
21071                 echo 'NSIG 50' > signal.nsg
21072         fi
21073         : Now look at all the signal names, one at a time.
21074         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21075                 $cat > signal.c <<EOCP
21076 #include <sys/types.h>
21077 #include <signal.h>
21078 #include <stdio.h>
21079 int main() {
21080 printf("$xx %d\n", SIG${xx});
21081 return 0;
21082 }
21083 EOCP
21084                 set signal
21085                 if eval $compile; then
21086                         echo "SIG${xx} found."
21087                         $run ./signal$_exe  >> signal.ls1
21088                 else
21089                         echo "SIG${xx} NOT found."
21090                 fi
21091         done
21092         if $test -s signal.ls1; then
21093                 $cat signal.nsg signal.ls1 |
21094                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21095         fi
21096
21097 fi
21098 if $test -s signal.lst; then
21099         :
21100 else
21101         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21102         echo 'kill -l' >signal
21103         set X `csh -f <signal`
21104         $rm -f signal
21105         shift
21106         case $# in
21107         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21108         esac
21109         echo $@ | $tr ' ' $trnl | \
21110             $awk '{ printf "%s %d\n", $1, ++s; }
21111                   END { printf "NSIG %d\n", ++s }' >signal.lst
21112 fi
21113 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21114 EOS
21115 chmod a+x signal_cmd
21116 $eunicefix signal_cmd
21117
21118 : generate list of signal names
21119 echo " "
21120 case "$sig_name_init" in
21121 '') doinit=yes ;;
21122 *)  case "$sig_num_init" in
21123     ''|*,*) doinit=yes ;;
21124     esac ;;
21125 esac
21126 case "$doinit" in
21127 yes)
21128         echo "Generating a list of signal names and numbers..." >&4
21129         . ./signal_cmd
21130         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21131         sig_name=`$awk 'BEGIN { printf "ZERO " }
21132                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21133         sig_num=`$awk  'BEGIN { printf "0 " }
21134                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21135         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21136                              !/^NSIG/   { printf "\"%s\", ", $1 }
21137                              END        { printf "0\n" }' signal.lst`
21138         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21139                              !/^NSIG/   { printf "%d, ", $2}
21140                              END        { printf "0\n"}' signal.lst`
21141         ;;
21142 esac
21143 echo "The following $sig_count signals are available:"
21144 echo " "
21145 echo $sig_name | $awk \
21146 'BEGIN { linelen = 0 }
21147 {
21148         for (i = 1; i <= NF; i++) {
21149                 name = "SIG" $i " "
21150                 linelen = linelen + length(name)
21151                 if (linelen > 70) {
21152                         printf "\n"
21153                         linelen = length(name)
21154                 }
21155                 printf "%s", name
21156         }
21157         printf "\n"
21158 }'
21159 sig_size=`echo $sig_name | awk '{print NF}'`
21160 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21161
21162 : Check size of size
21163 echo " "
21164 case "$sizetype" in
21165 *_t) zzz="$sizetype"    ;;
21166 *)   zzz="filesize"     ;;
21167 esac
21168 echo "Checking the size of $zzz..." >&4
21169 cat > try.c <<EOCP
21170 #include <sys/types.h>
21171 #include <stdio.h>
21172 #$i_stdlib I_STDLIB
21173 #ifdef I_STDLIB
21174 #include <stdlib.h>
21175 #endif
21176 int main() {
21177     printf("%d\n", (int)sizeof($sizetype));
21178     exit(0);
21179 }
21180 EOCP
21181 set try
21182 if eval $compile_ok; then
21183         yyy=`$run ./try`
21184         case "$yyy" in
21185         '')     sizesize=4
21186                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21187                 ;;
21188         *)      sizesize=$yyy
21189                 echo "Your $zzz size is $sizesize bytes."
21190                 ;;
21191         esac
21192 else
21193         sizesize=4
21194         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21195 fi
21196
21197
21198 : check for socklen_t
21199 echo " "
21200 echo "Checking to see if you have socklen_t..." >&4
21201 $cat >try.c <<EOCP
21202 #include <sys/types.h>
21203 #$d_socket HAS_SOCKET
21204 #ifdef HAS_SOCKET
21205 #include <sys/socket.h>
21206 #endif
21207 int main() { socklen_t x = 16; }
21208 EOCP
21209 set try
21210 if eval $compile; then
21211         val="$define"
21212         echo "You have socklen_t."
21213 else
21214         val="$undef"
21215         echo "You do not have socklen_t."
21216         case "$sizetype" in
21217         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21218         esac
21219 fi
21220 $rm_try
21221 set d_socklen_t
21222 eval $setvar
21223
21224 : see if this is a socks.h system
21225 set socks.h i_socks
21226 eval $inhdr
21227
21228 : check for type of the size argument to socket calls
21229 case "$d_socket" in
21230 "$define")
21231         $cat <<EOM
21232
21233 Checking to see what type is the last argument of accept().
21234 EOM
21235         yyy=''
21236         case "$d_socklen_t" in
21237         "$define") yyy="$yyy socklen_t"
21238         esac
21239         yyy="$yyy $sizetype int long unsigned"
21240         for xxx in $yyy; do
21241                 case "$socksizetype" in
21242                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21243                         case "$usesocks" in
21244                         "$define")
21245                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21246                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21247                                         socksizetype="$xxx"
21248                                 fi
21249                                 ;;
21250                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21251                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21252                                         socksizetype="$xxx"
21253                                 fi
21254                                 ;;
21255                         esac
21256                         ;;
21257                 esac
21258         done
21259 : In case none of those worked, prompt the user.
21260         case "$socksizetype" in
21261         '')     rp='What is the type for socket address structure sizes?'
21262                 dflt='int'
21263                 . ./myread
21264                 socksizetype=$ans
21265                 ;;
21266         esac
21267         ;;
21268 *)      : no sockets, so pick relatively harmless default
21269         socksizetype='int'
21270         ;;
21271 esac
21272
21273 : see what type is used for signed size_t
21274 set ssize_t ssizetype int stdio.h sys/types.h
21275 eval $typedef
21276 dflt="$ssizetype"
21277 $cat > try.c <<EOM
21278 #include <stdio.h>
21279 #$i_stdlib I_STDLIB
21280 #ifdef I_STDLIB
21281 #include <stdlib.h>
21282 #endif
21283 #include <sys/types.h>
21284 #define Size_t $sizetype
21285 #define SSize_t $dflt
21286 int main()
21287 {
21288         if (sizeof(Size_t) == sizeof(SSize_t))
21289                 printf("$dflt\n");
21290         else if (sizeof(Size_t) == sizeof(int))
21291                 printf("int\n");
21292         else
21293                 printf("long\n");
21294         exit(0);
21295 }
21296 EOM
21297 echo " "
21298 set try
21299 if eval $compile_ok && $run ./try > /dev/null; then
21300         ssizetype=`$run ./try`
21301         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21302 else
21303         $cat >&4 <<EOM
21304 Help! I can't compile and run the ssize_t test program: please enlighten me!
21305 (This is probably a misconfiguration in your system or libraries, and
21306 you really ought to fix it.  Still, I'll try anyway.)
21307
21308 I need a type that is the same size as $sizetype, but is guaranteed to
21309 be signed.  Common values are ssize_t, int and long.
21310
21311 EOM
21312         rp="What signed type is the same size as $sizetype?"
21313         . ./myread
21314         ssizetype="$ans"
21315 fi
21316 $rm_try
21317
21318 : Check the size of st_ino
21319 $echo " "
21320 $echo "Checking the size of st_ino..." >&4
21321 $cat > try.c <<EOCP
21322 #include <sys/stat.h>
21323 #include <stdio.h>
21324 #$i_stdlib I_STDLIB
21325 #ifdef I_STDLIB
21326 #include <stdlib.h>
21327 #endif
21328 int main() {
21329     struct stat st;
21330     printf("%d\n", (int)sizeof(st.st_ino));
21331     exit(0);
21332 }
21333 EOCP
21334 set try
21335 if eval $compile_ok; then
21336         val=`$run ./try`
21337         case "$val" in
21338         '')     st_ino_size=4
21339                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21340                 ;;
21341         *)      st_ino_size=$val
21342                 $echo "Your st_ino is $st_ino_size bytes long."
21343                 ;;
21344         esac
21345 else
21346         st_ino_size=4
21347         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21348 fi
21349 $rm_try
21350
21351 : Check if st_ino is signed
21352 $echo " "
21353 $echo "Checking the sign of st_ino..." >&4
21354 $cat > try.c <<EOCP
21355 #include <sys/stat.h>
21356 #include <stdio.h>
21357 int main() {
21358         struct stat foo;
21359         foo.st_ino = -1;
21360         if (foo.st_ino < 0)
21361                 printf("-1\n");
21362         else
21363                 printf("1\n");
21364 }
21365 EOCP
21366 set try
21367 if eval $compile; then
21368         val=`$run ./try`
21369         case "$val" in
21370         '')     st_ino_sign=1
21371                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21372                 ;;
21373         *)      st_ino_sign=$val
21374                 case "$st_ino_sign" in
21375                  1) $echo "Your st_ino is unsigned." ;;
21376                 -1) $echo "Your st_ino is signed."   ;;
21377                 esac
21378                 ;;
21379         esac
21380 else
21381         st_ino_sign=1
21382         $echo "(I can't compile the test program--guessing unsigned.)" >&4
21383 fi
21384 $rm_try
21385
21386 : see what type of char stdio uses.
21387 echo " "
21388 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21389 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21390         echo "Your stdio uses unsigned chars." >&4
21391         stdchar="unsigned char"
21392 else
21393         echo "Your stdio uses signed chars." >&4
21394         stdchar="char"
21395 fi
21396 $rm -f stdioh
21397
21398 : see what type uids are declared as in the kernel
21399 echo " "
21400 echo "Looking for the type for user ids returned by getuid()."
21401 set uid_t uidtype xxx stdio.h sys/types.h
21402 eval $typedef
21403 case "$uidtype" in
21404 xxx)
21405         xxx=`./findhdr sys/user.h`
21406         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21407         case $1 in
21408         unsigned) dflt="$1 $2" ;;
21409         *) dflt="$1" ;;
21410         esac
21411         ;;
21412 *) dflt="$uidtype";;
21413 esac
21414 case "$uidtype" in
21415 uid_t)  echo "uid_t found." ;;
21416 *)      rp="What is the type for user ids returned by getuid()?"
21417         . ./myread
21418         uidtype="$ans"
21419         ;;
21420 esac
21421
21422 : Check size of UID
21423 echo " "
21424 case "$uidtype" in
21425 *_t) zzz="$uidtype"     ;;
21426 *)   zzz="uid"          ;;
21427 esac
21428 echo "Checking the size of $zzz..." >&4
21429 cat > try.c <<EOCP
21430 #include <sys/types.h>
21431 #include <stdio.h>
21432 #$i_stdlib I_STDLIB
21433 #ifdef I_STDLIB
21434 #include <stdlib.h>
21435 #endif
21436 int main() {
21437     printf("%d\n", (int)sizeof($uidtype));
21438     exit(0);
21439 }
21440 EOCP
21441 set try
21442 if eval $compile_ok; then
21443         yyy=`$run ./try`
21444         case "$yyy" in
21445         '')     uidsize=4
21446                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21447                 ;;
21448         *)      uidsize=$yyy
21449                 echo "Your $zzz is $uidsize bytes long."
21450                 ;;
21451         esac
21452 else
21453         uidsize=4
21454         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21455 fi
21456
21457 : Check if UID is signed
21458 echo " "
21459 case "$uidtype" in
21460 *_t) zzz="$uidtype"     ;;
21461 *)   zzz="uid"          ;;
21462 esac
21463 echo "Checking the sign of $zzz..." >&4
21464 cat > try.c <<EOCP
21465 #include <sys/types.h>
21466 #include <stdio.h>
21467 int main() {
21468         $uidtype foo = -1;
21469         if (foo < 0)
21470                 printf("-1\n");
21471         else
21472                 printf("1\n");
21473 }
21474 EOCP
21475 set try
21476 if eval $compile; then
21477         yyy=`$run ./try`
21478         case "$yyy" in
21479         '')     uidsign=1
21480                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21481                 ;;
21482         *)      uidsign=$yyy
21483                 case "$uidsign" in
21484                  1) echo "Your $zzz is unsigned." ;;
21485                 -1) echo "Your $zzz is signed."   ;;
21486                 esac
21487                 ;;
21488         esac
21489 else
21490         uidsign=1
21491         echo "(I can't compile the test program--guessing unsigned.)" >&4
21492 fi
21493
21494
21495 : Check format string for UID
21496 echo " "
21497 $echo "Checking the format string to be used for uids..." >&4
21498
21499 case "$uidsign" in
21500 -1)     if $test X"$uidsize" = X"$ivsize"; then
21501                 uidformat="$ivdformat"
21502         else
21503                 if $test X"$uidsize" = X"$longsize"; then
21504                         uidformat='"ld"'
21505                 else
21506                         if $test X"$uidsize" = X"$intsize"; then
21507                                 uidformat='"d"'
21508                         else
21509                                 if $test X"$uidsize" = X"$shortsize"; then
21510                                         uidformat='"hd"'
21511                                 fi
21512                         fi
21513                 fi
21514         fi
21515         ;;
21516 *)      if $test X"$uidsize" = X"$uvsize"; then
21517                 uidformat="$uvuformat"
21518         else
21519                 if $test X"$uidsize" = X"$longsize"; then
21520                         uidformat='"lu"'
21521                 else
21522                         if $test X"$uidsize" = X"$intsize"; then
21523                                 uidformat='"u"'
21524                         else
21525                                 if $test X"$uidsize" = X"$shortsize"; then
21526                                         uidformat='"hu"'
21527                                 fi
21528                         fi
21529                 fi
21530         fi
21531         ;;
21532 esac
21533
21534 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21535 echo " "
21536 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21537 $cat >try.c <<'EOM'
21538 /* Intentionally a long probe as I'd like to sanity check that the exact
21539    approach is going to work, as thinking it will work, but only having it
21540    part working at runtime is worse than not having it.  */
21541
21542 #include <sys/types.h>
21543 #include <sys/sysctl.h>
21544 #include <sys/param.h>
21545 #include <stdio.h>
21546 #include <string.h>
21547 #include <stdlib.h>
21548 #include <unistd.h>
21549
21550 int
21551 main(int argc, char **argv) {
21552     char *buffer;
21553     char *argv_leaf = strrchr(argv[0], '/');
21554     char *buffer_leaf;
21555     size_t size = 0;
21556     int mib[4];
21557
21558     mib[0] = CTL_KERN;
21559     mib[1] = KERN_PROC;
21560     mib[2] = KERN_PROC_PATHNAME;
21561     mib[3] = -1;
21562
21563     if (!argv_leaf) {
21564         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21565         return 1;
21566     }
21567
21568     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21569         perror("sysctl");
21570         return 2;
21571     }
21572
21573     if (size < strlen(argv_leaf) + 1) {
21574         fprintf(stderr, "size %lu is too short for a path\n",
21575                 (unsigned long) size);
21576         return 3;
21577     }
21578
21579     if (size > MAXPATHLEN * MAXPATHLEN) {
21580         fprintf(stderr, "size %lu is too long for a path\n",
21581                 (unsigned long) size);
21582         return 4;
21583     }
21584
21585     buffer = malloc(size);
21586     if (!buffer) {
21587         perror("malloc");
21588         return 5;
21589     }
21590
21591     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21592         perror("sysctl");
21593         return 6;
21594     }
21595
21596     if (strlen(buffer) + 1 != size) {
21597         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21598                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21599         return 7;
21600     }
21601
21602
21603     if (*buffer != '/') {
21604         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21605         return 8;
21606     }
21607
21608     if (strstr(buffer, "/./")) {
21609         fprintf(stderr, "Contains /./: '%s'\n", buffer);
21610         return 9;
21611     }
21612
21613     if (strstr(buffer, "/../")) {
21614         fprintf(stderr, "Contains /../: '%s'\n", buffer);
21615         return 10;
21616     }
21617
21618     buffer_leaf = strrchr(buffer, '/');
21619     if (strcmp(buffer_leaf, argv_leaf) != 0) {
21620         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21621         return 11;
21622     }
21623
21624     free(buffer);
21625
21626     return 0;
21627 }
21628 EOM
21629
21630 val=$undef
21631 set try
21632 if eval $compile; then
21633         if $run ./try; then
21634                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21635                 val="$define"
21636         else
21637                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21638                 val="$undef"
21639         fi
21640 else
21641         echo "I'm unable to compile the test program." >&4
21642         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21643         val="$undef"
21644 fi
21645 $rm_try
21646 set usekernprocpathname
21647 eval $setvar
21648
21649 : Determine if we can use _NSGetExecutablePath to find executing program
21650 echo " "
21651 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21652 $cat >try.c <<'EOM'
21653 /* Intentionally a long probe as I'd like to sanity check that the exact
21654    approach is going to work, as thinking it will work, but only having it
21655    part working at runtime is worse than not having it.  */
21656 #include <mach-o/dyld.h>
21657 #include <stdio.h>
21658 #include <stdlib.h>
21659 #include <sys/param.h>
21660 #include <string.h>
21661
21662 int
21663 main(int argc, char **argv) {
21664     char buf[1];
21665     uint32_t size = sizeof(buf);
21666     int result;
21667     char *buffer;
21668     char *tidied;
21669     char *argv_leaf = strrchr(argv[0], '/');
21670     char *tidied_leaf;
21671
21672     if (!argv_leaf) {
21673         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21674         return 1;
21675     }
21676
21677     _NSGetExecutablePath(buf, &size);
21678     if (size > MAXPATHLEN * MAXPATHLEN) {
21679         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21680                 (unsigned int) size);
21681         return 2;
21682     }
21683
21684     buffer = malloc(size);
21685     if (!buffer) {
21686         perror("malloc");
21687         return 3;
21688     }
21689
21690     result = _NSGetExecutablePath(buffer, &size);
21691     if (result != 0) {
21692         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21693                 result, (unsigned int) size);
21694         return 4;
21695     }
21696
21697     tidied = realpath(buffer, NULL);
21698     if (!tidied) {
21699         perror("realpath");
21700         return 5;
21701     }
21702
21703     free(buffer);
21704
21705     if (*tidied != '/') {
21706         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21707         return 6;
21708     }
21709
21710     if (strstr(tidied, "/./")) {
21711         fprintf(stderr, "Contains /./: '%s'\n", tidied);
21712         return 7;
21713     }
21714
21715     if (strstr(tidied, "/../")) {
21716         fprintf(stderr, "Contains /../: '%s'\n", tidied);
21717         return 8;
21718     }
21719
21720     tidied_leaf = strrchr(tidied, '/');
21721     if (strcmp(tidied_leaf, argv_leaf) != 0) {
21722         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21723         return 9;
21724     }
21725
21726     free(tidied);
21727
21728     return 0;
21729 }
21730 EOM
21731
21732 val=$undef
21733 set try
21734 if eval $compile; then
21735         if $run ./try; then
21736                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21737                 val="$define"
21738         else
21739                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21740         fi
21741 else
21742         echo "I'm unable to compile the test program." >&4
21743         echo "I'll assume no _NSGetExecutablePath here." >&4
21744 fi
21745 $rm_try
21746 set usensgetexecutablepath
21747 eval $setvar
21748
21749 : Check if site customization support was requested
21750 case "$usesitecustomize" in
21751     $define|true|[Yy]*)
21752         usesitecustomize="$define"
21753         ;;
21754     *)
21755         usesitecustomize="$undef"
21756         ;;
21757     esac
21758
21759 : see if prototypes support variable argument declarations
21760 echo " "
21761 case "$prototype$i_stdarg" in
21762 $define$define)
21763         echo "It appears we'll be able to prototype varargs functions." >&4
21764         val="$define"
21765         ;;
21766 *)
21767         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21768         val="$undef"
21769         ;;
21770 esac
21771 set vaproto
21772 eval $setvar
21773
21774 : determine compiler compiler
21775 case "$yacc" in
21776 '')
21777         dflt=yacc;;
21778 *)
21779         dflt="$yacc";;
21780 esac
21781 echo " "
21782 comp='yacc'
21783 if $test -f "$byacc$_exe"; then
21784         dflt="$byacc"
21785         comp="byacc or $comp"
21786 fi
21787 if $test -f "$bison$_exe"; then
21788         comp="$comp or bison -y"
21789 fi
21790 rp="Which compiler compiler ($comp) shall I use?"
21791 . ./myread
21792 yacc="$ans"
21793 case "$yacc" in
21794 *bis*)
21795         case "$yacc" in
21796         *-y*) ;;
21797         *)
21798                 yacc="$yacc -y"
21799                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21800                 ;;
21801         esac
21802         ;;
21803 esac
21804
21805 : see if this is a assert.h system
21806 set assert.h i_assert
21807 eval $inhdr
21808
21809 : see if this is a fp.h system
21810 set fp.h i_fp
21811 eval $inhdr
21812
21813 : see if this is a fp_class.h system
21814 set fp_class.h i_fp_class
21815 eval $inhdr
21816
21817 : see if gdbm.h is available
21818 set gdbm.h t_gdbm
21819 eval $inhdr
21820 case "$t_gdbm" in
21821 $define)
21822         : see if gdbm_open exists
21823         set gdbm_open d_gdbm_open
21824         eval $inlibc
21825         case "$d_gdbm_open" in
21826         $undef)
21827                 t_gdbm="$undef"
21828                 echo "We won't be including <gdbm.h>"
21829                 ;;
21830         esac
21831         ;;
21832 esac
21833 val="$t_gdbm"
21834 set i_gdbm
21835 eval $setvar
21836
21837 : see if this is a ieeefp.h system
21838 case "$i_ieeefp" in
21839 '' ) set ieeefp.h i_ieeefp
21840      eval $inhdr
21841      ;;
21842 esac
21843
21844 : see if this is a libutil.h system
21845 set libutil.h i_libutil
21846 eval $inhdr
21847
21848 : see if mach cthreads are available
21849 if test "X$usethreads" = "X$define"; then
21850         set mach/cthreads.h i_machcthr
21851         eval $inhdr
21852 else
21853         i_machcthr="$undef"
21854 fi
21855
21856 : see if this is a mntent.h system
21857 set mntent.h i_mntent
21858 eval $inhdr
21859
21860 : see if net/errno.h is available
21861 val=''
21862 set net/errno.h val
21863 eval $inhdr
21864
21865 : Unfortunately, it causes problems on some systems.  Arrgh.
21866 case "$val" in
21867 $define)
21868         cat > try.c <<'EOM'
21869 #include <stdio.h>
21870 #include <errno.h>
21871 #include <net/errno.h>
21872 int func()
21873 {
21874         return ENOTSOCK;
21875 }
21876 EOM
21877         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21878                 echo "We'll be including <net/errno.h>." >&4
21879         else
21880                 echo "We won't be including <net/errno.h>." >&4
21881                 val="$undef"
21882         fi
21883         $rm_try
21884         ;;
21885 esac
21886 set i_neterrno
21887 eval $setvar
21888
21889 : see if netinet/tcp.h is available
21890 set netinet/tcp.h i_netinettcp
21891 eval $inhdr
21892
21893 : see if this is a poll.h system
21894 set poll.h i_poll
21895 eval $inhdr
21896
21897 : see if this is a prot.h system
21898 set prot.h i_prot
21899 eval $inhdr
21900
21901 : Preprocessor symbols
21902 echo " "
21903 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21904 $cat <<'EOSH' > Cppsym.know
21905 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21906 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21907 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21908 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21909 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21910 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21911 bull c cadmus clipper CMU COFF COMPILER_VERSION
21912 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21913 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21914 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21915 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21916 GLIBC GLIBC_MINOR
21917 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21918 H3050R H3050RX hbullx20 hcx host_mips
21919 hp200 hp300 hp700 HP700 hp800 hp9000
21920 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21921 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21922 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21923 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21924 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21925 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21926 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21927 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21928 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21929 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21930 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21931 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21932 MATH_HAS_NO_SIDE_EFFECTS
21933 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21934 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21935 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21936 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21937 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21938 NetBSD news1500 news1700 news1800 news1900 news3700
21939 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21940 ns32016 ns32332 ns32k nsc32000
21941 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21942 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21943 pc532 pdp11 PGC PIC plexus PORTAR posix
21944 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21945 POSIX_C_SOURCE POSIX_SOURCE POWER
21946 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21947 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21948 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21949 sony sony_news sonyrisc sparc sparclite spectrum
21950 stardent stdc STDC_EXT stratos sun sun3 sun386
21951 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21952 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21953 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21954 sysV68 sysV88 Tek4132 Tek4300 titan
21955 TM3200 TM5400 TM5600
21956 tower tower32 tower32_200 tower32_600 tower32_700
21957 tower32_800 tower32_850 tss
21958 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21959 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21960 unix UNIX95 UNIX99 unixpc unos
21961 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21962 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21963 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21964 USGr4 USGr4_2
21965 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21966 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21967 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21968 z8000
21969 EOSH
21970 # Maybe put other stuff here too.
21971 cat <<EOSH >>Cppsym.know
21972 $osname
21973 EOSH
21974 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21975 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21976 $cat Cppsym.know > Cppsym.c
21977 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21978 $rm -f Cppsym.a Cppsym.b Cppsym.c
21979 cat <<EOSH > Cppsym
21980 $startsh
21981 if $test \$# -gt 0; then
21982     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21983     if $test -s Cppsym.got; then
21984         $rm -f Cppsym.got
21985         exit 0
21986     fi
21987     $rm -f Cppsym.got
21988     exit 1
21989 else
21990     $tr " " "$trnl" | ./Cppsym.try
21991     exit 0
21992 fi
21993 EOSH
21994 chmod +x Cppsym
21995 $eunicefix Cppsym
21996 cat <<EOSH > Cppsym.try
21997 $startsh
21998 cat <<'EOCP' > try.c
21999 #include <stdio.h>
22000 #if cpp_stuff == 1
22001 #define STRINGIFY(a)    "a"
22002 #endif
22003 #if cpp_stuff == 42
22004 #define StGiFy(a)  #a
22005 #define STRINGIFY(a)    StGiFy(a)
22006 #endif
22007 #if $cpp_stuff != 1 && $cpp_stuff != 42
22008 #   include "Bletch: How does this C preprocessor stringify macros?"
22009 #endif
22010 int main() {
22011 EOCP
22012 $awk \\
22013 EOSH
22014 cat <<'EOSH' >> Cppsym.try
22015 'length($1) > 0 {
22016     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22017     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22018     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22019     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22020 }'       >> try.c
22021 echo 'return 0;}' >> try.c
22022 EOSH
22023 cat <<EOSH >> Cppsym.try
22024 ccflags="$ccflags"
22025 case "$osname-$gccversion" in
22026 irix-) ccflags="\$ccflags -woff 1178" ;;
22027 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22028 esac
22029 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
22030 EOSH
22031 chmod +x Cppsym.try
22032 $eunicefix Cppsym.try
22033 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22034 : Add in any linux cpp "predefined macros":
22035 case "$osname::$gccversion" in
22036   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22037     tHdrH=_tmpHdr
22038     rm -f $tHdrH'.h' $tHdrH
22039     touch $tHdrH'.h'
22040     # Filter out macro arguments, such as Linux's __INT8_C(c)
22041     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22042        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22043        if [ -s $tHdrH'_cppsym.real' ]; then
22044           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22045        fi
22046     fi
22047     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22048   ;;
22049 esac
22050 : now check the C compiler for additional symbols
22051 postprocess_cc_v=''
22052 case "$osname" in
22053 aix) postprocess_cc_v="|$tr , ' '" ;;
22054 esac
22055 $cat >ccsym <<EOS
22056 $startsh
22057 $cat >tmp.c <<EOF
22058 extern int foo;
22059 EOF
22060 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22061 do
22062         case "\$i" in
22063         -D*) echo "\$i" | $sed 's/^-D//';;
22064         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22065         esac
22066 done
22067 $rm_try
22068 EOS
22069 postprocess_cc_v=''
22070 chmod +x ccsym
22071 $eunicefix ccsym
22072 ./ccsym > ccsym1.raw
22073 if $test -s ccsym1.raw; then
22074        $sort ccsym1.raw | $uniq >ccsym.raw
22075 else
22076        mv ccsym1.raw ccsym.raw
22077 fi
22078
22079 $awk '/\=/ { print $0; next }
22080         { print $0"=1" }' ccsym.raw >ccsym.list
22081 $comm -13 Cppsym.true ccsym.list >ccsym.own
22082 $comm -12 Cppsym.true ccsym.list >ccsym.com
22083 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22084 also=''
22085 if $test -z ccsym.raw; then
22086         echo "Your C compiler doesn't seem to define any symbols!" >&4
22087         echo " "
22088         echo "However, your C preprocessor defines the following symbols:"
22089         $cat Cppsym.true
22090         ccsymbols=''
22091         cppsymbols=`$cat Cppsym.true`
22092         cppsymbols=`echo $cppsymbols`
22093         cppccsymbols="$cppsymbols"
22094 else
22095         if $test -s ccsym.com; then
22096                 echo "Your C compiler and pre-processor define these symbols:"
22097                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22098                 also='also '
22099                 symbols='ones'
22100                 cppccsymbols=`$cat ccsym.com`
22101                 cppccsymbols=`echo $cppccsymbols`
22102                 $test "$silent" || sleep 1
22103         fi
22104         if $test -s ccsym.cpp; then
22105                 $test "$also" && echo " "
22106                 echo "Your C pre-processor ${also}defines the following symbols:"
22107                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22108                 also='further '
22109                 cppsymbols=`$cat ccsym.cpp`
22110                 cppsymbols=`echo $cppsymbols`
22111                 $test "$silent" || sleep 1
22112         fi
22113         if $test -s ccsym.own; then
22114                 $test "$also" && echo " "
22115                 echo "Your C compiler ${also}defines the following cpp symbols:"
22116                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22117                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22118                 ccsymbols=`$cat ccsym.own`
22119                 ccsymbols=`echo $ccsymbols`
22120                 $test "$silent" || sleep 1
22121         fi
22122 fi
22123
22124 : see if this is a termio system
22125 val="$undef"
22126 val2="$undef"
22127 val3="$undef"
22128 if $test `./findhdr termios.h`; then
22129         set tcsetattr i_termios
22130         eval $inlibc
22131         val3="$i_termios"
22132 fi
22133 echo " "
22134 case "$val3" in
22135 "$define") echo "You have POSIX termios.h... good!" >&4;;
22136 *) if ./Cppsym pyr; then
22137                 case "`/bin/universe`" in
22138                 ucb) if $test `./findhdr sgtty.h`; then
22139                                 val2="$define"
22140                                 echo "<sgtty.h> found." >&4
22141                         else
22142                                 echo "System is pyramid with BSD universe."
22143                                 ./warn "<sgtty.h> not found--you could have problems."
22144                         fi;;
22145                 *) if $test `./findhdr termio.h`; then
22146                                 val="$define"
22147                                 echo "<termio.h> found." >&4
22148                         else
22149                                 echo "System is pyramid with USG universe."
22150                                 ./warn "<termio.h> not found--you could have problems."
22151                         fi;;
22152                 esac
22153         elif ./usg; then
22154                 if $test `./findhdr termio.h`; then
22155                         echo "<termio.h> found." >&4
22156                         val="$define"
22157                 elif $test `./findhdr sgtty.h`; then
22158                         echo "<sgtty.h> found." >&4
22159                         val2="$define"
22160                 else
22161                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
22162                 fi
22163         else
22164                 if $test `./findhdr sgtty.h`; then
22165                         echo "<sgtty.h> found." >&4
22166                         val2="$define"
22167                 elif $test `./findhdr termio.h`; then
22168                         echo "<termio.h> found." >&4
22169                         val="$define"
22170                 else
22171                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22172                 fi
22173         fi;;
22174 esac
22175 set i_termio; eval $setvar
22176 val=$val2; set i_sgtty; eval $setvar
22177 val=$val3; set i_termios; eval $setvar
22178
22179 : see if stdbool is available
22180 : we want a real compile instead of Inhdr because some Solaris systems
22181 : have stdbool.h, but it can only be used if the compiler indicates it
22182 : is sufficiently c99-compliant.
22183 echo " "
22184 $cat >try.c <<EOCP
22185 #include <stdio.h>
22186 #include <stdbool.h>
22187 int func(bool x)
22188 {
22189     return x ? 1 : 0;
22190 }
22191 int main(int argc, char **argv)
22192 {
22193     return func(0);
22194 }
22195 EOCP
22196 set try
22197 if eval $compile; then
22198         echo "<stdbool.h> found." >&4
22199         val="$define"
22200 else
22201         echo "<stdbool.h> NOT found." >&4
22202         val="$undef"
22203 fi
22204 $rm_try
22205 set i_stdbool
22206 eval $setvar
22207
22208 : see if stddef is available
22209 set stddef.h i_stddef
22210 eval $inhdr
22211
22212 : see if sys/access.h is available
22213 set sys/access.h i_sysaccess
22214 eval $inhdr
22215
22216 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22217 set sys/filio.h i_sysfilio
22218 eval $inhdr
22219 echo " "
22220 if $test `./findhdr sys/ioctl.h`; then
22221         val="$define"
22222         echo '<sys/ioctl.h> found.' >&4
22223 else
22224         val="$undef"
22225         if $test $i_sysfilio = "$define"; then
22226             echo '<sys/ioctl.h> NOT found.' >&4
22227         else
22228                 $test $i_sgtty = "$define" && xxx="sgtty.h"
22229                 $test $i_termio = "$define" && xxx="termio.h"
22230                 $test $i_termios = "$define" && xxx="termios.h"
22231 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22232         fi
22233 fi
22234 set i_sysioctl
22235 eval $setvar
22236
22237 : see if socket ioctl defs are in sys/sockio.h
22238 echo " "
22239 xxx=`./findhdr sys/sockio.h`
22240 if $test "$xxx"; then
22241         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22242                 val="$define"
22243                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22244         else
22245                 val="$undef"
22246                 echo "No socket ioctls found in <sys/sockio.h>." >&4
22247         fi
22248 else
22249         val="$undef"
22250         $cat <<EOM
22251 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22252 EOM
22253 fi
22254 set i_syssockio
22255 eval $setvar
22256
22257 : see if this is a syslog.h system
22258 set syslog.h i_syslog
22259 eval $inhdr
22260
22261 : see if this is a sys/mode.h system
22262 set sys/mode.h i_sysmode
22263 eval $inhdr
22264
22265 : see if there is a sys/poll.h file
22266 set sys/poll.h i_syspoll
22267 eval $inhdr
22268
22269 : see if sys/resource.h has to be included
22270 set sys/resource.h i_sysresrc
22271 eval $inhdr
22272
22273 : see if sys/security.h is available
22274 set sys/security.h i_syssecrt
22275 eval $inhdr
22276
22277 : see if this is a sys/statvfs.h system
22278 set sys/statvfs.h i_sysstatvfs
22279 eval $inhdr
22280
22281 : see if this is a sys/un.h system
22282 set sys/un.h i_sysun
22283 eval $inhdr
22284
22285 : see if this is a sys/utsname.h system
22286 set sys/utsname.h i_sysutsname
22287 eval $inhdr
22288
22289 : see if this is a syswait system
22290 set sys/wait.h i_syswait
22291 eval $inhdr
22292
22293 : see if this is a ustat.h system
22294 set ustat.h i_ustat
22295 eval $inhdr
22296
22297 : see if this is an utime system
22298 set utime.h i_utime
22299 eval $inhdr
22300
22301 : see if this is a vfork system
22302 case "$d_vfork" in
22303 "$define")
22304         set vfork.h i_vfork
22305         eval $inhdr
22306         ;;
22307 *)
22308         i_vfork="$undef"
22309         ;;
22310 esac
22311
22312 : Check extensions
22313 echo " "
22314 echo "Looking for extensions..." >&4
22315 : If we are using the old config.sh, known_extensions may contain
22316 : old or inaccurate or duplicate values.
22317 known_extensions=''
22318 nonxs_extensions=''
22319 : We do not use find because it might not be available.
22320 : We do not just use MANIFEST because the user may have dropped
22321 : some additional extensions into the source tree and expect them
22322 : to be built.
22323
22324 : Function to recursively find available extensions, ignoring DynaLoader
22325 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22326 : In 5.10.1 and later, extensions are stored in directories
22327 : like File-Glob instead of the older File/Glob/.
22328 find_extensions='
22329     for xxx in *; do
22330         case "$xxx" in
22331             DynaLoader|dynaload) ;;
22332             *)
22333             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22334             leaf=`echo $xxx | $sed -e s/.*-//`;
22335             if $test -d File; then
22336                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
22337                     known_extensions="$known_extensions $1$this_ext";
22338                 elif $test -f $xxx/Makefile.PL; then
22339                     nonxs_extensions="$nonxs_extensions $1$this_ext";
22340                 else
22341                     if $test -d $xxx -a $# -lt 10; then
22342                         set $1$xxx/ $*;
22343                         cd "$xxx";
22344                         eval $find_extensions;
22345                         cd ..;
22346                         shift;
22347                     fi;
22348                 fi;
22349             else
22350                 echo " $known_extensions $nonxs_extensions" > $$.tmp;
22351                 if $contains " $this_ext " $$.tmp; then
22352                     echo >&4;
22353                     echo "Duplicate directories detected for extension $xxx" >&4;
22354                     echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22355                     case "$knowitall" in
22356                     "") dflt=y;;
22357                     *) dflt=n;;
22358                     esac;
22359                     . ../UU/myread;
22360                     case "$ans" in
22361                     n*|N*) ;;
22362                     *) echo >&4;
22363                        echo "Ok.  Stopping Configure." >&4;
22364                        echo "Please remove the duplicate directory (eg using git clean) and then re-run Configure" >&4;
22365                         exit 1;;
22366                     esac;
22367                     echo "Ok.  You will need to correct config.sh before running make." >&4;
22368                 fi;
22369                 $ls -1 $xxx > $$.tmp;
22370                 if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
22371                     known_extensions="$known_extensions $this_ext";
22372                 elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
22373                     known_extensions="$known_extensions $this_ext";
22374                 elif $test -d $xxx; then
22375                     nonxs_extensions="$nonxs_extensions $this_ext";
22376                 fi;
22377                 $rm -f $$.tmp;
22378             fi
22379             ;;
22380         esac;
22381     done'
22382 tdir=`pwd`
22383 cd "$rsrc/cpan"
22384 set X
22385 shift
22386 eval $find_extensions
22387 cd "$rsrc/dist"
22388 set X
22389 shift
22390 eval $find_extensions
22391 cd "$rsrc/ext"
22392 set X
22393 shift
22394 eval $find_extensions
22395 if $test -d File-Glob; then
22396     : All ext/ flattened
22397 else
22398     # Special case:  Add in modules that nest beyond the first level.
22399     # Currently threads/shared and Hash/Util/FieldHash, since they are
22400     # not picked up by the recursive find above (and adding in general
22401     # recursive finding breaks SDBM_File/sdbm).
22402     # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
22403     known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
22404 fi
22405 set X $known_extensions
22406 shift
22407 known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22408 set X $nonxs_extensions
22409 shift
22410 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22411 cd "$tdir"
22412
22413 : Now see which are supported on this system.
22414 avail_ext=''
22415 for xxx in $known_extensions ; do
22416         case "$xxx" in
22417         DB_File|db_file)
22418                 case "$i_db" in
22419                 $define) avail_ext="$avail_ext $xxx" ;;
22420                 esac
22421                 ;;
22422         GDBM_File|gdbm_fil)
22423                 case "$i_gdbm" in
22424                 $define) avail_ext="$avail_ext $xxx" ;;
22425                 esac
22426                 ;;
22427         I18N/Langinfo|i18n_lan)
22428                 case "$i_langinfo$d_nl_langinfo" in
22429                 $define$define) avail_ext="$avail_ext $xxx" ;;
22430                 esac
22431                 ;;
22432         IPC/SysV|ipc/sysv)
22433                 : XXX Do we need a useipcsysv variable here
22434                 case "${d_msg}${d_sem}${d_shm}" in
22435                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22436                 esac
22437                 ;;
22438         NDBM_File|ndbm_fil)
22439                 case "$d_ndbm" in
22440                 $define)
22441                     case "$osname-$use64bitint" in
22442                     hpux-define)
22443                         case "$libs" in
22444                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22445                         esac
22446                         ;;
22447                     *) avail_ext="$avail_ext $xxx" ;;
22448                     esac
22449                     ;;
22450                 esac
22451                 ;;
22452         ODBM_File|odbm_fil)
22453                 case "${i_dbm}${i_rpcsvcdbm}" in
22454                 *"${define}"*)
22455                     case "$d_cplusplus" in
22456                     define) ;; # delete as a function name will not work
22457                     *)  case "$osname-$use64bitint" in
22458                         hpux-define)
22459                             case "$libs" in
22460                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22461                             esac
22462                             ;;
22463                         *) avail_ext="$avail_ext $xxx" ;;
22464                         esac
22465                         ;;
22466                     esac
22467                     ;;
22468                 esac
22469                 ;;
22470         Opcode|opcode)
22471                 case "$useopcode" in
22472                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22473                 esac
22474                 ;;
22475         POSIX|posix)
22476                 case "$useposix" in
22477                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22478                 esac
22479                 ;;
22480         Socket|socket)
22481                 case "$d_socket" in
22482                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22483                 esac
22484                 ;;
22485         Sys/Syslog|sys/syslog)
22486                 : XXX syslog requires socket
22487                 case "$d_socket" in
22488                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22489                 esac
22490                 ;;
22491         Thread|thread)
22492                 case "$usethreads" in
22493                 true|$define|y)
22494                         case "$use5005threads" in
22495                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22496                         esac
22497                 esac
22498                 ;;
22499         threads|threads/shared)
22500                 # threads and threads::shared are special cases.
22501                 # To stop people from asking "Perl 5.8.0 was supposed
22502                 # to have this new fancy threads implementation but my
22503                 # perl doesn't have it" and from people trying to
22504                 # (re)install the threads module using CPAN.pm and
22505                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22506                 # the threads.pm and threads/shared.pm will always be
22507                 # there, croaking informatively ("you need to rebuild
22508                 # all of Perl with threads, sorry") when threads haven't
22509                 # been compiled in.
22510                 # --jhi
22511                 avail_ext="$avail_ext $xxx"
22512                 ;;
22513         VMS*)
22514                 ;;
22515         Win32*)
22516                 case "$osname" in
22517                 cygwin) avail_ext="$avail_ext $xxx" ;;
22518                 esac
22519                 ;;
22520         XS/APItest|xs/apitest)
22521                 # This is just for testing.  Skip it unless we have dynamic loading.
22522
22523                 case "$usedl" in
22524                 $define) avail_ext="$avail_ext $xxx" ;;
22525                 esac
22526                 ;;
22527         XS/Typemap|xs/typemap)
22528                 # This is just for testing.  Skip it unless we have dynamic loading.
22529                 case "$usedl" in
22530                 $define) avail_ext="$avail_ext $xxx" ;;
22531                 esac
22532                 ;;
22533         *)      avail_ext="$avail_ext $xxx"
22534                 ;;
22535         esac
22536 done
22537
22538 set X $avail_ext
22539 shift
22540 avail_ext="$*"
22541
22542 case "$onlyextensions" in
22543 '') ;;
22544 *)  keepextensions=''
22545     echo "You have requested that only certain extensions be included..." >&4
22546     for i in $onlyextensions; do
22547         case " $avail_ext " in
22548         *" $i "*)
22549             echo "Keeping extension $i."
22550             keepextensions="$keepextensions $i"
22551             ;;
22552         *) echo "Ignoring extension $i." ;;
22553         esac
22554     done
22555     avail_ext="$keepextensions"
22556     ;;
22557 esac
22558
22559 case "$noextensions" in
22560 '') ;;
22561 *)  keepextensions=''
22562     echo "You have requested that certain extensions be ignored..." >&4
22563     for i in $avail_ext; do
22564         case " $noextensions " in
22565         *" $i "*) echo "Ignoring extension $i." ;;
22566         *) echo "Keeping extension $i.";
22567            keepextensions="$keepextensions $i"
22568            ;;
22569         esac
22570     done
22571     avail_ext="$keepextensions"
22572     ;;
22573 esac
22574
22575 : Now see which nonxs extensions are supported on this system.
22576 : For now assume all are.
22577 nonxs_ext=''
22578 for xxx in $nonxs_extensions ; do
22579         case "$xxx" in
22580         *)      nonxs_ext="$nonxs_ext $xxx"
22581                 ;;
22582         esac
22583 done
22584
22585 set X $nonxs_ext
22586 shift
22587 nonxs_ext="$*"
22588
22589 case $usedl in
22590 $define)
22591         $cat <<EOM
22592 A number of extensions are supplied with $package.  You may choose to
22593 compile these extensions for dynamic loading (the default), compile
22594 them into the $package executable (static loading), or not include
22595 them at all.  Answer "none" to include no extensions.
22596 Note that DynaLoader is always built and need not be mentioned here.
22597
22598 EOM
22599         case "$dynamic_ext" in
22600         '')
22601                 : Exclude those listed in static_ext
22602                 dflt=''
22603                 for xxx in $avail_ext; do
22604                         case " $static_ext " in
22605                         *" $xxx "*) ;;
22606                         *) dflt="$dflt $xxx" ;;
22607                         esac
22608                 done
22609                 set X $dflt
22610                 shift
22611                 dflt="$*"
22612                 ;;
22613         *)      dflt="$dynamic_ext"
22614                 # Perhaps we are reusing an old out-of-date config.sh.
22615                 case "$hint" in
22616                 previous)
22617                         if test X"$dynamic_ext" != X"$avail_ext"; then
22618                                 $cat <<EOM
22619 NOTICE:  Your previous config.sh list may be incorrect.
22620 The extensions now available to you are
22621         ${avail_ext}
22622 but the default list from your previous config.sh is
22623         ${dynamic_ext}
22624
22625 EOM
22626                         fi
22627                         ;;
22628                 esac
22629                 ;;
22630         esac
22631         case "$dflt" in
22632         '')     dflt=none;;
22633         esac
22634         rp="What extensions do you wish to load dynamically?"
22635         . ./myread
22636         case "$ans" in
22637         none) dynamic_ext=' ' ;;
22638         *) dynamic_ext="$ans" ;;
22639         esac
22640
22641         case "$static_ext" in
22642         '')
22643                 : Exclude those already listed in dynamic linking
22644                 dflt=''
22645                 for xxx in $avail_ext; do
22646                         case " $dynamic_ext " in
22647                         *" $xxx "*) ;;
22648                         *) dflt="$dflt $xxx" ;;
22649                         esac
22650                 done
22651                 set X $dflt
22652                 shift
22653                 dflt="$*"
22654                 ;;
22655         *)  dflt="$static_ext"
22656                 ;;
22657         esac
22658
22659         case "$dflt" in
22660         '')     dflt=none;;
22661         esac
22662         rp="What extensions do you wish to load statically?"
22663         . ./myread
22664         case "$ans" in
22665         none) static_ext=' ' ;;
22666         *) static_ext="$ans" ;;
22667         esac
22668         ;;
22669 *)
22670         $cat <<EOM
22671 A number of extensions are supplied with $package.  Answer "none"
22672 to include no extensions.
22673 Note that DynaLoader is always built and need not be mentioned here.
22674
22675 EOM
22676         case "$static_ext" in
22677         '') dflt="$avail_ext" ;;
22678         *)      dflt="$static_ext"
22679                 # Perhaps we are reusing an old out-of-date config.sh.
22680                 case "$hint" in
22681                 previous)
22682                         if test X"$static_ext" != X"$avail_ext"; then
22683                                 $cat <<EOM
22684 NOTICE:  Your previous config.sh list may be incorrect.
22685 The extensions now available to you are
22686         ${avail_ext}
22687 but the default list from your previous config.sh is
22688         ${static_ext}
22689
22690 EOM
22691                         fi
22692                         ;;
22693                 esac
22694                 ;;
22695         esac
22696         : Exclude those that are not xs extensions
22697         case "$dflt" in
22698         '')     dflt=none;;
22699         esac
22700         rp="What extensions do you wish to include?"
22701         . ./myread
22702         case "$ans" in
22703         none) static_ext=' ' ;;
22704         *) static_ext="$ans" ;;
22705         esac
22706         ;;
22707 esac
22708 #
22709 # Encode is a special case.  If we are building Encode as a static
22710 # extension, we need to explicitly list its subextensions as well.
22711 # For other nested extensions, this is handled automatically by
22712 # the appropriate Makefile.PL.
22713 case " $static_ext " in
22714         *" Encode "*) # Add the subextensions of Encode
22715         cd "$rsrc/cpan"
22716         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22717                 static_ext="$static_ext Encode/$xxx"
22718         done
22719         cd "$tdir"
22720         ;;
22721 esac
22722
22723 set X $dynamic_ext $static_ext $nonxs_ext
22724 shift
22725 extensions="$*"
22726
22727 # Sanity check:  We require an extension suitable for use with
22728 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22729 # should show up as failures in the test suite, but it's helpful to
22730 # catch them now.) The 'extensions' list is normally sorted
22731 # alphabetically, so we need to accept either
22732 #    DB_File ... Fcntl ... IO  ....
22733 # or something like
22734 #    Fcntl ... NDBM_File ... IO  ....
22735 case " $extensions"  in
22736 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22737 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22738 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22739 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22740    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22741    ;;
22742 esac
22743
22744 : Remove libraries needed only for extensions
22745 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22746 : The exception is SunOS 4.x, which needs them.
22747 case "${osname}X${osvers}" in
22748 sunos*X4*)
22749     perllibs="$libs"
22750     ;;
22751 *) case "$usedl" in
22752     $define|true|[yY]*)
22753             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
22754             shift
22755             perllibs="$*"
22756             ;;
22757     *)  perllibs="$libs"
22758             ;;
22759     esac
22760     ;;
22761 esac
22762
22763 : Remove build directory name from cppstdin so it can be used from
22764 : either the present location or the final installed location.
22765 echo " "
22766 : Get out of the UU directory to get correct path name.
22767 cd ..
22768 case "$cppstdin" in
22769 `pwd`/cppstdin)
22770         echo "Stripping down cppstdin path name"
22771         cppstdin=cppstdin
22772         ;;
22773 esac
22774 cd UU
22775
22776 : end of configuration questions
22777 echo " "
22778 echo "End of configuration questions."
22779 echo " "
22780
22781 : back to where it started
22782 if test -d ../UU; then
22783         cd ..
22784 fi
22785
22786 : configuration may be unconditionally patched via a 'config.arch' file
22787 if $test -f config.arch; then
22788         echo "I see a config.arch file, loading it." >&4
22789         . ./config.arch
22790 fi
22791
22792 : configuration may be patched via a 'config.over' file
22793 if $test -f config.over; then
22794         echo " "
22795         dflt=y
22796         rp='I see a config.over file.  Do you wish to load it?'
22797         . UU/myread
22798         case "$ans" in
22799         n*) echo "OK, I'll ignore it.";;
22800         *)      . ./config.over
22801                 echo "Configuration override changes have been loaded."
22802                 ;;
22803         esac
22804 fi
22805
22806 : in case they want portability, strip down executable paths
22807 case "$d_portable" in
22808 "$define")
22809         echo " "
22810         echo "Stripping down executable paths..." >&4
22811         for file in $loclist $trylist; do
22812                 eval temp=\$$file
22813                 eval $file=`basename $temp`
22814         done
22815         ;;
22816 esac
22817
22818 : create config.sh file
22819 echo " "
22820 echo "Creating config.sh..." >&4
22821 $spitshell <<EOT >config.sh
22822 $startsh
22823 #
22824 # This file was produced by running the Configure script. It holds all the
22825 # definitions figured out by Configure. Should you modify one of these values,
22826 # do not forget to propagate your changes by running "Configure -der". You may
22827 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22828 #
22829
22830 # Package name      : $package
22831 # Source directory  : $src
22832 # Configuration time: $cf_time
22833 # Configured by     : $cf_by
22834 # Target system     : $myuname
22835
22836 EOT
22837 : Add in command line options if available
22838 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22839
22840 $spitshell <<EOT >>config.sh
22841
22842 Author='$Author'
22843 Date='$Date'
22844 Header='$Header'
22845 Id='$Id'
22846 Locker='$Locker'
22847 Log='$Log'
22848 RCSfile='$RCSfile'
22849 Revision='$Revision'
22850 Source='$Source'
22851 State='$State'
22852 _a='$_a'
22853 _exe='$_exe'
22854 _o='$_o'
22855 afs='$afs'
22856 afsroot='$afsroot'
22857 alignbytes='$alignbytes'
22858 ansi2knr='$ansi2knr'
22859 aphostname='$aphostname'
22860 api_revision='$api_revision'
22861 api_subversion='$api_subversion'
22862 api_version='$api_version'
22863 api_versionstring='$api_versionstring'
22864 ar='$ar'
22865 archlib='$archlib'
22866 archlibexp='$archlibexp'
22867 archname64='$archname64'
22868 archname='$archname'
22869 archobjs='$archobjs'
22870 asctime_r_proto='$asctime_r_proto'
22871 awk='$awk'
22872 baserev='$baserev'
22873 bash='$bash'
22874 bin='$bin'
22875 bin_ELF='$bin_ELF'
22876 binexp='$binexp'
22877 bison='$bison'
22878 byacc='$byacc'
22879 byteorder='$byteorder'
22880 c='$c'
22881 castflags='$castflags'
22882 cat='$cat'
22883 cc='$cc'
22884 cccdlflags='$cccdlflags'
22885 ccdlflags='$ccdlflags'
22886 ccflags='$ccflags'
22887 ccflags_uselargefiles='$ccflags_uselargefiles'
22888 ccname='$ccname'
22889 ccsymbols='$ccsymbols'
22890 ccversion='$ccversion'
22891 cf_by='$cf_by'
22892 cf_email='$cf_email'
22893 cf_time='$cf_time'
22894 charbits='$charbits'
22895 charsize='$charsize'
22896 chgrp='$chgrp'
22897 chmod='$chmod'
22898 chown='$chown'
22899 clocktype='$clocktype'
22900 comm='$comm'
22901 compress='$compress'
22902 contains='$contains'
22903 cp='$cp'
22904 cpio='$cpio'
22905 cpp='$cpp'
22906 cpp_stuff='$cpp_stuff'
22907 cppccsymbols='$cppccsymbols'
22908 cppflags='$cppflags'
22909 cpplast='$cpplast'
22910 cppminus='$cppminus'
22911 cpprun='$cpprun'
22912 cppstdin='$cppstdin'
22913 cppsymbols='$cppsymbols'
22914 crypt_r_proto='$crypt_r_proto'
22915 cryptlib='$cryptlib'
22916 csh='$csh'
22917 ctermid_r_proto='$ctermid_r_proto'
22918 ctime_r_proto='$ctime_r_proto'
22919 d_Gconvert='$d_Gconvert'
22920 d_PRIEUldbl='$d_PRIEUldbl'
22921 d_PRIFUldbl='$d_PRIFUldbl'
22922 d_PRIGUldbl='$d_PRIGUldbl'
22923 d_PRIXU64='$d_PRIXU64'
22924 d_PRId64='$d_PRId64'
22925 d_PRIeldbl='$d_PRIeldbl'
22926 d_PRIfldbl='$d_PRIfldbl'
22927 d_PRIgldbl='$d_PRIgldbl'
22928 d_PRIi64='$d_PRIi64'
22929 d_PRIo64='$d_PRIo64'
22930 d_PRIu64='$d_PRIu64'
22931 d_PRIx64='$d_PRIx64'
22932 d_SCNfldbl='$d_SCNfldbl'
22933 d__fwalk='$d__fwalk'
22934 d_access='$d_access'
22935 d_accessx='$d_accessx'
22936 d_aintl='$d_aintl'
22937 d_alarm='$d_alarm'
22938 d_archlib='$d_archlib'
22939 d_asctime64='$d_asctime64'
22940 d_asctime_r='$d_asctime_r'
22941 d_atolf='$d_atolf'
22942 d_atoll='$d_atoll'
22943 d_attribute_deprecated='$d_attribute_deprecated'
22944 d_attribute_format='$d_attribute_format'
22945 d_attribute_malloc='$d_attribute_malloc'
22946 d_attribute_nonnull='$d_attribute_nonnull'
22947 d_attribute_noreturn='$d_attribute_noreturn'
22948 d_attribute_pure='$d_attribute_pure'
22949 d_attribute_unused='$d_attribute_unused'
22950 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22951 d_bcmp='$d_bcmp'
22952 d_bcopy='$d_bcopy'
22953 d_bsd='$d_bsd'
22954 d_bsdgetpgrp='$d_bsdgetpgrp'
22955 d_bsdsetpgrp='$d_bsdsetpgrp'
22956 d_builtin_choose_expr='$d_builtin_choose_expr'
22957 d_builtin_expect='$d_builtin_expect'
22958 d_bzero='$d_bzero'
22959 d_c99_variadic_macros='$d_c99_variadic_macros'
22960 d_casti32='$d_casti32'
22961 d_castneg='$d_castneg'
22962 d_charvspr='$d_charvspr'
22963 d_chown='$d_chown'
22964 d_chroot='$d_chroot'
22965 d_chsize='$d_chsize'
22966 d_class='$d_class'
22967 d_clearenv='$d_clearenv'
22968 d_closedir='$d_closedir'
22969 d_cmsghdr_s='$d_cmsghdr_s'
22970 d_const='$d_const'
22971 d_copysignl='$d_copysignl'
22972 d_cplusplus='$d_cplusplus'
22973 d_crypt='$d_crypt'
22974 d_crypt_r='$d_crypt_r'
22975 d_csh='$d_csh'
22976 d_ctermid='$d_ctermid'
22977 d_ctermid_r='$d_ctermid_r'
22978 d_ctime64='$d_ctime64'
22979 d_ctime_r='$d_ctime_r'
22980 d_cuserid='$d_cuserid'
22981 d_dbl_dig='$d_dbl_dig'
22982 d_dbminitproto='$d_dbminitproto'
22983 d_difftime64='$d_difftime64'
22984 d_difftime='$d_difftime'
22985 d_dir_dd_fd='$d_dir_dd_fd'
22986 d_dirfd='$d_dirfd'
22987 d_dirnamlen='$d_dirnamlen'
22988 d_dlerror='$d_dlerror'
22989 d_dlopen='$d_dlopen'
22990 d_dlsymun='$d_dlsymun'
22991 d_dosuid='$d_dosuid'
22992 d_drand48_r='$d_drand48_r'
22993 d_drand48proto='$d_drand48proto'
22994 d_dup2='$d_dup2'
22995 d_eaccess='$d_eaccess'
22996 d_endgrent='$d_endgrent'
22997 d_endgrent_r='$d_endgrent_r'
22998 d_endhent='$d_endhent'
22999 d_endhostent_r='$d_endhostent_r'
23000 d_endnent='$d_endnent'
23001 d_endnetent_r='$d_endnetent_r'
23002 d_endpent='$d_endpent'
23003 d_endprotoent_r='$d_endprotoent_r'
23004 d_endpwent='$d_endpwent'
23005 d_endpwent_r='$d_endpwent_r'
23006 d_endsent='$d_endsent'
23007 d_endservent_r='$d_endservent_r'
23008 d_eofnblk='$d_eofnblk'
23009 d_eunice='$d_eunice'
23010 d_faststdio='$d_faststdio'
23011 d_fchdir='$d_fchdir'
23012 d_fchmod='$d_fchmod'
23013 d_fchown='$d_fchown'
23014 d_fcntl='$d_fcntl'
23015 d_fcntl_can_lock='$d_fcntl_can_lock'
23016 d_fd_macros='$d_fd_macros'
23017 d_fd_set='$d_fd_set'
23018 d_fds_bits='$d_fds_bits'
23019 d_fgetpos='$d_fgetpos'
23020 d_finite='$d_finite'
23021 d_finitel='$d_finitel'
23022 d_flexfnam='$d_flexfnam'
23023 d_flock='$d_flock'
23024 d_flockproto='$d_flockproto'
23025 d_fork='$d_fork'
23026 d_fp_class='$d_fp_class'
23027 d_fpathconf='$d_fpathconf'
23028 d_fpclass='$d_fpclass'
23029 d_fpclassify='$d_fpclassify'
23030 d_fpclassl='$d_fpclassl'
23031 d_fpos64_t='$d_fpos64_t'
23032 d_frexpl='$d_frexpl'
23033 d_fs_data_s='$d_fs_data_s'
23034 d_fseeko='$d_fseeko'
23035 d_fsetpos='$d_fsetpos'
23036 d_fstatfs='$d_fstatfs'
23037 d_fstatvfs='$d_fstatvfs'
23038 d_fsync='$d_fsync'
23039 d_ftello='$d_ftello'
23040 d_ftime='$d_ftime'
23041 d_futimes='$d_futimes'
23042 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23043 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23044 d_getaddrinfo='$d_getaddrinfo'
23045 d_getcwd='$d_getcwd'
23046 d_getespwnam='$d_getespwnam'
23047 d_getfsstat='$d_getfsstat'
23048 d_getgrent='$d_getgrent'
23049 d_getgrent_r='$d_getgrent_r'
23050 d_getgrgid_r='$d_getgrgid_r'
23051 d_getgrnam_r='$d_getgrnam_r'
23052 d_getgrps='$d_getgrps'
23053 d_gethbyaddr='$d_gethbyaddr'
23054 d_gethbyname='$d_gethbyname'
23055 d_gethent='$d_gethent'
23056 d_gethname='$d_gethname'
23057 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23058 d_gethostbyname_r='$d_gethostbyname_r'
23059 d_gethostent_r='$d_gethostent_r'
23060 d_gethostprotos='$d_gethostprotos'
23061 d_getitimer='$d_getitimer'
23062 d_getlogin='$d_getlogin'
23063 d_getlogin_r='$d_getlogin_r'
23064 d_getmnt='$d_getmnt'
23065 d_getmntent='$d_getmntent'
23066 d_getnameinfo='$d_getnameinfo'
23067 d_getnbyaddr='$d_getnbyaddr'
23068 d_getnbyname='$d_getnbyname'
23069 d_getnent='$d_getnent'
23070 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23071 d_getnetbyname_r='$d_getnetbyname_r'
23072 d_getnetent_r='$d_getnetent_r'
23073 d_getnetprotos='$d_getnetprotos'
23074 d_getpagsz='$d_getpagsz'
23075 d_getpbyname='$d_getpbyname'
23076 d_getpbynumber='$d_getpbynumber'
23077 d_getpent='$d_getpent'
23078 d_getpgid='$d_getpgid'
23079 d_getpgrp2='$d_getpgrp2'
23080 d_getpgrp='$d_getpgrp'
23081 d_getppid='$d_getppid'
23082 d_getprior='$d_getprior'
23083 d_getprotobyname_r='$d_getprotobyname_r'
23084 d_getprotobynumber_r='$d_getprotobynumber_r'
23085 d_getprotoent_r='$d_getprotoent_r'
23086 d_getprotoprotos='$d_getprotoprotos'
23087 d_getprpwnam='$d_getprpwnam'
23088 d_getpwent='$d_getpwent'
23089 d_getpwent_r='$d_getpwent_r'
23090 d_getpwnam_r='$d_getpwnam_r'
23091 d_getpwuid_r='$d_getpwuid_r'
23092 d_getsbyname='$d_getsbyname'
23093 d_getsbyport='$d_getsbyport'
23094 d_getsent='$d_getsent'
23095 d_getservbyname_r='$d_getservbyname_r'
23096 d_getservbyport_r='$d_getservbyport_r'
23097 d_getservent_r='$d_getservent_r'
23098 d_getservprotos='$d_getservprotos'
23099 d_getspnam='$d_getspnam'
23100 d_getspnam_r='$d_getspnam_r'
23101 d_gettimeod='$d_gettimeod'
23102 d_gmtime64='$d_gmtime64'
23103 d_gmtime_r='$d_gmtime_r'
23104 d_gnulibc='$d_gnulibc'
23105 d_grpasswd='$d_grpasswd'
23106 d_hasmntopt='$d_hasmntopt'
23107 d_htonl='$d_htonl'
23108 d_ilogbl='$d_ilogbl'
23109 d_inc_version_list='$d_inc_version_list'
23110 d_index='$d_index'
23111 d_inetaton='$d_inetaton'
23112 d_inetntop='$d_inetntop'
23113 d_inetpton='$d_inetpton'
23114 d_int64_t='$d_int64_t'
23115 d_ip_mreq='$d_ip_mreq'
23116 d_ip_mreq_source='$d_ip_mreq_source'
23117 d_ipv6_mreq='$d_ipv6_mreq'
23118 d_ipv6_mreq_source='$d_ipv6_mreq_source'
23119 d_isascii='$d_isascii'
23120 d_isblank='$d_isblank'
23121 d_isfinite='$d_isfinite'
23122 d_isinf='$d_isinf'
23123 d_isnan='$d_isnan'
23124 d_isnanl='$d_isnanl'
23125 d_killpg='$d_killpg'
23126 d_lchown='$d_lchown'
23127 d_ldbl_dig='$d_ldbl_dig'
23128 d_libm_lib_version='$d_libm_lib_version'
23129 d_link='$d_link'
23130 d_localtime64='$d_localtime64'
23131 d_localtime_r='$d_localtime_r'
23132 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
23133 d_locconv='$d_locconv'
23134 d_lockf='$d_lockf'
23135 d_longdbl='$d_longdbl'
23136 d_longlong='$d_longlong'
23137 d_lseekproto='$d_lseekproto'
23138 d_lstat='$d_lstat'
23139 d_madvise='$d_madvise'
23140 d_malloc_good_size='$d_malloc_good_size'
23141 d_malloc_size='$d_malloc_size'
23142 d_mblen='$d_mblen'
23143 d_mbstowcs='$d_mbstowcs'
23144 d_mbtowc='$d_mbtowc'
23145 d_memchr='$d_memchr'
23146 d_memcmp='$d_memcmp'
23147 d_memcpy='$d_memcpy'
23148 d_memmove='$d_memmove'
23149 d_memset='$d_memset'
23150 d_mkdir='$d_mkdir'
23151 d_mkdtemp='$d_mkdtemp'
23152 d_mkfifo='$d_mkfifo'
23153 d_mkstemp='$d_mkstemp'
23154 d_mkstemps='$d_mkstemps'
23155 d_mktime64='$d_mktime64'
23156 d_mktime='$d_mktime'
23157 d_mmap='$d_mmap'
23158 d_modfl='$d_modfl'
23159 d_modfl_pow32_bug='$d_modfl_pow32_bug'
23160 d_modflproto='$d_modflproto'
23161 d_mprotect='$d_mprotect'
23162 d_msg='$d_msg'
23163 d_msg_ctrunc='$d_msg_ctrunc'
23164 d_msg_dontroute='$d_msg_dontroute'
23165 d_msg_oob='$d_msg_oob'
23166 d_msg_peek='$d_msg_peek'
23167 d_msg_proxy='$d_msg_proxy'
23168 d_msgctl='$d_msgctl'
23169 d_msgget='$d_msgget'
23170 d_msghdr_s='$d_msghdr_s'
23171 d_msgrcv='$d_msgrcv'
23172 d_msgsnd='$d_msgsnd'
23173 d_msync='$d_msync'
23174 d_munmap='$d_munmap'
23175 d_mymalloc='$d_mymalloc'
23176 d_ndbm='$d_ndbm'
23177 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
23178 d_nice='$d_nice'
23179 d_nl_langinfo='$d_nl_langinfo'
23180 d_nv_preserves_uv='$d_nv_preserves_uv'
23181 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
23182 d_off64_t='$d_off64_t'
23183 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23184 d_oldpthreads='$d_oldpthreads'
23185 d_oldsock='$d_oldsock'
23186 d_open3='$d_open3'
23187 d_pathconf='$d_pathconf'
23188 d_pause='$d_pause'
23189 d_perl_otherlibdirs='$d_perl_otherlibdirs'
23190 d_phostname='$d_phostname'
23191 d_pipe='$d_pipe'
23192 d_poll='$d_poll'
23193 d_portable='$d_portable'
23194 d_prctl='$d_prctl'
23195 d_prctl_set_name='$d_prctl_set_name'
23196 d_printf_format_null='$d_printf_format_null'
23197 d_procselfexe='$d_procselfexe'
23198 d_pseudofork='$d_pseudofork'
23199 d_pthread_atfork='$d_pthread_atfork'
23200 d_pthread_attr_setscope='$d_pthread_attr_setscope'
23201 d_pthread_yield='$d_pthread_yield'
23202 d_pwage='$d_pwage'
23203 d_pwchange='$d_pwchange'
23204 d_pwclass='$d_pwclass'
23205 d_pwcomment='$d_pwcomment'
23206 d_pwexpire='$d_pwexpire'
23207 d_pwgecos='$d_pwgecos'
23208 d_pwpasswd='$d_pwpasswd'
23209 d_pwquota='$d_pwquota'
23210 d_qgcvt='$d_qgcvt'
23211 d_quad='$d_quad'
23212 d_random_r='$d_random_r'
23213 d_readdir64_r='$d_readdir64_r'
23214 d_readdir='$d_readdir'
23215 d_readdir_r='$d_readdir_r'
23216 d_readlink='$d_readlink'
23217 d_readv='$d_readv'
23218 d_recvmsg='$d_recvmsg'
23219 d_rename='$d_rename'
23220 d_rewinddir='$d_rewinddir'
23221 d_rmdir='$d_rmdir'
23222 d_safebcpy='$d_safebcpy'
23223 d_safemcpy='$d_safemcpy'
23224 d_sanemcmp='$d_sanemcmp'
23225 d_sbrkproto='$d_sbrkproto'
23226 d_scalbnl='$d_scalbnl'
23227 d_sched_yield='$d_sched_yield'
23228 d_scm_rights='$d_scm_rights'
23229 d_seekdir='$d_seekdir'
23230 d_select='$d_select'
23231 d_sem='$d_sem'
23232 d_semctl='$d_semctl'
23233 d_semctl_semid_ds='$d_semctl_semid_ds'
23234 d_semctl_semun='$d_semctl_semun'
23235 d_semget='$d_semget'
23236 d_semop='$d_semop'
23237 d_sendmsg='$d_sendmsg'
23238 d_setegid='$d_setegid'
23239 d_seteuid='$d_seteuid'
23240 d_setgrent='$d_setgrent'
23241 d_setgrent_r='$d_setgrent_r'
23242 d_setgrps='$d_setgrps'
23243 d_sethent='$d_sethent'
23244 d_sethostent_r='$d_sethostent_r'
23245 d_setitimer='$d_setitimer'
23246 d_setlinebuf='$d_setlinebuf'
23247 d_setlocale='$d_setlocale'
23248 d_setlocale_r='$d_setlocale_r'
23249 d_setnent='$d_setnent'
23250 d_setnetent_r='$d_setnetent_r'
23251 d_setpent='$d_setpent'
23252 d_setpgid='$d_setpgid'
23253 d_setpgrp2='$d_setpgrp2'
23254 d_setpgrp='$d_setpgrp'
23255 d_setprior='$d_setprior'
23256 d_setproctitle='$d_setproctitle'
23257 d_setprotoent_r='$d_setprotoent_r'
23258 d_setpwent='$d_setpwent'
23259 d_setpwent_r='$d_setpwent_r'
23260 d_setregid='$d_setregid'
23261 d_setresgid='$d_setresgid'
23262 d_setresuid='$d_setresuid'
23263 d_setreuid='$d_setreuid'
23264 d_setrgid='$d_setrgid'
23265 d_setruid='$d_setruid'
23266 d_setsent='$d_setsent'
23267 d_setservent_r='$d_setservent_r'
23268 d_setsid='$d_setsid'
23269 d_setvbuf='$d_setvbuf'
23270 d_sfio='$d_sfio'
23271 d_shm='$d_shm'
23272 d_shmat='$d_shmat'
23273 d_shmatprototype='$d_shmatprototype'
23274 d_shmctl='$d_shmctl'
23275 d_shmdt='$d_shmdt'
23276 d_shmget='$d_shmget'
23277 d_sigaction='$d_sigaction'
23278 d_signbit='$d_signbit'
23279 d_sigprocmask='$d_sigprocmask'
23280 d_sigsetjmp='$d_sigsetjmp'
23281 d_sin6_scope_id='$d_sin6_scope_id'
23282 d_sitearch='$d_sitearch'
23283 d_snprintf='$d_snprintf'
23284 d_sockaddr_in6='$d_sockaddr_in6'
23285 d_sockaddr_sa_len='$d_sockaddr_sa_len'
23286 d_sockatmark='$d_sockatmark'
23287 d_sockatmarkproto='$d_sockatmarkproto'
23288 d_socket='$d_socket'
23289 d_socklen_t='$d_socklen_t'
23290 d_sockpair='$d_sockpair'
23291 d_socks5_init='$d_socks5_init'
23292 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23293 d_sqrtl='$d_sqrtl'
23294 d_srand48_r='$d_srand48_r'
23295 d_srandom_r='$d_srandom_r'
23296 d_sresgproto='$d_sresgproto'
23297 d_sresuproto='$d_sresuproto'
23298 d_statblks='$d_statblks'
23299 d_statfs_f_flags='$d_statfs_f_flags'
23300 d_statfs_s='$d_statfs_s'
23301 d_static_inline='$d_static_inline'
23302 d_statvfs='$d_statvfs'
23303 d_stdio_cnt_lval='$d_stdio_cnt_lval'
23304 d_stdio_ptr_lval='$d_stdio_ptr_lval'
23305 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23306 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23307 d_stdio_stream_array='$d_stdio_stream_array'
23308 d_stdiobase='$d_stdiobase'
23309 d_stdstdio='$d_stdstdio'
23310 d_strchr='$d_strchr'
23311 d_strcoll='$d_strcoll'
23312 d_strctcpy='$d_strctcpy'
23313 d_strerrm='$d_strerrm'
23314 d_strerror='$d_strerror'
23315 d_strerror_r='$d_strerror_r'
23316 d_strftime='$d_strftime'
23317 d_strlcat='$d_strlcat'
23318 d_strlcpy='$d_strlcpy'
23319 d_strtod='$d_strtod'
23320 d_strtol='$d_strtol'
23321 d_strtold='$d_strtold'
23322 d_strtoll='$d_strtoll'
23323 d_strtoq='$d_strtoq'
23324 d_strtoul='$d_strtoul'
23325 d_strtoull='$d_strtoull'
23326 d_strtouq='$d_strtouq'
23327 d_strxfrm='$d_strxfrm'
23328 d_suidsafe='$d_suidsafe'
23329 d_symlink='$d_symlink'
23330 d_syscall='$d_syscall'
23331 d_syscallproto='$d_syscallproto'
23332 d_sysconf='$d_sysconf'
23333 d_sysernlst='$d_sysernlst'
23334 d_syserrlst='$d_syserrlst'
23335 d_system='$d_system'
23336 d_tcgetpgrp='$d_tcgetpgrp'
23337 d_tcsetpgrp='$d_tcsetpgrp'
23338 d_telldir='$d_telldir'
23339 d_telldirproto='$d_telldirproto'
23340 d_time='$d_time'
23341 d_timegm='$d_timegm'
23342 d_times='$d_times'
23343 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23344 d_tm_tm_zone='$d_tm_tm_zone'
23345 d_tmpnam_r='$d_tmpnam_r'
23346 d_truncate='$d_truncate'
23347 d_ttyname_r='$d_ttyname_r'
23348 d_tzname='$d_tzname'
23349 d_u32align='$d_u32align'
23350 d_ualarm='$d_ualarm'
23351 d_umask='$d_umask'
23352 d_uname='$d_uname'
23353 d_union_semun='$d_union_semun'
23354 d_unordered='$d_unordered'
23355 d_unsetenv='$d_unsetenv'
23356 d_usleep='$d_usleep'
23357 d_usleepproto='$d_usleepproto'
23358 d_ustat='$d_ustat'
23359 d_vendorarch='$d_vendorarch'
23360 d_vendorbin='$d_vendorbin'
23361 d_vendorlib='$d_vendorlib'
23362 d_vendorscript='$d_vendorscript'
23363 d_vfork='$d_vfork'
23364 d_void_closedir='$d_void_closedir'
23365 d_voidsig='$d_voidsig'
23366 d_voidtty='$d_voidtty'
23367 d_volatile='$d_volatile'
23368 d_vprintf='$d_vprintf'
23369 d_vsnprintf='$d_vsnprintf'
23370 d_wait4='$d_wait4'
23371 d_waitpid='$d_waitpid'
23372 d_wcstombs='$d_wcstombs'
23373 d_wctomb='$d_wctomb'
23374 d_writev='$d_writev'
23375 d_xenix='$d_xenix'
23376 date='$date'
23377 db_hashtype='$db_hashtype'
23378 db_prefixtype='$db_prefixtype'
23379 db_version_major='$db_version_major'
23380 db_version_minor='$db_version_minor'
23381 db_version_patch='$db_version_patch'
23382 defvoidused='$defvoidused'
23383 direntrytype='$direntrytype'
23384 dlext='$dlext'
23385 dlsrc='$dlsrc'
23386 doublesize='$doublesize'
23387 drand01='$drand01'
23388 drand48_r_proto='$drand48_r_proto'
23389 dtrace='$dtrace'
23390 dynamic_ext='$dynamic_ext'
23391 eagain='$eagain'
23392 ebcdic='$ebcdic'
23393 echo='$echo'
23394 egrep='$egrep'
23395 emacs='$emacs'
23396 endgrent_r_proto='$endgrent_r_proto'
23397 endhostent_r_proto='$endhostent_r_proto'
23398 endnetent_r_proto='$endnetent_r_proto'
23399 endprotoent_r_proto='$endprotoent_r_proto'
23400 endpwent_r_proto='$endpwent_r_proto'
23401 endservent_r_proto='$endservent_r_proto'
23402 eunicefix='$eunicefix'
23403 exe_ext='$exe_ext'
23404 expr='$expr'
23405 extensions='$extensions'
23406 extern_C='$extern_C'
23407 extras='$extras'
23408 fflushNULL='$fflushNULL'
23409 fflushall='$fflushall'
23410 find='$find'
23411 firstmakefile='$firstmakefile'
23412 flex='$flex'
23413 fpossize='$fpossize'
23414 fpostype='$fpostype'
23415 freetype='$freetype'
23416 from='$from'
23417 full_ar='$full_ar'
23418 full_csh='$full_csh'
23419 full_sed='$full_sed'
23420 gccansipedantic='$gccansipedantic'
23421 gccosandvers='$gccosandvers'
23422 gccversion='$gccversion'
23423 getgrent_r_proto='$getgrent_r_proto'
23424 getgrgid_r_proto='$getgrgid_r_proto'
23425 getgrnam_r_proto='$getgrnam_r_proto'
23426 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23427 gethostbyname_r_proto='$gethostbyname_r_proto'
23428 gethostent_r_proto='$gethostent_r_proto'
23429 getlogin_r_proto='$getlogin_r_proto'
23430 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23431 getnetbyname_r_proto='$getnetbyname_r_proto'
23432 getnetent_r_proto='$getnetent_r_proto'
23433 getprotobyname_r_proto='$getprotobyname_r_proto'
23434 getprotobynumber_r_proto='$getprotobynumber_r_proto'
23435 getprotoent_r_proto='$getprotoent_r_proto'
23436 getpwent_r_proto='$getpwent_r_proto'
23437 getpwnam_r_proto='$getpwnam_r_proto'
23438 getpwuid_r_proto='$getpwuid_r_proto'
23439 getservbyname_r_proto='$getservbyname_r_proto'
23440 getservbyport_r_proto='$getservbyport_r_proto'
23441 getservent_r_proto='$getservent_r_proto'
23442 getspnam_r_proto='$getspnam_r_proto'
23443 gidformat='$gidformat'
23444 gidsign='$gidsign'
23445 gidsize='$gidsize'
23446 gidtype='$gidtype'
23447 glibpth='$glibpth'
23448 gmake='$gmake'
23449 gmtime_r_proto='$gmtime_r_proto'
23450 gnulibc_version='$gnulibc_version'
23451 grep='$grep'
23452 groupcat='$groupcat'
23453 groupstype='$groupstype'
23454 gzip='$gzip'
23455 h_fcntl='$h_fcntl'
23456 h_sysfile='$h_sysfile'
23457 hint='$hint'
23458 hostcat='$hostcat'
23459 html1dir='$html1dir'
23460 html1direxp='$html1direxp'
23461 html3dir='$html3dir'
23462 html3direxp='$html3direxp'
23463 i16size='$i16size'
23464 i16type='$i16type'
23465 i32size='$i32size'
23466 i32type='$i32type'
23467 i64size='$i64size'
23468 i64type='$i64type'
23469 i8size='$i8size'
23470 i8type='$i8type'
23471 i_arpainet='$i_arpainet'
23472 i_assert='$i_assert'
23473 i_bsdioctl='$i_bsdioctl'
23474 i_crypt='$i_crypt'
23475 i_db='$i_db'
23476 i_dbm='$i_dbm'
23477 i_dirent='$i_dirent'
23478 i_dld='$i_dld'
23479 i_dlfcn='$i_dlfcn'
23480 i_fcntl='$i_fcntl'
23481 i_float='$i_float'
23482 i_fp='$i_fp'
23483 i_fp_class='$i_fp_class'
23484 i_gdbm='$i_gdbm'
23485 i_gdbm_ndbm='$i_gdbm_ndbm'
23486 i_gdbmndbm='$i_gdbmndbm'
23487 i_grp='$i_grp'
23488 i_ieeefp='$i_ieeefp'
23489 i_inttypes='$i_inttypes'
23490 i_langinfo='$i_langinfo'
23491 i_libutil='$i_libutil'
23492 i_limits='$i_limits'
23493 i_locale='$i_locale'
23494 i_machcthr='$i_machcthr'
23495 i_malloc='$i_malloc'
23496 i_mallocmalloc='$i_mallocmalloc'
23497 i_math='$i_math'
23498 i_memory='$i_memory'
23499 i_mntent='$i_mntent'
23500 i_ndbm='$i_ndbm'
23501 i_netdb='$i_netdb'
23502 i_neterrno='$i_neterrno'
23503 i_netinettcp='$i_netinettcp'
23504 i_niin='$i_niin'
23505 i_poll='$i_poll'
23506 i_prot='$i_prot'
23507 i_pthread='$i_pthread'
23508 i_pwd='$i_pwd'
23509 i_rpcsvcdbm='$i_rpcsvcdbm'
23510 i_sfio='$i_sfio'
23511 i_sgtty='$i_sgtty'
23512 i_shadow='$i_shadow'
23513 i_socks='$i_socks'
23514 i_stdarg='$i_stdarg'
23515 i_stdbool='$i_stdbool'
23516 i_stddef='$i_stddef'
23517 i_stdlib='$i_stdlib'
23518 i_string='$i_string'
23519 i_sunmath='$i_sunmath'
23520 i_sysaccess='$i_sysaccess'
23521 i_sysdir='$i_sysdir'
23522 i_sysfile='$i_sysfile'
23523 i_sysfilio='$i_sysfilio'
23524 i_sysin='$i_sysin'
23525 i_sysioctl='$i_sysioctl'
23526 i_syslog='$i_syslog'
23527 i_sysmman='$i_sysmman'
23528 i_sysmode='$i_sysmode'
23529 i_sysmount='$i_sysmount'
23530 i_sysndir='$i_sysndir'
23531 i_sysparam='$i_sysparam'
23532 i_syspoll='$i_syspoll'
23533 i_sysresrc='$i_sysresrc'
23534 i_syssecrt='$i_syssecrt'
23535 i_sysselct='$i_sysselct'
23536 i_syssockio='$i_syssockio'
23537 i_sysstat='$i_sysstat'
23538 i_sysstatfs='$i_sysstatfs'
23539 i_sysstatvfs='$i_sysstatvfs'
23540 i_systime='$i_systime'
23541 i_systimek='$i_systimek'
23542 i_systimes='$i_systimes'
23543 i_systypes='$i_systypes'
23544 i_sysuio='$i_sysuio'
23545 i_sysun='$i_sysun'
23546 i_sysutsname='$i_sysutsname'
23547 i_sysvfs='$i_sysvfs'
23548 i_syswait='$i_syswait'
23549 i_termio='$i_termio'
23550 i_termios='$i_termios'
23551 i_time='$i_time'
23552 i_unistd='$i_unistd'
23553 i_ustat='$i_ustat'
23554 i_utime='$i_utime'
23555 i_values='$i_values'
23556 i_varargs='$i_varargs'
23557 i_varhdr='$i_varhdr'
23558 i_vfork='$i_vfork'
23559 ignore_versioned_solibs='$ignore_versioned_solibs'
23560 inc_version_list='$inc_version_list'
23561 inc_version_list_init='$inc_version_list_init'
23562 incpath='$incpath'
23563 inews='$inews'
23564 initialinstalllocation='$initialinstalllocation'
23565 installarchlib='$installarchlib'
23566 installbin='$installbin'
23567 installhtml1dir='$installhtml1dir'
23568 installhtml3dir='$installhtml3dir'
23569 installman1dir='$installman1dir'
23570 installman3dir='$installman3dir'
23571 installprefix='$installprefix'
23572 installprefixexp='$installprefixexp'
23573 installprivlib='$installprivlib'
23574 installscript='$installscript'
23575 installsitearch='$installsitearch'
23576 installsitebin='$installsitebin'
23577 installsitehtml1dir='$installsitehtml1dir'
23578 installsitehtml3dir='$installsitehtml3dir'
23579 installsitelib='$installsitelib'
23580 installsiteman1dir='$installsiteman1dir'
23581 installsiteman3dir='$installsiteman3dir'
23582 installsitescript='$installsitescript'
23583 installstyle='$installstyle'
23584 installusrbinperl='$installusrbinperl'
23585 installvendorarch='$installvendorarch'
23586 installvendorbin='$installvendorbin'
23587 installvendorhtml1dir='$installvendorhtml1dir'
23588 installvendorhtml3dir='$installvendorhtml3dir'
23589 installvendorlib='$installvendorlib'
23590 installvendorman1dir='$installvendorman1dir'
23591 installvendorman3dir='$installvendorman3dir'
23592 installvendorscript='$installvendorscript'
23593 intsize='$intsize'
23594 issymlink='$issymlink'
23595 ivdformat='$ivdformat'
23596 ivsize='$ivsize'
23597 ivtype='$ivtype'
23598 known_extensions='$known_extensions'
23599 ksh='$ksh'
23600 ld='$ld'
23601 ld_can_script='$ld_can_script'
23602 lddlflags='$lddlflags'
23603 ldflags='$ldflags'
23604 ldflags_uselargefiles='$ldflags_uselargefiles'
23605 ldlibpthname='$ldlibpthname'
23606 less='$less'
23607 lib_ext='$lib_ext'
23608 libc='$libc'
23609 libperl='$libperl'
23610 libpth='$libpth'
23611 libs='$libs'
23612 libsdirs='$libsdirs'
23613 libsfiles='$libsfiles'
23614 libsfound='$libsfound'
23615 libspath='$libspath'
23616 libswanted='$libswanted'
23617 libswanted_uselargefiles='$libswanted_uselargefiles'
23618 line='$line'
23619 lint='$lint'
23620 lkflags='$lkflags'
23621 ln='$ln'
23622 lns='$lns'
23623 localtime_r_proto='$localtime_r_proto'
23624 locincpth='$locincpth'
23625 loclibpth='$loclibpth'
23626 longdblsize='$longdblsize'
23627 longlongsize='$longlongsize'
23628 longsize='$longsize'
23629 lp='$lp'
23630 lpr='$lpr'
23631 ls='$ls'
23632 lseeksize='$lseeksize'
23633 lseektype='$lseektype'
23634 mad='$mad'
23635 madlyh='$madlyh'
23636 madlyobj='$madlyobj'
23637 madlysrc='$madlysrc'
23638 mail='$mail'
23639 mailx='$mailx'
23640 make='$make'
23641 make_set_make='$make_set_make'
23642 mallocobj='$mallocobj'
23643 mallocsrc='$mallocsrc'
23644 malloctype='$malloctype'
23645 man1dir='$man1dir'
23646 man1direxp='$man1direxp'
23647 man1ext='$man1ext'
23648 man3dir='$man3dir'
23649 man3direxp='$man3direxp'
23650 man3ext='$man3ext'
23651 mips_type='$mips_type'
23652 mistrustnm='$mistrustnm'
23653 mkdir='$mkdir'
23654 mmaptype='$mmaptype'
23655 modetype='$modetype'
23656 more='$more'
23657 multiarch='$multiarch'
23658 mv='$mv'
23659 myarchname='$myarchname'
23660 mydomain='$mydomain'
23661 myhostname='$myhostname'
23662 myuname='$myuname'
23663 n='$n'
23664 need_va_copy='$need_va_copy'
23665 netdb_hlen_type='$netdb_hlen_type'
23666 netdb_host_type='$netdb_host_type'
23667 netdb_name_type='$netdb_name_type'
23668 netdb_net_type='$netdb_net_type'
23669 nm='$nm'
23670 nm_opt='$nm_opt'
23671 nm_so_opt='$nm_so_opt'
23672 nonxs_ext='$nonxs_ext'
23673 nroff='$nroff'
23674 nvEUformat='$nvEUformat'
23675 nvFUformat='$nvFUformat'
23676 nvGUformat='$nvGUformat'
23677 nv_overflows_integers_at='$nv_overflows_integers_at'
23678 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23679 nveformat='$nveformat'
23680 nvfformat='$nvfformat'
23681 nvgformat='$nvgformat'
23682 nvsize='$nvsize'
23683 nvtype='$nvtype'
23684 o_nonblock='$o_nonblock'
23685 obj_ext='$obj_ext'
23686 old_pthread_create_joinable='$old_pthread_create_joinable'
23687 optimize='$optimize'
23688 orderlib='$orderlib'
23689 osname='$osname'
23690 osvers='$osvers'
23691 otherlibdirs='$otherlibdirs'
23692 package='$package'
23693 pager='$pager'
23694 passcat='$passcat'
23695 patchlevel='$patchlevel'
23696 path_sep='$path_sep'
23697 perl5='$perl5'
23698 perl='$perl'
23699 perl_patchlevel='$perl_patchlevel'
23700 perl_static_inline='$perl_static_inline'
23701 perladmin='$perladmin'
23702 perllibs='$perllibs'
23703 perlpath='$perlpath'
23704 pg='$pg'
23705 phostname='$phostname'
23706 pidtype='$pidtype'
23707 plibpth='$plibpth'
23708 pmake='$pmake'
23709 pr='$pr'
23710 prefix='$prefix'
23711 prefixexp='$prefixexp'
23712 privlib='$privlib'
23713 privlibexp='$privlibexp'
23714 procselfexe='$procselfexe'
23715 prototype='$prototype'
23716 ptrsize='$ptrsize'
23717 quadkind='$quadkind'
23718 quadtype='$quadtype'
23719 randbits='$randbits'
23720 randfunc='$randfunc'
23721 random_r_proto='$random_r_proto'
23722 randseedtype='$randseedtype'
23723 ranlib='$ranlib'
23724 rd_nodata='$rd_nodata'
23725 readdir64_r_proto='$readdir64_r_proto'
23726 readdir_r_proto='$readdir_r_proto'
23727 revision='$revision'
23728 rm='$rm'
23729 rm_try='$rm_try'
23730 rmail='$rmail'
23731 run='$run'
23732 runnm='$runnm'
23733 sGMTIME_max='$sGMTIME_max'
23734 sGMTIME_min='$sGMTIME_min'
23735 sLOCALTIME_max='$sLOCALTIME_max'
23736 sLOCALTIME_min='$sLOCALTIME_min'
23737 sPRIEUldbl='$sPRIEUldbl'
23738 sPRIFUldbl='$sPRIFUldbl'
23739 sPRIGUldbl='$sPRIGUldbl'
23740 sPRIXU64='$sPRIXU64'
23741 sPRId64='$sPRId64'
23742 sPRIeldbl='$sPRIeldbl'
23743 sPRIfldbl='$sPRIfldbl'
23744 sPRIgldbl='$sPRIgldbl'
23745 sPRIi64='$sPRIi64'
23746 sPRIo64='$sPRIo64'
23747 sPRIu64='$sPRIu64'
23748 sPRIx64='$sPRIx64'
23749 sSCNfldbl='$sSCNfldbl'
23750 sched_yield='$sched_yield'
23751 scriptdir='$scriptdir'
23752 scriptdirexp='$scriptdirexp'
23753 sed='$sed'
23754 seedfunc='$seedfunc'
23755 selectminbits='$selectminbits'
23756 selecttype='$selecttype'
23757 sendmail='$sendmail'
23758 setgrent_r_proto='$setgrent_r_proto'
23759 sethostent_r_proto='$sethostent_r_proto'
23760 setlocale_r_proto='$setlocale_r_proto'
23761 setnetent_r_proto='$setnetent_r_proto'
23762 setprotoent_r_proto='$setprotoent_r_proto'
23763 setpwent_r_proto='$setpwent_r_proto'
23764 setservent_r_proto='$setservent_r_proto'
23765 sh='$sh'
23766 shar='$shar'
23767 sharpbang='$sharpbang'
23768 shmattype='$shmattype'
23769 shortsize='$shortsize'
23770 shrpenv='$shrpenv'
23771 shsharp='$shsharp'
23772 sig_count='$sig_count'
23773 sig_name='$sig_name'
23774 sig_name_init='$sig_name_init'
23775 sig_num='$sig_num'
23776 sig_num_init='$sig_num_init'
23777 sig_size='$sig_size'
23778 signal_t='$signal_t'
23779 sitearch='$sitearch'
23780 sitearchexp='$sitearchexp'
23781 sitebin='$sitebin'
23782 sitebinexp='$sitebinexp'
23783 sitehtml1dir='$sitehtml1dir'
23784 sitehtml1direxp='$sitehtml1direxp'
23785 sitehtml3dir='$sitehtml3dir'
23786 sitehtml3direxp='$sitehtml3direxp'
23787 sitelib='$sitelib'
23788 sitelib_stem='$sitelib_stem'
23789 sitelibexp='$sitelibexp'
23790 siteman1dir='$siteman1dir'
23791 siteman1direxp='$siteman1direxp'
23792 siteman3dir='$siteman3dir'
23793 siteman3direxp='$siteman3direxp'
23794 siteprefix='$siteprefix'
23795 siteprefixexp='$siteprefixexp'
23796 sitescript='$sitescript'
23797 sitescriptexp='$sitescriptexp'
23798 sizesize='$sizesize'
23799 sizetype='$sizetype'
23800 sleep='$sleep'
23801 smail='$smail'
23802 so='$so'
23803 sockethdr='$sockethdr'
23804 socketlib='$socketlib'
23805 socksizetype='$socksizetype'
23806 sort='$sort'
23807 spackage='$spackage'
23808 spitshell='$spitshell'
23809 srand48_r_proto='$srand48_r_proto'
23810 srandom_r_proto='$srandom_r_proto'
23811 src='$src'
23812 ssizetype='$ssizetype'
23813 st_ino_sign='$st_ino_sign'
23814 st_ino_size='$st_ino_size'
23815 startperl='$startperl'
23816 startsh='$startsh'
23817 static_ext='$static_ext'
23818 stdchar='$stdchar'
23819 stdio_base='$stdio_base'
23820 stdio_bufsiz='$stdio_bufsiz'
23821 stdio_cnt='$stdio_cnt'
23822 stdio_filbuf='$stdio_filbuf'
23823 stdio_ptr='$stdio_ptr'
23824 stdio_stream_array='$stdio_stream_array'
23825 strerror_r_proto='$strerror_r_proto'
23826 strings='$strings'
23827 submit='$submit'
23828 subversion='$subversion'
23829 sysman='$sysman'
23830 tail='$tail'
23831 tar='$tar'
23832 targetarch='$targetarch'
23833 tbl='$tbl'
23834 tee='$tee'
23835 test='$test'
23836 timeincl='$timeincl'
23837 timetype='$timetype'
23838 tmpnam_r_proto='$tmpnam_r_proto'
23839 to='$to'
23840 touch='$touch'
23841 tr='$tr'
23842 trnl='$trnl'
23843 troff='$troff'
23844 ttyname_r_proto='$ttyname_r_proto'
23845 u16size='$u16size'
23846 u16type='$u16type'
23847 u32size='$u32size'
23848 u32type='$u32type'
23849 u64size='$u64size'
23850 u64type='$u64type'
23851 u8size='$u8size'
23852 u8type='$u8type'
23853 uidformat='$uidformat'
23854 uidsign='$uidsign'
23855 uidsize='$uidsize'
23856 uidtype='$uidtype'
23857 uname='$uname'
23858 uniq='$uniq'
23859 uquadtype='$uquadtype'
23860 use5005threads='$use5005threads'
23861 use64bitall='$use64bitall'
23862 use64bitint='$use64bitint'
23863 usecrosscompile='$usecrosscompile'
23864 usedevel='$usedevel'
23865 usedl='$usedl'
23866 usedtrace='$usedtrace'
23867 usefaststdio='$usefaststdio'
23868 useithreads='$useithreads'
23869 usekernprocpathname='$usekernprocpathname'
23870 uselargefiles='$uselargefiles'
23871 uselongdouble='$uselongdouble'
23872 usemallocwrap='$usemallocwrap'
23873 usemorebits='$usemorebits'
23874 usemultiplicity='$usemultiplicity'
23875 usemymalloc='$usemymalloc'
23876 usenm='$usenm'
23877 usensgetexecutablepath='$usensgetexecutablepath'
23878 useopcode='$useopcode'
23879 useperlio='$useperlio'
23880 useposix='$useposix'
23881 usereentrant='$usereentrant'
23882 userelocatableinc='$userelocatableinc'
23883 usesfio='$usesfio'
23884 useshrplib='$useshrplib'
23885 usesitecustomize='$usesitecustomize'
23886 usesocks='$usesocks'
23887 usethreads='$usethreads'
23888 usevendorprefix='$usevendorprefix'
23889 useversionedarchname='$useversionedarchname'
23890 usevfork='$usevfork'
23891 usrinc='$usrinc'
23892 uuname='$uuname'
23893 uvXUformat='$uvXUformat'
23894 uvoformat='$uvoformat'
23895 uvsize='$uvsize'
23896 uvtype='$uvtype'
23897 uvuformat='$uvuformat'
23898 uvxformat='$uvxformat'
23899 vaproto='$vaproto'
23900 vendorarch='$vendorarch'
23901 vendorarchexp='$vendorarchexp'
23902 vendorbin='$vendorbin'
23903 vendorbinexp='$vendorbinexp'
23904 vendorhtml1dir='$vendorhtml1dir'
23905 vendorhtml1direxp='$vendorhtml1direxp'
23906 vendorhtml3dir='$vendorhtml3dir'
23907 vendorhtml3direxp='$vendorhtml3direxp'
23908 vendorlib='$vendorlib'
23909 vendorlib_stem='$vendorlib_stem'
23910 vendorlibexp='$vendorlibexp'
23911 vendorman1dir='$vendorman1dir'
23912 vendorman1direxp='$vendorman1direxp'
23913 vendorman3dir='$vendorman3dir'
23914 vendorman3direxp='$vendorman3direxp'
23915 vendorprefix='$vendorprefix'
23916 vendorprefixexp='$vendorprefixexp'
23917 vendorscript='$vendorscript'
23918 vendorscriptexp='$vendorscriptexp'
23919 version='$version'
23920 version_patchlevel_string='$version_patchlevel_string'
23921 versiononly='$versiononly'
23922 vi='$vi'
23923 voidflags='$voidflags'
23924 xlibpth='$xlibpth'
23925 yacc='$yacc'
23926 yaccflags='$yaccflags'
23927 zcat='$zcat'
23928 zip='$zip'
23929 EOT
23930
23931 : add special variables
23932 $test -f $src/patchlevel.h && \
23933 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23934 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23935 echo "PERL_CONFIG_SH=true" >>config.sh
23936
23937 : propagate old symbols
23938 if $test -f UU/config.sh; then
23939         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23940         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23941                 config.sh config.sh UU/oldconfig.sh |\
23942                 $sort | $uniq -u >UU/oldsyms
23943         set X `$cat UU/oldsyms`
23944         shift
23945         case $# in
23946         0) ;;
23947         *)
23948                 $cat <<EOM
23949 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23950 EOM
23951                 echo ": Variables propagated from previous config.sh file." >>config.sh
23952                 for sym in `$cat UU/oldsyms`; do
23953                         echo "    Propagating $hint variable "'$'"$sym..."
23954                         eval 'tmp="$'"${sym}"'"'
23955                         echo "$tmp" | \
23956                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23957                 done
23958                 ;;
23959         esac
23960 fi
23961
23962 : Finish up by extracting the .SH files
23963 case "$alldone" in
23964 exit)
23965         $rm -rf UU
23966         echo "Extraction done."
23967         exit 0
23968         ;;
23969 cont)
23970         ;;
23971 '')
23972         dflt=''
23973         nostick=true
23974         $cat <<EOM
23975
23976 If you'd like to make any changes to the config.sh file before I begin
23977 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23978
23979 EOM
23980         rp="Press return or use a shell escape to edit config.sh:"
23981         . UU/myread
23982         nostick=''
23983         case "$ans" in
23984         '') ;;
23985         *) : in case they cannot read
23986                 sh 1>&4 -c "$ans";;
23987         esac
23988         ;;
23989 esac
23990
23991 : if this fails, just run all the .SH files by hand
23992 . ./config.sh
23993
23994 echo " "
23995 exec 1>&4
23996 pwd=`pwd`
23997 . ./UU/extract
23998 cd "$pwd"
23999
24000 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24001         dflt=y
24002         case "$silent" in
24003         true) ;;
24004         *)
24005                 $cat <<EOM
24006
24007 Now you need to generate make dependencies by running "$make depend".
24008 You might prefer to run it in background: "$make depend > makedepend.out &"
24009 It can take a while, so you might not want to run it right now.
24010
24011 EOM
24012                 ;;
24013         esac
24014         rp="Run $make depend now?"
24015         . UU/myread
24016         case "$ans" in
24017         y*)
24018                 $make depend && echo "Now you must run '$make'."
24019                 ;;
24020         *)
24021                 echo "You must run '$make depend' then '$make'."
24022                 ;;
24023         esac
24024 elif test -f [Mm]akefile; then
24025         echo " "
24026         echo "Now you must run a $make."
24027 else
24028         echo "Configure done."
24029 fi
24030
24031 if $test -f Policy.sh; then
24032     $cat <<EOM
24033
24034 If you compile $package on a different machine or from a different object
24035 directory, copy the Policy.sh file from this object directory to the
24036 new one before you run Configure -- this will help you with most of
24037 the policy defaults.
24038
24039 EOM
24040 fi
24041 if $test -f config.msg; then
24042     echo "Hmm.  I also noted the following information while running:"
24043     echo " "
24044     $cat config.msg >&4
24045     $rm -f config.msg
24046 fi
24047 $rm -f kit*isdone ark*isdone
24048 $rm -rf UU
24049
24050 : End of Configure
24051