This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Typemap.xs: fix warning under clang
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist package (which contains metaconfig) is available via SVN:
17 #     svn co https://svn.sourceforge.net/svnroot/dist/trunk/dist
18 #
19 # Though this script was generated by metaconfig from metaunits, it is
20 # OK to send patches against Configure itself. It's up to the Configure
21 # pumpkin to backport the patch to the metaunits if it is accepted.
22 # For more information on patching Configure, see pod/perlhack.pod
23 #
24 # The metaunits are also available from the public git repository:
25 #     http://perl5.git.perl.org/metaconfig.git/ or
26 #     $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
27 #
28 # See Porting/pumpkin.pod for more information on metaconfig.
29 #
30
31 # Generated on Sun Aug 26 14:33:39 CEST 2012 [metaconfig 3.5 PL0]
32 # (with additional metaconfig patches by perlbug@perl.org)
33
34 cat >c1$$ <<EOF
35 ARGGGHHHH!!!!!
36
37 SCO csh still thinks true is false.  Write to SCO today and tell them that next
38 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
39
40 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
41 we'd have to do is go in and swap the && and || tokens, wherever they are.)
42
43 [End of diatribe. We now return you to your regularly scheduled programming...]
44 EOF
45 cat >c2$$ <<EOF
46
47 OOPS!  You naughty creature!  You didn't run Configure with sh!
48 I will attempt to remedy the situation by running sh for you...
49 EOF
50
51 true || cat c1$$ c2$$
52 true || exec sh $0 $argv:q
53
54 (exit $?0) || cat c2$$
55 (exit $?0) || exec sh $0 $argv:q
56 rm -f c1$$ c2$$
57
58 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
59         cat <<EOF
60 ***
61 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
62 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
63 *** Please read the README.plan9 for further instructions.
64 *** Cannot continue, aborting.
65 ***
66 EOF
67         exit 1
68 fi
69
70 if test ! -c /dev/null ; then
71         cat <<EOF
72 ***
73 *** I'm sorry, but /dev/null appears to be a file rather than a device.
74 *** Please consult your operating sytem's notes for making a device
75 *** in /dev.
76 *** Cannot continue, aborting.
77 ***
78 EOF
79         exit 1
80 fi
81
82 : compute my invocation name
83 me=$0
84 case "$0" in
85 */*)
86         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
87         test "$me" || me=$0
88         ;;
89 esac
90
91 : Proper separator for the PATH environment variable
92 p_=:
93 : On OS/2 this directory should exist if this is not floppy only system ":-]"
94 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
95         if test -n "$OS2_SHELL"; then
96                 p_=\;
97                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
98                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
99                 is_os2=yes
100         elif test -n "$DJGPP"; then
101                 case "X${MACHTYPE:-nonesuchmach}" in
102                 *cygwin) ;;
103                 *) p_=\; ;;
104                 esac
105         fi
106 fi
107
108 : Proper PATH setting
109 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
110 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
111 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
112 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
113 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
114 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
115 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
116 paths="$paths /sbin /usr/sbin /usr/libexec"
117 paths="$paths /system/gnu_library/bin"
118
119 for p in $paths
120 do
121         case "$p_$PATH$p_" in
122         *$p_$p$p_*) ;;
123         *) test -d $p && PATH=$PATH$p_$p ;;
124         esac
125 done
126
127 PATH=.$p_$PATH
128 export PATH
129
130 : shall we be using ksh?
131 inksh=''
132 needksh=''
133 avoidksh=''
134 newsh=/bin/ksh
135 changesh=''
136 if (PATH=.; alias -x) >/dev/null 2>&1; then
137                 inksh=true
138 fi
139 if test -f /hp-ux -a -f /bin/ksh; then
140         needksh='to avoid sh bug in "here document" expansion'
141 fi
142 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
143         if test X`/usr/bin/uname -v` = X4; then
144                 avoidksh="to avoid AIX 4's /bin/sh"
145                 newsh=/usr/bin/bsh
146         fi
147 fi
148 if test -f /osf_boot -a -f /usr/sbin/setld; then
149         if test X`/usr/bin/uname -s` = XOSF1; then
150                 avoidksh="to avoid Digital UNIX' ksh"
151                 newsh=/bin/sh
152                 unset BIN_SH
153         fi
154 fi
155 case "$inksh/$needksh" in
156 /[a-z]*)
157                 ENV=''
158                 changesh=true
159                 reason="$needksh"
160         ;;
161 esac
162 case "$inksh/$avoidksh" in
163 true/[a-z]*)
164         changesh=true
165         reason="$avoidksh"
166         ;;
167 esac
168 case "$inksh/$needksh-$avoidksh-" in
169 true/--)
170                 cat <<EOM
171 (I see you are using the Korn shell.  Some ksh's blow up on $me,
172 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
173 EOM
174         ;;
175 esac
176 case "$changesh" in
177 true)
178         export newsh
179         echo "(Feeding myself to $newsh $reason.)"
180         case "$0" in
181         Configure|*/Configure) exec $newsh $0 "$@";;
182         *) exec $newsh Configure "$@";;
183         esac
184         ;;
185 esac
186 test -x "${newsh}" || unset newsh
187
188 : if needed, set CDPATH to a harmless value that is not chatty
189 : avoid bash 2.02 problems with empty CDPATH.
190 case "$CDPATH" in
191 '')     ;;
192 *)      case "$SHELL" in
193         *bash*) CDPATH='.' ;;
194         *) CDPATH='' ;;
195         esac
196         ;;
197 esac
198
199 : Configure runs within the UU subdirectory
200 test -d UU || mkdir UU
201 cd UU && rm -f ./*
202
203 ccname=''
204 ccversion=''
205 ccsymbols=''
206 cppccsymbols=''
207 cppsymbols=''
208 from=''
209 run=''
210 targetarch=''
211 to=''
212 usecrosscompile=''
213 extern_C=''
214 mistrustnm=''
215 usedevel=''
216 perllibs=''
217 dynamic_ext=''
218 extensions=''
219 known_extensions=''
220 nonxs_ext=''
221 static_ext=''
222 useopcode=''
223 useposix=''
224 extras=''
225 d_bsd=''
226 d_eunice=''
227 d_xenix=''
228 eunicefix=''
229 ar=''
230 awk=''
231 bash=''
232 bison=''
233 byacc=''
234 cat=''
235 chgrp=''
236 chmod=''
237 chown=''
238 comm=''
239 compress=''
240 cp=''
241 cpio=''
242 cpp=''
243 csh=''
244 date=''
245 echo=''
246 egrep=''
247 emacs=''
248 expr=''
249 find=''
250 flex=''
251 gmake=''
252 grep=''
253 gzip=''
254 inews=''
255 ksh=''
256 less=''
257 line=''
258 lint=''
259 ln=''
260 lp=''
261 lpr=''
262 ls=''
263 mail=''
264 mailx=''
265 make=''
266 mkdir=''
267 more=''
268 mv=''
269 nm=''
270 nroff=''
271 perl=''
272 pg=''
273 pmake=''
274 pr=''
275 rm=''
276 rmail=''
277 sed=''
278 sendmail=''
279 shar=''
280 sleep=''
281 smail=''
282 sort=''
283 submit=''
284 tail=''
285 tar=''
286 tbl=''
287 tee=''
288 test=''
289 touch=''
290 tr=''
291 troff=''
292 uname=''
293 uniq=''
294 uuname=''
295 vi=''
296 zcat=''
297 zip=''
298 full_ar=''
299 full_sed=''
300 libswanted=''
301 hint=''
302 myuname=''
303 osname=''
304 osvers=''
305 Author=''
306 Date=''
307 Header=''
308 Id=''
309 Locker=''
310 Log=''
311 RCSfile=''
312 Revision=''
313 Source=''
314 State=''
315 _a=''
316 _exe=''
317 _o=''
318 archobjs=''
319 exe_ext=''
320 firstmakefile=''
321 lib_ext=''
322 obj_ext=''
323 path_sep=''
324 rm_try=''
325 afs=''
326 afsroot=''
327 alignbytes=''
328 ansi2knr=''
329 archlib=''
330 archlibexp=''
331 d_archlib=''
332 installarchlib=''
333 archname=''
334 myarchname=''
335 d_atolf=''
336 d_atoll=''
337 baserev=''
338 bin=''
339 binexp=''
340 initialinstalllocation=''
341 installbin=''
342 userelocatableinc=''
343 byteorder=''
344 cc=''
345 ccflags=''
346 cppflags=''
347 ldflags=''
348 lkflags=''
349 locincpth=''
350 optimize=''
351 cf_email=''
352 cf_by=''
353 cf_time=''
354 charbits=''
355 charsize=''
356 contains=''
357 cpp_stuff=''
358 cpplast=''
359 cppminus=''
360 cpprun=''
361 cppstdin=''
362 d__fwalk=''
363 d_access=''
364 d_accessx=''
365 d_aintl=''
366 d_alarm=''
367 asctime_r_proto=''
368 d_asctime_r=''
369 d_attribute_deprecated=''
370 d_attribute_format=''
371 d_attribute_malloc=''
372 d_attribute_nonnull=''
373 d_attribute_noreturn=''
374 d_attribute_pure=''
375 d_attribute_unused=''
376 d_attribute_warn_unused_result=''
377 d_printf_format_null=''
378 d_bcmp=''
379 d_bcopy=''
380 d_builtin_choose_expr=''
381 d_builtin_expect=''
382 d_bzero=''
383 d_c99_variadic_macros=''
384 d_casti32=''
385 castflags=''
386 d_castneg=''
387 d_chown=''
388 d_chroot=''
389 d_chsize=''
390 d_class=''
391 d_clearenv=''
392 d_closedir=''
393 d_void_closedir=''
394 d_cmsghdr_s=''
395 d_const=''
396 d_copysignl=''
397 d_cplusplus=''
398 cryptlib=''
399 d_crypt=''
400 crypt_r_proto=''
401 d_crypt_r=''
402 d_csh=''
403 full_csh=''
404 d_ctermid=''
405 ctermid_r_proto=''
406 d_ctermid_r=''
407 ctime_r_proto=''
408 d_ctime_r=''
409 d_cuserid=''
410 d_dbl_dig=''
411 d_dbminitproto=''
412 d_difftime=''
413 d_dir_dd_fd=''
414 d_dirfd=''
415 d_dlerror=''
416 d_dlopen=''
417 d_dlsymun=''
418 d_dosuid=''
419 d_suidsafe=''
420 d_drand48_r=''
421 drand48_r_proto=''
422 d_drand48proto=''
423 d_dup2=''
424 d_eaccess=''
425 d_endgrent=''
426 d_endgrent_r=''
427 endgrent_r_proto=''
428 d_endhent=''
429 d_endhostent_r=''
430 endhostent_r_proto=''
431 d_endnent=''
432 d_endnetent_r=''
433 endnetent_r_proto=''
434 d_endpent=''
435 d_endprotoent_r=''
436 endprotoent_r_proto=''
437 d_endpwent=''
438 d_endpwent_r=''
439 endpwent_r_proto=''
440 d_endsent=''
441 d_endservent_r=''
442 endservent_r_proto=''
443 d_faststdio=''
444 d_fchdir=''
445 d_fchmod=''
446 d_fchown=''
447 d_fcntl=''
448 d_fcntl_can_lock=''
449 d_fd_macros=''
450 d_fd_set=''
451 d_fds_bits=''
452 d_fgetpos=''
453 d_finite=''
454 d_finitel=''
455 d_flexfnam=''
456 d_flock=''
457 d_flockproto=''
458 d_fork=''
459 d_fp_class=''
460 d_fpclass=''
461 d_fpclassify=''
462 d_fpclassl=''
463 d_fpos64_t=''
464 d_frexpl=''
465 d_fs_data_s=''
466 d_fseeko=''
467 d_fsetpos=''
468 d_fstatfs=''
469 d_fsync=''
470 d_ftello=''
471 d_ftime=''
472 d_gettimeod=''
473 d_futimes=''
474 d_Gconvert=''
475 d_getaddrinfo=''
476 d_getcwd=''
477 d_getespwnam=''
478 d_getfsstat=''
479 d_getgrent=''
480 d_getgrent_r=''
481 getgrent_r_proto=''
482 d_getgrgid_r=''
483 getgrgid_r_proto=''
484 d_getgrnam_r=''
485 getgrnam_r_proto=''
486 d_getgrps=''
487 d_gethbyaddr=''
488 d_gethbyname=''
489 d_gethent=''
490 aphostname=''
491 d_gethname=''
492 d_phostname=''
493 d_uname=''
494 d_gethostbyaddr_r=''
495 gethostbyaddr_r_proto=''
496 d_gethostbyname_r=''
497 gethostbyname_r_proto=''
498 d_gethostent_r=''
499 gethostent_r_proto=''
500 d_gethostprotos=''
501 d_getitimer=''
502 d_getlogin=''
503 d_getlogin_r=''
504 getlogin_r_proto=''
505 d_getmnt=''
506 d_getmntent=''
507 d_getnameinfo=''
508 d_getnbyaddr=''
509 d_getnbyname=''
510 d_getnent=''
511 d_getnetbyaddr_r=''
512 getnetbyaddr_r_proto=''
513 d_getnetbyname_r=''
514 getnetbyname_r_proto=''
515 d_getnetent_r=''
516 getnetent_r_proto=''
517 d_getnetprotos=''
518 d_getpagsz=''
519 d_getpent=''
520 d_getpgid=''
521 d_getpgrp2=''
522 d_bsdgetpgrp=''
523 d_getpgrp=''
524 d_getppid=''
525 d_getprior=''
526 d_getpbyname=''
527 d_getpbynumber=''
528 d_getprotobyname_r=''
529 getprotobyname_r_proto=''
530 d_getprotobynumber_r=''
531 getprotobynumber_r_proto=''
532 d_getprotoent_r=''
533 getprotoent_r_proto=''
534 d_getprotoprotos=''
535 d_getprpwnam=''
536 d_getpwent=''
537 d_getpwent_r=''
538 getpwent_r_proto=''
539 d_getpwnam_r=''
540 getpwnam_r_proto=''
541 d_getpwuid_r=''
542 getpwuid_r_proto=''
543 d_getsent=''
544 d_getservbyname_r=''
545 getservbyname_r_proto=''
546 d_getservbyport_r=''
547 getservbyport_r_proto=''
548 d_getservent_r=''
549 getservent_r_proto=''
550 d_getservprotos=''
551 d_getspnam=''
552 d_getspnam_r=''
553 getspnam_r_proto=''
554 d_getsbyname=''
555 d_getsbyport=''
556 d_gmtime_r=''
557 gmtime_r_proto=''
558 d_gnulibc=''
559 gnulibc_version=''
560 d_hasmntopt=''
561 d_htonl=''
562 d_ilogbl=''
563 d_inetaton=''
564 d_inetntop=''
565 d_inetpton=''
566 d_int64_t=''
567 d_isascii=''
568 d_isblank=''
569 d_isfinite=''
570 d_isinf=''
571 d_isnan=''
572 d_isnanl=''
573 d_killpg=''
574 d_lchown=''
575 d_ldbl_dig=''
576 d_libm_lib_version=''
577 d_link=''
578 d_localtime_r=''
579 d_localtime_r_needs_tzset=''
580 localtime_r_proto=''
581 d_locconv=''
582 d_lockf=''
583 d_longdbl=''
584 longdblsize=''
585 d_longlong=''
586 longlongsize=''
587 d_lseekproto=''
588 d_lstat=''
589 d_madvise=''
590 d_malloc_good_size=''
591 d_malloc_size=''
592 d_mblen=''
593 d_mbstowcs=''
594 d_mbtowc=''
595 d_memchr=''
596 d_memcmp=''
597 d_memcpy=''
598 d_memmove=''
599 d_memset=''
600 d_mkdir=''
601 d_mkdtemp=''
602 d_mkfifo=''
603 d_mkstemp=''
604 d_mkstemps=''
605 d_mktime=''
606 d_mmap=''
607 mmaptype=''
608 d_modfl=''
609 d_modfl_pow32_bug=''
610 d_modflproto=''
611 d_mprotect=''
612 d_msg=''
613 d_msgctl=''
614 d_msgget=''
615 d_msghdr_s=''
616 d_msgrcv=''
617 d_msgsnd=''
618 d_msync=''
619 d_munmap=''
620 d_nice=''
621 d_nl_langinfo=''
622 d_off64_t=''
623 d_open3=''
624 d_fpathconf=''
625 d_pathconf=''
626 d_pause=''
627 d_pipe=''
628 d_poll=''
629 d_portable=''
630 d_prctl=''
631 d_prctl_set_name=''
632 d_procselfexe=''
633 procselfexe=''
634 d_old_pthread_create_joinable=''
635 old_pthread_create_joinable=''
636 d_pthread_atfork=''
637 d_pthread_attr_setscope=''
638 d_pthread_yield=''
639 d_sched_yield=''
640 sched_yield=''
641 d_qgcvt=''
642 d_random_r=''
643 random_r_proto=''
644 d_readdir64_r=''
645 readdir64_r_proto=''
646 d_readdir=''
647 d_rewinddir=''
648 d_seekdir=''
649 d_telldir=''
650 d_readdir_r=''
651 readdir_r_proto=''
652 d_readlink=''
653 d_readv=''
654 d_recvmsg=''
655 d_rename=''
656 d_rmdir=''
657 d_safebcpy=''
658 d_safemcpy=''
659 d_sanemcmp=''
660 d_sbrkproto=''
661 d_scalbnl=''
662 d_select=''
663 d_sem=''
664 d_semctl=''
665 d_semget=''
666 d_semop=''
667 d_sendmsg=''
668 d_setegid=''
669 d_seteuid=''
670 d_setgrent=''
671 d_setgrent_r=''
672 setgrent_r_proto=''
673 d_setgrps=''
674 d_sethent=''
675 d_sethostent_r=''
676 sethostent_r_proto=''
677 d_setitimer=''
678 d_setlinebuf=''
679 d_setlocale=''
680 d_setlocale_r=''
681 setlocale_r_proto=''
682 d_setnent=''
683 d_setnetent_r=''
684 setnetent_r_proto=''
685 d_setpent=''
686 d_setpgid=''
687 d_setpgrp2=''
688 d_bsdsetpgrp=''
689 d_setpgrp=''
690 d_setprior=''
691 d_setproctitle=''
692 d_setprotoent_r=''
693 setprotoent_r_proto=''
694 d_setpwent=''
695 d_setpwent_r=''
696 setpwent_r_proto=''
697 d_setregid=''
698 d_setresgid=''
699 d_setresuid=''
700 d_setreuid=''
701 d_setrgid=''
702 d_setruid=''
703 d_setsent=''
704 d_setservent_r=''
705 setservent_r_proto=''
706 d_setsid=''
707 d_setvbuf=''
708 d_sfio=''
709 usesfio=''
710 d_shm=''
711 d_shmat=''
712 d_shmatprototype=''
713 shmattype=''
714 d_shmctl=''
715 d_shmdt=''
716 d_shmget=''
717 d_sigaction=''
718 d_signbit=''
719 d_sigprocmask=''
720 d_sigsetjmp=''
721 usesitecustomize=''
722 d_snprintf=''
723 d_vsnprintf=''
724 d_sockatmark=''
725 d_sockatmarkproto=''
726 d_ip_mreq=''
727 d_ip_mreq_source=''
728 d_ipv6_mreq=''
729 d_ipv6_mreq_source=''
730 d_msg_ctrunc=''
731 d_msg_dontroute=''
732 d_msg_oob=''
733 d_msg_peek=''
734 d_msg_proxy=''
735 d_oldsock=''
736 d_scm_rights=''
737 d_sin6_scope_id=''
738 d_sockaddr_in6=''
739 d_sockaddr_sa_len=''
740 d_socket=''
741 d_sockpair=''
742 sockethdr=''
743 socketlib=''
744 d_socklen_t=''
745 d_socks5_init=''
746 d_sprintf_returns_strlen=''
747 d_sqrtl=''
748 d_srand48_r=''
749 srand48_r_proto=''
750 d_srandom_r=''
751 srandom_r_proto=''
752 d_sresgproto=''
753 d_sresuproto=''
754 d_statblks=''
755 d_statfs_f_flags=''
756 d_statfs_s=''
757 d_static_inline=''
758 perl_static_inline=''
759 d_fstatvfs=''
760 d_statvfs=''
761 d_stdio_cnt_lval=''
762 d_stdio_ptr_lval=''
763 d_stdio_ptr_lval_nochange_cnt=''
764 d_stdio_ptr_lval_sets_cnt=''
765 d_stdiobase=''
766 d_stdstdio=''
767 stdio_base=''
768 stdio_bufsiz=''
769 stdio_cnt=''
770 stdio_filbuf=''
771 stdio_ptr=''
772 d_index=''
773 d_strchr=''
774 d_strcoll=''
775 d_strctcpy=''
776 d_strerrm=''
777 d_strerror=''
778 d_sysernlst=''
779 d_syserrlst=''
780 d_strerror_r=''
781 strerror_r_proto=''
782 d_strftime=''
783 d_strlcat=''
784 d_strlcpy=''
785 d_strtod=''
786 d_strtol=''
787 d_strtold=''
788 d_strtoll=''
789 d_strtoq=''
790 d_strtoul=''
791 d_strtoull=''
792 d_strtouq=''
793 d_strxfrm=''
794 d_symlink=''
795 d_syscall=''
796 d_syscallproto=''
797 d_sysconf=''
798 d_system=''
799 d_tcgetpgrp=''
800 d_tcsetpgrp=''
801 d_telldirproto=''
802 d_time=''
803 timetype=''
804 d_asctime64=''
805 d_ctime64=''
806 d_difftime64=''
807 d_gmtime64=''
808 d_localtime64=''
809 d_mktime64=''
810 d_timegm=''
811 clocktype=''
812 d_times=''
813 d_tmpnam_r=''
814 tmpnam_r_proto=''
815 d_truncate=''
816 d_ttyname_r=''
817 ttyname_r_proto=''
818 d_tzname=''
819 d_u32align=''
820 d_ualarm=''
821 d_umask=''
822 d_semctl_semid_ds=''
823 d_semctl_semun=''
824 d_union_semun=''
825 d_unordered=''
826 d_unsetenv=''
827 d_usleep=''
828 d_usleepproto=''
829 d_ustat=''
830 d_pseudofork=''
831 d_vfork=''
832 usevfork=''
833 d_voidsig=''
834 signal_t=''
835 d_volatile=''
836 d_charvspr=''
837 d_vprintf=''
838 d_wait4=''
839 d_waitpid=''
840 d_wcstombs=''
841 d_wctomb=''
842 d_writev=''
843 dlext=''
844 bin_ELF=''
845 cccdlflags=''
846 ccdlflags=''
847 dlsrc=''
848 ld=''
849 ld_can_script=''
850 lddlflags=''
851 usedl=''
852 doublesize=''
853 ebcdic=''
854 fflushNULL=''
855 fflushall=''
856 fpossize=''
857 fpostype=''
858 gccansipedantic=''
859 gccosandvers=''
860 gccversion=''
861 gidformat=''
862 gidsign=''
863 gidsize=''
864 gidtype=''
865 groupstype=''
866 h_fcntl=''
867 h_sysfile=''
868 html1dir=''
869 html1direxp=''
870 installhtml1dir=''
871 html3dir=''
872 html3direxp=''
873 installhtml3dir=''
874 i_arpainet=''
875 i_assert=''
876 i_crypt=''
877 db_hashtype=''
878 db_prefixtype=''
879 db_version_major=''
880 db_version_minor=''
881 db_version_patch=''
882 i_db=''
883 i_dbm=''
884 i_rpcsvcdbm=''
885 d_dirnamlen=''
886 direntrytype=''
887 i_dirent=''
888 i_dld=''
889 i_dlfcn=''
890 i_fcntl=''
891 i_float=''
892 i_fp=''
893 i_fp_class=''
894 i_gdbm=''
895 d_grpasswd=''
896 i_grp=''
897 i_ieeefp=''
898 i_inttypes=''
899 i_langinfo=''
900 i_libutil=''
901 i_limits=''
902 i_locale=''
903 i_machcthr=''
904 i_malloc=''
905 i_mallocmalloc=''
906 i_math=''
907 i_memory=''
908 i_mntent=''
909 d_gdbm_ndbm_h_uses_prototypes=''
910 d_gdbmndbm_h_uses_prototypes=''
911 d_ndbm=''
912 d_ndbm_h_uses_prototypes=''
913 i_gdbm_ndbm=''
914 i_gdbmndbm=''
915 i_ndbm=''
916 i_netdb=''
917 i_neterrno=''
918 i_netinettcp=''
919 i_niin=''
920 i_sysin=''
921 i_poll=''
922 i_prot=''
923 i_pthread=''
924 d_pwage=''
925 d_pwchange=''
926 d_pwclass=''
927 d_pwcomment=''
928 d_pwexpire=''
929 d_pwgecos=''
930 d_pwpasswd=''
931 d_pwquota=''
932 i_pwd=''
933 i_sfio=''
934 i_shadow=''
935 i_socks=''
936 i_stdbool=''
937 i_stddef=''
938 i_stdlib=''
939 i_string=''
940 strings=''
941 i_sunmath=''
942 i_sysaccess=''
943 i_sysdir=''
944 i_sysfile=''
945 d_voidtty=''
946 i_bsdioctl=''
947 i_sysfilio=''
948 i_sysioctl=''
949 i_syssockio=''
950 i_syslog=''
951 i_sysmman=''
952 i_sysmode=''
953 i_sysmount=''
954 i_sysndir=''
955 i_sysparam=''
956 i_syspoll=''
957 i_sysresrc=''
958 i_syssecrt=''
959 i_sysselct=''
960 i_sysstat=''
961 i_sysstatfs=''
962 i_sysstatvfs=''
963 i_systimes=''
964 i_systypes=''
965 i_sysuio=''
966 i_sysun=''
967 i_sysutsname=''
968 i_sysvfs=''
969 i_syswait=''
970 i_sgtty=''
971 i_termio=''
972 i_termios=''
973 d_tm_tm_gmtoff=''
974 d_tm_tm_zone=''
975 i_systime=''
976 i_systimek=''
977 i_time=''
978 timeincl=''
979 i_unistd=''
980 i_ustat=''
981 i_utime=''
982 i_values=''
983 i_stdarg=''
984 i_varargs=''
985 i_varhdr=''
986 i_vfork=''
987 d_inc_version_list=''
988 inc_version_list=''
989 inc_version_list_init=''
990 installprefix=''
991 installprefixexp=''
992 installstyle=''
993 installusrbinperl=''
994 intsize=''
995 longsize=''
996 shortsize=''
997 issymlink=''
998 libc=''
999 ldlibpthname=''
1000 libperl=''
1001 shrpenv=''
1002 useshrplib=''
1003 glibpth=''
1004 libpth=''
1005 loclibpth=''
1006 plibpth=''
1007 xlibpth=''
1008 ignore_versioned_solibs=''
1009 libs=''
1010 libsdirs=''
1011 libsfiles=''
1012 libsfound=''
1013 libspath=''
1014 lns=''
1015 d_PRIEUldbl=''
1016 d_PRIFUldbl=''
1017 d_PRIGUldbl=''
1018 d_PRIeldbl=''
1019 d_PRIfldbl=''
1020 d_PRIgldbl=''
1021 d_SCNfldbl=''
1022 sPRIEUldbl=''
1023 sPRIFUldbl=''
1024 sPRIGUldbl=''
1025 sPRIeldbl=''
1026 sPRIfldbl=''
1027 sPRIgldbl=''
1028 sSCNfldbl=''
1029 lseeksize=''
1030 lseektype=''
1031 mad=''
1032 madlyh=''
1033 madlyobj=''
1034 madlysrc=''
1035 make_set_make=''
1036 d_mymalloc=''
1037 freetype=''
1038 mallocobj=''
1039 mallocsrc=''
1040 malloctype=''
1041 usemallocwrap=''
1042 usemymalloc=''
1043 installman1dir=''
1044 man1dir=''
1045 man1direxp=''
1046 man1ext=''
1047 installman3dir=''
1048 man3dir=''
1049 man3direxp=''
1050 man3ext=''
1051 modetype=''
1052 multiarch=''
1053 mydomain=''
1054 myhostname=''
1055 phostname=''
1056 c=''
1057 n=''
1058 d_eofnblk=''
1059 eagain=''
1060 o_nonblock=''
1061 rd_nodata=''
1062 need_va_copy=''
1063 netdb_hlen_type=''
1064 netdb_host_type=''
1065 netdb_name_type=''
1066 netdb_net_type=''
1067 groupcat=''
1068 hostcat=''
1069 passcat=''
1070 orderlib=''
1071 ranlib=''
1072 d_perl_otherlibdirs=''
1073 otherlibdirs=''
1074 package=''
1075 spackage=''
1076 pager=''
1077 api_revision=''
1078 api_subversion=''
1079 api_version=''
1080 api_versionstring=''
1081 patchlevel=''
1082 perl_patchlevel=''
1083 revision=''
1084 subversion=''
1085 version=''
1086 version_patchlevel_string=''
1087 perl5=''
1088 perladmin=''
1089 perlpath=''
1090 d_nv_preserves_uv=''
1091 d_nv_zero_is_allbits_zero=''
1092 i16size=''
1093 i16type=''
1094 i32size=''
1095 i32type=''
1096 i64size=''
1097 i64type=''
1098 i8size=''
1099 i8type=''
1100 ivsize=''
1101 ivtype=''
1102 nv_overflows_integers_at=''
1103 nv_preserves_uv_bits=''
1104 nvsize=''
1105 nvtype=''
1106 u16size=''
1107 u16type=''
1108 u32size=''
1109 u32type=''
1110 u64size=''
1111 u64type=''
1112 u8size=''
1113 u8type=''
1114 uvsize=''
1115 uvtype=''
1116 ivdformat=''
1117 nvEUformat=''
1118 nvFUformat=''
1119 nvGUformat=''
1120 nveformat=''
1121 nvfformat=''
1122 nvgformat=''
1123 uvXUformat=''
1124 uvoformat=''
1125 uvuformat=''
1126 uvxformat=''
1127 pidtype=''
1128 prefix=''
1129 prefixexp=''
1130 installprivlib=''
1131 privlib=''
1132 privlibexp=''
1133 prototype=''
1134 ptrsize=''
1135 d_PRIXU64=''
1136 d_PRId64=''
1137 d_PRIi64=''
1138 d_PRIo64=''
1139 d_PRIu64=''
1140 d_PRIx64=''
1141 sPRIXU64=''
1142 sPRId64=''
1143 sPRIi64=''
1144 sPRIo64=''
1145 sPRIu64=''
1146 sPRIx64=''
1147 d_quad=''
1148 quadkind=''
1149 quadtype=''
1150 uquadtype=''
1151 drand01=''
1152 randbits=''
1153 randfunc=''
1154 randseedtype=''
1155 seedfunc=''
1156 installscript=''
1157 scriptdir=''
1158 scriptdirexp=''
1159 selectminbits=''
1160 selecttype=''
1161 sh=''
1162 sig_count=''
1163 sig_name=''
1164 sig_name_init=''
1165 sig_num=''
1166 sig_num_init=''
1167 sig_size=''
1168 d_sitearch=''
1169 installsitearch=''
1170 sitearch=''
1171 sitearchexp=''
1172 installsitebin=''
1173 sitebin=''
1174 sitebinexp=''
1175 installsitehtml1dir=''
1176 sitehtml1dir=''
1177 sitehtml1direxp=''
1178 installsitehtml3dir=''
1179 sitehtml3dir=''
1180 sitehtml3direxp=''
1181 installsitelib=''
1182 sitelib=''
1183 sitelib_stem=''
1184 sitelibexp=''
1185 installsiteman1dir=''
1186 siteman1dir=''
1187 siteman1direxp=''
1188 installsiteman3dir=''
1189 siteman3dir=''
1190 siteman3direxp=''
1191 siteprefix=''
1192 siteprefixexp=''
1193 installsitescript=''
1194 sitescript=''
1195 sitescriptexp=''
1196 sizesize=''
1197 sizetype=''
1198 so=''
1199 socksizetype=''
1200 sharpbang=''
1201 shsharp=''
1202 spitshell=''
1203 src=''
1204 ssizetype=''
1205 st_ino_sign=''
1206 st_ino_size=''
1207 startperl=''
1208 startsh=''
1209 stdchar=''
1210 d_stdio_stream_array=''
1211 stdio_stream_array=''
1212 sysman=''
1213 sGMTIME_max=''
1214 sGMTIME_min=''
1215 sLOCALTIME_max=''
1216 sLOCALTIME_min=''
1217 trnl=''
1218 uidformat=''
1219 uidsign=''
1220 uidsize=''
1221 uidtype=''
1222 archname64=''
1223 use64bitall=''
1224 use64bitint=''
1225 dtrace=''
1226 usedtrace=''
1227 usefaststdio=''
1228 usekernprocpathname=''
1229 ccflags_uselargefiles=''
1230 ldflags_uselargefiles=''
1231 libswanted_uselargefiles=''
1232 uselargefiles=''
1233 uselongdouble=''
1234 usemorebits=''
1235 usemultiplicity=''
1236 nm_opt=''
1237 nm_so_opt=''
1238 runnm=''
1239 usenm=''
1240 usensgetexecutablepath=''
1241 useperlio=''
1242 usesocks=''
1243 d_oldpthreads=''
1244 use5005threads=''
1245 useithreads=''
1246 usereentrant=''
1247 usethreads=''
1248 incpath=''
1249 mips_type=''
1250 usrinc=''
1251 vaproto=''
1252 d_vendorarch=''
1253 installvendorarch=''
1254 vendorarch=''
1255 vendorarchexp=''
1256 d_vendorbin=''
1257 installvendorbin=''
1258 vendorbin=''
1259 vendorbinexp=''
1260 installvendorhtml1dir=''
1261 vendorhtml1dir=''
1262 vendorhtml1direxp=''
1263 installvendorhtml3dir=''
1264 vendorhtml3dir=''
1265 vendorhtml3direxp=''
1266 d_vendorlib=''
1267 installvendorlib=''
1268 vendorlib=''
1269 vendorlib_stem=''
1270 vendorlibexp=''
1271 installvendorman1dir=''
1272 vendorman1dir=''
1273 vendorman1direxp=''
1274 installvendorman3dir=''
1275 vendorman3dir=''
1276 vendorman3direxp=''
1277 usevendorprefix=''
1278 vendorprefix=''
1279 vendorprefixexp=''
1280 d_vendorscript=''
1281 installvendorscript=''
1282 vendorscript=''
1283 vendorscriptexp=''
1284 versiononly=''
1285 defvoidused=''
1286 voidflags=''
1287 yacc=''
1288 yaccflags=''
1289 CONFIG=''
1290
1291 : Detect odd OSs
1292 define='define'
1293 undef='undef'
1294 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1295 rmlist=''
1296
1297 : We must find out about Eunice early
1298 eunicefix=':'
1299 if test -f /etc/unixtovms; then
1300         eunicefix=/etc/unixtovms
1301 fi
1302 if test -f /etc/unixtovms.exe; then
1303         eunicefix=/etc/unixtovms.exe
1304 fi
1305
1306 : Set executable suffix now -- needed before hints available
1307 if test -f "/libs/version.library"; then
1308 : Amiga OS
1309     _exe=""
1310 elif test -f "/system/gnu_library/bin/ar.pm"; then
1311 : Stratus VOS
1312     _exe=".pm"
1313 elif test -n "$DJGPP"; then
1314 : DOS DJGPP
1315     _exe=".exe"
1316 elif test -d c:/. -o -n "$is_os2" ; then
1317 : OS/2 or cygwin
1318     _exe=".exe"
1319 fi
1320
1321 groupstype=''
1322 i_whoami=''
1323 : Trailing extension.  Override this in a hint file, if needed.
1324 : Extra object files, if any, needed on this platform.
1325 archobjs=''
1326 archname=''
1327 : Possible local include directories to search.
1328 : Set locincpth to "" in a hint file to defeat local include searches.
1329 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1330 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1331 :
1332 : no include file wanted by default
1333 inclwanted=''
1334
1335 : Enable -DEBUGGING and -DDEBUGGING from the command line
1336 EBUGGING=''
1337 DEBUGGING=''
1338
1339 libnames=''
1340 : change the next line if compiling for Xenix/286 on Xenix/386
1341 xlibpth='/usr/lib/386 /lib/386'
1342 : Possible local library directories to search.
1343 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1344 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1345
1346 : general looking path for locating libraries
1347 glibpth="/lib /usr/lib $xlibpth"
1348 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1349 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1350 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1351 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1352
1353 : Private path used by Configure to find libraries.  Its value
1354 : is prepended to libpth. This variable takes care of special
1355 : machines, like the mips.  Usually, it should be empty.
1356 plibpth=''
1357
1358 : default library list
1359 libswanted=''
1360 : some systems want to use only the non-versioned libso:s
1361 ignore_versioned_solibs=''
1362 : set usethreads on the Configure command line to enable threads.
1363 usereentrant='undef'
1364 : full support for void wanted by default
1365 defvoidused=15
1366
1367 ccname=''
1368 ccversion=''
1369 perllibs=''
1370 : set useposix=false in your hint file to disable the POSIX extension.
1371 useposix=true
1372 : set useopcode=false in your hint file to disable the Opcode extension.
1373 useopcode=true
1374 archname64=''
1375 ccflags_uselargefiles=''
1376 ldflags_uselargefiles=''
1377 libswanted_uselargefiles=''
1378 : set usemultiplicity on the Configure command line to enable multiplicity.
1379 : set usesocks on the Configure command line to enable socks.
1380 : List of libraries we want.
1381 : If anyone needs extra -lxxx, put those in a hint file.
1382 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1383 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1384 : We probably want to search /usr/shlib before most other libraries.
1385 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1386 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1387 glibpth="/usr/shlib $glibpth"
1388 : Do not use vfork unless overridden by a hint file.
1389 usevfork=false
1390
1391 : Find the basic shell for Bourne shell scripts
1392 case "$sh" in
1393 '')
1394         case "$SYSTYPE" in
1395         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1396         *) xxx='/bin/sh';;
1397         esac
1398         if test -f "$xxx"; then
1399                 sh="$xxx"
1400         else
1401                 : Build up a list and do a single loop so we can 'break' out.
1402                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1403                 for xxx in sh bash ksh pdksh ash; do
1404                         for p in $pth; do
1405                                 try="$try ${p}/${xxx}"
1406                         done
1407                 done
1408                 for xxx in $try; do
1409                         if test -f "$xxx"; then
1410                                 sh="$xxx";
1411                                 break
1412                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1413                                 sh="$xxx";
1414                                 break
1415                         elif test -f "$xxx.exe"; then
1416                                 sh="$xxx";
1417                                 break
1418                         fi
1419                 done
1420         fi
1421         ;;
1422 esac
1423
1424 case "$sh" in
1425 '')     cat >&2 <<EOM
1426 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1427
1428 Usually it's in /bin/sh.  How did you even get this far?
1429 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1430 we'll try to straighten this all out.
1431 EOM
1432         exit 1
1433         ;;
1434 esac
1435
1436 : see if sh knows # comments
1437 if `$sh -c '#' >/dev/null 2>&1`; then
1438         shsharp=true
1439         spitshell=cat
1440         xcat=/bin/cat
1441         test -f $xcat$_exe || xcat=/usr/bin/cat
1442         if test ! -f $xcat$_exe; then
1443                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1444                         if test -f $p/cat$_exe; then
1445                                 xcat=$p/cat
1446                                 break
1447                         fi
1448                 done
1449                 if test ! -f $xcat$_exe; then
1450                         echo "Can't find cat anywhere!"
1451                         exit 1
1452                 fi
1453         fi
1454         echo "#!$xcat" >sharp
1455         $eunicefix sharp
1456         chmod +x sharp
1457         ./sharp > today 2>/dev/null
1458         if test -s today; then
1459                 sharpbang='#!'
1460         else
1461                 echo "#! $xcat" > sharp
1462                 $eunicefix sharp
1463                 chmod +x sharp
1464                 ./sharp > today 2>/dev/null
1465                 if test -s today; then
1466                         sharpbang='#! '
1467                 else
1468                         sharpbang=': use '
1469                 fi
1470         fi
1471 else
1472         echo " "
1473         echo "Your $sh doesn't grok # comments--I will strip them later on."
1474         shsharp=false
1475         cd ..
1476         echo "exec grep -v '^[  ]*#'" >spitshell
1477         chmod +x spitshell
1478         $eunicefix spitshell
1479         spitshell=`pwd`/spitshell
1480         cd UU
1481         echo "I presume that if # doesn't work, #! won't work either!"
1482         sharpbang=': use '
1483 fi
1484 rm -f sharp today
1485
1486 : figure out how to guarantee sh startup
1487 case "$startsh" in
1488 '') startsh=${sharpbang}${sh} ;;
1489 *)
1490 esac
1491 cat >sharp <<EOSS
1492 $startsh
1493 set abc
1494 test "$?abc" != 1
1495 EOSS
1496
1497 chmod +x sharp
1498 $eunicefix sharp
1499 if ./sharp; then
1500         : echo "Yup, it does."
1501 else
1502         echo "Hmm... '$startsh' does not guarantee sh startup..."
1503         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1504 fi
1505 rm -f sharp
1506
1507 : Save command line options in file UU/cmdline.opt for later use in
1508 : generating config.sh.
1509 cat > cmdline.opt <<EOSH
1510 : Configure command line arguments.
1511 config_arg0='$0'
1512 config_args='$*'
1513 config_argc=$#
1514 EOSH
1515 argn=1
1516 args_exp=''
1517 args_sep=''
1518 for arg in "$@"; do
1519         cat >>cmdline.opt <<EOSH
1520 config_arg$argn='$arg'
1521 EOSH
1522         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1523 $arg
1524 EOC
1525         arg_exp=`cat cmdl.opt`
1526         args_exp="$args_exp$args_sep'$arg_exp'"
1527         argn=`expr $argn + 1`
1528         args_sep=' '
1529 done
1530 rm -f cmdl.opt
1531
1532 : produce awk script to parse command line options
1533 cat >options.awk <<'EOF'
1534 BEGIN {
1535         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1536
1537         len = length(optstr);
1538         for (i = 1; i <= len; i++) {
1539                 c = substr(optstr, i, 1);
1540                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1541                 if (a == ":") {
1542                         arg[c] = 1;
1543                         i++;
1544                 }
1545                 opt[c] = 1;
1546         }
1547 }
1548 {
1549         expect = 0;
1550         str = $0;
1551         if (substr(str, 1, 1) != "-") {
1552                 printf("'%s'\n", str);
1553                 next;
1554         }
1555         len = length($0);
1556         for (i = 2; i <= len; i++) {
1557                 c = substr(str, i, 1);
1558                 if (!opt[c]) {
1559                         printf("-%s\n", substr(str, i));
1560                         next;
1561                 }
1562                 printf("-%s\n", c);
1563                 if (arg[c]) {
1564                         if (i < len)
1565                                 printf("'%s'\n", substr(str, i + 1));
1566                         else
1567                                 expect = 1;
1568                         next;
1569                 }
1570         }
1571 }
1572 END {
1573         if (expect)
1574                 print "?";
1575 }
1576 EOF
1577
1578 : process the command line options
1579 set X `for arg in "$@"; do echo "X$arg"; done |
1580         sed -e s/X// | awk -f options.awk`
1581 eval "set $*"
1582 shift
1583 rm -f options.awk
1584
1585 : set up default values
1586 fastread=''
1587 reuseval=false
1588 config_sh=''
1589 alldone=''
1590 error=''
1591 silent=''
1592 extractsh=''
1593 override=''
1594 knowitall=''
1595 rm -f optdef.sh posthint.sh
1596 cat >optdef.sh <<EOS
1597 $startsh
1598 EOS
1599
1600
1601 : option parsing
1602 while test $# -gt 0; do
1603         case "$1" in
1604         -d) shift; fastread=yes;;
1605         -e) shift; alldone=cont;;
1606         -f)
1607                 shift
1608                 cd ..
1609                 if test -r "$1"; then
1610                         config_sh="$1"
1611                 else
1612                         echo "$me: cannot read config file $1." >&2
1613                         error=true
1614                 fi
1615                 cd UU
1616                 shift;;
1617         --help|\
1618         -h) shift; error=true;;
1619         -r) shift; reuseval=true;;
1620         -s) shift; silent=true; realsilent=true;;
1621         -E) shift; alldone=exit;;
1622         -K) shift; knowitall=true;;
1623         -O) shift; override=true;;
1624         -S) shift; silent=true; extractsh=true;;
1625         -D)
1626                 shift
1627                 case "$1" in
1628                 *=)
1629                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1630                         echo "$me: ignoring -D $1" >&2
1631                         ;;
1632                 *=*) echo "$1" | \
1633                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1634                 *) echo "$1='define'" >> optdef.sh;;
1635                 esac
1636                 shift
1637                 ;;
1638         -U)
1639                 shift
1640                 case "$1" in
1641                 *=) echo "$1" >> optdef.sh;;
1642                 *=*)
1643                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1644                         echo "$me: ignoring -U $1" >&2
1645                         ;;
1646                 *) echo "$1='undef'" >> optdef.sh;;
1647                 esac
1648                 shift
1649                 ;;
1650         -A)
1651             shift
1652             xxx=''
1653             yyy="$1"
1654             zzz=''
1655             uuu=undef
1656             case "$yyy" in
1657             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1658                  case "$zzz" in
1659                  *:*) zzz='' ;;
1660                  *)   xxx=append
1661                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1662                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1663                  esac
1664                  ;;
1665             esac
1666             case "$xxx" in
1667             '')  case "$yyy" in
1668                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1669                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1670                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1671                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1672                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1673                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1674                  esac
1675                  ;;
1676             esac
1677             case "$xxx" in
1678             append)
1679                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1680             clear)
1681                 echo "$yyy=''"                  >> posthint.sh ;;
1682             define)
1683                 case "$zzz" in
1684                 '') zzz=define ;;
1685                 esac
1686                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1687             eval)
1688                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1689             prepend)
1690                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1691             undef)
1692                 case "$zzz" in
1693                 '') zzz="$uuu" ;;
1694                 esac
1695                 echo "$yyy=$zzz"                >> posthint.sh ;;
1696             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1697             esac
1698             shift
1699             ;;
1700         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1701             exit 0;;
1702         --) break;;
1703         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1704         *) break;;
1705         esac
1706 done
1707
1708 case "$error" in
1709 true)
1710         cat >&2 <<EOM
1711 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1712                  [-U symbol] [-U symbol=] [-A command:symbol...]
1713   -d : use defaults for all answers.
1714   -e : go on without questioning past the production of config.sh.
1715   -f : specify an alternate default configuration file.
1716   -h : print this help message and exit (with an error status).
1717   -r : reuse C symbols value if possible (skips costly nm extraction).
1718   -s : silent mode, only echoes questions and essential information.
1719   -D : define symbol to have some value:
1720          -D symbol         symbol gets the value 'define'
1721          -D symbol=value   symbol gets the value 'value'
1722        common used examples (see INSTALL for more info):
1723          -Duse64bitint            use 64bit integers
1724          -Duse64bitall            use 64bit integers and pointers
1725          -Dusethreads             use thread support
1726          -Dinc_version_list=none  do not include older perl trees in @INC
1727          -DEBUGGING=none          DEBUGGING options
1728          -Dcc=gcc                 choose your compiler
1729          -Dprefix=/opt/perl5      choose your destination
1730   -E : stop at the end of questions, after having produced config.sh.
1731   -K : do not use unless you know what you are doing.
1732   -O : let -D and -U override definitions from loaded configuration file.
1733   -S : perform variable substitutions on all .SH files (can mix with -f)
1734   -U : undefine symbol:
1735          -U symbol    symbol gets the value 'undef'
1736          -U symbol=   symbol gets completely empty
1737        e.g.:  -Uversiononly
1738   -A : manipulate symbol after the platform specific hints have been applied:
1739          -A append:symbol=value   append value to symbol
1740          -A symbol=value          like append:, but with a separating space
1741          -A define:symbol=value   define symbol to have value
1742          -A clear:symbol          define symbol to be ''
1743          -A define:symbol         define symbol to be 'define'
1744          -A eval:symbol=value     define symbol to be eval of value
1745          -A prepend:symbol=value  prepend value to symbol
1746          -A undef:symbol          define symbol to be 'undef'
1747          -A undef:symbol=         define symbol to be ''
1748        e.g.:  -A prepend:libswanted='cl pthread '
1749               -A ccflags=-DSOME_MACRO
1750   -V : print version number and exit (with a zero status).
1751 EOM
1752         exit 1
1753         ;;
1754 esac
1755
1756 : Sanity checks
1757 case "$fastread$alldone" in
1758 yescont|yesexit) ;;
1759 *)
1760         case "$extractsh" in
1761         true) ;;
1762         *)
1763                 if test ! -t 0; then
1764                         echo "Say 'sh Configure', not 'sh <Configure'"
1765                         exit 1
1766                 fi
1767                 ;;
1768         esac
1769         ;;
1770 esac
1771
1772 exec 4>&1
1773 case "$silent" in
1774 true) exec 1>/dev/null;;
1775 esac
1776
1777 : run the defines and the undefines, if any, but leave the file out there...
1778 touch optdef.sh
1779 . ./optdef.sh
1780 : create the posthint manipulation script and leave the file out there...
1781 touch posthint.sh
1782
1783 : set package name
1784 package='perl5'
1785 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1786 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1787 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1788 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1789 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1790 esac
1791
1792 : Some greps do not return status, grrr.
1793 echo "grimblepritz" >grimble
1794 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1795         contains=contains
1796 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1797         contains=grep
1798 else
1799         contains=contains
1800 fi
1801 rm -f grimble
1802 : the following should work in any shell
1803 case "$contains" in
1804 contains*)
1805         echo " "
1806         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1807         cat >contains <<'EOSS'
1808 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1809 EOSS
1810 chmod +x contains
1811 esac
1812
1813 : Find the path to the source tree
1814 case "$src" in
1815 '') case "$0" in
1816     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1817          case "$src" in
1818          /*)    ;;
1819          .)     ;;
1820          *)     src=`cd ../$src && pwd` ;;
1821          esac
1822          ;;
1823     *)   src='.';;
1824     esac;;
1825 esac
1826 case "$src" in
1827 '')     src=/
1828         rsrc=/
1829         ;;
1830 /*)     rsrc="$src";;
1831 *)      rsrc="../$src";;
1832 esac
1833 if test -f $rsrc/Configure && \
1834         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1835 then
1836    : found it, so we are ok.
1837 else
1838         rsrc=''
1839         for src in . .. ../.. ../../.. ../../../..; do
1840                 if test -f ../$src/Configure && \
1841                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1842                 then
1843                         rsrc=../$src
1844                         break
1845                 fi
1846         done
1847 fi
1848 case "$rsrc" in
1849 '')
1850         cat <<EOM >&4
1851
1852 Sorry, I can't seem to locate the source dir for $package.  Please start
1853 Configure with an explicit path -- i.e. /some/path/Configure.
1854
1855 EOM
1856         exit 1
1857         ;;
1858 ../.)   rsrc='..';;
1859 *)
1860         echo " "
1861         echo "Sources for $package found in \"$src\"." >&4
1862         ;;
1863 esac
1864
1865 : script used to extract .SH files with variable substitutions
1866 cat >extract <<'EOS'
1867 PERL_CONFIG_SH=true
1868 echo "Doing variable substitutions on .SH files..."
1869 if test -f MANIFEST; then
1870         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1871 else
1872         echo "(Looking for .SH files under the source directory.)"
1873         set x `(cd "$src"; find . -name "*.SH" -print)`
1874 fi
1875 shift
1876 case $# in
1877 0) set x `(cd "$src"; echo *.SH)`; shift;;
1878 esac
1879 if test ! -f "$src/$1"; then
1880         shift
1881 fi
1882 mkdir_p='
1883 name=$1;
1884 create="";
1885 while test $name; do
1886         if test ! -d "$name"; then
1887                 create="$name $create";
1888                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1889                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1890         else
1891                 name="";
1892         fi;
1893 done;
1894 for file in $create; do
1895         mkdir $file;
1896 done
1897 '
1898 for file in $*; do
1899         case "$src" in
1900         ".")
1901                 case "$file" in
1902                 */*)
1903                         dir=`expr X$file : 'X\(.*\)/'`
1904                         file=`expr X$file : 'X.*/\(.*\)'`
1905                         (cd "$dir" && . ./$file)
1906                         ;;
1907                 *)
1908                         . ./$file
1909                         ;;
1910                 esac
1911                 ;;
1912         *)
1913                 case "$file" in
1914                 */*)
1915                         dir=`expr X$file : 'X\(.*\)/'`
1916                         file=`expr X$file : 'X.*/\(.*\)'`
1917                         (set x $dir; shift; eval $mkdir_p)
1918                         sh <"$src/$dir/$file"
1919                         ;;
1920                 *)
1921                         sh <"$src/$file"
1922                         ;;
1923                 esac
1924                 ;;
1925         esac
1926 done
1927 if test -f "$src/config_h.SH"; then
1928         if test ! -f config.h; then
1929         : oops, they left it out of MANIFEST, probably, so do it anyway.
1930         . "$src/config_h.SH"
1931         fi
1932 fi
1933 EOS
1934
1935 : extract files and exit if asked to do so
1936 case "$extractsh" in
1937 true)
1938         case "$realsilent" in
1939         true) ;;
1940         *) exec 1>&4;;
1941         esac
1942         case "$config_sh" in
1943         '') config_sh='config.sh';;
1944         esac
1945         echo " "
1946         echo "Fetching answers from $config_sh..."
1947         cd ..
1948         . $config_sh
1949         test "$override" && . ./optdef.sh
1950         echo " "
1951         . UU/extract
1952         rm -rf UU
1953         echo "Extraction done."
1954         exit 0
1955         ;;
1956 esac
1957
1958 : Eunice requires " " instead of "", can you believe it
1959 echo " "
1960 : Here we go...
1961 echo "Beginning of configuration questions for $package."
1962
1963 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1964
1965 : first determine how to suppress newline on echo command
1966 echo " "
1967 echo "Checking echo to see how to suppress newlines..."
1968 (echo "hi there\c" ; echo " ") >.echotmp
1969 if $contains c .echotmp >/dev/null 2>&1 ; then
1970         echo "...using -n."
1971         n='-n'
1972         c=''
1973 else
1974         cat <<'EOM'
1975 ...using \c
1976 EOM
1977         n=''
1978         c='\c'
1979 fi
1980 echo $n "The star should be here-->$c"
1981 echo '*'
1982 rm -f .echotmp
1983
1984 : Now test for existence of everything in MANIFEST
1985 echo " "
1986 if test -f "$rsrc/MANIFEST"; then
1987         echo "First let's make sure your kit is complete.  Checking..." >&4
1988         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1989                 (split -l 50 2>/dev/null || split -50)
1990         rm -f missing
1991         tmppwd=`pwd`
1992         for filelist in x??; do
1993                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1994                         >/dev/null 2>>"$tmppwd/missing")
1995         done
1996         if test -s missing; then
1997                 cat missing >&4
1998                 cat >&4 <<'EOM'
1999
2000 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2001
2002 You have the option of continuing the configuration process, despite the
2003 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2004 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2005 and contact the author (perlbug@perl.org).
2006
2007 EOM
2008                 echo $n "Continue? [n] $c" >&4
2009                 read ans
2010                 case "$ans" in
2011                 y*)
2012                         echo "Continuing..." >&4
2013                         rm -f missing
2014                         ;;
2015                 *)
2016                         echo "ABORTING..." >&4
2017                         kill $$
2018                         ;;
2019                 esac
2020         else
2021                 echo "Looks good..."
2022         fi
2023 else
2024         echo "There is no MANIFEST file.  I hope your kit is complete !"
2025 fi
2026 rm -f missing x??
2027
2028 : Find the appropriate value for a newline for tr
2029 echo " "
2030 if test -n "$DJGPP"; then
2031        trnl='\012'
2032 fi
2033 if test X"$trnl" = X; then
2034         case "`echo foo|tr '\n' x 2>/dev/null`" in
2035         foox) trnl='\n' ;;
2036         esac
2037 fi
2038 if test X"$trnl" = X; then
2039         case "`echo foo|tr '\012' x 2>/dev/null`" in
2040         foox) trnl='\012' ;;
2041         esac
2042 fi
2043 if test X"$trnl" = X; then
2044        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2045        fooxy) trnl='\n\r' ;;
2046        esac
2047 fi
2048 if test X"$trnl" = X; then
2049         cat <<EOM >&2
2050
2051 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2052
2053 EOM
2054         exit 1
2055 fi
2056
2057 : compute the number of columns on the terminal for proper question formatting
2058 case "$COLUMNS" in
2059 '') COLUMNS='80';;
2060 esac
2061
2062 : set up the echo used in my read
2063 myecho="case \"\$xxxm\" in
2064 '') echo $n \"\$rp $c\" >&4;;
2065 *) case \"\$rp\" in
2066         '') echo $n \"[\$xxxm] $c\";;
2067         *)
2068                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2069                         echo \"\$rp\" >&4
2070                         echo $n \"[\$xxxm] $c\" >&4
2071                 else
2072                         echo $n \"\$rp [\$xxxm] $c\" >&4
2073                 fi
2074                 ;;
2075         esac;;
2076 esac"
2077
2078 : now set up to do reads with possible shell escape and default assignment
2079 cat <<EOSC >myread
2080 $startsh
2081 xxxm=\$dflt
2082 $myecho
2083 ans='!'
2084 case "\$fastread" in
2085 yes) case "\$dflt" in
2086         '') ;;
2087         *) ans='';
2088                 case "\$silent-\$rp" in
2089                 true-) ;;
2090                 *) echo " " >&4;;
2091                 esac;;
2092         esac;;
2093 *) case "\$silent" in
2094         true) case "\$rp" in
2095                 '') ans='';;
2096                 esac;;
2097         esac;;
2098 esac
2099 while expr "X\$ans" : "X!" >/dev/null; do
2100         read answ
2101         set x \$xxxm
2102         shift
2103         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2104         case  "\$answ" in
2105         "!")
2106                 sh 1>&4
2107                 echo " "
2108                 $myecho
2109                 ;;
2110         !*)
2111                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2112                 shift
2113                 sh 1>&4 -c "\$*"
2114                 echo " "
2115                 $myecho
2116                 ;;
2117         "\$ans")
2118                 case "\$ans" in
2119                 \\&*)
2120                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2121                         shift
2122                         case "\$1" in
2123                         -d)
2124                                 fastread=yes
2125                                 echo "(OK, I'll run with -d after this question.)" >&4
2126                                 ;;
2127                         -*)
2128                                 echo "*** Sorry, \$1 not supported yet." >&4
2129                                 ;;
2130                         esac
2131                         $myecho
2132                         ans=!
2133                         ;;
2134                 esac;;
2135         *)
2136                 case "\$aok" in
2137                 y)
2138                         echo "*** Substitution done -- please confirm."
2139                         xxxm="\$ans"
2140                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2141                         xxxm="\$ans"
2142                         ans=!
2143                         ;;
2144                 *)
2145                         echo "*** Error -- try again."
2146                         ans=!
2147                         ;;
2148                 esac
2149                 $myecho
2150                 ;;
2151         esac
2152         case "\$ans\$xxxm\$nostick" in
2153         '')
2154                 ans=!
2155                 $myecho
2156                 ;;
2157         esac
2158 done
2159 case "\$ans" in
2160 '') ans="\$xxxm";;
2161 esac
2162 EOSC
2163
2164 : create .config dir to save info across Configure sessions
2165 test -d ../.config || mkdir ../.config
2166 cat >../.config/README <<EOF
2167 This directory created by Configure to save information that should
2168 persist across sessions for $package.
2169
2170 You may safely delete it if you wish.
2171 EOF
2172
2173 : See if we are using a devel version and want that
2174 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2175 case "$usedevel" in
2176 $define|true|[yY]*)
2177     usedevel="$define" ;;
2178 *) case "$xversion" in
2179    *[13579])
2180         cat >&4 <<EOH
2181 *** WHOA THERE!!! ***
2182
2183     This is an UNSTABLE DEVELOPMENT release.
2184     The version of this $package distribution is $xversion, that is, odd,
2185     (as opposed to even) and that signifies a development release.
2186     If you want a maintenance release, you want an even-numbered version.
2187
2188     Do ***NOT*** install this into production use.
2189     Data corruption and crashes are possible.
2190
2191     It is most seriously suggested that you do not continue any further
2192     unless you want to help in developing and debugging Perl.
2193
2194     If you *still* want to build perl, you can answer 'y' now,
2195     or pass -Dusedevel to Configure.
2196
2197 EOH
2198         rp='Do you really want to continue?'
2199         dflt='n'
2200         . ./myread
2201         case "$ans" in
2202         [yY]) echo >&4 "Okay, continuing."
2203               usedevel="$define" ;;
2204         *) echo >&4 "Okay, bye."
2205            exit 1
2206            ;;
2207         esac
2208         ;;
2209     esac
2210     usedevel="$undef"
2211     ;;
2212 esac
2213 case "$usedevel" in
2214 $define|true|[yY]*)
2215         case "$versiononly" in
2216         '') versiononly="$define" ;;
2217         esac
2218         case "$installusrbinperl" in
2219         '') installusrbinperl="$undef" ;;
2220         esac
2221         ;;
2222 esac
2223
2224 : general instructions
2225 needman=true
2226 firsttime=true
2227 user=`(logname) 2>/dev/null`
2228 case "$user" in
2229 '') user=`whoami 2>&1`;;
2230 esac
2231 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2232         firsttime=false
2233         echo " "
2234         rp='Would you like to see the instructions?'
2235         dflt=n
2236         . ./myread
2237         case "$ans" in
2238         [yY]*) ;;
2239         *) needman=false;;
2240         esac
2241 fi
2242 if $needman; then
2243         cat <<EOH
2244
2245 This installation shell script will examine your system and ask you questions
2246 to determine how the perl5 package should be installed. If you get
2247 stuck on a question, you may use a ! shell escape to start a subshell or
2248 execute a command.  Many of the questions will have default answers in square
2249 brackets; typing carriage return will give you the default.
2250
2251 On some of the questions which ask for file or directory names you are allowed
2252 to use the ~name construct to specify the login directory belonging to "name",
2253 even if you don't have a shell which knows about that.  Questions where this is
2254 allowed will be marked "(~name ok)".
2255
2256 EOH
2257         rp=''
2258         dflt='Type carriage return to continue'
2259         . ./myread
2260         cat <<'EOH'
2261
2262 The prompter used in this script allows you to use shell variables and
2263 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2264 in the default answer, as if the default line was a set of arguments given to a
2265 script shell.  This means you may also use $* to repeat the whole default line,
2266 so you do not have to re-type everything to add something to the default.
2267
2268 Every time there is a substitution, you will have to confirm.  If there is an
2269 error (e.g. an unmatched backtick), the default answer will remain unchanged
2270 and you will be prompted again.
2271
2272 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2273 the questions and use the computed defaults (or the previous answers if there
2274 was already a config.sh file). Type 'Configure -h' for a list of options.
2275 You may also start interactively and then answer '& -d' at any prompt to turn
2276 on the non-interactive behaviour for the remainder of the execution.
2277
2278 EOH
2279         . ./myread
2280         cat <<EOH
2281
2282 Much effort has been expended to ensure that this shell script will run on any
2283 Unix system.  If despite that it blows up on yours, your best bet is to edit
2284 Configure and run it again.  If you can't run Configure for some reason,
2285 you'll have to generate a config.sh file by hand.  Whatever problems you
2286 have, let me (perlbug@perl.org) know how I blew it.
2287
2288 This installation script affects things in two ways:
2289
2290 1) it may do direct variable substitutions on some of the files included
2291    in this kit.
2292 2) it builds a config.h file for inclusion in C programs.  You may edit
2293    any of these files as the need arises after running this script.
2294
2295 If you make a mistake on a question, there is no easy way to back up to it
2296 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2297 files.  Configure will offer to let you do this before it runs the SH files.
2298
2299 EOH
2300         dflt='Type carriage return to continue'
2301         . ./myread
2302         case "$firsttime" in
2303         true) echo $user >>../.config/instruct;;
2304         esac
2305 fi
2306
2307 : find out where common programs are
2308 echo " "
2309 echo "Locating common programs..." >&4
2310 cat <<EOSC >loc
2311 $startsh
2312 case \$# in
2313 0) exit 1;;
2314 esac
2315 thing=\$1
2316 shift
2317 dflt=\$1
2318 shift
2319 for dir in \$*; do
2320         case "\$thing" in
2321         .)
2322         if test -d \$dir/\$thing; then
2323                 echo \$dir
2324                 exit 0
2325         fi
2326         ;;
2327         *)
2328         for thisthing in \$dir/\$thing; do
2329                 : just loop through to pick last item
2330         done
2331         if test -f \$thisthing; then
2332                 echo \$thisthing
2333                 exit 0
2334         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2335                 echo \$thisthing
2336                 exit 0
2337         elif test -f \$dir/\$thing.exe; then
2338                 if test -n "$DJGPP"; then
2339                         echo \$dir/\$thing.exe
2340                 elif test "$eunicefix" != ":"; then
2341                         : on Eunice apparently
2342                         echo \$dir/\$thing
2343                 fi
2344                 exit 0
2345         fi
2346         ;;
2347         esac
2348 done
2349 echo \$dflt
2350 exit 1
2351 EOSC
2352 chmod +x loc
2353 $eunicefix loc
2354 loclist="
2355 awk
2356 cat
2357 chmod
2358 comm
2359 cp
2360 echo
2361 expr
2362 grep
2363 ls
2364 mkdir
2365 rm
2366 sed
2367 sort
2368 touch
2369 tr
2370 uniq
2371 "
2372 trylist="
2373 ar
2374 bison
2375 byacc
2376 cpp
2377 csh
2378 date
2379 egrep
2380 gmake
2381 gzip
2382 less
2383 ln
2384 make
2385 more
2386 nm
2387 nroff
2388 perl
2389 pg
2390 test
2391 uname
2392 zip
2393 "
2394 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2395 pth="$pth /lib /usr/lib"
2396 for file in $loclist; do
2397         eval xxx=\$$file
2398         case "$xxx" in
2399         /*|?:[\\/]*)
2400                 if test -f "$xxx"; then
2401                         : ok
2402                 else
2403                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2404                         xxx=`./loc $file $file $pth`
2405                 fi
2406                 ;;
2407         '') xxx=`./loc $file $file $pth`;;
2408         *) xxx=`./loc $xxx $xxx $pth`;;
2409         esac
2410         eval $file=$xxx$_exe
2411         eval _$file=$xxx
2412         case "$xxx" in
2413         /*)
2414                 echo $file is in $xxx.
2415                 ;;
2416         ?:[\\/]*)
2417                 echo $file is in $xxx.
2418                 ;;
2419         *)
2420                 echo "I don't know where '$file' is, and my life depends on it." >&4
2421                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2422                 exit 1
2423                 ;;
2424         esac
2425 done
2426 echo " "
2427 echo "Don't worry if any of the following aren't found..."
2428 say=offhand
2429 for file in $trylist; do
2430         eval xxx=\$$file
2431         case "$xxx" in
2432         /*|?:[\\/]*)
2433                 if test -f "$xxx"; then
2434                         : ok
2435                 else
2436                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2437                         xxx=`./loc $file $file $pth`
2438                 fi
2439                 ;;
2440         '') xxx=`./loc $file $file $pth`;;
2441         *) xxx=`./loc $xxx $xxx $pth`;;
2442         esac
2443         eval $file=$xxx$_exe
2444         eval _$file=$xxx
2445         case "$xxx" in
2446         /*)
2447                 echo $file is in $xxx.
2448                 ;;
2449         ?:[\\/]*)
2450                 echo $file is in $xxx.
2451                 ;;
2452         *)
2453                 echo "I don't see $file out there, $say."
2454                 say=either
2455                 ;;
2456         esac
2457 done
2458 case "$egrep" in
2459 egrep)
2460         echo "Substituting grep for egrep."
2461         egrep=$grep
2462         _egrep=$grep
2463         ;;
2464 esac
2465 case "$less" in
2466 '')     ;;
2467 *)      if $less -R </dev/null >/dev/null; then
2468                echo "Substituting less -R for less."
2469                less="$less -R"
2470                _less=$less
2471         fi
2472         ;;
2473 esac
2474 case "$ln" in
2475 ln)
2476         echo "Substituting cp for ln."
2477         ln=$cp
2478         _ln=$cp
2479         ;;
2480 esac
2481 case "$make" in
2482 make)
2483         case "$gmake" in
2484         gmake)
2485         echo "I can't find make or gmake, and my life depends on it." >&4
2486         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2487         exit 1
2488         ;;
2489         esac
2490         ;;
2491 esac
2492 case "$gmake" in
2493 gmake)  ;;
2494 *)      # We can't have osname yet.
2495         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2496                 # Assume that gmake, if found, is definitely GNU make
2497                 # and prefer it over the system make.
2498                 echo "Substituting gmake for make."
2499                 make=$gmake
2500                 _make=$gmake
2501         fi
2502         ;;
2503 esac
2504 case "$test" in
2505 test)
2506         echo "Hopefully test is built into your sh."
2507         ;;
2508 *)
2509         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2510                 echo "Using the test built into your sh."
2511                 test=test
2512                 _test=test
2513         fi
2514         ;;
2515 esac
2516 case "$echo" in
2517 echo)
2518         echo "Hopefully echo is built into your sh."
2519         ;;
2520 '') ;;
2521 *)
2522         echo " "
2523 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2524         $echo $n "hi there$c" >foo1
2525         echo $n "hi there$c" >foo2
2526         if cmp foo1 foo2 >/dev/null 2>&1; then
2527                 echo "They are compatible.  In fact, they may be identical."
2528         else
2529                 case "$n" in
2530                 '-n') n='' c='\c';;
2531                 *) n='-n' c='';;
2532                 esac
2533                 cat <<FOO
2534 They are not compatible!  You are probably running ksh on a non-USG system.
2535 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2536 have echo built in and we may have to run some Bourne shell scripts.  That
2537 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2538
2539 FOO
2540                 $echo $n "The star should be here-->$c"
2541                 $echo "*"
2542         fi
2543         $rm -f foo1 foo2
2544         ;;
2545 esac
2546
2547 # This question was auctioned at YAPC::Europe-2007 in Vienna
2548 # I never promised you could answer it. I only auctioned the question.
2549 cat <<FOO
2550 The following message is sponsored by
2551
2552   Dresden.pm<--The stars should be here.
2553
2554 Dear Perl user, system administrator or package
2555 maintainer, the Perl community sends greetings to
2556 you. Do you (emblematical) greet back [Y/n]? n
2557
2558 FOO
2559
2560 : Check what type of C compiler we use
2561 cat <<EOS >trygcc
2562 $startsh
2563 EOS
2564 cat <<'EOSC' >>trygcc
2565 case "$cc" in
2566 '') ;;
2567 *)  $rm -f try try.*
2568     $cat >try.c <<EOM
2569 int main(int argc, char *argv[]) {
2570   return 0;
2571 }
2572 EOM
2573     if $cc -o try $ccflags $ldflags try.c; then
2574        :
2575     else
2576         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2577         despair=yes
2578         trygcc=yes
2579         case "$cc" in
2580         *gcc*) trygcc=no ;;
2581         esac
2582         # Skip this test because it gives a false match on output like:
2583         #    ./trygcc: line 23: cc: command not found
2584         # case "`$cc -v -c try.c 2>&1`" in
2585         # *gcc*) trygcc=no ;;
2586         # esac
2587         if $test X"$trygcc" = Xyes; then
2588             if gcc -o try -c try.c; then
2589                 echo " "
2590                 echo "You seem to have a working gcc, though." >&4
2591                 # Switching compilers may undo the work of hints files.
2592                 # The most common problem is -D_REENTRANT for threads.
2593                 # This heuristic catches that case, but gets false positives
2594                 # if -Dusethreads was not actually specified.  Better to
2595                 # bail out here with a useful message than fail 
2596                 # mysteriously later. Should we perhaps just try to
2597                 # re-invoke Configure -Dcc=gcc config_args ?
2598                 if $test -f usethreads.cbu; then
2599                         $cat >&4 <<EOM 
2600
2601 *** However, any setting of the C compiler flags (e.g. for thread support)
2602 *** will be lost.  It may be necessary for you to restart Configure and
2603 *** add -Dcc=gcc to your Configure command line.
2604
2605 EOM
2606                         rp="Would you like to go ahead and try gcc anyway?"
2607                         dflt=n
2608                 else
2609                         rp="Would you like to use it?"
2610                         dflt=y
2611                 fi
2612                 if $test -f myread; then
2613                     . ./myread
2614                 else
2615                     if $test -f UU/myread; then
2616                         . ./UU/myread
2617                     else
2618                         echo "Cannot find myread, sorry.  Aborting." >&2
2619                         exit 1
2620                     fi
2621                 fi  
2622                 case "$ans" in
2623                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2624                 esac
2625             fi
2626         fi
2627     fi
2628     $rm -f try try.*
2629     ;;
2630 esac
2631 EOSC
2632
2633 cat <<EOS >checkcc
2634 $startsh
2635 EOS
2636 cat <<'EOSC' >>checkcc
2637 case "$cc" in        
2638 '') ;;
2639 *)  $rm -f try try.*              
2640     $cat >try.c <<EOM
2641 int main(int argc, char *argv[]) {
2642   return 0;
2643 }
2644 EOM
2645     if $cc -o try $ccflags $ldflags try.c; then
2646        :
2647     else
2648         if $test X"$despair" = Xyes; then
2649            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2650         fi
2651         $cat >&4 <<EOM         
2652 You need to find a working C compiler.
2653 Either (purchase and) install the C compiler supplied by your OS vendor,
2654 or for a free C compiler try http://gcc.gnu.org/
2655 I cannot continue any further, aborting.
2656 EOM
2657         exit 1
2658     fi
2659     $rm -f try try.*
2660     ;;
2661 esac
2662 EOSC
2663
2664 : determine whether symbolic links are supported
2665 echo " "
2666 $touch blurfl
2667 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2668         echo "Symbolic links are supported." >&4
2669         lns="$ln -s"
2670 else
2671         echo "Symbolic links are NOT supported." >&4
2672         lns="$ln"
2673 fi
2674 $rm -f blurfl sym
2675
2676 : determine whether symbolic links are supported
2677 echo " "
2678 case "$lns" in
2679 *"ln"*" -s")
2680         echo "Checking how to test for symbolic links..." >&4
2681         $lns blurfl sym
2682         if $test "X$issymlink" = X; then
2683                 case "$newsh" in
2684                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2685                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2686                 esac
2687                 if test $? = 0; then
2688                         issymlink="test -h"
2689                 else
2690                         echo "Your builtin 'test -h' may be broken." >&4
2691                         case "$test" in
2692                         /*)     ;;
2693                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2694                                 for p in $pth
2695                                 do
2696                                         if test -f "$p/$test"; then
2697                                                 test="$p/$test"
2698                                                 break
2699                                         fi
2700                                 done
2701                                 ;;
2702                         esac
2703                         case "$test" in
2704                         /*)
2705                                 echo "Trying external '$test -h'." >&4
2706                                 issymlink="$test -h"
2707                                 if $test ! -h sym >/dev/null 2>&1; then
2708                                         echo "External '$test -h' is broken, too." >&4
2709                                         issymlink=''
2710                                 fi
2711                                 ;;
2712                         *)      issymlink='' ;;
2713                         esac
2714                 fi              
2715         fi
2716         if $test "X$issymlink" = X; then
2717                 if $test -L sym 2>/dev/null; then
2718                         issymlink="$test -L"
2719                         echo "The builtin '$test -L' worked." >&4
2720                 fi
2721         fi
2722         if $test "X$issymlink" != X; then
2723                 echo "You can test for symbolic links with '$issymlink'." >&4
2724         else
2725                 echo "I do not know how you can test for symbolic links." >&4
2726         fi
2727         $rm -f blurfl sym
2728         ;;
2729 *)      echo "No symbolic links, so not testing for their testing..." >&4
2730         ;;
2731 esac
2732 echo " "
2733
2734 : Make symlinks util
2735 case "$mksymlinks" in
2736 $define|true|[yY]*)
2737         case "$src" in
2738         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2739                 exit 1
2740                 ;;
2741         *)      case "$lns:$issymlink" in
2742                 *"ln"*" -s:"*"test -"?)
2743                         echo "Creating the symbolic links..." >&4
2744                         echo "(First creating the subdirectories...)" >&4
2745                         cd ..
2746                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2747                                 read directory
2748                                 test -z "$directory" && break
2749                                 mkdir -p $directory
2750                         done
2751                         # Sanity check 1.
2752                         if test ! -d t/base; then
2753                                 echo "Failed to create the subdirectories.  Aborting." >&4
2754                                 exit 1
2755                         fi
2756                         echo "(Then creating the symlinks...)" >&4
2757                         awk '{print $1}' $src/MANIFEST | while true; do
2758                                 read filename
2759                                 test -z "$filename" && break
2760                                 if test -f $filename; then
2761                                         if $issymlink $filename; then
2762                                                 rm -f $filename
2763                                         fi
2764                                 fi
2765                                 if test -f $filename; then
2766                                         echo "$filename already exists, not symlinking."
2767                                 else
2768                                         ln -s $src/$filename $filename
2769                                 fi
2770                         done
2771                         # Sanity check 2.
2772                         if test ! -f t/base/lex.t; then
2773                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2774                                 exit 1
2775                         fi
2776                         cd UU
2777                         ;;
2778                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2779                         ;;
2780                 esac
2781                 ;;
2782         esac
2783         ;;
2784 esac
2785
2786 : Check for Cross-Compilation
2787 case "$usecrosscompile" in
2788 $define|true|[yY]*)
2789         $echo "Cross-compiling..."
2790         croak=''
2791         case "$cc" in
2792         *-*-gcc) # A cross-compiling gcc, probably.
2793             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2794             ar=$targetarch-ar
2795             # leave out ld, choosing it is more complex
2796             nm=$targetarch-nm
2797             ranlib=$targetarch-ranlib
2798             $echo 'extern int foo;' > try.c
2799             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2800             shift
2801             if $test $# -gt 0; then
2802                 incpth="$incpth $*"
2803                 incpth="`$echo $incpth|$sed 's/^ //'`"
2804                 echo "Guessing incpth '$incpth'." >&4
2805                 for i in $*; do
2806                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2807                     if $test -d $j; then
2808                         libpth="$libpth $j"
2809                     fi
2810                 done   
2811                 libpth="`$echo $libpth|$sed 's/^ //'`"
2812                 echo "Guessing libpth '$libpth'." >&4
2813             fi
2814             $rm -f try.c
2815             ;;
2816         esac
2817         case "$targetarch" in
2818         '') echo "Targetarch not defined." >&4; croak=y ;;
2819         *)  echo "Using targetarch $targetarch." >&4 ;;
2820         esac
2821         case "$incpth" in
2822         '') echo "Incpth not defined." >&4; croak=y ;;
2823         *)  echo "Using incpth '$incpth'." >&4 ;;
2824         esac
2825         case "$libpth" in
2826         '') echo "Libpth not defined." >&4; croak=y ;;
2827         *)  echo "Using libpth '$libpth'." >&4 ;;
2828         esac
2829         case "$usrinc" in
2830         '') for i in $incpth; do
2831                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2832                     usrinc=$i
2833                     echo "Guessing usrinc $usrinc." >&4
2834                     break
2835                 fi
2836             done
2837             case "$usrinc" in
2838             '') echo "Usrinc not defined." >&4; croak=y ;;
2839             esac
2840             ;;
2841         *)  echo "Using usrinc $usrinc." >&4 ;;
2842         esac
2843         case "$targethost" in
2844         '') echo "Targethost not defined." >&4; croak=y ;;
2845         *)  echo "Using targethost $targethost." >&4
2846         esac
2847         locincpth=' '
2848         loclibpth=' '
2849         case "$croak" in
2850         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2851         esac
2852         case "$src" in
2853         /*) run=$src/Cross/run
2854             targetmkdir=$src/Cross/mkdir
2855             to=$src/Cross/to
2856             from=$src/Cross/from
2857             ;;
2858         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2859             run=$pwd/Cross/run
2860             targetmkdir=$pwd/Cross/mkdir
2861             to=$pwd/Cross/to
2862             from=$pwd/Cross/from
2863             ;;
2864         esac
2865         case "$targetrun" in
2866         '') targetrun=ssh ;;
2867         esac
2868         case "$targetto" in
2869         '') targetto=scp ;;
2870         esac
2871         case "$targetfrom" in
2872         '') targetfrom=scp ;;
2873         esac
2874         run=$run-$targetrun
2875         to=$to-$targetto
2876         from=$from-$targetfrom
2877         case "$targetdir" in
2878         '')  targetdir=/tmp
2879              echo "Guessing targetdir $targetdir." >&4
2880              ;;
2881         esac
2882         case "$targetuser" in
2883         '')  targetuser=root
2884              echo "Guessing targetuser $targetuser." >&4
2885              ;;
2886         esac
2887         case "$targetfrom" in
2888         scp)    q=-q ;;
2889         *)      q='' ;;
2890         esac
2891         case "$targetrun" in
2892         ssh|rsh)
2893             cat >$run <<EOF
2894 #!/bin/sh
2895 case "\$1" in
2896 -cwd)
2897   shift
2898   cwd=\$1
2899   shift
2900   ;;
2901 esac
2902 case "\$cwd" in
2903 '') cwd=$targetdir ;;
2904 esac
2905 exe=\$1
2906 shift
2907 if $test ! -f \$exe.xok; then
2908   $to \$exe
2909   $touch \$exe.xok
2910 fi
2911 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2912 EOF
2913             ;;
2914         *)  echo "Unknown targetrun '$targetrun'" >&4
2915             exit 1
2916             ;;
2917         esac
2918         case "$targetmkdir" in
2919         */Cross/mkdir)
2920             cat >$targetmkdir <<EOF
2921 #!/bin/sh
2922 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2923 EOF
2924             $chmod a+rx $targetmkdir
2925             ;;
2926         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2927             exit 1
2928             ;;
2929         esac
2930         case "$targetto" in
2931         scp|rcp)
2932             cat >$to <<EOF
2933 #!/bin/sh
2934 for f in \$@
2935 do
2936   case "\$f" in
2937   /*)
2938     $targetmkdir \`dirname \$f\`
2939     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2940     ;;
2941   *)
2942     $targetmkdir $targetdir/\`dirname \$f\`
2943     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2944     ;;
2945   esac
2946 done
2947 exit 0
2948 EOF
2949             ;;
2950         cp) cat >$to <<EOF
2951 #!/bin/sh
2952 for f in \$@
2953 do
2954   case "\$f" in
2955   /*)
2956     $mkdir -p $targetdir/\`dirname \$f\`
2957     $cp \$f $targetdir/\$f || exit 1
2958     ;;
2959   *)
2960     $targetmkdir $targetdir/\`dirname \$f\`
2961     $cp \$f $targetdir/\$f || exit 1
2962     ;;
2963   esac
2964 done
2965 exit 0
2966 EOF
2967             ;;
2968         *)  echo "Unknown targetto '$targetto'" >&4
2969             exit 1
2970             ;;
2971         esac
2972         case "$targetfrom" in
2973         scp|rcp)
2974           cat >$from <<EOF
2975 #!/bin/sh
2976 for f in \$@
2977 do
2978   $rm -f \$f
2979   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2980 done
2981 exit 0
2982 EOF
2983             ;;
2984         cp) cat >$from <<EOF
2985 #!/bin/sh
2986 for f in \$@
2987 do
2988   $rm -f \$f
2989   cp $targetdir/\$f . || exit 1
2990 done
2991 exit 0
2992 EOF
2993             ;;
2994         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2995             exit 1
2996             ;;
2997         esac
2998         if $test ! -f $run; then
2999             echo "Target 'run' script '$run' not found." >&4
3000         else
3001             $chmod a+rx $run
3002         fi
3003         if $test ! -f $to; then
3004             echo "Target 'to' script '$to' not found." >&4
3005         else
3006             $chmod a+rx $to
3007         fi
3008         if $test ! -f $from; then
3009             echo "Target 'from' script '$from' not found." >&4
3010         else
3011             $chmod a+rx $from
3012         fi
3013         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3014             exit 1
3015         fi
3016         cat >&4 <<EOF
3017 Using '$run' for remote execution,
3018 and '$from' and '$to'
3019 for remote file transfer.
3020 EOF
3021         ;;
3022 *)      run=''
3023         to=:
3024         from=:
3025         usecrosscompile='undef'
3026         targetarch=''
3027         ;;
3028 esac
3029
3030 : see whether [:lower:] and [:upper:] are supported character classes
3031 echo " "
3032 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3033 ABYZ)
3034         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3035         up='[:upper:]'
3036         low='[:lower:]'
3037         ;;
3038 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3039         # (0xd9 and 0xe2), therefore that is a nice testing point.
3040         if test "X$up" = X -o "X$low" = X; then
3041             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3042             rs) up='[A-Z]'
3043                 low='[a-z]'
3044                 ;;
3045             esac
3046         fi
3047         if test "X$up" = X -o "X$low" = X; then
3048             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3049             rs) up='A-Z'
3050                 low='a-z'
3051                 ;;
3052             esac
3053         fi
3054         if test "X$up" = X -o "X$low" = X; then
3055             case "`echo RS | od -x 2>/dev/null`" in
3056             *D9E2*|*d9e2*)
3057                 echo "Hey, this might be EBCDIC." >&4
3058                 if test "X$up" = X -o "X$low" = X; then
3059                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3060                     rs) up='[A-IJ-RS-Z]'
3061                         low='[a-ij-rs-z]'
3062                         ;;
3063                     esac
3064                 fi
3065                 if test "X$up" = X -o "X$low" = X; then
3066                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3067                     rs) up='A-IJ-RS-Z'
3068                         low='a-ij-rs-z'
3069                         ;;
3070                     esac
3071                 fi
3072                 ;;
3073             esac
3074         fi
3075 esac
3076 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3077 rs)
3078     echo "Using $up and $low to convert case." >&4
3079     ;;
3080 *)
3081     echo "I don't know how to translate letters from upper to lower case." >&4
3082     echo "Your tr is not acting any way I know of." >&4
3083     exit 1
3084     ;;
3085 esac
3086 : set up the translation script tr, must be called with ./tr of course
3087 cat >tr <<EOSC
3088 $startsh
3089 case "\$1\$2" in
3090 '[A-Z][a-z]') exec $tr '$up' '$low';;
3091 '[a-z][A-Z]') exec $tr '$low' '$up';;
3092 esac
3093 exec $tr "\$@"
3094 EOSC
3095 chmod +x tr
3096 $eunicefix tr
3097
3098 : Try to determine whether config.sh was made on this system
3099 case "$config_sh" in
3100 '')
3101 myuname=`$uname -a 2>/dev/null`
3102 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3103 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3104 # because the A-Z/a-z are not consecutive.
3105 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3106         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3107 newmyuname="$myuname"
3108 dflt=n
3109 case "$knowitall" in
3110 '')
3111         if test -f ../config.sh; then
3112                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3113                         eval "`grep myuname= ../config.sh`"
3114                 fi
3115                 if test "X$myuname" = "X$newmyuname"; then
3116                         dflt=y
3117                 fi
3118         fi
3119         ;;
3120 *) dflt=y;;
3121 esac
3122
3123 : Get old answers from old config file if Configure was run on the
3124 : same system, otherwise use the hints.
3125 hint=default
3126 cd ..
3127 if test -f config.sh; then
3128         echo " "
3129         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3130         . UU/myread
3131         case "$ans" in
3132         n*|N*) echo "OK, I'll ignore it."
3133                 mv config.sh config.sh.old
3134                 myuname="$newmyuname"
3135                 ;;
3136         *)  echo "Fetching default answers from your old config.sh file..." >&4
3137                 tmp_n="$n"
3138                 tmp_c="$c"
3139                 tmp_sh="$sh"
3140                 . ./config.sh
3141                 cp config.sh UU
3142                 n="$tmp_n"
3143                 c="$tmp_c"
3144                 : Older versions did not always set $sh.  Catch re-use of such
3145                 : an old config.sh.
3146                 case "$sh" in
3147                 '') sh="$tmp_sh" ;;
3148                 esac
3149                 hint=previous
3150                 ;;
3151         esac
3152 fi
3153 . ./UU/checkcc
3154 if test ! -f config.sh; then
3155         $cat <<EOM
3156
3157 First time through, eh?  I have some defaults handy for some systems
3158 that need some extra help getting the Configure answers right:
3159
3160 EOM
3161         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3162         dflt=''
3163         : Half the following guesses are probably wrong... If you have better
3164         : tests or hints, please send them to perlbug@perl.org
3165         : The metaconfig authors would also appreciate a copy...
3166         $test -f /irix && osname=irix
3167         $test -f /xenix && osname=sco_xenix
3168         $test -f /dynix && osname=dynix
3169         $test -f /dnix && osname=dnix
3170         $test -f /lynx.os && osname=lynxos
3171         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3172         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3173         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3174         $test -f /bin/mips && /bin/mips && osname=mips
3175         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3176                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3177         $test -d /usr/apollo/bin && osname=apollo
3178         $test -f /etc/saf/_sactab && osname=svr4
3179         $test -d /usr/include/minix && osname=minix
3180         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3181         if $test -d /MachTen -o -d /MachTen_Folder; then
3182                 osname=machten
3183                 if $test -x /sbin/version; then
3184                         osvers=`/sbin/version | $awk '{print $2}' |
3185                         $sed -e 's/[A-Za-z]$//'`
3186                 elif $test -x /usr/etc/version; then
3187                         osvers=`/usr/etc/version | $awk '{print $2}' |
3188                         $sed -e 's/[A-Za-z]$//'`
3189                 else
3190                         osvers="$2.$3"
3191                 fi
3192         fi
3193
3194         $test -f /sys/posix.dll &&
3195                 $test -f /usr/bin/what &&
3196                 set X `/usr/bin/what /sys/posix.dll` &&
3197                 $test "$3" = UWIN &&
3198                 osname=uwin &&
3199                 osvers="$5"
3200
3201         if $test -f $uname; then
3202                 set X $myuname
3203                 shift
3204
3205                 case "$5" in
3206                 fps*) osname=fps ;;
3207                 mips*)
3208                         case "$4" in
3209                         umips) osname=umips ;;
3210                         *) osname=mips ;;
3211                         esac;;
3212                 [23]100) osname=mips ;;
3213                 next*) osname=next ;;
3214                 i386*)
3215                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3216                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3217                                 osname='sco'
3218                                 osvers=$tmp
3219                         elif $test -f /etc/kconfig; then
3220                                 osname=isc
3221                                 if test "$lns" = "$ln -s"; then
3222                                         osvers=4
3223                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3224                                         osvers=3
3225                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3226                                         osvers=2
3227                                 fi
3228                         fi
3229                         tmp=''
3230                         ;;
3231                 pc*)
3232                         if test -n "$DJGPP"; then
3233                                 osname=dos
3234                                 osvers=djgpp
3235                         fi
3236                         ;;
3237                 esac
3238
3239                 case "$1" in
3240                 aix) osname=aix
3241                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3242                         case "$tmp" in
3243                         # oslevel can fail with:
3244                         # oslevel: Unable to acquire lock.
3245                         *not\ found) osvers="$4"."$3" ;;
3246                         '<3240'|'<>3240') osvers=3.2.0 ;;
3247                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3248                         '=3250'|'>3250') osvers=3.2.5 ;;
3249                         *) osvers=$tmp;;
3250                         esac
3251                         ;;
3252                 bsd386) osname=bsd386
3253                         osvers=`$uname -r`
3254                         ;;
3255                 cygwin*) osname=cygwin
3256                         osvers="$3"
3257                         ;;
3258                 *dc.osx) osname=dcosx
3259                         osvers="$3"
3260                         ;;
3261                 dnix) osname=dnix
3262                         osvers="$3"
3263                         ;;
3264                 domainos) osname=apollo
3265                         osvers="$3"
3266                         ;;
3267                 dgux)   osname=dgux
3268                         osvers="$3"
3269                         ;;
3270                 dragonfly) osname=dragonfly
3271                         osvers="$3"
3272                         ;;
3273                 dynixptx*) osname=dynixptx
3274                         osvers=`echo "$4"|sed 's/^v//'`
3275                         ;;
3276                 freebsd) osname=freebsd
3277                         osvers="$3" ;;
3278                 genix)  osname=genix ;;
3279                 gnu)    osname=gnu
3280                         osvers="$3" ;;
3281                 hp*)    osname=hpux
3282                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3283                         ;;
3284                 irix*)  osname=irix
3285                         case "$3" in
3286                         4*) osvers=4 ;;
3287                         5*) osvers=5 ;;
3288                         *)      osvers="$3" ;;
3289                         esac
3290                         ;;
3291                 linux)  osname=linux
3292                         case "$3" in
3293                         *)      osvers="$3" ;;
3294                         esac
3295                         ;;
3296                 MiNT)   osname=mint
3297                         ;;
3298                 netbsd*) osname=netbsd
3299                         osvers="$3"
3300                         ;;
3301                 news-os) osvers="$3"
3302                         case "$3" in
3303                         4*) osname=newsos4 ;;
3304                         *) osname=newsos ;;
3305                         esac
3306                         ;;
3307                 next*) osname=next ;;
3308                 nonstop-ux) osname=nonstopux ;;
3309                 openbsd) osname=openbsd
3310                         osvers="$3"
3311                         ;;
3312                 os2)    osname=os2
3313                         osvers="$4"
3314                         ;;
3315                 POSIX-BC | posix-bc ) osname=posix-bc
3316                         osvers="$3"
3317                         ;;
3318                 powerux | power_ux | powermax_os | powermaxos | \
3319                 powerunix | power_unix) osname=powerux
3320                         osvers="$3"
3321                         ;;
3322                 qnx) osname=qnx
3323                         osvers="$4"
3324                         ;;
3325                 solaris) osname=solaris
3326                         case "$3" in
3327                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3328                         *)      osvers="$3" ;;
3329                         esac
3330                         ;;
3331                 sunos) osname=sunos
3332                         case "$3" in
3333                         5*) osname=solaris
3334                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3335                         *)      osvers="$3" ;;
3336                         esac
3337                         ;;
3338                 titanos) osname=titanos
3339                         case "$3" in
3340                         1*) osvers=1 ;;
3341                         2*) osvers=2 ;;
3342                         3*) osvers=3 ;;
3343                         4*) osvers=4 ;;
3344                         *)      osvers="$3" ;;
3345                         esac
3346                         ;;
3347                 ultrix) osname=ultrix
3348                         osvers="$3"
3349                         ;;
3350                 osf1|mls+)      case "$5" in
3351                                 alpha)
3352                                         osname=dec_osf
3353                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3354                                         case "$osvers" in
3355                                         [1-9].[0-9]*) ;;
3356                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3357                                         esac
3358                                         ;;
3359                         hp*)    osname=hp_osf1  ;;
3360                         mips)   osname=mips_osf1 ;;
3361                         esac
3362                         ;;
3363                 # UnixWare 7.1.2 is known as Open UNIX 8
3364                 openunix|unixware) osname=svr5
3365                         osvers="$4"
3366                         ;;
3367                 uts)    osname=uts
3368                         osvers="$3"
3369                         ;;
3370                 vos) osvers="$3"
3371                         ;;
3372                 $2) case "$osname" in
3373                         *isc*) ;;
3374                         *freebsd*) ;;
3375                         svr*)
3376                                 : svr4.x or possibly later
3377                                 case "svr$3" in
3378                                 ${osname}*)
3379                                         osname=svr$3
3380                                         osvers=$4
3381                                         ;;
3382                                 esac
3383                                 case "$osname" in
3384                                 svr4.0)
3385                                         : Check for ESIX
3386                                         if test -f /stand/boot ; then
3387                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3388                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3389                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3390                                                         if test -n "$isesix"; then
3391                                                                 osname=esix4
3392                                                         fi
3393                                                 fi
3394                                         fi
3395                                         ;;
3396                                 esac
3397                                 ;;
3398                         *)      if test -f /etc/systemid; then
3399                                         osname=sco
3400                                         set `echo $3 | $sed 's/\./ /g'` $4
3401                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3402                                                 osvers=$1.$2.$3
3403                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3404                                                 osvers=$1.$2
3405                                         elif $test -f $src/hints/sco_$1.sh; then
3406                                                 osvers=$1
3407                                         fi
3408                                 else
3409                                         case "$osname" in
3410                                         '') : Still unknown.  Probably a generic Sys V.
3411                                                 osname="sysv"
3412                                                 osvers="$3"
3413                                                 ;;
3414                                         esac
3415                                 fi
3416                                 ;;
3417                         esac
3418                         ;;
3419                 *)      case "$osname" in
3420                         '') : Still unknown.  Probably a generic BSD.
3421                                 osname="$1"
3422                                 osvers="$3"
3423                                 ;;
3424                         esac
3425                         ;;
3426                 esac
3427         else
3428                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3429                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3430                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3431                                 osname=news_os
3432                         fi
3433                         $rm -f UU/kernel.what
3434                 elif test -d c:/. -o -n "$is_os2" ; then
3435                         set X $myuname
3436                         osname=os2
3437                         osvers="$5"
3438                 fi
3439         fi
3440
3441         case "$targetarch" in
3442         '') ;;
3443         *)  hostarch=$osname
3444             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3445             osvers=''
3446             ;;
3447         esac
3448
3449         : Now look for a hint file osname_osvers, unless one has been
3450         : specified already.
3451         case "$hintfile" in
3452         ''|' ')
3453                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3454                 : Also try without trailing minor version numbers.
3455                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3456                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3457                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3458                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3459                 case "$file" in
3460                 '') dflt=none ;;
3461                 *)  case "$osvers" in
3462                         '') dflt=$file
3463                                 ;;
3464                         *)  if $test -f $src/hints/$file.sh ; then
3465                                         dflt=$file
3466                                 elif $test -f $src/hints/$xfile.sh ; then
3467                                         dflt=$xfile
3468                                 elif $test -f $src/hints/$xxfile.sh ; then
3469                                         dflt=$xxfile
3470                                 elif $test -f $src/hints/$xxxfile.sh ; then
3471                                         dflt=$xxxfile
3472                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3473                                         dflt=$xxxxfile
3474                                 elif $test -f "$src/hints/${osname}.sh" ; then
3475                                         dflt="${osname}"
3476                                 else
3477                                         dflt=none
3478                                 fi
3479                                 ;;
3480                         esac
3481                         ;;
3482                 esac
3483                 if $test -f Policy.sh ; then
3484                         case "$dflt" in
3485                         *Policy*) ;;
3486                         none) dflt="Policy" ;;
3487                         *) dflt="Policy $dflt" ;;
3488                         esac
3489                 fi
3490                 ;;
3491         *)
3492                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3493                 ;;
3494         esac
3495
3496         if $test -f Policy.sh ; then
3497                 $cat <<EOM
3498
3499 There's also a Policy hint file available, which should make the
3500 site-specific (policy) questions easier to answer.
3501 EOM
3502
3503         fi
3504
3505         $cat <<EOM
3506
3507 You may give one or more space-separated answers, or "none" if appropriate.
3508 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3509 previous run of Configure, you may specify it as well as or instead of
3510 OS-specific hints.  If hints are provided for your OS, you should use them:
3511 although Perl can probably be built without hints on many platforms, using
3512 hints often improve performance and may enable features that Configure can't
3513 set up on its own. If there are no hints that match your OS, specify "none";
3514 DO NOT give a wrong version or a wrong OS.
3515
3516 EOM
3517
3518         rp="Which of these apply, if any?"
3519         . UU/myread
3520         tans=$ans
3521         for file in $tans; do
3522                 if $test X$file = XPolicy -a -f Policy.sh; then
3523                         . Policy.sh
3524                         $cat Policy.sh >> UU/config.sh
3525                 elif $test -f $src/hints/$file.sh; then
3526                         . $src/hints/$file.sh
3527                         $cat $src/hints/$file.sh >> UU/config.sh
3528                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3529                         : nothing
3530                 else
3531                         : Give one chance to correct a possible typo.
3532                         echo "$file.sh does not exist"
3533                         dflt=$file
3534                         rp="hint to use instead?"
3535                         . UU/myread
3536                         for file in $ans; do
3537                                 if $test -f "$src/hints/$file.sh"; then
3538                                         . $src/hints/$file.sh
3539                                         $cat $src/hints/$file.sh >> UU/config.sh
3540                                 elif $test X$ans = X -o X$ans = Xnone ; then
3541                                         : nothing
3542                                 else
3543                                         echo "$file.sh does not exist -- ignored."
3544                                 fi
3545                         done
3546                 fi
3547         done
3548
3549         hint=recommended
3550         : Remember our hint file for later.
3551         if $test -f "$src/hints/$file.sh" ; then
3552                 hintfile="$file"
3553         else
3554                 hintfile=''
3555         fi
3556 fi
3557 cd UU
3558 ;;
3559 *)
3560         echo " "
3561         echo "Fetching default answers from $config_sh..." >&4
3562         tmp_n="$n"
3563         tmp_c="$c"
3564         cd ..
3565         cp $config_sh config.sh 2>/dev/null
3566         chmod +w config.sh
3567         . ./config.sh
3568         cd UU
3569         cp ../config.sh .
3570         n="$tmp_n"
3571         c="$tmp_c"
3572         hint=previous
3573         ;;
3574 esac
3575 test "$override" && . ./optdef.sh
3576
3577 : Restore computed paths
3578 for file in $loclist $trylist; do
3579         eval $file="\$_$file"
3580 done
3581
3582 cat << EOM
3583
3584 Configure uses the operating system name and version to set some defaults.
3585 The default value is probably right if the name rings a bell. Otherwise,
3586 since spelling matters for me, either accept the default or answer "none"
3587 to leave it blank.
3588
3589 EOM
3590 case "$osname" in
3591         ''|' ')
3592                 case "$hintfile" in
3593                 ''|' '|none) dflt=none ;;
3594                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3595                 esac
3596                 ;;
3597         *) dflt="$osname" ;;
3598 esac
3599 rp="Operating system name?"
3600 . ./myread
3601 case "$ans" in
3602 none)  osname='' ;;
3603 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3604 esac
3605 echo " "
3606 case "$osvers" in
3607         ''|' ')
3608                 case "$hintfile" in
3609                 ''|' '|none) dflt=none ;;
3610                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3611                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3612                         case "$dflt" in
3613                         ''|' ') dflt=none ;;
3614                         esac
3615                         ;;
3616                 esac
3617                 ;;
3618         *) dflt="$osvers" ;;
3619 esac
3620 rp="Operating system version?"
3621 . ./myread
3622 case "$ans" in
3623 none)  osvers='' ;;
3624 *) osvers="$ans" ;;
3625 esac
3626
3627
3628 . ./posthint.sh
3629
3630 : who configured the system
3631 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3632 case "$cf_by" in
3633 "")
3634         cf_by=`(logname) 2>/dev/null`
3635         case "$cf_by" in
3636         "")
3637                 cf_by=`(whoami) 2>/dev/null`
3638                 case "$cf_by" in
3639                 "") cf_by=unknown ;;
3640                 esac ;;
3641         esac ;;
3642 esac
3643
3644 : decide how portable to be.  Allow command line overrides.
3645 case "$d_portable" in
3646 "$undef") ;;
3647 *)      d_portable="$define" ;;
3648 esac
3649
3650 : set up shell script to do ~ expansion
3651 cat >filexp <<EOSS
3652 $startsh
3653 : expand filename
3654 case "\$1" in
3655  \~/*|\~)
3656         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3657         ;;
3658  \~*)
3659         if $test -f /bin/csh; then
3660                 /bin/csh -f -c "glob \$1"
3661                 failed=\$?
3662                 echo ""
3663                 exit \$failed
3664         else
3665                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3666                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3667                 if $test ! -d "\$dir"; then
3668                         me=\`basename \$0\`
3669                         echo "\$me: can't locate home directory for: \$name" >&2
3670                         exit 1
3671                 fi
3672                 case "\$1" in
3673                 */*)
3674                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3675                         ;;
3676                 *)
3677                         echo \$dir
3678                         ;;
3679                 esac
3680         fi
3681         ;;
3682 *)
3683         echo \$1
3684         ;;
3685 esac
3686 EOSS
3687 chmod +x filexp
3688 $eunicefix filexp
3689
3690 : now set up to get a file name
3691 cat <<EOS >getfile
3692 $startsh
3693 EOS
3694 cat <<'EOSC' >>getfile
3695 tilde=''
3696 fullpath=''
3697 already=''
3698 skip=''
3699 none_ok=''
3700 exp_file=''
3701 nopath_ok=''
3702 orig_rp="$rp"
3703 orig_dflt="$dflt"
3704 case "$gfpth" in
3705 '') gfpth='.' ;;
3706 esac
3707
3708 case "$fn" in
3709 *\(*)
3710         : getfile will accept an answer from the comma-separated list
3711         : enclosed in parentheses even if it does not meet other criteria.
3712         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3713         fn=`echo $fn | sed 's/(.*)//'`
3714         ;;
3715 esac
3716
3717 case "$fn" in
3718 *:*)
3719         loc_file=`expr $fn : '.*:\(.*\)'`
3720         fn=`expr $fn : '\(.*\):.*'`
3721         ;;
3722 esac
3723
3724 case "$fn" in
3725 *~*) tilde=true;;
3726 esac
3727 case "$fn" in
3728 */*) fullpath=true;;
3729 esac
3730 case "$fn" in
3731 *+*) skip=true;;
3732 esac
3733 case "$fn" in
3734 *n*) none_ok=true;;
3735 esac
3736 case "$fn" in
3737 *e*) exp_file=true;;
3738 esac
3739 case "$fn" in
3740 *p*) nopath_ok=true;;
3741 esac
3742
3743 case "$fn" in
3744 *f*) type='File';;
3745 *d*) type='Directory';;
3746 *l*) type='Locate';;
3747 esac
3748
3749 what="$type"
3750 case "$what" in
3751 Locate) what='File';;
3752 esac
3753
3754 case "$exp_file" in
3755 '')
3756         case "$d_portable" in
3757         "$define") ;;
3758         *) exp_file=true;;
3759         esac
3760         ;;
3761 esac
3762
3763 cd ..
3764 while test "$type"; do
3765         redo=''
3766         rp="$orig_rp"
3767         dflt="$orig_dflt"
3768         case "$tilde" in
3769         true) rp="$rp (~name ok)";;
3770         esac
3771         . UU/myread
3772         if test -f UU/getfile.ok && \
3773                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3774         then
3775                 value="$ans"
3776                 ansexp="$ans"
3777                 break
3778         fi
3779         case "$ans" in
3780         none)
3781                 value=''
3782                 ansexp=''
3783                 case "$none_ok" in
3784                 true) type='';;
3785                 esac
3786                 ;;
3787         *)
3788                 case "$tilde" in
3789                 '') value="$ans"
3790                         ansexp="$ans";;
3791                 *)
3792                         value=`UU/filexp $ans`
3793                         case $? in
3794                         0)
3795                                 if test "$ans" != "$value"; then
3796                                         echo "(That expands to $value on this system.)"
3797                                 fi
3798                                 ;;
3799                         *) value="$ans";;
3800                         esac
3801                         ansexp="$value"
3802                         case "$exp_file" in
3803                         '') value="$ans";;
3804                         esac
3805                         ;;
3806                 esac
3807                 case "$fullpath" in
3808                 true)
3809                         case "$ansexp" in
3810                         /*) value="$ansexp" ;;
3811                         [a-zA-Z]:/*) value="$ansexp" ;;
3812                         *)
3813                                 redo=true
3814                                 case "$already" in
3815                                 true)
3816                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3817                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3818                                         ;;
3819                                 *)
3820                                 echo "Please give a full path name, starting with slash." >&4
3821                                         case "$tilde" in
3822                                         true)
3823                                 echo "Note that using ~name is ok provided it expands well." >&4
3824                                                 already=true
3825                                                 ;;
3826                                         esac
3827                                 esac
3828                                 ;;
3829                         esac
3830                         ;;
3831                 esac
3832                 case "$redo" in
3833                 '')
3834                         case "$type" in
3835                         File)
3836                                 for fp in $gfpth; do
3837                                         if test "X$fp" = X.; then
3838                                             pf="$ansexp"
3839                                         else    
3840                                             pf="$fp/$ansexp"
3841                                         fi
3842                                         if test -f "$pf"; then
3843                                                 type=''
3844                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3845                                         then
3846                                                 echo "($value is not a plain file, but that's ok.)"
3847                                                 type=''
3848                                         fi
3849                                         if test X"$type" = X; then
3850                                             value="$pf"
3851                                             break
3852                                         fi
3853                                 done
3854                                 ;;
3855                         Directory)
3856                                 for fp in $gfpth; do
3857                                         if test "X$fp" = X.; then
3858                                             dir="$ans"
3859                                             direxp="$ansexp"
3860                                         else    
3861                                             dir="$fp/$ansexp"
3862                                             direxp="$fp/$ansexp"
3863                                         fi
3864                                         if test -d "$direxp"; then
3865                                                 type=''
3866                                                 value="$dir"
3867                                                 break
3868                                         fi
3869                                 done
3870                                 ;;
3871                         Locate)
3872                                 if test -d "$ansexp"; then
3873                                         echo "(Looking for $loc_file in directory $value.)"
3874                                         value="$value/$loc_file"
3875                                         ansexp="$ansexp/$loc_file"
3876                                 fi
3877                                 if test -f "$ansexp"; then
3878                                         type=''
3879                                 fi
3880                                 case "$nopath_ok" in
3881                                 true)   case "$value" in
3882                                         */*) ;;
3883                                         *)      echo "Assuming $value will be in people's path."
3884                                                 type=''
3885                                                 ;;
3886                                         esac
3887                                         ;;
3888                                 esac
3889                                 ;;
3890                         esac
3891
3892                         case "$skip" in
3893                         true) type='';
3894                         esac
3895
3896                         case "$type" in
3897                         '') ;;
3898                         *)
3899                                 if test "$fastread" = yes; then
3900                                         dflt=y
3901                                 else
3902                                         dflt=n
3903                                 fi
3904                                 rp="$what $value doesn't exist.  Use that name anyway?"
3905                                 . UU/myread
3906                                 dflt=''
3907                                 case "$ans" in
3908                                 y*) type='';;
3909                                 *) echo " ";;
3910                                 esac
3911                                 ;;
3912                         esac
3913                         ;;
3914                 esac
3915                 ;;
3916         esac
3917 done
3918 cd UU
3919 ans="$value"
3920 rp="$orig_rp"
3921 dflt="$orig_dflt"
3922 rm -f getfile.ok
3923 test "X$gfpthkeep" != Xy && gfpth=""
3924 EOSC
3925
3926 : determine root of directory hierarchy where package will be installed.
3927 case "$prefix" in
3928 '')
3929         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3930         ;;
3931 *?/)
3932         dflt=`echo "$prefix" | sed 's/.$//'`
3933         ;;
3934 *)
3935         dflt="$prefix"
3936         ;;
3937 esac
3938 $cat <<EOM
3939
3940 By default, $package will be installed in $dflt/bin, manual pages
3941 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3942 installation directories. Typically this is something like /usr/local.
3943 If you wish to have binaries under /usr/bin but other parts of the
3944 installation under /usr/local, that's ok: you will be prompted
3945 separately for each of the installation directories, the prefix being
3946 only used to set the defaults.
3947
3948 EOM
3949 fn=d~
3950 rp='Installation prefix to use?'
3951 . ./getfile
3952 oldprefix=''
3953 case "$prefix" in
3954 '') ;;
3955 *)
3956         case "$ans" in
3957         "$prefix") ;;
3958         *) oldprefix="$prefix";;
3959         esac
3960         ;;
3961 esac
3962 prefix="$ans"
3963 prefixexp="$ansexp"
3964
3965 : allow them to override the AFS root
3966 case "$afsroot" in
3967 '')     afsroot=/afs ;;
3968 *)      afsroot=$afsroot ;;
3969 esac
3970
3971 : is AFS running?
3972 echo " "
3973 case "$afs" in
3974 $define|true)   afs=true ;;
3975 $undef|false)   afs=false ;;
3976 *)      if $test -d $afsroot; then
3977                 afs=true
3978         else
3979                 afs=false
3980         fi
3981         ;;
3982 esac
3983 if $afs; then
3984         echo "AFS may be running... I'll be extra cautious then..." >&4
3985 else
3986         echo "AFS does not seem to be running..." >&4
3987 fi
3988
3989 : determine installation prefix for where package is to be installed.
3990 if $afs; then 
3991 $cat <<EOM
3992
3993 Since you are running AFS, I need to distinguish the directory in which
3994 files will reside from the directory in which they are installed (and from
3995 which they are presumably copied to the former directory by occult means).
3996
3997 EOM
3998         case "$installprefix" in
3999         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4000         *) dflt="$installprefix";;
4001         esac
4002 else
4003 $cat <<EOM
4004
4005 In some special cases, particularly when building $package for distribution,
4006 it is convenient to distinguish the directory in which files should be
4007 installed from the directory ($prefix) in which they will
4008 eventually reside.  For most users, these two directories are the same.
4009
4010 EOM
4011         case "$installprefix" in
4012         '') dflt=$prefix ;;
4013         *) dflt=$installprefix;;
4014         esac
4015 fi
4016 fn=d~
4017 rp='What installation prefix should I use for installing files?'
4018 . ./getfile
4019 installprefix="$ans"
4020 installprefixexp="$ansexp"
4021
4022 : Perform the prefixexp/installprefixexp correction if necessary
4023 cat <<EOS >installprefix
4024 $startsh
4025 EOS
4026 cat <<'EOSC' >>installprefix
4027 : Change installation prefix, if necessary.
4028 if $test X"$prefix" != X"$installprefix"; then
4029     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4030 else
4031     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4032 fi
4033 EOSC
4034 chmod +x installprefix
4035 $eunicefix installprefix
4036
4037 : Set variables such as privlib and privlibexp from the output of ./getfile
4038 : performing the prefixexp/installprefixexp correction if necessary.
4039 cat <<EOS >setprefixvar
4040 $startsh
4041 EOS
4042 cat <<'EOSC' >>setprefixvar
4043 eval "${prefixvar}=\"\$ans\""
4044 eval "${prefixvar}exp=\"\$ansexp\""
4045 . ./installprefix
4046 EOSC
4047 chmod +x setprefixvar
4048 $eunicefix setprefixvar
4049
4050 : set up the script used to warn in case of inconsistency
4051 cat <<EOS >whoa
4052 $startsh
4053 EOS
4054 cat <<'EOSC' >>whoa
4055 dflt=y
4056 case "$hint" in
4057     recommended)
4058         case "$hintfile" in
4059         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4060                 ;;
4061         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4062                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4063                 ;;
4064         esac
4065         ;;
4066     *)  echo " "
4067         echo "*** WHOA THERE!!! ***" >&4
4068         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4069         ;;
4070 esac
4071 rp="    Keep the $hint value?"
4072 . ./myread
4073 case "$ans" in
4074 y) td=$was; tu=$was;;
4075 esac
4076 EOSC
4077
4078 : function used to set '$1' to '$val'
4079 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4080 case "$val$was" in
4081 $define$undef) . ./whoa; eval "$var=\$td";;
4082 $undef$define) . ./whoa; eval "$var=\$tu";;
4083 *) eval "$var=$val";;
4084 esac'
4085
4086 : get the patchlevel
4087 echo " "
4088 echo "Getting the current patchlevel..." >&4
4089 if $test -r $rsrc/patchlevel.h;then
4090         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4091         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4092         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4093         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4094         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4095         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4096         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4097 else
4098         revision=0
4099         patchlevel=0
4100         subversion=0
4101         api_revision=0
4102         api_version=0
4103         api_subversion=0
4104         perl_patchlevel=0
4105         $echo "(You do not have patchlevel.h.  Eek.)"
4106 fi
4107 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4108 version_patchlevel_string="version $patchlevel subversion $subversion"
4109 case "$perl_patchlevel" in
4110 0|'') ;;
4111 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4112     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4113     ;;
4114 esac
4115
4116 $echo "(You have $package $version_patchlevel_string.)"
4117
4118 case "$osname" in
4119 dos|vms)
4120         : XXX Should be a Configure test for double-dots in filenames.
4121         version=`echo $revision $patchlevel $subversion | \
4122                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4123         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4124                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4125         ;;
4126 *)
4127         version=`echo $revision $patchlevel $subversion | \
4128                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4129         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4130                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4131         ;;
4132 esac
4133 : Special case the 5.005_xx maintenance series, which used 5.005
4134 : without any subversion label as a subdirectory in $sitelib
4135 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4136         api_versionstring='5.005'
4137 fi
4138
4139 : Do we want threads support and if so, what type
4140 case "$usethreads" in
4141 $define|true|[yY]*)     dflt='y';;
4142 *)     # Catch case where user specified ithreads or 5005threads but
4143        # forgot -Dusethreads (A.D. 4/2002)
4144        case "$useithreads$use5005threads" in
4145        *$define*)       dflt='y';;
4146        *)               dflt='n';;
4147        esac
4148        ;;
4149 esac
4150 cat <<EOM
4151
4152 Perl can be built to take advantage of threads on some systems.
4153 To do so, Configure can be run with -Dusethreads.
4154
4155 Note that Perl built with threading support runs slightly slower
4156 and uses more memory than plain Perl. The current implementation
4157 is believed to be stable, but it is fairly new, and so should be
4158 treated with caution.
4159
4160 If this doesn't make any sense to you, just accept the default '$dflt'.
4161 EOM
4162 rp='Build a threading Perl?'
4163 . ./myread
4164 case "$ans" in
4165 y|Y)    val="$define" ;;
4166 *)      val="$undef" ;;
4167 esac
4168 set usethreads
4169 eval $setvar
4170
4171 if $test $patchlevel -lt 9; then
4172     case "$usethreads" in
4173     $define)
4174         $cat <<EOM
4175
4176 Since release 5.6, Perl has had two different threading implementations,
4177 the newer interpreter-based version (ithreads) with one interpreter per
4178 thread, and the older 5.005 version (5005threads).
4179 The 5005threads version is effectively unmaintained and will probably be
4180 removed in Perl 5.10, so there should be no need to build a Perl using it
4181 unless needed for backwards compatibility with some existing 5.005threads
4182 code.
4183
4184 EOM
4185         : Default to ithreads unless overridden on command line or with
4186         : old config.sh
4187         dflt='y'
4188         case "$use5005threads" in
4189                 $define|true|[yY]*) dflt='n';;
4190         esac
4191         case "$useithreads" in
4192                 $undef|false|[nN]*) dflt='n';;
4193         esac
4194         rp='Use the newer interpreter-based ithreads?'
4195         . ./myread
4196         case "$ans" in
4197         y|Y)    val="$define" ;;
4198         *)      val="$undef" ;;
4199         esac
4200         set useithreads
4201         eval $setvar
4202         : Now set use5005threads to the opposite value.
4203         case "$useithreads" in
4204         $define) val="$undef" ;;
4205         *) val="$define" ;;
4206         esac
4207         set use5005threads
4208         eval $setvar
4209         ;;
4210     *)
4211         useithreads="$undef"
4212         use5005threads="$undef"
4213         ;;
4214     esac
4215
4216     case "$useithreads$use5005threads" in
4217     "$define$define")
4218         $cat >&4 <<EOM
4219
4220 You cannot have both the ithreads and the 5.005 threads enabled
4221 at the same time.  Disabling the 5.005 threads since they are
4222 much less stable than the ithreads.
4223
4224 EOM
4225         use5005threads="$undef"
4226         ;;
4227     esac
4228
4229 else
4230 : perl-5.9.x and later
4231
4232     if test X"$usethreads" = "X$define"; then
4233         case "$use5005threads" in
4234             $define|true|[yY]*)
4235                 $cat >&4 <<EOM
4236
4237 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4238
4239 EOM
4240             ;;
4241         esac
4242     fi
4243
4244     use5005threads="$undef"
4245     useithreads="$usethreads"
4246 fi
4247
4248 case "$d_oldpthreads" in
4249 '')     : Configure tests would be welcome here.  For now, assume undef.
4250         val="$undef" ;;
4251 *)      val="$d_oldpthreads" ;;
4252 esac
4253 set d_oldpthreads
4254 eval $setvar
4255
4256
4257 : Look for a hint-file generated 'call-back-unit'.  If the
4258 : user has specified that a threading perl is to be built,
4259 : we may need to set or change some other defaults.
4260 if $test -f usethreads.cbu; then
4261     echo "Your platform has some specific hints regarding threaded builds, using them..."
4262     . ./usethreads.cbu
4263 else
4264     case "$usethreads" in
4265         "$define"|true|[yY]*)
4266                 $cat <<EOM
4267 (Your platform does not have any specific hints for threaded builds.
4268  Assuming POSIX threads, then.)
4269 EOM
4270         ;;
4271     esac
4272 fi
4273
4274 : Check if multiplicity is required
4275 cat <<EOM
4276
4277 Perl can be built so that multiple Perl interpreters can coexist
4278 within the same Perl executable.
4279 EOM
4280
4281 case "$useithreads" in
4282 $define)
4283         cat <<EOM
4284 This multiple interpreter support is required for interpreter-based threads.
4285 EOM
4286         val="$define"
4287         ;;
4288 *)      case "$usemultiplicity" in
4289         $define|true|[yY]*)     dflt='y';;
4290         *) dflt='n';;
4291         esac
4292         echo " "
4293         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4294         rp='Build Perl for multiplicity?'
4295         . ./myread
4296         case "$ans" in
4297         y|Y)    val="$define" ;;
4298         *)      val="$undef" ;;
4299         esac
4300         ;;
4301 esac
4302 set usemultiplicity
4303 eval $setvar
4304
4305 : Check if morebits is requested
4306 case "$usemorebits" in
4307 "$define"|true|[yY]*)
4308         use64bitint="$define"
4309         uselongdouble="$define"
4310         usemorebits="$define"
4311         ;;
4312 *)      usemorebits="$undef"
4313         ;;
4314 esac
4315
4316 : Determine the C compiler to be used
4317 echo " "
4318 case "$cc" in
4319 '') dflt=cc;;
4320 *) dflt="$cc";;
4321 esac
4322 rp="Use which C compiler?"
4323 . ./myread
4324 cc="$ans"
4325
4326 : See whether they have no cc but they do have gcc
4327 . ./trygcc
4328 if $test -f cc.cbu; then
4329     . ./cc.cbu
4330 fi
4331 . ./checkcc
4332
4333 : make some quick guesses about what we are up against
4334 echo " "
4335 $echo $n "Hmm...  $c"
4336 echo exit 1 >bsd
4337 echo exit 1 >usg
4338 echo exit 1 >v7
4339 echo exit 1 >osf1
4340 echo exit 1 >eunice
4341 echo exit 1 >xenix
4342 echo exit 1 >venix
4343 echo exit 1 >os2
4344 d_bsd="$undef"
4345 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4346 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4347 then
4348         echo "Looks kind of like an OSF/1 system, but we'll see..."
4349         echo exit 0 >osf1
4350 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4351         xxx=`./loc addbib blurfl $pth`
4352         if $test -f $xxx; then
4353         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4354                 echo exit 0 >bsd
4355                 echo exit 0 >usg
4356         else
4357                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4358                         echo "Looks kind of like an extended USG system, but we'll see..."
4359                 else
4360                         echo "Looks kind of like a USG system, but we'll see..."
4361                 fi
4362                 echo exit 0 >usg
4363         fi
4364 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4365         echo "Looks kind of like a BSD system, but we'll see..."
4366         d_bsd="$define"
4367         echo exit 0 >bsd
4368 else
4369         echo "Looks kind of like a Version 7 system, but we'll see..."
4370         echo exit 0 >v7
4371 fi
4372 case "$eunicefix" in
4373 *unixtovms*)
4374         $cat <<'EOI'
4375 There is, however, a strange, musty smell in the air that reminds me of
4376 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4377 EOI
4378         echo exit 0 >eunice
4379         d_eunice="$define"
4380 : it so happens the Eunice I know will not run shell scripts in Unix format
4381         ;;
4382 *)
4383         echo " "
4384         echo "Congratulations.  You aren't running Eunice."
4385         d_eunice="$undef"
4386         ;;
4387 esac
4388 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4389 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4390 : semicolon as a patch separator
4391 case "$p_" in
4392 :) ;;
4393 *)
4394         $cat <<'EOI'
4395 I have the feeling something is not exactly right, however...don't tell me...
4396 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4397 (Or you may be running DOS with DJGPP.)
4398 EOI
4399         echo exit 0 >os2
4400         ;;
4401 esac
4402 if test -f /xenix; then
4403         echo "Actually, this looks more like a XENIX system..."
4404         echo exit 0 >xenix
4405         d_xenix="$define"
4406 else
4407         echo " "
4408         echo "It's not Xenix..."
4409         d_xenix="$undef"
4410 fi
4411 chmod +x xenix
4412 $eunicefix xenix
4413 if test -f /venix; then
4414         echo "Actually, this looks more like a VENIX system..."
4415         echo exit 0 >venix
4416 else
4417         echo " "
4418         if ./xenix; then
4419                 : null
4420         else
4421                 echo "Nor is it Venix..."
4422         fi
4423 fi
4424 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4425 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4426 $rm -f foo
4427
4428 : Check if we are using GNU gcc and what its version is
4429 echo " "
4430 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4431 $cat >try.c <<EOM
4432 #include <stdio.h>
4433 int main() {
4434 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4435 #ifdef __VERSION__
4436         printf("%s\n", __VERSION__);
4437 #else
4438         printf("%s\n", "1");
4439 #endif
4440 #endif
4441         return(0);
4442 }
4443 EOM
4444 if $cc -o try $ccflags $ldflags try.c; then
4445         gccversion=`$run ./try`
4446         case "$gccversion" in
4447         '') echo "You are not using GNU cc." ;;
4448         *)  echo "You are using GNU cc $gccversion."
4449             ccname=gcc
4450             ;;
4451         esac
4452 else
4453         echo " "
4454         echo "*** WHOA THERE!!! ***" >&4
4455         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4456         case "$knowitall" in
4457         '')
4458         echo "    You'd better start hunting for one and let me know about it." >&4
4459                 exit 1
4460                 ;;
4461         esac
4462 fi
4463 $rm -f try try.*
4464 case "$gccversion" in
4465 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4466 esac
4467 case "$gccversion" in
4468 '') gccosandvers='' ;;
4469 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4470    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4471    gccshortvers=''
4472    case "$gccosandvers" in
4473    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4474    $osname$osvers) ;; # looking good
4475    $osname*) cat <<EOM >&4
4476
4477 *** WHOA THERE!!! ***
4478
4479     Your gcc has not been compiled for the exact release of
4480     your operating system ($gccosandvers versus $osname$osvers).
4481
4482     In general it is a good idea to keep gcc synchronized with
4483     the operating system because otherwise serious problems
4484     may ensue when trying to compile software, like Perl.
4485
4486     I'm trying to be optimistic here, though, and will continue.
4487     If later during the configuration and build icky compilation
4488     problems appear (headerfile conflicts being the most common
4489     manifestation), I suggest reinstalling the gcc to match
4490     your operating system release.
4491
4492 EOM
4493       ;;
4494    *) gccosandvers='' ;; # failed to parse, better be silent
4495    esac
4496    ;;
4497 esac
4498 case "$ccname" in
4499 '') ccname="$cc" ;;
4500 esac
4501
4502 # gcc 3.* complain about adding -Idirectories that they already know about,
4503 # so we will take those off from locincpth.
4504 case "$gccversion" in
4505 3*)
4506     echo "main(){}">try.c
4507     for incdir in $locincpth; do
4508        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4509              grep '^c[cp]p*[01]: warning: changing search order '`
4510        if test "X$warn" != X; then
4511            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4512        fi
4513     done
4514     $rm -f try try.*
4515 esac
4516
4517 : What should the include directory be ?
4518 echo " "
4519 $echo $n "Hmm...  $c"
4520 dflt='/usr/include'
4521 incpath=''
4522 mips_type=''
4523 if $test -f /bin/mips && /bin/mips; then
4524         echo "Looks like a MIPS system..."
4525         $cat >usr.c <<'EOCP'
4526 #ifdef SYSTYPE_BSD43
4527 /bsd43
4528 #endif
4529 EOCP
4530         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4531                 dflt='/bsd43/usr/include'
4532                 incpath='/bsd43'
4533                 mips_type='BSD 4.3'
4534         else
4535                 mips_type='System V'
4536         fi
4537         $rm -f usr.c usr.out
4538         echo "and you're compiling with the $mips_type compiler and libraries."
4539         xxx_prompt=y
4540         echo "exit 0" >mips
4541 else
4542         echo "Doesn't look like a MIPS system."
4543         xxx_prompt=n
4544         echo "exit 1" >mips
4545 fi
4546 chmod +x mips
4547 $eunicefix mips
4548 case "$usrinc" in
4549 '') ;;
4550 *) dflt="$usrinc";;
4551 esac
4552 case "$xxx_prompt" in
4553 y)      fn=d/
4554         echo " "
4555         rp='Where are the include files you want to use?'
4556         . ./getfile
4557         usrinc="$ans"
4558         ;;
4559 *)      usrinc="$dflt"
4560         ;;
4561 esac
4562
4563 : see how we invoke the C preprocessor
4564 echo " "
4565 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4566 cat <<'EOT' >testcpp.c
4567 #define ABC abc
4568 #define XYZ xyz
4569 ABC.XYZ
4570 EOT
4571 cd ..
4572 if test ! -f cppstdin; then
4573         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4574                 # AIX cc -E doesn't show the absolute headerfile
4575                 # locations but we'll cheat by using the -M flag.
4576                 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
4577         else
4578                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4579         fi
4580 else
4581         echo "Keeping your $hint cppstdin wrapper."
4582 fi
4583 chmod 755 cppstdin
4584 wrapper=`pwd`/cppstdin
4585 ok='false'
4586 cd UU
4587
4588 if $test "X$cppstdin" != "X" && \
4589         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4590         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4591 then
4592         echo "You used to use $cppstdin $cppminus so we'll use that again."
4593         case "$cpprun" in
4594         '') echo "But let's see if we can live without a wrapper..." ;;
4595         *)
4596                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4597                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4598                 then
4599                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4600                         ok='true'
4601                 else
4602                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4603                 fi
4604                 ;;
4605         esac
4606 else
4607         case "$cppstdin" in
4608         '') ;;
4609         *)
4610                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4611                 ;;
4612         esac
4613 fi
4614
4615 if $ok; then
4616         : nothing
4617 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4618         $cc -E <testcpp.c >testcpp.out 2>&1; \
4619         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4620         echo "Yup, it does."
4621         x_cpp="$cc -E"
4622         x_minus='';
4623 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4624         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4625         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4626         echo "Yup, it does."
4627         x_cpp="$cc -E"
4628         x_minus='-';
4629 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4630         $cc -P <testcpp.c >testcpp.out 2>&1; \
4631         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4632         echo "Yipee, that works!"
4633         x_cpp="$cc -P"
4634         x_minus='';
4635 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4636         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4637         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4638         echo "At long last!"
4639         x_cpp="$cc -P"
4640         x_minus='-';
4641 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4642         $cpp <testcpp.c >testcpp.out 2>&1; \
4643         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4644         echo "It works!"
4645         x_cpp="$cpp"
4646         x_minus='';
4647 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4648         $cpp - <testcpp.c >testcpp.out 2>&1; \
4649         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4650         echo "Hooray, it works!  I was beginning to wonder."
4651         x_cpp="$cpp"
4652         x_minus='-';
4653 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4654         $wrapper <testcpp.c >testcpp.out 2>&1; \
4655         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4656         x_cpp="$wrapper"
4657         x_minus=''
4658         echo "Eureka!"
4659 else
4660         dflt=''
4661         rp="No dice.  I can't find a C preprocessor.  Name one:"
4662         . ./myread
4663         x_cpp="$ans"
4664         x_minus=''
4665         $x_cpp <testcpp.c >testcpp.out 2>&1
4666         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4667                 echo "OK, that will do." >&4
4668         else
4669 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4670                 exit 1
4671         fi
4672 fi
4673
4674 case "$ok" in
4675 false)
4676         cppstdin="$x_cpp"
4677         cppminus="$x_minus"
4678         cpprun="$x_cpp"
4679         cpplast="$x_minus"
4680         set X $x_cpp
4681         shift
4682         case "$1" in
4683         "$cpp")
4684                 echo "Perhaps can we force $cc -E using a wrapper..."
4685                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4686                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4687                 then
4688                         echo "Yup, we can."
4689                         cppstdin="$wrapper"
4690                         cppminus='';
4691                 else
4692                         echo "Nope, we'll have to live without it..."
4693                 fi
4694                 ;;
4695         esac
4696         case "$cpprun" in
4697         "$wrapper")
4698                 cpprun=''
4699                 cpplast=''
4700                 ;;
4701         esac
4702         ;;
4703 esac
4704
4705 case "$cppstdin" in
4706 "$wrapper"|'cppstdin') ;;
4707 *) $rm -f $wrapper;;
4708 esac
4709 $rm -f testcpp.c testcpp.out
4710
4711 : Set private lib path
4712 case "$plibpth" in
4713 '') if ./mips; then
4714                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4715         fi;;
4716 esac
4717 case "$libpth" in
4718 ' ') dlist='';;
4719 '') dlist="$loclibpth $plibpth $glibpth";;
4720 *) dlist="$libpth";;
4721 esac
4722
4723 : Now check and see which directories actually exist, avoiding duplicates
4724 libpth=''
4725 for xxx in $dlist
4726 do
4727     if $test -d $xxx; then
4728                 case " $libpth " in
4729                 *" $xxx "*) ;;
4730                 *) libpth="$libpth $xxx";;
4731                 esac
4732     fi
4733 done
4734 $cat <<'EOM'
4735
4736 Some systems have incompatible or broken versions of libraries.  Among
4737 the directories listed in the question below, please remove any you
4738 know not to be holding relevant libraries, and add any that are needed.
4739 Say "none" for none.
4740
4741 EOM
4742 case "$libpth" in
4743 '') dflt='none';;
4744 *)
4745         set X $libpth
4746         shift
4747         dflt=${1+"$@"}
4748         ;;
4749 esac
4750 rp="Directories to use for library searches?"
4751 . ./myread
4752 case "$ans" in
4753 none) libpth=' ';;
4754 *) libpth="$ans";;
4755 esac
4756
4757 : compute shared library extension
4758 case "$so" in
4759 '')
4760         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4761                 dflt='sl'
4762         else
4763                 dflt='so'
4764         fi
4765         ;;
4766 *) dflt="$so";;
4767 esac
4768 $cat <<EOM
4769
4770 On some systems, shared libraries may be available.  Answer 'none' if
4771 you want to suppress searching of shared libraries for the remainder
4772 of this configuration.
4773
4774 EOM
4775 rp='What is the file extension used for shared libraries?'
4776 . ./myread
4777 so="$ans"
4778
4779 : Define several unixisms.
4780 : Hints files or command line option can be used to override them.
4781 : The convoluted testing is in case hints files set either the old
4782 : or the new name.
4783 case "$_exe" in
4784 '')     case "$exe_ext" in
4785         '')     ;;
4786         *)      _exe="$exe_ext" ;;
4787         esac
4788         ;;
4789 esac
4790 case "$_a" in
4791 '')     case "$lib_ext" in
4792     '') _a='.a';;
4793         *)      _a="$lib_ext" ;;
4794         esac
4795         ;;
4796 esac
4797 case "$_o" in
4798 '') case "$obj_ext" in
4799         '')     _o='.o';;
4800         *)      _o="$obj_ext";;
4801         esac
4802         ;;
4803 esac
4804 case "$p_" in
4805 '') case "$path_sep" in
4806         '')     p_=':';;
4807         *)      p_="$path_sep";;
4808         esac
4809         ;;
4810 esac
4811 exe_ext=$_exe
4812 lib_ext=$_a
4813 obj_ext=$_o
4814 path_sep=$p_
4815
4816 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4817
4818 : Which makefile gets called first.  This is used by make depend.
4819 case "$firstmakefile" in
4820 '') firstmakefile='makefile';;
4821 esac
4822
4823 : Check is we will use socks
4824 case "$usesocks" in
4825 $define|true|[yY]*)     dflt='y';;
4826 *) dflt='n';;
4827 esac
4828 cat <<EOM
4829
4830 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4831 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4832 to use the PerlIO abstraction layer, this will be implicitly selected.
4833
4834 If this doesn't make any sense to you, just accept the default '$dflt'.
4835 EOM
4836 rp='Build Perl for SOCKS?'
4837 . ./myread
4838 case "$ans" in
4839 y|Y)    val="$define" ;;
4840 *)      val="$undef" ;;
4841 esac
4842 set usesocks
4843 eval $setvar
4844
4845 : Check for uselongdouble support
4846 case "$ccflags" in
4847 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4848 esac
4849
4850 case "$uselongdouble" in
4851 $define|true|[yY]*)     dflt='y';;
4852 *) dflt='n';;
4853 esac
4854 cat <<EOM
4855
4856 Perl can be built to take advantage of long doubles which
4857 (if available) may give more accuracy and range for floating point numbers.
4858
4859 If this doesn't make any sense to you, just accept the default '$dflt'.
4860 EOM
4861 rp='Try to use long doubles if available?'
4862 . ./myread
4863 case "$ans" in
4864 y|Y)    val="$define"   ;;
4865 *)      val="$undef"    ;;
4866 esac
4867 set uselongdouble
4868 eval $setvar
4869
4870 case "$uselongdouble" in
4871 true|[yY]*) uselongdouble="$define" ;;
4872 esac
4873
4874 : Look for a hint-file generated 'call-back-unit'.  If the
4875 : user has specified that long doubles should be used,
4876 : we may need to set or change some other defaults.
4877 if $test -f uselongdouble.cbu; then
4878     echo "Your platform has some specific hints regarding long doubles, using them..."
4879     . ./uselongdouble.cbu
4880 else
4881     case "$uselongdouble" in
4882         $define)
4883                 $cat <<EOM
4884 (Your platform does not have any specific hints for long doubles.)
4885 EOM
4886         ;;
4887     esac
4888 fi
4889
4890 : Looking for optional libraries
4891 echo " "
4892 echo "Checking for optional libraries..." >&4
4893 case "$libs" in
4894 ' '|'') dflt='';;
4895 *) dflt="$libs";;
4896 esac
4897 case "$libswanted" in
4898 '') libswanted='c_s';;
4899 esac
4900 case "$usesocks" in
4901 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4902 esac
4903 libsfound=''
4904 libsfiles=''
4905 libsdirs=''
4906 libspath=''
4907 for thisdir in $libpth $xlibpth; do
4908   test -d $thisdir && libspath="$libspath $thisdir"
4909 done
4910 for thislib in $libswanted; do
4911         for thisdir in $libspath; do
4912             xxx=''
4913             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4914                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4915                 $test -f "$xxx" && eval $libscheck
4916                 $test -f "$xxx" && libstyle=shared
4917             fi
4918             if test ! -f "$xxx"; then
4919                 xxx=$thisdir/lib$thislib.$so
4920                 $test -f "$xxx" && eval $libscheck
4921                 $test -f "$xxx" && libstyle=shared
4922             fi
4923             if test ! -f "$xxx"; then
4924                 xxx=$thisdir/lib$thislib$_a
4925                 $test -f "$xxx" && eval $libscheck
4926                 $test -f "$xxx" && libstyle=static
4927             fi
4928             if test ! -f "$xxx"; then
4929                 xxx=$thisdir/$thislib$_a
4930                 $test -f "$xxx" && eval $libscheck
4931                 $test -f "$xxx" && libstyle=static
4932             fi
4933             if test ! -f "$xxx"; then
4934                 xxx=$thisdir/lib${thislib}_s$_a
4935                 $test -f "$xxx" && eval $libscheck
4936                 $test -f "$xxx" && libstyle=static
4937                 $test -f "$xxx" && thislib=${thislib}_s
4938             fi
4939             if test ! -f "$xxx"; then
4940                 xxx=$thisdir/Slib$thislib$_a
4941                 $test -f "$xxx" && eval $libscheck
4942                 $test -f "$xxx" && libstyle=static
4943             fi
4944             if $test -f "$xxx"; then
4945                 case "$libstyle" in
4946                 shared) echo "Found -l$thislib (shared)." ;;
4947                 static) echo "Found -l$thislib." ;;
4948                 *)      echo "Found -l$thislib ($libstyle)." ;;
4949                 esac
4950                 case " $dflt " in
4951                 *"-l$thislib "*);;
4952                 *) dflt="$dflt -l$thislib"
4953                    libsfound="$libsfound $xxx"
4954                    yyy=`basename $xxx`
4955                    libsfiles="$libsfiles $yyy"
4956                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4957                    case " $libsdirs " in
4958                    *" $yyy "*) ;;
4959                    *) libsdirs="$libsdirs $yyy" ;;
4960                    esac
4961                    ;;
4962                 esac
4963                 break
4964             fi
4965         done
4966         if $test ! -f "$xxx"; then
4967             echo "No -l$thislib."
4968         fi
4969 done
4970 set X $dflt
4971 shift
4972 dflt="$*"
4973 case "$libs" in
4974 '') dflt="$dflt";;
4975 *) dflt="$libs";;
4976 esac
4977 case "$dflt" in
4978 ' '|'') dflt='none';;
4979 esac
4980
4981 $cat <<EOM
4982
4983 In order to compile $package on your machine, a number of libraries
4984 are usually needed.  Include any other special libraries here as well.
4985 Say "none" for none.  The default list is almost always right.
4986 EOM
4987
4988 echo " "
4989 rp="What libraries to use?"
4990 . ./myread
4991 case "$ans" in
4992 none) libs=' ';;
4993 *) libs="$ans";;
4994 esac
4995
4996 : determine optimization, if desired, or use for debug flag also
4997 case "$optimize" in
4998 ' '|$undef) dflt='none';;
4999 '') dflt='-O';;
5000 *) dflt="$optimize";;
5001 esac
5002 $cat <<EOH
5003
5004 By default, $package compiles with the -O flag to use the optimizer.
5005 Alternately, you might want to use the symbolic debugger, which uses
5006 the -g flag (on traditional Unix systems).  Either flag can be
5007 specified here.  To use neither flag, specify the word "none".
5008
5009 EOH
5010 rp="What optimizer/debugger flag should be used?"
5011 . ./myread
5012 optimize="$ans"
5013 case "$optimize" in
5014 'none') optimize=" ";;
5015 esac
5016
5017 : Check what DEBUGGING is required from the command line
5018 : -DEBUGGING      or -DDEBUGGING or
5019 : -DEBUGGING=both                       = -g + -DDEBUGGING
5020 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5021 : -DEBUGGING=none or -UDEBUGGING        =
5022 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5023 case "$EBUGGING" in
5024 '')     ;;
5025 *)      DEBUGGING=$EBUGGING ;;
5026 esac
5027
5028 case "$DEBUGGING" in
5029 -g|both|$define)
5030     case "$optimize" in
5031         *-g*) ;;
5032         *)    optimize="$optimize -g" ;;
5033     esac ;;
5034 none|$undef)
5035     case "$optimize" in
5036         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5037                 shift
5038                 optimize="$*"
5039                 ;;
5040     esac ;;
5041 esac
5042
5043 dflt=''
5044 case "$DEBUGGING" in
5045 both|$define) dflt='-DDEBUGGING'
5046 esac
5047
5048 : argument order is deliberate, as the flag will start with - which set could
5049 : think is an option
5050 checkccflag='check=$1; flag=$2; callback=$3;
5051 echo " ";
5052 echo "Checking if your compiler accepts $flag" 2>&1;
5053 echo "int main(void) { return 0; }" > gcctest.c;
5054 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5055     echo "Yes, it does." 2>&1;
5056     if $test -s gcctest.out ; then
5057         echo "But your platform does not like it:";
5058         cat gcctest.out;
5059     else
5060         case "$ccflags" in
5061         *$check*)
5062             echo "Leaving current flags $ccflags alone." 2>&1
5063             ;;
5064         *) dflt="$dflt $flag";
5065             eval $callback
5066             ;;
5067         esac
5068     fi
5069 else
5070     echo "Nope, it does not, but that is ok." 2>&1;
5071 fi
5072 '
5073
5074 : We will not override a previous value, but we might want to
5075 : augment a hint file
5076 case "$hint" in
5077 default|recommended)
5078         case "$gccversion" in
5079         1*) dflt="$dflt -fpcc-struct-return" ;;
5080         esac
5081         case "$optimize:$DEBUGGING" in
5082         *-g*:old) dflt="$dflt -DDEBUGGING";;
5083         esac
5084         case "$gccversion" in
5085         2*) if $test -d /etc/conf/kconfig.d &&
5086                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5087                 then
5088                         # Interactive Systems (ISC) POSIX mode.
5089                         dflt="$dflt -posix"
5090                 fi
5091                 ;;
5092         esac
5093         case "$gccversion" in
5094         1*) ;;
5095         2.[0-8]*) ;;
5096         ?*)     set strict-aliasing -fno-strict-aliasing
5097                 eval $checkccflag
5098                 ;;
5099         esac
5100         # For gcc, adding -pipe speeds up compilations for some, but apparently
5101         # some assemblers can't read from stdin.  (It also slows down compilations
5102         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5103         case "$gccversion" in
5104         ?*)     set pipe -pipe
5105                 eval $checkccflag
5106                 ;;
5107         esac
5108
5109         # on x86_64 (at least) we require an extra library (libssp) in the
5110         # link command line. This library is not named, so I infer that it is
5111         # an implementation detail that may change. Hence the safest approach
5112         # is to add the flag to the flags passed to the compiler at link time,
5113         # as that way the compiler can do the right implementation dependant
5114         # thing. (NWC)
5115         case "$gccversion" in
5116         ?*)     set stack-protector -fstack-protector
5117                 eval $checkccflag
5118                 ;;
5119         esac
5120         ;;
5121 esac
5122
5123 case "$mips_type" in
5124 *BSD*|'') inclwanted="$locincpth $usrinc";;
5125 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5126 esac
5127 for thisincl in $inclwanted; do
5128         if $test -d $thisincl; then
5129                 if $test x$thisincl != x$usrinc; then
5130                         case "$dflt" in
5131                         *" -I$thisincl "*);;
5132                         *) dflt="$dflt -I$thisincl ";;
5133                         esac
5134                 fi
5135         fi
5136 done
5137
5138 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5139         xxx=true;
5140 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5141         xxx=true;
5142 else
5143         xxx=false;
5144 fi;
5145 if $xxx; then
5146         case "$dflt" in
5147         *$2*);;
5148         *) dflt="$dflt -D$2";;
5149         esac;
5150 fi'
5151
5152 set signal.h LANGUAGE_C; eval $inctest
5153
5154 case "$usesocks" in
5155 $define)
5156         ccflags="$ccflags -DSOCKS"
5157         ;;
5158 esac
5159
5160 case "$hint" in
5161 default|recommended) dflt="$ccflags $dflt" ;;
5162 *) dflt="$ccflags";;
5163 esac
5164
5165 case "$dflt" in
5166 ''|' ') dflt=none;;
5167 esac
5168
5169 $cat <<EOH
5170
5171 Your C compiler may want other flags.  For this question you should include
5172 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5173 but you should NOT include libraries or ld flags like -lwhatever.  If you
5174 want $package to honor its debug switch, you should include -DDEBUGGING here.
5175 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5176
5177 To use no flags, specify the word "none".
5178
5179 EOH
5180 set X $dflt
5181 shift
5182 dflt=${1+"$@"}
5183 rp="Any additional cc flags?"
5184 . ./myread
5185 case "$ans" in
5186 none) ccflags='';;
5187 *) ccflags="$ans";;
5188 esac
5189
5190 : the following weeds options from ccflags that are of no interest to cpp
5191 case "$cppflags" in
5192 '') cppflags="$ccflags" ;;
5193 *)  cppflags="$cppflags $ccflags" ;;
5194 esac
5195 case "$gccversion" in
5196 1*) cppflags="$cppflags -D__GNUC__"
5197 esac
5198 case "$mips_type" in
5199 '');;
5200 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5201 esac
5202 case "$cppflags" in
5203 '');;
5204 *)
5205         echo " "
5206         echo "Let me guess what the preprocessor flags are..." >&4
5207         set X $cppflags
5208         shift
5209         cppflags=''
5210         $cat >cpp.c <<'EOM'
5211 #define BLURFL foo
5212
5213 BLURFL xx LFRULB
5214 EOM
5215         previous=''
5216         for flag in $*
5217         do
5218                 case "$flag" in
5219                 -*) ftry="$flag";;
5220                 *) ftry="$previous $flag";;
5221                 esac
5222                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5223                         >cpp1.out 2>/dev/null && \
5224                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5225                         >cpp2.out 2>/dev/null && \
5226                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5227                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5228                 then
5229                         cppflags="$cppflags $ftry"
5230                         previous=''
5231                 else
5232                         previous="$flag"
5233                 fi
5234         done
5235         set X $cppflags
5236         shift
5237         cppflags=${1+"$@"}
5238         case "$cppflags" in
5239         *-*)  echo "They appear to be: $cppflags";;
5240         esac
5241         $rm -f cpp.c cpp?.out
5242         ;;
5243 esac
5244
5245 : flags used in final linking phase
5246 case "$ldflags" in
5247 '') if ./venix; then
5248                 dflt='-i -z'
5249         else
5250                 dflt=''
5251         fi
5252         case "$ccflags" in
5253         *-posix*) dflt="$dflt -posix" ;;
5254         esac
5255         ;;
5256 *) dflt="$ldflags";;
5257 esac
5258 # See note above about -fstack-protector
5259 case "$ccflags" in
5260 *-fstack-protector*) 
5261         case "$dflt" in
5262         *-fstack-protector*) ;; # Don't add it again
5263         *) dflt="$dflt -fstack-protector" ;; 
5264         esac
5265         ;;
5266 esac
5267
5268 : Try to guess additional flags to pick up local libraries.
5269 for thislibdir in $libpth; do
5270         case " $loclibpth " in
5271         *" $thislibdir "*)
5272                 case "$dflt " in
5273                 *"-L$thislibdir "*) ;;
5274                 *)  dflt="$dflt -L$thislibdir" ;;
5275                 esac
5276                 ;;
5277         esac
5278 done
5279
5280 case "$dflt" in
5281 '') dflt='none' ;;
5282 esac
5283
5284 $cat <<EOH
5285
5286 Your C linker may need flags.  For this question you should
5287 include -L/whatever and any other flags used by the C linker, but you
5288 should NOT include libraries like -lwhatever.
5289
5290 Make sure you include the appropriate -L/path flags if your C linker
5291 does not normally search all of the directories you specified above,
5292 namely
5293         $libpth
5294 To use no flags, specify the word "none".
5295
5296 EOH
5297
5298 rp="Any additional ld flags (NOT including libraries)?"
5299 . ./myread
5300 case "$ans" in
5301 none) ldflags='';;
5302 *) ldflags="$ans";;
5303 esac
5304 rmlist="$rmlist pdp11"
5305
5306 : coherency check
5307 echo " "
5308 echo "Checking your choice of C compiler and flags for coherency..." >&4
5309 $cat > try.c <<'EOF'
5310 #include <stdio.h>
5311 int main() { printf("Ok\n"); return(0); }
5312 EOF
5313 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5314 shift
5315 $cat >try.msg <<'EOM'
5316 I've tried to compile and run the following simple program:
5317
5318 EOM
5319 $cat try.c >> try.msg
5320
5321 $cat >> try.msg <<EOM
5322
5323 I used the command:
5324
5325         $*
5326         $run ./try
5327
5328 and I got the following output:
5329
5330 EOM
5331 dflt=y
5332 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5333         if $sh -c "$run ./try " >>try.msg 2>&1; then
5334                 xxx=`$run ./try`
5335                 case "$xxx" in
5336                 "Ok") dflt=n ;;
5337                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5338                         case " $libs " in
5339                         *" -lsfio "*)
5340                                 cat >> try.msg <<'EOQS'
5341 If $libs contains -lsfio, and sfio is mis-configured, then it
5342 sometimes (apparently) runs and exits with a 0 status, but with no
5343 output!  It may have to do with sfio's use of _exit vs. exit.
5344
5345 EOQS
5346                                 rp="You have a big problem.  Shall I abort Configure"
5347                                 dflt=y
5348                                 ;;
5349                         esac
5350                         ;;
5351                 esac
5352         else
5353                 echo "The program compiled OK, but exited with status $?." >>try.msg
5354                 rp="You have a problem.  Shall I abort Configure"
5355                 dflt=y
5356         fi
5357 else
5358         echo "I can't compile the test program." >>try.msg
5359         rp="You have a BIG problem.  Shall I abort Configure"
5360         dflt=y
5361 fi
5362 case "$dflt" in
5363 y)
5364         $cat try.msg >&4
5365         case "$knowitall" in
5366         '')
5367                 echo "(The supplied flags or libraries might be incorrect.)"
5368                 ;;
5369         *) dflt=n;;
5370         esac
5371         echo " "
5372         . ./myread
5373         case "$ans" in
5374         n*|N*) ;;
5375         *)      echo "Ok.  Stopping Configure." >&4
5376                 exit 1
5377                 ;;
5378         esac
5379         ;;
5380 n) echo "OK, that should do.";;
5381 esac
5382 $rm_try gcctest gcctest.out
5383
5384 : define a shorthand compile call
5385 compile='
5386 mc_file=$1;
5387 shift;
5388 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5389 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5390 exit 1;
5391 fi;
5392 esac;
5393 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5394 : define a shorthand compile call for compilations that should be ok.
5395 compile_ok='
5396 mc_file=$1;
5397 shift;
5398 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5399
5400 : determine filename position in cpp output
5401 echo " "
5402 echo "Computing filename position in cpp output for #include directives..." >&4
5403 case "$osname" in
5404 vos) testaccess=-e ;;
5405 *)   testaccess=-r ;;
5406 esac
5407 echo '#include <stdio.h>' > foo.c
5408 $cat >fieldn <<EOF
5409 $startsh
5410 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5411 $grep '^[       ]*#.*stdio\.h' | \
5412 while read cline; do
5413         pos=1
5414         set \$cline
5415         while $test \$# -gt 0; do
5416                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5417                         echo "\$pos"
5418                         exit 0
5419                 fi
5420                 shift
5421                 pos=\`expr \$pos + 1\`
5422         done
5423 done
5424 EOF
5425 chmod +x fieldn
5426 fieldn=`./fieldn`
5427 $rm -f foo.c fieldn
5428 case $fieldn in
5429 '') pos='???';;
5430 1) pos=first;;
5431 2) pos=second;;
5432 3) pos=third;;
5433 *) pos="${fieldn}th";;
5434 esac
5435 echo "Your cpp writes the filename in the $pos field of the line."
5436
5437 case "$osname" in
5438 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5439 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5440 *)   cppfilter='' ;;
5441 esac
5442 : locate header file
5443 $cat >findhdr <<EOF
5444 $startsh
5445 wanted=\$1
5446 name=''
5447 for usrincdir in $usrinc
5448 do
5449         if test -f \$usrincdir/\$wanted; then
5450                 echo "\$usrincdir/\$wanted"
5451                 exit 0
5452         fi
5453 done
5454 awkprg='{ print \$$fieldn }'
5455 echo "#include <\$wanted>" > foo\$\$.c
5456 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5457 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5458 while read cline; do
5459         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5460         case "\$name" in
5461         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5462         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5463         *) exit 2;;
5464         esac;
5465 done;
5466 #
5467 # status = 0: grep returned 0 lines, case statement not executed
5468 # status = 1: headerfile found
5469 # status = 2: while loop executed, no headerfile found
5470 #
5471 status=\$?
5472 $rm -f foo\$\$.c;
5473 if test \$status -eq 1; then
5474         exit 0;
5475 fi
5476 exit 1
5477 EOF
5478 chmod +x findhdr
5479
5480 : define an alternate in-header-list? function
5481 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5482 cont=true; xxf="echo \"<\$1> found.\" >&4";
5483 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5484 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5485 esac;
5486 case $# in 4) instead=instead;; *) instead="at last";; esac;
5487 while $test "$cont"; do
5488         xxx=`./findhdr $1`
5489         var=$2; eval "was=\$$2";
5490         if $test "$xxx" && $test -r "$xxx";
5491         then eval $xxf;
5492         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5493                 cont="";
5494         else eval $xxnf;
5495         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5496         set $yyy; shift; shift; yyy=$@;
5497         case $# in 0) cont="";;
5498         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5499                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5500         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5501                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5502         esac;
5503 done;
5504 while $test "$yyy";
5505 do set $yyy; var=$2; eval "was=\$$2";
5506         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5507         set $yyy; shift; shift; yyy=$@;
5508 done'
5509
5510 : see if stdlib is available
5511 set stdlib.h i_stdlib
5512 eval $inhdr
5513
5514 : check for lengths of integral types
5515 echo " "
5516 case "$intsize" in
5517 '')
5518         echo "Checking to see how big your integers are..." >&4
5519         $cat >try.c <<EOCP
5520 #include <stdio.h>
5521 #$i_stdlib I_STDLIB
5522 #ifdef I_STDLIB
5523 #include <stdlib.h>
5524 #endif
5525 int main()
5526 {
5527         printf("intsize=%d;\n", (int)sizeof(int));
5528         printf("longsize=%d;\n", (int)sizeof(long));
5529         printf("shortsize=%d;\n", (int)sizeof(short));
5530         exit(0);
5531 }
5532 EOCP
5533         set try
5534         if eval $compile_ok && $run ./try > /dev/null; then
5535                 eval `$run ./try`
5536                 echo "Your integers are $intsize bytes long."
5537                 echo "Your long integers are $longsize bytes long."
5538                 echo "Your short integers are $shortsize bytes long."
5539         else
5540                 $cat >&4 <<EOM
5541 !
5542 Help! I can't compile and run the intsize test program: please enlighten me!
5543 (This is probably a misconfiguration in your system or libraries, and
5544 you really ought to fix it.  Still, I'll try anyway.)
5545 !
5546 EOM
5547                 dflt=4
5548                 rp="What is the size of an integer (in bytes)?"
5549                 . ./myread
5550                 intsize="$ans"
5551                 dflt=$intsize
5552                 rp="What is the size of a long integer (in bytes)?"
5553                 . ./myread
5554                 longsize="$ans"
5555                 dflt=2
5556                 rp="What is the size of a short integer (in bytes)?"
5557                 . ./myread
5558                 shortsize="$ans"
5559         fi
5560         ;;
5561 esac
5562 $rm_try
5563
5564 : check for long long
5565 echo " "
5566 echo "Checking to see if you have long long..." >&4
5567 echo 'int main() { long long x = 7; return 0; }' > try.c
5568 set try
5569 if eval $compile; then
5570         val="$define"
5571         echo "You have long long."
5572 else
5573         val="$undef"
5574         echo "You do not have long long."
5575 fi
5576 $rm_try
5577 set d_longlong
5578 eval $setvar
5579
5580 : check for length of long long
5581 case "${d_longlong}${longlongsize}" in
5582 $define)
5583         echo " "
5584         echo "Checking to see how big your long longs are..." >&4
5585         $cat >try.c <<'EOCP'
5586 #include <stdio.h>
5587 int main()
5588 {
5589     printf("%d\n", (int)sizeof(long long));
5590     return(0);
5591 }
5592 EOCP
5593         set try
5594         if eval $compile_ok; then
5595                 longlongsize=`$run ./try`
5596                 echo "Your long longs are $longlongsize bytes long."
5597         else
5598                 dflt='8'
5599                 echo " "
5600                 echo "(I can't seem to compile the test program.  Guessing...)"
5601                 rp="What is the size of a long long (in bytes)?"
5602                 . ./myread
5603                 longlongsize="$ans"
5604         fi
5605         if $test "X$longsize" = "X$longlongsize"; then
5606                 echo "(That isn't any different from an ordinary long.)"
5607         fi
5608         ;;
5609 esac
5610 $rm_try
5611
5612 : see if inttypes.h is available
5613 : we want a real compile instead of Inhdr because some systems
5614 : have an inttypes.h which includes non-existent headers
5615 echo " "
5616 $cat >try.c <<EOCP
5617 #include <inttypes.h>
5618 int main() {
5619         static int32_t foo32 = 0x12345678;
5620 }
5621 EOCP
5622 set try
5623 if eval $compile; then
5624         echo "<inttypes.h> found." >&4
5625         val="$define"
5626 else
5627         echo "<inttypes.h> NOT found." >&4
5628         val="$undef"
5629 fi
5630 $rm_try
5631 set i_inttypes
5632 eval $setvar
5633
5634 : check for int64_t
5635 echo " "
5636 echo "Checking to see if you have int64_t..." >&4
5637 $cat >try.c <<EOCP
5638 #include <sys/types.h>
5639 #$i_inttypes I_INTTYPES
5640 #ifdef I_INTTYPES
5641 #include <inttypes.h>
5642 #endif
5643 int main() { int64_t x = 7; }
5644 EOCP
5645 set try
5646 if eval $compile; then
5647         val="$define"
5648         echo "You have int64_t."
5649 else
5650         val="$undef"
5651         echo "You do not have int64_t."
5652 fi
5653 $rm_try
5654 set d_int64_t
5655 eval $setvar
5656
5657 : Check if 64bit ints have a quad type
5658 echo " "
5659 echo "Checking which 64-bit integer type we could use..." >&4
5660
5661 case "$intsize" in
5662 8) val=int
5663    set quadtype
5664    eval $setvar
5665    val='"unsigned int"'
5666    set uquadtype
5667    eval $setvar
5668    quadkind=1
5669    ;;
5670 *) case "$longsize" in
5671    8) val=long
5672       set quadtype
5673       eval $setvar
5674       val='"unsigned long"'
5675       set uquadtype
5676       eval $setvar
5677       quadkind=2
5678       ;;
5679    *) case "$d_longlong:$longlongsize" in
5680       define:8)
5681         val='"long long"'
5682         set quadtype
5683         eval $setvar
5684         val='"unsigned long long"'
5685         set uquadtype
5686         eval $setvar
5687         quadkind=3
5688         ;;
5689       *) case "$d_int64_t" in
5690          define)
5691            val=int64_t
5692            set quadtype
5693            eval $setvar
5694            val=uint64_t
5695            set uquadtype
5696            eval $setvar
5697            quadkind=4
5698            ;;
5699          esac
5700          ;;
5701       esac
5702       ;;
5703    esac
5704    ;;
5705 esac
5706
5707 case "$quadtype" in
5708 '')     echo "Alas, no 64-bit integer types in sight." >&4
5709         d_quad="$undef"
5710         ;;
5711 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5712         d_quad="$define"
5713         ;;
5714 esac
5715
5716 : Do we want 64bit support
5717 case "$uselonglong" in
5718 "$define"|true|[yY]*)
5719         cat <<EOM >&4
5720
5721 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5722 EOM
5723         use64bitint="$define"
5724         ;;
5725 esac
5726 case "$use64bits" in
5727 "$define"|true|[yY]*)
5728         cat <<EOM >&4
5729
5730 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5731 EOM
5732         use64bitint="$define"
5733         ;;
5734 esac
5735 case "$use64bitints" in
5736 "$define"|true|[yY]*)
5737         cat <<EOM >&4
5738
5739 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5740 EOM
5741         use64bitint="$define"
5742         ;;
5743 esac
5744 case "$use64bitsint" in
5745 "$define"|true|[yY]*)
5746         cat <<EOM >&4
5747
5748 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5749 EOM
5750         use64bitint="$define"
5751         ;;
5752 esac
5753 case "$uselonglongs" in
5754 "$define"|true|[yY]*)
5755         cat <<EOM >&4
5756
5757 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5758 EOM
5759         use64bitint="$define"
5760         ;;
5761 esac
5762 case "$use64bitsall" in
5763 "$define"|true|[yY]*)
5764         cat <<EOM >&4
5765
5766 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5767 EOM
5768         use64bitall="$define"
5769         ;;
5770 esac
5771
5772 case "$ccflags" in
5773 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5774 esac
5775 case "$use64bitall" in
5776 "$define"|true|[yY]*) use64bitint="$define" ;;
5777 esac
5778
5779 case "$longsize" in
5780 8) cat <<EOM
5781
5782 You have natively 64-bit long integers.
5783 EOM
5784    val="$define"
5785    ;;
5786 *) case "$use64bitint" in
5787    "$define"|true|[yY]*) dflt='y';;
5788    *) dflt='n';;
5789    esac
5790    case "$d_quad" in
5791    "$define") ;;
5792    *) dflt='n' ;;
5793    esac
5794    cat <<EOM
5795
5796 Perl can be built to take advantage of 64-bit integer types
5797 on some systems.  To do so, Configure can be run with -Duse64bitint.
5798 Choosing this option will most probably introduce binary incompatibilities.
5799
5800 If this doesn't make any sense to you, just accept the default '$dflt'.
5801 (The default has been chosen based on your configuration.)
5802 EOM
5803    rp='Try to use 64-bit integers, if available?'
5804    . ./myread
5805    case "$ans" in
5806    [yY]*) val="$define" ;;
5807    *)     val="$undef"  ;;
5808    esac
5809    ;;
5810 esac
5811 set use64bitint
5812 eval $setvar
5813
5814 case "$use64bitall" in
5815 "$define"|true|[yY]*) dflt='y' ;;
5816 *) case "$longsize" in
5817    8) dflt='y' ;;
5818    *) dflt='n' ;;
5819    esac
5820    ;;
5821 esac
5822 cat <<EOM
5823
5824 You may also choose to try maximal 64-bitness.  It means using as much
5825 64-bitness as possible on the platform.  This in turn means even more
5826 binary incompatibilities.  On the other hand, your platform may not
5827 have any more 64-bitness available than what you already have chosen.
5828
5829 If this doesn't make any sense to you, just accept the default '$dflt'.
5830 (The default has been chosen based on your configuration.)
5831 EOM
5832 rp='Try to use maximal 64-bit support, if available?'
5833 . ./myread
5834 case "$ans" in
5835 [yY]*) val="$define" ;;
5836 *)     val="$undef"  ;;
5837 esac
5838 set use64bitall
5839 eval $setvar
5840 case "$use64bitall" in
5841 "$define")
5842         case "$use64bitint" in
5843         "$undef")
5844                 cat <<EOM
5845
5846 Since you have chosen a maximally 64-bit build, I'm also turning on
5847 the use of 64-bit integers.
5848 EOM
5849                 use64bitint="$define" ;;
5850         esac
5851         ;;
5852 esac
5853
5854 : Look for a hint-file generated 'call-back-unit'.  If the
5855 : user has specified that a 64-bit perl is to be built,
5856 : we may need to set or change some other defaults.
5857 if $test -f use64bitint.cbu; then
5858         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5859         . ./use64bitint.cbu
5860 fi
5861 case "$use64bitint" in
5862 "$define"|true|[yY]*)
5863         case "$longsize" in
5864         4) case "$archname64" in
5865            '') archname64=64int ;;
5866            esac
5867            ;;
5868         esac
5869         ;;
5870 esac
5871
5872 : Look for a hint-file generated 'call-back-unit'.  If the
5873 : user has specified that a maximally 64-bit perl is to be built,
5874 : we may need to set or change some other defaults.
5875 if $test -f use64bitall.cbu; then
5876         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5877         . ./use64bitall.cbu
5878 fi
5879 case "$use64bitall" in
5880 "$define"|true|[yY]*)
5881         case "$longsize" in
5882         4) case "$archname64" in
5883            ''|64int) archname64=64all ;;
5884            esac
5885            ;;
5886         esac
5887         ;;
5888 esac
5889
5890 case "$d_quad:$use64bitint" in
5891 $undef:$define)
5892         cat >&4 <<EOF
5893
5894 *** You have chosen to use 64-bit integers,
5895 *** but none can be found.
5896 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5897 *** Cannot continue, aborting.
5898
5899 EOF
5900         exit 1
5901         ;;
5902 esac
5903
5904 : check for length of double
5905 echo " "
5906 case "$doublesize" in
5907 '')
5908         echo "Checking to see how big your double precision numbers are..." >&4
5909         $cat >try.c <<EOCP
5910 #include <stdio.h>
5911 #$i_stdlib I_STDLIB
5912 #ifdef I_STDLIB
5913 #include <stdlib.h>
5914 #endif
5915 int main()
5916 {
5917     printf("%d\n", (int)sizeof(double));
5918     exit(0);
5919 }
5920 EOCP
5921         set try
5922         if eval $compile_ok; then
5923                 doublesize=`$run ./try`
5924                 echo "Your double is $doublesize bytes long."
5925         else
5926                 dflt='8'
5927                 echo "(I can't seem to compile the test program.  Guessing...)"
5928                 rp="What is the size of a double precision number (in bytes)?"
5929                 . ./myread
5930                 doublesize="$ans"
5931         fi
5932         ;;
5933 esac
5934 $rm_try
5935
5936 : check for long doubles
5937 echo " "
5938 echo "Checking to see if you have long double..." >&4
5939 echo 'int main() { long double x = 7.0; }' > try.c
5940 set try
5941 if eval $compile; then
5942         val="$define"
5943         echo "You have long double."
5944 else
5945         val="$undef"
5946         echo "You do not have long double."
5947 fi
5948 $rm_try
5949 set d_longdbl
5950 eval $setvar
5951
5952 : check for length of long double
5953 case "${d_longdbl}${longdblsize}" in
5954 $define)
5955         echo " "
5956         echo "Checking to see how big your long doubles are..." >&4
5957         $cat >try.c <<'EOCP'
5958 #include <stdio.h>
5959 int main()
5960 {
5961         printf("%d\n", sizeof(long double));
5962 }
5963 EOCP
5964         set try
5965         set try
5966         if eval $compile; then
5967                 longdblsize=`$run ./try`
5968                 echo "Your long doubles are $longdblsize bytes long."
5969         else
5970                 dflt='8'
5971                 echo " "
5972                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5973                 rp="What is the size of a long double (in bytes)?"
5974                 . ./myread
5975                 longdblsize="$ans"
5976         fi
5977         if $test "X$doublesize" = "X$longdblsize"; then
5978                 echo "That isn't any different from an ordinary double."
5979                 echo "I'll keep your setting anyway, but you may see some"
5980                 echo "harmless compilation warnings."
5981         fi
5982         ;;
5983 esac
5984 $rm_try
5985
5986 : determine the architecture name
5987 echo " "
5988 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5989         tarch=`arch`"-$osname"
5990 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5991         if uname -m > tmparch 2>&1 ; then
5992                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5993                         -e 's/$/'"-$osname/" tmparch`
5994         else
5995                 tarch="$osname"
5996         fi
5997         $rm -f tmparch
5998 else
5999         tarch="$osname"
6000 fi
6001 case "$myarchname" in
6002 ''|"$tarch") ;;
6003 *)
6004         echo "(Your architecture name used to be $myarchname.)"
6005         archname=''
6006         ;;
6007 esac
6008 case "$targetarch" in
6009 '') ;;
6010 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6011 esac
6012 myarchname="$tarch"
6013 case "$archname" in
6014 '') dflt="$tarch";;
6015 *) dflt="$archname";;
6016 esac
6017 rp='What is your architecture name'
6018 . ./myread
6019 archname="$ans"
6020 case "$usethreads" in
6021 $define)
6022         echo "Threads selected." >&4
6023         case "$archname" in
6024         *-thread*) echo "...and architecture name already has -thread." >&4
6025                 ;;
6026         *)      archname="$archname-thread"
6027                 echo "...setting architecture name to $archname." >&4
6028                 ;;
6029         esac
6030         ;;
6031 esac
6032 case "$usemultiplicity" in
6033 $define)
6034         echo "Multiplicity selected." >&4
6035         case "$archname" in
6036         *-multi*) echo "...and architecture name already has -multi." >&4
6037                 ;;
6038         *)      archname="$archname-multi"
6039                 echo "...setting architecture name to $archname." >&4
6040                 ;;
6041         esac
6042         ;;
6043 esac
6044 case "$use64bitint$use64bitall" in
6045 *"$define"*)
6046         case "$archname64" in
6047         '')
6048                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6049                 ;;
6050         *)
6051                 case "$use64bitint" in
6052                 "$define") echo "64 bit integers selected." >&4 ;;
6053                 esac
6054                 case "$use64bitall" in
6055                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6056                 esac
6057                 case "$archname" in
6058                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6059                         ;;
6060                 *)      archname="$archname-$archname64"
6061                         echo "...setting architecture name to $archname." >&4
6062                         ;;
6063                 esac
6064                 ;;
6065         esac
6066 esac
6067 case "$uselongdouble" in
6068 $define)
6069         echo "Long doubles selected." >&4
6070         case "$longdblsize" in
6071         $doublesize)
6072                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6073                 ;;
6074         *)
6075                 case "$archname" in
6076                 *-ld*) echo "...and architecture name already has -ld." >&4
6077                         ;;
6078                 *)      archname="$archname-ld"
6079                         echo "...setting architecture name to $archname." >&4
6080                         ;;
6081                 esac
6082                 ;;
6083         esac
6084         ;;
6085 esac
6086 if $test -f archname.cbu; then
6087         echo "Your platform has some specific hints for architecture name, using them..."
6088         . ./archname.cbu
6089 fi
6090
6091 : set the prefixit variable, to compute a suitable default value
6092 prefixit='case "$3" in
6093 ""|none)
6094         case "$oldprefix" in
6095         "") eval "$1=\"\$$2\"";;
6096         *)
6097                 case "$3" in
6098                 "") eval "$1=";;
6099                 none)
6100                         eval "tp=\"\$$2\"";
6101                         case "$tp" in
6102                         ""|" ") eval "$1=\"\$$2\"";;
6103                         *) eval "$1=";;
6104                         esac;;
6105                 esac;;
6106         esac;;
6107 *)
6108         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6109         case "$tp" in
6110         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6111         /*-$oldprefix/*|\~*-$oldprefix/*)
6112                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6113         *) eval "$1=\"\$$2\"";;
6114         esac;;
6115 esac'
6116
6117 : determine installation style
6118 : For now, try to deduce it from prefix unless it is already set.
6119 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6120 case "$installstyle" in
6121 '')     case "$prefix" in
6122                 *perl*) dflt='lib';;
6123                 *) dflt='lib/perl5' ;;
6124         esac
6125         ;;
6126 *)      dflt="$installstyle" ;;
6127 esac
6128 : Probably not worth prompting for this since we prompt for all
6129 : the directories individually, and the prompt would be too long and
6130 : confusing anyway.
6131 installstyle=$dflt
6132
6133 : determine where public executables go
6134 echo " "
6135 set dflt bin bin
6136 eval $prefixit
6137 fn=d~
6138 rp='Pathname where the public executables will reside?'
6139 . ./getfile
6140 if $test "X$ansexp" != "X$binexp"; then
6141         installbin=''
6142 fi
6143 prefixvar=bin
6144 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6145 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6146 :     this via initialinstalllocation
6147 . ./setprefixvar
6148
6149 case "$userelocatableinc" in
6150 $define|true|[yY]*)     dflt='y' ;;
6151 *)                      dflt='n' ;;
6152 esac
6153 cat <<EOM
6154
6155 Would you like to build Perl so that the installation is relocatable, so that
6156 library paths in @INC are determined relative to the path of the perl binary?
6157 This is not advised for system Perl installs, or if you need to run setid
6158 scripts or scripts under taint mode.
6159
6160 If this doesn't make any sense to you, just accept the default '$dflt'.
6161 EOM
6162 rp='Use relocatable @INC?'
6163 . ./myread
6164 case "$ans" in
6165 y|Y)    val="$define" ;;
6166 *)      val="$undef"  ;;
6167 esac
6168 set userelocatableinc
6169 eval $setvar
6170
6171 initialinstalllocation="$binexp"
6172 : Default prefix is now "up one level from where the binaries are"
6173 case "$userelocatableinc" in
6174 $define|true|[yY]*)
6175     bin=".../"
6176     binexp=".../"
6177     prefix=".../.."
6178     prefixexp=".../.."
6179     installprefixexp=".../.."
6180     ;;
6181 esac
6182
6183 : determine where private library files go
6184 : Usual default is /usr/local/lib/perl5/$version.
6185 : Also allow things like /opt/perl/lib/$version, since
6186 : /opt/perl/lib/perl5... would be redundant.
6187 : The default "style" setting is made in installstyle.U
6188 case "$installstyle" in
6189 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6190 *)       set dflt privlib lib/$version ;;
6191 esac
6192 eval $prefixit
6193 $cat <<EOM
6194
6195 There are some auxiliary files for $package that need to be put into a
6196 private library directory that is accessible by everyone.
6197
6198 EOM
6199 fn=$binexp
6200 fn=d~+
6201 rp='Pathname where the private library files will reside?'
6202 . ./getfile
6203 prefixvar=privlib
6204 . ./setprefixvar
6205
6206 : set the prefixup variable, to restore leading tilda escape
6207 prefixup='case "$prefixexp" in
6208 "$prefix") ;;
6209 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6210 esac'
6211
6212 : determine where public architecture dependent libraries go
6213 set archlib archlib
6214 eval $prefixit
6215 : privlib default is /usr/local/lib/$package/$version
6216 : archlib default is /usr/local/lib/$package/$version/$archname
6217 : privlib may have an optional trailing /share.
6218 tdflt=`echo $privlib | $sed 's,/share$,,'`
6219 tdflt=$tdflt/$archname
6220 case "$archlib" in
6221 '')     dflt=$tdflt
6222         ;;
6223 *)      dflt="$archlib"
6224     ;;
6225 esac
6226 $cat <<EOM
6227
6228 $spackage contains architecture-dependent library files.  If you are
6229 sharing libraries in a heterogeneous environment, you might store
6230 these files in a separate location.  Otherwise, you can just include
6231 them with the rest of the public library files.
6232
6233 EOM
6234 fn=$binexp
6235 fn=d+~
6236 rp='Where do you want to put the public architecture-dependent libraries?'
6237 . ./getfile
6238 prefixvar=archlib
6239 . ./setprefixvar
6240 if $test X"$archlib" = X"$privlib"; then
6241         d_archlib="$undef"
6242 else
6243         d_archlib="$define"
6244 fi
6245
6246 : see if setuid scripts can be secure
6247 $cat <<EOM
6248
6249 Some kernels have a bug that prevents setuid #! scripts from being
6250 secure.  Some sites have disabled setuid #! scripts because of this.
6251
6252 First let's decide if your kernel supports secure setuid #! scripts.
6253 (If setuid #! scripts would be secure but have been disabled anyway,
6254 don't say that they are secure if asked.)
6255
6256 EOM
6257
6258 val="$undef"
6259 if $test -d /dev/fd; then
6260         echo "#!$ls" >reflect
6261         chmod +x,u+s reflect
6262         ./reflect >flect 2>&1
6263         if $contains "/dev/fd" flect >/dev/null; then
6264                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6265                 val="$define"
6266         else
6267                 $cat <<EOM
6268 If you are not sure if they are secure, I can check but I'll need a
6269 username and password different from the one you are using right now.
6270 If you don't have such a username or don't want me to test, simply
6271 enter 'none'.
6272
6273 EOM
6274                 rp='Other username to test security of setuid scripts with?'
6275                 dflt='none'
6276                 . ./myread
6277                 case "$ans" in
6278                 n|none)
6279                         case "$d_suidsafe" in
6280                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6281                                 dflt=n;;
6282                         "$undef")
6283                                 echo "Well, the $hint value is *not* secure." >&4
6284                                 dflt=n;;
6285                         *)      echo "Well, the $hint value *is* secure." >&4
6286                                 dflt=y;;
6287                         esac
6288                         ;;
6289                 *)
6290                         $rm -f reflect flect
6291                         echo "#!$ls" >reflect
6292                         chmod +x,u+s reflect
6293                         echo >flect
6294                         chmod a+w flect
6295                         echo '"su" will (probably) prompt you for '"$ans's password."
6296                         su $ans -c './reflect >flect'
6297                         if $contains "/dev/fd" flect >/dev/null; then
6298                                 echo "Okay, it looks like setuid scripts are secure." >&4
6299                                 dflt=y
6300                         else
6301                                 echo "I don't think setuid scripts are secure." >&4
6302                                 dflt=n
6303                         fi
6304                         ;;
6305                 esac
6306                 rp='Does your kernel have *secure* setuid scripts?'
6307                 . ./myread
6308                 case "$ans" in
6309                 [yY]*)  val="$define";;
6310                 *)      val="$undef";;
6311                 esac
6312         fi
6313 else
6314         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6315         echo "(That's for file descriptors, not floppy disks.)"
6316         val="$undef"
6317 fi
6318 set d_suidsafe
6319 eval $setvar
6320
6321 $rm -f reflect flect
6322
6323 : now see if they want to do setuid emulation
6324 if $test $patchlevel -lt 11; then
6325 echo " "
6326 val="$undef"
6327 case "$d_suidsafe" in
6328 "$define")
6329         val="$undef"
6330         echo "No need to emulate SUID scripts since they are secure here." >&4
6331         ;;
6332 *)
6333         $cat <<EOM
6334 Some systems have disabled setuid scripts, especially systems where
6335 setuid scripts cannot be secure.  On systems where setuid scripts have
6336 been disabled, the setuid/setgid bits on scripts are currently
6337 useless.  It is possible for $package to detect those bits and emulate
6338 setuid/setgid in a secure fashion.  This emulation will only work if
6339 setuid scripts have been disabled in your kernel.
6340
6341 EOM
6342         case "$d_dosuid" in
6343         "$define") dflt=y ;;
6344         *) dflt=n ;;
6345         esac
6346         rp="Do you want to do setuid/setgid emulation?"
6347         . ./myread
6348         case "$ans" in
6349         [yY]*)  val="$define";;
6350         *)      val="$undef";;
6351         esac
6352         ;;
6353 esac
6354 set d_dosuid
6355 eval $setvar
6356 else
6357     case "$d_dosuid" in
6358         "$define")
6359         cat >&4 <<EOH
6360
6361 SUID emulation has been removed for 5.12
6362 Please re-run Configure without -Dd_dosuid
6363
6364 EOH
6365         exit 1;
6366         ;;
6367     esac
6368     d_dosuid=undef
6369 fi
6370
6371 : Find perl5.005 or later.
6372 echo "Looking for a previously installed perl5.005 or later... "
6373 case "$perl5" in
6374 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6375                 : Check if this perl is recent and can load a simple module
6376                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6377                         perl5=$tdir/perl
6378                         break;
6379                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6380                         perl5=$tdir/perl5
6381                         break;
6382                 fi
6383         done
6384         ;;
6385 *)      perl5="$perl5"
6386         ;;
6387 esac
6388 case "$perl5" in
6389 '')     echo "None found.  That's ok.";;
6390 *)      echo "Using $perl5." ;;
6391 esac
6392
6393 : Set the siteprefix variables
6394 $cat <<EOM
6395
6396 After $package is installed, you may wish to install various
6397 add-on modules and utilities.  Typically, these add-ons will
6398 be installed under $prefix with the rest
6399 of this package.  However, you may wish to install such add-ons
6400 elsewhere under a different prefix.
6401
6402 If you do not wish to put everything under a single prefix, that's
6403 ok.  You will be prompted for the individual locations; this siteprefix
6404 is only used to suggest the defaults.
6405
6406 The default should be fine for most people.
6407
6408 EOM
6409 fn=d~+
6410 rp='Installation prefix to use for add-on modules and utilities?'
6411 : XXX Here might be another good place for an installstyle setting.
6412 case "$siteprefix" in
6413 '') dflt=$prefix ;;
6414 *)  dflt=$siteprefix ;;
6415 esac
6416 . ./getfile
6417 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6418 oldsiteprefix=''
6419 case "$siteprefix" in
6420 '') ;;
6421 *)      case "$ans" in
6422         "$prefix") ;;
6423         *) oldsiteprefix="$prefix";;
6424         esac
6425         ;;
6426 esac
6427 siteprefix="$ans"
6428 siteprefixexp="$ansexp"
6429
6430 : determine where site specific libraries go.
6431 : Usual default is /usr/local/lib/perl5/site_perl/$version
6432 : The default "style" setting is made in installstyle.U
6433 : XXX No longer works with Prefixit stuff.
6434 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6435 case "$sitelib" in
6436 '') case "$installstyle" in
6437         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6438         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6439         esac
6440         ;;
6441 *)      dflt="$sitelib"
6442         ;;
6443 esac
6444 $cat <<EOM
6445
6446 The installation process will create a directory for
6447 site-specific extensions and modules.  Most users find it convenient
6448 to place all site-specific files in this directory rather than in the
6449 main distribution directory.
6450
6451 EOM
6452 fn=d~+
6453 rp='Pathname for the site-specific library files?'
6454 . ./getfile
6455 prefixvar=sitelib
6456 . ./setprefixvar
6457 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6458
6459 : Determine list of previous versions to include in @INC
6460 $cat > getverlist <<EOPL
6461 #!$perl5 -w
6462 use File::Basename;
6463 \$api_versionstring = "$api_versionstring";
6464 \$version = "$version";
6465 \$stem = "$sitelib_stem";
6466 \$archname = "$archname";
6467 EOPL
6468         $cat >> getverlist <<'EOPL'
6469 # The list found is store twice for each entry: the original name, and
6470 # the binary broken down version as pack "sss", so sorting is easy and
6471 # unambiguous. This will work for all versions that have a maximum of
6472 # three digit groups, separate by '.'s or '_'s. Names are extended with
6473 # ".0.0" to ensure at least three elements for the pack.
6474 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6475
6476 # Can't have leading @ because metaconfig interprets it as a command!
6477 ;@inc_version_list=();
6478 # XXX Redo to do opendir/readdir?
6479 if (-d $stem) {
6480     chdir($stem);
6481     ;@candidates = map {
6482         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6483     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6484 }
6485 else {
6486     ;@candidates = ();
6487 }
6488
6489 ($pversion, $aversion, $vsn5005) = map {
6490     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6491 foreach $d (@candidates) {
6492     if ($d->[1] lt $pversion) {
6493         if ($d->[1] ge $aversion) {
6494             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6495         }
6496         elsif ($d->[1] ge $vsn5005) {
6497             unshift(@inc_version_list, grep { -d } $d->[0]);
6498         }
6499     }
6500     else {
6501         # Skip newer version.  I.e. don't look in
6502         # 5.7.0 if we're installing 5.6.1.
6503     }
6504 }
6505
6506 if (@inc_version_list) {
6507     print join(' ', @inc_version_list);
6508 }
6509 else {
6510     # Blank space to preserve value for next Configure run.
6511     print " ";
6512 }
6513 EOPL
6514 chmod +x getverlist
6515 case "$inc_version_list" in
6516 '')     if test -x "$perl5$exe_ext"; then
6517                 dflt=`$perl5 getverlist`
6518         else
6519                 dflt='none'
6520         fi
6521         ;;
6522 $undef) dflt='none' ;;
6523 *)  eval dflt=\"$inc_version_list\" ;;
6524 esac
6525 case "$dflt" in
6526 ''|' ') dflt=none ;;
6527 esac
6528 case "$dflt" in
6529 5.005) dflt=none ;;
6530 esac
6531 $cat <<EOM
6532
6533 In order to ease the process of upgrading, this version of perl
6534 can be configured to use modules built and installed with earlier
6535 versions of perl that were installed under $prefix.  Specify here
6536 the list of earlier versions that this version of perl should check.
6537 If Configure detected no earlier versions of perl installed under
6538 $prefix, then the list will be empty.  Answer 'none' to tell perl
6539 to not search earlier versions.
6540
6541 The default should almost always be sensible, so if you're not sure,
6542 just accept the default.
6543 EOM
6544
6545 rp='List of earlier versions to include in @INC?'
6546 . ./myread
6547 case "$ans" in
6548 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6549 *) inc_version_list="$ans" ;;
6550 esac
6551 case "$inc_version_list" in
6552 ''|' ')
6553         inc_version_list_init='0'
6554         d_inc_version_list="$undef"
6555         ;;
6556 *)      inc_version_list_init=`echo $inc_version_list |
6557                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6558         d_inc_version_list="$define"
6559         ;;
6560 esac
6561 $rm -f getverlist
6562
6563 : see if malloc/malloc.h has to be included
6564 set malloc/malloc.h i_mallocmalloc
6565 eval $inhdr
6566
6567 : see if this is a malloc.h system
6568 : we want a real compile instead of Inhdr because some systems have a
6569 : malloc.h that just gives a compile error saying to use stdlib.h instead
6570 echo " "
6571 $cat >try.c <<EOCP
6572 #include <stdlib.h>
6573 #include <malloc.h>
6574 #$i_mallocmalloc I_MALLOCMALLOC
6575 #ifdef I_MALLOCMALLOC
6576 # include <malloc/malloc.h>
6577 #endif
6578
6579 int main () { return 0; }
6580 EOCP
6581 set try
6582 if eval $compile; then
6583     echo "<malloc.h> found." >&4
6584     val="$define"
6585 else
6586     echo "<malloc.h> NOT found." >&4
6587     val="$undef"
6588 fi
6589 $rm_try
6590 set i_malloc
6591 eval $setvar
6592
6593 : check for void type
6594 echo " "
6595 echo "Checking to see how well your C compiler groks the void type..." >&4
6596 case "$voidflags" in
6597 '')
6598         $cat >try.c <<EOCP
6599 #$i_stdlib I_STDLIB
6600 #ifdef I_STDLIB
6601 #include <stdlib.h>
6602 #endif
6603 #if TRY & 1
6604 void sub() {
6605 #else
6606 sub() {
6607 #endif
6608         extern void moo();      /* function returning void */
6609         void (*goo)();          /* ptr to func returning void */
6610 #if TRY & 8
6611         void *hue;              /* generic ptr */
6612 #endif
6613 #if TRY & 2
6614         void (*foo[10])();
6615 #endif
6616
6617 #if TRY & 4
6618         if(goo == moo) {
6619                 exit(0);
6620         }
6621 #endif
6622         exit(0);
6623 }
6624 int main() { sub(); }
6625 EOCP
6626         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6627                 voidflags=$defvoidused
6628         echo "Good.  It appears to support void to the level $package wants.">&4
6629                 if $contains warning .out >/dev/null 2>&1; then
6630                         echo "However, you might get some warnings that look like this:"
6631                         $cat .out
6632                 fi
6633         else
6634 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6635                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6636                         echo "It supports 1..."
6637                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6638                                 echo "It also supports 2..."
6639                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6640                                         voidflags=7
6641                                         echo "And it supports 4 but not 8 definitely."
6642                                 else
6643                                         echo "It doesn't support 4..."
6644                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6645                                                 voidflags=11
6646                                                 echo "But it supports 8."
6647                                         else
6648                                                 voidflags=3
6649                                                 echo "Neither does it support 8."
6650                                         fi
6651                                 fi
6652                         else
6653                                 echo "It does not support 2..."
6654                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6655                                         voidflags=13
6656                                         echo "But it supports 4 and 8."
6657                                 else
6658                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6659                                                 voidflags=5
6660                                                 echo "And it supports 4 but has not heard about 8."
6661                                         else
6662                                                 echo "However it supports 8 but not 4."
6663                                         fi
6664                                 fi
6665                         fi
6666                 else
6667                         echo "There is no support at all for void."
6668                         voidflags=0
6669                 fi
6670         fi
6671 esac
6672 case "$voidflags" in
6673 "$defvoidused") ;;
6674 *)      $cat >&4 <<'EOM'
6675   Support flag bits are:
6676     1: basic void declarations.
6677     2: arrays of pointers to functions returning void.
6678     4: operations between pointers to and addresses of void functions.
6679     8: generic void pointers.
6680 EOM
6681         dflt="$voidflags";
6682         rp="Your void support flags add up to what?"
6683         . ./myread
6684         voidflags="$ans"
6685         ;;
6686 esac
6687 $rm_try
6688
6689 : check for length of pointer
6690 echo " "
6691 case "$ptrsize" in
6692 '')
6693         echo "Checking to see how big your pointers are..." >&4
6694         if test "$voidflags" -gt 7; then
6695                 echo '#define VOID_PTR char *' > try.c
6696         else
6697                 echo '#define VOID_PTR void *' > try.c
6698         fi
6699         $cat >>try.c <<EOCP
6700 #include <stdio.h>
6701 #$i_stdlib I_STDLIB
6702 #ifdef I_STDLIB
6703 #include <stdlib.h>
6704 #endif
6705 int main()
6706 {
6707     printf("%d\n", (int)sizeof(VOID_PTR));
6708     exit(0);
6709 }
6710 EOCP
6711         set try
6712         if eval $compile_ok; then
6713                 ptrsize=`$run ./try`
6714                 echo "Your pointers are $ptrsize bytes long."
6715         else
6716                 dflt='4'
6717                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6718                 rp="What is the size of a pointer (in bytes)?"
6719                 . ./myread
6720                 ptrsize="$ans"
6721         fi
6722         ;;
6723 esac
6724 $rm_try
6725 case "$use64bitall" in
6726 "$define"|true|[yY]*)
6727         case "$ptrsize" in
6728         4)      cat <<EOM >&4
6729
6730 *** You have chosen a maximally 64-bit build,
6731 *** but your pointers are only 4 bytes wide.
6732 *** Please rerun Configure without -Duse64bitall.
6733 EOM
6734                 case "$d_quad" in
6735                 define)
6736                         cat <<EOM >&4
6737 *** Since you have quads, you could possibly try with -Duse64bitint.
6738 EOM
6739                         ;;
6740                 esac
6741                 cat <<EOM >&4
6742 *** Cannot continue, aborting.
6743
6744 EOM
6745
6746                 exit 1
6747                 ;;
6748         esac
6749         ;;
6750 esac
6751
6752
6753 : determine whether to use malloc wrapping
6754 echo " "
6755 case "$usemallocwrap" in
6756 [yY]*|true|$define)     dflt='y' ;;
6757 [nN]*|false|$undef)     dflt='n' ;;
6758 *)      case "$usedevel" in
6759         [yY]*|true|$define)     dflt='y' ;;
6760         *) dflt='n' ;;
6761         esac
6762         ;;
6763 esac
6764 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6765 . ./myread
6766 usemallocwrap="$ans"
6767 case "$ans" in
6768 y*|true)
6769         usemallocwrap="$define" ;;
6770 *)
6771         usemallocwrap="$undef" ;;
6772 esac
6773
6774 : determine which malloc to compile in
6775 echo " "
6776 case "$usemymalloc" in
6777 [yY]*|true|$define)     dflt='y' ;;
6778 [nN]*|false|$undef)     dflt='n' ;;
6779 *)      case "$ptrsize" in
6780         4) dflt='y' ;;
6781         *) dflt='n' ;;
6782         esac
6783         if test "$useithreads" = "$define"; then dflt='n'; fi
6784         ;;
6785 esac
6786 rp="Do you wish to attempt to use the malloc that comes with $package?"
6787 . ./myread
6788 usemymalloc="$ans"
6789 case "$ans" in
6790 y*|true)
6791         usemymalloc='y'
6792         mallocsrc='malloc.c'
6793         mallocobj="malloc$_o"
6794         d_mymalloc="$define"
6795         case "$libs" in
6796         *-lmalloc*)
6797                 : Remove malloc from list of libraries to use
6798                 echo "Removing unneeded -lmalloc from library list" >&4
6799                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6800                 shift
6801                 libs="$*"
6802                 echo "libs = $libs" >&4
6803                 ;;
6804         esac
6805         ;;
6806 *)
6807         usemymalloc='n'
6808         mallocsrc=''
6809         mallocobj=''
6810         d_mymalloc="$undef"
6811         ;;
6812 esac
6813
6814 : compute the return types of malloc and free
6815 echo " "
6816 $cat >malloc.c <<END
6817 #$i_malloc I_MALLOC
6818 #$i_stdlib I_STDLIB
6819 #include <stdio.h>
6820 #include <sys/types.h>
6821 #ifdef I_MALLOC
6822 #include <malloc.h>
6823 #endif
6824 #ifdef I_STDLIB
6825 #include <stdlib.h>
6826 #endif
6827 #ifdef TRY_MALLOC
6828 void *malloc();
6829 #endif
6830 #ifdef TRY_FREE
6831 void free();
6832 #endif
6833 END
6834 case "$malloctype" in
6835 '')
6836         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6837                 malloctype='void *'
6838         else
6839                 malloctype='char *'
6840         fi
6841         ;;
6842 esac
6843 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6844
6845 case "$freetype" in
6846 '')
6847         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6848                 freetype='void'
6849         else
6850                 freetype='int'
6851         fi
6852         ;;
6853 esac
6854 echo "Your system uses $freetype free(), it would seem." >&4
6855 $rm -f malloc.[co]
6856 : determine where site specific architecture-dependent libraries go.
6857 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6858 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6859 : sitelib may have an optional trailing /share.
6860 case "$sitearch" in
6861 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6862         dflt="$dflt/$archname"
6863         ;;
6864 *)      dflt="$sitearch"
6865         ;;
6866 esac
6867 set sitearch sitearch none
6868 eval $prefixit
6869 $cat <<EOM
6870
6871 The installation process will also create a directory for
6872 architecture-dependent site-specific extensions and modules.
6873
6874 EOM
6875 fn=d~+
6876 rp='Pathname for the site-specific architecture-dependent library files?'
6877 . ./getfile
6878 prefixvar=sitearch
6879 . ./setprefixvar
6880 if $test X"$sitearch" = X"$sitelib"; then
6881         d_sitearch="$undef"
6882 else
6883         d_sitearch="$define"
6884 fi
6885
6886 : Set the vendorprefix variables
6887 $cat <<EOM
6888
6889 The installation process will also create a directory for
6890 vendor-supplied add-ons.  Vendors who supply perl with their system
6891 may find it convenient to place all vendor-supplied files in this
6892 directory rather than in the main distribution directory.  This will
6893 ease upgrades between binary-compatible maintenance versions of perl.
6894
6895 Of course you may also use these directories in whatever way you see
6896 fit.  For example, you might use them to access modules shared over a
6897 company-wide network.
6898
6899 The default answer should be fine for most people.
6900 This causes further questions about vendor add-ons to be skipped
6901 and no vendor-specific directories will be configured for perl.
6902
6903 EOM
6904 rp='Do you want to configure vendor-specific add-on directories?'
6905 case "$usevendorprefix" in
6906 define|true|[yY]*) dflt=y ;;
6907 *)      : User may have set vendorprefix directly on Configure command line.
6908         case "$vendorprefix" in
6909         ''|' ') dflt=n ;;
6910         *)      dflt=y ;;
6911         esac
6912         ;;
6913 esac
6914 . ./myread
6915 case "$ans" in
6916 [yY]*)  fn=d~+
6917         rp='Installation prefix to use for vendor-supplied add-ons?'
6918         case "$vendorprefix" in
6919         '') dflt='' ;;
6920         *)  dflt=$vendorprefix ;;
6921         esac
6922         . ./getfile
6923         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6924         oldvendorprefix=''
6925         case "$vendorprefix" in
6926         '') ;;
6927         *)      case "$ans" in
6928                 "$prefix") ;;
6929                 *) oldvendorprefix="$prefix";;
6930                 esac
6931                 ;;
6932         esac
6933         usevendorprefix="$define"
6934         vendorprefix="$ans"
6935         vendorprefixexp="$ansexp"
6936         ;;
6937 *)      usevendorprefix="$undef"
6938         vendorprefix=''
6939         vendorprefixexp=''
6940         ;;
6941 esac
6942
6943 : Set the vendorlib variables
6944 case "$vendorprefix" in
6945 '')     d_vendorlib="$undef"
6946         vendorlib=''
6947         vendorlibexp=''
6948         ;;
6949 *)      d_vendorlib="$define"
6950         : determine where vendor-supplied modules go.
6951         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6952         case "$vendorlib" in
6953         '')
6954                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6955                 case "$installstyle" in
6956                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6957                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6958                 esac
6959                 ;;
6960         *)      dflt="$vendorlib"
6961                 ;;
6962         esac
6963         fn=d~+
6964         rp='Pathname for the vendor-supplied library files?'
6965         . ./getfile
6966         vendorlib="$ans"
6967         vendorlibexp="$ansexp"
6968         ;;
6969 esac
6970 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6971 prefixvar=vendorlib
6972 . ./installprefix
6973
6974 : Set the vendorarch variables
6975 case "$vendorprefix" in
6976 '')     d_vendorarch="$undef"
6977         vendorarch=''
6978         vendorarchexp=''
6979         ;;
6980 *)      d_vendorarch="$define"
6981         : determine where vendor-supplied architecture-dependent libraries go.
6982         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6983         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6984         : vendorlib may have an optional trailing /share.
6985         case "$vendorarch" in
6986         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6987                 dflt="$dflt/$archname"
6988                 ;;
6989         *)      dflt="$vendorarch" ;;
6990         esac
6991         fn=d~+
6992         rp='Pathname for vendor-supplied architecture-dependent files?'
6993         . ./getfile
6994         vendorarch="$ans"
6995         vendorarchexp="$ansexp"
6996         ;;
6997 esac
6998 prefixvar=vendorarch
6999 . ./installprefix
7000 if $test X"$vendorarch" = X"$vendorlib"; then
7001         d_vendorarch="$undef"
7002 else
7003         d_vendorarch="$define"
7004 fi
7005
7006 : Final catch-all directories to search
7007 $cat <<EOM
7008
7009 Lastly, you can have perl look in other directories for extensions and
7010 modules in addition to those already specified.
7011 These directories will be searched after 
7012         $sitearch 
7013         $sitelib 
7014 EOM
7015 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7016 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7017 echo ' '
7018 case "$otherlibdirs" in
7019 ''|' ') dflt='none' ;;
7020 *)      dflt="$otherlibdirs" ;;
7021 esac
7022 $cat <<EOM
7023 Enter a colon-separated set of extra paths to include in perl's @INC
7024 search path, or enter 'none' for no extra paths.
7025
7026 EOM
7027
7028 rp='Colon-separated list of additional directories for perl to search?'
7029 . ./myread
7030 case "$ans" in
7031 ' '|''|none)    otherlibdirs=' ' ;;     
7032 *)      otherlibdirs="$ans" ;;
7033 esac
7034 case "$otherlibdirs" in
7035 ' ') val=$undef ;;
7036 *)      val=$define ;;
7037 esac
7038 set d_perl_otherlibdirs
7039 eval $setvar
7040
7041 : Cruising for prototypes
7042 echo " "
7043 echo "Checking out function prototypes..." >&4
7044 $cat >prototype.c <<EOCP
7045 #$i_stdlib I_STDLIB
7046 #ifdef I_STDLIB
7047 #include <stdlib.h>
7048 #endif
7049 int main(int argc, char *argv[]) {
7050         exit(0);}
7051 EOCP
7052 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7053         echo "Your C compiler appears to support function prototypes."
7054         val="$define"
7055 else
7056         echo "Your C compiler doesn't seem to understand function prototypes."
7057         val="$undef"
7058 fi
7059 set prototype
7060 eval $setvar
7061 $rm -f prototype*
7062
7063 : Check if ansi2knr is required
7064 case "$prototype" in
7065 "$define") ;;
7066 *)      ansi2knr='ansi2knr'
7067         echo " "
7068         cat <<EOM >&4
7069
7070 $me:  FATAL ERROR:
7071 This version of $package can only be compiled by a compiler that 
7072 understands function prototypes.  Unfortunately, your C compiler 
7073         $cc $ccflags
7074 doesn't seem to understand them.  Sorry about that.
7075
7076 If GNU cc is available for your system, perhaps you could try that instead.  
7077
7078 Eventually, we hope to support building Perl with pre-ANSI compilers.
7079 If you would like to help in that effort, please contact <perlbug@perl.org>.
7080
7081 Aborting Configure now.
7082 EOM
7083         exit 2
7084         ;;
7085 esac
7086
7087 : DTrace support
7088 dflt_dtrace='/usr/sbin/dtrace'
7089 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7090
7091 cat <<EOM
7092
7093 Perl can be built to support DTrace on platforms that support it.
7094 DTrace is a diagnosis and performance analysis tool from Sun.
7095
7096 If this doesn't make any sense to you, just accept the default '$dflt'.
7097 EOM
7098
7099 while $test 1 ; do
7100         case "$usedtrace" in
7101         $define|true|[yY]*)
7102                 dflt='y'
7103                 ;;
7104         ?*)
7105                 dflt='y'
7106                 dflt_dtrace=$usedtrace
7107                 ;;
7108         *)
7109                 dflt='n'
7110                 ;;
7111         esac
7112
7113         rp='Support DTrace if available?'
7114         . ./myread
7115         case "$ans" in
7116         y|Y)    val="$define" ;;
7117         *)      val="$undef" ;;
7118         esac
7119         set usedtrace
7120         eval $setvar
7121
7122         test "X$usedtrace" != "X$define" && break
7123
7124         echo " "
7125         rp='Where is the dtrace executable?'
7126         dflt=$dflt_dtrace
7127         . ./getfile
7128         val="$ans"
7129         set dtrace
7130         eval $setvar
7131
7132         if $test -f $dtrace
7133         then
7134                 if $dtrace -h -s ../perldtrace.d \
7135                         -o perldtrace.tmp >/dev/null 2>&1 \
7136                         && rm -f perldtrace.tmp
7137                 then
7138                         echo " "
7139                         echo "Good: your $dtrace knows about the -h flag."
7140                 else
7141                         cat >&2 <<EOM
7142
7143 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7144 ***
7145 *** Your installed dtrace doesn't support the -h switch to compile a D
7146 *** program into a C header. Can't continue.
7147
7148 EOM
7149                         exit 1
7150                 fi
7151                 break;
7152         fi
7153
7154         case "$fastread" in
7155         yes)
7156                 cat >&2 <<EOM
7157
7158 *** $me:  Fatal Error:  $dtrace not found.
7159 *** Can't continue.
7160
7161 EOM
7162                 exit 1
7163                 ;;
7164         *)
7165                 echo "*** $dtrace was not found."
7166                 echo " "
7167                 ;;
7168         esac
7169 done
7170
7171 : See if we want extra modules installed
7172 echo " "
7173 case "$extras" in
7174 '') dflt='n';;
7175 *) dflt='y';;
7176 esac
7177 cat <<EOM
7178 Perl can be built with extra modules or bundles of modules which
7179 will be fetched from the CPAN and installed alongside Perl.
7180
7181 Notice that you will need access to the CPAN; either via the Internet,
7182 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7183 be asked later to configure the CPAN.pm module which will in turn do
7184 the installation of the rest of the extra modules or bundles.)
7185
7186 Notice also that if the modules require any external software such as
7187 libraries and headers (the libz library and the zlib.h header for the
7188 Compress::Zlib module, for example) you MUST have any such software
7189 already installed, this configuration process will NOT install such
7190 things for you.
7191
7192 If this doesn't make any sense to you, just accept the default '$dflt'.
7193 EOM
7194 rp='Install any extra modules (y or n)?'
7195 . ./myread
7196 case "$ans" in
7197 y|Y)
7198         cat <<EOM
7199
7200 Please list any extra modules or bundles to be installed from CPAN,
7201 with spaces between the names.  The names can be in any format the
7202 'install' command of CPAN.pm will understand.  (Answer 'none',
7203 without the quotes, to install no extra modules or bundles.)
7204 EOM
7205         rp='Extras?'
7206         dflt="$extras"
7207         . ./myread
7208         extras="$ans"
7209 esac
7210 case "$extras" in
7211 ''|'none')
7212         val=''
7213         $rm -f ../extras.lst
7214         ;;
7215 *)      echo "(Saving the list of extras for later...)"
7216         echo "$extras" > ../extras.lst
7217         val="'$extras'"
7218         ;;
7219 esac
7220 set extras
7221 eval $setvar
7222 echo " "
7223
7224 : determine where html pages for programs go
7225 set html1dir html1dir none
7226 eval $prefixit
7227 $cat <<EOM
7228
7229 If you wish to install html files for programs in $spackage, indicate
7230 the appropriate directory here.  To skip installing html files,
7231 answer "none".
7232 EOM
7233 case "$html1dir" in
7234 ''|none|$undef|' ') dflt=none ;;
7235 *) dflt=$html1dir ;;
7236 esac
7237 fn=dn+~
7238 rp="Directory for the main $spackage html pages?"
7239 . ./getfile
7240 prefixvar=html1dir
7241 . ./setprefixvar
7242 : Use ' ' for none so value is preserved next time through Configure
7243 $test X"$html1dir" = "X" && html1dir=' '
7244
7245 : determine where html pages for libraries and modules go
7246 set html3dir html3dir none
7247 eval $prefixit
7248 $cat <<EOM
7249
7250 If you wish to install html files for modules associated with $spackage,
7251 indicate the appropriate directory here.  To skip installing html files,
7252 answer "none".
7253 EOM
7254 : There is no obvious default.  If they have specified html1dir, then
7255 : try to key off that, possibly changing .../html1 into .../html3.
7256 case "$html3dir" in
7257 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7258 *) dflt=$html3dir ;;
7259 esac
7260 fn=dn+~
7261 rp="Directory for the $spackage module html pages?"
7262 . ./getfile
7263 prefixvar=html3dir
7264 . ./setprefixvar
7265 : Use ' ' for none so value is preserved next time through Configure
7266 $test X"$html3dir" = "X" && html3dir=' '
7267
7268 : determine whether to install perl also as /usr/bin/perl
7269
7270 echo " "
7271 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7272         $cat <<EOM
7273 Many scripts expect perl to be installed as /usr/bin/perl.
7274
7275 If you want to, I can install the perl you are about to compile
7276 as /usr/bin/perl (in addition to $bin/perl).
7277 EOM
7278         if test -f /usr/bin/perl; then
7279             $cat <<EOM
7280
7281 However, please note that because you already have a /usr/bin/perl,
7282 overwriting that with a new Perl would very probably cause problems.
7283 Therefore I'm assuming you don't want to do that (unless you insist).
7284
7285 EOM
7286             case "$installusrbinperl" in
7287             "$define"|[yY]*)    dflt='y';;
7288             *)                  dflt='n';;
7289             esac
7290         else
7291             $cat <<EOM
7292
7293 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7294
7295 EOM
7296             case "$installusrbinperl" in
7297             "$undef"|[nN]*)     dflt='n';;
7298             *)                  dflt='y';;
7299             esac
7300         fi
7301         rp="Do you want to install perl as /usr/bin/perl?"
7302         . ./myread
7303         case "$ans" in
7304         [yY]*)  val="$define";;
7305         *)      val="$undef" ;;
7306         esac
7307 else
7308         val="$undef"
7309 fi
7310 set installusrbinperl
7311 eval $setvar
7312
7313 : Check if we are using the GNU C library
7314 echo " "
7315 echo "Checking for GNU C Library..." >&4
7316 cat >try.c <<'EOCP'
7317 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7318    alone are insufficient to distinguish different versions, such as
7319    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7320    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7321 */
7322 #include <stdio.h>
7323 int main(void)
7324 {
7325 #ifdef __GLIBC__
7326 #   ifdef __GLIBC_MINOR__
7327 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7328 #           include <gnu/libc-version.h>
7329             printf("%s\n",  gnu_get_libc_version());
7330 #       else
7331             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7332 #       endif
7333 #   else
7334         printf("%d\n",  __GLIBC__);
7335 #   endif
7336     return 0;
7337 #else
7338     return 1;
7339 #endif
7340 }
7341 EOCP
7342 set try
7343 if eval $compile_ok && $run ./try > glibc.ver; then
7344         val="$define"
7345         gnulibc_version=`$cat glibc.ver`
7346         echo "You are using the GNU C Library version $gnulibc_version"
7347 else
7348         val="$undef"
7349         gnulibc_version=''
7350         echo "You are not using the GNU C Library"
7351 fi
7352 $rm_try glibc.ver
7353 set d_gnulibc
7354 eval $setvar
7355
7356 : see if nm is to be used to determine whether a symbol is defined or not
7357 case "$usenm" in
7358 '')
7359         dflt=''
7360         case "$d_gnulibc" in
7361         "$define")
7362                 echo " "
7363                 echo "nm probably won't work on the GNU C Library." >&4
7364                 dflt=n
7365                 ;;
7366         esac
7367         case "$dflt" in
7368         '') 
7369                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7370                         echo " "
7371                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7372                         echo "'nm' won't be sufficient on this sytem." >&4
7373                         dflt=n
7374                 fi
7375                 ;;
7376         esac
7377         case "$dflt" in
7378         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7379                 if $test $dflt -gt 20; then
7380                         dflt=y
7381                 else
7382                         dflt=n
7383                 fi
7384                 ;;
7385         esac
7386         ;;
7387 *)
7388         case "$usenm" in
7389         true|$define) dflt=y;;
7390         *) dflt=n;;
7391         esac
7392         ;;
7393 esac
7394 $cat <<EOM
7395
7396 I can use $nm to extract the symbols from your C libraries. This
7397 is a time consuming task which may generate huge output on the disk (up
7398 to 3 megabytes) but that should make the symbols extraction faster. The
7399 alternative is to skip the 'nm' extraction part and to compile a small
7400 test program instead to determine whether each symbol is present. If
7401 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7402 this may be the best solution.
7403
7404 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7405
7406 EOM
7407 rp="Shall I use $nm to extract C symbols from the libraries?"
7408 . ./myread
7409 case "$ans" in
7410 [Nn]*) usenm=false;;
7411 *) usenm=true;;
7412 esac
7413
7414 runnm=$usenm
7415 case "$reuseval" in
7416 true) runnm=false;;
7417 esac
7418
7419 : nm options which may be necessary
7420 case "$nm_opt" in
7421 '') if $test -f /mach_boot; then
7422                 nm_opt=''       # Mach
7423         elif $test -d /usr/ccs/lib; then
7424                 nm_opt='-p'     # Solaris (and SunOS?)
7425         elif $test -f /dgux; then
7426                 nm_opt='-p'     # DG-UX
7427         elif $test -f /lib64/rld; then
7428                 nm_opt='-p'     # 64-bit Irix
7429         else
7430                 nm_opt=''
7431         fi;;
7432 esac
7433
7434 : nm options which may be necessary for shared libraries but illegal
7435 : for archive libraries.  Thank you, Linux.
7436 case "$nm_so_opt" in
7437 '')     case "$myuname" in
7438         *linux*|gnu*)
7439                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7440                         nm_so_opt='--dynamic'
7441                 fi
7442                 ;;
7443         esac
7444         ;;
7445 esac
7446
7447 : Figure out where the libc is located
7448 case "$runnm" in
7449 true)
7450 : get list of predefined functions in a handy place
7451 echo " "
7452 case "$libc" in
7453 '') libc=unknown
7454         case "$libs" in
7455         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7456         esac
7457         ;;
7458 esac
7459 case "$libs" in
7460 '') ;;
7461 *)  for thislib in $libs; do
7462         case "$thislib" in
7463         -lc|-lc_s)
7464                 : Handle C library specially below.
7465                 ;;
7466         -l*)
7467                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7468                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7469                         :
7470                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7471                         :
7472                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7473                         :
7474                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7475                         :
7476                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7477                         :
7478                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7479                         :
7480                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7481                         :
7482                 else
7483                         try=''
7484                 fi
7485                 libnames="$libnames $try"
7486                 ;;
7487         *) libnames="$libnames $thislib" ;;
7488         esac
7489         done
7490         ;;
7491 esac
7492 xxx=normal
7493 case "$libc" in
7494 unknown)
7495         set /lib/libc.$so
7496         for xxx in $libpth; do
7497                 $test -r $1 || set $xxx/libc.$so
7498                 : The messy sed command sorts on library version numbers.
7499                 $test -r $1 || \
7500                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7501                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7502                                 h
7503                                 s/[0-9][0-9]*/0000&/g
7504                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7505                                 G
7506                                 s/\n/ /' | \
7507                          $sort | $sed -e 's/^.* //'`
7508                 eval set \$$#
7509         done
7510         $test -r $1 || set /usr/ccs/lib/libc.$so
7511         $test -r $1 || set /lib/libsys_s$_a
7512         ;;
7513 *)
7514         set blurfl
7515         ;;
7516 esac
7517 if $test -r "$1"; then
7518         echo "Your (shared) C library seems to be in $1."
7519         libc="$1"
7520 elif $test -r /lib/libc && $test -r /lib/clib; then
7521         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7522         xxx=apollo
7523         libc='/lib/clib /lib/libc'
7524         if $test -r /lib/syslib; then
7525                 echo "(Your math library is in /lib/syslib.)"
7526                 libc="$libc /lib/syslib"
7527         fi
7528 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7529         echo "Your C library seems to be in $libc, as you said before."
7530 elif $test -r $incpath/usr/lib/libc$_a; then
7531         libc=$incpath/usr/lib/libc$_a;
7532         echo "Your C library seems to be in $libc.  That's fine."
7533 elif $test -r /lib/libc$_a; then
7534         libc=/lib/libc$_a;
7535         echo "Your C library seems to be in $libc.  You're normal."
7536 else
7537         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7538                 :
7539         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7540                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7541         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7542                 :
7543         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7544                 :
7545         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7546                 :
7547         else
7548                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7549         fi
7550         if $test -r "$tans"; then
7551                 echo "Your C library seems to be in $tans, of all places."
7552                 libc=$tans
7553         else
7554                 libc='blurfl'
7555         fi
7556 fi
7557 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7558         dflt="$libc"
7559         cat <<EOM
7560
7561 If the guess above is wrong (which it might be if you're using a strange
7562 compiler, or your machine supports multiple models), you can override it here.
7563
7564 EOM
7565 else
7566         dflt=''
7567         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7568         cat >&4 <<EOM
7569 I can't seem to find your C library.  I've looked in the following places:
7570
7571 EOM
7572         $sed 's/^/      /' libpath
7573         cat <<EOM
7574
7575 None of these seems to contain your C library. I need to get its name...
7576
7577 EOM
7578 fi
7579 fn=f
7580 rp='Where is your C library?'
7581 . ./getfile
7582 libc="$ans"
7583
7584 echo " "
7585 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7586 set X `cat libnames`
7587 shift
7588 xxx=files
7589 case $# in 1) xxx=file; esac
7590 echo "Extracting names from the following $xxx for later perusal:" >&4
7591 echo " "
7592 $sed 's/^/      /' libnames >&4
7593 echo " "
7594 $echo $n "This may take a while...$c" >&4
7595
7596 for file in $*; do
7597         case $file in
7598         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7599         *) $nm $nm_opt $file 2>/dev/null;;
7600         esac
7601 done >libc.tmp
7602
7603 $echo $n ".$c"
7604 $grep fprintf libc.tmp > libc.ptf
7605 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7606 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7607 xxx='[ADTSIWi]'
7608 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7609         eval $xscan;\
7610         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7611                 eval $xrun
7612 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7613         eval $xscan;\
7614         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7615                 eval $xrun
7616 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7617         eval $xscan;\
7618         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7619                 eval $xrun
7620 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7621         eval $xscan;\
7622         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7623                 eval $xrun
7624 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7625         eval $xscan;\
7626         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7627                 eval $xrun
7628 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7629         eval $xscan;\
7630         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7631                 eval $xrun
7632 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7633                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7634         eval $xscan;\
7635         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7636                 eval $xrun
7637 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7638         eval $xscan;\
7639         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7640                 eval $xrun
7641 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7642         eval $xscan;\
7643         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7644                 eval $xrun
7645 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7646         eval $xscan;\
7647         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7648                 eval $xrun
7649 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7650         eval $xscan;\
7651         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7652                 eval $xrun
7653 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7654         eval $xscan;\
7655         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7656                 eval $xrun
7657 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7658         eval $xscan;\
7659         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7660                 eval $xrun
7661 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7662         eval $xscan;\
7663         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7664                 eval $xrun
7665 else
7666         $nm -p $* 2>/dev/null >libc.tmp
7667         $grep fprintf libc.tmp > libc.ptf
7668         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7669                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7670         then
7671                 nm_opt='-p'
7672                 eval $xrun
7673         else
7674                 echo " "
7675                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7676                 com=''
7677                 if $ar t $libc > libc.tmp && \
7678                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7679                 then
7680                         for thisname in $libnames $libc; do
7681                                 $ar t $thisname >>libc.tmp
7682                         done
7683                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7684                         echo "Ok." >&4
7685                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7686                         for thisname in $libnames $libc; do
7687                                 $ar tv $thisname >>libc.tmp
7688                                 emximp -o tmp.imp $thisname \
7689                                     2>/dev/null && \
7690                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7691                                     < tmp.imp >>libc.tmp
7692                                 $rm -f tmp.imp
7693                         done
7694                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7695                         echo "Ok." >&4
7696                 else
7697                         echo "$ar didn't seem to work right." >&4
7698                         echo "Maybe this is a Cray...trying bld instead..." >&4
7699                         if  bld t $libc | \
7700                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7701                                 $test -s libc.list
7702                         then
7703                                 for thisname in $libnames; do
7704                                         bld t $libnames | \
7705                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7706                                         $ar t $thisname >>libc.tmp
7707                                 done
7708                                 echo "Ok." >&4
7709                         else
7710                                 echo "That didn't work either.  Giving up." >&4
7711                                 exit 1
7712                         fi
7713                 fi
7714         fi
7715 fi
7716 nm_extract="$com"
7717 case "$PASE" in
7718 define)
7719     echo " "
7720     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7721     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7722     ;;
7723 *)  if $test -f /lib/syscalls.exp; then
7724         echo " "
7725         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7726         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7727                 /lib/syscalls.exp >>libc.list
7728     fi
7729     ;;
7730 esac
7731 ;;
7732 esac
7733 $rm -f libnames libpath
7734
7735 : see if dld is available
7736 set dld.h i_dld
7737 eval $inhdr
7738
7739 : Check if we are using C++
7740 echo " "
7741 echo "Checking for C++..." >&4
7742 $cat >try.c <<'EOCP'
7743 #include <stdio.h>
7744 int main(void)
7745 {
7746 #ifdef __cplusplus
7747     return 0;
7748 #else
7749     return 1;
7750 #endif
7751 }
7752 EOCP
7753 set try
7754 if eval $compile_ok && $run ./try; then
7755         val="$define"
7756         echo "You are using a C++ compiler."
7757 else
7758         val="$undef"
7759         echo "You are not using a C++ compiler."
7760 fi
7761 $rm_try cplusplus$$
7762 set d_cplusplus
7763 eval $setvar
7764
7765 : is a C symbol defined?
7766 csym='tlook=$1;
7767 case "$3" in
7768 -v) tf=libc.tmp; tdc="";;
7769 -a) tf=libc.tmp; tdc="[]";;
7770 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7771 esac;
7772 case "$d_cplusplus" in
7773     $define)    extern_C="extern \"C\"" ;;
7774     *)          extern_C="extern"       ;;
7775 esac;
7776 tx=yes;
7777 case "$reuseval-$4" in
7778 true-) ;;
7779 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7780 esac;
7781 case "$tx" in
7782 yes)
7783         tval=false;
7784         if $test "$runnm" = true; then
7785                 if $contains $tlook $tf >/dev/null 2>&1; then
7786                         tval=true;
7787                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7788                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7789                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7790                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7791                         $rm_try;
7792                 fi;
7793         else
7794                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7795                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7796                 $rm_try;
7797         fi;
7798         ;;
7799 *)
7800         case "$tval" in
7801         $define) tval=true;;
7802         *) tval=false;;
7803         esac;
7804         ;;
7805 esac;
7806 eval "$2=$tval"'
7807
7808 : define an is-in-libc? function
7809 inlibc='echo " "; td=$define; tu=$undef;
7810 sym=$1; var=$2; eval "was=\$$2";
7811 tx=yes;
7812 case "$reuseval$was" in
7813 true) ;;
7814 true*) tx=no;;
7815 esac;
7816 case "$tx" in
7817 yes)
7818         set $sym tres -f;
7819         eval $csym;
7820         case "$tres" in
7821         true)
7822                 echo "$sym() found." >&4;
7823                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7824         *)
7825                 echo "$sym() NOT found." >&4;
7826                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7827         esac;;
7828 *)
7829         case "$was" in
7830         $define) echo "$sym() found." >&4;;
7831         *) echo "$sym() NOT found." >&4;;
7832         esac;;
7833 esac'
7834
7835 : see if dlopen exists
7836 xxx_runnm="$runnm"
7837 xxx_ccflags="$ccflags"
7838 runnm=false
7839 : with g++ one needs -shared to get is-in-libc to work for dlopen
7840 case "$gccversion" in
7841 '')     ;;
7842 *)      case "$d_cplusplus" in
7843         "$define") ccflags="$ccflags -shared" ;;
7844         esac
7845         ;;
7846 esac
7847 set dlopen d_dlopen
7848 eval $inlibc
7849 runnm="$xxx_runnm"
7850 ccflags="$xxx_ccflags"
7851
7852 : see if this is a unistd.h system
7853 set unistd.h i_unistd
7854 eval $inhdr
7855
7856 : determine which dynamic loading, if any, to compile in
7857 echo " "
7858 dldir="ext/DynaLoader"
7859 case "$usedl" in
7860 $define|y|true)
7861         dflt='y'
7862         usedl="$define"
7863         ;;
7864 $undef|n|false)
7865         dflt='n'
7866         usedl="$undef"
7867         ;;
7868 *)
7869         dflt='n'
7870         case "$d_dlopen" in
7871             $define) dflt='y' ;;
7872         esac
7873         case "$i_dld" in
7874             $define) dflt='y' ;;
7875         esac
7876         : Does a dl_xxx.xs file exist for this operating system
7877         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7878         ;;
7879 esac
7880 rp="Do you wish to use dynamic loading?"
7881 . ./myread
7882 usedl="$ans"
7883 bin_ELF="$undef"
7884 case "$ans" in
7885 y*) usedl="$define"
7886         case "$dlsrc" in
7887         '')
7888                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7889                         dflt="$dldir/dl_${osname}.xs"
7890                 elif $test "$d_dlopen" = "$define" ; then
7891                         dflt="$dldir/dl_dlopen.xs"
7892                 elif $test "$i_dld" = "$define" ; then
7893                         dflt="$dldir/dl_dld.xs"
7894                 else
7895                         dflt=''
7896                 fi
7897                 ;;
7898         *)      dflt="$dldir/$dlsrc"
7899                 ;;
7900         esac
7901     echo "The following dynamic loading files are available:"
7902         : Can not go over to $dldir because getfile has path hard-coded in.
7903         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7904         rp="Source file to use for dynamic loading"
7905         fn="fne"
7906         gfpth="$src"
7907         . ./getfile
7908         usedl="$define"
7909         : emulate basename
7910         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7911
7912         $cat << EOM
7913
7914 Some systems may require passing special flags to $cc -c to
7915 compile modules that will be used to create a shared library.
7916 To use no flags, say "none".
7917
7918 EOM
7919     case "$cccdlflags" in
7920     '') case "$gccversion" in
7921                 '') case "$osname" in
7922                         hpux)   dflt='+z' ;;
7923                         next)   dflt='none' ;;
7924                         irix*)  dflt='-KPIC' ;;
7925                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7926                         sunos)  dflt='-pic' ;;
7927                         *)      dflt='none' ;;
7928                     esac
7929                         ;;
7930                 *)  case "$osname" in
7931                         darwin) dflt='none' ;;
7932                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7933                         *)      dflt='-fpic' ;;
7934                     esac ;;
7935             esac ;;
7936         ' ') dflt='none' ;;
7937     *)  dflt="$cccdlflags" ;;
7938     esac
7939     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7940     . ./myread
7941     case "$ans" in
7942     none) cccdlflags=' ' ;;
7943     *) cccdlflags="$ans" ;;
7944     esac
7945
7946     cat << EOM
7947
7948 Some systems use ld to create libraries that can be dynamically loaded,
7949 while other systems (such as those using ELF) use $cc.
7950
7951 EOM
7952
7953 : Determine if this is ELF
7954         $cat >try.c <<EOM
7955 /* Test for whether ELF binaries are produced */
7956 #include <fcntl.h>
7957 #$i_stdlib I_STDLIB
7958 #ifdef I_STDLIB
7959 #include <stdlib.h>
7960 #endif
7961 #$i_unistd I_UNISTD
7962 #ifdef I_UNISTD
7963 #include <unistd.h>
7964 #endif
7965 int main() {
7966         char b[4];
7967         int i = open("a.out",O_RDONLY);
7968         if(i == -1)
7969                 exit(1); /* fail */
7970         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7971                 exit(0); /* succeed (yes, it is ELF) */
7972         else
7973                 exit(1); /* fail */
7974 }
7975 EOM
7976         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7977                 bin_ELF="$define"
7978         fi
7979         $rm_try
7980
7981         case "$ld" in
7982         '')     if $test $bin_ELF = "$define"; then
7983                         cat <<EOM
7984 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7985 EOM
7986                         dflt="$cc"
7987                 else
7988                         echo "I'll use ld to build dynamic libraries."
7989                         dflt='ld'
7990                 fi
7991                 ;;
7992         *)      dflt="$ld"
7993                 ;;
7994         esac
7995
7996     rp="What command should be used to create dynamic libraries?"
7997     . ./myread
7998         ld="$ans"
7999
8000     cat << EOM
8001
8002 Some systems may require passing special flags to $ld to create a
8003 library that can be dynamically loaded.  If your ld flags include
8004 -L/other/path options to locate libraries outside your loader's normal
8005 search path, you may need to specify those -L options here as well.  To
8006 use no flags, say "none".
8007
8008 EOM
8009     case "$lddlflags" in
8010     '') case "$osname" in
8011                         haiku) dflt='-shared' ;;
8012                         hpux) dflt='-b';
8013                               case "$gccversion" in
8014                               '') dflt="$dflt +vnocompatwarnings" ;;
8015                               esac
8016                               ;;
8017                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8018                         next)  dflt='none' ;;
8019                         solaris) dflt='-G' ;;
8020                         sunos) dflt='-assert nodefinitions' ;;
8021                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8022                 *)     dflt='none' ;;
8023                         esac
8024                         ;;
8025     *) dflt="$lddlflags" ;;
8026     esac
8027
8028         : Try to guess additional flags to pick up local libraries.
8029         : Be careful not to append to a plain 'none'
8030         case "$dflt" in
8031         none) dflt='' ;;
8032         esac
8033         for thisflag in $ldflags; do
8034                 case "$thisflag" in
8035                 -L*|-R*|-Wl,-R*)
8036                         case " $dflt " in
8037                         *" $thisflag "*) ;;
8038                         *) dflt="$dflt $thisflag" ;;
8039                         esac
8040                         ;;
8041                 esac
8042         done
8043
8044         case "$dflt" in
8045         ''|' ') dflt='none' ;;
8046         esac
8047
8048         case "$ldflags" in
8049         *-fstack-protector*)
8050             case "$dflt" in
8051                         *-fstack-protector*) ;; # Don't add it again
8052                         *) dflt="$dflt -fstack-protector" ;; 
8053                 esac
8054                 ;;
8055         esac
8056
8057
8058     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8059     . ./myread
8060     case "$ans" in
8061     none) lddlflags=' ' ;;
8062     *) lddlflags="$ans" ;;
8063     esac
8064
8065         cat <<EOM
8066
8067 Some systems may require passing special flags to $cc to indicate that
8068 the resulting executable will use dynamic linking.  To use no flags,
8069 say "none".
8070
8071 EOM
8072     case "$ccdlflags" in
8073     '') case "$osname" in
8074             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8075             next|sunos) dflt='none' ;;
8076             *)          dflt='none' ;;
8077             esac ;;
8078     ' ')  dflt='none' ;;
8079     *)  dflt="$ccdlflags" ;;
8080     esac
8081     rp="Any special flags to pass to $cc to use dynamic linking?"
8082     . ./myread
8083     case "$ans" in
8084     none) ccdlflags=' ' ;;
8085     *) ccdlflags="$ans" ;;
8086     esac
8087     ;;
8088 *)  usedl="$undef"
8089         ld='ld'
8090     dlsrc='dl_none.xs'
8091     lddlflags=''
8092     ccdlflags=''
8093     ;;
8094 esac
8095
8096 ld_can_script="$undef"
8097 case "$bin_ELF$usedl" in
8098 $define$define)
8099     # Abuse try.h and a.out names for neat cleanup
8100     $cat >try.c <<EOM
8101 void foo() {}
8102 void bar() {}
8103 EOM
8104     $cat >try.h <<EOM
8105 LIBTEST_42 {
8106  global:
8107   foo;
8108  local: *;
8109  };
8110 EOM
8111     if $cc $cccdlflags $ccdlflags $ccflags \
8112            $ldflags $lddlflags -o a.out try.c \
8113            -Wl,--version-script=try.h >/dev/null 2>&1 \
8114        &&  $test -s a.out ; then
8115         echo "ld supports scripting" >&4
8116         ld_can_script="$define"
8117     else
8118         echo "ld does not support scripting" >&4
8119     fi
8120     $rm_try
8121     ;;
8122 esac
8123
8124 : Do we want a shared libperl?
8125 also=''
8126 case "$usedl" in
8127 $undef)
8128         # No dynamic loading being used, so don't bother even to prompt.
8129         useshrplib='false'
8130         ;;
8131 *)      case "$useshrplib" in
8132         '')     case "$osname" in
8133                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8134                         dflt=y
8135                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8136                         ;;
8137                 next*)
8138                         case "$osvers" in
8139                         4*)     dflt=y
8140                                 also='Building a shared libperl is needed for MAB support.'
8141                                 ;;
8142                         *)      dflt=n
8143                                 ;;
8144                         esac
8145                         ;;
8146                 *)      dflt=n
8147                         ;;
8148                 esac
8149                 ;;
8150         $define|true|[Yy]*)
8151                 dflt=y
8152                 ;;
8153         *)      dflt=n
8154                 ;;
8155         esac
8156         $cat << EOM
8157
8158 The perl executable is normally obtained by linking perlmain.c with
8159 libperl${_a}, any static extensions (usually just DynaLoader), and
8160 any other libraries needed on this system (such as -lm, etc.).  Since
8161 your system supports dynamic loading, it is probably possible to build
8162 a shared libperl.$so.  If you will have more than one executable linked
8163 to libperl.$so, this will significantly reduce the size of each
8164 executable, but it may have a noticeable effect on performance.  The
8165 default is probably sensible for your system.
8166 $also
8167
8168 EOM
8169         rp="Build a shared libperl.$so (y/n)"
8170         . ./myread
8171         case "$ans" in
8172         true|$define|[Yy]*)
8173                 useshrplib='true'  ;;
8174         *)      useshrplib='false' ;;
8175         esac
8176         ;;
8177 esac
8178
8179 case "$useshrplib" in
8180 true)
8181         case "$userelocatableinc" in
8182         true|define)
8183                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8184                 echo "See INSTALL for an explanation why that won't work." >&4
8185                 exit 4
8186                 ;;
8187         esac
8188         case "$libperl" in
8189         '')
8190                 # Figure out a good name for libperl.so.  Since it gets stored in
8191                 # a version-specific architecture-dependent library, the version
8192                 # number isn't really that important, except for making cc/ld happy.
8193                 #
8194                 # A name such as libperl.so.10.1
8195                 majmin="libperl.$so.$patchlevel.$subversion"
8196                 # A name such as libperl.so.100
8197                 majonly=`echo $patchlevel $subversion |
8198                         $awk '{printf "%d%02d", $1, $2}'`
8199                 majonly=libperl.$so.$majonly
8200                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8201                 # rely on figuring it out from the naming of libc.
8202                 case "${osname}${osvers}" in
8203                 next4*)
8204                         dflt=libperl.5.$so
8205                         # XXX How handle the --version stuff for MAB?
8206                         ;;
8207                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8208                         dflt=libperl.$so
8209                         ;;
8210                 cygwin*) # ld links now against the dll directly
8211                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8212                         majonly=`echo $patchlevel $subversion |
8213                                 $awk '{printf "%03d%03d", $1, $2}'`
8214                         majonly=cygperl5.$majonly.$so
8215                         dflt=$majmin
8216                         ;;
8217                 *)      # Try to guess based on whether libc has major.minor.
8218                         case "$libc" in
8219                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8220                         *libc.$so.[0-9]*) dflt=$majonly ;;
8221                         *)      dflt=libperl.$so ;;
8222                         esac
8223                         ;;
8224                 esac
8225                 ;;
8226         *)      dflt=$libperl
8227                 ;;
8228         esac
8229         cat << EOM
8230
8231 I need to select a good name for the shared libperl.  If your system uses
8232 library names with major and minor numbers, then you might want something
8233 like $majmin.  Alternatively, if your system uses a single version
8234 number for shared libraries, then you might want to use $majonly.
8235 Or, your system might be quite happy with a simple libperl.$so.
8236
8237 Since the shared libperl will get installed into a version-specific
8238 architecture-dependent directory, the version number of the shared perl
8239 library probably isn't important, so the default should be o.k.
8240
8241 EOM
8242         rp='What name do you want to give to the shared libperl?'
8243         . ./myread
8244         libperl=$ans
8245         echo "Ok, I'll use $libperl"
8246         ;;
8247 *)
8248         libperl="libperl${_a}"
8249         ;;
8250 esac
8251
8252 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8253 case "$shrpdir" in
8254 '') ;;
8255 *)      $cat >&4 <<EOM
8256 WARNING:  Use of the shrpdir variable for the installation location of
8257 the shared $libperl is not supported.  It was never documented and
8258 will not work in this version.  Let me (perlbug@perl.org)
8259 know of any problems this may cause.
8260
8261 EOM
8262         case "$shrpdir" in
8263         "$archlibexp/CORE")
8264                 $cat >&4 <<EOM
8265 But your current setting of $shrpdir is
8266 the default anyway, so it's harmless.
8267 EOM
8268                 ;;
8269         *)
8270                 $cat >&4 <<EOM
8271 Further, your current attempted setting of $shrpdir
8272 conflicts with the value of $archlibexp/CORE
8273 that installperl will use.
8274 EOM
8275                 ;;
8276         esac
8277         ;;
8278 esac
8279
8280 # How will the perl executable find the installed shared $libperl?
8281 # Add $xxx to ccdlflags.
8282 # If we can't figure out a command-line option, use $shrpenv to
8283 # set env LD_RUN_PATH.  The main perl makefile uses this.
8284 shrpdir=$archlibexp/CORE
8285 xxx=''
8286 tmp_shrpenv=''
8287 if "$useshrplib"; then
8288     case "$osname" in
8289         aix)
8290                 # We'll set it in Makefile.SH...
8291                 ;;
8292         solaris)
8293                 xxx="-R $shrpdir"
8294                 ;;
8295         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly)
8296                 xxx="-Wl,-R$shrpdir"
8297                 ;;
8298         bsdos|linux|irix*|dec_osf|gnu*)
8299                 xxx="-Wl,-rpath,$shrpdir"
8300                 ;;
8301         next)
8302                 # next doesn't like the default...
8303                 ;;
8304         haiku)
8305                 # Haiku doesn't like the default, either.
8306                 ;;
8307         hpux*)
8308                 # hpux doesn't like the default, either.
8309                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8310                 ;;
8311         cygwin)
8312                 # cygwin needs only ldlibpth
8313                 ;;
8314         *)
8315                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8316                 ;;
8317         esac
8318         case "$xxx" in
8319         '') ;;
8320         *)
8321                 # Only add $xxx if it isn't already in ccdlflags.
8322                 case " $ccdlflags " in
8323                 *" $xxx "*)     ;;
8324                 *)      ccdlflags="$ccdlflags $xxx"
8325                         cat <<EOM >&4
8326
8327 Adding $xxx to the flags
8328 passed to $ld so that the perl executable will find the
8329 installed shared $libperl.
8330
8331 EOM
8332                         ;;
8333                 esac
8334                 ;;
8335         esac
8336 fi
8337 # Fix ccdlflags in AIX for building external extensions.
8338 # (For building Perl itself bare -bE:perl.exp is needed,
8339 #  Makefile.SH takes care of this.)
8340 case "$osname" in
8341 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8342 esac
8343 # Respect a hint or command-line value.
8344 case "$shrpenv" in
8345 '') shrpenv="$tmp_shrpenv" ;;
8346 esac
8347 case "$ldlibpthname" in
8348 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8349 none)   ldlibpthname='' ;;
8350 esac
8351
8352 : determine where manual pages are on this system
8353 echo " "
8354 case "$sysman" in
8355 '') 
8356         syspath='/usr/share/man/man1 /usr/man/man1'
8357         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8358         syspath="$syspath /usr/man/u_man/man1"
8359         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8360         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8361         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8362         sysman=`./loc . /usr/man/man1 $syspath`
8363         ;;
8364 esac
8365 if $test -d "$sysman"; then
8366         echo "System manual is in $sysman." >&4
8367 else
8368         echo "Could not find manual pages in source form." >&4
8369 fi
8370
8371 : determine where manual pages go
8372 set man1dir man1dir none
8373 eval $prefixit
8374 $cat <<EOM
8375
8376 $spackage has manual pages available in source form.
8377 EOM
8378 case "$nroff" in
8379 nroff)
8380         echo "However, you don't have nroff, so they're probably useless to you."
8381         case "$man1dir" in
8382         '') man1dir="none";;
8383         esac;;
8384 esac
8385 echo "If you don't want the manual sources installed, answer 'none'."
8386 case "$man1dir" in
8387 ' ') dflt=none
8388         ;;
8389 '')
8390         lookpath="$prefixexp/share/man/man1"
8391         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8392         lookpath="$lookpath $prefixexp/man/p_man/man1"
8393         lookpath="$lookpath $prefixexp/man/u_man/man1"
8394         lookpath="$lookpath $prefixexp/man/man.1"
8395         case "$sysman" in
8396         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8397         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8398         esac
8399         set dflt
8400         eval $prefixup
8401         ;;
8402 *)  dflt="$man1dir"
8403         ;;
8404 esac
8405 echo " "
8406 fn=dn+~
8407 rp="Where do the main $spackage manual pages (source) go?"
8408 . ./getfile
8409 if $test "X$man1direxp" != "X$ansexp"; then
8410         installman1dir=''
8411 fi
8412 prefixvar=man1dir
8413 . ./setprefixvar
8414
8415 case "$man1dir" in
8416 '')     man1dir=' '
8417         installman1dir='';;
8418 esac
8419
8420 : What suffix to use on installed man pages
8421
8422 case "$man1dir" in
8423 ' ')
8424         man1ext='0'
8425         ;;
8426 *)
8427         rp="What suffix should be used for the main $spackage man pages?"
8428         case "$man1ext" in
8429         '')     case "$man1dir" in
8430                 *1)  dflt=1 ;;
8431                 *1p) dflt=1p ;;
8432                 *1pm) dflt=1pm ;;
8433                 *l) dflt=l;;
8434                 *n) dflt=n;;
8435                 *o) dflt=o;;
8436                 *p) dflt=p;;
8437                 *C) dflt=C;;
8438                 *L) dflt=L;;
8439                 *L1) dflt=L1;;
8440                 *) dflt=1;;
8441                 esac
8442                 ;;
8443         *)      dflt="$man1ext";;
8444         esac
8445         . ./myread
8446         man1ext="$ans"
8447         ;;
8448 esac
8449
8450 : see if we can have long filenames
8451 echo " "
8452 first=123456789abcdef
8453 $rm -f $first
8454 if (echo hi >$first) 2>/dev/null; then
8455         if $test -f 123456789abcde; then
8456                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8457                 val="$undef"
8458         else
8459                 echo 'You can have filenames longer than 14 characters.'>&4
8460                 val="$define"
8461         fi
8462 else
8463         $cat <<'EOM'
8464 You can't have filenames longer than 14 chars.
8465 You can't even think about them!
8466 EOM
8467         val="$undef"
8468 fi
8469 set d_flexfnam
8470 eval $setvar
8471 $rm -rf 123456789abcde*
8472
8473 : determine where library module manual pages go
8474 set man3dir man3dir none
8475 eval $prefixit
8476 $cat <<EOM
8477
8478 $spackage has manual pages for many of the library modules.
8479 EOM
8480
8481 case "$nroff" in
8482 nroff)
8483         $cat <<'EOM'
8484 However, you don't have nroff, so they're probably useless to you.
8485 EOM
8486         case "$man3dir" in
8487         '') man3dir="none";;
8488         esac;;
8489 esac
8490
8491 case "$d_flexfnam" in
8492 undef)
8493         $cat <<'EOM'
8494 However, your system can't handle the long file names like File::Basename.3.
8495 EOM
8496         case "$man3dir" in
8497         '') man3dir="none";;
8498         esac;;
8499 esac
8500
8501 echo "If you don't want the manual sources installed, answer 'none'."
8502 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8503 case "$man3dir" in
8504 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8505         if $test -d "$privlib/man/man3"; then
8506                 cat <<EOM >&4
8507
8508 WARNING:  Previous versions of perl installed man3 pages into
8509 $privlib/man/man3.  This version will suggest a
8510 new default of $dflt.
8511 EOM
8512                 tdflt=$dflt
8513                 dflt='n'
8514                 rp='Do you wish to preserve the old behavior?(y/n)'
8515                 . ./myread
8516                 case "$ans" in
8517                 y*) dflt="$privlib/man/man3" ;;
8518                 *)  dflt=$tdflt ;;
8519                 esac
8520     fi
8521         ;;
8522 *)      dflt="$man3dir" ;;
8523 esac
8524 case "$dflt" in
8525 ' ') dflt=none ;;
8526 esac
8527 echo " "
8528 fn=dn+~
8529 rp="Where do the $package library man pages (source) go?"
8530 . ./getfile
8531 prefixvar=man3dir
8532 . ./setprefixvar
8533
8534 case "$man3dir" in
8535 '')     man3dir=' '
8536         installman3dir='';;
8537 esac
8538
8539 : What suffix to use on installed man pages
8540 case "$man3dir" in
8541 ' ')
8542         man3ext='0'
8543         ;;
8544 *)
8545         rp="What suffix should be used for the $package library man pages?"
8546         case "$man3ext" in
8547         '')     case "$man3dir" in
8548                 *3)  dflt=3 ;;
8549                 *3p) dflt=3p ;;
8550                 *3pm) dflt=3pm ;;
8551                 *l) dflt=l;;
8552                 *n) dflt=n;;
8553                 *o) dflt=o;;
8554                 *p) dflt=p;;
8555                 *C) dflt=C;;
8556                 *L) dflt=L;;
8557                 *L3) dflt=L3;;
8558                 *) dflt=3;;
8559                 esac
8560                 ;;
8561         *)      dflt="$man3ext";;
8562         esac
8563         . ./myread
8564         man3ext="$ans"
8565         ;;
8566 esac
8567
8568 : see if we have to deal with yellow pages, now NIS.
8569 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8570         if $test -f /usr/etc/nibindd; then
8571                 echo " "
8572                 echo "I'm fairly confident you're on a NeXT."
8573                 echo " "
8574                 rp='Do you get the hosts file via NetInfo?'
8575                 dflt=y
8576                 case "$hostcat" in
8577                 nidump*) ;;
8578                 '') ;;
8579                 *) dflt=n;;
8580                 esac
8581                 . ./myread
8582                 case "$ans" in
8583                 y*) hostcat='nidump hosts .';;
8584                 *)      case "$hostcat" in
8585                         nidump*) hostcat='';;
8586                         esac
8587                         ;;
8588                 esac
8589         fi
8590         case "$hostcat" in
8591         nidump*) ;;
8592         *)
8593                 case "$hostcat" in
8594                 *ypcat*) dflt=y;;
8595                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8596                                 dflt=y
8597                         else
8598                                 dflt=n
8599                         fi;;
8600                 *) dflt=n;;
8601                 esac
8602                 echo " "
8603                 rp='Are you getting the hosts file via yellow pages?'
8604                 . ./myread
8605                 case "$ans" in
8606                 y*) hostcat='ypcat hosts';;
8607                 *) hostcat='cat /etc/hosts';;
8608                 esac
8609                 ;;
8610         esac
8611 fi
8612 case "$hostcat" in
8613 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8614 esac
8615 case "$groupcat" in
8616 '') test -f /etc/group && groupcat='cat /etc/group';;
8617 esac
8618 case "$passcat" in
8619 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8620 esac
8621
8622 : now get the host name
8623 echo " "
8624 echo "Figuring out host name..." >&4
8625 case "$myhostname" in
8626 '') cont=true
8627         echo 'Maybe "hostname" will work...'
8628         if tans=`sh -c hostname 2>&1` ; then
8629                 myhostname=$tans
8630                 phostname=hostname
8631                 cont=''
8632         fi
8633         ;;
8634 *) cont='';;
8635 esac
8636 if $test "$cont"; then
8637         if ./xenix; then
8638                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8639                 if tans=`cat /etc/systemid 2>&1` ; then
8640                         myhostname=$tans
8641                         phostname='cat /etc/systemid'
8642                         echo "Whadyaknow.  Xenix always was a bit strange..."
8643                         cont=''
8644                 fi
8645         elif $test -r /etc/systemid; then
8646                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8647         fi
8648 fi
8649 if $test "$cont"; then
8650         echo 'No, maybe "uuname -l" will work...'
8651         if tans=`sh -c 'uuname -l' 2>&1` ; then
8652                 myhostname=$tans
8653                 phostname='uuname -l'
8654         else
8655                 echo 'Strange.  Maybe "uname -n" will work...'
8656                 if tans=`sh -c 'uname -n' 2>&1` ; then
8657                         myhostname=$tans
8658                         phostname='uname -n'
8659                 else
8660                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8661                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8662                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8663                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8664                         else
8665                                 case "$myhostname" in
8666                                 '') echo "Does this machine have an identity crisis or something?"
8667                                         phostname='';;
8668                                 *)
8669                                         echo "Well, you said $myhostname before..."
8670                                         phostname='echo $myhostname';;
8671                                 esac
8672                         fi
8673                 fi
8674         fi
8675 fi
8676 case "$myhostname" in
8677 '') myhostname=noname ;;
8678 esac
8679 : you do not want to know about this
8680 set $myhostname
8681 myhostname=$1
8682
8683 : verify guess
8684 if $test "$myhostname" ; then
8685         dflt=y
8686         rp='Your host name appears to be "'$myhostname'".'" Right?"
8687         . ./myread
8688         case "$ans" in
8689         y*) ;;
8690         *) myhostname='';;
8691         esac
8692 fi
8693
8694 : bad guess or no guess
8695 while $test "X$myhostname" = X ; do
8696         dflt=''
8697         rp="Please type the (one word) name of your host:"
8698         . ./myread
8699         myhostname="$ans"
8700 done
8701
8702 : translate upper to lower if necessary
8703 case "$myhostname" in
8704 *[A-Z]*)
8705         echo "(Normalizing case in your host name)"
8706         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8707         ;;
8708 esac
8709
8710 case "$myhostname" in
8711 *.*)
8712         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8713         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8714         echo "(Trimming domain name from host name--host name is now $myhostname)"
8715         ;;
8716 *) case "$mydomain" in
8717         '')
8718                 {
8719                         test "X$hostcat" = "Xypcat hosts" &&
8720                         ypmatch "$myhostname" hosts 2>/dev/null |\
8721                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8722                         $test -s hosts
8723                 } || {
8724                         test "X$hostcat" != "X" &&
8725                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8726                                         /[       ]$myhostname[  . ]/p" > hosts
8727                 }
8728                 tmp_re="[       . ]"
8729                 if $test -f hosts; then
8730                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8731                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8732                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8733                                 hosts | $sort | $uniq | \
8734                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8735                         case `$echo X$dflt` in
8736                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8737                                 dflt=.
8738                                 ;;
8739                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8740                                 ;;
8741                         esac
8742                 else
8743                         echo "(I cannot locate a hosts database anywhere)"
8744                         dflt=.
8745                 fi
8746                 case "$dflt" in
8747                 .)
8748                         tans=`./loc resolv.conf X /etc /usr/etc`
8749                         if $test -f "$tans"; then
8750                                 echo "(Attempting domain name extraction from $tans)"
8751                                 dflt=.`$sed -n -e 's/   / /g' \
8752                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8753                                   -e 1q 2>/dev/null`
8754                                 case "$dflt" in
8755                                 .) dflt=.`$sed -n -e 's/        / /g' \
8756                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8757                                      -e 1q 2>/dev/null`
8758                                         ;;
8759                                 esac
8760                         fi
8761                         ;;
8762                 esac
8763                 case "$dflt" in
8764                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8765                         dflt=.`sh -c domainname 2>/dev/null`
8766                         case "$dflt" in
8767                         '') dflt='.';;
8768                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8769                         esac
8770                         ;;
8771                 esac
8772                 case "$dflt$osname" in
8773                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8774                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8775                         ;;
8776                 esac
8777                 case "$dflt" in
8778                 .) echo "(Lost all hope -- silly guess then)"
8779                         dflt='.nonet'
8780                         ;;
8781                 esac
8782                 $rm -f hosts
8783                 ;;
8784         *) dflt="$mydomain";;
8785         esac;;
8786 esac
8787 echo " "
8788 rp="What is your domain name?"
8789 . ./myread
8790 tans="$ans"
8791 case "$ans" in
8792 '') ;;
8793 .*) ;;
8794 *) tans=".$tans";;
8795 esac
8796 mydomain="$tans"
8797
8798 : translate upper to lower if necessary
8799 case "$mydomain" in
8800 *[A-Z]*)
8801         echo "(Normalizing case in your domain name)"
8802         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8803         ;;
8804 esac
8805
8806 : a little sanity check here
8807 case "$phostname" in
8808 '') ;;
8809 *)
8810         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8811         $myhostname$mydomain|$myhostname) ;;
8812         *)
8813                 case "$phostname" in
8814                 sed*)
8815                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8816                         ;;
8817                 *)
8818                         echo "(That doesn't agree with your $phostname command, by the way.)"
8819                         ;;
8820                 esac
8821         ;;
8822         esac
8823         ;;
8824 esac
8825
8826 : determine the e-mail address of the user who is running us
8827 $cat <<EOM
8828
8829 I need to get your e-mail address in Internet format if possible, i.e.
8830 something like user@host.domain. Please answer accurately since I have
8831 no easy means to double check it. The default value provided below
8832 is most probably close to reality but may not be valid from outside
8833 your organization...
8834
8835 EOM
8836 cont=x
8837 while test "$cont"; do
8838         case "$cf_email" in
8839         '') dflt="$cf_by@$myhostname$mydomain";;
8840         *) dflt="$cf_email";;
8841         esac
8842         rp='What is your e-mail address?'
8843         . ./myread
8844         cf_email="$ans"
8845         case "$cf_email" in
8846         *@*.*) cont='' ;;
8847         *)
8848                 rp='Address does not look like an Internet one.  Use it anyway?'
8849                 case "$fastread" in
8850                 yes) dflt=y ;;
8851                 *) dflt=n ;;
8852                 esac
8853                 . ./myread
8854                 case "$ans" in
8855                 y*) cont='' ;;
8856                 *) echo " " ;;
8857                 esac
8858                 ;;
8859         esac
8860 done
8861
8862 : Ask e-mail of administrator
8863 $cat <<EOM
8864
8865 If you or somebody else will be maintaining perl at your site, please
8866 fill in the correct e-mail address here so that they may be contacted
8867 if necessary. Currently, the "perlbug" program included with perl
8868 will send mail to this address in addition to perlbug@perl.org. You may
8869 enter "none" for no administrator.
8870
8871 EOM
8872 case "$perladmin" in
8873 '') dflt="$cf_email";;
8874 *) dflt="$perladmin";;
8875 esac
8876 rp='Perl administrator e-mail address'
8877 . ./myread
8878 perladmin="$ans"
8879
8880 : determine whether to only install version-specific parts.
8881 echo " "
8882 $cat <<EOM
8883 Do you want to install only the version-specific parts of the perl
8884 distribution?  Usually you do *not* want to do this.
8885 EOM
8886 case "$versiononly" in
8887 "$define"|[Yy]*|true) dflt='y' ;;
8888 *) dflt='n';
8889 esac
8890 rp="Do you want to install only the version-specific parts of perl?"
8891 . ./myread
8892 case "$ans" in
8893 [yY]*)  val="$define";;
8894 *)      val="$undef" ;;
8895 esac
8896 set versiononly
8897 eval $setvar
8898
8899 case "$versiononly" in
8900 "$define") inc_version_list=''
8901            inc_version_list_init=0
8902            ;;
8903 esac
8904
8905 : figure out how to guarantee perl startup
8906 : XXX Note that this currently takes advantage of the bug that binexp ignores
8907 :     the Configure -Dinstallprefix setting, which in turn means that under
8908 :     relocatable @INC, initialinstalllocation is what binexp started as.
8909 case "$startperl" in
8910 '')
8911         case "$sharpbang" in
8912         *!)
8913                 $cat <<EOH
8914
8915 I can use the #! construct to start perl on your system. This will
8916 make startup of perl scripts faster, but may cause problems if you
8917 want to share those scripts and perl is not in a standard place
8918 ($initialinstalllocation/perl) on all your platforms. The alternative
8919 is to force a shell by starting the script with a single ':' character.
8920
8921 EOH
8922                 case "$versiononly" in
8923                 "$define")      dflt="$initialinstalllocation/perl$version";;
8924                 *)              dflt="$initialinstalllocation/perl";;
8925                 esac
8926                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8927                 . ./myread
8928                 case "$ans" in
8929                 none)   startperl=": # use perl";;
8930                 *)      startperl="#!$ans"
8931                         if $test 30 -lt `echo "$ans" | wc -c`; then
8932                                 $cat >&4 <<EOM
8933
8934 WARNING:  Some systems limit the #! command to 32 characters.
8935 If you experience difficulty running Perl scripts with #!, try
8936 installing Perl in a directory with a shorter pathname.
8937
8938 EOM
8939                         fi ;;
8940                 esac
8941                 ;;
8942         *) startperl=": # use perl"
8943                 ;;
8944         esac
8945         ;;
8946 esac
8947 echo "I'll use $startperl to start perl scripts."
8948
8949 : figure best path for perl in scripts
8950 case "$perlpath" in
8951 '')
8952         case "$versiononly" in
8953         "$define")      perlpath="$initialinstalllocation/perl$version";;
8954         *)              perlpath="$initialinstalllocation/perl";;
8955         esac
8956         case "$startperl" in
8957         *!*) ;;
8958         *)
8959                 $cat <<EOH
8960
8961 I will use the "eval 'exec'" idiom to start Perl on your system.
8962 I can use the full path of your Perl binary for this purpose, but
8963 doing so may cause problems if you want to share those scripts and
8964 Perl is not always in a standard place ($initialinstalllocation/perl).
8965
8966 EOH
8967                 dflt="$initialinstalllocation/perl"
8968                 rp="What path shall I use in \"eval 'exec'\"?"
8969                 . ./myread
8970                 perlpath="$ans"
8971                 ;;
8972         esac
8973         ;;
8974 esac
8975 case "$startperl" in
8976 *!*)    ;;
8977 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8978 esac
8979
8980 : determine where public executable scripts go
8981 set scriptdir scriptdir
8982 eval $prefixit
8983 case "$scriptdir" in
8984 '')
8985         dflt="$bin"
8986         : guess some guesses
8987         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8988         $test -d /usr/share/bin     && dflt=/usr/share/bin
8989         $test -d /usr/local/script  && dflt=/usr/local/script
8990         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8991         $test -d $prefixexp/script  && dflt=$prefixexp/script
8992         set dflt
8993         eval $prefixup
8994         ;;
8995 *)  dflt="$scriptdir"
8996         ;;
8997 esac
8998 $cat <<EOM
8999
9000 Some installations have a separate directory just for executable scripts so
9001 that they can mount it across multiple architectures but keep the scripts in
9002 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9003 Or you might just lump your scripts in with all your other executables.
9004
9005 EOM
9006 fn=d~
9007 rp='Where do you keep publicly executable scripts?'
9008 . ./getfile
9009 if $test "X$ansexp" != "X$scriptdirexp"; then
9010         installscript=''
9011 fi
9012 installscriptdir=''
9013 prefixvar=scriptdir
9014 . ./setprefixvar
9015 : A little fix up for an irregularly named variable.
9016 installscript="$installscriptdir"
9017
9018 : determine where add-on public executables go
9019 case "$sitebin" in
9020 '')     dflt=$siteprefix/bin ;;
9021 *)      dflt=$sitebin ;;
9022 esac
9023 fn=d~
9024 rp='Pathname where the add-on public executables should be installed?'
9025 . ./getfile
9026 prefixvar=sitebin
9027 . ./setprefixvar
9028
9029 : determine where add-on html pages go
9030 : There is no standard location, so try to copy the previously-selected
9031 : directory structure for the core html pages.
9032 case "$sitehtml1dir" in
9033 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9034 *)     dflt=$sitehtml1dir ;;
9035 esac
9036 case "$dflt" in
9037 ''|' ') dflt=none ;;
9038 esac
9039 fn=dn+~
9040 rp='Pathname where the site-specific html pages should be installed?'
9041 . ./getfile
9042 prefixvar=sitehtml1dir
9043 . ./setprefixvar
9044
9045 : determine where add-on library html pages go
9046 : There is no standard location, so try to copy the previously-selected
9047 : directory structure for the core html pages.
9048 case "$sitehtml3dir" in
9049 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9050 *)     dflt=$sitehtml3dir ;;
9051 esac
9052 case "$dflt" in
9053 ''|' ') dflt=none ;;
9054 esac
9055 fn=dn+~
9056 rp='Pathname where the site-specific library html pages should be installed?'
9057 . ./getfile
9058 prefixvar=sitehtml3dir
9059 . ./setprefixvar
9060
9061 : determine where add-on manual pages go
9062 case "$siteman1dir" in
9063 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9064 *)      dflt=$siteman1dir ;;
9065 esac
9066 case "$dflt" in
9067 ''|' ') dflt=none ;;
9068 esac
9069 fn=dn+~
9070 rp='Pathname where the site-specific manual pages should be installed?'
9071 . ./getfile
9072 prefixvar=siteman1dir
9073 . ./setprefixvar
9074
9075 : determine where add-on library man pages go
9076 case "$siteman3dir" in
9077 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9078 *)      dflt=$siteman3dir ;;
9079 esac
9080 case "$dflt" in
9081 ''|' ') dflt=none ;;
9082 esac
9083 fn=dn+~
9084 rp='Pathname where the site-specific library manual pages should be installed?'
9085 . ./getfile
9086 prefixvar=siteman3dir
9087 . ./setprefixvar
9088
9089 : determine where add-on public executable scripts go
9090 case "$sitescript" in
9091 '')     dflt=$siteprefix/script
9092         $test -d $dflt || dflt=$sitebin ;;
9093 *)  dflt="$sitescript" ;;
9094 esac
9095 fn=d~+
9096 rp='Pathname where add-on public executable scripts should be installed?'
9097 . ./getfile
9098 prefixvar=sitescript
9099 . ./setprefixvar
9100
9101 : Check if faststdio is requested and available
9102 case "$usefaststdio" in
9103 $define|true|[yY]*|'')
9104         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9105         case "$xversion" in
9106         [68])   dflt='y' ;;
9107         *)      dflt='n' ;;
9108         esac
9109         ;;
9110 *) dflt='n';;
9111 esac
9112 cat <<EOM
9113
9114 Perl can be built to use 'fast stdio', which means using the stdio
9115 library but also directly manipulating the stdio buffers to enable
9116 faster I/O.  Using stdio is better for backward compatibility (especially
9117 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9118 interface has been preferred instead of stdio.
9119
9120 If this doesn't make any sense to you, just accept the default '$dflt'.
9121 EOM
9122 rp='Use the "fast stdio" if available?'
9123 . ./myread
9124 case "$ans" in
9125 y|Y)    val="$define" ;;
9126 *)      val="$undef" ;;
9127 esac
9128 set usefaststdio
9129 eval $setvar
9130
9131
9132 : define an is-a-typedef? function
9133 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9134 case "$inclist" in
9135 "") inclist="sys/types.h";;
9136 esac;
9137 eval "varval=\$$var";
9138 case "$varval" in
9139 "")
9140         $rm -f temp.c;
9141         for inc in $inclist; do
9142                 echo "#include <$inc>" >>temp.c;
9143         done;
9144         echo "#ifdef $type" >> temp.c;
9145         echo "printf(\"We have $type\");" >> temp.c;
9146         echo "#endif" >> temp.c;
9147         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9148         if $contains $type temp.E >/dev/null 2>&1; then
9149                 eval "$var=\$type";
9150         else
9151                 eval "$var=\$def";
9152         fi;
9153         $rm -f temp.?;;
9154 *) eval "$var=\$varval";;
9155 esac'
9156
9157 : define an is-a-typedef? function that prompts if the type is not available.
9158 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9159 case "$inclist" in
9160 "") inclist="sys/types.h";;
9161 esac;
9162 eval "varval=\$$var";
9163 case "$varval" in
9164 "")
9165         $rm -f temp.c;
9166         for inc in $inclist; do
9167                 echo "#include <$inc>" >>temp.c;
9168         done;
9169         echo "#ifdef $type" >> temp.c;
9170         echo "printf(\"We have $type\");" >> temp.c;
9171         echo "#endif" >> temp.c;
9172         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9173         echo " " ;
9174         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9175         if $contains $type temp.E >/dev/null 2>&1; then
9176                 echo "$type found." >&4;
9177                 eval "$var=\$type";
9178         else
9179                 echo "$type NOT found." >&4;
9180                 dflt="$def";
9181                 . ./myread ;
9182                 eval "$var=\$ans";
9183         fi;
9184         $rm -f temp.?;;
9185 *) eval "$var=\$varval";;
9186 esac'
9187
9188 : see what type lseek is declared as in the kernel
9189 rp="What is the type used for lseek's offset on this system?"
9190 set off_t lseektype long stdio.h sys/types.h
9191 eval $typedef_ask
9192
9193 echo " "
9194 echo "Checking to see how big your file offsets are..." >&4
9195 $cat >try.c <<EOCP
9196 #include <sys/types.h>
9197 #include <stdio.h>
9198 int main()
9199 {
9200     printf("%d\n", (int)sizeof($lseektype));
9201     return(0);
9202 }
9203 EOCP
9204 set try
9205 if eval $compile_ok; then
9206         lseeksize=`$run ./try`
9207         echo "Your file offsets are $lseeksize bytes long."
9208 else
9209         dflt=$longsize
9210         echo " "
9211         echo "(I can't seem to compile the test program.  Guessing...)"
9212         rp="What is the size of your file offsets (in bytes)?"
9213         . ./myread
9214         lseeksize="$ans"
9215 fi
9216 $rm_try
9217
9218 : see what type file positions are declared as in the library
9219 rp="What is the type for file position used by fsetpos()?"
9220 set fpos_t fpostype long stdio.h sys/types.h
9221 eval $typedef_ask
9222
9223 : Check size for Fpos_t
9224 echo " "
9225 case "$fpostype" in
9226 *_t) zzz="$fpostype"    ;;
9227 *)   zzz="fpos_t"       ;;
9228 esac
9229 echo "Checking the size of $zzz..." >&4
9230 cat > try.c <<EOCP
9231 #include <sys/types.h>
9232 #include <stdio.h>
9233 #$i_stdlib I_STDLIB
9234 #ifdef I_STDLIB
9235 #include <stdlib.h>
9236 #endif
9237 int main() {
9238     printf("%d\n", (int)sizeof($fpostype));
9239     exit(0);
9240 }
9241 EOCP
9242 set try
9243 if eval $compile_ok; then
9244         yyy=`$run ./try`
9245         case "$yyy" in
9246         '')     fpossize=4
9247                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9248                 ;;
9249         *)      fpossize=$yyy
9250                 echo "Your $zzz is $fpossize bytes long."
9251                 ;;
9252         esac
9253 else
9254         dflt="$longsize"
9255         echo " " >&4
9256         echo "(I can't compile the test program.  Guessing...)" >&4
9257         rp="What is the size of your file positions (in bytes)?"
9258         . ./myread
9259         fpossize="$ans"
9260 fi
9261
9262 : Check for large file support
9263 # Backward compatibility (uselfs is deprecated).
9264 case "$uselfs" in
9265 "$define"|true|[yY]*)
9266         cat <<EOM >&4
9267
9268 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9269 EOM
9270         uselargefiles="$define"
9271         ;;
9272 esac
9273
9274 case "$lseeksize:$fpossize" in
9275 8:8) cat <<EOM
9276
9277 You can have files larger than 2 gigabytes.
9278 EOM
9279    val="$define" ;;
9280 *)    case "$uselargefiles" in
9281    "$undef"|false|[nN]*) dflt='n' ;;
9282    *)   dflt='y' ;;
9283    esac
9284    cat <<EOM
9285
9286 Perl can be built to understand large files (files larger than 2 gigabytes)
9287 on some systems.  To do so, Configure can be run with -Duselargefiles.
9288
9289 If this doesn't make any sense to you, just accept the default '$dflt'.
9290 EOM
9291    rp='Try to understand large files, if available?'
9292    . ./myread
9293    case "$ans" in
9294    y|Y)         val="$define" ;;
9295    *)           val="$undef"  ;;
9296    esac
9297    ;;
9298 esac
9299 set uselargefiles
9300 eval $setvar
9301 : Look for a hint-file generated 'call-back-unit'.  If the
9302 : user has specified that a large files perl is to be built,
9303 : we may need to set or change some other defaults.
9304 if $test -f uselargefiles.cbu; then
9305         echo "Your platform has some specific hints regarding large file builds, using them..."
9306         . ./uselargefiles.cbu
9307 fi
9308 case "$uselargefiles" in
9309 "$define")
9310         if $test -f uselargefiles.cbu; then
9311                 echo " "
9312                 echo "Rechecking to see how big your file offsets are..." >&4
9313                 $cat >try.c <<EOCP
9314 #include <sys/types.h>
9315 #include <stdio.h>
9316 int main()
9317 {
9318     printf("%d\n", (int)sizeof($lseektype));
9319     return(0);
9320 }
9321 EOCP
9322                 set try
9323                 if eval $compile_ok; then
9324                         lseeksize=`$run ./try`
9325                         $echo "Your file offsets are now $lseeksize bytes long."
9326                 else
9327                         dflt="$lseeksize"
9328                         echo " "
9329                         echo "(I can't seem to compile the test program.  Guessing...)"
9330                         rp="What is the size of your file offsets (in bytes)?"
9331                         . ./myread
9332                         lseeksize="$ans"
9333                 fi
9334                 case "$fpostype" in
9335                 *_t) zzz="$fpostype"    ;;
9336                 *)   zzz="fpos_t"       ;;
9337                 esac
9338                 $echo $n "Rechecking the size of $zzz...$c" >&4
9339                 $cat > try.c <<EOCP
9340 #include <sys/types.h>
9341 #include <stdio.h>
9342 #$i_stdlib I_STDLIB
9343 #ifdef I_STDLIB
9344 #include <stdlib.h>
9345 #endif
9346 int main() {
9347     printf("%d\n", (int)sizeof($fpostype));
9348     return(0);
9349 }
9350 EOCP
9351                 set try
9352                 if eval $compile_ok; then
9353                         yyy=`$run ./try`
9354                         dflt="$lseeksize"
9355                         case "$yyy" in
9356                         '')     echo " "
9357                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9358                                 ;;
9359                         *)      fpossize=$yyy
9360                                 echo " $fpossize bytes." >&4
9361                                 ;;
9362                         esac
9363                 else
9364                         dflt="$fpossize"
9365                         echo " "
9366                         echo "(I can't compile the test program.  Guessing...)" >&4
9367                         rp="What is the size of your file positions (in bytes)?"
9368                         . ./myread
9369                         fpossize="$ans"
9370                 fi
9371                 $rm_try
9372         fi
9373         ;;
9374 esac
9375
9376 : Check if we want perlio
9377 useperlio="$define"
9378
9379 : Set the vendorbin variables
9380 case "$vendorprefix" in
9381 '')     d_vendorbin="$undef"
9382         vendorbin=''
9383         vendorbinexp=''
9384         ;;
9385 *)      d_vendorbin="$define"
9386         : determine where vendor-supplied executables go.
9387         case "$vendorbin" in
9388         '') dflt=$vendorprefix/bin ;;
9389         *)      dflt="$vendorbin" ;;
9390         esac
9391         fn=d~+
9392         rp='Pathname for the vendor-supplied executables directory?'
9393         . ./getfile
9394         vendorbin="$ans"
9395         vendorbinexp="$ansexp"
9396         ;;
9397 esac
9398 prefixvar=vendorbin
9399 . ./installprefix
9400
9401 : Set the vendorhtml1dir variables
9402 case "$vendorprefix" in
9403 '')     vendorhtml1dir=''
9404         vendorhtml1direxp=''
9405         ;;
9406 *)      : determine where vendor-supplied html pages go.
9407         : There is no standard location, so try to copy the previously-selected
9408         : directory structure for the core html pages.
9409         : XXX Better default suggestions would be welcome.
9410         case "$vendorhtml1dir" in
9411         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9412         *)      dflt=$vendorhtml1dir ;;
9413         esac
9414         case "$dflt" in
9415         ''|' ') dflt=none ;;
9416         esac
9417         fn=dn+~
9418         rp='Pathname for the vendor-supplied html pages?'
9419         . ./getfile
9420         vendorhtml1dir="$ans"
9421         vendorhtml1direxp="$ansexp"
9422         ;;
9423 esac
9424 : Use ' ' for none so value is preserved next time through Configure
9425 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9426 prefixvar=vendorhtml1dir
9427 . ./installprefix
9428
9429 : Set the vendorhtml3dir variables
9430 case "$vendorprefix" in
9431 '')     vendorhtml3dir=''
9432         vendorhtml3direxp=''
9433         ;;
9434 *)      : determine where vendor-supplied module html pages go.
9435         : There is no standard location, so try to copy the previously-selected
9436         : directory structure for the core html pages.
9437         : XXX Better default suggestions would be welcome.
9438         case "$vendorhtml3dir" in
9439         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9440         *)      dflt=$vendorhtml3dir ;;
9441         esac
9442         case "$dflt" in
9443         ''|' ') dflt=none ;;
9444         esac
9445         fn=dn+~
9446         rp='Pathname for the vendor-supplied html pages?'
9447         . ./getfile
9448         vendorhtml3dir="$ans"
9449         vendorhtml3direxp="$ansexp"
9450         ;;
9451 esac
9452 : Use ' ' for none so value is preserved next time through Configure
9453 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9454 prefixvar=vendorhtml3dir
9455 . ./installprefix
9456
9457 : Set the vendorman1dir variables
9458 case "$vendorprefix" in
9459 '')     vendorman1dir=''
9460         vendorman1direxp=''
9461         ;;
9462 *)      : determine where vendor-supplied manual pages go.
9463         case "$vendorman1dir" in
9464         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9465         *)      dflt=$vendorman1dir ;;
9466         esac
9467         case "$dflt" in
9468         ''|' ') dflt=none ;;
9469         esac
9470         fn=nd~+
9471         rp='Pathname for the vendor-supplied manual section 1 pages?'
9472         . ./getfile
9473         vendorman1dir="$ans"
9474         vendorman1direxp="$ansexp"
9475         ;;
9476 esac
9477 : Use ' ' for none so value is preserved next time through Configure
9478 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9479 prefixvar=vendorman1dir
9480 . ./installprefix
9481
9482 : Set the vendorman3dir variables
9483 case "$vendorprefix" in
9484 '')     vendorman3dir=''
9485         vendorman3direxp=''
9486         ;;
9487 *)      : determine where vendor-supplied module manual pages go.
9488         case "$vendorman3dir" in
9489         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9490         *)      dflt=$vendorman3dir ;;
9491         esac
9492         case "$dflt" in
9493         ''|' ') dflt=none ;;
9494         esac
9495         fn=nd~+
9496         rp='Pathname for the vendor-supplied manual section 3 pages?'
9497         . ./getfile
9498         vendorman3dir="$ans"
9499         vendorman3direxp="$ansexp"
9500         ;;
9501 esac
9502 : Use ' ' for none so value is preserved next time through Configure
9503 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9504 prefixvar=vendorman3dir
9505 . ./installprefix
9506
9507 : Set the vendorscript variables
9508 case "$vendorprefix" in
9509 '')     d_vendorscript="$undef"
9510         vendorscript=''
9511         vendorscriptexp=''
9512         ;;
9513 *)      d_vendorscript="$define"
9514         : determine where vendor-supplied scripts go.
9515         case "$vendorscript" in
9516         '')     dflt=$vendorprefix/script
9517                 $test -d $dflt || dflt=$vendorbin ;;
9518         *)  dflt="$vendorscript" ;;
9519         esac
9520         $cat <<EOM
9521
9522 The installation process will create a directory for
9523 vendor-supplied scripts.
9524
9525 EOM
9526         fn=d~+
9527         rp='Pathname for the vendor-supplied scripts directory?'
9528         . ./getfile
9529         vendorscript="$ans"
9530         vendorscriptexp="$ansexp"
9531         ;;
9532 esac
9533 prefixvar=vendorscript
9534 . ./installprefix
9535
9536 : script used to emit important warnings
9537 cat >warn <<EOS
9538 $startsh
9539 if test \$# -gt 0; then
9540         echo "\$@" >msg
9541 else
9542         cat >msg
9543 fi
9544 echo "*** WARNING:" >&4
9545 sed -e 's/^/*** /' <msg >&4
9546 echo "*** " >&4
9547 cat msg >>config.msg
9548 echo " " >>config.msg
9549 rm -f msg
9550 EOS
9551 chmod +x warn
9552 $eunicefix warn
9553
9554 : see which of string.h or strings.h is needed
9555 echo " "
9556 strings=`./findhdr string.h`
9557 if $test "$strings" && $test -r "$strings"; then
9558         echo "Using <string.h> instead of <strings.h>." >&4
9559         val="$define"
9560 else
9561         val="$undef"
9562         strings=`./findhdr strings.h`
9563         if $test "$strings" && $test -r "$strings"; then
9564                 echo "Using <strings.h> instead of <string.h>." >&4
9565         else
9566                 ./warn "No string header found -- You'll surely have problems."
9567         fi
9568 fi
9569 set i_string
9570 eval $setvar
9571 case "$i_string" in
9572 "$undef") strings=`./findhdr strings.h`;;
9573 *)        strings=`./findhdr string.h`;;
9574 esac
9575
9576 : see if qgcvt exists
9577 set qgcvt d_qgcvt
9578 eval $inlibc
9579
9580 : Check print/scan long double stuff
9581 echo " "
9582
9583 if $test X"$d_longdbl" = X"$define"; then
9584
9585 echo "Checking how to print long doubles..." >&4
9586
9587 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9588         $cat >try.c <<'EOCP'
9589 #include <sys/types.h>
9590 #include <stdio.h>
9591 int main() {
9592   double d = 123.456;
9593   printf("%.3f\n", d);
9594 }
9595 EOCP
9596         set try
9597         if eval $compile; then
9598                 yyy=`$run ./try`
9599                 case "$yyy" in
9600                 123.456)
9601                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9602                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9603                         echo "We will use %f."
9604                         ;;
9605                 esac
9606         fi
9607 fi
9608
9609 if $test X"$sPRIfldbl" = X; then
9610         $cat >try.c <<'EOCP'
9611 #include <sys/types.h>
9612 #include <stdio.h>
9613 int main() {
9614   long double d = 123.456;
9615   printf("%.3Lf\n", d);
9616 }
9617 EOCP
9618         set try
9619         if eval $compile; then
9620                 yyy=`$run ./try`
9621                 case "$yyy" in
9622                 123.456)
9623                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9624                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9625                         echo "We will use %Lf."
9626                         ;;
9627                 esac
9628         fi
9629 fi
9630
9631 if $test X"$sPRIfldbl" = X; then
9632         $cat >try.c <<'EOCP'
9633 #include <sys/types.h>
9634 #include <stdio.h>
9635 int main() {
9636   long double d = 123.456;
9637   printf("%.3llf\n", d);
9638 }
9639 EOCP
9640         set try
9641         if eval $compile; then
9642                 yyy=`$run ./try`
9643                 case "$yyy" in
9644                 123.456)
9645                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9646                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9647                         echo "We will use %llf."
9648                         ;;
9649                 esac
9650         fi
9651 fi
9652
9653 if $test X"$sPRIfldbl" = X; then
9654         $cat >try.c <<'EOCP'
9655 #include <sys/types.h>
9656 #include <stdio.h>
9657 int main() {
9658   long double d = 123.456;
9659   printf("%.3lf\n", d);
9660 }
9661 EOCP
9662         set try
9663         if eval $compile; then
9664                 yyy=`$run ./try`
9665                 case "$yyy" in
9666                 123.456)
9667                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9668                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9669                         echo "We will use %lf."
9670                         ;;
9671                 esac
9672         fi
9673 fi
9674
9675 if $test X"$sPRIfldbl" = X; then
9676         echo "Cannot figure out how to print long doubles." >&4
9677 else
9678         sSCNfldbl=$sPRIfldbl    # expect consistency
9679 fi
9680
9681 $rm_try
9682
9683 fi # d_longdbl
9684
9685 case "$sPRIfldbl" in
9686 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9687         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9688         d_SCNfldbl="$undef";
9689         ;;
9690 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9691         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9692         d_SCNfldbl="$define";
9693         ;;
9694 esac
9695
9696 : Check how to convert floats to strings.
9697
9698 if test "X$d_Gconvert" = X; then
9699
9700 echo " "
9701 echo "Checking for an efficient way to convert floats to strings."
9702 echo " " > try.c
9703 case "$uselongdouble" in
9704 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9705 esac
9706 case "$d_longdbl" in
9707 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9708 esac
9709 case "$d_PRIgldbl" in
9710 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9711 esac
9712 $cat >>try.c <<EOP
9713 #ifdef TRY_gconvert
9714 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9715 char *myname = "gconvert";
9716 #endif
9717 #ifdef TRY_gcvt
9718 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9719 char *myname = "gcvt";
9720 #endif
9721 #ifdef TRY_qgcvt
9722 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9723 char *myname = "qgcvt";
9724 #define DOUBLETYPE long double
9725 #endif
9726 #ifdef TRY_sprintf
9727 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9728 #ifdef HAS_PRIgldbl
9729 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9730 #else
9731 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9732 #endif
9733 #else
9734 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9735 #endif
9736 char *myname = "sprintf";
9737 #endif
9738
9739 #ifndef DOUBLETYPE
9740 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9741 #define DOUBLETYPE long double
9742 #else
9743 #define DOUBLETYPE double
9744 #endif
9745 #endif
9746
9747 #include <stdio.h>
9748
9749 #$i_stdlib I_STDLIB
9750 #ifdef I_STDLIB
9751 #include <stdlib.h>
9752 #endif
9753 #$i_string I_STRING
9754 #ifdef I_STRING
9755 #  include <string.h>
9756 #else
9757 #  include <strings.h>
9758 #endif
9759
9760 int checkit(char *expect, char *got)
9761 {
9762     if (strcmp(expect, got)) {
9763                 printf("%s oddity:  Expected %s, got %s\n",
9764                         myname, expect, got);
9765                 exit(1);
9766         }
9767 }
9768
9769 int main()
9770 {
9771         char buf[64];
9772         buf[63] = '\0';
9773
9774         /* This must be 1st test on (which?) platform */
9775         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9776         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9777         checkit("0.1", buf);
9778
9779         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9780         checkit("0.01", buf);
9781
9782         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9783         checkit("0.001", buf);
9784
9785         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9786         checkit("0.0001", buf);
9787
9788         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9789         if (strlen(buf) > 5)
9790             checkit("9e-005", buf); /* for Microsoft ?? */
9791         else
9792             checkit("9e-05", buf);
9793
9794         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9795         checkit("1", buf);
9796
9797         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9798         checkit("1.1", buf);
9799
9800         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9801         checkit("1.01", buf);
9802
9803         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9804         checkit("1.001", buf);
9805
9806         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9807         checkit("1.0001", buf);
9808
9809         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9810         checkit("1.00001", buf);
9811
9812         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9813         checkit("1.000001", buf);
9814
9815         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9816         checkit("0", buf);
9817
9818         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9819         checkit("-1", buf);
9820
9821         /* Some Linux gcvt's give 1.e+5 here. */
9822         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9823         checkit("100000", buf);
9824
9825         /* Some Linux gcvt's give -1.e+5 here. */
9826         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9827         checkit("-100000", buf);
9828
9829         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9830         checkit("123.456", buf);
9831
9832         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9833         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9834         /* 34 should be enough to scare even long double
9835          * places into using the e notation. */
9836         if (strlen(buf) > 5)
9837             checkit("1e+034", buf); /* for Microsoft */
9838         else
9839             checkit("1e+34", buf);
9840
9841         /* For Perl, if you add additional tests here, also add them to
9842          * t/base/num.t for benefit of platforms not using Configure or
9843          * overriding d_Gconvert */
9844
9845         exit(0);
9846 }
9847 EOP
9848 : first add preferred functions to our list
9849 xxx_list=""
9850 for xxx_convert in $gconvert_preference; do
9851     case $xxx_convert in
9852     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9853     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9854     esac
9855 done
9856 : then add any others
9857 for xxx_convert in gconvert gcvt sprintf; do
9858     case "$xxx_list" in
9859     *$xxx_convert*) ;;
9860     *) xxx_list="$xxx_list $xxx_convert" ;;
9861     esac
9862 done
9863
9864 case "$d_longdbl$uselongdouble" in
9865 "$define$define")
9866     : again, add preferred functions to our list first
9867     xxx_ld_list=""
9868     for xxx_convert in $gconvert_ld_preference; do
9869         case $xxx_convert in
9870         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9871         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9872         esac
9873     done
9874     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9875     for xxx_convert in qgcvt sprintf $xxx_list; do
9876         case "$xxx_ld_list" in
9877         $xxx_convert*|*" $xxx_convert"*) ;;
9878         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9879         esac
9880     done
9881     : if sprintf cannot do long doubles, move it to the end
9882     if test "$d_PRIgldbl" != "$define"; then
9883         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9884     fi
9885     : if no qgcvt, remove it
9886     if test "$d_qgcvt" != "$define"; then
9887         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9888     fi
9889     : use the ld_list
9890     xxx_list="$xxx_ld_list"
9891     ;;
9892 esac
9893
9894 for xxx_convert in $xxx_list; do
9895         echo "Trying $xxx_convert..."
9896         $rm -f try try$_o core
9897         set try -DTRY_$xxx_convert
9898         if eval $compile; then
9899                 echo "$xxx_convert() found." >&4
9900                 if $run ./try; then
9901                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9902                         break;
9903                 else
9904                         echo "...But $xxx_convert didn't work as I expected."
9905                         xxx_convert=''
9906                 fi
9907         else
9908                 echo "$xxx_convert NOT found." >&4
9909         fi
9910 done
9911
9912 if test X$xxx_convert = X; then
9913     echo "*** WHOA THERE!!! ***" >&4
9914     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9915     xxx_convert=sprintf
9916 fi
9917
9918 case "$xxx_convert" in
9919 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9920 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9921 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9922 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9923    "$define$define$define")
9924       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9925    "$define$define$undef")
9926       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9927    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9928    esac
9929    ;;
9930 esac
9931
9932 fi
9933 $rm_try
9934
9935 : see if _fwalk exists
9936 set fwalk d__fwalk
9937 eval $inlibc
9938
9939 : Initialize h_fcntl
9940 h_fcntl=false
9941
9942 : Initialize h_sysfile
9943 h_sysfile=false
9944
9945 : access call always available on UNIX
9946 set access d_access
9947 eval $inlibc
9948
9949 : locate the flags for 'access()'
9950 case "$d_access" in
9951 "$define")
9952         echo " "
9953         $cat >access.c <<EOCP
9954 #include <sys/types.h>
9955 #ifdef I_FCNTL
9956 #include <fcntl.h>
9957 #endif
9958 #ifdef I_SYS_FILE
9959 #include <sys/file.h>
9960 #endif
9961 #ifdef I_UNISTD
9962 #include <unistd.h>
9963 #endif
9964 #$i_stdlib I_STDLIB
9965 #ifdef I_STDLIB
9966 #include <stdlib.h>
9967 #endif
9968 int main() {
9969         exit(R_OK);
9970 }
9971 EOCP
9972         : check sys/file.h first, no particular reason here
9973         if $test `./findhdr sys/file.h` && \
9974                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9975                 h_sysfile=true;
9976                 echo "<sys/file.h> defines the *_OK access constants." >&4
9977         elif $test `./findhdr fcntl.h` && \
9978                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9979                 h_fcntl=true;
9980                 echo "<fcntl.h> defines the *_OK access constants." >&4
9981         elif $test `./findhdr unistd.h` && \
9982                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9983                 echo "<unistd.h> defines the *_OK access constants." >&4
9984         else
9985                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9986         fi
9987         ;;
9988 esac
9989 $rm -f access*
9990
9991 : see if accessx exists
9992 set accessx d_accessx
9993 eval $inlibc
9994
9995 : see if aintl exists
9996 set aintl d_aintl
9997 eval $inlibc
9998
9999 : see if alarm exists
10000 set alarm d_alarm
10001 eval $inlibc
10002
10003 : see if 64bit time functions exists
10004
10005 set ctime64 d_ctime64
10006 eval $inlibc
10007
10008 set localtime64 d_localtime64
10009 eval $inlibc
10010
10011 set gmtime64 d_gmtime64
10012 eval $inlibc
10013
10014 set mktime64 d_mktime64
10015 eval $inlibc
10016
10017 set difftime64 d_difftime64
10018 eval $inlibc
10019
10020 set asctime64 d_asctime64
10021 eval $inlibc
10022
10023 : see if POSIX threads are available
10024 set pthread.h i_pthread
10025 eval $inhdr
10026
10027 : define a function to check prototypes
10028 $cat > protochk <<EOSH
10029 $startsh
10030 cc="$cc"
10031 optimize="$optimize"
10032 ccflags="$ccflags"
10033 prototype="$prototype"
10034 define="$define"
10035 rm_try="$rm_try"
10036 usethreads=$usethreads
10037 i_pthread=$i_pthread
10038 pthread_h_first=$pthread_h_first
10039 EOSH
10040
10041 $cat >> protochk <<'EOSH'
10042
10043 $rm_try
10044 foo="$1"
10045 shift
10046 while test $# -ge 2; do
10047         case "$1" in
10048                 $define) echo "#include <$2>" >> try.c ;;
10049                 literal) echo "$2" >> try.c ;;
10050         esac
10051     # Extra magic for the benefit of systems that need pthread.h
10052     # to be included early to correctly detect threadsafe functions.
10053     # Such functions must guarantee themselves, though, that the usethreads
10054     # and i_pthread have been defined, before calling protochk.
10055     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10056         echo "#include <pthread.h>" >> try.c
10057         pthread_h_done=yes
10058     fi
10059     shift 2
10060 done
10061 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10062 cat >> try.c <<'EOCP'
10063 #ifdef CAN_PROTOTYPE
10064 #define _(args) args
10065 #else
10066 #define _(args) ()
10067 #endif
10068 EOCP
10069 echo "$foo" >> try.c
10070 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10071 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10072 status=$?
10073 $rm_try
10074 exit $status
10075 EOSH
10076 chmod +x protochk
10077 $eunicefix protochk
10078
10079 : Define hasproto macro for Configure internal use
10080 hasproto='varname=$1; func=$2; shift; shift;
10081 while $test $# -ge 2; do
10082         case "$1" in
10083         $define) echo "#include <$2>";;
10084         esac ;
10085     shift 2;
10086 done > try.c;
10087 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10088 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10089         echo "$func() prototype found.";
10090         val="$define";
10091 else
10092         echo "$func() prototype NOT found.";
10093         val="$undef";
10094 fi;
10095 set $varname;
10096 eval $setvar;
10097 $rm_try tryout.c'
10098
10099 : see if sys/types.h has to be included
10100 set sys/types.h i_systypes
10101 eval $inhdr
10102
10103 : see if sys/select.h has to be included
10104 set sys/select.h i_sysselct
10105 eval $inhdr
10106
10107 : Define hasfield macro for Configure internal use
10108 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10109 while $test $# -ge 2; do
10110         case "$1" in
10111         $define) echo "#include <$2>";;
10112         esac ;
10113     shift 2;
10114 done > try.c;
10115 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10116 set try;
10117 if eval $compile; then
10118         val="$define";
10119 else
10120         val="$undef";
10121 fi;
10122 set $varname;
10123 eval $setvar;
10124 $rm_try'
10125
10126 : see if we should include time.h, sys/time.h, or both
10127 echo " "
10128 if test "X$timeincl" = X; then
10129         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10130         $echo $n "I'm now running the test program...$c"
10131         $cat >try.c <<EOCP
10132 #include <sys/types.h>
10133 #ifdef I_TIME
10134 #include <time.h>
10135 #endif
10136 #ifdef I_SYSTIME
10137 #ifdef SYSTIMEKERNEL
10138 #define KERNEL
10139 #endif
10140 #include <sys/time.h>
10141 #endif
10142 #ifdef I_SYSSELECT
10143 #include <sys/select.h>
10144 #endif
10145 #$i_stdlib I_STDLIB
10146 #ifdef I_STDLIB
10147 #include <stdlib.h>
10148 #endif
10149 int main()
10150 {
10151         struct tm foo;
10152 #ifdef S_TIMEVAL
10153         struct timeval bar;
10154 #endif
10155 #ifdef S_TIMEZONE
10156         struct timezone tzp;
10157 #endif
10158         if (foo.tm_sec == foo.tm_sec)
10159                 exit(0);
10160 #ifdef S_TIMEVAL
10161         if (bar.tv_sec == bar.tv_sec)
10162                 exit(0);
10163 #endif
10164         exit(1);
10165 }
10166 EOCP
10167         flags=''
10168         for s_timezone in '-DS_TIMEZONE' ''; do
10169         sysselect=''
10170         for s_timeval in '-DS_TIMEVAL' ''; do
10171         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10172         for i_time in '' '-DI_TIME'; do
10173         for i_systime in '-DI_SYSTIME' ''; do
10174                 case "$flags" in
10175                 '') $echo $n ".$c"
10176                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10177                         if eval $compile; then
10178                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10179                                 shift
10180                                 flags="$*"
10181                                 echo " "
10182                                 $echo $n "Succeeded with $flags$c"
10183                         fi
10184                         ;;
10185                 esac
10186         done
10187         done
10188         done
10189         done
10190         done
10191         timeincl=''
10192         echo " "
10193         case "$flags" in
10194         *SYSTIMEKERNEL*) i_systimek="$define"
10195                 timeincl=`./findhdr sys/time.h`
10196                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10197         *) i_systimek="$undef";;
10198         esac
10199         case "$flags" in
10200         *I_TIME*) i_time="$define"
10201                 timeincl=`./findhdr time.h`" $timeincl"
10202                 echo "We'll include <time.h>." >&4;;
10203         *) i_time="$undef";;
10204         esac
10205         case "$flags" in
10206         *I_SYSTIME*) i_systime="$define"
10207                 timeincl=`./findhdr sys/time.h`" $timeincl"
10208                 echo "We'll include <sys/time.h>." >&4;;
10209         *) i_systime="$undef";;
10210         esac
10211         $rm_try
10212 fi
10213 : see if struct tm knows about tm_zone
10214 case "$i_systime$i_time" in
10215 *$define*)
10216         echo " "
10217         echo "Checking to see if your struct tm has tm_zone field..." >&4
10218         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10219         eval $hasfield
10220         ;;
10221 *)      val="$undef"
10222         set d_tm_tm_zone
10223         eval $setvar
10224         ;;
10225 esac
10226 case "$d_tm_tm_zone" in
10227 "$define")      echo "Yes, it does."   ;;
10228 *)              echo "No, it doesn't." ;;
10229 esac
10230 : see if struct tm knows about tm_gmtoff
10231 case "$i_systime$i_time" in
10232 *$define*)
10233         echo " "
10234         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10235         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10236         eval $hasfield
10237         ;;
10238 *)      val="$undef"
10239         set d_tm_tm_gmtoff
10240         eval $setvar
10241         ;;
10242 esac
10243 case "$d_tm_tm_gmtoff" in
10244 "$define")      echo "Yes, it does."   ;;
10245 *)              echo "No, it doesn't." ;;
10246 esac
10247
10248 : see if asctime_r exists
10249 set asctime_r d_asctime_r
10250 eval $inlibc
10251 case "$d_asctime_r" in
10252 "$define")
10253         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10254         case "$d_asctime_r_proto:$usethreads" in
10255         ":define")      d_asctime_r_proto=define
10256                 set d_asctime_r_proto asctime_r $hdrs
10257                 eval $hasproto ;;
10258         *)      ;;
10259         esac
10260         case "$d_asctime_r_proto" in
10261         define)
10262         case "$asctime_r_proto" in
10263         ''|0) try='char* asctime_r(const struct tm*, char*);'
10264         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10265         esac
10266         case "$asctime_r_proto" in
10267         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10268         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10269         esac
10270         case "$asctime_r_proto" in
10271         ''|0) try='int asctime_r(const struct tm*, char*);'
10272         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10273         esac
10274         case "$asctime_r_proto" in
10275         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10276         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10277         esac
10278         case "$asctime_r_proto" in
10279         ''|0)   d_asctime_r=undef
10280                 asctime_r_proto=0
10281                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10282         * )     case "$asctime_r_proto" in
10283                 REENTRANT_PROTO*) ;;
10284                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10285                 esac
10286                 echo "Prototype: $try" ;;
10287         esac
10288         ;;
10289         *)      case "$usethreads" in
10290                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10291                 esac
10292                 d_asctime_r=undef
10293                 asctime_r_proto=0
10294                 ;;
10295         esac
10296         ;;
10297 *)      asctime_r_proto=0
10298         ;;
10299 esac
10300
10301 : see if atolf exists
10302 set atolf d_atolf
10303 eval $inlibc
10304
10305 : see if atoll exists
10306 set atoll d_atoll
10307 eval $inlibc
10308
10309 : Look for GCC-style attribute format
10310 case "$d_attribute_format" in
10311 '')
10312 echo " "
10313 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10314 $cat >attrib.c <<'EOCP'
10315 #include <stdio.h>
10316 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10317 EOCP
10318 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10319         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10320                 echo "Your C compiler doesn't support __attribute__((format))."
10321                 val="$undef"
10322         else
10323                 echo "Your C compiler supports __attribute__((format))."
10324                 val="$define"
10325         fi
10326 else
10327         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10328         val="$undef"
10329 fi
10330 ;;
10331 *) val="$d_attribute_format" ;;
10332 esac
10333 set d_attribute_format
10334 eval $setvar
10335 $rm -f attrib*
10336
10337 : Look for GCC-style attribute format with null format allowed
10338 case "$d_printf_format_null" in
10339 '') case "$d_attribute_format" in
10340     $define)
10341         echo " "
10342         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10343 $cat >attrib.c <<EOCP
10344 #include <stdio.h>
10345 #$i_stdlib I_STDLIB
10346 #ifdef I_STDLIB
10347 #include <stdlib.h>
10348 #endif
10349 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10350 int null_printf (char* pat,...) { return (int)pat; }
10351 int main () { exit(null_printf(NULL)); }
10352 EOCP
10353         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10354             : run the executable in case it produces a run-time warning
10355             if $run ./attrib >>attrib.out 2>&1; then
10356                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10357                     echo "Your C compiler doesn't allow __printf__ format to be null."
10358                     val="$undef"
10359                 else
10360                     echo "Your C compiler allows __printf__ format to be null."
10361                     val="$define"
10362                 fi
10363             else
10364             echo "Your C compiler executable failed with __printf__ format null."
10365             val="$undef"
10366         fi
10367     else
10368         echo "Your C compiler fails with __printf__ format null."
10369         val="$undef"
10370     fi
10371     ;;
10372     *)  val="$undef" ;;
10373     esac
10374 ;;
10375 *)  val="$d_printf_format_null" ;;
10376 esac
10377 set d_printf_format_null
10378 eval $setvar
10379 $rm -f attrib*
10380
10381 : Look for GCC-style attribute malloc
10382 case "$d_attribute_malloc" in
10383 '')
10384 echo " "
10385 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10386 $cat >attrib.c <<'EOCP'
10387 #include <stdio.h>
10388 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10389 EOCP
10390 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10391         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10392                 echo "Your C compiler doesn't support __attribute__((malloc))."
10393                 val="$undef"
10394         else
10395                 echo "Your C compiler supports __attribute__((malloc))."
10396                 val="$define"
10397         fi
10398 else
10399         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10400         val="$undef"
10401 fi
10402 ;;
10403 *) val="$d_attribute_malloc" ;;
10404 esac
10405 set d_attribute_malloc
10406 eval $setvar
10407 $rm -f attrib*
10408
10409 : Look for GCC-style attribute nonnull
10410 case "$d_attribute_nonnull" in
10411 '')
10412 echo " "
10413 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10414 $cat >attrib.c <<'EOCP'
10415 #include <stdio.h>
10416 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10417 EOCP
10418 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10419         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10420                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10421                 val="$undef"
10422         else
10423                 echo "Your C compiler supports __attribute__((nonnull))."
10424                 val="$define"
10425         fi
10426 else
10427         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10428         val="$undef"
10429 fi
10430 ;;
10431 *) val="$d_attribute_nonnull" ;;
10432 esac
10433 set d_attribute_nonnull
10434 eval $setvar
10435 $rm -f attrib*
10436
10437 : Look for GCC-style attribute noreturn
10438 case "$d_attribute_noreturn" in
10439 '')
10440 echo " "
10441 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10442 $cat >attrib.c <<'EOCP'
10443 #include <stdio.h>
10444 void fall_over_dead( void ) __attribute__((noreturn));
10445 EOCP
10446 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10447         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10448                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10449                 val="$undef"
10450         else
10451                 echo "Your C compiler supports __attribute__((noreturn))."
10452                 val="$define"
10453         fi
10454 else
10455         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10456         val="$undef"
10457 fi
10458 ;;
10459 *) val="$d_attribute_noreturn" ;;
10460 esac
10461 set d_attribute_noreturn
10462 eval $setvar
10463 $rm -f attrib*
10464
10465 : Look for GCC-style attribute pure
10466 case "$d_attribute_pure" in
10467 '')
10468 echo " "
10469 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10470 $cat >attrib.c <<'EOCP'
10471 #include <stdio.h>
10472 int square( int n ) __attribute__((pure));
10473 EOCP
10474 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10475         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10476                 echo "Your C compiler doesn't support __attribute__((pure))."
10477                 val="$undef"
10478         else
10479                 echo "Your C compiler supports __attribute__((pure))."
10480                 val="$define"
10481         fi
10482 else
10483         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10484         val="$undef"
10485 fi
10486 ;;
10487 *) val="$d_attribute_pure" ;;
10488 esac
10489 set d_attribute_pure
10490 eval $setvar
10491 $rm -f attrib*
10492
10493 : Look for GCC-style attribute unused
10494 case "$d_attribute_unused" in
10495 '')
10496 echo " "
10497 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10498 $cat >attrib.c <<'EOCP'
10499 #include <stdio.h>
10500 int do_something( int dummy __attribute__((unused)), int n );
10501 EOCP
10502 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10503         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10504                 echo "Your C compiler doesn't support __attribute__((unused))."
10505                 val="$undef"
10506         else
10507                 echo "Your C compiler supports __attribute__((unused))."
10508                 val="$define"
10509         fi
10510 else
10511         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10512         val="$undef"
10513 fi
10514 ;;
10515 *) val="$d_attribute_unused" ;;
10516 esac
10517 set d_attribute_unused
10518 eval $setvar
10519 $rm -f attrib*
10520
10521 : Look for GCC-style attribute deprecated
10522 case "$d_attribute_deprecated" in
10523 '')
10524 echo " "
10525 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10526 $cat >attrib.c <<'EOCP'
10527 #include <stdio.h>
10528 int I_am_deprecated(void) __attribute__((deprecated));
10529 EOCP
10530 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10531         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10532                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10533                 val="$undef"
10534         else
10535                 echo "Your C compiler supports __attribute__((deprecated))."
10536                 val="$define"
10537         fi
10538 else
10539         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10540         val="$undef"
10541 fi
10542 ;;
10543 *) val="$d_attribute_deprecated" ;;
10544 esac
10545 set d_attribute_deprecated
10546 eval $setvar
10547 $rm -f attrib*
10548
10549 : Look for GCC-style attribute warn_unused_result
10550 case "$d_attribute_warn_unused_result" in
10551 '')
10552 echo " "
10553 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10554 $cat >attrib.c <<'EOCP'
10555 #include <stdio.h>
10556 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10557 EOCP
10558 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10559         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10560                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10561                 val="$undef"
10562         else
10563                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10564                 val="$define"
10565         fi
10566 else
10567         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10568         val="$undef"
10569 fi
10570 ;;
10571 *) val="$d_attribute_warn_unused_result" ;;
10572 esac
10573 set d_attribute_warn_unused_result
10574 eval $setvar
10575 $rm -f attrib*
10576
10577 : see if bcmp exists
10578 set bcmp d_bcmp
10579 eval $inlibc
10580
10581 : see if bcopy exists
10582 set bcopy d_bcopy
10583 eval $inlibc
10584
10585 : see if getpgrp exists
10586 set getpgrp d_getpgrp
10587 eval $inlibc
10588
10589 case "$d_getpgrp" in
10590 "$define")
10591         echo " "
10592         echo "Checking to see which flavor of getpgrp is in use..."
10593         $cat >try.c <<EOP
10594 #$i_unistd I_UNISTD
10595 #include <sys/types.h>
10596 #ifdef I_UNISTD
10597 #  include <unistd.h>
10598 #endif
10599 #$i_stdlib I_STDLIB
10600 #ifdef I_STDLIB
10601 #include <stdlib.h>
10602 #endif
10603 int main()
10604 {
10605         if (getuid() == 0) {
10606                 printf("(I see you are running Configure as super-user...)\n");
10607                 setuid(1);
10608         }
10609 #ifdef TRY_BSD_PGRP
10610         if (getpgrp(1) == 0)
10611                 exit(0);
10612 #else
10613         if (getpgrp() > 0)
10614                 exit(0);
10615 #endif
10616         exit(1);
10617 }
10618 EOP
10619         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10620                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10621                 val="$define"
10622         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10623                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10624                 val="$undef"
10625         else
10626                 echo "I can't seem to compile and run the test program."
10627                 if ./usg; then
10628                         xxx="a USG one, i.e. you use getpgrp()."
10629                 else
10630                         # SVR4 systems can appear rather BSD-ish.
10631                         case "$i_unistd" in
10632                         $undef)
10633                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10634                                 val="$define"
10635                                 ;;
10636                         $define)
10637                                 xxx="probably a USG one, i.e. you use getpgrp()."
10638                                 val="$undef"
10639                                 ;;
10640                         esac
10641                 fi
10642                 echo "Assuming your getpgrp is $xxx" >&4
10643         fi
10644         ;;
10645 *) val="$undef";;
10646 esac
10647 set d_bsdgetpgrp
10648 eval $setvar
10649 $rm_try
10650
10651 : see if setpgrp exists
10652 set setpgrp d_setpgrp
10653 eval $inlibc
10654
10655 case "$d_setpgrp" in
10656 "$define")
10657         echo " "
10658         echo "Checking to see which flavor of setpgrp is in use..."
10659         $cat >try.c <<EOP
10660 #$i_unistd I_UNISTD
10661 #include <sys/types.h>
10662 #ifdef I_UNISTD
10663 #  include <unistd.h>
10664 #endif
10665 #$i_stdlib I_STDLIB
10666 #ifdef I_STDLIB
10667 #include <stdlib.h>
10668 #endif
10669 int main()
10670 {
10671         if (getuid() == 0) {
10672                 printf("(I see you are running Configure as super-user...)\n");
10673                 setuid(1);
10674         }
10675 #ifdef TRY_BSD_PGRP
10676         if (-1 == setpgrp(1, 1))
10677                 exit(0);
10678 #else
10679         if (setpgrp() != -1)
10680                 exit(0);
10681 #endif
10682         exit(1);
10683 }
10684 EOP
10685         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10686                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10687                 val="$define"
10688         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10689                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10690                 val="$undef"
10691         else
10692                 echo "(I can't seem to compile and run the test program.)"
10693                 if ./usg; then
10694                         xxx="a USG one, i.e. you use setpgrp()."
10695                 else
10696                         # SVR4 systems can appear rather BSD-ish.
10697                         case "$i_unistd" in
10698                         $undef)
10699                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10700                                 val="$define"
10701                                 ;;
10702                         $define)
10703                                 xxx="probably a USG one, i.e. you use setpgrp()."
10704                                 val="$undef"
10705                                 ;;
10706                         esac
10707                 fi
10708                 echo "Assuming your setpgrp is $xxx" >&4
10709         fi
10710         ;;
10711 *) val="$undef";;
10712 esac
10713 set d_bsdsetpgrp
10714 eval $setvar
10715 $rm_try
10716
10717 : Look for GCC-style __builtin_choose_expr
10718 case "$d_builtin_choose_expr" in
10719 '')
10720     echo " "
10721     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10722     $cat >try.c <<'EOCP'
10723 #include <assert.h>
10724 #include <stdlib.h>
10725 #include <stdio.h>
10726
10727 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10728
10729 int main(void) {
10730     assert( SYRINX(1) == 2112 );
10731     assert( SYRINX(1) != 5150 );
10732     assert( SYRINX(0) == 5150 );
10733     assert( SYRINX(0) != 2112 );
10734     puts( "All good!" );
10735     exit(0);
10736 }
10737
10738 EOCP
10739     set try
10740     if eval $compile && $run ./try; then
10741         echo "Your C compiler supports __builtin_choose_expr."
10742         val="$define"
10743     else
10744         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10745         val="$undef"
10746     fi
10747 ;;
10748 *) val="$d_builtin_choose_expr" ;;
10749 esac
10750
10751 set d_builtin_choose_expr
10752 eval $setvar
10753 $rm_try
10754
10755 : Look for GCC-style __builtin_expect
10756 case "$d_builtin_expect" in
10757 '')
10758     echo " "
10759     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10760     $cat >try.c <<'EOCP'
10761 int main(void) {
10762     int n = 50;
10763     if ( __builtin_expect(n, 0) ) n = 1;
10764     /* Remember shell exit code truth is 0, C truth is non-zero */
10765     return !(n == 1);
10766 }
10767 EOCP
10768     set try
10769     if eval $compile && $run ./try; then
10770         echo "Your C compiler supports __builtin_expect."
10771         val="$define"
10772     else
10773         echo "Your C compiler doesn't seem to understand __builtin_expect."
10774         val="$undef"
10775     fi
10776     ;;
10777 *) val="$d_builtin_expect" ;;
10778 esac
10779
10780 set d_builtin_expect
10781 eval $setvar
10782 $rm_try
10783
10784 : see if bzero exists
10785 set bzero d_bzero
10786 eval $inlibc
10787
10788 : see if stdarg is available
10789 echo " "
10790 if $test `./findhdr stdarg.h`; then
10791         echo "<stdarg.h> found." >&4
10792         valstd="$define"
10793 else
10794         echo "<stdarg.h> NOT found." >&4
10795         valstd="$undef"
10796 fi
10797
10798 : see if varags is available
10799 echo " "
10800 if $test `./findhdr varargs.h`; then
10801         echo "<varargs.h> found." >&4
10802 else
10803         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10804 fi
10805
10806 : set up the varargs testing programs
10807 $cat > varargs.c <<EOP
10808 #ifdef I_STDARG
10809 #include <stdarg.h>
10810 #endif
10811 #ifdef I_VARARGS
10812 #include <varargs.h>
10813 #endif
10814
10815 #ifdef I_STDARG
10816 int f(char *p, ...)
10817 #else
10818 int f(va_alist)
10819 va_dcl
10820 #endif
10821 {
10822         va_list ap;
10823 #ifndef I_STDARG
10824         char *p;
10825 #endif
10826 #ifdef I_STDARG
10827         va_start(ap,p);
10828 #else
10829         va_start(ap);
10830         p = va_arg(ap, char *);
10831 #endif
10832         va_end(ap);
10833         return 0;
10834 }
10835 EOP
10836 $cat > varargs <<EOP
10837 $startsh
10838 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10839         echo "true"
10840 else
10841         echo "false"
10842 fi
10843 $rm -f varargs$_o
10844 EOP
10845 chmod +x varargs
10846
10847 : now check which varargs header should be included
10848 echo " "
10849 i_varhdr=''
10850 case "$valstd" in
10851 "$define")
10852         if `./varargs I_STDARG`; then
10853                 val='stdarg.h'
10854         elif `./varargs I_VARARGS`; then
10855                 val='varargs.h'
10856         fi
10857         ;;
10858 *)
10859         if `./varargs I_VARARGS`; then
10860                 val='varargs.h'
10861         fi
10862         ;;
10863 esac
10864 case "$val" in
10865 '')
10866 echo "I could not find the definition for va_dcl... You have problems..." >&4
10867         val="$undef"; set i_stdarg; eval $setvar
10868         val="$undef"; set i_varargs; eval $setvar
10869         ;;
10870 *)
10871         set i_varhdr
10872         eval $setvar
10873         case "$i_varhdr" in
10874         stdarg.h)
10875                 val="$define"; set i_stdarg; eval $setvar
10876                 val="$undef"; set i_varargs; eval $setvar
10877                 ;;
10878         varargs.h)
10879                 val="$undef"; set i_stdarg; eval $setvar
10880                 val="$define"; set i_varargs; eval $setvar
10881                 ;;
10882         esac
10883         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10884 esac
10885 $rm -f varargs*
10886
10887 : see if the Compiler supports C99 variadic macros
10888 case "$i_stdarg$i_stdlib" in
10889     "$define$define")
10890     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10891     $cat >try.c <<EOCP
10892 #include <stdio.h>
10893 #include <stdarg.h>
10894
10895 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10896
10897 int main() {
10898   char buf[20];
10899   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10900   puts(buf);
10901   return 0;
10902 }
10903 EOCP
10904     set try
10905     if eval $compile && $run ./try 2>&1 >/dev/null; then
10906         case "`$run ./try`" in
10907             "123 456 789")
10908             echo "You have C99 variadic macros." >&4
10909             d_c99_variadic_macros="$define"
10910             ;;
10911             *)
10912             echo "You don't have functional C99 variadic macros." >&4
10913             d_c99_variadic_macros="$undef"
10914             ;;
10915         esac
10916     else
10917         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10918         d_c99_variadic_macros="$undef"
10919     fi
10920     $rm_try
10921     ;;
10922     *)
10923     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10924     d_c99_variadic_macros="$undef"
10925     ;;
10926 esac
10927
10928 : see if signal is declared as pointer to function returning int or void
10929 echo " "
10930 xxx=`./findhdr signal.h`
10931 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10932 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10933         echo "You have int (*signal())() instead of void." >&4
10934         val="$undef"
10935 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10936         echo "You have void (*signal())()." >&4
10937         val="$define"
10938 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10939         echo "You have int (*signal())() instead of void." >&4
10940         val="$undef"
10941 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10942         echo "You have void (*signal())()." >&4
10943         val="$define"
10944 else
10945         case "$d_voidsig" in
10946         '')
10947         echo "I can't determine whether signal handler returns void or int..." >&4
10948                 dflt=void
10949                 rp="What type does your signal handler return?"
10950                 . ./myread
10951                 case "$ans" in
10952                 v*) val="$define";;
10953                 *) val="$undef";;
10954                 esac;;
10955         "$define")
10956                 echo "As you already told me, signal handler returns void." >&4
10957                 val="$define"
10958                 ;;
10959         *)      echo "As you already told me, signal handler returns int." >&4
10960                 val="$undef"
10961                 ;;
10962         esac
10963 fi
10964 set d_voidsig
10965 eval $setvar
10966 case "$d_voidsig" in
10967 "$define") signal_t="void";;
10968 *) signal_t="int";;
10969 esac
10970 $rm -f $$.tmp
10971
10972 : check for ability to cast large floats to 32-bit ints.
10973 echo " "
10974 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10975 if $test "$intsize" -ge 4; then
10976         xxx=int
10977 else
10978         xxx=long
10979 fi
10980 $cat >try.c <<EOCP
10981 #include <stdio.h>
10982 #$i_stdlib I_STDLIB
10983 #ifdef I_STDLIB
10984 #include <stdlib.h>
10985 #endif
10986 #include <sys/types.h>
10987 #include <signal.h>
10988 $signal_t blech(int s) { exit(3); }
10989 int main()
10990 {
10991         $xxx i32;
10992         double f, g;
10993         int result = 0;
10994         char str[16];
10995         signal(SIGFPE, blech);
10996
10997         /* Don't let compiler optimize the test away.  Store the number
10998            in a writable string for gcc to pass to sscanf under HP-UX.
10999         */
11000         sprintf(str, "2147483647");
11001         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11002         g = 10 * f;
11003         i32  = ($xxx) g;
11004
11005         /* x86 processors will probably give 0x8000 0000, which is a
11006            sign change.  We don't want that.  We want to mimic SPARC
11007            behavior here, which is to preserve the sign and give
11008            back 0x7fff ffff.
11009         */
11010         if (i32 != ($xxx) f)
11011                 result |= 1;
11012         exit(result);
11013 }
11014 EOCP
11015 set try
11016 if eval $compile_ok; then
11017         $run ./try
11018         yyy=$?
11019 else
11020         echo "(I can't seem to compile the test program--assuming it can't)"
11021         yyy=1
11022 fi
11023 case "$yyy" in
11024 0)      val="$define"
11025         echo "Yup, it can."
11026         ;;
11027 *)      val="$undef"
11028         echo "Nope, it can't."
11029         ;;
11030 esac
11031 set d_casti32
11032 eval $setvar
11033 $rm_try
11034
11035 : check for ability to cast negative floats to unsigned
11036 echo " "
11037 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11038 $cat >try.c <<EOCP
11039 #include <stdio.h>
11040 #$i_stdlib I_STDLIB
11041 #ifdef I_STDLIB
11042 #include <stdlib.h>
11043 #endif
11044 #include <sys/types.h>
11045 #include <signal.h>
11046 $signal_t blech(int s) { exit(7); }
11047 $signal_t blech_in_list(int s) { exit(4); }
11048 unsigned long dummy_long(unsigned long p) { return p; }
11049 unsigned int dummy_int(unsigned int p) { return p; }
11050 unsigned short dummy_short(unsigned short p) { return p; }
11051 int main()
11052 {
11053         double f;
11054         unsigned long along;
11055         unsigned int aint;
11056         unsigned short ashort;
11057         int result = 0;
11058         char str[16];
11059
11060         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11061            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11062            optimized the whole file away
11063         */
11064         /* Store the number in a writable string for gcc to pass to
11065            sscanf under HP-UX.
11066         */
11067         sprintf(str, "-123");
11068         sscanf(str, "%lf", &f);  /* f = -123.; */
11069
11070         signal(SIGFPE, blech);
11071         along = (unsigned long)f;
11072         aint = (unsigned int)f;
11073         ashort = (unsigned short)f;
11074         if (along != (unsigned long)-123)
11075                 result |= 1;
11076         if (aint != (unsigned int)-123)
11077                 result |= 1;
11078         if (ashort != (unsigned short)-123)
11079                 result |= 1;
11080         sprintf(str, "1073741824.");
11081         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11082         f = f + f;
11083         along = 0;
11084         along = (unsigned long)f;
11085         if (along != 0x80000000)
11086                 result |= 2;
11087         f -= 1.;
11088         along = 0;
11089         along = (unsigned long)f;
11090         if (along != 0x7fffffff)
11091                 result |= 1;
11092         f += 2.;
11093         along = 0;
11094         along = (unsigned long)f;
11095         if (along != 0x80000001)
11096                 result |= 2;
11097         if (result)
11098                 exit(result);
11099         signal(SIGFPE, blech_in_list);
11100         sprintf(str, "123.");
11101         sscanf(str, "%lf", &f);  /* f = 123.; */
11102         along = dummy_long((unsigned long)f);
11103         aint = dummy_int((unsigned int)f);
11104         ashort = dummy_short((unsigned short)f);
11105         if (along != (unsigned long)123)
11106                 result |= 4;
11107         if (aint != (unsigned int)123)
11108                 result |= 4;
11109         if (ashort != (unsigned short)123)
11110                 result |= 4;
11111         exit(result);
11112
11113 }
11114 EOCP
11115 set try
11116 if eval $compile_ok; then
11117         $run ./try
11118         castflags=$?
11119 else
11120         echo "(I can't seem to compile the test program--assuming it can't)"
11121         castflags=7
11122 fi
11123 case "$castflags" in
11124 0)      val="$define"
11125         echo "Yup, it can."
11126         ;;
11127 *)      val="$undef"
11128         echo "Nope, it can't."
11129         ;;
11130 esac
11131 set d_castneg
11132 eval $setvar
11133 $rm_try
11134
11135 : see if vprintf exists
11136 echo " "
11137 if set vprintf val -f d_vprintf; eval $csym; $val; then
11138         echo 'vprintf() found.' >&4
11139         val="$define"
11140         $cat >try.c <<EOF
11141 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11142 #$i_varargs I_VARARGS
11143
11144 #$i_stdlib I_STDLIB
11145 #$i_unistd I_UNISTD
11146
11147 #ifdef I_STDARG
11148 #  include <stdarg.h>
11149 #else /* I_VARARGS */
11150 #  include <varargs.h>
11151 #endif
11152
11153 #ifdef I_UNISTD
11154 #  include <unistd.h>
11155 #endif
11156
11157 #ifdef I_STDLIB
11158 #  include <stdlib.h>
11159 #endif
11160
11161 #include <stdio.h> /* vsprintf prototype */
11162
11163 #ifdef I_STDARG
11164 void xxx(int n, ...)
11165 {
11166     va_list args;
11167     char buf[10];
11168     va_start(args, n);
11169     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11170 }
11171 int main() { xxx(1, "foo"); }
11172
11173 #else /* I_VARARGS */
11174
11175 xxx(va_alist)
11176 va_dcl
11177 {
11178     va_list args;
11179     char buf[10];
11180     va_start(args);
11181     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11182 }
11183 int main() { xxx("foo"); }
11184
11185 #endif
11186
11187 EOF
11188         set try
11189         if eval $compile_ok; then
11190                 if $run ./try; then
11191                         echo "Your vsprintf() returns (int)." >&4
11192                         val2="$undef"
11193                 else
11194                         echo "Your vsprintf() returns (char*)." >&4
11195                         val2="$define"
11196                 fi
11197         else
11198                 echo 'I am unable to compile the vsprintf() test program.' >&4
11199                 # We shouldn't get here.  If we do, assume the standard signature,
11200                 # not the old BSD one.
11201                 echo 'Guessing that vsprintf() returns (int).' >&4
11202                 val2="$undef"
11203         fi
11204 else
11205         echo 'vprintf() NOT found.' >&4
11206         val="$undef"
11207         val2="$undef"
11208 fi
11209 $rm_try
11210 set d_vprintf
11211 eval $setvar
11212 val=$val2
11213 set d_charvspr
11214 eval $setvar
11215
11216 : see if chown exists
11217 set chown d_chown
11218 eval $inlibc
11219
11220 : see if chroot exists
11221 set chroot d_chroot
11222 eval $inlibc
11223
11224 : see if chsize exists
11225 set chsize d_chsize
11226 eval $inlibc
11227
11228 : see if class exists
11229 set class d_class
11230 eval $inlibc
11231
11232 : see if clearenv exists
11233 set clearenv d_clearenv
11234 eval $inlibc
11235
11236 : Define hasstruct macro for Configure internal use
11237 hasstruct='varname=$1; struct=$2; shift; shift;
11238 while $test $# -ge 2; do
11239         case "$1" in
11240         $define) echo "#include <$2>";;
11241         esac ;
11242     shift 2;
11243 done > try.c;
11244 echo "int main () { struct $struct foo; }" >> try.c;
11245 set try;
11246 if eval $compile; then
11247         val="$define";
11248 else
11249         val="$undef";
11250 fi;
11251 set $varname;
11252 eval $setvar;
11253 $rm_try'
11254
11255 : see whether socket exists
11256 socketlib=''
11257 sockethdr=''
11258 echo " "
11259 $echo $n "Hmm... $c" >&4
11260 if set socket val -f d_socket; eval $csym; $val; then
11261         echo "Looks like you have Berkeley networking support." >&4
11262         d_socket="$define"
11263         if set setsockopt val -f; eval $csym; $val; then
11264                 d_oldsock="$undef"
11265         else
11266                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11267                 d_oldsock="$define"
11268         fi
11269 else
11270         if $contains socklib libc.list >/dev/null 2>&1; then
11271                 echo "Looks like you have Berkeley networking support." >&4
11272                 d_socket="$define"
11273                 : we will have to assume that it supports the 4.2 BSD interface
11274                 d_oldsock="$undef"
11275         else
11276                 echo "You don't have Berkeley networking in libc$_a..." >&4
11277                 if test "X$d_socket" = "X$define"; then
11278                    echo "...but you seem to believe that you have sockets." >&4
11279                 else
11280                         for net in net socket
11281                         do
11282                                 if test -f /usr/lib/lib$net$_a; then
11283                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11284                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11285                                         if $contains socket libc.list >/dev/null 2>&1; then
11286                                                 d_socket="$define"
11287                                                 socketlib="-l$net"
11288                                                 case "$net" in
11289                                                 net)
11290                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11291                                                         sockethdr="-I/usr/netinclude"
11292                                                         ;;
11293                                                 esac
11294                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11295                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11296                                                         d_oldsock="$undef"
11297                                                 else
11298                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11299                                                         d_oldsock="$define"
11300                                                 fi
11301                                                 break
11302                                         fi
11303                                 fi
11304                         done
11305                         if test "X$d_socket" != "X$define"; then
11306                            echo "or anywhere else I see." >&4
11307                            d_socket="$undef"
11308                            d_oldsock="$undef"
11309                         fi
11310                 fi
11311         fi
11312 fi
11313
11314 : see if socketpair exists
11315 set socketpair d_sockpair
11316 eval $inlibc
11317
11318
11319 echo " "
11320 echo "Checking the availability sa_len in the sock struct ..." >&4
11321 $cat >try.c <<EOF
11322 #include <sys/types.h>
11323 #include <sys/socket.h>
11324 int main() {
11325 struct sockaddr sa;
11326 return (sa.sa_len);
11327 }
11328 EOF
11329 val="$undef"
11330 set try; if eval $compile; then
11331         val="$define"
11332 fi
11333 set d_sockaddr_sa_len; eval $setvar
11334 $rm_try
11335
11336 echo " "
11337 echo "Checking the availability struct sockaddr_in6 ..." >&4
11338 $cat >try.c <<EOF
11339 #include <sys/types.h>
11340 #include <sys/socket.h>
11341 #include <netinet/in.h>
11342 int main() {
11343 struct sockaddr_in6 sin6;
11344 return (sin6.sin6_family);
11345 }
11346 EOF
11347 val="$undef"
11348 set try; if eval $compile; then
11349         val="$define"
11350 fi
11351 set d_sockaddr_in6; eval $setvar
11352 $rm_try
11353
11354 echo " "
11355 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11356 $cat >try.c <<EOF
11357 #include <sys/types.h>
11358 #include <sys/socket.h>
11359 #include <netinet/in.h>
11360 int main() {
11361 struct sockaddr_in6 sin6;
11362 return (sin6.sin6_scope_id);
11363 }
11364 EOF
11365 val="$undef"
11366 set try; if eval $compile; then
11367         val="$define"
11368 fi
11369 set d_sin6_scope_id; eval $setvar
11370 $rm_try
11371
11372 echo " "
11373 echo "Checking the availability struct ip_mreq ..." >&4
11374 $cat >try.c <<EOF
11375 #include <sys/types.h>
11376 #include <sys/socket.h>
11377 #include <netinet/in.h>
11378 int main() {
11379 struct ip_mreq mreq;
11380 return (mreq.imr_multiaddr.s_addr);
11381 }
11382 EOF
11383 val="$undef"
11384 set try; if eval $compile; then
11385        val="$define"
11386 fi
11387 set d_ip_mreq; eval $setvar
11388 $rm_try
11389
11390 echo " "
11391 echo "Checking the availability struct ip_mreq_source ..." >&4
11392 $cat >try.c <<EOF
11393 #include <sys/types.h>
11394 #include <sys/socket.h>
11395 #include <netinet/in.h>
11396 int main() {
11397 struct ip_mreq_source mreq;
11398 return (mreq.imr_multiaddr.s_addr);
11399 }
11400 EOF
11401 val="$undef"
11402 set try; if eval $compile; then
11403        val="$define"
11404 fi
11405 set d_ip_mreq_source; eval $setvar
11406 $rm_try
11407
11408 echo " "
11409 echo "Checking the availability struct ipv6_mreq ..." >&4
11410 $cat >try.c <<EOF
11411 #include <sys/types.h>
11412 #include <sys/socket.h>
11413 #include <netinet/in.h>
11414 int main() {
11415 struct ipv6_mreq mreq;
11416 return (mreq.ipv6mr_interface);
11417 }
11418 EOF
11419 val="$undef"
11420 set try; if eval $compile; then
11421         val="$define"
11422 fi
11423 set d_ipv6_mreq; eval $setvar
11424 $rm_try
11425
11426 echo " "
11427 echo "Checking the availability struct ipv6_mreq_source ..." >&4
11428 $cat >try.c <<EOF
11429 #include <sys/types.h>
11430 #include <sys/socket.h>
11431 #include <netinet/in.h>
11432 int main() {
11433 struct ipv6_mreq_source mreq;
11434 return (mreq.imr_multiaddr.s_addr);
11435 }
11436 EOF
11437 val="$undef"
11438 set try; if eval $compile; then
11439        val="$define"
11440 fi
11441 set d_ipv6_mreq_source; eval $setvar
11442 $rm_try
11443
11444 echo " "
11445 echo "Checking the availability of certain socket constants..." >&4
11446 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11447         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11448         $cat >try.c <<EOF
11449 #include <sys/types.h>
11450 #include <sys/socket.h>
11451 int main() {
11452     int i = $ENUM;
11453 }
11454 EOF
11455         val="$undef"
11456         set try; if eval $compile; then
11457                 val="$define"
11458         fi
11459         set d_${enum}; eval $setvar
11460         $rm_try
11461 done
11462
11463 : see if this is a sys/uio.h system
11464 set sys/uio.h i_sysuio
11465 eval $inhdr
11466
11467 : Check for cmsghdr support
11468 echo " "
11469 echo "Checking to see if your system supports struct cmsghdr..." >&4
11470 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11471 eval $hasstruct
11472 case "$d_cmsghdr_s" in
11473 "$define")      echo "Yes, it does."   ;;
11474 *)              echo "No, it doesn't." ;;
11475 esac
11476
11477
11478 : check for const keyword
11479 echo " "
11480 echo 'Checking to see if your C compiler knows about "const"...' >&4
11481 $cat >const.c <<'EOCP'
11482 typedef struct spug { int drokk; } spug;
11483 int main()
11484 {
11485         const char *foo;
11486         const spug y = { 0 };
11487 }
11488 EOCP
11489 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11490         val="$define"
11491         echo "Yup, it does."
11492 else
11493         val="$undef"
11494         echo "Nope, it doesn't."
11495 fi
11496 set d_const
11497 eval $setvar
11498
11499 : see if copysignl exists
11500 set copysignl d_copysignl
11501 eval $inlibc
11502
11503 : see if crypt exists
11504 echo " "
11505 set crypt d_crypt
11506 eval $inlibc
11507 case "$d_crypt" in
11508 $define) cryptlib='' ;;
11509 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11510                 echo 'crypt() found.' >&4
11511                 val="$define"
11512                 cryptlib=''
11513         else
11514                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11515                 if $test -z "$cryptlib"; then
11516                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11517                 else
11518                         cryptlib=-lcrypt
11519                 fi
11520                 if $test -z "$cryptlib"; then
11521                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11522                 else
11523                         cryptlib=-lcrypt
11524                 fi
11525                 if $test -z "$cryptlib"; then
11526                         cryptlib=`./loc libcrypt$_a "" $libpth`
11527                 else
11528                         cryptlib=-lcrypt
11529                 fi
11530                 if $test -z "$cryptlib"; then
11531                         echo 'crypt() NOT found.' >&4
11532                         val="$undef"
11533                 else
11534                         val="$define"
11535                 fi
11536         fi
11537         set d_crypt
11538         eval $setvar
11539         ;;
11540 esac
11541
11542 : see if this is a crypt.h system
11543 set crypt.h i_crypt
11544 eval $inhdr
11545
11546 : see if crypt_r exists
11547 set crypt_r d_crypt_r
11548 eval $inlibc
11549 case "$d_crypt_r" in
11550 "$define")
11551         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11552         case "$d_crypt_r_proto:$usethreads" in
11553         ":define")      d_crypt_r_proto=define
11554                 set d_crypt_r_proto crypt_r $hdrs
11555                 eval $hasproto ;;
11556         *)      ;;
11557         esac
11558         case "$d_crypt_r_proto" in
11559         define)
11560         case "$crypt_r_proto" in
11561         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11562         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11563         esac
11564         case "$crypt_r_proto" in
11565         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11566         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11567         esac
11568         case "$crypt_r_proto" in
11569         ''|0)   d_crypt_r=undef
11570                 crypt_r_proto=0
11571                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11572         * )     case "$crypt_r_proto" in
11573                 REENTRANT_PROTO*) ;;
11574                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11575                 esac
11576                 echo "Prototype: $try" ;;
11577         esac
11578         ;;
11579         *)      case "$usethreads" in
11580                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11581                 esac
11582                 d_crypt_r=undef
11583                 crypt_r_proto=0
11584                 ;;
11585         esac
11586         ;;
11587 *)      crypt_r_proto=0
11588         ;;
11589 esac
11590
11591 : get csh whereabouts
11592 case "$csh" in
11593 'csh') val="$undef" ;;
11594 *) val="$define" ;;
11595 esac
11596 set d_csh
11597 eval $setvar
11598 : Respect a hint or command line value for full_csh.
11599 case "$full_csh" in
11600 '') full_csh=$csh ;;
11601 esac
11602
11603 : see if ctermid exists
11604 set ctermid d_ctermid
11605 eval $inlibc
11606
11607 : see if ctermid_r exists
11608 set ctermid_r d_ctermid_r
11609 eval $inlibc
11610 case "$d_ctermid_r" in
11611 "$define")
11612         hdrs="$i_systypes sys/types.h define stdio.h "
11613         case "$d_ctermid_r_proto:$usethreads" in
11614         ":define")      d_ctermid_r_proto=define
11615                 set d_ctermid_r_proto ctermid_r $hdrs
11616                 eval $hasproto ;;
11617         *)      ;;
11618         esac
11619         case "$d_ctermid_r_proto" in
11620         define)
11621         case "$ctermid_r_proto" in
11622         ''|0) try='char* ctermid_r(char*);'
11623         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11624         esac
11625         case "$ctermid_r_proto" in
11626         ''|0)   d_ctermid_r=undef
11627                 ctermid_r_proto=0
11628                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11629         * )     case "$ctermid_r_proto" in
11630                 REENTRANT_PROTO*) ;;
11631                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11632                 esac
11633                 echo "Prototype: $try" ;;
11634         esac
11635         ;;
11636         *)      case "$usethreads" in
11637                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11638                 esac
11639                 d_ctermid_r=undef
11640                 ctermid_r_proto=0
11641                 ;;
11642         esac
11643         ;;
11644 *)      ctermid_r_proto=0
11645         ;;
11646 esac
11647
11648 : see if ctime_r exists
11649 set ctime_r d_ctime_r
11650 eval $inlibc
11651 case "$d_ctime_r" in
11652 "$define")
11653         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11654         case "$d_ctime_r_proto:$usethreads" in
11655         ":define")      d_ctime_r_proto=define
11656                 set d_ctime_r_proto ctime_r $hdrs
11657                 eval $hasproto ;;
11658         *)      ;;
11659         esac
11660         case "$d_ctime_r_proto" in
11661         define)
11662         case "$ctime_r_proto" in
11663         ''|0) try='char* ctime_r(const time_t*, char*);'
11664         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11665         esac
11666         case "$ctime_r_proto" in
11667         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11668         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11669         esac
11670         case "$ctime_r_proto" in
11671         ''|0) try='int ctime_r(const time_t*, char*);'
11672         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11673         esac
11674         case "$ctime_r_proto" in
11675         ''|0) try='int ctime_r(const time_t*, char*, int);'
11676         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11677         esac
11678         case "$ctime_r_proto" in
11679         ''|0)   d_ctime_r=undef
11680                 ctime_r_proto=0
11681                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11682         * )     case "$ctime_r_proto" in
11683                 REENTRANT_PROTO*) ;;
11684                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11685                 esac
11686                 echo "Prototype: $try" ;;
11687         esac
11688         ;;
11689         *)      case "$usethreads" in
11690                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11691                 esac
11692                 d_ctime_r=undef
11693                 ctime_r_proto=0
11694                 ;;
11695         esac
11696         ;;
11697 *)      ctime_r_proto=0
11698         ;;
11699 esac
11700
11701 : see if cuserid exists
11702 set cuserid d_cuserid
11703 eval $inlibc
11704
11705 : see if this is a limits.h system
11706 set limits.h i_limits
11707 eval $inhdr
11708
11709 : see if this is a float.h system
11710 set float.h i_float
11711 eval $inhdr
11712
11713 : See if number of significant digits in a double precision number is known
11714 echo " "
11715 $cat >dbl_dig.c <<EOM
11716 #$i_limits I_LIMITS
11717 #$i_float I_FLOAT
11718 #ifdef I_LIMITS
11719 #include <limits.h>
11720 #endif
11721 #ifdef I_FLOAT
11722 #include <float.h>
11723 #endif
11724 #ifdef DBL_DIG
11725 printf("Contains DBL_DIG");
11726 #endif
11727 EOM
11728 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11729 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11730         echo "DBL_DIG found." >&4
11731         val="$define"
11732 else
11733         echo "DBL_DIG NOT found." >&4
11734         val="$undef"
11735 fi
11736 $rm -f dbl_dig.?
11737 set d_dbl_dig
11738 eval $setvar
11739
11740 : see if dbm.h is available
11741 : see if dbmclose exists
11742 set dbmclose d_dbmclose
11743 eval $inlibc
11744
11745 case "$d_dbmclose" in
11746 $define)
11747         set dbm.h i_dbm
11748         eval $inhdr
11749         case "$i_dbm" in
11750         $define)
11751                 val="$undef"
11752                 set i_rpcsvcdbm
11753                 eval $setvar
11754                 ;;
11755         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11756                 eval $inhdr
11757                 ;;
11758         esac
11759         ;;
11760 *)      echo "We won't be including <dbm.h>"
11761         val="$undef"
11762         set i_dbm
11763         eval $setvar
11764         val="$undef"
11765         set i_rpcsvcdbm
11766         eval $setvar
11767         ;;
11768 esac
11769
11770 : see if prototype for dbminit is available
11771 echo " "
11772 set d_dbminitproto dbminit $i_dbm dbm.h
11773 eval $hasproto
11774
11775 : see if difftime exists
11776 set difftime d_difftime
11777 eval $inlibc
11778
11779 : see if this is a dirent system
11780 echo " "
11781 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11782         val="$define"
11783         echo "<dirent.h> found." >&4
11784 else
11785         val="$undef"
11786         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11787                 echo "<sys/dir.h> found." >&4
11788                 echo " "
11789         else
11790                 xinc=`./findhdr sys/ndir.h`
11791         fi
11792         echo "<dirent.h> NOT found." >&4
11793 fi
11794 set i_dirent
11795 eval $setvar
11796
11797 : Look for type of directory structure.
11798 echo " "
11799 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11800
11801 case "$direntrytype" in
11802 ''|' ')
11803         case "$i_dirent" in
11804         $define) guess1='struct dirent' ;;
11805         *) guess1='struct direct'  ;;
11806         esac
11807         ;;
11808 *)      guess1="$direntrytype"
11809         ;;
11810 esac
11811
11812 case "$guess1" in
11813 'struct dirent') guess2='struct direct' ;;
11814 *) guess2='struct dirent' ;;
11815 esac
11816
11817 if $contains "$guess1" try.c >/dev/null 2>&1; then
11818         direntrytype="$guess1"
11819         echo "Your directory entries are $direntrytype." >&4
11820 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11821         direntrytype="$guess2"
11822         echo "Your directory entries seem to be $direntrytype." >&4
11823 else
11824         echo "I don't recognize your system's directory entries." >&4
11825         rp="What type is used for directory entries on this system?"
11826         dflt="$guess1"
11827         . ./myread
11828         direntrytype="$ans"
11829 fi
11830 $rm_try
11831
11832 : see if the directory entry stores field length
11833 echo " "
11834 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11835 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11836         echo "Good, your directory entry keeps length information in d_namlen." >&4
11837         val="$define"
11838 else
11839         echo "Your directory entry does not know about the d_namlen field." >&4
11840         val="$undef"
11841 fi
11842 set d_dirnamlen
11843 eval $setvar
11844 $rm_try
11845
11846 : Look for DIR.dd_fd
11847 case "$i_dirent" in
11848 "$define")
11849     echo "Checking to see if DIR has a dd_fd member variable" >&4
11850     $cat >try.c <<EOCP
11851 #$i_stdlib I_STDLIB
11852 #ifdef I_STDLIB
11853 #include <stdlib.h>
11854 #endif
11855 #include <dirent.h>
11856
11857 int main() {
11858     DIR dir;
11859     dir.dd_fd = 1;
11860     return 0;
11861 }
11862 EOCP
11863     val=$undef
11864     set try
11865     if eval $compile; then
11866         echo "Yes, it does."
11867         val="$define"
11868     else
11869         echo "No, it does not."
11870         val="$undef"
11871     fi
11872     ;;
11873 *)
11874     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11875     val="$undef"
11876     ;;
11877 esac
11878 set d_dir_dd_fd
11879 eval $setvar
11880 $rm_try
11881
11882 : see if this is an sysdir system
11883 set sys/dir.h i_sysdir
11884 eval $inhdr
11885
11886 : see if this is an sysndir system
11887 set sys/ndir.h i_sysndir
11888 eval $inhdr
11889
11890 : Look for dirfd
11891 echo " "
11892 $cat >dirfd.c <<EOM
11893 #include <stdio.h>
11894 #$i_stdlib I_STDLIB
11895 #ifdef I_STDLIB
11896 #include <stdlib.h>
11897 #endif
11898 #$i_dirent I_DIRENT             /**/
11899 #$i_sysdir I_SYS_DIR            /**/
11900 #$i_sysndir I_SYS_NDIR          /**/
11901 #$i_systypes I_SYS_TYPES        /**/
11902 #if defined(I_SYS_TYPES)
11903 #include <sys/types.h>
11904 #endif
11905 #if defined(I_DIRENT)
11906 #include <dirent.h>
11907 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11908 #include <sys/dir.h>
11909 #endif
11910 #else
11911 #ifdef I_SYS_NDIR
11912 #include <sys/ndir.h>
11913 #else
11914 #ifdef I_SYS_DIR
11915 #ifdef hp9000s500
11916 #include <ndir.h>       /* may be wrong in the future */
11917 #else
11918 #include <sys/dir.h>
11919 #endif
11920 #endif
11921 #endif
11922 #endif 
11923 int main() {
11924         DIR *dirp = opendir(".");
11925         if (dirfd(dirp) >= 0)
11926                 exit(0);
11927         else
11928                 exit(1);
11929 }
11930 EOM
11931 val=$undef
11932 set dirfd
11933 if eval $compile; then
11934         val="$define"
11935 fi
11936 case "$val" in
11937 $define)        echo "dirfd() found." >&4       ;;
11938 *)              echo "dirfd() NOT found." >&4   ;;
11939 esac
11940 set d_dirfd
11941 eval $setvar
11942 $rm -f dirfd*
11943
11944 : see if dlerror exists
11945 xxx_runnm="$runnm"
11946 runnm=false
11947 set dlerror d_dlerror
11948 eval $inlibc
11949 runnm="$xxx_runnm"
11950
11951 : see if dlfcn is available
11952 set dlfcn.h i_dlfcn
11953 eval $inhdr
11954
11955 : Check what extension to use for shared libs
11956 case "$usedl" in
11957 $define|y|true)
11958         $cat << EOM
11959
11960 On a few systems, the dynamically loaded modules that perl generates and uses
11961 will need a different extension than shared libs. The default will probably
11962 be appropriate.
11963
11964 EOM
11965         case "$dlext" in
11966         '')     dflt="$so" ;;
11967         *)      dflt="$dlext" ;;
11968         esac
11969         rp='What is the extension of dynamically loaded modules'
11970         . ./myread
11971         dlext="$ans"
11972         ;;
11973 *)
11974         dlext="none"
11975         ;;
11976 esac
11977
11978 : Check if dlsym need a leading underscore
11979 echo " "
11980 val="$undef"
11981
11982 case "$dlsrc" in
11983 dl_dlopen.xs)
11984         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11985         $cat >dyna.c <<'EOM'
11986 fred () { }
11987 EOM
11988
11989 $cat >fred.c<<EOM
11990
11991 #include <stdio.h>
11992 #$i_stdlib I_STDLIB
11993 #ifdef I_STDLIB
11994 #include <stdlib.h>
11995 #endif
11996 #$i_dlfcn I_DLFCN
11997 #ifdef I_DLFCN
11998 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11999 #else
12000 #include <sys/types.h>
12001 #include <nlist.h>
12002 #include <link.h>
12003 #endif
12004
12005 extern int fred() ;
12006
12007 int main()
12008 {
12009     void * handle ;
12010     void * symbol ;
12011 #ifndef RTLD_LAZY
12012     int mode = 1 ;
12013 #else
12014     int mode = RTLD_LAZY ;
12015 #endif
12016     handle = dlopen("./dyna.$dlext", mode) ;
12017     if (handle == NULL) {
12018         printf ("1\n") ;
12019         fflush (stdout) ;
12020         exit(0);
12021     }
12022     symbol = dlsym(handle, "fred") ;
12023     if (symbol == NULL) {
12024         /* try putting a leading underscore */
12025         symbol = dlsym(handle, "_fred") ;
12026         if (symbol == NULL) {
12027             printf ("2\n") ;
12028             fflush (stdout) ;
12029             exit(0);
12030         }
12031         printf ("3\n") ;
12032     }
12033     else
12034         printf ("4\n") ;
12035     fflush (stdout) ;
12036     exit(0);
12037 }
12038 EOM
12039         : Call the object file tmp-dyna.o in case dlext=o.
12040         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12041                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12042                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12043                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12044                 xxx=`$run ./fred`
12045                 case $xxx in
12046                 1)      echo "Test program failed using dlopen." >&4
12047                         echo "Perhaps you should not use dynamic loading." >&4;;
12048                 2)      echo "Test program failed using dlsym." >&4
12049                         echo "Perhaps you should not use dynamic loading." >&4;;
12050                 3)      echo "dlsym needs a leading underscore" >&4
12051                         val="$define" ;;
12052                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12053                 esac
12054         else
12055                 echo "I can't compile and run the test program." >&4
12056                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12057         fi
12058         ;;
12059 esac
12060
12061 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12062
12063 set d_dlsymun
12064 eval $setvar
12065
12066 : see if drand48_r exists
12067 set drand48_r d_drand48_r
12068 eval $inlibc
12069 case "$d_drand48_r" in
12070 "$define")
12071         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12072         case "$d_drand48_r_proto:$usethreads" in
12073         ":define")      d_drand48_r_proto=define
12074                 set d_drand48_r_proto drand48_r $hdrs
12075                 eval $hasproto ;;
12076         *)      ;;
12077         esac
12078         case "$d_drand48_r_proto" in
12079         define)
12080         case "$drand48_r_proto" in
12081         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12082         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12083         esac
12084         case "$drand48_r_proto" in
12085         ''|0)   d_drand48_r=undef
12086                 drand48_r_proto=0
12087                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12088         * )     case "$drand48_r_proto" in
12089                 REENTRANT_PROTO*) ;;
12090                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12091                 esac
12092                 echo "Prototype: $try" ;;
12093         esac
12094         ;;
12095         *)      case "$usethreads" in
12096                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12097                 esac
12098                 d_drand48_r=undef
12099                 drand48_r_proto=0
12100                 ;;
12101         esac
12102         ;;
12103 *)      drand48_r_proto=0
12104         ;;
12105 esac
12106
12107 : see if prototype for drand48 is available
12108 echo " "
12109 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12110 eval $hasproto
12111
12112 : see if dup2 exists
12113 set dup2 d_dup2
12114 eval $inlibc
12115
12116 : see if eaccess exists
12117 set eaccess d_eaccess
12118 eval $inlibc
12119
12120 : see if endgrent exists
12121 set endgrent d_endgrent
12122 eval $inlibc
12123
12124 : see if this is an grp system
12125 set grp.h i_grp
12126 eval $inhdr
12127
12128 case "$i_grp" in
12129 $define)
12130         xxx=`./findhdr grp.h`
12131         $cppstdin $cppflags $cppminus < $xxx >$$.h
12132
12133         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12134                 val="$define"
12135         else
12136                 val="$undef"
12137         fi
12138         set d_grpasswd
12139         eval $setvar
12140
12141         $rm -f $$.h
12142         ;;
12143 *)
12144         val="$undef";
12145         set d_grpasswd; eval $setvar
12146         ;;
12147 esac
12148
12149 : see if endgrent_r exists
12150 set endgrent_r d_endgrent_r
12151 eval $inlibc
12152 case "$d_endgrent_r" in
12153 "$define")
12154         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12155         case "$d_endgrent_r_proto:$usethreads" in
12156         ":define")      d_endgrent_r_proto=define
12157                 set d_endgrent_r_proto endgrent_r $hdrs
12158                 eval $hasproto ;;
12159         *)      ;;
12160         esac
12161         case "$d_endgrent_r_proto" in
12162         define)
12163         case "$endgrent_r_proto" in
12164         ''|0) try='int endgrent_r(FILE**);'
12165         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12166         esac
12167         case "$endgrent_r_proto" in
12168         ''|0) try='void endgrent_r(FILE**);'
12169         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12170         esac
12171         case "$endgrent_r_proto" in
12172         ''|0)   d_endgrent_r=undef
12173                 endgrent_r_proto=0
12174                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12175         * )     case "$endgrent_r_proto" in
12176                 REENTRANT_PROTO*) ;;
12177                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12178                 esac
12179                 echo "Prototype: $try" ;;
12180         esac
12181         ;;
12182         *)      case "$usethreads" in
12183                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12184                 esac
12185                 d_endgrent_r=undef
12186                 endgrent_r_proto=0
12187                 ;;
12188         esac
12189         ;;
12190 *)      endgrent_r_proto=0
12191         ;;
12192 esac
12193
12194 : see if endhostent exists
12195 set endhostent d_endhent
12196 eval $inlibc
12197
12198 : see if this is a netdb.h system
12199 set netdb.h i_netdb
12200 eval $inhdr
12201
12202 : see if endhostent_r exists
12203 set endhostent_r d_endhostent_r
12204 eval $inlibc
12205 case "$d_endhostent_r" in
12206 "$define")
12207         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12208         case "$d_endhostent_r_proto:$usethreads" in
12209         ":define")      d_endhostent_r_proto=define
12210                 set d_endhostent_r_proto endhostent_r $hdrs
12211                 eval $hasproto ;;
12212         *)      ;;
12213         esac
12214         case "$d_endhostent_r_proto" in
12215         define)
12216         case "$endhostent_r_proto" in
12217         ''|0) try='int endhostent_r(struct hostent_data*);'
12218         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12219         esac
12220         case "$endhostent_r_proto" in
12221         ''|0) try='void endhostent_r(struct hostent_data*);'
12222         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12223         esac
12224         case "$endhostent_r_proto" in
12225         ''|0)   d_endhostent_r=undef
12226                 endhostent_r_proto=0
12227                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12228         * )     case "$endhostent_r_proto" in
12229                 REENTRANT_PROTO*) ;;
12230                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12231                 esac
12232                 echo "Prototype: $try" ;;
12233         esac
12234         ;;
12235         *)      case "$usethreads" in
12236                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12237                 esac
12238                 d_endhostent_r=undef
12239                 endhostent_r_proto=0
12240                 ;;
12241         esac
12242         ;;
12243 *)      endhostent_r_proto=0
12244         ;;
12245 esac
12246
12247 : see if endnetent exists
12248 set endnetent d_endnent
12249 eval $inlibc
12250
12251 : see if endnetent_r exists
12252 set endnetent_r d_endnetent_r
12253 eval $inlibc
12254 case "$d_endnetent_r" in
12255 "$define")
12256         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12257         case "$d_endnetent_r_proto:$usethreads" in
12258         ":define")      d_endnetent_r_proto=define
12259                 set d_endnetent_r_proto endnetent_r $hdrs
12260                 eval $hasproto ;;
12261         *)      ;;
12262         esac
12263         case "$d_endnetent_r_proto" in
12264         define)
12265         case "$endnetent_r_proto" in
12266         ''|0) try='int endnetent_r(struct netent_data*);'
12267         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12268         esac
12269         case "$endnetent_r_proto" in
12270         ''|0) try='void endnetent_r(struct netent_data*);'
12271         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12272         esac
12273         case "$endnetent_r_proto" in
12274         ''|0)   d_endnetent_r=undef
12275                 endnetent_r_proto=0
12276                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12277         * )     case "$endnetent_r_proto" in
12278                 REENTRANT_PROTO*) ;;
12279                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12280                 esac
12281                 echo "Prototype: $try" ;;
12282         esac
12283         ;;
12284         *)      case "$usethreads" in
12285                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12286                 esac
12287                 d_endnetent_r=undef
12288                 endnetent_r_proto=0
12289                 ;;
12290         esac
12291         ;;
12292 *)      endnetent_r_proto=0
12293         ;;
12294 esac
12295
12296 : see if endprotoent exists
12297 set endprotoent d_endpent
12298 eval $inlibc
12299
12300 : see if endprotoent_r exists
12301 set endprotoent_r d_endprotoent_r
12302 eval $inlibc
12303 case "$d_endprotoent_r" in
12304 "$define")
12305         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12306         case "$d_endprotoent_r_proto:$usethreads" in
12307         ":define")      d_endprotoent_r_proto=define
12308                 set d_endprotoent_r_proto endprotoent_r $hdrs
12309                 eval $hasproto ;;
12310         *)      ;;
12311         esac
12312         case "$d_endprotoent_r_proto" in
12313         define)
12314         case "$endprotoent_r_proto" in
12315         ''|0) try='int endprotoent_r(struct protoent_data*);'
12316         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12317         esac
12318         case "$endprotoent_r_proto" in
12319         ''|0) try='void endprotoent_r(struct protoent_data*);'
12320         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12321         esac
12322         case "$endprotoent_r_proto" in
12323         ''|0)   d_endprotoent_r=undef
12324                 endprotoent_r_proto=0
12325                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12326         * )     case "$endprotoent_r_proto" in
12327                 REENTRANT_PROTO*) ;;
12328                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12329                 esac
12330                 echo "Prototype: $try" ;;
12331         esac
12332         ;;
12333         *)      case "$usethreads" in
12334                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12335                 esac
12336                 d_endprotoent_r=undef
12337                 endprotoent_r_proto=0
12338                 ;;
12339         esac
12340         ;;
12341 *)      endprotoent_r_proto=0
12342         ;;
12343 esac
12344
12345 : see if endpwent exists
12346 set endpwent d_endpwent
12347 eval $inlibc
12348
12349 : see if this is a pwd.h system
12350 set pwd.h i_pwd
12351 eval $inhdr
12352
12353 case "$i_pwd" in
12354 $define)
12355         xxx=`./findhdr pwd.h`
12356         $cppstdin $cppflags $cppminus < $xxx >$$.h
12357
12358         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12359                 val="$define"
12360         else
12361                 val="$undef"
12362         fi
12363         set d_pwquota
12364         eval $setvar
12365
12366         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12367                 val="$define"
12368         else
12369                 val="$undef"
12370         fi
12371         set d_pwage
12372         eval $setvar
12373
12374         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12375                 val="$define"
12376         else
12377                 val="$undef"
12378         fi
12379         set d_pwchange
12380         eval $setvar
12381
12382         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12383                 val="$define"
12384         else
12385                 val="$undef"
12386         fi
12387         set d_pwclass
12388         eval $setvar
12389
12390         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12391                 val="$define"
12392         else
12393                 val="$undef"
12394         fi
12395         set d_pwexpire
12396         eval $setvar
12397
12398         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12399                 val="$define"
12400         else
12401                 val="$undef"
12402         fi
12403         set d_pwcomment
12404         eval $setvar
12405
12406         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12407                 val="$define"
12408         else
12409                 val="$undef"
12410         fi
12411         set d_pwgecos
12412         eval $setvar
12413
12414         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12415                 val="$define"
12416         else
12417                 val="$undef"
12418         fi
12419         set d_pwpasswd
12420         eval $setvar
12421
12422         $rm -f $$.h
12423         ;;
12424 *)
12425         val="$undef"; 
12426         set d_pwquota; eval $setvar
12427         set d_pwage; eval $setvar
12428         set d_pwchange; eval $setvar
12429         set d_pwclass; eval $setvar
12430         set d_pwexpire; eval $setvar
12431         set d_pwcomment; eval $setvar
12432         set d_pwgecos; eval $setvar
12433         set d_pwpasswd; eval $setvar
12434         ;;
12435 esac
12436
12437 : see if endpwent_r exists
12438 set endpwent_r d_endpwent_r
12439 eval $inlibc
12440 case "$d_endpwent_r" in
12441 "$define")
12442         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12443         case "$d_endpwent_r_proto:$usethreads" in
12444         ":define")      d_endpwent_r_proto=define
12445                 set d_endpwent_r_proto endpwent_r $hdrs
12446                 eval $hasproto ;;
12447         *)      ;;
12448         esac
12449         case "$d_endpwent_r_proto" in
12450         define)
12451         case "$endpwent_r_proto" in
12452         ''|0) try='int endpwent_r(FILE**);'
12453         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12454         esac
12455         case "$endpwent_r_proto" in
12456         ''|0) try='void endpwent_r(FILE**);'
12457         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12458         esac
12459         case "$endpwent_r_proto" in
12460         ''|0)   d_endpwent_r=undef
12461                 endpwent_r_proto=0
12462                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12463         * )     case "$endpwent_r_proto" in
12464                 REENTRANT_PROTO*) ;;
12465                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12466                 esac
12467                 echo "Prototype: $try" ;;
12468         esac
12469         ;;
12470         *)      case "$usethreads" in
12471                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12472                 esac
12473                 d_endpwent_r=undef
12474                 endpwent_r_proto=0
12475                 ;;
12476         esac
12477         ;;
12478 *)      endpwent_r_proto=0
12479         ;;
12480 esac
12481
12482 : see if endservent exists
12483 set endservent d_endsent
12484 eval $inlibc
12485
12486 : see if endservent_r exists
12487 set endservent_r d_endservent_r
12488 eval $inlibc
12489 case "$d_endservent_r" in
12490 "$define")
12491         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12492         case "$d_endservent_r_proto:$usethreads" in
12493         ":define")      d_endservent_r_proto=define
12494                 set d_endservent_r_proto endservent_r $hdrs
12495                 eval $hasproto ;;
12496         *)      ;;
12497         esac
12498         case "$d_endservent_r_proto" in
12499         define)
12500         case "$endservent_r_proto" in
12501         ''|0) try='int endservent_r(struct servent_data*);'
12502         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12503         esac
12504         case "$endservent_r_proto" in
12505         ''|0) try='void endservent_r(struct servent_data*);'
12506         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12507         esac
12508         case "$endservent_r_proto" in
12509         ''|0)   d_endservent_r=undef
12510                 endservent_r_proto=0
12511                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12512         * )     case "$endservent_r_proto" in
12513                 REENTRANT_PROTO*) ;;
12514                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12515                 esac
12516                 echo "Prototype: $try" ;;
12517         esac
12518         ;;
12519         *)      case "$usethreads" in
12520                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12521                 esac
12522                 d_endservent_r=undef
12523                 endservent_r_proto=0
12524                 ;;
12525         esac
12526         ;;
12527 *)      endservent_r_proto=0
12528         ;;
12529 esac
12530
12531 : Locate the flags for 'open()'
12532 echo " "
12533 $cat >try.c <<EOCP
12534 #include <sys/types.h>
12535 #ifdef I_FCNTL
12536 #include <fcntl.h>
12537 #endif
12538 #ifdef I_SYS_FILE
12539 #include <sys/file.h>
12540 #endif
12541 #$i_stdlib I_STDLIB
12542 #ifdef I_STDLIB
12543 #include <stdlib.h>
12544 #endif
12545 int main() {
12546         if(O_RDONLY);
12547 #ifdef O_TRUNC
12548         exit(0);
12549 #else
12550         exit(1);
12551 #endif
12552 }
12553 EOCP
12554 : check sys/file.h first to get FREAD on Sun
12555 if $test `./findhdr sys/file.h` && \
12556                 set try -DI_SYS_FILE && eval $compile; then
12557         h_sysfile=true;
12558         echo "<sys/file.h> defines the O_* constants..." >&4
12559         if $run ./try; then
12560                 echo "and you have the 3 argument form of open()." >&4
12561                 val="$define"
12562         else
12563                 echo "but not the 3 argument form of open().  Oh, well." >&4
12564                 val="$undef"
12565         fi
12566 elif $test `./findhdr fcntl.h` && \
12567                 set try -DI_FCNTL && eval $compile; then
12568         h_fcntl=true;
12569         echo "<fcntl.h> defines the O_* constants..." >&4
12570         if $run ./try; then
12571                 echo "and you have the 3 argument form of open()." >&4
12572                 val="$define"
12573         else
12574                 echo "but not the 3 argument form of open().  Oh, well." >&4
12575                 val="$undef"
12576         fi
12577 else
12578         val="$undef"
12579         echo "I can't find the O_* constant definitions!  You got problems." >&4
12580 fi
12581 set d_open3
12582 eval $setvar
12583 $rm_try
12584
12585 : see if this is a sys/file.h system
12586 val=''
12587 set sys/file.h val
12588 eval $inhdr
12589
12590 : do we need to include sys/file.h ?
12591 case "$val" in
12592 "$define")
12593         echo " "
12594         if $h_sysfile; then
12595                 val="$define"
12596                 echo "We'll be including <sys/file.h>." >&4
12597         else
12598                 val="$undef"
12599                 echo "We won't be including <sys/file.h>." >&4
12600         fi
12601         ;;
12602 *)
12603         h_sysfile=false
12604         ;;
12605 esac
12606 set i_sysfile
12607 eval $setvar
12608
12609 : see if fcntl.h is there
12610 val=''
12611 set fcntl.h val
12612 eval $inhdr
12613
12614 : see if we can include fcntl.h
12615 case "$val" in
12616 "$define")
12617         echo " "
12618         if $h_fcntl; then
12619                 val="$define"
12620                 echo "We'll be including <fcntl.h>." >&4
12621         else
12622                 val="$undef"
12623                 if $h_sysfile; then
12624         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12625                 else
12626                         echo "We won't be including <fcntl.h>." >&4
12627                 fi
12628         fi
12629         ;;
12630 *)
12631         h_fcntl=false
12632         val="$undef"
12633         ;;
12634 esac
12635 set i_fcntl
12636 eval $setvar
12637
12638 : see if fork exists
12639 set fork d_fork
12640 eval $inlibc
12641
12642 : see if pipe exists
12643 set pipe d_pipe
12644 eval $inlibc
12645
12646 : check for non-blocking I/O stuff
12647 case "$h_sysfile" in
12648 true) echo "#include <sys/file.h>" > head.c;;
12649 *)
12650        case "$h_fcntl" in
12651        true) echo "#include <fcntl.h>" > head.c;;
12652        *) echo "#include <sys/fcntl.h>" > head.c;;
12653        esac
12654        ;;
12655 esac
12656 echo " "
12657 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12658 case "$o_nonblock" in
12659 '')
12660         $cat head.c > try.c
12661         $cat >>try.c <<EOCP
12662 #include <stdio.h>
12663 #$i_stdlib I_STDLIB
12664 #ifdef I_STDLIB
12665 #include <stdlib.h>
12666 #endif
12667 #$i_fcntl I_FCNTL
12668 #ifdef I_FCNTL
12669 #include <fcntl.h>
12670 #endif
12671 int main() {
12672 #ifdef O_NONBLOCK
12673         printf("O_NONBLOCK\n");
12674         exit(0);
12675 #endif
12676 #ifdef O_NDELAY
12677         printf("O_NDELAY\n");
12678         exit(0);
12679 #endif
12680 #ifdef FNDELAY
12681         printf("FNDELAY\n");
12682         exit(0);
12683 #endif
12684         exit(0);
12685 }
12686 EOCP
12687         set try
12688         if eval $compile_ok; then
12689                 o_nonblock=`$run ./try`
12690                 case "$o_nonblock" in
12691                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12692                 *) echo "Seems like we can use $o_nonblock.";;
12693                 esac
12694         else
12695                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12696         fi
12697         ;;
12698 *) echo "Using $hint value $o_nonblock.";;
12699 esac
12700 $rm_try
12701
12702 echo " "
12703 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12704 case "$eagain" in
12705 '')
12706         case "$d_fork:$d_pipe" in
12707         define:define)
12708         $cat head.c > try.c
12709         $cat >>try.c <<EOCP
12710 #include <errno.h>
12711 #include <sys/types.h>
12712 #include <signal.h>
12713 #include <stdio.h>
12714 #$i_stdlib I_STDLIB
12715 #ifdef I_STDLIB
12716 #include <stdlib.h>
12717 #endif
12718 #$i_fcntl I_FCNTL
12719 #ifdef I_FCNTL
12720 #include <fcntl.h>
12721 #endif
12722 #define MY_O_NONBLOCK $o_nonblock
12723 #ifndef errno  /* XXX need better Configure test */
12724 extern int errno;
12725 #endif
12726 #$i_unistd I_UNISTD
12727 #ifdef I_UNISTD
12728 #include <unistd.h>
12729 #endif
12730 #$i_string I_STRING
12731 #ifdef I_STRING
12732 #include <string.h>
12733 #else
12734 #include <strings.h>
12735 #endif
12736 $signal_t blech(int x) { exit(3); }
12737 EOCP
12738         $cat >> try.c <<'EOCP'
12739 int main()
12740 {
12741         int pd[2];
12742         int pu[2];
12743         char buf[1];
12744         char string[100];
12745
12746         pipe(pd);       /* Down: child -> parent */
12747         pipe(pu);       /* Up: parent -> child */
12748         if (0 != fork()) {
12749                 int ret;
12750                 close(pd[1]);   /* Parent reads from pd[0] */
12751                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12752 #ifdef F_SETFL
12753                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12754                         exit(1);
12755 #else
12756                 exit(4);
12757 #endif
12758                 signal(SIGALRM, blech);
12759                 alarm(5);
12760                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12761                         exit(2);
12762                 sprintf(string, "%d\n", ret);
12763                 write(2, string, strlen(string));
12764                 alarm(0);
12765 #ifdef EAGAIN
12766                 if (errno == EAGAIN) {
12767                         printf("EAGAIN\n");
12768                         goto ok;
12769                 }
12770 #endif
12771 #ifdef EWOULDBLOCK
12772                 if (errno == EWOULDBLOCK)
12773                         printf("EWOULDBLOCK\n");
12774 #endif
12775         ok:
12776                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12777                 sleep(2);                               /* Give it time to close our pipe */
12778                 alarm(5);
12779                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12780                 alarm(0);
12781                 sprintf(string, "%d\n", ret);
12782                 write(4, string, strlen(string));
12783                 exit(0);
12784         }
12785
12786         close(pd[0]);                   /* We write to pd[1] */
12787         close(pu[1]);                   /* We read from pu[0] */
12788         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12789         close(pd[1]);                   /* Pipe pd is now fully closed! */
12790         exit(0);                                /* Bye bye, thank you for playing! */
12791 }
12792 EOCP
12793         set try
12794         if eval $compile_ok; then
12795                 echo "$startsh" >mtry
12796                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12797                 chmod +x mtry
12798                 ./mtry >/dev/null 2>&1
12799                 case $? in
12800                 0) eagain=`$cat try.out`;;
12801                 1) echo "Could not perform non-blocking setting!";;
12802                 2) echo "I did a successful read() for something that was not there!";;
12803                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12804                 4) echo "Could not find F_SETFL!";;
12805                 *) echo "Something terribly wrong happened during testing.";;
12806                 esac
12807                 rd_nodata=`$cat try.ret`
12808                 echo "A read() system call with no data present returns $rd_nodata."
12809                 case "$rd_nodata" in
12810                 0|-1) ;;
12811                 *)
12812                         echo "(That's peculiar, fixing that to be -1.)"
12813                         rd_nodata=-1
12814                         ;;
12815                 esac
12816                 case "$eagain" in
12817                 '')
12818                         echo "Forcing errno EAGAIN on read() with no data available."
12819                         eagain=EAGAIN
12820                         ;;
12821                 *)
12822                         echo "Your read() sets errno to $eagain when no data is available."
12823                         ;;
12824                 esac
12825                 status=`$cat try.err`
12826                 case "$status" in
12827                 0) echo "And it correctly returns 0 to signal EOF.";;
12828                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12829                 *) echo "However, your read() returns '$status' on EOF??";;
12830                 esac
12831                 val="$define"
12832                 if test "$status" = "$rd_nodata"; then
12833                         echo "WARNING: you can't distinguish between EOF and no data!"
12834                         val="$undef"
12835                 fi
12836         else
12837                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12838                 eagain=EAGAIN
12839         fi
12840         ;;
12841         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12842                 eagain=EAGAIN
12843                 val="$define"
12844                 ;;
12845         esac
12846         set d_eofnblk
12847         eval $setvar
12848         ;;
12849 *)
12850         echo "Using $hint value $eagain."
12851         echo "Your read() returns $rd_nodata when no data is present."
12852         case "$d_eofnblk" in
12853         "$define") echo "And you can see EOF because read() returns 0.";;
12854         "$undef") echo "But you can't see EOF status from read() returned value.";;
12855         *)
12856                 echo "(Assuming you can't see EOF status from read anyway.)"
12857                 d_eofnblk=$undef
12858                 ;;
12859         esac
12860         ;;
12861 esac
12862 $rm_try head.c mtry
12863
12864 : see if _ptr and _cnt from stdio act std
12865 echo " "
12866
12867 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12868         echo "(Looks like you have stdio.h from BSD.)"
12869         case "$stdio_ptr" in
12870         '') stdio_ptr='((fp)->_p)'
12871                 ptr_lval=$define
12872                 ;;
12873         *)      ptr_lval=$d_stdio_ptr_lval;;
12874         esac
12875         case "$stdio_cnt" in
12876         '') stdio_cnt='((fp)->_r)'
12877                 cnt_lval=$define
12878                 ;;
12879         *)      cnt_lval=$d_stdio_cnt_lval;;
12880         esac
12881         case "$stdio_base" in
12882         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12883         esac
12884         case "$stdio_bufsiz" in
12885         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12886         esac
12887 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12888         echo "(Looks like you have stdio.h from Linux.)"
12889         case "$stdio_ptr" in
12890         '') stdio_ptr='((fp)->_IO_read_ptr)'
12891                 ptr_lval=$define
12892                 ;;
12893         *)      ptr_lval=$d_stdio_ptr_lval;;
12894         esac
12895         case "$stdio_cnt" in
12896         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12897                 cnt_lval=$undef
12898                 ;;
12899         *)      cnt_lval=$d_stdio_cnt_lval;;
12900         esac
12901         case "$stdio_base" in
12902         '') stdio_base='((fp)->_IO_read_base)';;
12903         esac
12904         case "$stdio_bufsiz" in
12905         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12906         esac
12907 else
12908         case "$stdio_ptr" in
12909         '') stdio_ptr='((fp)->_ptr)'
12910                 ptr_lval=$define
12911                 ;;
12912         *)      ptr_lval=$d_stdio_ptr_lval;;
12913         esac
12914         case "$stdio_cnt" in
12915         '') stdio_cnt='((fp)->_cnt)'
12916                 cnt_lval=$define
12917                 ;;
12918         *)      cnt_lval=$d_stdio_cnt_lval;;
12919         esac
12920         case "$stdio_base" in
12921         '') stdio_base='((fp)->_base)';;
12922         esac
12923         case "$stdio_bufsiz" in
12924         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12925         esac
12926 fi
12927
12928 : test whether _ptr and _cnt really work
12929 echo "Checking how std your stdio is..." >&4
12930 $cat >try.c <<EOP
12931 #include <stdio.h>
12932 #$i_stdlib I_STDLIB
12933 #ifdef I_STDLIB
12934 #include <stdlib.h>
12935 #endif
12936 #define FILE_ptr(fp)    $stdio_ptr
12937 #define FILE_cnt(fp)    $stdio_cnt
12938 int main() {
12939         FILE *fp = fopen("try.c", "r");
12940         char c = getc(fp);
12941         if (
12942                 18 <= FILE_cnt(fp) &&
12943                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12944         )
12945                 exit(0);
12946         exit(1);
12947 }
12948 EOP
12949 val="$undef"
12950 set try
12951 if eval $compile && $to try.c; then
12952         if $run ./try; then
12953                 echo "Your stdio acts pretty std."
12954                 val="$define"
12955         else
12956                 echo "Your stdio isn't very std."
12957         fi
12958 else
12959         echo "Your stdio doesn't appear very std."
12960 fi
12961 $rm_try
12962
12963 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12964 # direct buffer manipulation no longer works.  The Configure tests
12965 # should be changed to correctly detect this, but until then,
12966 # the following check should at least let perl compile and run.
12967 # (This quick fix should be updated before 5.8.1.)
12968 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12969 # A. Dougherty, June 3, 2002.
12970 case "$d_gnulibc" in
12971 $define)
12972         case "$gnulibc_version" in
12973         2.[01]*)  ;;
12974         2.2) ;;
12975         2.2.[0-9]) ;;
12976         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12977                 val="$undef"
12978                 ;;
12979         esac
12980         ;;
12981 esac
12982 set d_stdstdio
12983 eval $setvar
12984
12985 : Can _ptr be used as an lvalue?
12986 case "$d_stdstdio$ptr_lval" in
12987 $define$define) val=$define ;;
12988 *) val=$undef ;;
12989 esac
12990 set d_stdio_ptr_lval
12991 eval $setvar
12992
12993 : Can _cnt be used as an lvalue?
12994 case "$d_stdstdio$cnt_lval" in
12995 $define$define) val=$define ;;
12996 *) val=$undef ;;
12997 esac
12998 set d_stdio_cnt_lval
12999 eval $setvar
13000
13001
13002 : test whether setting _ptr sets _cnt as a side effect
13003 d_stdio_ptr_lval_sets_cnt="$undef"
13004 d_stdio_ptr_lval_nochange_cnt="$undef"
13005 case "$d_stdio_ptr_lval$d_stdstdio" in
13006 $define$define)
13007         echo "Checking to see what happens if we set the stdio ptr..." >&4
13008 $cat >try.c <<EOP
13009 #include <stdio.h>
13010 /* Can we scream? */
13011 /* Eat dust sed :-) */
13012 /* In the buffer space, no one can hear you scream. */
13013 #$i_stdlib I_STDLIB
13014 #ifdef I_STDLIB
13015 #include <stdlib.h>
13016 #endif
13017 #define FILE_ptr(fp)    $stdio_ptr
13018 #define FILE_cnt(fp)    $stdio_cnt
13019 #include <sys/types.h>
13020 int main() {
13021         FILE *fp = fopen("try.c", "r");
13022         int c;
13023         char *ptr;
13024         size_t cnt;
13025         if (!fp) {
13026             puts("Fail even to read");
13027             exit(1);
13028         }
13029         c = getc(fp); /* Read away the first # */
13030         if (c == EOF) {
13031             puts("Fail even to read");
13032             exit(1);
13033         }
13034         if (!(
13035                 18 <= FILE_cnt(fp) &&
13036                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13037         )) {
13038                 puts("Fail even to read");
13039                 exit (1);
13040         }
13041         ptr = (char*) FILE_ptr(fp);
13042         cnt = (size_t)FILE_cnt(fp);
13043
13044         FILE_ptr(fp) += 42;
13045
13046         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13047                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13048                 exit (1);
13049         }
13050         if (FILE_cnt(fp) <= 20) {
13051                 printf ("Fail (<20 chars to test)");
13052                 exit (1);
13053         }
13054         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13055                 puts("Fail compare");
13056                 exit (1);
13057         }
13058         if (cnt == FILE_cnt(fp)) {
13059                 puts("Pass_unchanged");
13060                 exit (0);
13061         }
13062         if (FILE_cnt(fp) == (cnt - 42)) {
13063                 puts("Pass_changed");
13064                 exit (0);
13065         }
13066         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13067         return 1;
13068
13069 }
13070 EOP
13071         set try
13072         if eval $compile && $to try.c; then
13073                 case `$run ./try` in
13074                 Pass_changed)
13075                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13076                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13077                 Pass_unchanged)
13078                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13079                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13080                 Fail*)
13081                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13082                 *)
13083                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13084         esac
13085         else
13086                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13087         fi
13088         $rm_try
13089         ;;
13090 esac
13091
13092 : see if _base is also standard
13093 val="$undef"
13094 case "$d_stdstdio" in
13095 $define)
13096         $cat >try.c <<EOP
13097 #include <stdio.h>
13098 #$i_stdlib I_STDLIB
13099 #ifdef I_STDLIB
13100 #include <stdlib.h>
13101 #endif
13102 #define FILE_base(fp)   $stdio_base
13103 #define FILE_bufsiz(fp) $stdio_bufsiz
13104 int main() {
13105         FILE *fp = fopen("try.c", "r");
13106         char c = getc(fp);
13107         if (
13108                 19 <= FILE_bufsiz(fp) &&
13109                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13110         )
13111                 exit(0);
13112         exit(1);
13113 }
13114 EOP
13115         set try
13116         if eval $compile && $to try.c; then
13117                 if $run ./try; then
13118                         echo "And its _base field acts std."
13119                         val="$define"
13120                 else
13121                         echo "But its _base field isn't std."
13122                 fi
13123         else
13124                 echo "However, it seems to be lacking the _base field."
13125         fi
13126         $rm_try
13127         ;;
13128 esac
13129 set d_stdiobase
13130 eval $setvar
13131
13132 : see if fast_stdio exists
13133 val="$undef"
13134 case "$d_stdstdio:$d_stdio_ptr_lval" in
13135 "$define:$define")
13136         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13137         *$define*)
13138                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13139                 val="$define"
13140                 ;;
13141         esac
13142         ;;
13143 esac
13144 set d_faststdio
13145 eval $setvar
13146
13147
13148
13149 : see if fchdir exists
13150 set fchdir d_fchdir
13151 eval $inlibc
13152
13153 : see if fchmod exists
13154 set fchmod d_fchmod
13155 eval $inlibc
13156
13157 : see if fchown exists
13158 set fchown d_fchown
13159 eval $inlibc
13160
13161 : see if this is an fcntl system
13162 set fcntl d_fcntl
13163 eval $inlibc
13164
13165 : See if fcntl-based locking works.
13166 echo " "
13167 $cat >try.c <<EOCP
13168 #$i_stdlib I_STDLIB
13169 #ifdef I_STDLIB
13170 #include <stdlib.h>
13171 #endif
13172 #include <unistd.h>
13173 #include <fcntl.h>
13174 #include <signal.h>
13175 $signal_t blech(int x) { exit(3); }
13176 int main() {
13177 #if defined(F_SETLK) && defined(F_SETLKW)
13178      struct flock flock;
13179      int retval, fd;
13180      fd = open("try.c", O_RDONLY);
13181      flock.l_type = F_RDLCK;
13182      flock.l_whence = SEEK_SET;
13183      flock.l_start = flock.l_len = 0;
13184      signal(SIGALRM, blech);
13185      alarm(10);
13186      retval = fcntl(fd, F_SETLK, &flock);
13187      close(fd);
13188      (retval < 0 ? exit(2) : exit(0));
13189 #else
13190      exit(2);
13191 #endif
13192 }
13193 EOCP
13194 echo "Checking if fcntl-based file locking works... "
13195 case "$d_fcntl" in
13196 "$define")
13197         set try
13198         if eval $compile_ok; then
13199                 if $run ./try; then
13200                         echo "Yes, it seems to work."
13201                         val="$define"
13202                 else
13203                         echo "Nope, it didn't work."
13204                         val="$undef"
13205                         case "$?" in
13206                         3) $cat >&4 <<EOM
13207 ***
13208 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13209 *** This is (almost) impossible.
13210 *** If your NFS lock daemons are not feeling well, something like
13211 *** this may happen, please investigate.  Cannot continue, aborting.
13212 ***
13213 EOM
13214                                 exit 1
13215                                 ;;
13216                         esac
13217                 fi
13218         else
13219                 echo "I'm unable to compile the test program, so I'll assume not."
13220                 val="$undef"
13221         fi
13222         ;;
13223 *) val="$undef";
13224         echo "Nope, since you don't even have fcntl()."
13225         ;;
13226 esac
13227 set d_fcntl_can_lock
13228 eval $setvar
13229 $rm_try
13230
13231 : check for fd_set items
13232 $cat <<EOM
13233
13234 Checking to see how well your C compiler handles fd_set and friends ...
13235 EOM
13236 $cat >try.c <<EOCP
13237 #$i_stdlib I_STDLIB
13238 #ifdef I_STDLIB
13239 #include <stdlib.h>
13240 #endif
13241 #$i_systime I_SYS_TIME
13242 #$i_sysselct I_SYS_SELECT
13243 #$d_socket HAS_SOCKET
13244 #include <sys/types.h>
13245 #ifdef HAS_SOCKET
13246 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13247 #endif
13248 #ifdef I_SYS_TIME
13249 #include <sys/time.h>
13250 #endif
13251 #ifdef I_SYS_SELECT
13252 #include <sys/select.h>
13253 #endif
13254 int main() {
13255         fd_set fds;
13256
13257 #ifdef TRYBITS
13258         if(fds.fds_bits);
13259 #endif
13260
13261 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13262         exit(0);
13263 #else
13264         exit(1);
13265 #endif
13266 }
13267 EOCP
13268 set try -DTRYBITS
13269 if eval $compile; then
13270         d_fds_bits="$define"
13271         d_fd_set="$define"
13272         echo "Well, your system knows about the normal fd_set typedef..." >&4
13273         if $run ./try; then
13274                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13275                 d_fd_macros="$define"
13276         else
13277                 $cat >&4 <<'EOM'
13278 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13279 EOM
13280                 d_fd_macros="$undef"
13281         fi
13282 else
13283         $cat <<'EOM'
13284 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13285 EOM
13286         set try
13287         if eval $compile; then
13288                 d_fds_bits="$undef"
13289                 d_fd_set="$define"
13290                 echo "Well, your system has some sort of fd_set available..." >&4
13291                 if $run ./try; then
13292                         echo "and you have the normal fd_set macros." >&4
13293                         d_fd_macros="$define"
13294                 else
13295                         $cat <<'EOM'
13296 but not the normal fd_set macros!  Gross!  More work for me...
13297 EOM
13298                         d_fd_macros="$undef"
13299                 fi
13300         else
13301         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13302                 d_fd_set="$undef"
13303                 d_fds_bits="$undef"
13304                 d_fd_macros="$undef"
13305         fi
13306 fi
13307 $rm_try
13308
13309 : see if fgetpos exists
13310 set fgetpos d_fgetpos
13311 eval $inlibc
13312
13313 : see if finite exists
13314 set finite d_finite
13315 eval $inlibc
13316
13317 : see if finitel exists
13318 set finitel d_finitel
13319 eval $inlibc
13320
13321 : see if flock exists
13322 set flock d_flock
13323 eval $inlibc
13324
13325 : see if prototype for flock is available
13326 echo " "
13327 set d_flockproto flock $i_sysfile sys/file.h
13328 eval $hasproto
13329
13330 : see if fp_class exists
13331 set fp_class d_fp_class
13332 eval $inlibc
13333
13334 : see if pathconf exists
13335 set pathconf d_pathconf
13336 eval $inlibc
13337
13338 : see if fpathconf exists
13339 set fpathconf d_fpathconf
13340 eval $inlibc
13341
13342 : see if fpclass exists
13343 set fpclass d_fpclass
13344 eval $inlibc
13345
13346 : see if fpclassify exists
13347 set fpclassify d_fpclassify
13348 eval $inlibc
13349
13350 : see if fpclassl exists
13351 set fpclassl d_fpclassl
13352 eval $inlibc
13353
13354 : check for fpos64_t
13355 echo " "
13356 echo "Checking to see if you have fpos64_t..." >&4
13357 $cat >try.c <<EOCP
13358 #include <stdio.h>
13359 int main() { fpos64_t x = 7; }
13360 EOCP
13361 set try
13362 if eval $compile; then
13363         val="$define"
13364         echo "You have fpos64_t."
13365 else
13366         val="$undef"
13367         echo "You do not have fpos64_t."
13368         case "$fpossize" in
13369         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13370         esac
13371 fi
13372 $rm_try
13373 set d_fpos64_t
13374 eval $setvar
13375
13376 : see if frexpl exists
13377 set frexpl d_frexpl
13378 eval $inlibc
13379
13380 : see if this is a sys/param system
13381 set sys/param.h i_sysparam
13382 eval $inhdr
13383
13384 : see if this is a sys/mount.h system
13385 set sys/mount.h i_sysmount
13386 eval $inhdr
13387
13388 : Check for fs_data_s
13389 echo " "
13390 echo "Checking to see if your system supports struct fs_data..." >&4
13391 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13392 eval $hasstruct
13393 case "$d_fs_data_s" in
13394 "$define")      echo "Yes, it does."   ;;
13395 *)              echo "No, it doesn't." ;;
13396 esac
13397
13398 : see if fseeko exists
13399 set fseeko d_fseeko
13400 eval $inlibc
13401 case "$longsize" in
13402 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13403 esac
13404
13405 : see if fsetpos exists
13406 set fsetpos d_fsetpos
13407 eval $inlibc
13408
13409 : see if fstatfs exists
13410 set fstatfs d_fstatfs
13411 eval $inlibc
13412
13413 : see if statvfs exists
13414 set statvfs d_statvfs
13415 eval $inlibc
13416
13417 : see if fstatvfs exists
13418 set fstatvfs d_fstatvfs
13419 eval $inlibc
13420
13421
13422 : see if fsync exists
13423 set fsync d_fsync
13424 eval $inlibc
13425
13426 : see if ftello exists
13427 set ftello d_ftello
13428 eval $inlibc
13429 case "$longsize" in
13430 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13431 esac
13432
13433 : check for a working futimes
13434 d_futimes="$undef"
13435 echo " "
13436 echo "Checking if you have a working futimes()" >&4
13437 $cat >try.c <<EOCP
13438 #include <stdio.h>
13439 #include <sys/time.h>
13440 #include <errno.h>
13441 #include <fcntl.h>
13442
13443 int main ()
13444 {
13445     int fd, rv;
13446     fd = open ("try.c", O_RDWR);
13447     if (-1 == fd) exit (1);
13448     rv = futimes (fd, NULL);
13449     exit (rv == -1 ? errno : 0);
13450 }
13451 EOCP
13452 set try
13453 if eval $compile; then
13454     `$run ./try`
13455     rc=$?
13456     case "$rc" in
13457         0)  echo "Yes, you have" >&4
13458             d_futimes="$define"
13459             ;;
13460         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13461             ;;
13462     esac
13463 else
13464     echo "No, it does not (probably harmless)" >&4
13465 fi
13466 $rm_try
13467
13468 : see if ndbm.h is available
13469 set ndbm.h i_ndbm
13470 eval $inhdr
13471 : Compatibility location for RedHat 7.1
13472 set gdbm/ndbm.h i_gdbmndbm
13473 eval $inhdr
13474 : Compatibility location for Debian 4.0
13475 set gdbm-ndbm.h i_gdbm_ndbm
13476 eval $inhdr
13477
13478 val="$undef"
13479 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13480         : see if dbm_open exists
13481         set dbm_open d_dbm_open
13482         eval $inlibc
13483         case "$d_dbm_open" in
13484         $undef)
13485                 i_ndbm="$undef"
13486                 i_gdbmndbm="$undef"
13487                 i_gdbm_ndbm="$undef"
13488                 echo "We won't be including <ndbm.h>"
13489                 val="$undef"
13490                 ;;
13491         *) val="$define"
13492            ;;
13493         esac
13494 fi
13495 set d_ndbm
13496 eval $setvar
13497
13498 ndbm_hdr_protochk='name=$1; hdr=$2;
13499 eval "ihdr=\$""i_$name";
13500 val="$undef";
13501 if $test "$ihdr" = "$define"; then
13502         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13503         case "$d_cplusplus" in
13504         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13505         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13506         esac;
13507         case "$val" in
13508         $define) $echo "Your <$hdr> seems to have prototypes";;
13509         *) $echo "Your <$hdr> does not seem to have prototypes";;
13510         esac;
13511 fi;
13512 set "d_${name}_h_uses_prototypes";
13513 eval $setvar'
13514
13515 set ndbm ndbm.h
13516 eval $ndbm_hdr_protochk
13517 set gdbmndbm gdbm/ndbm.h
13518 eval $ndbm_hdr_protochk
13519 set gdbm_ndbm gdbm-ndbm.h
13520 eval $ndbm_hdr_protochk
13521
13522 : see if getaddrinfo exists
13523 set getaddrinfo d_getaddrinfo
13524 eval $inlibc
13525
13526 : see if getcwd exists
13527 set getcwd d_getcwd
13528 eval $inlibc
13529
13530 : see if getespwnam exists
13531 set getespwnam d_getespwnam
13532 eval $inlibc
13533
13534 : see if getfsstat exists
13535 set getfsstat d_getfsstat
13536 eval $inlibc
13537
13538 : see if getgrent exists
13539 set getgrent d_getgrent
13540 eval $inlibc
13541
13542 : see if getgrent_r exists
13543 set getgrent_r d_getgrent_r
13544 eval $inlibc
13545 case "$d_getgrent_r" in
13546 "$define")
13547         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13548         case "$d_getgrent_r_proto:$usethreads" in
13549         ":define")      d_getgrent_r_proto=define
13550                 set d_getgrent_r_proto getgrent_r $hdrs
13551                 eval $hasproto ;;
13552         *)      ;;
13553         esac
13554         case "$d_getgrent_r_proto" in
13555         define)
13556         case "$getgrent_r_proto" in
13557         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13558         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13559         esac
13560         case "$getgrent_r_proto" in
13561         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13562         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13563         esac
13564         case "$getgrent_r_proto" in
13565         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13566         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13567         esac
13568         case "$getgrent_r_proto" in
13569         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13570         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13571         esac
13572         case "$getgrent_r_proto" in
13573         ''|0) try='int getgrent_r(struct group*, char*, int);'
13574         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13575         esac
13576         case "$getgrent_r_proto" in
13577         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13578         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13579         esac
13580         case "$getgrent_r_proto" in
13581         ''|0)   d_getgrent_r=undef
13582                 getgrent_r_proto=0
13583                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13584         * )     case "$getgrent_r_proto" in
13585                 REENTRANT_PROTO*) ;;
13586                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13587                 esac
13588                 echo "Prototype: $try" ;;
13589         esac
13590         ;;
13591         *)      case "$usethreads" in
13592                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13593                 esac
13594                 d_getgrent_r=undef
13595                 getgrent_r_proto=0
13596                 ;;
13597         esac
13598         ;;
13599 *)      getgrent_r_proto=0
13600         ;;
13601 esac
13602
13603 : see if getgrgid_r exists
13604 set getgrgid_r d_getgrgid_r
13605 eval $inlibc
13606 case "$d_getgrgid_r" in
13607 "$define")
13608         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13609         case "$d_getgrgid_r_proto:$usethreads" in
13610         ":define")      d_getgrgid_r_proto=define
13611                 set d_getgrgid_r_proto getgrgid_r $hdrs
13612                 eval $hasproto ;;
13613         *)      ;;
13614         esac
13615         case "$d_getgrgid_r_proto" in
13616         define)
13617         case "$getgrgid_r_proto" in
13618         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13619         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13620         esac
13621         case "$getgrgid_r_proto" in
13622         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13623         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13624         esac
13625         case "$getgrgid_r_proto" in
13626         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13627         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13628         esac
13629         case "$getgrgid_r_proto" in
13630         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13631         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13632         esac
13633         case "$getgrgid_r_proto" in
13634         ''|0)   d_getgrgid_r=undef
13635                 getgrgid_r_proto=0
13636                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13637         * )     case "$getgrgid_r_proto" in
13638                 REENTRANT_PROTO*) ;;
13639                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13640                 esac
13641                 echo "Prototype: $try" ;;
13642         esac
13643         ;;
13644         *)      case "$usethreads" in
13645                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13646                 esac
13647                 d_getgrgid_r=undef
13648                 getgrgid_r_proto=0
13649                 ;;
13650         esac
13651         ;;
13652 *)      getgrgid_r_proto=0
13653         ;;
13654 esac
13655
13656 : see if getgrnam_r exists
13657 set getgrnam_r d_getgrnam_r
13658 eval $inlibc
13659 case "$d_getgrnam_r" in
13660 "$define")
13661         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13662         case "$d_getgrnam_r_proto:$usethreads" in
13663         ":define")      d_getgrnam_r_proto=define
13664                 set d_getgrnam_r_proto getgrnam_r $hdrs
13665                 eval $hasproto ;;
13666         *)      ;;
13667         esac
13668         case "$d_getgrnam_r_proto" in
13669         define)
13670         case "$getgrnam_r_proto" in
13671         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13672         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13673         esac
13674         case "$getgrnam_r_proto" in
13675         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13676         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13677         esac
13678         case "$getgrnam_r_proto" in
13679         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13680         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13681         esac
13682         case "$getgrnam_r_proto" in
13683         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13684         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13685         esac
13686         case "$getgrnam_r_proto" in
13687         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13688         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13689         esac
13690         case "$getgrnam_r_proto" in
13691         ''|0)   d_getgrnam_r=undef
13692                 getgrnam_r_proto=0
13693                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13694         * )     case "$getgrnam_r_proto" in
13695                 REENTRANT_PROTO*) ;;
13696                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13697                 esac
13698                 echo "Prototype: $try" ;;
13699         esac
13700         ;;
13701         *)      case "$usethreads" in
13702                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13703                 esac
13704                 d_getgrnam_r=undef
13705                 getgrnam_r_proto=0
13706                 ;;
13707         esac
13708         ;;
13709 *)      getgrnam_r_proto=0
13710         ;;
13711 esac
13712
13713 : see if gethostbyaddr exists
13714 set gethostbyaddr d_gethbyaddr
13715 eval $inlibc
13716
13717 : see if gethostbyname exists
13718 set gethostbyname d_gethbyname
13719 eval $inlibc
13720
13721 : see if gethostent exists
13722 set gethostent d_gethent
13723 eval $inlibc
13724
13725 : see how we will look up host name
13726 echo " "
13727 call=''
13728 if set gethostname val -f d_gethname; eval $csym; $val; then
13729         echo 'gethostname() found.' >&4
13730         d_gethname="$define"
13731         call=gethostname
13732 fi
13733 if set uname val -f d_uname; eval $csym; $val; then
13734         if ./xenix; then
13735                 $cat <<'EOM'
13736 uname() was found, but you're running xenix, and older versions of xenix
13737 have a broken uname(). If you don't really know whether your xenix is old
13738 enough to have a broken system call, use the default answer.
13739
13740 EOM
13741                 dflt=y
13742                 case "$d_uname" in
13743                 "$define") dflt=n;;
13744                 esac
13745                 rp='Is your uname() broken?'
13746                 . ./myread
13747                 case "$ans" in
13748                 n*) d_uname="$define"; call=uname;;
13749                 esac
13750         else
13751                 echo 'uname() found.' >&4
13752                 d_uname="$define"
13753                 case "$call" in
13754                 '') call=uname ;;
13755                 esac
13756         fi
13757 fi
13758 case "$d_gethname" in
13759 '') d_gethname="$undef";;
13760 esac
13761 case "$d_uname" in
13762 '') d_uname="$undef";;
13763 esac
13764 case "$d_uname$d_gethname" in
13765 *define*)
13766         dflt=n
13767         cat <<EOM
13768
13769 Every now and then someone has a $call() that lies about the hostname
13770 but can't be fixed for political or economic reasons.  If you wish, I can
13771 pretend $call() isn't there and maybe compute hostname at run-time
13772 thanks to the '$phostname' command.
13773
13774 EOM
13775         rp="Shall I ignore $call() from now on?"
13776         . ./myread
13777         case "$ans" in
13778         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13779         esac;;
13780 esac
13781 case "$phostname" in
13782 '') aphostname='';;
13783 *) case "$aphostname" in
13784         /*) ;;
13785         *) set X $phostname
13786                 shift
13787                 file=$1
13788                 shift
13789                 file=`./loc $file $file $pth`
13790                 aphostname=`echo $file $*`
13791                 ;;
13792         esac
13793         ;;
13794 esac
13795 case "$d_uname$d_gethname" in
13796 *define*) ;;
13797 *)
13798         case "$phostname" in
13799         '')
13800                 echo "There will be no way for $package to get your hostname." >&4;;
13801         *)
13802         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13803                 ;;
13804         esac;;
13805 esac
13806 case "$d_phostname" in
13807 '') d_phostname="$undef";;
13808 esac
13809
13810 : see if gethostbyaddr_r exists
13811 set gethostbyaddr_r d_gethostbyaddr_r
13812 eval $inlibc
13813 case "$d_gethostbyaddr_r" in
13814 "$define")
13815         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13816         case "$d_gethostbyaddr_r_proto:$usethreads" in
13817         ":define")      d_gethostbyaddr_r_proto=define
13818                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13819                 eval $hasproto ;;
13820         *)      ;;
13821         esac
13822         case "$d_gethostbyaddr_r_proto" in
13823         define)
13824         case "$gethostbyaddr_r_proto" in
13825         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13826         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13827         esac
13828         case "$gethostbyaddr_r_proto" in
13829         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13830         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13831         esac
13832         case "$gethostbyaddr_r_proto" in
13833         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13834         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13835         esac
13836         case "$gethostbyaddr_r_proto" in
13837         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13838         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13839         esac
13840         case "$gethostbyaddr_r_proto" in
13841         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13842         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13843         esac
13844         case "$gethostbyaddr_r_proto" in
13845         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13846         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13847         esac
13848         case "$gethostbyaddr_r_proto" in
13849         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13850         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13851         esac
13852         case "$gethostbyaddr_r_proto" in
13853         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13854         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13855         esac
13856         case "$gethostbyaddr_r_proto" in
13857         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13858         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13859         esac
13860         case "$gethostbyaddr_r_proto" in
13861         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13862         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13863         esac
13864         case "$gethostbyaddr_r_proto" in
13865         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13866         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13867         esac
13868         case "$gethostbyaddr_r_proto" in
13869         ''|0)   d_gethostbyaddr_r=undef
13870                 gethostbyaddr_r_proto=0
13871                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13872         * )     case "$gethostbyaddr_r_proto" in
13873                 REENTRANT_PROTO*) ;;
13874                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13875                 esac
13876                 echo "Prototype: $try" ;;
13877         esac
13878         ;;
13879         *)      case "$usethreads" in
13880                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13881                 esac
13882                 d_gethostbyaddr_r=undef
13883                 gethostbyaddr_r_proto=0
13884                 ;;
13885         esac
13886         ;;
13887 *)      gethostbyaddr_r_proto=0
13888         ;;
13889 esac
13890
13891 : see if gethostbyname_r exists
13892 set gethostbyname_r d_gethostbyname_r
13893 eval $inlibc
13894 case "$d_gethostbyname_r" in
13895 "$define")
13896         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13897         case "$d_gethostbyname_r_proto:$usethreads" in
13898         ":define")      d_gethostbyname_r_proto=define
13899                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13900                 eval $hasproto ;;
13901         *)      ;;
13902         esac
13903         case "$d_gethostbyname_r_proto" in
13904         define)
13905         case "$gethostbyname_r_proto" in
13906         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13907         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13908         esac
13909         case "$gethostbyname_r_proto" in
13910         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13911         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13912         esac
13913         case "$gethostbyname_r_proto" in
13914         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13915         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13916         esac
13917         case "$gethostbyname_r_proto" in
13918         ''|0)   d_gethostbyname_r=undef
13919                 gethostbyname_r_proto=0
13920                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13921         * )     case "$gethostbyname_r_proto" in
13922                 REENTRANT_PROTO*) ;;
13923                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13924                 esac
13925                 echo "Prototype: $try" ;;
13926         esac
13927         ;;
13928         *)      case "$usethreads" in
13929                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13930                 esac
13931                 d_gethostbyname_r=undef
13932                 gethostbyname_r_proto=0
13933                 ;;
13934         esac
13935         ;;
13936 *)      gethostbyname_r_proto=0
13937         ;;
13938 esac
13939
13940 : see if gethostent_r exists
13941 set gethostent_r d_gethostent_r
13942 eval $inlibc
13943 case "$d_gethostent_r" in
13944 "$define")
13945         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13946         case "$d_gethostent_r_proto:$usethreads" in
13947         ":define")      d_gethostent_r_proto=define
13948                 set d_gethostent_r_proto gethostent_r $hdrs
13949                 eval $hasproto ;;
13950         *)      ;;
13951         esac
13952         case "$d_gethostent_r_proto" in
13953         define)
13954         case "$gethostent_r_proto" in
13955         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13956         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13957         esac
13958         case "$gethostent_r_proto" in
13959         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13960         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13961         esac
13962         case "$gethostent_r_proto" in
13963         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13964         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13965         esac
13966         case "$gethostent_r_proto" in
13967         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13968         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13969         esac
13970         case "$gethostent_r_proto" in
13971         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13972         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13973         esac
13974         case "$gethostent_r_proto" in
13975         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13976         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13977         esac
13978         case "$gethostent_r_proto" in
13979         ''|0)   d_gethostent_r=undef
13980                 gethostent_r_proto=0
13981                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13982         * )     case "$gethostent_r_proto" in
13983                 REENTRANT_PROTO*) ;;
13984                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13985                 esac
13986                 echo "Prototype: $try" ;;
13987         esac
13988         ;;
13989         *)      case "$usethreads" in
13990                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13991                 esac
13992                 d_gethostent_r=undef
13993                 gethostent_r_proto=0
13994                 ;;
13995         esac
13996         ;;
13997 *)      gethostent_r_proto=0
13998         ;;
13999 esac
14000
14001 : see if prototypes for various gethostxxx netdb.h functions are available
14002 echo " "
14003 set d_gethostprotos gethostent $i_netdb netdb.h
14004 eval $hasproto
14005
14006 : see if getitimer exists
14007 set getitimer d_getitimer
14008 eval $inlibc
14009
14010 : see if getlogin exists
14011 set getlogin d_getlogin
14012 eval $inlibc
14013
14014 : see if getlogin_r exists
14015 set getlogin_r d_getlogin_r
14016 eval $inlibc
14017 case "$d_getlogin_r" in
14018 "$define")
14019         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14020         case "$d_getlogin_r_proto:$usethreads" in
14021         ":define")      d_getlogin_r_proto=define
14022                 set d_getlogin_r_proto getlogin_r $hdrs
14023                 eval $hasproto ;;
14024         *)      ;;
14025         esac
14026         case "$d_getlogin_r_proto" in
14027         define)
14028         case "$getlogin_r_proto" in
14029         ''|0) try='int getlogin_r(char*, size_t);'
14030         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14031         esac
14032         case "$getlogin_r_proto" in
14033         ''|0) try='int getlogin_r(char*, int);'
14034         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14035         esac
14036         case "$getlogin_r_proto" in
14037         ''|0) try='char* getlogin_r(char*, size_t);'
14038         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14039         esac
14040         case "$getlogin_r_proto" in
14041         ''|0) try='char* getlogin_r(char*, int);'
14042         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14043         esac
14044         case "$getlogin_r_proto" in
14045         ''|0)   d_getlogin_r=undef
14046                 getlogin_r_proto=0
14047                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14048         * )     case "$getlogin_r_proto" in
14049                 REENTRANT_PROTO*) ;;
14050                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14051                 esac
14052                 echo "Prototype: $try" ;;
14053         esac
14054         ;;
14055         *)      case "$usethreads" in
14056                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14057                 esac
14058                 d_getlogin_r=undef
14059                 getlogin_r_proto=0
14060                 ;;
14061         esac
14062         ;;
14063 *)      getlogin_r_proto=0
14064         ;;
14065 esac
14066
14067 : see if getmnt exists
14068 set getmnt d_getmnt
14069 eval $inlibc
14070
14071 : see if getmntent exists
14072 set getmntent d_getmntent
14073 eval $inlibc
14074
14075 : see if getnameinfo exists
14076 set getnameinfo d_getnameinfo
14077 eval $inlibc
14078
14079 : see if getnetbyaddr exists
14080 set getnetbyaddr d_getnbyaddr
14081 eval $inlibc
14082
14083 : see if getnetbyname exists
14084 set getnetbyname d_getnbyname
14085 eval $inlibc
14086
14087 : see if getnetent exists
14088 set getnetent d_getnent
14089 eval $inlibc
14090
14091 : see if getnetbyaddr_r exists
14092 set getnetbyaddr_r d_getnetbyaddr_r
14093 eval $inlibc
14094 case "$d_getnetbyaddr_r" in
14095 "$define")
14096         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14097         case "$d_getnetbyaddr_r_proto:$usethreads" in
14098         ":define")      d_getnetbyaddr_r_proto=define
14099                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14100                 eval $hasproto ;;
14101         *)      ;;
14102         esac
14103         case "$d_getnetbyaddr_r_proto" in
14104         define)
14105         case "$getnetbyaddr_r_proto" in
14106         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14107         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14108         esac
14109         case "$getnetbyaddr_r_proto" in
14110         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14111         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14112         esac
14113         case "$getnetbyaddr_r_proto" in
14114         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14115         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14116         esac
14117         case "$getnetbyaddr_r_proto" in
14118         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14119         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14120         esac
14121         case "$getnetbyaddr_r_proto" in
14122         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14123         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14124         esac
14125         case "$getnetbyaddr_r_proto" in
14126         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14127         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14128         esac
14129         case "$getnetbyaddr_r_proto" in
14130         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14131         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14132         esac
14133         case "$getnetbyaddr_r_proto" in
14134         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14135         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14136         esac
14137         case "$getnetbyaddr_r_proto" in
14138         ''|0)   d_getnetbyaddr_r=undef
14139                 getnetbyaddr_r_proto=0
14140                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14141         * )     case "$getnetbyaddr_r_proto" in
14142                 REENTRANT_PROTO*) ;;
14143                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14144                 esac
14145                 echo "Prototype: $try" ;;
14146         esac
14147         ;;
14148         *)      case "$usethreads" in
14149                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14150                 esac
14151                 d_getnetbyaddr_r=undef
14152                 getnetbyaddr_r_proto=0
14153                 ;;
14154         esac
14155         ;;
14156 *)      getnetbyaddr_r_proto=0
14157         ;;
14158 esac
14159
14160 : see if getnetbyname_r exists
14161 set getnetbyname_r d_getnetbyname_r
14162 eval $inlibc
14163 case "$d_getnetbyname_r" in
14164 "$define")
14165         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14166         case "$d_getnetbyname_r_proto:$usethreads" in
14167         ":define")      d_getnetbyname_r_proto=define
14168                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14169                 eval $hasproto ;;
14170         *)      ;;
14171         esac
14172         case "$d_getnetbyname_r_proto" in
14173         define)
14174         case "$getnetbyname_r_proto" in
14175         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14176         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14177         esac
14178         case "$getnetbyname_r_proto" in
14179         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14180         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14181         esac
14182         case "$getnetbyname_r_proto" in
14183         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14184         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14185         esac
14186         case "$getnetbyname_r_proto" in
14187         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14188         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14189         esac
14190         case "$getnetbyname_r_proto" in
14191         ''|0)   d_getnetbyname_r=undef
14192                 getnetbyname_r_proto=0
14193                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14194         * )     case "$getnetbyname_r_proto" in
14195                 REENTRANT_PROTO*) ;;
14196                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14197                 esac
14198                 echo "Prototype: $try" ;;
14199         esac
14200         ;;
14201         *)      case "$usethreads" in
14202                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14203                 esac
14204                 d_getnetbyname_r=undef
14205                 getnetbyname_r_proto=0
14206                 ;;
14207         esac
14208         ;;
14209 *)      getnetbyname_r_proto=0
14210         ;;
14211 esac
14212
14213 : see if getnetent_r exists
14214 set getnetent_r d_getnetent_r
14215 eval $inlibc
14216 case "$d_getnetent_r" in
14217 "$define")
14218         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14219         case "$d_getnetent_r_proto:$usethreads" in
14220         ":define")      d_getnetent_r_proto=define
14221                 set d_getnetent_r_proto getnetent_r $hdrs
14222                 eval $hasproto ;;
14223         *)      ;;
14224         esac
14225         case "$d_getnetent_r_proto" in
14226         define)
14227         case "$getnetent_r_proto" in
14228         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14229         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14230         esac
14231         case "$getnetent_r_proto" in
14232         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14233         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14234         esac
14235         case "$getnetent_r_proto" in
14236         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14237         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14238         esac
14239         case "$getnetent_r_proto" in
14240         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14241         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14242         esac
14243         case "$getnetent_r_proto" in
14244         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14245         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14246         esac
14247         case "$getnetent_r_proto" in
14248         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14249         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14250         esac
14251         case "$getnetent_r_proto" in
14252         ''|0)   d_getnetent_r=undef
14253                 getnetent_r_proto=0
14254                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14255         * )     case "$getnetent_r_proto" in
14256                 REENTRANT_PROTO*) ;;
14257                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14258                 esac
14259                 echo "Prototype: $try" ;;
14260         esac
14261         ;;
14262         *)      case "$usethreads" in
14263                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14264                 esac
14265                 d_getnetent_r=undef
14266                 getnetent_r_proto=0
14267                 ;;
14268         esac
14269         ;;
14270 *)      getnetent_r_proto=0
14271         ;;
14272 esac
14273
14274 : see if prototypes for various getnetxxx netdb.h functions are available
14275 echo " "
14276 set d_getnetprotos getnetent $i_netdb netdb.h
14277 eval $hasproto
14278
14279 : see if getpagesize exists
14280 set getpagesize d_getpagsz
14281 eval $inlibc
14282
14283 : Optional checks for getprotobyname and getprotobynumber
14284
14285 : see if getprotobyname exists
14286 set getprotobyname d_getpbyname
14287 eval $inlibc
14288
14289 : see if getprotobynumber exists
14290 set getprotobynumber d_getpbynumber
14291 eval $inlibc
14292
14293 : see if getprotoent exists
14294 set getprotoent d_getpent
14295 eval $inlibc
14296
14297 : see if getpgid exists
14298 set getpgid d_getpgid
14299 eval $inlibc
14300
14301 : see if getpgrp2 exists
14302 set getpgrp2 d_getpgrp2
14303 eval $inlibc
14304
14305 : see if getppid exists
14306 set getppid d_getppid
14307 eval $inlibc
14308
14309 : see if getpriority exists
14310 set getpriority d_getprior
14311 eval $inlibc
14312
14313 : see if getprotobyname_r exists
14314 set getprotobyname_r d_getprotobyname_r
14315 eval $inlibc
14316 case "$d_getprotobyname_r" in
14317 "$define")
14318         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14319         case "$d_getprotobyname_r_proto:$usethreads" in
14320         ":define")      d_getprotobyname_r_proto=define
14321                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14322                 eval $hasproto ;;
14323         *)      ;;
14324         esac
14325         case "$d_getprotobyname_r_proto" in
14326         define)
14327         case "$getprotobyname_r_proto" in
14328         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14329         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14330         esac
14331         case "$getprotobyname_r_proto" in
14332         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14333         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14334         esac
14335         case "$getprotobyname_r_proto" in
14336         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14337         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14338         esac
14339         case "$getprotobyname_r_proto" in
14340         ''|0)   d_getprotobyname_r=undef
14341                 getprotobyname_r_proto=0
14342                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14343         * )     case "$getprotobyname_r_proto" in
14344                 REENTRANT_PROTO*) ;;
14345                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14346                 esac
14347                 echo "Prototype: $try" ;;
14348         esac
14349         ;;
14350         *)      case "$usethreads" in
14351                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14352                 esac
14353                 d_getprotobyname_r=undef
14354                 getprotobyname_r_proto=0
14355                 ;;
14356         esac
14357         ;;
14358 *)      getprotobyname_r_proto=0
14359         ;;
14360 esac
14361
14362 : see if getprotobynumber_r exists
14363 set getprotobynumber_r d_getprotobynumber_r
14364 eval $inlibc
14365 case "$d_getprotobynumber_r" in
14366 "$define")
14367         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14368         case "$d_getprotobynumber_r_proto:$usethreads" in
14369         ":define")      d_getprotobynumber_r_proto=define
14370                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14371                 eval $hasproto ;;
14372         *)      ;;
14373         esac
14374         case "$d_getprotobynumber_r_proto" in
14375         define)
14376         case "$getprotobynumber_r_proto" in
14377         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14378         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14379         esac
14380         case "$getprotobynumber_r_proto" in
14381         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14382         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14383         esac
14384         case "$getprotobynumber_r_proto" in
14385         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14386         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14387         esac
14388         case "$getprotobynumber_r_proto" in
14389         ''|0)   d_getprotobynumber_r=undef
14390                 getprotobynumber_r_proto=0
14391                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14392         * )     case "$getprotobynumber_r_proto" in
14393                 REENTRANT_PROTO*) ;;
14394                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14395                 esac
14396                 echo "Prototype: $try" ;;
14397         esac
14398         ;;
14399         *)      case "$usethreads" in
14400                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14401                 esac
14402                 d_getprotobynumber_r=undef
14403                 getprotobynumber_r_proto=0
14404                 ;;
14405         esac
14406         ;;
14407 *)      getprotobynumber_r_proto=0
14408         ;;
14409 esac
14410
14411 : see if getprotoent_r exists
14412 set getprotoent_r d_getprotoent_r
14413 eval $inlibc
14414 case "$d_getprotoent_r" in
14415 "$define")
14416         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14417         case "$d_getprotoent_r_proto:$usethreads" in
14418         ":define")      d_getprotoent_r_proto=define
14419                 set d_getprotoent_r_proto getprotoent_r $hdrs
14420                 eval $hasproto ;;
14421         *)      ;;
14422         esac
14423         case "$d_getprotoent_r_proto" in
14424         define)
14425         case "$getprotoent_r_proto" in
14426         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14427         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14428         esac
14429         case "$getprotoent_r_proto" in
14430         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14431         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14432         esac
14433         case "$getprotoent_r_proto" in
14434         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14435         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14436         esac
14437         case "$getprotoent_r_proto" in
14438         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14439         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14440         esac
14441         case "$getprotoent_r_proto" in
14442         ''|0)   d_getprotoent_r=undef
14443                 getprotoent_r_proto=0
14444                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14445         * )     case "$getprotoent_r_proto" in
14446                 REENTRANT_PROTO*) ;;
14447                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14448                 esac
14449                 echo "Prototype: $try" ;;
14450         esac
14451         ;;
14452         *)      case "$usethreads" in
14453                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14454                 esac
14455                 d_getprotoent_r=undef
14456                 getprotoent_r_proto=0
14457                 ;;
14458         esac
14459         ;;
14460 *)      getprotoent_r_proto=0
14461         ;;
14462 esac
14463
14464 : see if prototypes for various getprotoxxx netdb.h functions are available
14465 echo " "
14466 set d_getprotoprotos getprotoent $i_netdb netdb.h
14467 eval $hasproto
14468
14469 : see if getprpwnam exists
14470 set getprpwnam d_getprpwnam
14471 eval $inlibc
14472
14473 : see if getpwent exists
14474 set getpwent d_getpwent
14475 eval $inlibc
14476
14477 : see if getpwent_r exists
14478 set getpwent_r d_getpwent_r
14479 eval $inlibc
14480 case "$d_getpwent_r" in
14481 "$define")
14482         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14483         case "$d_getpwent_r_proto:$usethreads" in
14484         ":define")      d_getpwent_r_proto=define
14485                 set d_getpwent_r_proto getpwent_r $hdrs
14486                 eval $hasproto ;;
14487         *)      ;;
14488         esac
14489         case "$d_getpwent_r_proto" in
14490         define)
14491         case "$getpwent_r_proto" in
14492         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14493         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14494         esac
14495         case "$getpwent_r_proto" in
14496         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14497         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14498         esac
14499         case "$getpwent_r_proto" in
14500         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14501         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14502         esac
14503         case "$getpwent_r_proto" in
14504         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14505         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14506         esac
14507         case "$getpwent_r_proto" in
14508         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14509         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14510         esac
14511         case "$getpwent_r_proto" in
14512         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14513         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14514         esac
14515         case "$getpwent_r_proto" in
14516         ''|0)   d_getpwent_r=undef
14517                 getpwent_r_proto=0
14518                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14519         * )     case "$getpwent_r_proto" in
14520                 REENTRANT_PROTO*) ;;
14521                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14522                 esac
14523                 echo "Prototype: $try" ;;
14524         esac
14525         ;;
14526         *)      case "$usethreads" in
14527                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14528                 esac
14529                 d_getpwent_r=undef
14530                 getpwent_r_proto=0
14531                 ;;
14532         esac
14533         ;;
14534 *)      getpwent_r_proto=0
14535         ;;
14536 esac
14537
14538 : see if getpwnam_r exists
14539 set getpwnam_r d_getpwnam_r
14540 eval $inlibc
14541 case "$d_getpwnam_r" in
14542 "$define")
14543         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14544         case "$d_getpwnam_r_proto:$usethreads" in
14545         ":define")      d_getpwnam_r_proto=define
14546                 set d_getpwnam_r_proto getpwnam_r $hdrs
14547                 eval $hasproto ;;
14548         *)      ;;
14549         esac
14550         case "$d_getpwnam_r_proto" in
14551         define)
14552         case "$getpwnam_r_proto" in
14553         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14554         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14555         esac
14556         case "$getpwnam_r_proto" in
14557         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14558         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14559         esac
14560         case "$getpwnam_r_proto" in
14561         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14562         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14563         esac
14564         case "$getpwnam_r_proto" in
14565         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14566         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14567         esac
14568         case "$getpwnam_r_proto" in
14569         ''|0)   d_getpwnam_r=undef
14570                 getpwnam_r_proto=0
14571                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14572         * )     case "$getpwnam_r_proto" in
14573                 REENTRANT_PROTO*) ;;
14574                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14575                 esac
14576                 echo "Prototype: $try" ;;
14577         esac
14578         ;;
14579         *)      case "$usethreads" in
14580                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14581                 esac
14582                 d_getpwnam_r=undef
14583                 getpwnam_r_proto=0
14584                 ;;
14585         esac
14586         ;;
14587 *)      getpwnam_r_proto=0
14588         ;;
14589 esac
14590
14591 : see if getpwuid_r exists
14592 set getpwuid_r d_getpwuid_r
14593 eval $inlibc
14594 case "$d_getpwuid_r" in
14595 "$define")
14596         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14597         case "$d_getpwuid_r_proto:$usethreads" in
14598         ":define")      d_getpwuid_r_proto=define
14599                 set d_getpwuid_r_proto getpwuid_r $hdrs
14600                 eval $hasproto ;;
14601         *)      ;;
14602         esac
14603         case "$d_getpwuid_r_proto" in
14604         define)
14605         case "$getpwuid_r_proto" in
14606         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14607         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14608         esac
14609         case "$getpwuid_r_proto" in
14610         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14611         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14612         esac
14613         case "$getpwuid_r_proto" in
14614         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14615         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14616         esac
14617         case "$getpwuid_r_proto" in
14618         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14619         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14620         esac
14621         case "$getpwuid_r_proto" in
14622         ''|0)   d_getpwuid_r=undef
14623                 getpwuid_r_proto=0
14624                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14625         * )     case "$getpwuid_r_proto" in
14626                 REENTRANT_PROTO*) ;;
14627                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14628                 esac
14629                 echo "Prototype: $try" ;;
14630         esac
14631         ;;
14632         *)      case "$usethreads" in
14633                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14634                 esac
14635                 d_getpwuid_r=undef
14636                 getpwuid_r_proto=0
14637                 ;;
14638         esac
14639         ;;
14640 *)      getpwuid_r_proto=0
14641         ;;
14642 esac
14643
14644 : Optional checks for getsbyname and getsbyport
14645
14646 : see if getservbyname exists
14647 set getservbyname d_getsbyname
14648 eval $inlibc
14649
14650 : see if getservbyport exists
14651 set getservbyport d_getsbyport
14652 eval $inlibc
14653
14654 : see if getservent exists
14655 set getservent d_getsent
14656 eval $inlibc
14657
14658 : see if getservbyname_r exists
14659 set getservbyname_r d_getservbyname_r
14660 eval $inlibc
14661 case "$d_getservbyname_r" in
14662 "$define")
14663         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14664         case "$d_getservbyname_r_proto:$usethreads" in
14665         ":define")      d_getservbyname_r_proto=define
14666                 set d_getservbyname_r_proto getservbyname_r $hdrs
14667                 eval $hasproto ;;
14668         *)      ;;
14669         esac
14670         case "$d_getservbyname_r_proto" in
14671         define)
14672         case "$getservbyname_r_proto" in
14673         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14674         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14675         esac
14676         case "$getservbyname_r_proto" in
14677         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14678         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14679         esac
14680         case "$getservbyname_r_proto" in
14681         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14682         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14683         esac
14684         case "$getservbyname_r_proto" in
14685         ''|0)   d_getservbyname_r=undef
14686                 getservbyname_r_proto=0
14687                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14688         * )     case "$getservbyname_r_proto" in
14689                 REENTRANT_PROTO*) ;;
14690                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14691                 esac
14692                 echo "Prototype: $try" ;;
14693         esac
14694         ;;
14695         *)      case "$usethreads" in
14696                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14697                 esac
14698                 d_getservbyname_r=undef
14699                 getservbyname_r_proto=0
14700                 ;;
14701         esac
14702         ;;
14703 *)      getservbyname_r_proto=0
14704         ;;
14705 esac
14706
14707 : see if getservbyport_r exists
14708 set getservbyport_r d_getservbyport_r
14709 eval $inlibc
14710 case "$d_getservbyport_r" in
14711 "$define")
14712         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14713         case "$d_getservbyport_r_proto:$usethreads" in
14714         ":define")      d_getservbyport_r_proto=define
14715                 set d_getservbyport_r_proto getservbyport_r $hdrs
14716                 eval $hasproto ;;
14717         *)      ;;
14718         esac
14719         case "$d_getservbyport_r_proto" in
14720         define)
14721         case "$getservbyport_r_proto" in
14722         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14723         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14724         esac
14725         case "$getservbyport_r_proto" in
14726         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14727         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14728         esac
14729         case "$getservbyport_r_proto" in
14730         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14731         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14732         esac
14733         case "$getservbyport_r_proto" in
14734         ''|0)   d_getservbyport_r=undef
14735                 getservbyport_r_proto=0
14736                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14737         * )     case "$getservbyport_r_proto" in
14738                 REENTRANT_PROTO*) ;;
14739                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14740                 esac
14741                 echo "Prototype: $try" ;;
14742         esac
14743         ;;
14744         *)      case "$usethreads" in
14745                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14746                 esac
14747                 d_getservbyport_r=undef
14748                 getservbyport_r_proto=0
14749                 ;;
14750         esac
14751         ;;
14752 *)      getservbyport_r_proto=0
14753         ;;
14754 esac
14755
14756 : see if getservent_r exists
14757 set getservent_r d_getservent_r
14758 eval $inlibc
14759 case "$d_getservent_r" in
14760 "$define")
14761         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14762         case "$d_getservent_r_proto:$usethreads" in
14763         ":define")      d_getservent_r_proto=define
14764                 set d_getservent_r_proto getservent_r $hdrs
14765                 eval $hasproto ;;
14766         *)      ;;
14767         esac
14768         case "$d_getservent_r_proto" in
14769         define)
14770         case "$getservent_r_proto" in
14771         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14772         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14773         esac
14774         case "$getservent_r_proto" in
14775         ''|0) try='int getservent_r(struct servent*, char*, int);'
14776         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14777         esac
14778         case "$getservent_r_proto" in
14779         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14780         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14781         esac
14782         case "$getservent_r_proto" in
14783         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14784         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14785         esac
14786         case "$getservent_r_proto" in
14787         ''|0)   d_getservent_r=undef
14788                 getservent_r_proto=0
14789                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14790         * )     case "$getservent_r_proto" in
14791                 REENTRANT_PROTO*) ;;
14792                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14793                 esac
14794                 echo "Prototype: $try" ;;
14795         esac
14796         ;;
14797         *)      case "$usethreads" in
14798                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14799                 esac
14800                 d_getservent_r=undef
14801                 getservent_r_proto=0
14802                 ;;
14803         esac
14804         ;;
14805 *)      getservent_r_proto=0
14806         ;;
14807 esac
14808
14809 : see if prototypes for various getservxxx netdb.h functions are available
14810 echo " "
14811 set d_getservprotos getservent $i_netdb netdb.h
14812 eval $hasproto
14813
14814 : see if getspnam exists
14815 set getspnam d_getspnam
14816 eval $inlibc
14817
14818 : see if this is a shadow.h system
14819 set shadow.h i_shadow
14820 eval $inhdr
14821
14822 : see if getspnam_r exists
14823 set getspnam_r d_getspnam_r
14824 eval $inlibc
14825 case "$d_getspnam_r" in
14826 "$define")
14827         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14828         case "$d_getspnam_r_proto:$usethreads" in
14829         ":define")      d_getspnam_r_proto=define
14830                 set d_getspnam_r_proto getspnam_r $hdrs
14831                 eval $hasproto ;;
14832         *)      ;;
14833         esac
14834         case "$d_getspnam_r_proto" in
14835         define)
14836         case "$getspnam_r_proto" in
14837         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14838         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14839         esac
14840         case "$getspnam_r_proto" in
14841         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14842         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14843         esac
14844         case "$getspnam_r_proto" in
14845         ''|0)   d_getspnam_r=undef
14846                 getspnam_r_proto=0
14847                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14848         * )     case "$getspnam_r_proto" in
14849                 REENTRANT_PROTO*) ;;
14850                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14851                 esac
14852                 echo "Prototype: $try" ;;
14853         esac
14854         ;;
14855         *)      case "$usethreads" in
14856                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14857                 esac
14858                 d_getspnam_r=undef
14859                 getspnam_r_proto=0
14860                 ;;
14861         esac
14862         ;;
14863 *)      getspnam_r_proto=0
14864         ;;
14865 esac
14866
14867 : see if gettimeofday or ftime exists
14868 set gettimeofday d_gettimeod
14869 eval $inlibc
14870 case "$d_gettimeod" in
14871 "$undef")
14872         set ftime d_ftime 
14873         eval $inlibc
14874         ;;
14875 *)
14876         val="$undef"; set d_ftime; eval $setvar
14877         ;;
14878 esac
14879 case "$d_gettimeod$d_ftime" in
14880 "$undef$undef")
14881         echo " "
14882         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14883         ;;
14884 esac
14885
14886 : see if gmtime_r exists
14887 set gmtime_r d_gmtime_r
14888 eval $inlibc
14889 case "$d_gmtime_r" in
14890 "$define")
14891         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14892         case "$d_gmtime_r_proto:$usethreads" in
14893         ":define")      d_gmtime_r_proto=define
14894                 set d_gmtime_r_proto gmtime_r $hdrs
14895                 eval $hasproto ;;
14896         *)      ;;
14897         esac
14898         case "$d_gmtime_r_proto" in
14899         define)
14900         case "$gmtime_r_proto" in
14901         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14902         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14903         esac
14904         case "$gmtime_r_proto" in
14905         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14906         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14907         esac
14908         case "$gmtime_r_proto" in
14909         ''|0)   d_gmtime_r=undef
14910                 gmtime_r_proto=0
14911                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14912         * )     case "$gmtime_r_proto" in
14913                 REENTRANT_PROTO*) ;;
14914                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14915                 esac
14916                 echo "Prototype: $try" ;;
14917         esac
14918         ;;
14919         *)      case "$usethreads" in
14920                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14921                 esac
14922                 d_gmtime_r=undef
14923                 gmtime_r_proto=0
14924                 ;;
14925         esac
14926         ;;
14927 *)      gmtime_r_proto=0
14928         ;;
14929 esac
14930
14931 : see if hasmntopt exists
14932 set hasmntopt d_hasmntopt
14933 eval $inlibc
14934
14935 : see if this is a netinet/in.h or sys/in.h system
14936 set netinet/in.h i_niin sys/in.h i_sysin
14937 eval $inhdr
14938
14939 : see if arpa/inet.h has to be included
14940 set arpa/inet.h i_arpainet
14941 eval $inhdr
14942
14943 : see if htonl --and friends-- exists
14944 val=''
14945 set htonl val
14946 eval $inlibc
14947
14948 : Maybe they are macros.
14949 case "$val" in
14950 $undef)
14951         $cat >htonl.c <<EOM
14952 #include <stdio.h>
14953 #include <sys/types.h>
14954 #$i_niin I_NETINET_IN
14955 #$i_sysin I_SYS_IN
14956 #$i_arpainet I_ARPA_INET
14957 #ifdef I_NETINET_IN
14958 #include <netinet/in.h>
14959 #endif
14960 #ifdef I_SYS_IN
14961 #include <sys/in.h>
14962 #endif
14963 #ifdef I_ARPA_INET
14964 #include <arpa/inet.h>
14965 #endif
14966 #ifdef htonl
14967 printf("Defined as a macro.");
14968 #endif
14969 EOM
14970         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14971         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14972                 val="$define"
14973                 echo "But it seems to be defined as a macro." >&4
14974         fi
14975         $rm -f htonl.?
14976         ;;
14977 esac
14978 set d_htonl
14979 eval $setvar
14980
14981 : see if ilogbl exists
14982 set ilogbl d_ilogbl
14983 eval $inlibc
14984
14985 : index or strchr
14986 echo " "
14987 if set index val -f; eval $csym; $val; then
14988         if set strchr val -f d_strchr; eval $csym; $val; then
14989                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14990                         val="$define"
14991                         vali="$undef"
14992                         echo "strchr() found." >&4
14993                 else
14994                         val="$undef"
14995                         vali="$define"
14996                         echo "index() found." >&4
14997                 fi
14998         else
14999                 val="$undef"
15000                 vali="$define"
15001                 echo "index() found." >&4
15002         fi
15003 else
15004         if set strchr val -f d_strchr; eval $csym; $val; then
15005                 val="$define"
15006                 vali="$undef"
15007                 echo "strchr() found." >&4
15008         else
15009                 echo "No index() or strchr() found!" >&4
15010                 val="$undef"
15011                 vali="$undef"
15012         fi
15013 fi
15014 set d_strchr; eval $setvar
15015 val="$vali"
15016 set d_index; eval $setvar
15017
15018 : check whether inet_aton exists
15019 set inet_aton d_inetaton
15020 eval $inlibc
15021
15022 : see if inet_ntop exists
15023 set inet_ntop d_inetntop
15024 eval $inlibc
15025
15026 : see if inet_pton exists
15027 set inet_pton d_inetpton
15028 eval $inlibc
15029
15030 : Look for isascii
15031 echo " "
15032 $cat >isascii.c <<EOCP
15033 #include <stdio.h>
15034 #include <ctype.h>
15035 #$i_stdlib I_STDLIB
15036 #ifdef I_STDLIB
15037 #include <stdlib.h>
15038 #endif
15039 int main() {
15040         int c = 'A';
15041         if (isascii(c))
15042                 exit(0);
15043         else
15044                 exit(1);
15045 }
15046 EOCP
15047 set isascii
15048 if eval $compile; then
15049         echo "isascii() found." >&4
15050         val="$define"
15051 else
15052         echo "isascii() NOT found." >&4
15053         val="$undef"
15054 fi
15055 set d_isascii
15056 eval $setvar
15057 $rm -f isascii*
15058
15059 : Look for isblank
15060 echo " "
15061 $cat >isblank.c <<'EOCP'
15062 #include <stdio.h>
15063 #include <ctype.h>
15064 int main() {
15065         int c = ' ';
15066         if (isblank(c))
15067                 return 0 ;
15068         else
15069                 return 1 ;
15070 }
15071 EOCP
15072 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15073         echo "isblank() found." >&4
15074         val="$define"
15075 else
15076         echo "isblank() NOT found." >&4
15077         val="$undef"
15078 fi
15079 set d_isblank
15080 eval $setvar
15081 $rm -f isblank*
15082
15083 : see if isfinite exists
15084 set isfinite d_isfinite
15085 eval $inlibc
15086
15087 : see if isinf exists
15088 set isinf d_isinf
15089 eval $inlibc
15090
15091 : see if isnan exists
15092 set isnan d_isnan
15093 eval $inlibc
15094
15095 : see if isnanl exists
15096 set isnanl d_isnanl
15097 eval $inlibc
15098
15099 : see if killpg exists
15100 set killpg d_killpg
15101 eval $inlibc
15102
15103 : see if lchown exists
15104 echo " "
15105 $cat > try.c <<'EOCP'
15106 /* System header to define __stub macros and hopefully few prototypes,
15107     which can conflict with char lchown(); below.  */
15108 #include <assert.h>
15109 /* Override any gcc2 internal prototype to avoid an error.  */
15110 /* We use char because int might match the return type of a gcc2
15111    builtin and then its argument prototype would still apply.  */
15112 char lchown();
15113 int main() {
15114     /*  The GNU C library defines this for functions which it implements
15115         to always fail with ENOSYS.  Some functions are actually named
15116         something starting with __ and the normal name is an alias.  */
15117 #if defined (__stub_lchown) || defined (__stub___lchown)
15118 choke me
15119 #else
15120 lchown();
15121 #endif
15122 ; return 0; }
15123 EOCP
15124 set try
15125 if eval $compile; then
15126     $echo "lchown() found." >&4
15127     val="$define"
15128 else
15129     $echo "lchown() NOT found." >&4
15130     val="$undef"
15131 fi
15132 set d_lchown
15133 eval $setvar
15134
15135 : See if number of significant digits in a double precision number is known
15136 echo " "
15137 $cat >ldbl_dig.c <<EOM
15138 #$i_limits I_LIMITS
15139 #$i_float I_FLOAT
15140 #ifdef I_LIMITS
15141 #include <limits.h>
15142 #endif
15143 #ifdef I_FLOAT
15144 #include <float.h>
15145 #endif
15146 #ifdef LDBL_DIG
15147 printf("Contains LDBL_DIG");
15148 #endif
15149 EOM
15150 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15151 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15152         echo "LDBL_DIG found." >&4
15153         val="$define"
15154 else
15155         echo "LDBL_DIG NOT found." >&4
15156         val="$undef"
15157 fi
15158 $rm -f ldbl_dig.?
15159 set d_ldbl_dig
15160 eval $setvar
15161
15162 : see if this is a math.h system
15163 set math.h i_math
15164 eval $inhdr
15165
15166 : check to see if math.h defines _LIB_VERSION
15167 d_libm_lib_version="$undef"
15168 case $i_math in
15169     $define)
15170         echo " "
15171         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15172         $cat >try.c <<EOCP
15173 #include <unistd.h>
15174 #include <math.h>
15175 int main (int argc, char *argv[])
15176 {
15177     printf ("%d\n", _LIB_VERSION);
15178     return (0);
15179     } /* main */
15180 EOCP
15181         set try
15182         if eval $compile; then
15183             foo=`$run ./try`
15184             echo "Yes, it does ($foo)" >&4
15185             d_libm_lib_version="$define"
15186         else
15187             echo "No, it does not (probably harmless)" >&4
15188             fi
15189         $rm_try
15190         ;;
15191
15192     esac
15193
15194 : see if link exists
15195 set link d_link
15196 eval $inlibc
15197
15198 : see if localtime_r exists
15199 set localtime_r d_localtime_r
15200 eval $inlibc
15201 case "$d_localtime_r" in
15202 "$define")
15203         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15204         case "$d_localtime_r_proto:$usethreads" in
15205         ":define")      d_localtime_r_proto=define
15206                 set d_localtime_r_proto localtime_r $hdrs
15207                 eval $hasproto ;;
15208         *)      ;;
15209         esac
15210         case "$d_localtime_r_proto" in
15211         define)
15212         case "$localtime_r_proto" in
15213         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15214         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15215         esac
15216         case "$localtime_r_proto" in
15217         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15218         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15219         esac
15220         case "$localtime_r_proto" in
15221         ''|0)   d_localtime_r=undef
15222                 localtime_r_proto=0
15223                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15224         * )     case "$localtime_r_proto" in
15225                 REENTRANT_PROTO*) ;;
15226                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15227                 esac
15228                 echo "Prototype: $try" ;;
15229         esac
15230         ;;
15231         *)      case "$usethreads" in
15232                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15233                 esac
15234                 d_localtime_r=undef
15235                 localtime_r_proto=0
15236                 ;;
15237         esac
15238         ;;
15239 *)      localtime_r_proto=0
15240         ;;
15241 esac
15242
15243 : see if localtime_r calls tzset
15244 case "$localtime_r_proto" in
15245 REENTRANT_PROTO*)
15246         $cat >try.c <<EOCP
15247 /*  Does our libc's localtime_r call tzset ?
15248  *  return 0 if so, 1 otherwise.
15249  */
15250 #$i_systypes    I_SYS_TYPES
15251 #$i_unistd      I_UNISTD
15252 #$i_time        I_TIME
15253 #$i_stdlib      I_STDLIB
15254 #$i_string      I_STRING
15255 #$i_malloc      I_MALLOC
15256 #ifdef I_SYS_TYPES
15257 #  include <sys/types.h>
15258 #endif
15259 #ifdef I_UNISTD
15260 #  include <unistd.h>
15261 #endif
15262 #ifdef I_TIME
15263 #  include <time.h>
15264 #endif
15265 #ifdef I_STDLIB
15266 #include <stdlib.h>
15267 #endif
15268 #ifdef I_STRING
15269 #  include <string.h>
15270 #else
15271 #  include <strings.h>
15272 #endif
15273 #ifdef I_MALLOC
15274 #  include <malloc.h>
15275 #endif
15276 int main()
15277 {
15278     time_t t = time(0L);
15279     char w_tz[]="TZ" "=GMT+5",
15280          e_tz[]="TZ" "=GMT-5",
15281         *tz_e = (char*)malloc(16),
15282         *tz_w = (char*)malloc(16);
15283     struct tm tm_e, tm_w;
15284     memset(&tm_e,'\0',sizeof(struct tm));
15285     memset(&tm_w,'\0',sizeof(struct tm));
15286     strcpy(tz_e,e_tz);
15287     strcpy(tz_w,w_tz);
15288
15289     putenv(tz_e);
15290     localtime_r(&t, &tm_e);
15291
15292     putenv(tz_w);
15293     localtime_r(&t, &tm_w);
15294
15295     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15296         return 1;
15297     return 0;
15298 }
15299 EOCP
15300         set try
15301         if eval $compile; then
15302             if $run ./try; then
15303                 d_localtime_r_needs_tzset=undef;
15304             else
15305                 d_localtime_r_needs_tzset=define;
15306             fi;
15307         else
15308             d_localtime_r_needs_tzset=undef;
15309         fi;
15310      ;;
15311   *)
15312      d_localtime_r_needs_tzset=undef;
15313      ;;
15314 esac
15315 $rm_try
15316
15317 : see if localeconv exists
15318 set localeconv d_locconv
15319 eval $inlibc
15320
15321 : see if lockf exists
15322 set lockf d_lockf
15323 eval $inlibc
15324
15325 : see if prototype for lseek is available
15326 echo " "
15327 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15328 eval $hasproto
15329
15330 : see if lstat exists
15331 set lstat d_lstat
15332 eval $inlibc
15333
15334 : see if madvise exists
15335 set madvise d_madvise
15336 eval $inlibc
15337
15338 : see if malloc_size exists
15339 set malloc_size d_malloc_size
15340 eval $inlibc
15341
15342 : see if malloc_size_good exists
15343 set malloc_good_size d_malloc_good_size
15344 eval $inlibc
15345
15346 : see if mblen exists
15347 set mblen d_mblen
15348 eval $inlibc
15349
15350 : see if mbstowcs exists
15351 set mbstowcs d_mbstowcs
15352 eval $inlibc
15353
15354 : see if mbtowc exists
15355 set mbtowc d_mbtowc
15356 eval $inlibc
15357
15358 : see if memchr exists
15359 set memchr d_memchr
15360 eval $inlibc
15361
15362 : see if memcmp exists
15363 set memcmp d_memcmp
15364 eval $inlibc
15365
15366 : see if memcpy exists
15367 set memcpy d_memcpy
15368 eval $inlibc
15369
15370 : see if memmove exists
15371 set memmove d_memmove
15372 eval $inlibc
15373
15374 : see if memset exists
15375 set memset d_memset
15376 eval $inlibc
15377
15378 : see if mkdir exists
15379 set mkdir d_mkdir
15380 eval $inlibc
15381
15382 : see if mkdtemp exists
15383 set mkdtemp d_mkdtemp
15384 eval $inlibc
15385
15386 : see if mkfifo exists
15387 set mkfifo d_mkfifo
15388 eval $inlibc
15389
15390 : see if mkstemp exists
15391 set mkstemp d_mkstemp
15392 eval $inlibc
15393
15394 : see if mkstemps exists
15395 set mkstemps d_mkstemps
15396 eval $inlibc
15397
15398 : see if mktime exists
15399 set mktime d_mktime
15400 eval $inlibc
15401
15402 : see if this is a sys/mman.h system
15403 set sys/mman.h i_sysmman
15404 eval $inhdr
15405
15406 : see if mmap exists
15407 set mmap d_mmap
15408 eval $inlibc
15409 : see what shmat returns
15410 : default to something harmless
15411 mmaptype='void *'
15412 case "$i_sysmman$d_mmap" in
15413 "$define$define")
15414         $cat >mmap.c <<'END'
15415 #include <sys/mman.h>
15416 void *mmap();
15417 END
15418         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15419                 mmaptype='void *'
15420         else
15421                 mmaptype='caddr_t'
15422         fi
15423         echo "and it returns ($mmaptype)." >&4
15424         ;;
15425 esac
15426
15427
15428
15429 : see if sqrtl exists
15430 set sqrtl d_sqrtl
15431 eval $inlibc
15432
15433 : see if scalbnl exists
15434 set scalbnl d_scalbnl
15435 eval $inlibc
15436
15437 : see if modfl exists
15438 set modfl d_modfl
15439 eval $inlibc
15440
15441 : see if prototype for modfl is available
15442 echo " "
15443 set d_modflproto modfl $i_math math.h
15444 eval $hasproto
15445
15446 d_modfl_pow32_bug="$undef"
15447
15448 case "$d_longdbl$d_modfl" in
15449 $define$define)
15450         $cat <<EOM
15451 Checking to see whether your modfl() is okay for large values...
15452 EOM
15453 $cat >try.c <<EOCP
15454 #include <math.h>
15455 #include <stdio.h>
15456 EOCP
15457 if $test "X$d_modflproto" != "X$define"; then
15458         $cat >>try.c <<EOCP
15459 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15460 long double modfl (long double, long double *);
15461 EOCP
15462 fi
15463 $cat >>try.c <<EOCP
15464 int main() {
15465     long double nv = 4294967303.15;
15466     long double v, w;
15467     v = modfl(nv, &w);
15468 #ifdef __GLIBC__
15469     printf("glibc");
15470 #endif
15471     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15472     return 0;
15473 }
15474 EOCP
15475         case "$osname:$gccversion" in
15476         aix:)   saveccflags="$ccflags"
15477                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15478         esac
15479         set try
15480         if eval $compile; then
15481                 foo=`$run ./try`
15482                 case "$foo" in
15483                 *" 4294967303.150000 1.150000 4294967302.000000")
15484                         echo >&4 "Your modfl() is broken for large values."
15485                         d_modfl_pow32_bug="$define"
15486                         case "$foo" in
15487                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15488                         ;;
15489                         esac
15490                         ;;
15491                 *" 4294967303.150000 0.150000 4294967303.000000")
15492                         echo >&4 "Your modfl() seems okay for large values."
15493                         ;;
15494                 *)      echo >&4 "I don't understand your modfl() at all."
15495                         d_modfl="$undef"
15496                         ;;
15497                 esac
15498                 $rm_try
15499         else
15500                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15501                 d_modfl="$undef"
15502         fi
15503         case "$osname:$gccversion" in
15504         aix:)   ccflags="$saveccflags" ;; # restore
15505         esac
15506         ;;
15507 esac
15508
15509 if $test "$uselongdouble" = "$define"; then
15510     message=""
15511     if $test "$d_sqrtl" != "$define"; then
15512         message="$message sqrtl"
15513     fi
15514     if $test "$d_modfl" != "$define"; then
15515         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15516             echo "You have both aintl and copysignl, so I can emulate modfl."
15517         else
15518             message="$message modfl"
15519         fi
15520     fi
15521     if $test "$d_frexpl" != "$define"; then
15522         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15523             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15524         else
15525             message="$message frexpl"
15526         fi
15527     fi
15528
15529     if $test "$message" != ""; then
15530         $cat <<EOM >&4
15531
15532 *** You requested the use of long doubles but you do not seem to have
15533 *** the following mathematical functions needed for long double support:
15534 ***    $message
15535 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15536 *** Cannot continue, aborting.
15537
15538 EOM
15539
15540         exit 1
15541     fi
15542 fi
15543
15544 : see if mprotect exists
15545 set mprotect d_mprotect
15546 eval $inlibc
15547
15548 : see if msgctl exists
15549 set msgctl d_msgctl
15550 eval $inlibc
15551
15552 : see if msgget exists
15553 set msgget d_msgget
15554 eval $inlibc
15555
15556 : see if msgsnd exists
15557 set msgsnd d_msgsnd
15558 eval $inlibc
15559
15560 : see if msgrcv exists
15561 set msgrcv d_msgrcv
15562 eval $inlibc
15563
15564 : see how much of the 'msg*(2)' library is present.
15565 h_msg=true
15566 echo " "
15567 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15568 *"$undef"*) h_msg=false;;
15569 esac
15570 case "$osname" in
15571 freebsd)
15572     case "`ipcs 2>&1`" in
15573     "SVID messages"*"not configured"*)
15574         echo "Your $osname does not have the msg*(2) configured." >&4
15575         h_msg=false
15576         val="$undef"
15577         set msgctl d_msgctl
15578         eval $setvar
15579         set msgget d_msgget
15580         eval $setvar
15581         set msgsnd d_msgsnd
15582         eval $setvar
15583         set msgrcv d_msgrcv
15584         eval $setvar
15585         ;;
15586     esac
15587     ;;
15588 esac
15589 : we could also check for sys/ipc.h ...
15590 if $h_msg && $test `./findhdr sys/msg.h`; then
15591         echo "You have the full msg*(2) library." >&4
15592         val="$define"
15593 else
15594         echo "You don't have the full msg*(2) library." >&4
15595         val="$undef"
15596 fi
15597 set d_msg
15598 eval $setvar
15599
15600 : Check for msghdr_s
15601 echo " "
15602 echo "Checking to see if your system supports struct msghdr..." >&4
15603 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15604 eval $hasstruct
15605 case "$d_msghdr_s" in
15606 "$define")      echo "Yes, it does."   ;;
15607 *)              echo "No, it doesn't." ;;
15608 esac
15609
15610
15611 : see if msync exists
15612 set msync d_msync
15613 eval $inlibc
15614
15615 : see if munmap exists
15616 set munmap d_munmap
15617 eval $inlibc
15618
15619 : see if nice exists
15620 set nice d_nice
15621 eval $inlibc
15622
15623 : see if this is a langinfo.h system
15624 set langinfo.h i_langinfo
15625 eval $inhdr
15626
15627 : see if nl_langinfo exists
15628 set nl_langinfo d_nl_langinfo
15629 eval $inlibc
15630
15631 : check for volatile keyword
15632 echo " "
15633 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15634 $cat >try.c <<'EOCP'
15635 int main()
15636 {
15637         typedef struct _goo_struct goo_struct;
15638         goo_struct * volatile goo = ((goo_struct *)0);
15639         struct _goo_struct {
15640                 long long_int;
15641                 int reg_int;
15642                 char char_var;
15643         };
15644         typedef unsigned short foo_t;
15645         char *volatile foo;
15646         volatile int bar;
15647         volatile foo_t blech;
15648         foo = foo;
15649 }
15650 EOCP
15651 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15652         val="$define"
15653         echo "Yup, it does."
15654 else
15655         val="$undef"
15656         echo "Nope, it doesn't."
15657 fi
15658 set d_volatile
15659 eval $setvar
15660 $rm_try
15661
15662 : Check basic sizes
15663 echo " "
15664 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15665
15666 case "$use64bitint:$d_quad:$quadtype" in
15667 define:define:?*)
15668         ivtype="$quadtype"
15669         uvtype="$uquadtype"
15670         ivsize=8
15671         uvsize=8
15672         ;;
15673 *)      ivtype="long"
15674         uvtype="unsigned long"
15675         ivsize=$longsize
15676         uvsize=$longsize
15677         ;;
15678 esac
15679
15680 case "$uselongdouble:$d_longdbl" in
15681 define:define)
15682         nvtype="long double"
15683         nvsize=$longdblsize
15684         ;;
15685 *)      nvtype=double
15686         nvsize=$doublesize
15687         ;;
15688 esac
15689
15690 $echo "(IV will be "$ivtype", $ivsize bytes)"
15691 $echo "(UV will be "$uvtype", $uvsize bytes)"
15692 $echo "(NV will be "$nvtype", $nvsize bytes)"
15693
15694 $cat >try.c <<EOCP
15695 #$i_inttypes I_INTTYPES
15696 #ifdef I_INTTYPES
15697 #include <inttypes.h>
15698 #endif
15699 #include <stdio.h>
15700 int main() {
15701 #ifdef INT8
15702    int8_t i =  INT8_MAX;
15703   uint8_t u = UINT8_MAX;
15704   printf("int8_t\n");
15705 #endif
15706 #ifdef INT16
15707    int16_t i =  INT16_MAX;
15708   uint16_t i = UINT16_MAX;
15709   printf("int16_t\n");
15710 #endif
15711 #ifdef INT32
15712    int32_t i =  INT32_MAX;
15713   uint32_t u = UINT32_MAX;
15714   printf("int32_t\n");
15715 #endif
15716 }
15717 EOCP
15718
15719 i8type="signed char"
15720 u8type="unsigned char"
15721 i8size=1
15722 u8size=1
15723
15724 case "$i16type" in
15725 '')     case "$shortsize" in
15726         2)      i16type=short
15727                 u16type="unsigned short"
15728                 i16size=$shortsize
15729                 u16size=$shortsize
15730                 ;;
15731         esac
15732         ;;
15733 esac
15734 case "$i16type" in
15735 '')     set try -DINT16
15736         if eval $compile; then
15737                 case "`$run ./try`" in
15738                 int16_t)
15739                         i16type=int16_t
15740                         u16type=uint16_t
15741                         i16size=2
15742                         u16size=2
15743                         ;;
15744                 esac
15745         fi
15746         ;;
15747 esac
15748 case "$i16type" in
15749 '')     if $test $shortsize -ge 2; then
15750                 i16type=short
15751                 u16type="unsigned short"
15752                 i16size=$shortsize
15753                 u16size=$shortsize
15754         fi
15755         ;;
15756 esac
15757
15758 case "$i32type" in
15759 '')     case "$longsize" in
15760         4)      i32type=long
15761                 u32type="unsigned long"
15762                 i32size=$longsize
15763                 u32size=$longsize
15764                 ;;
15765         *)      case "$intsize" in
15766                 4)      i32type=int
15767                         u32type="unsigned int"
15768                         i32size=$intsize
15769                         u32size=$intsize
15770                         ;;
15771                 esac
15772                 ;;
15773         esac
15774         ;;
15775 esac
15776 case "$i32type" in
15777 '')     set try -DINT32
15778         if eval $compile; then
15779                 case "`$run ./try`" in
15780                 int32_t)
15781                         i32type=int32_t
15782                         u32type=uint32_t
15783                         i32size=4
15784                         u32size=4
15785                         ;;
15786                 esac
15787         fi
15788         ;;
15789 esac
15790 case "$i32type" in
15791 '')     if $test $intsize -ge 4; then
15792                 i32type=int
15793                 u32type="unsigned int"
15794                 i32size=$intsize
15795                 u32size=$intsize
15796         fi
15797         ;;
15798 esac
15799
15800 case "$i64type" in
15801 '')     case "$d_quad:$quadtype" in
15802         define:?*)
15803                 i64type="$quadtype"
15804                 u64type="$uquadtype"
15805                 i64size=8
15806                 u64size=8
15807                 ;;
15808         esac
15809         ;;
15810 esac
15811
15812 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15813 : volatile so that the compiler has to store it out to memory.
15814 if test X"$d_volatile" = X"$define"; then
15815         volatile=volatile
15816 fi
15817 $cat <<EOP >try.c
15818 #include <stdio.h>
15819 #$i_stdlib I_STDLIB
15820 #ifdef I_STDLIB
15821 #include <stdlib.h>
15822 #endif
15823 #include <sys/types.h>
15824 #include <signal.h>
15825 #ifdef SIGFPE
15826 $volatile int bletched = 0;
15827 $signal_t blech(int s) { bletched = 1; }
15828 #endif
15829 int main() {
15830     $uvtype u = 0;
15831     $nvtype d;
15832     int     n = 8 * $uvsize;
15833     int     i;
15834 #ifdef SIGFPE
15835     signal(SIGFPE, blech);
15836 #endif
15837
15838     for (i = 0; i < n; i++) {
15839       u = u << 1 | ($uvtype)1;
15840       d = ($nvtype)u;
15841       if (($uvtype)d != u)
15842         break;
15843       if (d <= 0)
15844         break;
15845       d = ($nvtype)(u - 1);
15846       if (($uvtype)d != (u - 1))
15847         break;
15848 #ifdef SIGFPE
15849       if (bletched)
15850         break;
15851 #endif
15852     }
15853     printf("%d\n", ((i == n) ? -n : i));
15854     exit(0);
15855 }
15856 EOP
15857 set try
15858
15859 d_nv_preserves_uv="$undef"
15860 if eval $compile; then
15861         nv_preserves_uv_bits="`$run ./try`"
15862 fi
15863 case "$nv_preserves_uv_bits" in
15864 \-[1-9]*)
15865         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15866         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15867         d_nv_preserves_uv="$define"
15868         ;;
15869 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15870         d_nv_preserves_uv="$undef" ;;
15871 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15872         nv_preserves_uv_bits="0" ;;
15873 esac
15874 $rm_try
15875
15876 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15877 : volatile so that the compiler has to store it out to memory.
15878 if test X"$d_volatile" = X"$define"; then
15879         volatile=volatile
15880 fi
15881 $cat <<EOP >try.c
15882 #include <stdio.h>
15883
15884 typedef $nvtype NV;
15885
15886 int
15887 main() {
15888   NV value = 2;
15889   int count = 1;
15890
15891   while(count < 256) {
15892     $volatile NV up = value + 1.0;
15893     $volatile NV negated = -value;
15894     $volatile NV down = negated - 1.0;
15895     $volatile NV got_up = up - value;
15896     int up_good = got_up == 1.0;
15897     int got_down = down - negated;
15898     int down_good = got_down == -1.0;
15899
15900     if (down_good != up_good) {
15901       fprintf(stderr,
15902               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15903               up_good, (double) got_up, down_good, (double) got_down,
15904               count, (double) value);
15905       return 1;
15906     }
15907     if (!up_good) {
15908       while (1) {
15909         if (count > 8) {
15910           count -= 8;
15911           fputs("256.0", stdout);
15912         } else {
15913           count--;
15914           fputs("2.0", stdout);
15915         }
15916         if (!count) {
15917           puts("");
15918           return 0;
15919         }
15920         fputs("*", stdout);
15921       }
15922     }
15923     value *= 2;
15924     ++count;
15925   }
15926   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15927           count, (double) value);
15928   return 1;
15929 }
15930 EOP
15931 set try
15932
15933 nv_overflows_integers_at='0'
15934 if eval $compile; then
15935     xxx="`$run ./try`"
15936     case "$?" in
15937         0)
15938             case "$xxx" in
15939                 2*)  cat >&4 <<EOM
15940 The largest integer your NVs can preserve is equal to $xxx
15941 EOM
15942                     nv_overflows_integers_at="$xxx"
15943                     ;;
15944                 *)  cat >&4 <<EOM
15945 Cannot determine the largest integer value your NVs can hold, unexpected output
15946 '$xxx'
15947 EOM
15948                     ;;
15949             esac
15950             ;;
15951         *)  cat >&4 <<EOM
15952 Cannot determine the largest integer value your NVs can hold
15953 EOM
15954             ;;
15955     esac
15956 fi
15957 $rm_try
15958
15959 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15960 : volatile so that the compiler has to store it out to memory.
15961 if test X"$d_volatile" = X"$define"; then
15962         volatile=volatile
15963 fi
15964 $cat <<EOP >try.c
15965 #include <stdio.h>
15966 #$i_stdlib I_STDLIB
15967 #ifdef I_STDLIB
15968 #include <stdlib.h>
15969 #endif
15970 #$i_string I_STRING
15971 #ifdef I_STRING
15972 #  include <string.h>
15973 #else
15974 #  include <strings.h>
15975 #endif
15976 #include <sys/types.h>
15977 #include <signal.h>
15978 #ifdef SIGFPE
15979 $volatile int bletched = 0;
15980 $signal_t blech(int s) { bletched = 1; }
15981 #endif
15982
15983 int checkit($nvtype d, char *where) {
15984     unsigned char *p = (char *)&d;
15985     unsigned char *end = p + sizeof(d);
15986     int fail = 0;
15987
15988     while (p < end)
15989         fail += *p++;
15990
15991     if (!fail)
15992         return 0;
15993
15994     p = (char *)&d;
15995     printf("No - %s: 0x", where);
15996     while (p < end)
15997         printf ("%02X", *p++);
15998     printf("\n");
15999     return 1;
16000 }
16001
16002 int main(int argc, char **argv) {
16003     $nvtype d = 0.0;
16004     int fail = 0;
16005     fail += checkit(d, "0.0");
16006
16007     /* The compiler shouldn't be assuming that bletched is 0  */
16008     d = bletched;
16009
16010     fail += checkit(d, "bleched");
16011
16012 #ifdef SIGFPE
16013     signal(SIGFPE, blech);
16014 #endif
16015
16016     /* Paranoia - the compiler should have no way of knowing that ANSI says
16017        that argv[argc] will always be NULL.  Actually, if it did assume this it
16018        would be buggy, as this is C and main() can be called from elsewhere in
16019        the program.  */
16020     d = argv[argc] ? 1 : 0;
16021
16022     if (d) {
16023         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16024     }
16025
16026     fail += checkit(d, "ternary");
16027
16028     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16029
16030     if (d != 0.0) {
16031         printf("No - memset doesn't give 0.0\n");
16032         /* This might just blow up:  */
16033         printf("(gives %g)\n", d);
16034         return 1;
16035     }
16036
16037 #ifdef SIGFPE
16038     if (bletched) {
16039         printf("No - something bleched\n");
16040         return 1;
16041     }
16042 #endif
16043     if (fail) {
16044       printf("No - %d fail(s)\n", fail);
16045       return 1;
16046     }
16047     printf("Yes\n");
16048     return 0;
16049 }
16050 EOP
16051 set try
16052
16053 d_nv_zero_is_allbits_zero="$undef"
16054 if eval $compile; then
16055     xxx="`$run ./try`"
16056     case "$?" in
16057         0)
16058             case "$xxx" in
16059                 Yes)  cat >&4 <<EOM
16060 0.0 is represented as all bits zero in memory
16061 EOM
16062                     d_nv_zero_is_allbits_zero="$define"
16063                     ;;
16064                 *)  cat >&4 <<EOM
16065 0.0 is not represented as all bits zero in memory
16066 EOM
16067                     d_nv_zero_is_allbits_zero="$undef"
16068                     ;;
16069             esac
16070             ;;
16071         *)  cat >&4 <<EOM
16072 0.0 is not represented as all bits zero in memory
16073 EOM
16074             d_nv_zero_is_allbits_zero="$undef"
16075             ;;
16076     esac
16077 fi
16078 $rm_try
16079
16080 : check for off64_t
16081 echo " "
16082 echo "Checking to see if you have off64_t..." >&4
16083 $cat >try.c <<EOCP
16084 #include <sys/types.h>
16085 #include <unistd.h>
16086 int main() { off64_t x = 7; }
16087 EOCP
16088 set try
16089 if eval $compile; then
16090         val="$define"
16091         echo "You have off64_t."
16092 else
16093         val="$undef"
16094         echo "You do not have off64_t."
16095         case "$lseeksize" in
16096         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16097         esac
16098 fi
16099 $rm_try
16100 set d_off64_t
16101 eval $setvar
16102
16103 : how to create joinable pthreads
16104 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16105         echo " "
16106         echo "Checking what constant to use for creating joinable pthreads..." >&4
16107         $cat >try.c <<'EOCP'
16108 #include <pthread.h>
16109 int main() {
16110     int detachstate = JOINABLE;
16111 }
16112 EOCP
16113         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16114         if eval $compile; then
16115                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16116                 val="$undef" # Yes, undef.
16117                 set d_old_pthread_create_joinable
16118                 eval $setvar
16119                 val=""
16120                 set old_pthread_create_joinable
16121                 eval $setvar
16122         else
16123                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16124                 if eval $compile; then
16125                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16126                         val="$define"
16127                         set d_old_pthread_create_joinable
16128                         eval $setvar
16129                         val=PTHREAD_CREATE_UNDETACHED
16130                         set old_pthread_create_joinable
16131                         eval $setvar
16132                 else
16133                         set try -DJOINABLE=__UNDETACHED
16134                         if eval $compile; then
16135                                 echo "You seem to use __UNDETACHED." >&4
16136                                 val="$define"
16137                                 set d_old_pthread_create_joinable
16138                                 eval $setvar
16139                                 val=__UNDETACHED
16140                                 set old_pthread_create_joinable
16141                                 eval $setvar
16142                         else
16143                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16144                                 val="$define"
16145                                 set d_old_pthread_create_joinable
16146                                 eval $setvar
16147                                 val=0
16148                                 set old_pthread_create_joinable
16149                                 eval $setvar
16150                         fi
16151                 fi
16152         fi
16153         $rm_try
16154 else
16155     d_old_pthread_create_joinable="$undef"
16156     old_pthread_create_joinable=""
16157 fi
16158
16159 : see if pause exists
16160 set pause d_pause
16161 eval $inlibc
16162
16163 : see if poll exists
16164 set poll d_poll
16165 eval $inlibc
16166
16167 : see if prctl exists
16168 set prctl d_prctl
16169 eval $inlibc
16170
16171 : see if prctl supports PR_SET_NAME
16172 d_prctl_set_name=$undef
16173 case $d_prctl in
16174     $define)
16175         $cat >try.c <<EOM
16176 #include <sys/prctl.h>
16177
16178 int main (int argc, char *argv[])
16179 {
16180     return (prctl (PR_SET_NAME, "Test"));
16181     } /* main */
16182 EOM
16183         set try
16184         if eval $compile_ok && $run ./try; then
16185             echo "Your prctl (PR_SET_NAME, ...) works"
16186             d_prctl_set_name=$define
16187             fi
16188         $rm_try
16189         ;;
16190     esac
16191
16192 : see if readlink exists
16193 set readlink d_readlink
16194 eval $inlibc
16195
16196 : Check if exe is symlink to abs path of executing program
16197 echo " "
16198 procselfexe=''
16199 val="$undef"
16200 case "$d_readlink" in
16201     "$define")
16202         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16203         : more tidy to avoid an extra level of symlink
16204         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16205         while test $# -gt 0; do
16206             type=$1; try=$2
16207             shift; shift
16208             if $issymlink $try; then
16209                 $ls -l $try > reflect
16210                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16211                     echo "You have $type-like $try."
16212                     procselfexe='"'$try'"'
16213                     val="$define"
16214                     : This will break out of the loop
16215                     set X; shift
16216                 fi
16217             fi
16218         done
16219         ;;
16220 esac
16221 $rm -f reflect
16222 set d_procselfexe
16223 eval $setvar
16224
16225 : backward compatibility for d_hvfork
16226 if test X$d_hvfork != X; then
16227         d_vfork="$d_hvfork"
16228         d_hvfork=''
16229 fi
16230 : see if there is a vfork
16231 val=''
16232 set vfork val
16233 eval $inlibc
16234
16235 d_pseudofork=$undef
16236
16237 : Ok, but do we want to use it. vfork is reportedly unreliable in
16238 : perl on Solaris 2.x, and probably elsewhere.
16239 case "$val" in
16240 $define)
16241         echo " "
16242         case "$usevfork" in
16243         false) dflt='n';;
16244         *) dflt='y';;
16245         esac
16246         cat <<'EOM'
16247
16248 Perl can only use a vfork() that doesn't suffer from strict
16249 restrictions on calling functions or modifying global data in
16250 the child.  For example, glibc-2.1 contains such a vfork()
16251 that is unsuitable.  If your system provides a proper fork()
16252 call, chances are that you do NOT want perl to use vfork().
16253
16254 EOM
16255         rp="Do you still want to use vfork()?"
16256         . ./myread
16257         case "$ans" in
16258         y|Y) ;;
16259         *)
16260                 echo "Ok, we won't use vfork()."
16261                 val="$undef"
16262                 ;;
16263         esac
16264         ;;
16265 esac
16266 set d_vfork
16267 eval $setvar
16268 case "$d_vfork" in
16269 $define) usevfork='true';;
16270 *) usevfork='false';;
16271 esac
16272
16273 : see whether the pthread_atfork exists
16274 $cat >try.c <<EOP
16275 #include <pthread.h>
16276 #include <stdio.h>
16277 int main() {
16278 #ifdef  PTHREAD_ATFORK
16279         pthread_atfork(NULL,NULL,NULL);
16280 #endif
16281 }
16282 EOP
16283
16284 : see if pthread_atfork exists
16285 set try -DPTHREAD_ATFORK
16286 if eval $compile; then
16287     val="$define"
16288 else
16289     val="$undef"
16290 fi
16291 case "$usethreads" in
16292 $define)
16293         case "$val" in
16294         $define) echo 'pthread_atfork found.' >&4        ;;
16295         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16296         esac
16297 esac
16298 set d_pthread_atfork
16299 eval $setvar
16300
16301 : see if pthread_attr_setscope exists
16302 set pthread_attr_setscope d_pthread_attr_setscope
16303 eval $inlibc
16304
16305 : see whether the various POSIXish _yields exist
16306 $cat >try.c <<EOP
16307 #include <pthread.h>
16308 #include <stdio.h>
16309 int main() {
16310 #ifdef SCHED_YIELD
16311         sched_yield();
16312 #else
16313 #ifdef PTHREAD_YIELD
16314         pthread_yield();
16315 #else
16316 #ifdef PTHREAD_YIELD_NULL
16317         pthread_yield(NULL);
16318 #endif
16319 #endif
16320 #endif
16321 }
16322 EOP
16323 : see if sched_yield exists
16324 set try -DSCHED_YIELD
16325 if eval $compile; then
16326     val="$define"
16327     sched_yield='sched_yield()'
16328 else
16329     val="$undef"
16330 fi
16331 case "$usethreads" in
16332 $define)
16333         case "$val" in
16334         $define) echo 'sched_yield() found.' >&4        ;;
16335         *)       echo 'sched_yield() NOT found.' >&4    ;;
16336         esac
16337 esac
16338 set d_sched_yield
16339 eval $setvar
16340
16341 : see if pthread_yield exists
16342 set try -DPTHREAD_YIELD
16343 if eval $compile; then
16344     val="$define"
16345     case "$sched_yield" in
16346     '') sched_yield='pthread_yield()' ;;
16347     esac
16348 else
16349     set try -DPTHREAD_YIELD_NULL
16350     if eval $compile; then
16351         val="$define"
16352         case "$sched_yield" in
16353         '') sched_yield='pthread_yield(NULL)' ;;
16354         esac
16355     else
16356         val="$undef"
16357     fi
16358 fi
16359 case "$usethreads" in
16360 $define)
16361         case "$val" in
16362         $define) echo 'pthread_yield() found.' >&4      ;;
16363         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16364         esac
16365         ;;
16366 esac
16367 set d_pthread_yield
16368 eval $setvar
16369 case "$sched_yield" in
16370 '') sched_yield=undef ;;
16371 esac
16372 $rm_try
16373
16374 : see if random_r exists
16375 set random_r d_random_r
16376 eval $inlibc
16377 case "$d_random_r" in
16378 "$define")
16379         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16380         case "$d_random_r_proto:$usethreads" in
16381         ":define")      d_random_r_proto=define
16382                 set d_random_r_proto random_r $hdrs
16383                 eval $hasproto ;;
16384         *)      ;;
16385         esac
16386         case "$d_random_r_proto" in
16387         define)
16388         case "$random_r_proto" in
16389         ''|0) try='int random_r(int*, struct random_data*);'
16390         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16391         esac
16392         case "$random_r_proto" in
16393         ''|0) try='int random_r(long*, struct random_data*);'
16394         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16395         esac
16396         case "$random_r_proto" in
16397         ''|0) try='int random_r(struct random_data*, int32_t*);'
16398         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16399         esac
16400         case "$random_r_proto" in
16401         ''|0)   d_random_r=undef
16402                 random_r_proto=0
16403                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16404         * )     case "$random_r_proto" in
16405                 REENTRANT_PROTO*) ;;
16406                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16407                 esac
16408                 echo "Prototype: $try" ;;
16409         esac
16410         ;;
16411         *)      case "$usethreads" in
16412                 define) echo "random_r has no prototype, not using it." >&4 ;;
16413                 esac
16414                 d_random_r=undef
16415                 random_r_proto=0
16416                 ;;
16417         esac
16418         ;;
16419 *)      random_r_proto=0
16420         ;;
16421 esac
16422
16423 : see if readdir and friends exist
16424 set readdir d_readdir
16425 eval $inlibc
16426 set seekdir d_seekdir
16427 eval $inlibc
16428 set telldir d_telldir
16429 eval $inlibc
16430 set rewinddir d_rewinddir
16431 eval $inlibc
16432
16433 : see if readdir64_r exists
16434 set readdir64_r d_readdir64_r
16435 eval $inlibc
16436 case "$d_readdir64_r" in
16437 "$define")
16438         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16439         case "$d_readdir64_r_proto:$usethreads" in
16440         ":define")      d_readdir64_r_proto=define
16441                 set d_readdir64_r_proto readdir64_r $hdrs
16442                 eval $hasproto ;;
16443         *)      ;;
16444         esac
16445         case "$d_readdir64_r_proto" in
16446         define)
16447         case "$readdir64_r_proto" in
16448         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16449         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16450         esac
16451         case "$readdir64_r_proto" in
16452         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16453         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16454         esac
16455         case "$readdir64_r_proto" in
16456         ''|0)   d_readdir64_r=undef
16457                 readdir64_r_proto=0
16458                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16459         * )     case "$readdir64_r_proto" in
16460                 REENTRANT_PROTO*) ;;
16461                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16462                 esac
16463                 echo "Prototype: $try" ;;
16464         esac
16465         ;;
16466         *)      case "$usethreads" in
16467                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16468                 esac
16469                 d_readdir64_r=undef
16470                 readdir64_r_proto=0
16471                 ;;
16472         esac
16473         ;;
16474 *)      readdir64_r_proto=0
16475         ;;
16476 esac
16477
16478 : see if readdir_r exists
16479 set readdir_r d_readdir_r
16480 eval $inlibc
16481 case "$d_readdir_r" in
16482 "$define")
16483         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16484         case "$d_readdir_r_proto:$usethreads" in
16485         ":define")      d_readdir_r_proto=define
16486                 set d_readdir_r_proto readdir_r $hdrs
16487                 eval $hasproto ;;
16488         *)      ;;
16489         esac
16490         case "$d_readdir_r_proto" in
16491         define)
16492         case "$readdir_r_proto" in
16493         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16494         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16495         esac
16496         case "$readdir_r_proto" in
16497         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16498         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16499         esac
16500         case "$readdir_r_proto" in
16501         ''|0)   d_readdir_r=undef
16502                 readdir_r_proto=0
16503                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16504         * )     case "$readdir_r_proto" in
16505                 REENTRANT_PROTO*) ;;
16506                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16507                 esac
16508                 echo "Prototype: $try" ;;
16509         esac
16510         ;;
16511         *)      case "$usethreads" in
16512                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16513                 esac
16514                 d_readdir_r=undef
16515                 readdir_r_proto=0
16516                 ;;
16517         esac
16518         ;;
16519 *)      readdir_r_proto=0
16520         ;;
16521 esac
16522
16523 : see if readv exists
16524 set readv d_readv
16525 eval $inlibc
16526
16527 : see if recvmsg exists
16528 set recvmsg d_recvmsg
16529 eval $inlibc
16530
16531 : see if rename exists
16532 set rename d_rename
16533 eval $inlibc
16534
16535 : see if rmdir exists
16536 set rmdir d_rmdir
16537 eval $inlibc
16538
16539 : see if memory.h is available.
16540 val=''
16541 set memory.h val
16542 eval $inhdr
16543
16544 : See if it conflicts with string.h
16545 case "$val" in
16546 $define)
16547         case "$strings" in
16548         '') ;;
16549         *)
16550                 $cppstdin $cppflags $cppminus < $strings > mem.h
16551                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16552                         echo " "
16553                         echo "We won't be including <memory.h>."
16554                         val="$undef"
16555                 fi
16556                 $rm -f mem.h
16557                 ;;
16558         esac
16559 esac
16560 set i_memory
16561 eval $setvar
16562
16563 : can bcopy handle overlapping blocks?
16564 echo " "
16565 val="$undef"
16566 case "$d_memmove" in
16567 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16568 *)      case "$d_bcopy" in
16569         "$define")
16570                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16571                 $cat >try.c <<EOCP
16572 #$i_memory I_MEMORY
16573 #$i_stdlib I_STDLIB
16574 #$i_string I_STRING
16575 #$i_unistd I_UNISTD
16576 EOCP
16577         $cat >>try.c <<'EOCP'
16578 #include <stdio.h>
16579 #ifdef I_MEMORY
16580 #  include <memory.h>
16581 #endif
16582 #ifdef I_STDLIB
16583 #  include <stdlib.h>
16584 #endif
16585 #ifdef I_STRING
16586 #  include <string.h>
16587 #else
16588 #  include <strings.h>
16589 #endif
16590 #ifdef I_UNISTD
16591 #  include <unistd.h>  /* Needed for NetBSD */
16592 #endif
16593 int main()
16594 {
16595 char buf[128], abc[128];
16596 char *b;
16597 int len;
16598 int off;
16599 int align;
16600
16601 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16602    try to store the string in read-only memory. */
16603 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16604
16605 for (align = 7; align >= 0; align--) {
16606         for (len = 36; len; len--) {
16607                 b = buf+align;
16608                 bcopy(abc, b, len);
16609                 for (off = 1; off <= len; off++) {
16610                         bcopy(b, b+off, len);
16611                         bcopy(b+off, b, len);
16612                         if (bcmp(b, abc, len))
16613                                 exit(1);
16614                 }
16615         }
16616 }
16617 exit(0);
16618 }
16619 EOCP
16620                 set try
16621                 if eval $compile_ok; then
16622                         if $run ./try 2>/dev/null; then
16623                                 echo "Yes, it can."
16624                                 val="$define"
16625                         else
16626                                 echo "It can't, sorry."
16627                         fi
16628                 else
16629                         echo "(I can't compile the test program, so we'll assume not...)"
16630                 fi
16631                 ;;
16632         esac
16633         $rm_try
16634         ;;
16635 esac
16636 set d_safebcpy
16637 eval $setvar
16638
16639 : can memcpy handle overlapping blocks?
16640 echo " "
16641 val="$undef"
16642 case "$d_memmove" in
16643 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16644 *)      case "$d_memcpy" in
16645         "$define")
16646                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16647                 $cat >try.c <<EOCP
16648 #$i_memory I_MEMORY
16649 #$i_stdlib I_STDLIB
16650 #$i_string I_STRING
16651 #$i_unistd I_UNISTD
16652 EOCP
16653         $cat >>try.c <<'EOCP'
16654 #include <stdio.h>
16655 #ifdef I_MEMORY
16656 #  include <memory.h>
16657 #endif
16658 #ifdef I_STDLIB
16659 #  include <stdlib.h>
16660 #endif
16661 #ifdef I_STRING
16662 #  include <string.h>
16663 #else
16664 #  include <strings.h>
16665 #endif
16666 #ifdef I_UNISTD
16667 #  include <unistd.h>  /* Needed for NetBSD */
16668 #endif
16669 int main()
16670 {
16671 char buf[128], abc[128];
16672 char *b;
16673 int len;
16674 int off;
16675 int align;
16676
16677 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16678    try to store the string in read-only memory. */
16679 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16680
16681 for (align = 7; align >= 0; align--) {
16682         for (len = 36; len; len--) {
16683                 b = buf+align;
16684                 memcpy(b, abc, len);
16685                 for (off = 1; off <= len; off++) {
16686                         memcpy(b+off, b, len);
16687                         memcpy(b, b+off, len);
16688                         if (memcmp(b, abc, len))
16689                                 exit(1);
16690                 }
16691         }
16692 }
16693 exit(0);
16694 }
16695 EOCP
16696                 set try
16697                 if eval $compile_ok; then
16698                         if $run ./try 2>/dev/null; then
16699                                 echo "Yes, it can."
16700                                 val="$define"
16701                         else
16702                                 echo "It can't, sorry."
16703                         fi
16704                 else
16705                         echo "(I can't compile the test program, so we'll assume not...)"
16706                 fi
16707                 ;;
16708         esac
16709         $rm_try
16710         ;;
16711 esac
16712 set d_safemcpy
16713 eval $setvar
16714
16715 : can memcmp be trusted to compare relative magnitude?
16716 val="$undef"
16717 case "$d_memcmp" in
16718 "$define")
16719         echo " "
16720         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16721         $cat >try.c <<EOCP
16722 #$i_memory I_MEMORY
16723 #$i_stdlib I_STDLIB
16724 #$i_string I_STRING
16725 #$i_unistd I_UNISTD
16726 EOCP
16727         $cat >>try.c <<'EOCP'
16728 #include <stdio.h>
16729 #ifdef I_MEMORY
16730 #  include <memory.h>
16731 #endif
16732 #ifdef I_STDLIB
16733 #  include <stdlib.h>
16734 #endif
16735 #ifdef I_STRING
16736 #  include <string.h>
16737 #else
16738 #  include <strings.h>
16739 #endif
16740 #ifdef I_UNISTD
16741 #  include <unistd.h>  /* Needed for NetBSD */
16742 #endif
16743 int main()
16744 {
16745 char a = -1;
16746 char b = 0;
16747 if ((a < b) && memcmp(&a, &b, 1) < 0)
16748         exit(1);
16749 exit(0);
16750 }
16751 EOCP
16752         set try
16753         if eval $compile_ok; then
16754                 if $run ./try 2>/dev/null; then
16755                         echo "Yes, it can."
16756                         val="$define"
16757                 else
16758                         echo "No, it can't (it uses signed chars)."
16759                 fi
16760         else
16761                 echo "(I can't compile the test program, so we'll assume not...)"
16762         fi
16763         ;;
16764 esac
16765 $rm_try
16766 set d_sanemcmp
16767 eval $setvar
16768
16769 : see if prototype for sbrk is available
16770 echo " "
16771 set d_sbrkproto sbrk $i_unistd unistd.h
16772 eval $hasproto
16773
16774 : see if select exists
16775 set select d_select
16776 eval $inlibc
16777
16778 : see if semctl exists
16779 set semctl d_semctl
16780 eval $inlibc
16781
16782 : see if semget exists
16783 set semget d_semget
16784 eval $inlibc
16785
16786 : see if semop exists
16787 set semop d_semop
16788 eval $inlibc
16789
16790 : see how much of the 'sem*(2)' library is present.
16791 h_sem=true
16792 echo " "
16793 case "$d_semctl$d_semget$d_semop" in
16794 *"$undef"*) h_sem=false;;
16795 esac
16796 case "$osname" in
16797 freebsd)
16798     case "`ipcs 2>&1`" in
16799     "SVID messages"*"not configured"*)
16800         echo "Your $osname does not have the sem*(2) configured." >&4
16801         h_sem=false
16802         val="$undef"
16803         set semctl d_semctl
16804         eval $setvar
16805         set semget d_semget
16806         eval $setvar
16807         set semop d_semop
16808         eval $setvar
16809         ;;
16810     esac
16811     ;;
16812 esac
16813 : we could also check for sys/ipc.h ...
16814 if $h_sem && $test `./findhdr sys/sem.h`; then
16815         echo "You have the full sem*(2) library." >&4
16816         val="$define"
16817 else
16818         echo "You don't have the full sem*(2) library." >&4
16819         val="$undef"
16820 fi
16821 set d_sem
16822 eval $setvar
16823
16824 : see whether sys/sem.h defines union semun
16825 echo " "
16826 $cat > try.c <<'END'
16827 #include <sys/types.h>
16828 #include <sys/ipc.h>
16829 #include <sys/sem.h>
16830 int main () { union semun semun; semun.buf = 0; }
16831 END
16832 set try
16833 if eval $compile; then
16834     echo "You have union semun in <sys/sem.h>." >&4
16835     val="$define"
16836 else
16837     echo "You do not have union semun in <sys/sem.h>." >&4
16838     val="$undef"
16839 fi
16840 $rm_try
16841 set d_union_semun
16842 eval $setvar
16843
16844 : see how to do semctl IPC_STAT
16845 case "$d_sem" in
16846 $define)
16847     echo " "
16848     $cat > tryh.h <<END
16849 #ifndef S_IRUSR
16850 #   ifdef S_IREAD
16851 #       define S_IRUSR S_IREAD
16852 #       define S_IWUSR S_IWRITE
16853 #       define S_IXUSR S_IEXEC
16854 #   else
16855 #       define S_IRUSR 0400
16856 #       define S_IWUSR 0200
16857 #       define S_IXUSR 0100
16858 #   endif
16859 #   define S_IRGRP (S_IRUSR>>3)
16860 #   define S_IWGRP (S_IWUSR>>3)
16861 #   define S_IXGRP (S_IXUSR>>3)
16862 #   define S_IROTH (S_IRUSR>>6)
16863 #   define S_IWOTH (S_IWUSR>>6)
16864 #   define S_IXOTH (S_IXUSR>>6)
16865 #endif
16866 #ifndef S_IRWXU
16867 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16868 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16869 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16870 #endif
16871 END
16872     : see whether semctl IPC_STAT can use union semun
16873     case "$d_semctl_semun" in
16874     '')
16875       val="$undef"
16876       $cat > try.c <<END
16877 #include <sys/types.h>
16878 #include <sys/ipc.h>
16879 #include <sys/sem.h>
16880 #include <sys/stat.h>
16881 #include <stdio.h>
16882 #include <errno.h>
16883 #include "tryh.h"
16884 #ifndef errno
16885 extern int errno;
16886 #endif
16887 #$d_union_semun HAS_UNION_SEMUN
16888 int main() {
16889     union semun
16890 #ifndef HAS_UNION_SEMUN
16891     {
16892         int val;
16893         struct semid_ds *buf;
16894         unsigned short *array;
16895     }
16896 #endif
16897     arg;
16898     int sem, st;
16899
16900 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16901     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16902     if (sem > -1) {
16903         struct semid_ds argbuf;
16904         arg.buf = &argbuf;
16905 #       ifdef IPC_STAT
16906         st = semctl(sem, 0, IPC_STAT, arg);
16907         if (st == 0)
16908             printf("semun\n");
16909         else
16910 #       endif /* IPC_STAT */
16911             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16912 #       ifdef IPC_RMID
16913         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16914 #       endif /* IPC_RMID */
16915             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16916     } else
16917 #endif /* IPC_PRIVATE && ... */
16918         printf("semget failed: errno = %d\n", errno);
16919   return 0;
16920 }
16921 END
16922       set try
16923       if eval $compile; then
16924           xxx=`$run ./try`
16925           case "$xxx" in
16926           semun) val="$define" ;;
16927           esac
16928       fi
16929       $rm_try
16930       set d_semctl_semun
16931       eval $setvar
16932       ;;
16933     esac
16934     case "$d_semctl_semun" in
16935     $define)
16936         echo "You can use union semun for semctl IPC_STAT." >&4
16937         also='also'
16938         ;;
16939     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16940         also=''
16941         ;;
16942     esac
16943
16944     : see whether semctl IPC_STAT can use struct semid_ds pointer
16945     case "$d_semctl_semid_ds" in
16946     '')
16947       val="$undef"
16948       $cat > try.c <<'END'
16949 #include <sys/types.h>
16950 #include <sys/ipc.h>
16951 #include <sys/sem.h>
16952 #include <sys/stat.h>
16953 #include "tryh.h"
16954 #include <stdio.h>
16955 #include <errno.h>
16956 #ifndef errno
16957 extern int errno;
16958 #endif
16959 int main() {
16960     struct semid_ds arg;
16961     int sem, st;
16962
16963 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16964     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16965     if (sem > -1) {
16966 #       ifdef IPC_STAT
16967         st = semctl(sem, 0, IPC_STAT, &arg);
16968         if (st == 0)
16969             printf("semid_ds\n");
16970         else
16971 #       endif /* IPC_STAT */
16972             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16973 #       ifdef IPC_RMID
16974         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16975 #       endif /* IPC_RMID */
16976             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16977     } else
16978 #endif /* IPC_PRIVATE && ... */
16979         printf("semget failed: errno = %d\n", errno);
16980
16981     return 0;
16982 }
16983 END
16984       set try
16985       if eval $compile; then
16986           xxx=`$run ./try`
16987           case "$xxx" in
16988           semid_ds) val="$define" ;;
16989           esac
16990       fi
16991       $rm_try
16992       set d_semctl_semid_ds
16993       eval $setvar
16994       ;;
16995     esac
16996     case "$d_semctl_semid_ds" in
16997     $define)
16998         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16999         ;;
17000     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17001         ;;
17002     esac
17003     ;;
17004 *)  val="$undef"
17005
17006     # We do not have the full sem*(2) library, so assume we can not
17007     # use either.
17008
17009     set d_semctl_semun
17010     eval $setvar
17011
17012     set d_semctl_semid_ds
17013     eval $setvar
17014     ;;
17015 esac
17016 $rm_try tryh.h
17017
17018 : see if sendmsg exists
17019 set sendmsg d_sendmsg
17020 eval $inlibc
17021
17022 : see if setegid exists
17023 set setegid d_setegid
17024 eval $inlibc
17025
17026 : see if seteuid exists
17027 set seteuid d_seteuid
17028 eval $inlibc
17029
17030 : see if setgrent exists
17031 set setgrent d_setgrent
17032 eval $inlibc
17033
17034 : see if setgrent_r exists
17035 set setgrent_r d_setgrent_r
17036 eval $inlibc
17037 case "$d_setgrent_r" in
17038 "$define")
17039         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17040         case "$d_setgrent_r_proto:$usethreads" in
17041         ":define")      d_setgrent_r_proto=define
17042                 set d_setgrent_r_proto setgrent_r $hdrs
17043                 eval $hasproto ;;
17044         *)      ;;
17045         esac
17046         case "$d_setgrent_r_proto" in
17047         define)
17048         case "$setgrent_r_proto" in
17049         ''|0) try='int setgrent_r(FILE**);'
17050         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17051         esac
17052         case "$setgrent_r_proto" in
17053         ''|0) try='void setgrent_r(FILE**);'
17054         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17055         esac
17056         case "$setgrent_r_proto" in
17057         ''|0)   d_setgrent_r=undef
17058                 setgrent_r_proto=0
17059                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17060         * )     case "$setgrent_r_proto" in
17061                 REENTRANT_PROTO*) ;;
17062                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17063                 esac
17064                 echo "Prototype: $try" ;;
17065         esac
17066         ;;
17067         *)      case "$usethreads" in
17068                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17069                 esac
17070                 d_setgrent_r=undef
17071                 setgrent_r_proto=0
17072                 ;;
17073         esac
17074         ;;
17075 *)      setgrent_r_proto=0
17076         ;;
17077 esac
17078
17079 : see if sethostent exists
17080 set sethostent d_sethent
17081 eval $inlibc
17082
17083 : see if sethostent_r exists
17084 set sethostent_r d_sethostent_r
17085 eval $inlibc
17086 case "$d_sethostent_r" in
17087 "$define")
17088         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17089         case "$d_sethostent_r_proto:$usethreads" in
17090         ":define")      d_sethostent_r_proto=define
17091                 set d_sethostent_r_proto sethostent_r $hdrs
17092                 eval $hasproto ;;
17093         *)      ;;
17094         esac
17095         case "$d_sethostent_r_proto" in
17096         define)
17097         case "$sethostent_r_proto" in
17098         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17099         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17100         esac
17101         case "$sethostent_r_proto" in
17102         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17103         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17104         esac
17105         case "$sethostent_r_proto" in
17106         ''|0)   d_sethostent_r=undef
17107                 sethostent_r_proto=0
17108                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17109         * )     case "$sethostent_r_proto" in
17110                 REENTRANT_PROTO*) ;;
17111                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17112                 esac
17113                 echo "Prototype: $try" ;;
17114         esac
17115         ;;
17116         *)      case "$usethreads" in
17117                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17118                 esac
17119                 d_sethostent_r=undef
17120                 sethostent_r_proto=0
17121                 ;;
17122         esac
17123         ;;
17124 *)      sethostent_r_proto=0
17125         ;;
17126 esac
17127
17128 : see if setitimer exists
17129 set setitimer d_setitimer
17130 eval $inlibc
17131
17132 : see if setlinebuf exists
17133 set setlinebuf d_setlinebuf
17134 eval $inlibc
17135
17136 : see if setlocale exists
17137 set setlocale d_setlocale
17138 eval $inlibc
17139
17140 : see if locale.h is available
17141 set locale.h i_locale
17142 eval $inhdr
17143
17144 : see if setlocale_r exists
17145 set setlocale_r d_setlocale_r
17146 eval $inlibc
17147 case "$d_setlocale_r" in
17148 "$define")
17149         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17150         case "$d_setlocale_r_proto:$usethreads" in
17151         ":define")      d_setlocale_r_proto=define
17152                 set d_setlocale_r_proto setlocale_r $hdrs
17153                 eval $hasproto ;;
17154         *)      ;;
17155         esac
17156         case "$d_setlocale_r_proto" in
17157         define)
17158         case "$setlocale_r_proto" in
17159         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17160         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17161         esac
17162         case "$setlocale_r_proto" in
17163         ''|0)   d_setlocale_r=undef
17164                 setlocale_r_proto=0
17165                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17166         * )     case "$setlocale_r_proto" in
17167                 REENTRANT_PROTO*) ;;
17168                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17169                 esac
17170                 echo "Prototype: $try" ;;
17171         esac
17172         ;;
17173         *)      case "$usethreads" in
17174                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17175                 esac
17176                 d_setlocale_r=undef
17177                 setlocale_r_proto=0
17178                 ;;
17179         esac
17180         ;;
17181 *)      setlocale_r_proto=0
17182         ;;
17183 esac
17184
17185 : see if setnetent exists
17186 set setnetent d_setnent
17187 eval $inlibc
17188
17189 : see if setnetent_r exists
17190 set setnetent_r d_setnetent_r
17191 eval $inlibc
17192 case "$d_setnetent_r" in
17193 "$define")
17194         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17195         case "$d_setnetent_r_proto:$usethreads" in
17196         ":define")      d_setnetent_r_proto=define
17197                 set d_setnetent_r_proto setnetent_r $hdrs
17198                 eval $hasproto ;;
17199         *)      ;;
17200         esac
17201         case "$d_setnetent_r_proto" in
17202         define)
17203         case "$setnetent_r_proto" in
17204         ''|0) try='int setnetent_r(int, struct netent_data*);'
17205         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17206         esac
17207         case "$setnetent_r_proto" in
17208         ''|0) try='void setnetent_r(int, struct netent_data*);'
17209         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17210         esac
17211         case "$setnetent_r_proto" in
17212         ''|0)   d_setnetent_r=undef
17213                 setnetent_r_proto=0
17214                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17215         * )     case "$setnetent_r_proto" in
17216                 REENTRANT_PROTO*) ;;
17217                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17218                 esac
17219                 echo "Prototype: $try" ;;
17220         esac
17221         ;;
17222         *)      case "$usethreads" in
17223                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17224                 esac
17225                 d_setnetent_r=undef
17226                 setnetent_r_proto=0
17227                 ;;
17228         esac
17229         ;;
17230 *)      setnetent_r_proto=0
17231         ;;
17232 esac
17233
17234 : see if setprotoent exists
17235 set setprotoent d_setpent
17236 eval $inlibc
17237
17238 : see if setpgid exists
17239 set setpgid d_setpgid
17240 eval $inlibc
17241
17242 : see if setpgrp2 exists
17243 set setpgrp2 d_setpgrp2
17244 eval $inlibc
17245
17246 : see if setpriority exists
17247 set setpriority d_setprior
17248 eval $inlibc
17249
17250 : see if setproctitle exists
17251 set setproctitle d_setproctitle
17252 eval $inlibc
17253
17254 : see if setprotoent_r exists
17255 set setprotoent_r d_setprotoent_r
17256 eval $inlibc
17257 case "$d_setprotoent_r" in
17258 "$define")
17259         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17260         case "$d_setprotoent_r_proto:$usethreads" in
17261         ":define")      d_setprotoent_r_proto=define
17262                 set d_setprotoent_r_proto setprotoent_r $hdrs
17263                 eval $hasproto ;;
17264         *)      ;;
17265         esac
17266         case "$d_setprotoent_r_proto" in
17267         define)
17268         case "$setprotoent_r_proto" in
17269         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17270         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17271         esac
17272         case "$setprotoent_r_proto" in
17273         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17274         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17275         esac
17276         case "$setprotoent_r_proto" in
17277         ''|0)   d_setprotoent_r=undef
17278                 setprotoent_r_proto=0
17279                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17280         * )     case "$setprotoent_r_proto" in
17281                 REENTRANT_PROTO*) ;;
17282                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17283                 esac
17284                 echo "Prototype: $try" ;;
17285         esac
17286         ;;
17287         *)      case "$usethreads" in
17288                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17289                 esac
17290                 d_setprotoent_r=undef
17291                 setprotoent_r_proto=0
17292                 ;;
17293         esac
17294         ;;
17295 *)      setprotoent_r_proto=0
17296         ;;
17297 esac
17298
17299 : see if setpwent exists
17300 set setpwent d_setpwent
17301 eval $inlibc
17302
17303 : see if setpwent_r exists
17304 set setpwent_r d_setpwent_r
17305 eval $inlibc
17306 case "$d_setpwent_r" in
17307 "$define")
17308         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17309         case "$d_setpwent_r_proto:$usethreads" in
17310         ":define")      d_setpwent_r_proto=define
17311                 set d_setpwent_r_proto setpwent_r $hdrs
17312                 eval $hasproto ;;
17313         *)      ;;
17314         esac
17315         case "$d_setpwent_r_proto" in
17316         define)
17317         case "$setpwent_r_proto" in
17318         ''|0) try='int setpwent_r(FILE**);'
17319         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17320         esac
17321         case "$setpwent_r_proto" in
17322         ''|0) try='void setpwent_r(FILE**);'
17323         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17324         esac
17325         case "$setpwent_r_proto" in
17326         ''|0)   d_setpwent_r=undef
17327                 setpwent_r_proto=0
17328                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17329         * )     case "$setpwent_r_proto" in
17330                 REENTRANT_PROTO*) ;;
17331                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17332                 esac
17333                 echo "Prototype: $try" ;;
17334         esac
17335         ;;
17336         *)      case "$usethreads" in
17337                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17338                 esac
17339                 d_setpwent_r=undef
17340                 setpwent_r_proto=0
17341                 ;;
17342         esac
17343         ;;
17344 *)      setpwent_r_proto=0
17345         ;;
17346 esac
17347
17348 : see if setregid exists
17349 set setregid d_setregid
17350 eval $inlibc
17351 set setresgid d_setresgid
17352 eval $inlibc
17353
17354 : see if setreuid exists
17355 set setreuid d_setreuid
17356 eval $inlibc
17357 set setresuid d_setresuid
17358 eval $inlibc
17359
17360 : see if setrgid exists
17361 set setrgid d_setrgid
17362 eval $inlibc
17363
17364 : see if setruid exists
17365 set setruid d_setruid
17366 eval $inlibc
17367
17368 : see if setservent exists
17369 set setservent d_setsent
17370 eval $inlibc
17371
17372 : see if setservent_r exists
17373 set setservent_r d_setservent_r
17374 eval $inlibc
17375 case "$d_setservent_r" in
17376 "$define")
17377         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17378         case "$d_setservent_r_proto:$usethreads" in
17379         ":define")      d_setservent_r_proto=define
17380                 set d_setservent_r_proto setservent_r $hdrs
17381                 eval $hasproto ;;
17382         *)      ;;
17383         esac
17384         case "$d_setservent_r_proto" in
17385         define)
17386         case "$setservent_r_proto" in
17387         ''|0) try='int setservent_r(int, struct servent_data*);'
17388         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17389         esac
17390         case "$setservent_r_proto" in
17391         ''|0) try='void setservent_r(int, struct servent_data*);'
17392         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17393         esac
17394         case "$setservent_r_proto" in
17395         ''|0)   d_setservent_r=undef
17396                 setservent_r_proto=0
17397                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17398         * )     case "$setservent_r_proto" in
17399                 REENTRANT_PROTO*) ;;
17400                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17401                 esac
17402                 echo "Prototype: $try" ;;
17403         esac
17404         ;;
17405         *)      case "$usethreads" in
17406                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17407                 esac
17408                 d_setservent_r=undef
17409                 setservent_r_proto=0
17410                 ;;
17411         esac
17412         ;;
17413 *)      setservent_r_proto=0
17414         ;;
17415 esac
17416
17417 : see if setsid exists
17418 set setsid d_setsid
17419 eval $inlibc
17420
17421 : see if setvbuf exists
17422 set setvbuf d_setvbuf
17423 eval $inlibc
17424
17425 : see if sfio.h is available
17426 set sfio.h i_sfio
17427 eval $inhdr
17428
17429 : see if sfio library is available
17430 case "$i_sfio" in
17431 $define)
17432         val=''
17433         set sfreserve val
17434         eval $inlibc
17435         ;;
17436 *)
17437         val="$undef"
17438         ;;
17439 esac
17440 : Ok, but do we want to use it.
17441 case "$val" in
17442 $define)
17443         case "$usesfio" in
17444         true|$define|[yY]*) dflt='y';;
17445         *) dflt='n';;
17446         esac
17447         echo "$package can use the sfio library, but it is experimental."
17448         rp="You seem to have sfio available, do you want to try using it?"
17449         . ./myread
17450         case "$ans" in
17451         y|Y)    echo "Ok, turning on sfio then."
17452                 val="$define"
17453                 ;;
17454         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17455                 val="$undef"
17456                 ;;
17457         esac
17458         ;;
17459 *)      case "$usesfio" in
17460         true|$define|[yY]*)
17461                 echo "Sorry, cannot find sfio on this machine." >&4
17462                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17463                 val="$undef"
17464                 ;;
17465         esac
17466         ;;
17467 esac
17468 set d_sfio
17469 eval $setvar
17470 case "$d_sfio" in
17471 $define) usesfio='true';;
17472 *) usesfio='false';;
17473 esac
17474 case "$d_sfio" in
17475 $define) ;;
17476 *)      : Remove sfio from list of libraries to use
17477         case "$libs" in
17478         *-lsfio*)
17479                 echo "Removing unneeded -lsfio from library list" >&4
17480                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17481                 shift
17482                 libs="$*"
17483                 echo "libs = $libs" >&4
17484                 ;;
17485         esac
17486 ;;
17487 esac
17488
17489
17490 : see if shmctl exists
17491 set shmctl d_shmctl
17492 eval $inlibc
17493
17494 : see if shmget exists
17495 set shmget d_shmget
17496 eval $inlibc
17497
17498 : see if shmat exists
17499 set shmat d_shmat
17500 eval $inlibc
17501 : see what shmat returns
17502 case "$d_shmat" in
17503 "$define")
17504         $cat >shmat.c <<'END'
17505 #include <sys/shm.h>
17506 void *shmat();
17507 END
17508         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17509                 shmattype='void *'
17510         else
17511                 shmattype='char *'
17512         fi
17513         echo "and it returns ($shmattype)." >&4
17514         : see if a prototype for shmat is available
17515         xxx=`./findhdr sys/shm.h`
17516         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17517         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17518                 val="$define"
17519         else
17520                 val="$undef"
17521         fi
17522         $rm -f shmat.[co]
17523         ;;
17524 *)
17525         val="$undef"
17526         ;;
17527 esac
17528 set d_shmatprototype
17529 eval $setvar
17530
17531 : see if shmdt exists
17532 set shmdt d_shmdt
17533 eval $inlibc
17534
17535 : see how much of the 'shm*(2)' library is present.
17536 h_shm=true
17537 echo " "
17538 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17539 *"$undef"*) h_shm=false;;
17540 esac
17541 case "$osname" in
17542 freebsd)
17543     case "`ipcs 2>&1`" in
17544     "SVID shared memory"*"not configured"*)
17545         echo "Your $osname does not have the shm*(2) configured." >&4
17546         h_shm=false
17547         val="$undef"
17548         set shmctl d_shmctl
17549         evat $setvar
17550         set shmget d_shmget
17551         evat $setvar
17552         set shmat d_shmat
17553         evat $setvar
17554         set shmdt d_shmdt
17555         evat $setvar
17556         ;;
17557     esac
17558     ;;
17559 esac
17560 : we could also check for sys/ipc.h ...
17561 if $h_shm && $test `./findhdr sys/shm.h`; then
17562         echo "You have the full shm*(2) library." >&4
17563         val="$define"
17564 else
17565         echo "You don't have the full shm*(2) library." >&4
17566         val="$undef"
17567 fi
17568 set d_shm
17569 eval $setvar
17570
17571 : see if we have sigaction
17572 echo " "
17573 if set sigaction val -f d_sigaction; eval $csym; $val; then
17574         echo 'sigaction() found.' >&4
17575         $cat > try.c <<EOP
17576 #include <stdio.h>
17577 #include <sys/types.h>
17578 #include <signal.h>
17579 #$i_stdlib I_STDLIB
17580 #ifdef I_STDLIB
17581 #include <stdlib.h>
17582 #endif
17583 int main()
17584 {
17585     struct sigaction act, oact;
17586     act.sa_flags = 0;
17587     oact.sa_handler = 0;
17588     /* so that act and oact are used */
17589     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17590 }
17591 EOP
17592         set try
17593         if eval $compile_ok; then
17594                 val="$define"
17595         else
17596                 echo "But you don't seem to have a useable struct sigaction." >&4
17597                 val="$undef"
17598         fi
17599 else
17600         echo 'sigaction NOT found.' >&4
17601         val="$undef"
17602 fi
17603 set d_sigaction; eval $setvar
17604 $rm_try
17605
17606 : see if this is a sunmath.h system
17607 set sunmath.h i_sunmath
17608 eval $inhdr
17609
17610 : see if signbit exists
17611 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17612 $cat >try.c <<EOCP
17613 #$i_math I_MATH
17614 #$i_sunmath I_SUNMATH
17615 #ifdef I_MATH
17616 #  include <math.h>
17617 #endif
17618 #ifdef I_SUNMATH  /* Solaris special math library */
17619 #  include <sunmath.h>
17620 #endif
17621 #define NV $nvtype
17622 int main(int argc, char **argv)
17623 {
17624     NV x = 0.0;
17625     NV y = -0.0;
17626     if ((signbit(x) == 0) && (signbit(y) != 0))
17627         return 0;
17628     else
17629         return 1;
17630 }
17631 EOCP
17632 val="$undef"
17633 set try
17634 if eval $compile; then
17635     if $run ./try; then
17636         $echo "Yes." >&4
17637         val="$define"
17638     else
17639         $echo "Signbit seems to be available, but doesn't work as I expected."
17640         $echo "I won't use it." >&4
17641         val="$undef"
17642     fi
17643 else
17644     $echo "Nope." >&4
17645     dflt="$undef"
17646 fi
17647 set d_signbit
17648 eval $setvar
17649 $rm_try
17650
17651 : see if sigprocmask exists
17652 set sigprocmask d_sigprocmask
17653 eval $inlibc
17654
17655 : see if sigsetjmp exists
17656 echo " "
17657 case "$d_sigsetjmp" in
17658 '')
17659         $cat >try.c <<EOP
17660 #include <setjmp.h>
17661 #$i_stdlib I_STDLIB
17662 #ifdef I_STDLIB
17663 #include <stdlib.h>
17664 #endif
17665 sigjmp_buf env;
17666 int set = 1;
17667 int main()
17668 {
17669         if (sigsetjmp(env,1))
17670                 exit(set);
17671         set = 0;
17672         siglongjmp(env, 1);
17673         exit(1);
17674 }
17675 EOP
17676         set try
17677         if eval $compile; then
17678                 if $run ./try >/dev/null 2>&1; then
17679                         echo "POSIX sigsetjmp found." >&4
17680                         val="$define"
17681                 else
17682                         $cat >&4 <<EOM
17683 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17684 I'll ignore them.
17685 EOM
17686                         val="$undef"
17687                 fi
17688         else
17689                 echo "sigsetjmp not found." >&4
17690                 val="$undef"
17691         fi
17692         ;;
17693 *) val="$d_sigsetjmp"
17694         case "$d_sigsetjmp" in
17695         $define) echo "POSIX sigsetjmp found." >&4;;
17696         $undef) echo "sigsetjmp not found." >&4;;
17697         esac
17698         ;;
17699 esac
17700 set d_sigsetjmp
17701 eval $setvar
17702 $rm_try
17703
17704 : see if snprintf exists
17705 set snprintf d_snprintf
17706 eval $inlibc
17707
17708 : see if vsnprintf exists
17709 set vsnprintf d_vsnprintf
17710 eval $inlibc
17711
17712 case "$d_snprintf-$d_vsnprintf" in
17713 "$define-$define")
17714     $cat <<EOM
17715 Checking whether your snprintf() and vsnprintf() work okay...
17716 EOM
17717     $cat >try.c <<'EOCP'
17718 /* v?snprintf testing logic courtesy of Russ Allbery.
17719  * According to C99:
17720  * - if the buffer is too short it still must be \0-terminated
17721  * - if the buffer is too short the potentially required length
17722  *   must be returned and not -1
17723  * - if the buffer is NULL the potentially required length
17724  *   must be returned and not -1 or core dump
17725  */
17726 #include <stdio.h>
17727 #include <stdarg.h>
17728
17729 char buf[2];
17730
17731 int test (char *format, ...)
17732 {
17733     va_list args;
17734     int count;
17735
17736     va_start (args, format);
17737     count = vsnprintf (buf, sizeof buf, format, args);
17738     va_end (args);
17739     return count;
17740 }
17741
17742 int main ()
17743 {
17744     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17745              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17746 }
17747 EOCP
17748     set try
17749     if eval $compile; then
17750         `$run ./try`
17751         case "$?" in
17752         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17753         *) cat <<EOM >&4
17754 Your snprintf() and snprintf() don't seem to be working okay.
17755 EOM
17756            d_snprintf="$undef"
17757            d_vsnprintf="$undef"
17758            ;;
17759         esac
17760     else
17761         echo "(I can't seem to compile the test program--assuming they don't)"
17762         d_snprintf="$undef"
17763         d_vsnprintf="$undef"
17764     fi
17765     $rm_try
17766     ;;
17767 esac
17768
17769 : see if sockatmark exists
17770 set sockatmark d_sockatmark
17771 eval $inlibc
17772
17773 : see if prototype for sockatmark is available
17774 echo " "
17775 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17776 eval $hasproto
17777
17778 : see if socks5_init exists
17779 set socks5_init d_socks5_init
17780 eval $inlibc
17781
17782 : see if sprintf returns the length of the string in the buffer as per ANSI
17783 $echo "Checking whether sprintf returns the length of the string..." >&4
17784 $cat <<EOP >try.c
17785 #include <stdio.h>
17786 #$i_stdlib I_STDLIB
17787 #ifdef I_STDLIB
17788 #include <stdlib.h>
17789 #endif
17790 #$i_string I_STRING
17791 #ifdef I_STRING
17792 #  include <string.h>
17793 #else
17794 #  include <strings.h>
17795 #endif
17796 #$i_math I_MATH
17797 #ifdef I_MATH
17798 #include <math.h>
17799 #endif
17800
17801 char buffer[256];
17802
17803 int check (size_t expect, int test) {
17804   size_t got = strlen(buffer);
17805   if (expect == got)
17806     return 0;
17807
17808   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17809        test, buffer);
17810   exit (test);
17811 }
17812
17813 int main(int argc, char **argv) {
17814   int test = 0;
17815
17816   check(sprintf(buffer, ""), ++test);
17817   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17818   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17819
17820   return 0;
17821 }
17822 EOP
17823 set try
17824
17825 if eval $compile; then
17826     xxx="`$run ./try`"
17827     case "$?" in
17828         0) cat >&4 <<EOM
17829 sprintf returns the length of the string (as ANSI says it should)
17830 EOM
17831         d_sprintf_returns_strlen="$define"
17832         ;;
17833         *) cat >&4 <<EOM
17834 sprintf does not return the length of the string (how old is this system?)
17835 EOM
17836         d_sprintf_returns_strlen="$undef"
17837         ;;
17838     esac
17839 else
17840     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17841     d_sprintf_returns_strlen="$undef"
17842 fi
17843 $rm_try
17844
17845 : see if srand48_r exists
17846 set srand48_r d_srand48_r
17847 eval $inlibc
17848 case "$d_srand48_r" in
17849 "$define")
17850         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17851         case "$d_srand48_r_proto:$usethreads" in
17852         ":define")      d_srand48_r_proto=define
17853                 set d_srand48_r_proto srand48_r $hdrs
17854                 eval $hasproto ;;
17855         *)      ;;
17856         esac
17857         case "$d_srand48_r_proto" in
17858         define)
17859         case "$srand48_r_proto" in
17860         ''|0) try='int srand48_r(long, struct drand48_data*);'
17861         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17862         esac
17863         case "$srand48_r_proto" in
17864         ''|0)   d_srand48_r=undef
17865                 srand48_r_proto=0
17866                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17867         * )     case "$srand48_r_proto" in
17868                 REENTRANT_PROTO*) ;;
17869                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17870                 esac
17871                 echo "Prototype: $try" ;;
17872         esac
17873         ;;
17874         *)      case "$usethreads" in
17875                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17876                 esac
17877                 d_srand48_r=undef
17878                 srand48_r_proto=0
17879                 ;;
17880         esac
17881         ;;
17882 *)      srand48_r_proto=0
17883         ;;
17884 esac
17885
17886 : see if srandom_r exists
17887 set srandom_r d_srandom_r
17888 eval $inlibc
17889 case "$d_srandom_r" in
17890 "$define")
17891         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17892         case "$d_srandom_r_proto:$usethreads" in
17893         ":define")      d_srandom_r_proto=define
17894                 set d_srandom_r_proto srandom_r $hdrs
17895                 eval $hasproto ;;
17896         *)      ;;
17897         esac
17898         case "$d_srandom_r_proto" in
17899         define)
17900         case "$srandom_r_proto" in
17901         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17902         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17903         esac
17904         case "$srandom_r_proto" in
17905         ''|0)   d_srandom_r=undef
17906                 srandom_r_proto=0
17907                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17908         * )     case "$srandom_r_proto" in
17909                 REENTRANT_PROTO*) ;;
17910                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17911                 esac
17912                 echo "Prototype: $try" ;;
17913         esac
17914         ;;
17915         *)      case "$usethreads" in
17916                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17917                 esac
17918                 d_srandom_r=undef
17919                 srandom_r_proto=0
17920                 ;;
17921         esac
17922         ;;
17923 *)      srandom_r_proto=0
17924         ;;
17925 esac
17926
17927 : see if prototype for setresgid is available
17928 echo " "
17929 set d_sresgproto setresgid $i_unistd unistd.h
17930 eval $hasproto
17931
17932 : see if prototype for setresuid is available
17933 echo " "
17934 set d_sresuproto setresuid $i_unistd unistd.h
17935 eval $hasproto
17936
17937 : see if sys/stat.h is available
17938 set sys/stat.h i_sysstat
17939 eval $inhdr
17940
17941 : see if stat knows about block sizes
17942 echo " "
17943 echo "Checking to see if your struct stat has st_blocks field..." >&4
17944 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17945 eval $hasfield
17946
17947 : see if this is a sys/vfs.h system
17948 set sys/vfs.h i_sysvfs
17949 eval $inhdr
17950
17951 : see if this is a sys/statfs.h system
17952 set sys/statfs.h i_sysstatfs
17953 eval $inhdr
17954
17955 : Check for statfs_s
17956 echo " "
17957 echo "Checking to see if your system supports struct statfs..." >&4
17958 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
17959 eval $hasstruct
17960 case "$d_statfs_s" in
17961 "$define")      echo "Yes, it does."   ;;
17962 *)              echo "No, it doesn't." ;;
17963 esac
17964
17965
17966 : see if struct statfs knows about f_flags
17967 case "$d_statfs_s" in
17968 define)
17969         echo " "
17970         echo "Checking to see if your struct statfs has f_flags field..." >&4
17971         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
17972         eval $hasfield
17973         ;;
17974 *)      val="$undef"
17975         set d_statfs_f_flags
17976         eval $setvar
17977         ;;
17978 esac
17979 case "$d_statfs_f_flags" in
17980 "$define")      echo "Yes, it does."   ;;
17981 *)              echo "No, it doesn't." ;;
17982 esac
17983
17984 : see what flavor, if any, of static inline is supported
17985 echo " "
17986 echo "Checking to see if your system supports static inline..."
17987 $cat > try.c <<'EOCP'
17988 #include <stdlib.h>
17989 extern int f_via_a(int x);
17990 extern int f_via_b(int x);
17991 int main(int argc, char **argv)
17992 {
17993     int y;
17994
17995     y = f_via_a(0);
17996 #ifdef USE_B
17997     y = f_via_b(0);
17998 #endif
17999     if (y == 42) {
18000         return EXIT_SUCCESS;
18001     }
18002     else {
18003         return EXIT_FAILURE;
18004     }
18005 }
18006 EOCP
18007 $cat > a.c <<'EOCP'
18008 static INLINE int f(int x) {
18009     int y;
18010     y = x + 42;
18011     return y;
18012 }
18013
18014 int f_via_a(int x)
18015 {
18016     return f(x);
18017 }
18018 EOCP
18019 $cat > b.c <<'EOCP'
18020 extern int f(int x);
18021
18022 int f_via_b(int x)
18023 {
18024     return f(x);
18025 }
18026 EOCP
18027
18028 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18029 case "$perl_static_inline" in
18030 '')     # Check the various possibilities, and break out on success.
18031         # For gcc, prefer __inline__, which will still permit 
18032         # cflags.SH to add in -ansi.
18033         case "$gccversion" in
18034                 '') xxx="inline __inline__ __inline _inline";;
18035                 *)  xxx="__inline__ inline __inline _inline";;
18036         esac
18037         for inline in $xxx; do
18038                 set try -DINLINE=$inline a.c
18039                 if eval $compile && $run ./try; then
18040                         # Now make sure there is no external linkage of static
18041                         # functions
18042                         set try -DINLINE=$inline -DUSE_B a.c b.c
18043                         if eval $compile && $run ./try; then
18044                                 $echo "Your compiler supports static $inline, " >&4
18045                                 $echo "but it also creates an external definition," >&4
18046                                 $echo "so I won't use it." >&4
18047                                 val=$undef
18048                         else
18049                                 $echo "Your compiler supports static $inline." >&4
18050                                 val=$define
18051                                 perl_static_inline="static $inline";
18052                                 break;
18053                         fi
18054                 else
18055                         $echo "Your compiler does NOT support static $inline." >&4
18056                         val="$undef"
18057                 fi
18058         done
18059         ;;
18060 *inline*) # Some variant of inline exists.
18061         echo "Keeping your $hint value of $perl_static_inline."
18062         val=$define
18063         ;;
18064 static)  # No inline capabilities
18065         echo "Keeping your $hint value of $perl_static_inline."
18066         val=$undef
18067         ;;
18068 *)  # Unrecognized previous value -- blindly trust the supplied
18069         # value and hope it makes sense.  Use old value for
18070         # d_static_inline, if there is one.
18071         echo "Keeping your $hint value of $perl_static_inline."
18072         case "$d_static_inline" in
18073                 '') val=$define ;;
18074                 *)  val=$d_static_inline ;;
18075         esac
18076         ;;
18077 esac
18078 # Fallback to plain 'static' if nothing worked.
18079 case "$perl_static_inline" in
18080 '')
18081         perl_static_inline="static"
18082         val=$undef
18083         ;;
18084 esac
18085 set d_static_inline
18086 eval $setvar
18087 $rm -f a.[co] b.[co]
18088 $rm_try
18089
18090 : Check stream access
18091 $cat >&4 <<EOM
18092 Checking how to access stdio streams by file descriptor number...
18093 EOM
18094 case "$stdio_stream_array" in
18095 '')     $cat >try.c <<EOCP
18096 #include <stdio.h>
18097 int main() {
18098   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18099     printf("yes\n");
18100 }
18101 EOCP
18102         for s in _iob __iob __sF
18103         do
18104                 set try -DSTDIO_STREAM_ARRAY=$s
18105                 if eval $compile; then
18106                         case "`$run ./try`" in
18107                         yes)    stdio_stream_array=$s; break ;;
18108                         esac
18109                 fi
18110         done
18111         $rm_try
18112 esac
18113 case "$stdio_stream_array" in
18114 '')     $cat >&4 <<EOM
18115 I can't figure out how to access stdio streams by file descriptor number.
18116 EOM
18117         d_stdio_stream_array="$undef"
18118         ;;
18119 *)      $cat >&4 <<EOM
18120 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18121 EOM
18122         d_stdio_stream_array="$define"
18123         ;;
18124 esac
18125
18126 : see if strcoll exists
18127 set strcoll d_strcoll
18128 eval $inlibc
18129
18130 : check for structure copying
18131 echo " "
18132 echo "Checking to see if your C compiler can copy structs..." >&4
18133 $cat >try.c <<'EOCP'
18134 int main()
18135 {
18136         struct blurfl {
18137                 int dyick;
18138         } foo, bar;
18139
18140         foo = bar;
18141 }
18142 EOCP
18143 if $cc -c try.c >/dev/null 2>&1 ; then
18144         val="$define"
18145         echo "Yup, it can."
18146 else
18147         val="$undef"
18148         echo "Nope, it can't."
18149 fi
18150 set d_strctcpy
18151 eval $setvar
18152 $rm_try
18153
18154 : see if strerror and/or sys_errlist[] exist
18155 echo " "
18156 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18157     if set strerror val -f d_strerror; eval $csym; $val; then
18158                 echo 'strerror() found.' >&4
18159                 d_strerror="$define"
18160                 d_strerrm='strerror(e)'
18161                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18162                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
18163                         d_syserrlst="$define"
18164                 else
18165                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
18166                         d_syserrlst="$undef"
18167                 fi
18168     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18169                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18170                 echo 'strerror() found in string header.' >&4
18171                 d_strerror="$define"
18172                 d_strerrm='strerror(e)'
18173                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18174                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18175                                 d_syserrlst="$define"
18176                 else
18177                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18178                         d_syserrlst="$undef"
18179                 fi
18180     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18181                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18182                 d_strerror="$undef"
18183                 d_syserrlst="$define"
18184                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18185     else
18186                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18187                 d_strerror="$undef"
18188                 d_syserrlst="$undef"
18189                 d_strerrm='"unknown"'
18190     fi
18191 fi
18192
18193 : see if strerror_r exists
18194 set strerror_r d_strerror_r
18195 eval $inlibc
18196 case "$d_strerror_r" in
18197 "$define")
18198         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18199         case "$d_strerror_r_proto:$usethreads" in
18200         ":define")      d_strerror_r_proto=define
18201                 set d_strerror_r_proto strerror_r $hdrs
18202                 eval $hasproto ;;
18203         *)      ;;
18204         esac
18205         case "$d_strerror_r_proto" in
18206         define)
18207         case "$strerror_r_proto" in
18208         ''|0) try='int strerror_r(int, char*, size_t);'
18209         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18210         esac
18211         case "$strerror_r_proto" in
18212         ''|0) try='int strerror_r(int, char*, int);'
18213         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18214         esac
18215         case "$strerror_r_proto" in
18216         ''|0) try='char* strerror_r(int, char*, size_t);'
18217         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18218         esac
18219         case "$strerror_r_proto" in
18220         ''|0)   d_strerror_r=undef
18221                 strerror_r_proto=0
18222                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18223         * )     case "$strerror_r_proto" in
18224                 REENTRANT_PROTO*) ;;
18225                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18226                 esac
18227                 echo "Prototype: $try" ;;
18228         esac
18229         ;;
18230         *)      case "$usethreads" in
18231                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18232                 esac
18233                 d_strerror_r=undef
18234                 strerror_r_proto=0
18235                 ;;
18236         esac
18237         ;;
18238 *)      strerror_r_proto=0
18239         ;;
18240 esac
18241
18242 : see if strftime exists
18243 set strftime d_strftime
18244 eval $inlibc
18245
18246 : see if strlcat exists
18247 set strlcat d_strlcat
18248 eval $inlibc
18249
18250 : see if strlcpy exists
18251 set strlcpy d_strlcpy
18252 eval $inlibc
18253
18254 : see if strtod exists
18255 set strtod d_strtod
18256 eval $inlibc
18257
18258 : see if strtol exists
18259 set strtol d_strtol
18260 eval $inlibc
18261
18262 : see if strtold exists
18263 set strtold d_strtold
18264 eval $inlibc
18265
18266 : see if strtoll exists
18267 set strtoll d_strtoll
18268 eval $inlibc
18269
18270 case "$d_longlong-$d_strtoll" in
18271 "$define-$define")
18272         $cat <<EOM
18273 Checking whether your strtoll() works okay...
18274 EOM
18275         $cat >try.c <<'EOCP'
18276 #include <errno.h>
18277 #ifdef __hpux
18278 #define strtoll __strtoll
18279 #endif
18280 #ifdef __EMX__
18281 #define strtoll _strtoll
18282 #endif
18283 #include <stdio.h>
18284 extern long long int strtoll(char *s, char **, int);
18285 static int bad = 0;
18286 int check(char *s, long long ell, int een) {
18287         long long gll;
18288         errno = 0;
18289         gll = strtoll(s, 0, 10);
18290         if (!((gll == ell) && (errno == een)))
18291                 bad++;
18292 }
18293 int main() {
18294         check(" 1",                                      1LL, 0);
18295         check(" 0",                                      0LL, 0);
18296         check("-1",                                     -1LL, 0);
18297         check("-9223372036854775808", -9223372036854775808LL, 0);
18298         check("-9223372036854775808", -9223372036854775808LL, 0);
18299         check(" 9223372036854775807",  9223372036854775807LL, 0);
18300         check("-9223372036854775808", -9223372036854775808LL, 0);
18301         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18302         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18303         if (!bad)
18304                 printf("ok\n");
18305 }
18306 EOCP
18307         set try
18308         if eval $compile; then
18309                 yyy=`$run ./try`
18310                 case "$yyy" in
18311                 ok) echo "Your strtoll() seems to be working okay." ;;
18312                 *) cat <<EOM >&4
18313 Your strtoll() doesn't seem to be working okay.
18314 EOM
18315                    d_strtoll="$undef"
18316                    ;;
18317                 esac
18318         else
18319                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18320                 d_strtoll="$undef"
18321         fi
18322         ;;
18323 esac
18324
18325 : see if strtoq exists
18326 set strtoq d_strtoq
18327 eval $inlibc
18328
18329 : see if strtoul exists
18330 set strtoul d_strtoul
18331 eval $inlibc
18332
18333 case "$d_strtoul" in
18334 "$define")
18335         $cat <<EOM
18336 Checking whether your strtoul() works okay...
18337 EOM
18338         $cat >try.c <<'EOCP'
18339 #include <errno.h>
18340 #include <stdio.h>
18341 extern unsigned long int strtoul(char *s, char **, int);
18342 static int bad = 0;
18343 void check(char *s, unsigned long eul, int een) {
18344         unsigned long gul;
18345         errno = 0;
18346         gul = strtoul(s, 0, 10);
18347         if (!((gul == eul) && (errno == een)))
18348                 bad++;
18349 }
18350 int main() {
18351         check(" 1", 1L, 0);
18352         check(" 0", 0L, 0);
18353 EOCP
18354         case "$longsize" in
18355         8)
18356             $cat >>try.c <<'EOCP'
18357         check("18446744073709551615", 18446744073709551615UL, 0);
18358         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18359 #if 0 /* strtoul() for /^-/ strings is undefined. */
18360         check("-1", 18446744073709551615UL, 0);
18361         check("-18446744073709551614", 2, 0);
18362         check("-18446744073709551615", 1, 0);
18363         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18364         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18365 #endif
18366 EOCP
18367                 ;;
18368         4)
18369                     $cat >>try.c <<'EOCP'
18370         check("4294967295", 4294967295UL, 0);
18371         check("4294967296", 4294967295UL, ERANGE);
18372 #if 0 /* strtoul() for /^-/ strings is undefined. */
18373         check("-1", 4294967295UL, 0);
18374         check("-4294967294", 2, 0);
18375         check("-4294967295", 1, 0);
18376         check("-4294967296", 4294967295UL, ERANGE);
18377         check("-4294967297", 4294967295UL, ERANGE);
18378 #endif
18379 EOCP
18380                 ;;
18381         *)
18382 : Should we write these tests to be more portable by sprintf-ing
18383 : ~0 and then manipulating that char string as input for strtol?
18384                 ;;
18385         esac
18386         $cat >>try.c <<'EOCP'
18387         if (!bad)
18388                 printf("ok\n");
18389         return 0;
18390 }
18391 EOCP
18392         set try
18393         if eval $compile; then
18394                 case "`$run ./try`" in
18395                 ok) echo "Your strtoul() seems to be working okay." ;;
18396                 *) cat <<EOM >&4
18397 Your strtoul() doesn't seem to be working okay.
18398 EOM
18399                    d_strtoul="$undef"
18400                    ;;
18401                 esac
18402         else
18403                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18404                 d_strtoul="$undef"
18405         fi
18406         ;;
18407 esac
18408
18409 : see if strtoull exists
18410 set strtoull d_strtoull
18411 eval $inlibc
18412
18413 case "$d_longlong-$d_strtoull" in
18414 "$define-$define")
18415         $cat <<EOM
18416 Checking whether your strtoull() works okay...
18417 EOM
18418         $cat >try.c <<'EOCP'
18419 #include <errno.h>
18420 #ifdef __hpux
18421 #define strtoull __strtoull
18422 #endif
18423 #include <stdio.h>
18424 extern unsigned long long int strtoull(char *s, char **, int);
18425 static int bad = 0;
18426 int check(char *s, long long eull, int een) {
18427         long long gull;
18428         errno = 0;
18429         gull = strtoull(s, 0, 10);
18430         if (!((gull == eull) && (errno == een)))
18431                 bad++;
18432 }
18433 int main() {
18434         check(" 1",                                        1LL, 0);
18435         check(" 0",                                        0LL, 0);
18436         check("18446744073709551615",  18446744073709551615ULL, 0);
18437         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18438 #if 0 /* strtoull() for /^-/ strings is undefined. */
18439         check("-1",                    18446744073709551615ULL, 0);
18440         check("-18446744073709551614",                     2LL, 0);
18441         check("-18446744073709551615",                     1LL, 0);
18442         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18443         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18444 #endif
18445         if (!bad)
18446                 printf("ok\n");
18447 }
18448 EOCP
18449         set try
18450         if eval $compile; then
18451                 case "`$run ./try`" in
18452                 ok) echo "Your strtoull() seems to be working okay." ;;
18453                 *) cat <<EOM >&4
18454 Your strtoull() doesn't seem to be working okay.
18455 EOM
18456                    d_strtoull="$undef"
18457                    ;;
18458                 esac
18459         else
18460                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18461                 d_strtoull="$undef"
18462         fi
18463         ;;
18464 esac
18465
18466 : see if strtouq exists
18467 set strtouq d_strtouq
18468 eval $inlibc
18469
18470 case "$d_strtouq" in
18471 "$define")
18472         $cat <<EOM
18473 Checking whether your strtouq() works okay...
18474 EOM
18475         $cat >try.c <<'EOCP'
18476 #include <errno.h>
18477 #include <stdio.h>
18478 extern unsigned long long int strtouq(char *s, char **, int);
18479 static int bad = 0;
18480 void check(char *s, unsigned long long eull, int een) {
18481         unsigned long long gull;
18482         errno = 0;
18483         gull = strtouq(s, 0, 10);
18484         if (!((gull == eull) && (errno == een)))
18485                 bad++;
18486 }
18487 int main() {
18488         check(" 1",                                        1LL, 0);
18489         check(" 0",                                        0LL, 0);
18490         check("18446744073709551615",  18446744073709551615ULL, 0);
18491         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18492 #if 0 /* strtouq() for /^-/ strings is undefined. */
18493         check("-1",                    18446744073709551615ULL, 0);
18494         check("-18446744073709551614",                     2LL, 0);
18495         check("-18446744073709551615",                     1LL, 0);
18496         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18497         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18498 #endif
18499         if (!bad)
18500                 printf("ok\n");
18501         return 0;
18502 }
18503 EOCP
18504         set try
18505         if eval $compile; then
18506                 case "`$run ./try`" in
18507                 ok) echo "Your strtouq() seems to be working okay." ;;
18508                 *) cat <<EOM >&4
18509 Your strtouq() doesn't seem to be working okay.
18510 EOM
18511                    d_strtouq="$undef"
18512                    ;;
18513                 esac
18514         else
18515                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18516                 d_strtouq="$undef"
18517         fi
18518         ;;
18519 esac
18520
18521 : see if strxfrm exists
18522 set strxfrm d_strxfrm
18523 eval $inlibc
18524
18525 : see if symlink exists
18526 set symlink d_symlink
18527 eval $inlibc
18528
18529 : see if syscall exists
18530 set syscall d_syscall
18531 eval $inlibc
18532
18533 : see if prototype for syscall is available
18534 echo " "
18535 set d_syscallproto syscall $i_unistd unistd.h
18536 eval $hasproto
18537
18538 : see if sysconf exists
18539 set sysconf d_sysconf
18540 eval $inlibc
18541
18542 : see if system exists
18543 set system d_system
18544 eval $inlibc
18545
18546 : see if tcgetpgrp exists
18547 set tcgetpgrp d_tcgetpgrp
18548 eval $inlibc
18549
18550 : see if tcsetpgrp exists
18551 set tcsetpgrp d_tcsetpgrp
18552 eval $inlibc
18553
18554 : see if prototype for telldir is available
18555 echo " "
18556 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18557 eval $hasproto
18558
18559 : see if time exists
18560 echo " "
18561 if test "X$d_time" = X -o X"$timetype" = X; then
18562     if set time val -f d_time; eval $csym; $val; then
18563                 echo 'time() found.' >&4
18564                 val="$define"
18565                 rp="What is the type returned by time() on this system?"
18566                 set time_t timetype long stdio.h sys/types.h
18567                 eval $typedef_ask
18568     else
18569                 echo 'time() not found, hope that will do.' >&4
18570                 val="$undef"
18571                 timetype='int';
18572     fi
18573     set d_time
18574     eval $setvar
18575 fi
18576
18577 : see if timegm exists
18578 set timegm d_timegm
18579 eval $inlibc
18580
18581 : see if this is a sys/times.h system
18582 set sys/times.h i_systimes
18583 eval $inhdr
18584
18585 : see if times exists
18586 echo " "
18587 if set times val -f d_times; eval $csym; $val; then
18588         echo 'times() found.' >&4
18589         d_times="$define"
18590         inc=''
18591         case "$i_systimes" in
18592         "$define") inc='sys/times.h';;
18593         esac
18594         rp="What is the type returned by times() on this system?"
18595         set clock_t clocktype long stdio.h sys/types.h $inc
18596         eval $typedef_ask
18597 else
18598         echo 'times() NOT found, hope that will do.' >&4
18599         d_times="$undef"
18600         clocktype='int'
18601 fi
18602
18603 : see if tmpnam_r exists
18604 set tmpnam_r d_tmpnam_r
18605 eval $inlibc
18606 case "$d_tmpnam_r" in
18607 "$define")
18608         hdrs="$i_systypes sys/types.h define stdio.h "
18609         case "$d_tmpnam_r_proto:$usethreads" in
18610         ":define")      d_tmpnam_r_proto=define
18611                 set d_tmpnam_r_proto tmpnam_r $hdrs
18612                 eval $hasproto ;;
18613         *)      ;;
18614         esac
18615         case "$d_tmpnam_r_proto" in
18616         define)
18617         case "$tmpnam_r_proto" in
18618         ''|0) try='char* tmpnam_r(char*);'
18619         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18620         esac
18621         case "$tmpnam_r_proto" in
18622         ''|0)   d_tmpnam_r=undef
18623                 tmpnam_r_proto=0
18624                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18625         * )     case "$tmpnam_r_proto" in
18626                 REENTRANT_PROTO*) ;;
18627                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18628                 esac
18629                 echo "Prototype: $try" ;;
18630         esac
18631         ;;
18632         *)      case "$usethreads" in
18633                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18634                 esac
18635                 d_tmpnam_r=undef
18636                 tmpnam_r_proto=0
18637                 ;;
18638         esac
18639         ;;
18640 *)      tmpnam_r_proto=0
18641         ;;
18642 esac
18643
18644 : see if truncate exists
18645 set truncate d_truncate
18646 eval $inlibc
18647
18648 : see if ttyname_r exists
18649 set ttyname_r d_ttyname_r
18650 eval $inlibc
18651 case "$d_ttyname_r" in
18652 "$define")
18653         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18654         case "$d_ttyname_r_proto:$usethreads" in
18655         ":define")      d_ttyname_r_proto=define
18656                 set d_ttyname_r_proto ttyname_r $hdrs
18657                 eval $hasproto ;;
18658         *)      ;;
18659         esac
18660         case "$d_ttyname_r_proto" in
18661         define)
18662         case "$ttyname_r_proto" in
18663         ''|0) try='int ttyname_r(int, char*, size_t);'
18664         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18665         esac
18666         case "$ttyname_r_proto" in
18667         ''|0) try='int ttyname_r(int, char*, int);'
18668         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18669         esac
18670         case "$ttyname_r_proto" in
18671         ''|0) try='char* ttyname_r(int, char*, int);'
18672         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18673         esac
18674         case "$ttyname_r_proto" in
18675         ''|0)   d_ttyname_r=undef
18676                 ttyname_r_proto=0
18677                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18678         * )     case "$ttyname_r_proto" in
18679                 REENTRANT_PROTO*) ;;
18680                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18681                 esac
18682                 echo "Prototype: $try" ;;
18683         esac
18684         ;;
18685         *)      case "$usethreads" in
18686                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18687                 esac
18688                 d_ttyname_r=undef
18689                 ttyname_r_proto=0
18690                 ;;
18691         esac
18692         ;;
18693 *)      ttyname_r_proto=0
18694         ;;
18695 esac
18696
18697 : see if tzname[] exists
18698 echo " "
18699 if set tzname val -a d_tzname; eval $csym; $val; then
18700         val="$define"
18701         echo 'tzname[] found.' >&4
18702 else
18703         val="$undef"
18704         echo 'tzname[] NOT found.' >&4
18705 fi
18706 set d_tzname
18707 eval $setvar
18708
18709 : Check if is a multiplatform env
18710 case "$osname" in
18711 next|rhapsody|darwin) multiarch="$define" ;;
18712 esac
18713 case "$multiarch" in
18714 ''|[nN]*) multiarch="$undef" ;;
18715 esac
18716
18717 : check for ordering of bytes in a UV
18718 echo " "
18719 case "$usecrosscompile$multiarch" in
18720 *$define*)
18721         $cat <<EOM
18722 You seem to be either cross-compiling or doing a multiarchitecture build,
18723 skipping the byteorder check.
18724
18725 EOM
18726         byteorder='ffff'
18727         ;;
18728 *)
18729         case "$byteorder" in
18730         '')
18731                 $cat <<'EOM'
18732 In the following, larger digits indicate more significance.  A big-endian
18733 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18734 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18735 machines may have weird orders like 3412.  A Cray will report 87654321,
18736 an Alpha will report 12345678. If the test program works the default is
18737 probably right.
18738 I'm now running the test program...
18739 EOM
18740                 $cat >try.c <<EOCP
18741 #include <stdio.h>
18742 #$i_stdlib I_STDLIB
18743 #ifdef I_STDLIB
18744 #include <stdlib.h>
18745 #endif
18746 #include <sys/types.h>
18747 typedef $uvtype UV;
18748 int main()
18749 {
18750         int i;
18751         union {
18752                 UV l;
18753                 char c[$uvsize];
18754         } u;
18755
18756         if ($uvsize > 4)
18757                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18758         else
18759                 u.l = (UV)0x04030201;
18760         for (i = 0; i < $uvsize; i++)
18761                 printf("%c", u.c[i]+'0');
18762         printf("\n");
18763         exit(0);
18764 }
18765 EOCP
18766                 xxx_prompt=y
18767                 set try
18768                 if eval $compile && $run ./try > /dev/null; then
18769                         dflt=`$run ./try`
18770                         case "$dflt" in
18771                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18772                                 echo "(The test program ran ok.)"
18773                                 echo "byteorder=$dflt"
18774                                 xxx_prompt=n
18775                         ;;
18776                         ????|????????) echo "(The test program ran ok.)" ;;
18777                         *) echo "(The test program didn't run right for some reason.)" ;;
18778                         esac
18779                 else
18780                         dflt='4321'
18781                         cat <<'EOM'
18782 (I can't seem to compile the test program.  Guessing big-endian...)
18783 EOM
18784                 fi
18785                 case "$xxx_prompt" in
18786                 y)
18787                         rp="What is the order of bytes in $uvtype?"
18788                         . ./myread
18789                         byteorder="$ans"
18790                         ;;
18791                 *)      byteorder=$dflt
18792                         ;;
18793                 esac
18794                 ;;
18795         esac
18796         $rm_try
18797         ;;
18798 esac
18799
18800 : Checking 32bit alignedness
18801 $cat <<EOM
18802
18803 Checking to see whether you can access character data unalignedly...
18804 EOM
18805 case "$d_u32align" in
18806 '')   $cat >try.c <<EOCP
18807 #include <stdio.h>
18808 #$i_stdlib I_STDLIB
18809 #ifdef I_STDLIB
18810 #include <stdlib.h>
18811 #endif
18812 #define U32 $u32type
18813 #define BYTEORDER 0x$byteorder
18814 #define U8 $u8type
18815 #include <signal.h>
18816 #ifdef SIGBUS
18817 $signal_t bletch(int s) { exit(4); }
18818 #endif
18819 int main() {
18820 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18821     volatile U8 buf[8];
18822     volatile U32 *up;
18823     int i;
18824
18825     if (sizeof(U32) != 4) {
18826         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18827         exit(1);
18828     }
18829
18830     fflush(stdout);
18831
18832 #ifdef SIGBUS
18833     signal(SIGBUS, bletch);
18834 #endif
18835
18836     buf[0] = 0;
18837     buf[1] = 0;
18838     buf[2] = 0;
18839     buf[3] = 1;
18840     buf[4] = 0;
18841     buf[5] = 0;
18842     buf[6] = 0;
18843     buf[7] = 1;
18844
18845     for (i = 0; i < 4; i++) {
18846         up = (U32*)(buf + i);
18847         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18848                (*up == 1 << (8*(3-i)))  /* little-endian */
18849               )
18850            )
18851         {
18852             printf("read failed (%x)\n", *up);
18853             exit(2);
18854         }
18855     }
18856
18857     /* write test */
18858     for (i = 0; i < 4; i++) {
18859         up = (U32*)(buf + i);
18860         *up = 0xBeef;
18861         if (*up != 0xBeef) {
18862             printf("write failed (%x)\n", *up);
18863             exit(3);
18864         }
18865     }
18866
18867     exit(0);
18868 #else
18869     printf("1\n");
18870     exit(1);
18871 #endif
18872     return 0;
18873 }
18874 EOCP
18875 set try
18876 if eval $compile_ok; then
18877         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18878         $run ./try 2>&1 >/dev/null
18879         case "$?" in
18880         0)      cat >&4 <<EOM
18881 You can access character data pretty unalignedly.
18882 EOM
18883                 d_u32align="$undef"
18884                 ;;
18885         *)      cat >&4 <<EOM
18886 It seems that you must access character data in an aligned manner.
18887 EOM
18888                 d_u32align="$define"
18889                 ;;
18890         esac
18891 else
18892         rp='Can you access character data at unaligned addresses?'
18893         dflt='n'
18894         . ./myread
18895         case "$ans" in
18896         [yY]*)  d_u32align="$undef"  ;;
18897         *)      d_u32align="$define" ;;
18898         esac
18899 fi
18900 $rm_try
18901 ;;
18902 esac
18903
18904 : see if ualarm exists
18905 set ualarm d_ualarm
18906 eval $inlibc
18907
18908 : see if umask exists
18909 set umask d_umask
18910 eval $inlibc
18911
18912 : see if unordered exists
18913 set unordered d_unordered
18914 eval $inlibc
18915
18916 : see if unsetenv exists
18917 set unsetenv d_unsetenv
18918 eval $inlibc
18919
18920 : see if usleep exists
18921 set usleep d_usleep
18922 eval $inlibc
18923
18924 : see if prototype for usleep is available
18925 echo " "
18926 set d_usleepproto usleep $i_unistd unistd.h
18927 eval $hasproto
18928
18929 : see if ustat exists
18930 set ustat d_ustat
18931 eval $inlibc
18932
18933 : see if closedir exists
18934 set closedir d_closedir
18935 eval $inlibc
18936
18937 case "$d_closedir" in
18938 "$define")
18939         echo " "
18940         echo "Checking whether closedir() returns a status..." >&4
18941         cat > try.c <<EOM
18942 #$i_dirent I_DIRENT             /**/
18943 #$i_sysdir I_SYS_DIR            /**/
18944 #$i_sysndir I_SYS_NDIR          /**/
18945 #$i_systypes I_SYS_TYPES        /**/
18946
18947 #if defined(I_SYS_TYPES)
18948 #include <sys/types.h>
18949 #endif
18950 #if defined(I_DIRENT)
18951 #include <dirent.h>
18952 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18953 #include <sys/dir.h>
18954 #endif
18955 #else
18956 #ifdef I_SYS_NDIR
18957 #include <sys/ndir.h>
18958 #else
18959 #ifdef I_SYS_DIR
18960 #ifdef hp9000s500
18961 #include <ndir.h>       /* may be wrong in the future */
18962 #else
18963 #include <sys/dir.h>
18964 #endif
18965 #endif
18966 #endif
18967 #endif
18968 int main() { return closedir(opendir(".")); }
18969 EOM
18970         set try
18971         if eval $compile_ok; then
18972                 if $run ./try > /dev/null 2>&1 ; then
18973                         echo "Yes, it does."
18974                         val="$undef"
18975                 else
18976                         echo "No, it doesn't."
18977                         val="$define"
18978                 fi
18979         else
18980                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18981                 val="$define"
18982         fi
18983         ;;
18984 *)
18985         val="$undef";
18986         ;;
18987 esac
18988 set d_void_closedir
18989 eval $setvar
18990 $rm_try
18991
18992 : see if there is a wait4
18993 set wait4 d_wait4
18994 eval $inlibc
18995
18996 : see if waitpid exists
18997 set waitpid d_waitpid
18998 eval $inlibc
18999
19000 : see if wcstombs exists
19001 set wcstombs d_wcstombs
19002 eval $inlibc
19003
19004 : see if wctomb exists
19005 set wctomb d_wctomb
19006 eval $inlibc
19007
19008 : see if writev exists
19009 set writev d_writev
19010 eval $inlibc
19011
19012 : preserve RCS keywords in files with variable substitution, grrr
19013 Date='$Date'
19014 Id='$Id'
19015 Log='$Log'
19016 RCSfile='$RCSfile'
19017 Revision='$Revision'
19018
19019 : check for alignment requirements
19020 echo " "
19021 case "$usecrosscompile" in
19022 *$define*)
19023         $cat <<EOM
19024 You seem to be cross-compiling.  Skipping the memory alignment check.
19025
19026 EOM
19027         case "$alignbytes" in
19028         '') alignbytes=8 ;;
19029         esac
19030         ;;
19031 *)
19032         case "$alignbytes" in
19033         '') echo "Checking alignment constraints..." >&4
19034                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
19035                         $cat >try.c <<'EOCP'
19036 typedef long double NV;
19037 EOCP
19038                 else
19039                         $cat >try.c <<'EOCP'
19040 typedef double NV;
19041 EOCP
19042                 fi
19043                 $cat >>try.c <<'EOCP'
19044 #include <stdio.h>
19045 struct foobar {
19046         char foo;
19047         NV bar;
19048 } try_algn;
19049 int main()
19050 {
19051     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19052     return(0);
19053 }
19054 EOCP
19055                 set try
19056                 if eval $compile_ok; then
19057                         dflt=`$run ./try`
19058                 else
19059                         dflt='8'
19060                         echo "(I can't seem to compile the test program...)"
19061                 fi
19062                 case "$multiarch" in
19063                 *$define*)
19064                         : The usual safe value is 8, but Darwin with -Duselongdouble
19065                         : needs 16.  Hence, we will take 8 as a minimum, but allow
19066                         : Configure to pick a larger value if needed.
19067                         if $test "$dflt" -lt 8; then
19068                             dflt='8'
19069                                 echo "Setting alignment to 8 for multiarch support.">&4
19070                         fi
19071                         ;;
19072                 esac
19073                 ;;
19074         *) dflt="$alignbytes"
19075                 ;;
19076         esac
19077         rp="Doubles must be aligned on a how-many-byte boundary?"
19078         . ./myread
19079         alignbytes="$ans"
19080         $rm_try
19081         ;;
19082 esac
19083
19084
19085 : set the base revision
19086 baserev=5.0
19087
19088 : length of character in bytes. Is always 1, otherwise it isnt C
19089 : This used to be a test using sizeof
19090 charsize=1
19091
19092 : Check for the number of bits in a character
19093 case "$charbits" in
19094 '')     echo "Checking how long a character is (in bits)..." >&4
19095         $cat >try.c <<EOCP
19096 #include <stdio.h>
19097 int main ()
19098 {
19099     int n;
19100     unsigned char c;
19101     for (c = 1, n = 0; c; c <<= 1, n++) ;
19102     printf ("%d\n", n);
19103     return (0);
19104     }
19105 EOCP
19106         set try
19107         if eval $compile_ok; then
19108                 dflt=`$run ./try`
19109         else
19110                 dflt='8'
19111                 echo "(I can't seem to compile the test program.  Guessing...)"
19112         fi
19113         ;;
19114 *)
19115         dflt="$charbits"
19116         ;;
19117 esac
19118 rp="What is the length of a character (in bits)?"
19119 . ./myread
19120 charbits="$ans"
19121 $rm_try
19122 case "$charbits" in
19123 8)      ;;
19124 *)      cat >&4 << EOM
19125 Your system has an unsigned character size of $charbits bits, which
19126 is rather unusual (normally it is 8 bits).  Perl likely will not work
19127 correctly on your system, with subtle bugs in various places.
19128 EOM
19129         rp='Do you really want to continue?'
19130         dflt='n'
19131         . ./myread
19132         case "$ans" in
19133                 [yY])   echo >&4 "Okay, continuing."    ;;
19134                 *)      exit 1                          ;;
19135         esac
19136 esac
19137
19138 : how do we concatenate cpp tokens here?
19139 echo " "
19140 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19141 $cat >cpp_stuff.c <<'EOCP'
19142 #define RCAT(a,b)a/**/b
19143 #define ACAT(a,b)a ## b
19144 RCAT(Rei,ser)
19145 ACAT(Cir,cus)
19146 EOCP
19147 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19148 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19149         echo "Oh!  Smells like ANSI's been here." >&4
19150         echo "We can catify or stringify, separately or together!"
19151         cpp_stuff=42
19152 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19153         echo "Ah, yes!  The good old days!" >&4
19154         echo "However, in the good old days we don't know how to stringify and"
19155         echo "catify at the same time."
19156         cpp_stuff=1
19157 else
19158         $cat >&4 <<EOM
19159 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19160 You're going to have to edit the values of CAT[2-5] in config.h...
19161 EOM
19162         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19163 fi
19164 $rm -f cpp_stuff.*
19165
19166 : see if this is a db.h system
19167 set db.h i_db
19168 eval $inhdr
19169
19170 case "$i_db" in
19171 $define)
19172         : Check db version.
19173         echo " "
19174         echo "Checking Berkeley DB version ..." >&4
19175         $cat >try.c <<EOCP
19176 #$d_const HASCONST
19177 #ifndef HASCONST
19178 #define const
19179 #endif
19180 #include <sys/types.h>
19181 #include <stdio.h>
19182 #$i_stdlib I_STDLIB
19183 #ifdef I_STDLIB
19184 #include <stdlib.h>
19185 #endif
19186 #include <db.h>
19187 int main(int argc, char *argv[])
19188 {
19189 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19190     int Major, Minor, Patch ;
19191     unsigned long Version ;
19192     (void)db_version(&Major, &Minor, &Patch) ;
19193     if (argc == 2) {
19194         printf("%d %d %d %d %d %d\n",
19195                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19196                Major, Minor, Patch);
19197         exit(0);
19198     }
19199     printf("You have Berkeley DB Version 2 or greater.\n");
19200
19201     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19202                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19203     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19204                 Major, Minor, Patch) ;
19205
19206     /* check that db.h & libdb are compatible */
19207     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19208         printf("db.h and libdb are incompatible.\n") ;
19209         exit(3);
19210     }
19211
19212     printf("db.h and libdb are compatible.\n") ;
19213
19214     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19215                 + DB_VERSION_PATCH ;
19216
19217     /* needs to be >= 2.3.4 */
19218     if (Version < 2003004) {
19219     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19220         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19221         exit(2);
19222     }
19223
19224     exit(0);
19225 #else
19226 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19227     if (argc == 2) {
19228         printf("1 0 0\n");
19229         exit(0);
19230     }
19231     printf("You have Berkeley DB Version 1.\n");
19232     exit(0);    /* DB version < 2: the coast is clear. */
19233 #else
19234     exit(1);    /* <db.h> not Berkeley DB? */
19235 #endif
19236 #endif
19237 }
19238 EOCP
19239         set try
19240         if eval $compile_ok && $run ./try; then
19241                 echo 'Looks OK.' >&4
19242                 set `$run ./try 1`
19243                 db_version_major=$1
19244                 db_version_minor=$2
19245                 db_version_patch=$3
19246         else
19247                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19248                 i_db=$undef
19249                 case " $libs " in
19250                 *"-ldb "*)
19251                         : Remove db from list of libraries to use
19252                         echo "Removing unusable -ldb from library list" >&4
19253                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19254                         shift
19255                         libs="$*"
19256                         echo "libs = $libs" >&4
19257                         ;;
19258                 esac
19259         fi
19260         $rm_try
19261         ;;
19262 esac
19263
19264 case "$i_db" in
19265 define)
19266         : Check the return type needed for hash
19267         echo " "
19268         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19269         $cat >try.c <<EOCP
19270 #$d_const HASCONST
19271 #ifndef HASCONST
19272 #define const
19273 #endif
19274 #include <sys/types.h>
19275 #include <db.h>
19276
19277 #ifndef DB_VERSION_MAJOR
19278 u_int32_t hash_cb (ptr, size)
19279 const void *ptr;
19280 size_t size;
19281 {
19282 }
19283 HASHINFO info;
19284 int main()
19285 {
19286         info.hash = hash_cb;
19287 }
19288 #endif
19289 EOCP
19290         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19291                 if $contains warning try.out >>/dev/null 2>&1 ; then
19292                         db_hashtype='int'
19293                 else
19294                         db_hashtype='u_int32_t'
19295                 fi
19296         else
19297                 : XXX Maybe we should just give up here.
19298                 db_hashtype=u_int32_t
19299                 $cat try.out >&4
19300                 echo "Help:  I can't seem to compile the db test program." >&4
19301                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19302         fi
19303         $rm_try
19304         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19305         ;;
19306 *)      db_hashtype=u_int32_t
19307         ;;
19308 esac
19309 case "$i_db" in
19310 define)
19311         : Check the return type needed for prefix
19312         echo " "
19313         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19314         cat >try.c <<EOCP
19315 #$d_const HASCONST
19316 #ifndef HASCONST
19317 #define const
19318 #endif
19319 #include <sys/types.h>
19320 #include <db.h>
19321
19322 #ifndef DB_VERSION_MAJOR
19323 size_t prefix_cb (key1, key2)
19324 const DBT *key1;
19325 const DBT *key2;
19326 {
19327 }
19328 BTREEINFO info;
19329 int main()
19330 {
19331         info.prefix = prefix_cb;
19332 }
19333 #endif
19334 EOCP
19335         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19336                 if $contains warning try.out >>/dev/null 2>&1 ; then
19337                         db_prefixtype='int'
19338                 else
19339                         db_prefixtype='size_t'
19340                 fi
19341         else
19342                 db_prefixtype='size_t'
19343                 : XXX Maybe we should just give up here.
19344                 $cat try.out >&4
19345                 echo "Help:  I can't seem to compile the db test program." >&4
19346                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19347         fi
19348         $rm_try
19349         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19350         ;;
19351 *)      db_prefixtype='size_t'
19352         ;;
19353 esac
19354
19355 : How can we generate normalized random numbers ?
19356 echo " "
19357 echo "Looking for a random number function..." >&4
19358 case "$randfunc" in
19359 '')
19360         if set drand48 val -f; eval $csym; $val; then
19361                 dflt="drand48"
19362                 echo "Good, found drand48()." >&4
19363         elif set random val -f; eval $csym; $val; then
19364                 dflt="random"
19365                 echo "OK, found random()." >&4
19366         else
19367                 dflt="rand"
19368                 echo "Yick, looks like I have to use rand()." >&4
19369         fi
19370         echo " "
19371         ;;
19372 *)
19373         dflt="$randfunc"
19374         ;;
19375 esac
19376 cont=true
19377
19378 case "$ccflags" in
19379 *-Dmy_rand=*|*-Dmy_srand=*)
19380         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19381         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19382         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19383         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19384         ;;
19385 esac
19386
19387 while $test "$cont"; do
19388         rp="Use which function to generate random numbers?"
19389         . ./myread
19390         if $test "$ans" = "$dflt"; then
19391                 : null
19392         else
19393                 randbits=''
19394         fi
19395         randfunc="$ans"
19396         if set $ans val -f; eval $csym; $val; then
19397                 cont=''
19398         else
19399                 dflt=y
19400                 rp="I cannot find function $ans. Use that name anyway?"
19401                 . ./myread
19402                 dflt=rand
19403                 case "$ans" in
19404                         [yY]*) cont='';;
19405                 esac
19406         fi
19407         case "$cont" in
19408         '')
19409                 case "$randfunc" in
19410                 drand48)
19411                         drand01="drand48()"
19412                         seedfunc="srand48"
19413                         randbits=48
19414                         randseedtype=long
19415                         ;;
19416                 rand|random)
19417                         case "$randbits" in
19418                         '')
19419 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19420                                 $cat >try.c <<EOCP
19421 #$i_unistd I_UNISTD
19422 #$i_stdlib I_STDLIB
19423 #include <stdio.h>
19424 #ifdef I_UNISTD
19425 #  include <unistd.h>
19426 #endif
19427 #ifdef I_STDLIB
19428 #  include <stdlib.h>
19429 #endif
19430 int main()
19431 {
19432         register int i;
19433         register unsigned long tmp;
19434         register unsigned long max = 0L;
19435
19436         for (i = 1000; i; i--) {
19437                 tmp = (unsigned long) $randfunc();
19438                 if (tmp > max) max = tmp;
19439         }
19440         for (i = 0; max; i++)
19441                 max /= 2;
19442         printf("%d\n",i);
19443 }
19444 EOCP
19445                                 set try
19446                                 if eval $compile_ok; then
19447                                         dflt=`try`
19448                                 else
19449                                         dflt='?'
19450                                         echo "(I can't seem to compile the test program...)"
19451                                 fi
19452                                 ;;
19453                         *)
19454                                 dflt="$randbits"
19455                                 ;;
19456                         esac
19457                         rp="How many bits does your $randfunc() function produce?"
19458                         . ./myread
19459                         randbits="$ans"
19460                         $rm_try
19461                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19462                         seedfunc="s$randfunc"
19463                         randseedtype=unsigned
19464                         ;;
19465                 *)
19466                         dflt="31"
19467                         rp="How many bits does your $randfunc() function produce?"
19468                         . ./myread
19469                         randbits="$ans"
19470                         seedfunc="s$randfunc"
19471                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19472                         if set $seedfunc val -f; eval $csym; $val; then
19473                                 echo "(Using $seedfunc() to seed random generator)"
19474                         else
19475                                 echo "(Warning: no $seedfunc() to seed random generator)"
19476                                 seedfunc=rand
19477                         fi
19478                         randseedtype=unsigned
19479                         ;;
19480                 esac
19481                 ;;
19482         esac
19483 done
19484
19485 : Determine if this is an EBCDIC system
19486 echo " "
19487 echo "Determining whether or not we are on an EBCDIC system..." >&4
19488 $cat >try.c <<'EOM'
19489 int main()
19490 {
19491   if ('M'==0xd4) return 0;
19492   return 1;
19493 }
19494 EOM
19495
19496 val=$undef
19497 set try
19498 if eval $compile_ok; then
19499         if $run ./try; then
19500                 echo "You seem to speak EBCDIC." >&4
19501                 val="$define"
19502         else
19503                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19504         fi
19505 else
19506         echo "I'm unable to compile the test program." >&4
19507         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19508 fi
19509 $rm_try
19510 set ebcdic
19511 eval $setvar
19512
19513 : Check how to flush
19514 echo " "
19515 $cat >&4 <<EOM
19516 Checking how to flush all pending stdio output...
19517 EOM
19518 # I only know how to find the first 32 possibly open files on SunOS.
19519 # See also hints/sunos_4_1.sh and util.c  --AD
19520 case "$osname" in
19521 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19522 esac
19523 $cat >>try.c <<EOCP
19524 #include <stdio.h>
19525 #$i_stdlib I_STDLIB
19526 #ifdef I_STDLIB
19527 #include <stdlib.h>
19528 #endif
19529 #$i_unistd I_UNISTD
19530 #ifdef I_UNISTD
19531 # include <unistd.h>
19532 #endif
19533 #$d_sysconf HAS_SYSCONF
19534 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19535 #ifdef HAS_STDIO_STREAM_ARRAY
19536 # define STDIO_STREAM_ARRAY $stdio_stream_array
19537 #endif
19538 int main() {
19539   FILE* p;
19540   unlink("try.out");
19541   p = fopen("try.out", "w");
19542 #ifdef TRY_FPUTC
19543   fputc('x', p);
19544 #else
19545 # ifdef TRY_FPRINTF
19546   fprintf(p, "x");
19547 # endif
19548 #endif
19549 #ifdef TRY_FFLUSH_NULL
19550   fflush(NULL);
19551 #endif
19552 #ifdef TRY_FFLUSH_ALL
19553   {
19554     long open_max = -1;
19555 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19556     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19557 # else
19558 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19559     open_max = sysconf(_SC_OPEN_MAX);
19560 #  else
19561 #   ifdef FOPEN_MAX
19562     open_max = FOPEN_MAX;
19563 #   else
19564 #    ifdef OPEN_MAX
19565     open_max = OPEN_MAX;
19566 #    else
19567 #     ifdef _NFILE
19568     open_max = _NFILE;
19569 #     endif
19570 #    endif
19571 #   endif
19572 #  endif
19573 # endif
19574 # ifdef HAS_STDIO_STREAM_ARRAY
19575     if (open_max > 0) {
19576       long i;
19577       for (i = 0; i < open_max; i++)
19578             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19579                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19580                 STDIO_STREAM_ARRAY[i]._flag)
19581                 fflush(&STDIO_STREAM_ARRAY[i]);
19582     }
19583   }
19584 # endif
19585 #endif
19586   _exit(42);
19587 }
19588 EOCP
19589 : first we have to find out how _not_ to flush
19590 $to try.c
19591 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19592     output=''
19593     set try -DTRY_FPUTC
19594     if eval $compile; then
19595             $run ./try 2>/dev/null
19596             code="$?"
19597             $from try.out
19598             if $test ! -s try.out -a "X$code" = X42; then
19599                 output=-DTRY_FPUTC
19600             fi
19601     fi
19602     case "$output" in
19603     '')
19604             set try -DTRY_FPRINTF
19605             if eval $compile; then
19606                     $run ./try 2>/dev/null
19607                     code="$?"
19608                     $from try.out
19609                     if $test ! -s try.out -a "X$code" = X42; then
19610                         output=-DTRY_FPRINTF
19611                     fi
19612             fi
19613         ;;
19614     esac
19615 fi
19616 : check for fflush NULL behaviour
19617 case "$fflushNULL" in
19618 '')     set try -DTRY_FFLUSH_NULL $output
19619         if eval $compile; then
19620                 $run ./try 2>/dev/null
19621                 code="$?"
19622                 $from try.out
19623                 if $test -s try.out -a "X$code" = X42; then
19624                         fflushNULL="`$cat try.out`"
19625                 else
19626                         if $test "X$code" != X42; then
19627                                 $cat >&4 <<EOM
19628 (If this test failed, don't worry, we'll try another method shortly.)
19629 EOM
19630                         fi
19631                 fi
19632         fi
19633         $rm -f core try.core core.try.*
19634         case "$fflushNULL" in
19635         x)      $cat >&4 <<EOM
19636 Your fflush(NULL) works okay for output streams.
19637 Let's see if it clobbers input pipes...
19638 EOM
19639 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19640 # bug that improperly flushes the input end of pipes.  So we avoid the
19641 # autoflush on fork/system/exec support for now. :-(
19642 $cat >tryp.c <<EOCP
19643 #include <stdio.h>
19644 int
19645 main(int argc, char **argv)
19646 {
19647     char buf[1024];
19648     int i;
19649     char *bp = buf;
19650     while (1) {
19651         while ((i = getc(stdin)) != -1
19652                && (*bp++ = i) != '\n'
19653                && bp < &buf[1024])
19654         /* DO NOTHING */ ;
19655         *bp = '\0';
19656         fprintf(stdout, "%s", buf);
19657         fflush(NULL);
19658         if (i == -1)
19659             return 0;
19660         bp = buf;
19661     }
19662 }
19663 EOCP
19664                 fflushNULL="$define"
19665                 set tryp
19666                 if eval $compile; then
19667                     $rm -f tryp.out
19668                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19669                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19670                        $cat >&4 <<EOM
19671 fflush(NULL) seems to behave okay with input streams.
19672 EOM
19673                         fflushNULL="$define"
19674                     else
19675                         $cat >&4 <<EOM
19676 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19677 EOM
19678                         fflushNULL="$undef"
19679                     fi
19680                 fi
19681                 $rm -f core tryp.c tryp.core core.tryp.*
19682                 ;;
19683         '')     $cat >&4 <<EOM
19684 Your fflush(NULL) isn't working (contrary to ANSI C).
19685 EOM
19686                 fflushNULL="$undef"
19687                 ;;
19688         *)      $cat >&4 <<EOM
19689 Cannot figure out whether your fflush(NULL) works or not.
19690 I'm assuming it doesn't (contrary to ANSI C).
19691 EOM
19692                 fflushNULL="$undef"
19693                 ;;
19694         esac
19695         ;;
19696 $define|true|[yY]*)
19697         fflushNULL="$define"
19698         ;;
19699 *)
19700         fflushNULL="$undef"
19701         ;;
19702 esac
19703 : check explicit looping only if NULL did not work, and if the pipe
19704 : bug does not show up on an explicit flush too
19705 case "$fflushNULL" in
19706 "$undef")
19707         $cat >tryp.c <<EOCP
19708 #include <stdio.h>
19709 int
19710 main(int argc, char **argv)
19711 {
19712     char buf[1024];
19713     int i;
19714     char *bp = buf;
19715     while (1) {
19716         while ((i = getc(stdin)) != -1
19717                && (*bp++ = i) != '\n'
19718                && bp < &buf[1024])
19719         /* DO NOTHING */ ;
19720         *bp = '\0';
19721         fprintf(stdout, "%s", buf);
19722         fflush(stdin);
19723         if (i == -1)
19724             return 0;
19725         bp = buf;
19726     }
19727 }
19728 EOCP
19729         set tryp
19730         if eval $compile; then
19731             $rm -f tryp.out
19732             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19733             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19734                $cat >&4 <<EOM
19735 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19736 EOM
19737                 : now check for fflushall behaviour
19738                 case "$fflushall" in
19739                 '')     set try -DTRY_FFLUSH_ALL $output
19740                         if eval $compile; then
19741                                 $cat >&4 <<EOM
19742 (Now testing the other method--but note that this also may fail.)
19743 EOM
19744                                 $run ./try 2>/dev/null
19745                                 code=$?
19746                                 $from try.out
19747                                 if $test -s try.out -a "X$code" = X42; then
19748                                         fflushall="`$cat try.out`"
19749                                 fi
19750                         fi
19751                         $rm_try
19752                         case "$fflushall" in
19753                         x)      $cat >&4 <<EOM
19754 Whew. Flushing explicitly all the stdio streams works.
19755 EOM
19756                                 fflushall="$define"
19757                                 ;;
19758                         '')     $cat >&4 <<EOM
19759 Sigh. Flushing explicitly all the stdio streams doesn't work.
19760 EOM
19761                                 fflushall="$undef"
19762                                 ;;
19763                         *)      $cat >&4 <<EOM
19764 Cannot figure out whether flushing stdio streams explicitly works or not.
19765 I'm assuming it doesn't.
19766 EOM
19767                                 fflushall="$undef"
19768                                 ;;
19769                         esac
19770                         ;;
19771                 "$define"|true|[yY]*)
19772                         fflushall="$define"
19773                         ;;
19774                 *)
19775                         fflushall="$undef"
19776                         ;;
19777                 esac
19778             else
19779                 $cat >&4 <<EOM
19780 All is futile.  Even fflush(stdin) clobbers input pipes!
19781 EOM
19782                 fflushall="$undef"
19783             fi
19784         else
19785             fflushall="$undef"
19786         fi
19787         $rm -f core tryp.c tryp.core core.tryp.*
19788         ;;
19789 *)      fflushall="$undef"
19790         ;;
19791 esac
19792
19793 case "$fflushNULL$fflushall" in
19794 undefundef)
19795         $cat <<EOM
19796 OK, I give up.  I cannot figure out how to flush pending stdio output.
19797 We won't be flushing handles at all before fork/exec/popen.
19798 EOM
19799         ;;
19800 esac
19801 $rm_try tryp
19802
19803 : Store the full pathname to the ar program for use in the C program
19804 : Respect a hint or command line value for full_ar.
19805 case "$full_ar" in
19806 '') full_ar=$ar ;;
19807 esac
19808
19809 : Store the full pathname to the sed program for use in the C program
19810 full_sed=$sed
19811
19812 : see what type gids are declared as in the kernel
19813 echo " "
19814 echo "Looking for the type for group ids returned by getgid()."
19815 set gid_t gidtype xxx stdio.h sys/types.h
19816 eval $typedef
19817 case "$gidtype" in
19818 xxx)
19819         xxx=`./findhdr sys/user.h`
19820         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19821         case $1 in
19822         unsigned) dflt="$1 $2" ;;
19823         *) dflt="$1" ;;
19824         esac
19825         ;;
19826 *) dflt="$gidtype";;
19827 esac
19828 case "$gidtype" in
19829 gid_t) echo "gid_t found." ;;
19830 *)      rp="What is the type for group ids returned by getgid()?"
19831         . ./myread
19832         gidtype="$ans"
19833         ;;
19834 esac
19835
19836 : Check the size of GID
19837 echo " "
19838 case "$gidtype" in
19839 *_t) zzz="$gidtype"     ;;
19840 *)   zzz="gid"          ;;
19841 esac
19842 echo "Checking the size of $zzz..." >&4
19843 cat > try.c <<EOCP
19844 #include <sys/types.h>
19845 #include <stdio.h>
19846 #$i_stdlib I_STDLIB
19847 #ifdef I_STDLIB
19848 #include <stdlib.h>
19849 #endif
19850 int main() {
19851     printf("%d\n", (int)sizeof($gidtype));
19852     exit(0);
19853 }
19854 EOCP
19855 set try
19856 if eval $compile_ok; then
19857         yyy=`$run ./try`
19858         case "$yyy" in
19859         '')     gidsize=4
19860                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19861                 ;;
19862         *)      gidsize=$yyy
19863                 echo "Your $zzz is $gidsize bytes long."
19864                 ;;
19865         esac
19866 else
19867         gidsize=4
19868         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19869 fi
19870
19871
19872 : Check if GID is signed
19873 echo " "
19874 case "$gidtype" in
19875 *_t) zzz="$gidtype"     ;;
19876 *)   zzz="gid"          ;;
19877 esac
19878 echo "Checking the sign of $zzz..." >&4
19879 cat > try.c <<EOCP
19880 #include <sys/types.h>
19881 #include <stdio.h>
19882 int main() {
19883         $gidtype foo = -1;
19884         if (foo < 0)
19885                 printf("-1\n");
19886         else
19887                 printf("1\n");
19888 }
19889 EOCP
19890 set try
19891 if eval $compile; then
19892         yyy=`$run ./try`
19893         case "$yyy" in
19894         '')     gidsign=1
19895                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19896                 ;;
19897         *)      gidsign=$yyy
19898                 case "$gidsign" in
19899                  1) echo "Your $zzz is unsigned." ;;
19900                 -1) echo "Your $zzz is signed."   ;;
19901                 esac
19902                 ;;
19903         esac
19904 else
19905         gidsign=1
19906         echo "(I can't compile the test program--guessing unsigned.)" >&4
19907 fi
19908
19909
19910 : Check 64bit sizes
19911 echo " "
19912
19913 if $test X"$quadtype" != X; then
19914
19915 echo "Checking how to print 64-bit integers..." >&4
19916
19917 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19918         $cat >try.c <<'EOCP'
19919 #include <sys/types.h>
19920 #include <stdio.h>
19921 int main() {
19922   int q = 12345678901;
19923   printf("%ld\n", q);
19924 }
19925 EOCP
19926         set try
19927         if eval $compile; then
19928                 yyy=`$run ./try`
19929                 case "$yyy" in
19930                 12345678901)
19931                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19932                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19933                         echo "We will use %d."
19934                         ;;
19935                 esac
19936         fi
19937 fi
19938
19939 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19940         $cat >try.c <<'EOCP'
19941 #include <sys/types.h>
19942 #include <stdio.h>
19943 int main() {
19944   long q = 12345678901;
19945   printf("%ld\n", q);
19946 }
19947 EOCP
19948         set try
19949         if eval $compile; then
19950                 yyy=`$run ./try`
19951                 case "$yyy" in
19952                 12345678901)
19953                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19954                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19955                         echo "We will use %ld."
19956                         ;;
19957                 esac
19958         fi
19959 fi
19960
19961 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19962         $cat >try.c <<'EOCP'
19963 #include <sys/types.h>
19964 #include <inttypes.h>
19965 #include <stdio.h>
19966 int main() {
19967   int64_t q = 12345678901;
19968   printf("%" PRId64 "\n", q);
19969 }
19970 EOCP
19971         set try
19972         if eval $compile; then
19973                 yyy=`$run ./try`
19974                 case "$yyy" in
19975                 12345678901)
19976                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19977                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19978                         echo "We will use the C9X style."
19979                         ;;
19980                 esac
19981         fi
19982 fi
19983
19984 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19985         $cat >try.c <<EOCP
19986 #include <sys/types.h>
19987 #include <stdio.h>
19988 int main() {
19989   $quadtype q = 12345678901;
19990   printf("%Ld\n", q);
19991 }
19992 EOCP
19993         set try
19994         if eval $compile; then
19995                 yyy=`$run ./try`
19996                 case "$yyy" in
19997                 12345678901)
19998                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19999                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20000                         echo "We will use %Ld."
20001                         ;;
20002                 esac
20003         fi
20004 fi
20005
20006 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20007         $cat >try.c <<'EOCP'
20008 #include <sys/types.h>
20009 #include <stdio.h>
20010 int main() {
20011   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20012   printf("%lld\n", q);
20013 }
20014 EOCP
20015         set try
20016         if eval $compile; then
20017                 yyy=`$run ./try`
20018                 case "$yyy" in
20019                 12345678901)
20020                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20021                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20022                         echo "We will use the %lld style."
20023                         ;;
20024                 esac
20025         fi
20026 fi
20027
20028 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20029         $cat >try.c <<EOCP
20030 #include <sys/types.h>
20031 #include <stdio.h>
20032 int main() {
20033   $quadtype q = 12345678901;
20034   printf("%qd\n", q);
20035 }
20036 EOCP
20037         set try
20038         if eval $compile; then
20039                 yyy=`$run ./try`
20040                 case "$yyy" in
20041                 12345678901)
20042                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20043                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20044                         echo "We will use %qd."
20045                         ;;
20046                 esac
20047         fi
20048 fi
20049
20050 if $test X"$sPRId64" = X; then
20051         echo "Cannot figure out how to print 64-bit integers." >&4
20052 fi
20053 $rm_try
20054
20055 fi
20056
20057 case "$sPRId64" in
20058 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20059         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20060         ;;
20061 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20062         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20063         ;;
20064 esac
20065
20066 : Check format strings for internal types
20067 echo " "
20068 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20069
20070 if $test X"$ivsize" = X8; then
20071         ivdformat="$sPRId64"
20072         uvuformat="$sPRIu64"
20073         uvoformat="$sPRIo64"
20074         uvxformat="$sPRIx64"
20075         uvXUformat="$sPRIXU64"
20076 else
20077         if $test X"$ivsize" = X"$longsize"; then
20078                 ivdformat='"ld"'
20079                 uvuformat='"lu"'
20080                 uvoformat='"lo"'
20081                 uvxformat='"lx"'
20082                 uvXUformat='"lX"'
20083         else
20084                 if $test X"$ivsize" = X"$intsize"; then
20085                         ivdformat='"d"'
20086                         uvuformat='"u"'
20087                         uvoformat='"o"'
20088                         uvxformat='"x"'
20089                         uvXUformat='"X"'
20090                 else
20091                         : far out
20092                         if $test X"$ivsize" = X"$shortsize"; then
20093                                 ivdformat='"hd"'
20094                                 uvuformat='"hu"'
20095                                 uvoformat='"ho"'
20096                                 uvxformat='"hx"'
20097                                 uvXUformat='"hX"'
20098                         fi
20099                 fi
20100         fi
20101 fi
20102
20103 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20104         nveformat="$sPRIeldbl"
20105         nvfformat="$sPRIfldbl"
20106         nvgformat="$sPRIgldbl"
20107         nvEUformat="$sPRIEUldbl"
20108         nvFUformat="$sPRIFUldbl"
20109         nvGUformat="$sPRIGUldbl"
20110 else
20111         nveformat='"e"'
20112         nvfformat='"f"'
20113         nvgformat='"g"'
20114         nvEUformat='"E"'
20115         nvFUformat='"F"'
20116         nvGUformat='"G"'
20117 fi
20118
20119 case "$ivdformat" in
20120 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20121     exit 1
20122     ;;
20123 esac
20124
20125 : Check format string for GID
20126
20127 echo " "
20128 $echo "Checking the format string to be used for gids..." >&4
20129
20130 case "$gidsign" in
20131 -1)     if $test X"$gidsize" = X"$ivsize"; then
20132                 gidformat="$ivdformat"
20133         else
20134                 if $test X"$gidsize" = X"$longsize"; then
20135                         gidformat='"ld"'
20136                 else
20137                         if $test X"$gidsize" = X"$intsize"; then
20138                                 gidformat='"d"'
20139                         else
20140                                 if $test X"$gidsize" = X"$shortsize"; then
20141                                         gidformat='"hd"'
20142                                 fi
20143                         fi
20144                 fi
20145         fi
20146         ;;
20147 *)      if $test X"$gidsize" = X"$uvsize"; then
20148                 gidformat="$uvuformat"
20149         else
20150                 if $test X"$gidsize" = X"$longsize"; then
20151                         gidformat='"lu"'
20152                 else
20153                         if $test X"$gidsize" = X"$intsize"; then
20154                                 gidformat='"u"'
20155                         else
20156                                 if $test X"$gidsize" = X"$shortsize"; then
20157                                         gidformat='"hu"'
20158                                 fi
20159                         fi
20160                 fi
20161         fi
20162         ;;
20163 esac
20164
20165 : see if getgroups exists
20166 set getgroups d_getgrps
20167 eval $inlibc
20168
20169 : see if setgroups exists
20170 set setgroups d_setgrps
20171 eval $inlibc
20172
20173 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20174 echo " "
20175 case "$d_getgrps$d_setgrps" in
20176 *define*)
20177         case "$groupstype" in
20178         '') dflt="$gidtype" ;;
20179         *)  dflt="$groupstype" ;;
20180         esac
20181         $cat <<EOM
20182 What type of pointer is the second argument to getgroups() and setgroups()?
20183 Usually this is the same as group ids, $gidtype, but not always.
20184
20185 EOM
20186         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20187         . ./myread
20188         groupstype="$ans"
20189         ;;
20190 *)  groupstype="$gidtype";;
20191 esac
20192
20193 : MAD = Misc Attribute Definition
20194
20195 if $test $patchlevel -lt 9; then
20196 : MAD is not available in 5.8.x or earlier.
20197     ans=n;
20198 else
20199     case "$mad" in
20200     $define|true|[yY]*) dflt='y' ;;
20201     *)                  dflt='n' ;;
20202     esac
20203     cat <<EOM
20204
20205 Would you like to build with Misc Attribute Decoration? This is development
20206 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20207 overhead on the interpreter.
20208
20209 If this doesn't make any sense to you, just accept the default '$dflt'.
20210 EOM
20211     rp='Build Perl with MAD?'
20212     . ./myread
20213 fi
20214 case "$ans" in
20215 y|Y)    val="$define"
20216         madlyh='madly.h madly.act madly.tab'
20217         madlysrc='madly.c'
20218         madlyobj="madly$_o" ;;
20219 *)      val="$undef"
20220         madlyh=''
20221         madlysrc=''
20222         madlyobj='' ;;
20223 esac
20224 set mad
20225 eval $setvar
20226
20227 : check whether make sets MAKE
20228 echo " "
20229 echo "Checking if your $make program sets \$(MAKE)..." >&4
20230 case "$make_set_make" in
20231 '')
20232         $sed 's/^X //' > testmake.mak << 'EOF'
20233 Xall:
20234 X       @echo 'maketemp="$(MAKE)"'
20235 EOF
20236         case "`$make -f testmake.mak 2>/dev/null`" in
20237         *maketemp=*) make_set_make='#' ;;
20238         *)      make_set_make="MAKE=$make" ;;
20239         esac
20240         $rm -f testmake.mak
20241         ;;
20242 esac
20243 case "$make_set_make" in
20244 '#') echo "Yup, it does.";;
20245 *) echo "Nope, it doesn't.";;
20246 esac
20247
20248 : see what type is used for mode_t
20249 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20250 set mode_t modetype int stdio.h sys/types.h
20251 eval $typedef_ask
20252
20253 : see if we need va_copy
20254 echo " "
20255 case "$i_stdarg" in
20256 "$define")
20257         $cat >try.c <<EOCP
20258 #include <stdarg.h>
20259 #include <stdio.h>
20260 #$i_stdlib I_STDLIB
20261 #ifdef I_STDLIB
20262 #include <stdlib.h>
20263 #endif
20264 #include <signal.h>
20265
20266 int
20267 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20268 {
20269   return vfprintf(f, fmt, *valp);
20270 }
20271
20272 int
20273 myvfprintf(FILE *f, const  char *fmt, va_list val)
20274 {
20275   return ivfprintf(f, fmt, &val);
20276 }
20277
20278 int
20279 myprintf(char *fmt, ...)
20280 {
20281   va_list val;
20282   va_start(val, fmt);
20283   return myvfprintf(stdout, fmt, val);
20284 }
20285
20286 int
20287 main(int ac, char **av)
20288 {
20289   signal(SIGSEGV, exit);
20290
20291   myprintf("%s%cs all right, then\n", "that", '\'');
20292   exit(0);
20293 }
20294 EOCP
20295         set try
20296         if eval $compile && $run ./try 2>&1 >/dev/null; then
20297                 case "`$run ./try`" in
20298                 "that's all right, then")
20299                         okay=yes
20300                         ;;
20301                 esac
20302         fi
20303         case "$okay" in
20304         yes)    echo "It seems that you don't need va_copy()." >&4
20305                 need_va_copy="$undef"
20306                 ;;
20307         *)      echo "It seems that va_copy() or similar will be needed." >&4
20308                 need_va_copy="$define"
20309                 ;;
20310         esac
20311         $rm_try
20312         ;;
20313 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20314         ;;
20315 esac
20316
20317 : see what type is used for size_t
20318 rp="What is the type used for the length parameter for string functions?"
20319 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20320 eval $typedef_ask
20321
20322 : check for type of arguments to gethostbyaddr. 
20323 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20324         case "$d_gethbyaddr" in
20325         $define)
20326                 $cat <<EOM
20327
20328 Checking to see what type of arguments are accepted by gethostbyaddr().
20329 EOM
20330                 hdrs="$define sys/types.h
20331                         $d_socket sys/socket.h 
20332                         $i_niin netinet/in.h 
20333                         $i_netdb netdb.h
20334                         $i_unistd unistd.h"
20335                 : The first arg can 'char *' or 'void *'
20336                 : The second arg is some of integral type
20337                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20338                         for yyy in size_t long int; do
20339                                 case "$netdb_host_type" in
20340                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20341                                         if ./protochk "$try" $hdrs; then
20342                                                 echo "Your system accepts $xxx for the first arg."
20343                                                 echo "...and $yyy for the second arg."
20344                                                 netdb_host_type="$xxx"
20345                                                 netdb_hlen_type="$yyy"
20346                                         fi
20347                                         ;;
20348                                 esac
20349                         done
20350                 done
20351                 : In case none of those worked, prompt the user.
20352                 case "$netdb_host_type" in
20353                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20354                         dflt='char *'
20355                         . ./myread
20356                         netdb_host_type=$ans
20357                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20358                         dflt="$sizetype"
20359                         . ./myread
20360                         netdb_hlen_type=$ans
20361                         ;;
20362                 esac
20363                 ;;
20364         *)      : no gethostbyaddr, so pick harmless defaults
20365                 netdb_host_type='char *'
20366                 netdb_hlen_type="$sizetype"
20367                 ;;
20368         esac
20369         # Remove the "const" if needed. -- but then we'll have a 
20370         # prototype clash!
20371         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20372 fi
20373
20374 : check for type of argument to gethostbyname. 
20375 if test "X$netdb_name_type" = X ; then
20376         case "$d_gethbyname" in
20377         $define)
20378                 $cat <<EOM
20379
20380 Checking to see what type of argument is accepted by gethostbyname().
20381 EOM
20382                 hdrs="$define sys/types.h
20383                         $d_socket sys/socket.h 
20384                         $i_niin netinet/in.h 
20385                         $i_netdb netdb.h
20386                         $i_unistd unistd.h"
20387                 for xxx in "const char *" "char *"; do
20388                         case "$netdb_name_type" in
20389                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20390                                 if ./protochk "$try" $hdrs; then
20391                                         echo "Your system accepts $xxx."
20392                                         netdb_name_type="$xxx"
20393                                 fi
20394                                 ;;
20395                         esac
20396                 done
20397                 : In case none of those worked, prompt the user.
20398                 case "$netdb_name_type" in
20399                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20400                         dflt='char *'
20401                         . ./myread
20402                         netdb_name_type=$ans
20403                         ;;
20404                 esac
20405                 ;;
20406         *)      : no gethostbyname, so pick harmless default
20407                 netdb_name_type='char *'
20408                 ;;
20409         esac
20410 fi
20411
20412 : check for type of 1st argument to getnetbyaddr. 
20413 if test "X$netdb_net_type" = X ; then
20414         case "$d_getnbyaddr" in
20415         $define)
20416                 $cat <<EOM
20417
20418 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20419 EOM
20420                 hdrs="$define sys/types.h
20421                         $d_socket sys/socket.h 
20422                         $i_niin netinet/in.h 
20423                         $i_netdb netdb.h
20424                         $i_unistd unistd.h"
20425                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20426                         case "$netdb_net_type" in
20427                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20428                                 if ./protochk "$try" $hdrs; then
20429                                         echo "Your system accepts $xxx."
20430                                         netdb_net_type="$xxx"
20431                                 fi
20432                                 ;;
20433                         esac
20434                 done
20435                 : In case none of those worked, prompt the user.
20436                 case "$netdb_net_type" in
20437                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20438                         dflt='long'
20439                         . ./myread
20440                         netdb_net_type=$ans
20441                         ;;
20442                 esac
20443                 ;;
20444         *)      : no getnetbyaddr, so pick harmless default
20445                 netdb_net_type='long'
20446                 ;;
20447         esac
20448 fi
20449 : locate the preferred pager for this system
20450 fn=f/
20451 case "$pager" in
20452 '')
20453         dflt=''
20454         case "$pg" in
20455         /*) dflt=$pg;;
20456         [a-zA-Z]:/*) dflt=$pg;;
20457         esac
20458         case "$more" in
20459         /*) dflt=$more;;
20460         [a-zA-Z]:/*) dflt=$more;;
20461         esac
20462         case "$less" in
20463         /*) dflt=$less;;
20464         [a-zA-Z]:/*) dflt=$less;;
20465         esac
20466         case "$dflt" in
20467         '') dflt=/usr/ucb/more;;
20468         esac
20469         ;;
20470 *)      dflt="$pager"
20471         ;;
20472 esac
20473 fn="f/($dflt)"
20474 echo " "
20475 rp='What pager is used on your system?'
20476 . ./getfile
20477 pager="$ans"
20478
20479 : see what type pids are declared as in the kernel
20480 rp="What is the type of process ids on this system?"
20481 set pid_t pidtype int stdio.h sys/types.h
20482 eval $typedef_ask
20483
20484 : see if ar generates random libraries by itself
20485 echo " "
20486 echo "Checking how to generate random libraries on your machine..." >&4
20487 echo 'int bar1() { return bar2(); }' > bar1.c
20488 echo 'int bar2() { return 2; }' > bar2.c
20489 $cat > foo.c <<EOP
20490 #$i_stdlib I_STDLIB
20491 #ifdef I_STDLIB
20492 #include <stdlib.h>
20493 #endif
20494 int main() { printf("%d\n", bar1()); exit(0); }
20495 EOP
20496 $cc $ccflags -c bar1.c >/dev/null 2>&1
20497 $cc $ccflags -c bar2.c >/dev/null 2>&1
20498 $cc $ccflags -c foo.c >/dev/null 2>&1
20499 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20500 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20501         $run ./foobar >/dev/null 2>&1; then
20502         echo "$ar appears to generate random libraries itself."
20503         orderlib=false
20504         if [ "X$ranlib" = "X" ]; then
20505             ranlib=":"
20506         fi
20507 elif $ar s bar$_a >/dev/null 2>&1 &&
20508         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20509         $run ./foobar >/dev/null 2>&1; then
20510                 echo "a table of contents needs to be added with '$ar s'."
20511                 orderlib=false
20512                 ranlib="$ar s"
20513 elif $ar ts bar$_a >/dev/null 2>&1 &&
20514         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20515         $run ./foobar >/dev/null 2>&1; then
20516                 echo "a table of contents needs to be added with '$ar ts'."
20517                 orderlib=false
20518                 ranlib="$ar ts"
20519 else
20520         case "$ranlib" in
20521         :) ranlib='';;
20522         '')
20523                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20524                 $test -f $ranlib || ranlib=''
20525                 ;;
20526         esac
20527         if $test -n "$ranlib"; then
20528                 echo "your system has '$ranlib'; we'll use that."
20529                 orderlib=false
20530         else
20531                 echo "your system doesn't seem to support random libraries"
20532                 echo "so we'll use lorder and tsort to order the libraries."
20533                 orderlib=true
20534                 ranlib=":"
20535         fi
20536 fi
20537 $rm -f foo* bar*
20538
20539 : see if this is a values.h system
20540 set values.h i_values
20541 eval $inhdr
20542
20543 : Check the max offset that gmtime and localtime accept
20544 echo "Checking max offsets that gmtime () accepts"
20545
20546 case $i_values in
20547     define) yyy="#include <values.h>" ;;
20548     *)      yyy="" ;;
20549     esac
20550
20551 case "$sGMTIME_min/$sGMTIME_max" in
20552     0/0|/)
20553         $cat >try.c <<EOCP
20554 #include <sys/types.h>
20555 #include <stdio.h>
20556 #include <time.h>
20557 $yyy
20558
20559 int i;
20560 struct tm *tmp;
20561 time_t pt;
20562
20563 void gm_check (time_t t, int min_year, int max_year)
20564 {
20565     tmp = gmtime (&t);
20566     if ( tmp == NULL ||
20567         /* Check tm_year overflow */
20568          tmp->tm_year < min_year || tmp->tm_year > max_year)
20569         tmp = NULL;
20570     else
20571         pt = t;
20572     } /* gm_check */
20573
20574 int check_max ()
20575 {
20576     tmp = NULL;
20577     pt  = 0;
20578 #ifdef MAXLONG
20579     gm_check (MAXLONG, 69, 0x7fffffff);
20580 #endif
20581     if (tmp == NULL || tmp->tm_year < 0) {
20582         for (i = 63; i >= 0; i--) {
20583             time_t x = pt | ((time_t)1 << i);
20584             if (x < 0 || x < pt) continue;
20585             gm_check (x, 69, 0x7fffffff);
20586             }
20587         }
20588     printf ("sGMTIME_max=%ld\n", pt);
20589     return (0);
20590     } /* check_max */
20591
20592 int check_min ()
20593 {
20594     tmp = NULL;
20595     pt  = 0;
20596 #ifdef MINLONG
20597     gm_check (MINLONG, -1900, 70);
20598 #endif
20599     if (tmp == NULL) {
20600         for (i = 36; i >= 0; i--) {
20601             time_t x = pt - ((time_t)1 << i);
20602             if (x > 0) continue;
20603             gm_check (x, -1900, 70);
20604             }
20605         }
20606     printf ("sGMTIME_min=%ld\n", pt);
20607     return (0);
20608     } /* check_min */
20609
20610 int main (int argc, char *argv[])
20611 {
20612     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20613     check_max ();
20614     check_min ();
20615     return (0);
20616     } /* main */
20617 EOCP
20618         set try
20619         if eval $compile; then
20620             eval `$run ./try`
20621         else
20622             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20623             fi
20624         $rm_try
20625         ;;
20626     esac
20627
20628 echo "Checking max offsets that localtime () accepts"
20629
20630 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20631     0/0|/)
20632         $cat >try.c <<EOCP
20633 #include <sys/types.h>
20634 #include <stdio.h>
20635 #include <time.h>
20636 $yyy
20637
20638 int i;
20639 struct tm *tmp;
20640 time_t pt;
20641
20642 void local_check (time_t t, int min_year, int max_year)
20643 {
20644     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20645         tmp = NULL;
20646     else
20647         tmp = localtime (&t);
20648     if ( tmp == NULL ||
20649         /* Check tm_year overflow */
20650          tmp->tm_year < min_year || tmp->tm_year > max_year)
20651         tmp = NULL;
20652     else
20653         pt = t;
20654     } /* local_check */
20655
20656 int check_max ()
20657 {
20658     tmp = NULL;
20659     pt  = 0;
20660 #ifdef MAXLONG
20661     local_check (MAXLONG, 69, 0x7fffffff);
20662 #endif
20663     if (tmp == NULL || tmp->tm_year < 0) {
20664         for (i = 63; i >= 0; i--) {
20665             time_t x = pt | ((time_t)1 << i);
20666             if (x < 0 || x < pt) continue;
20667             local_check (x, 69, 0x7fffffff);
20668             }
20669         }
20670     printf ("sLOCALTIME_max=%ld\n", pt);
20671     return (0);
20672    } /* check_max */
20673
20674 int check_min ()
20675 {
20676     tmp = NULL;
20677     pt  = 0;
20678 #ifdef MINLONG
20679     local_check (MINLONG, -1900, 70);
20680 #endif
20681     if (tmp == NULL) {
20682         for (i = 36; i >= 0; i--) {
20683             time_t x = pt - ((time_t)1 << i);
20684             if (x > 0) continue;
20685             local_check (x, -1900, 70);
20686             }
20687         }
20688     printf ("sLOCALTIME_min=%ld\n", pt);
20689     return (0);
20690     } /* check_min */
20691
20692 int main (int argc, char *argv[])
20693 {
20694     check_max ();
20695     check_min ();
20696     return (0);
20697     } /* main */
20698 EOCP
20699         set try
20700         if eval $compile; then
20701             eval `$run ./try`
20702         else
20703             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20704             fi
20705         $rm_try
20706         ;;
20707     esac
20708
20709 : check for type of arguments to select.
20710 case "$selecttype" in
20711 '') case "$d_select" in
20712         $define)
20713                 echo " "
20714                 $cat <<EOM
20715 Checking to see what type of arguments are accepted by select().
20716 EOM
20717                 hdrs="$define sys/types.h
20718                         $i_systime sys/time.h
20719                         $i_sysselct sys/select.h
20720                         $d_socket sys/socket.h"
20721                 : The first arg can be int, unsigned, or size_t
20722                 : The last arg may or may not be 'const'
20723                 val=''
20724                 : void pointer has been seen but using that
20725                 : breaks the selectminbits test
20726                 for xxx in 'fd_set *' 'int *'; do
20727                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20728                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20729                                         case "$val" in
20730                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20731                                                 if ./protochk "$try" $hdrs; then
20732                                                         echo "Your system accepts $xxx."
20733                                                         val="$xxx"
20734                                                 fi
20735                                                 ;;
20736                                         esac
20737                                 done
20738                         done
20739                 done
20740                 case "$val" in
20741                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20742                         case "$d_fd_set" in
20743                                 $define) dflt="fd_set *" ;;
20744                                 *)              dflt="int *" ;;
20745                         esac
20746                         . ./myread
20747                         val=$ans
20748                         ;;
20749                 esac
20750                 selecttype="$val"
20751                 ;;
20752         *)      : no select, so pick a harmless default
20753                 selecttype='int *'
20754                 ;;
20755         esac
20756         ;;
20757 esac
20758
20759 : check for the select 'width'
20760 case "$selectminbits" in
20761 '') safebits=`expr $ptrsize \* 8`
20762     case "$d_select" in
20763         $define)
20764                 $cat <<EOM
20765
20766 Checking to see on how many bits at a time your select() operates...
20767 EOM
20768                 $cat >try.c <<EOCP
20769 #include <sys/types.h>
20770 #$i_time I_TIME
20771 #$i_systime I_SYS_TIME
20772 #$i_systimek I_SYS_TIME_KERNEL
20773 #ifdef I_TIME
20774 #   include <time.h>
20775 #endif
20776 #ifdef I_SYS_TIME
20777 #   ifdef I_SYS_TIME_KERNEL
20778 #       define KERNEL
20779 #   endif
20780 #   include <sys/time.h>
20781 #   ifdef I_SYS_TIME_KERNEL
20782 #       undef KERNEL
20783 #   endif
20784 #endif
20785 #$i_sysselct I_SYS_SELECT
20786 #ifdef I_SYS_SELECT
20787 #include <sys/select.h>
20788 #endif
20789 #$d_socket HAS_SOCKET
20790 #ifdef HAS_SOCKET
20791 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20792 #endif
20793 #include <stdio.h>
20794 #$i_stdlib I_STDLIB
20795 #ifdef I_STDLIB
20796 #include <stdlib.h>
20797 #endif
20798 $selecttype b;
20799 #define S sizeof(*(b))
20800 #define MINBITS 64
20801 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20802 #define NBITS  (NBYTES * 8)
20803 int main() {
20804     char *s = (char *)malloc(NBYTES);
20805     struct timeval t;
20806     int i;
20807     FILE* fp;
20808     int fd;
20809
20810     if (!s)
20811         exit(1);
20812     fclose(stdin);
20813     fp = fopen("try.c", "r");
20814     if (fp == 0)
20815       exit(2);
20816     fd = fileno(fp);
20817     if (fd < 0)
20818       exit(3);
20819     b = ($selecttype)s;
20820     for (i = 0; i < NBITS; i++)
20821         FD_SET(i, b);
20822     t.tv_sec  = 0;
20823     t.tv_usec = 0;
20824     select(fd + 1, b, 0, 0, &t);
20825     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20826     free(s);
20827     printf("%d\n", i + 1);
20828     return 0;
20829 }
20830 EOCP
20831                 set try
20832                 if eval $compile_ok; then
20833                         selectminbits=`$run ./try`
20834                         case "$selectminbits" in
20835                         '')     cat >&4 <<EOM
20836 Cannot figure out on how many bits at a time your select() operates.
20837 I'll play safe and guess it is $safebits bits.
20838 EOM
20839                                 selectminbits=$safebits
20840                                 bits="$safebits bits"
20841                                 ;;
20842                         1)      bits="1 bit" ;;
20843                         *)      bits="$selectminbits bits" ;;
20844                         esac
20845                         echo "Your select() operates on $bits at a time." >&4
20846                 else
20847                         rp='What is the minimum number of bits your select() operates on?'
20848                         case "$byteorder" in
20849                         12345678)       dflt=64 ;;
20850                         1234)           dflt=32 ;;
20851                         *)              dflt=1  ;;
20852                         esac
20853                         . ./myread
20854                         val=$ans
20855                         selectminbits="$val"
20856                 fi
20857                 $rm_try
20858                 ;;
20859         *)      : no select, so pick a harmless default
20860                 selectminbits=$safebits
20861                 ;;
20862         esac
20863         ;;
20864 esac
20865
20866 : Trace out the files included by signal.h, then look for SIGxxx names.
20867 if [ "X$fieldn" = X ]; then
20868         : Just make some guesses.  We check them later.
20869         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20870 else
20871         xxx=`echo '#include <signal.h>' |
20872         $cppstdin $cppminus $cppflags 2>/dev/null |
20873         $grep '^[       ]*#.*include' |
20874         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20875                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20876 fi
20877 xxxfiles=''
20878 for xx in $xxx /dev/null ; do
20879         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20880 done
20881 case "$xxxfiles" in
20882 '')     xxxfiles=`./findhdr signal.h` ;;
20883 esac
20884 xxx=`awk '
20885 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20886         print substr($2, 4, 20)
20887 }
20888 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20889         print substr($3, 4, 20)
20890 }' $xxxfiles`
20891 : Append some common names just in case the awk scan failed.
20892 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20893 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20894 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20895 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20896 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20897
20898 : generate a few handy files for later
20899 $cat > signal.c <<EOCP
20900 #include <sys/types.h>
20901 #include <signal.h>
20902 #$i_stdlib I_STDLIB
20903 #ifdef I_STDLIB
20904 #include <stdlib.h>
20905 #endif
20906 #include <stdio.h>
20907 int main() {
20908
20909 /* Strange style to avoid deeply-nested #if/#else/#endif */
20910 #ifndef NSIG
20911 #  ifdef _NSIG
20912 #    define NSIG (_NSIG)
20913 #  endif
20914 #endif
20915
20916 #ifndef NSIG
20917 #  ifdef SIGMAX
20918 #    define NSIG (SIGMAX+1)
20919 #  endif
20920 #endif
20921
20922 #ifndef NSIG
20923 #  ifdef SIG_MAX
20924 #    define NSIG (SIG_MAX+1)
20925 #  endif
20926 #endif
20927
20928 #ifndef NSIG
20929 #  ifdef _SIG_MAX
20930 #    define NSIG (_SIG_MAX+1)
20931 #  endif
20932 #endif
20933
20934 #ifndef NSIG
20935 #  ifdef MAXSIG
20936 #    define NSIG (MAXSIG+1)
20937 #  endif
20938 #endif
20939
20940 #ifndef NSIG
20941 #  ifdef MAX_SIG
20942 #    define NSIG (MAX_SIG+1)
20943 #  endif
20944 #endif
20945
20946 #ifndef NSIG
20947 #  ifdef SIGARRAYSIZE
20948 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20949 #  endif
20950 #endif
20951
20952 #ifndef NSIG
20953 #  ifdef _sys_nsig
20954 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20955 #  endif
20956 #endif
20957
20958 /* Default to some arbitrary number that's big enough to get most
20959    of the common signals.
20960 */
20961 #ifndef NSIG
20962 #    define NSIG 50
20963 #endif
20964
20965 printf("NSIG %d\n", NSIG);
20966
20967 #ifndef JUST_NSIG
20968
20969 EOCP
20970
20971 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20972 {
20973         printf "#ifdef SIG"; printf $1; printf "\n"
20974         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20975         printf $1; printf ");\n"
20976         printf "#endif\n"
20977 }
20978 END {
20979         printf "#endif /* JUST_NSIG */\n";
20980         printf "exit(0);\n}\n";
20981 }
20982 ' >>signal.c
20983 $cat >signal.awk <<'EOP'
20984 BEGIN { ndups = 0 }
20985 $1 ~ /^NSIG$/ { nsig = $2 }
20986 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20987     if ($2 > maxsig) { maxsig = $2 }
20988     if (sig_name[$2]) {
20989         dup_name[ndups] = $1
20990         dup_num[ndups] = $2
20991         ndups++
20992     }
20993     else {
20994         sig_name[$2] = $1
20995         sig_num[$2] = $2
20996     }
20997 }
20998 END {
20999     if (nsig == 0) {
21000         nsig = maxsig + 1
21001     }
21002     printf("NSIG %d\n", nsig);
21003     for (n = 1; n < nsig; n++) {
21004         if (sig_name[n]) {
21005             printf("%s %d\n", sig_name[n], sig_num[n])
21006         }
21007         else {
21008             printf("NUM%d %d\n", n, n)
21009         }
21010     }
21011     for (n = 0; n < ndups; n++) {
21012         printf("%s %d\n", dup_name[n], dup_num[n])
21013     }
21014 }
21015 EOP
21016 $cat >signal_cmd <<EOS
21017 $startsh
21018 if $test -s signal.lst; then
21019     echo "Using your existing signal.lst file"
21020         exit 0
21021 fi
21022 xxx="$xxx"
21023 EOS
21024 $cat >>signal_cmd <<'EOS'
21025
21026 set signal
21027 if eval $compile_ok; then
21028         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21029                 $uniq | $awk -f signal.awk >signal.lst
21030 else
21031         echo "(I can't seem be able to compile the whole test program)" >&4
21032         echo "(I'll try it in little pieces.)" >&4
21033         set signal -DJUST_NSIG
21034         if eval $compile_ok; then
21035                 $run ./signal$_exe > signal.nsg
21036                 $cat signal.nsg
21037         else
21038                 echo "I can't seem to figure out how many signals you have." >&4
21039                 echo "Guessing 50." >&4
21040                 echo 'NSIG 50' > signal.nsg
21041         fi
21042         : Now look at all the signal names, one at a time.
21043         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21044                 $cat > signal.c <<EOCP
21045 #include <sys/types.h>
21046 #include <signal.h>
21047 #include <stdio.h>
21048 int main() {
21049 printf("$xx %d\n", SIG${xx});
21050 return 0;
21051 }
21052 EOCP
21053                 set signal
21054                 if eval $compile; then
21055                         echo "SIG${xx} found."
21056                         $run ./signal$_exe  >> signal.ls1
21057                 else
21058                         echo "SIG${xx} NOT found."
21059                 fi
21060         done
21061         if $test -s signal.ls1; then
21062                 $cat signal.nsg signal.ls1 |
21063                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21064         fi
21065
21066 fi
21067 if $test -s signal.lst; then
21068         :
21069 else
21070         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21071         echo 'kill -l' >signal
21072         set X `csh -f <signal`
21073         $rm -f signal
21074         shift
21075         case $# in
21076         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21077         esac
21078         echo $@ | $tr ' ' $trnl | \
21079             $awk '{ printf "%s %d\n", $1, ++s; }
21080                   END { printf "NSIG %d\n", ++s }' >signal.lst
21081 fi
21082 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21083 EOS
21084 chmod a+x signal_cmd
21085 $eunicefix signal_cmd
21086
21087 : generate list of signal names
21088 echo " "
21089 case "$sig_name_init" in
21090 '') doinit=yes ;;
21091 *)  case "$sig_num_init" in
21092     ''|*,*) doinit=yes ;;
21093     esac ;;
21094 esac
21095 case "$doinit" in
21096 yes)
21097         echo "Generating a list of signal names and numbers..." >&4
21098         . ./signal_cmd
21099         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21100         sig_name=`$awk 'BEGIN { printf "ZERO " }
21101                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21102         sig_num=`$awk  'BEGIN { printf "0 " }
21103                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21104         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21105                              !/^NSIG/   { printf "\"%s\", ", $1 }
21106                              END        { printf "0\n" }' signal.lst`
21107         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21108                              !/^NSIG/   { printf "%d, ", $2}
21109                              END        { printf "0\n"}' signal.lst`
21110         ;;
21111 esac
21112 echo "The following $sig_count signals are available:"
21113 echo " "
21114 echo $sig_name | $awk \
21115 'BEGIN { linelen = 0 }
21116 {
21117         for (i = 1; i <= NF; i++) {
21118                 name = "SIG" $i " "
21119                 linelen = linelen + length(name)
21120                 if (linelen > 70) {
21121                         printf "\n"
21122                         linelen = length(name)
21123                 }
21124                 printf "%s", name
21125         }
21126         printf "\n"
21127 }'
21128 sig_size=`echo $sig_name | awk '{print NF}'`
21129 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21130
21131 : Check size of size
21132 echo " "
21133 case "$sizetype" in
21134 *_t) zzz="$sizetype"    ;;
21135 *)   zzz="filesize"     ;;
21136 esac
21137 echo "Checking the size of $zzz..." >&4
21138 cat > try.c <<EOCP
21139 #include <sys/types.h>
21140 #include <stdio.h>
21141 #$i_stdlib I_STDLIB
21142 #ifdef I_STDLIB
21143 #include <stdlib.h>
21144 #endif
21145 int main() {
21146     printf("%d\n", (int)sizeof($sizetype));
21147     exit(0);
21148 }
21149 EOCP
21150 set try
21151 if eval $compile_ok; then
21152         yyy=`$run ./try`
21153         case "$yyy" in
21154         '')     sizesize=4
21155                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21156                 ;;
21157         *)      sizesize=$yyy
21158                 echo "Your $zzz size is $sizesize bytes."
21159                 ;;
21160         esac
21161 else
21162         sizesize=4
21163         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21164 fi
21165
21166
21167 : check for socklen_t
21168 echo " "
21169 echo "Checking to see if you have socklen_t..." >&4
21170 $cat >try.c <<EOCP
21171 #include <sys/types.h>
21172 #$d_socket HAS_SOCKET
21173 #ifdef HAS_SOCKET
21174 #include <sys/socket.h>
21175 #endif
21176 int main() { socklen_t x = 16; }
21177 EOCP
21178 set try
21179 if eval $compile; then
21180         val="$define"
21181         echo "You have socklen_t."
21182 else
21183         val="$undef"
21184         echo "You do not have socklen_t."
21185         case "$sizetype" in
21186         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21187         esac
21188 fi
21189 $rm_try
21190 set d_socklen_t
21191 eval $setvar
21192
21193 : see if this is a socks.h system
21194 set socks.h i_socks
21195 eval $inhdr
21196
21197 : check for type of the size argument to socket calls
21198 case "$d_socket" in
21199 "$define")
21200         $cat <<EOM
21201
21202 Checking to see what type is the last argument of accept().
21203 EOM
21204         yyy=''
21205         case "$d_socklen_t" in
21206         "$define") yyy="$yyy socklen_t"
21207         esac
21208         yyy="$yyy $sizetype int long unsigned"
21209         for xxx in $yyy; do
21210                 case "$socksizetype" in
21211                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21212                         case "$usesocks" in
21213                         "$define")
21214                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21215                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21216                                         socksizetype="$xxx"
21217                                 fi
21218                                 ;;
21219                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21220                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21221                                         socksizetype="$xxx"
21222                                 fi
21223                                 ;;
21224                         esac
21225                         ;;
21226                 esac
21227         done
21228 : In case none of those worked, prompt the user.
21229         case "$socksizetype" in
21230         '')     rp='What is the type for socket address structure sizes?'
21231                 dflt='int'
21232                 . ./myread
21233                 socksizetype=$ans
21234                 ;;
21235         esac
21236         ;;
21237 *)      : no sockets, so pick relatively harmless default
21238         socksizetype='int'
21239         ;;
21240 esac
21241
21242 : see what type is used for signed size_t
21243 set ssize_t ssizetype int stdio.h sys/types.h
21244 eval $typedef
21245 dflt="$ssizetype"
21246 $cat > try.c <<EOM
21247 #include <stdio.h>
21248 #$i_stdlib I_STDLIB
21249 #ifdef I_STDLIB
21250 #include <stdlib.h>
21251 #endif
21252 #include <sys/types.h>
21253 #define Size_t $sizetype
21254 #define SSize_t $dflt
21255 int main()
21256 {
21257         if (sizeof(Size_t) == sizeof(SSize_t))
21258                 printf("$dflt\n");
21259         else if (sizeof(Size_t) == sizeof(int))
21260                 printf("int\n");
21261         else
21262                 printf("long\n");
21263         exit(0);
21264 }
21265 EOM
21266 echo " "
21267 set try
21268 if eval $compile_ok && $run ./try > /dev/null; then
21269         ssizetype=`$run ./try`
21270         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21271 else
21272         $cat >&4 <<EOM
21273 Help! I can't compile and run the ssize_t test program: please enlighten me!
21274 (This is probably a misconfiguration in your system or libraries, and
21275 you really ought to fix it.  Still, I'll try anyway.)
21276
21277 I need a type that is the same size as $sizetype, but is guaranteed to
21278 be signed.  Common values are ssize_t, int and long.
21279
21280 EOM
21281         rp="What signed type is the same size as $sizetype?"
21282         . ./myread
21283         ssizetype="$ans"
21284 fi
21285 $rm_try
21286
21287 : Check the size of st_ino
21288 $echo " "
21289 $echo "Checking the size of st_ino..." >&4
21290 $cat > try.c <<EOCP
21291 #include <sys/stat.h>
21292 #include <stdio.h>
21293 #$i_stdlib I_STDLIB
21294 #ifdef I_STDLIB
21295 #include <stdlib.h>
21296 #endif
21297 int main() {
21298     struct stat st;
21299     printf("%d\n", (int)sizeof(st.st_ino));
21300     exit(0);
21301 }
21302 EOCP
21303 set try
21304 if eval $compile_ok; then
21305         val=`$run ./try`
21306         case "$val" in
21307         '')     st_ino_size=4
21308                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21309                 ;;
21310         *)      st_ino_size=$val
21311                 $echo "Your st_ino is $st_ino_size bytes long."
21312                 ;;
21313         esac
21314 else
21315         st_ino_size=4
21316         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21317 fi
21318 $rm_try
21319
21320 : Check if st_ino is signed
21321 $echo " "
21322 $echo "Checking the sign of st_ino..." >&4
21323 $cat > try.c <<EOCP
21324 #include <sys/stat.h>
21325 #include <stdio.h>
21326 int main() {
21327         struct stat foo;
21328         foo.st_ino = -1;
21329         if (foo.st_ino < 0)
21330                 printf("-1\n");
21331         else
21332                 printf("1\n");
21333 }
21334 EOCP
21335 set try
21336 if eval $compile; then
21337         val=`$run ./try`
21338         case "$val" in
21339         '')     st_ino_sign=1
21340                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21341                 ;;
21342         *)      st_ino_sign=$val
21343                 case "$st_ino_sign" in
21344                  1) $echo "Your st_ino is unsigned." ;;
21345                 -1) $echo "Your st_ino is signed."   ;;
21346                 esac
21347                 ;;
21348         esac
21349 else
21350         st_ino_sign=1
21351         $echo "(I can't compile the test program--guessing unsigned.)" >&4
21352 fi
21353 $rm_try
21354
21355 : see what type of char stdio uses.
21356 echo " "
21357 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21358 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21359         echo "Your stdio uses unsigned chars." >&4
21360         stdchar="unsigned char"
21361 else
21362         echo "Your stdio uses signed chars." >&4
21363         stdchar="char"
21364 fi
21365 $rm -f stdioh
21366
21367 : see what type uids are declared as in the kernel
21368 echo " "
21369 echo "Looking for the type for user ids returned by getuid()."
21370 set uid_t uidtype xxx stdio.h sys/types.h
21371 eval $typedef
21372 case "$uidtype" in
21373 xxx)
21374         xxx=`./findhdr sys/user.h`
21375         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21376         case $1 in
21377         unsigned) dflt="$1 $2" ;;
21378         *) dflt="$1" ;;
21379         esac
21380         ;;
21381 *) dflt="$uidtype";;
21382 esac
21383 case "$uidtype" in
21384 uid_t)  echo "uid_t found." ;;
21385 *)      rp="What is the type for user ids returned by getuid()?"
21386         . ./myread
21387         uidtype="$ans"
21388         ;;
21389 esac
21390
21391 : Check size of UID
21392 echo " "
21393 case "$uidtype" in
21394 *_t) zzz="$uidtype"     ;;
21395 *)   zzz="uid"          ;;
21396 esac
21397 echo "Checking the size of $zzz..." >&4
21398 cat > try.c <<EOCP
21399 #include <sys/types.h>
21400 #include <stdio.h>
21401 #$i_stdlib I_STDLIB
21402 #ifdef I_STDLIB
21403 #include <stdlib.h>
21404 #endif
21405 int main() {
21406     printf("%d\n", (int)sizeof($uidtype));
21407     exit(0);
21408 }
21409 EOCP
21410 set try
21411 if eval $compile_ok; then
21412         yyy=`$run ./try`
21413         case "$yyy" in
21414         '')     uidsize=4
21415                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21416                 ;;
21417         *)      uidsize=$yyy
21418                 echo "Your $zzz is $uidsize bytes long."
21419                 ;;
21420         esac
21421 else
21422         uidsize=4
21423         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21424 fi
21425
21426 : Check if UID is signed
21427 echo " "
21428 case "$uidtype" in
21429 *_t) zzz="$uidtype"     ;;
21430 *)   zzz="uid"          ;;
21431 esac
21432 echo "Checking the sign of $zzz..." >&4
21433 cat > try.c <<EOCP
21434 #include <sys/types.h>
21435 #include <stdio.h>
21436 int main() {
21437         $uidtype foo = -1;
21438         if (foo < 0)
21439                 printf("-1\n");
21440         else
21441                 printf("1\n");
21442 }
21443 EOCP
21444 set try
21445 if eval $compile; then
21446         yyy=`$run ./try`
21447         case "$yyy" in
21448         '')     uidsign=1
21449                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21450                 ;;
21451         *)      uidsign=$yyy
21452                 case "$uidsign" in
21453                  1) echo "Your $zzz is unsigned." ;;
21454                 -1) echo "Your $zzz is signed."   ;;
21455                 esac
21456                 ;;
21457         esac
21458 else
21459         uidsign=1
21460         echo "(I can't compile the test program--guessing unsigned.)" >&4
21461 fi
21462
21463
21464 : Check format string for UID
21465 echo " "
21466 $echo "Checking the format string to be used for uids..." >&4
21467
21468 case "$uidsign" in
21469 -1)     if $test X"$uidsize" = X"$ivsize"; then
21470                 uidformat="$ivdformat"
21471         else
21472                 if $test X"$uidsize" = X"$longsize"; then
21473                         uidformat='"ld"'
21474                 else
21475                         if $test X"$uidsize" = X"$intsize"; then
21476                                 uidformat='"d"'
21477                         else
21478                                 if $test X"$uidsize" = X"$shortsize"; then
21479                                         uidformat='"hd"'
21480                                 fi
21481                         fi
21482                 fi
21483         fi
21484         ;;
21485 *)      if $test X"$uidsize" = X"$uvsize"; then
21486                 uidformat="$uvuformat"
21487         else
21488                 if $test X"$uidsize" = X"$longsize"; then
21489                         uidformat='"lu"'
21490                 else
21491                         if $test X"$uidsize" = X"$intsize"; then
21492                                 uidformat='"u"'
21493                         else
21494                                 if $test X"$uidsize" = X"$shortsize"; then
21495                                         uidformat='"hu"'
21496                                 fi
21497                         fi
21498                 fi
21499         fi
21500         ;;
21501 esac
21502
21503 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21504 echo " "
21505 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21506 $cat >try.c <<'EOM'
21507 /* Intentionally a long probe as I'd like to sanity check that the exact
21508    approach is going to work, as thinking it will work, but only having it
21509    part working at runtime is worse than not having it.  */
21510
21511 #include <sys/types.h>
21512 #include <sys/sysctl.h>
21513 #include <sys/param.h>
21514 #include <stdio.h>
21515 #include <string.h>
21516 #include <stdlib.h>
21517 #include <unistd.h>
21518
21519 int
21520 main(int argc, char **argv) {
21521     char *buffer;
21522     char *argv_leaf = strrchr(argv[0], '/');
21523     char *buffer_leaf;
21524     size_t size = 0;
21525     int mib[4];
21526
21527     mib[0] = CTL_KERN;
21528     mib[1] = KERN_PROC;
21529     mib[2] = KERN_PROC_PATHNAME;
21530     mib[3] = -1;
21531
21532     if (!argv_leaf) {
21533         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21534         return 1;
21535     }
21536
21537     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21538         perror("sysctl");
21539         return 2;
21540     }
21541
21542     if (size < strlen(argv_leaf) + 1) {
21543         fprintf(stderr, "size %lu is too short for a path\n",
21544                 (unsigned long) size);
21545         return 3;
21546     }
21547
21548     if (size > MAXPATHLEN * MAXPATHLEN) {
21549         fprintf(stderr, "size %lu is too long for a path\n",
21550                 (unsigned long) size);
21551         return 4;
21552     }
21553
21554     buffer = malloc(size);
21555     if (!buffer) {
21556         perror("malloc");
21557         return 5;
21558     }
21559
21560     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21561         perror("sysctl");
21562         return 6;
21563     }
21564
21565     if (strlen(buffer) + 1 != size) {
21566         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21567                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21568         return 7;
21569     }
21570
21571
21572     if (*buffer != '/') {
21573         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21574         return 8;
21575     }
21576
21577     if (strstr(buffer, "/./")) {
21578         fprintf(stderr, "Contains /./: '%s'\n", buffer);
21579         return 9;
21580     }
21581
21582     if (strstr(buffer, "/../")) {
21583         fprintf(stderr, "Contains /../: '%s'\n", buffer);
21584         return 10;
21585     }
21586
21587     buffer_leaf = strrchr(buffer, '/');
21588     if (strcmp(buffer_leaf, argv_leaf) != 0) {
21589         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21590         return 11;
21591     }
21592
21593     free(buffer);
21594
21595     return 0;
21596 }
21597 EOM
21598
21599 val=$undef
21600 set try
21601 if eval $compile; then
21602         if $run ./try; then
21603                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21604                 val="$define"
21605         else
21606                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21607                 val="$undef"
21608         fi
21609 else
21610         echo "I'm unable to compile the test program." >&4
21611         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21612         val="$undef"
21613 fi
21614 $rm_try
21615 set usekernprocpathname
21616 eval $setvar
21617
21618 : Determine if we can use _NSGetExecutablePath to find executing program
21619 echo " "
21620 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21621 $cat >try.c <<'EOM'
21622 /* Intentionally a long probe as I'd like to sanity check that the exact
21623    approach is going to work, as thinking it will work, but only having it
21624    part working at runtime is worse than not having it.  */
21625 #include <mach-o/dyld.h>
21626 #include <stdio.h>
21627 #include <stdlib.h>
21628 #include <sys/param.h>
21629 #include <string.h>
21630
21631 int
21632 main(int argc, char **argv) {
21633     char buf[1];
21634     uint32_t size = sizeof(buf);
21635     int result;
21636     char *buffer;
21637     char *tidied;
21638     char *argv_leaf = strrchr(argv[0], '/');
21639     char *tidied_leaf;
21640
21641     if (!argv_leaf) {
21642         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21643         return 1;
21644     }
21645
21646     _NSGetExecutablePath(buf, &size);
21647     if (size > MAXPATHLEN * MAXPATHLEN) {
21648         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21649                 (unsigned int) size);
21650         return 2;
21651     }
21652
21653     buffer = malloc(size);
21654     if (!buffer) {
21655         perror("malloc");
21656         return 3;
21657     }
21658
21659     result = _NSGetExecutablePath(buffer, &size);
21660     if (result != 0) {
21661         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21662                 result, (unsigned int) size);
21663         return 4;
21664     }
21665
21666     tidied = realpath(buffer, NULL);
21667     if (!tidied) {
21668         perror("realpath");
21669         return 5;
21670     }
21671
21672     free(buffer);
21673
21674     if (*tidied != '/') {
21675         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21676         return 6;
21677     }
21678
21679     if (strstr(tidied, "/./")) {
21680         fprintf(stderr, "Contains /./: '%s'\n", tidied);
21681         return 7;
21682     }
21683
21684     if (strstr(tidied, "/../")) {
21685         fprintf(stderr, "Contains /../: '%s'\n", tidied);
21686         return 8;
21687     }
21688
21689     tidied_leaf = strrchr(tidied, '/');
21690     if (strcmp(tidied_leaf, argv_leaf) != 0) {
21691         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21692         return 9;
21693     }
21694
21695     free(tidied);
21696
21697     return 0;
21698 }
21699 EOM
21700
21701 val=$undef
21702 set try
21703 if eval $compile; then
21704         if $run ./try; then
21705                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21706                 val="$define"
21707         else
21708                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21709         fi
21710 else
21711         echo "I'm unable to compile the test program." >&4
21712         echo "I'll assume no _NSGetExecutablePath here." >&4
21713 fi
21714 $rm_try
21715 set usensgetexecutablepath
21716 eval $setvar
21717
21718 : Check if site customization support was requested
21719 case "$usesitecustomize" in
21720     $define|true|[Yy]*)
21721         usesitecustomize="$define"
21722         ;;
21723     *)
21724         usesitecustomize="$undef"
21725         ;;
21726     esac
21727
21728 : see if prototypes support variable argument declarations
21729 echo " "
21730 case "$prototype$i_stdarg" in
21731 $define$define)
21732         echo "It appears we'll be able to prototype varargs functions." >&4
21733         val="$define"
21734         ;;
21735 *)
21736         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21737         val="$undef"
21738         ;;
21739 esac
21740 set vaproto
21741 eval $setvar
21742
21743 : determine compiler compiler
21744 case "$yacc" in
21745 '')
21746         dflt=yacc;;
21747 *)
21748         dflt="$yacc";;
21749 esac
21750 echo " "
21751 comp='yacc'
21752 if $test -f "$byacc$_exe"; then
21753         dflt="$byacc"
21754         comp="byacc or $comp"
21755 fi
21756 if $test -f "$bison$_exe"; then
21757         comp="$comp or bison -y"
21758 fi
21759 rp="Which compiler compiler ($comp) shall I use?"
21760 . ./myread
21761 yacc="$ans"
21762 case "$yacc" in
21763 *bis*)
21764         case "$yacc" in
21765         *-y*) ;;
21766         *)
21767                 yacc="$yacc -y"
21768                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21769                 ;;
21770         esac
21771         ;;
21772 esac
21773
21774 : see if this is a assert.h system
21775 set assert.h i_assert
21776 eval $inhdr
21777
21778 : see if this is a fp.h system
21779 set fp.h i_fp
21780 eval $inhdr
21781
21782 : see if this is a fp_class.h system
21783 set fp_class.h i_fp_class
21784 eval $inhdr
21785
21786 : see if gdbm.h is available
21787 set gdbm.h t_gdbm
21788 eval $inhdr
21789 case "$t_gdbm" in
21790 $define)
21791         : see if gdbm_open exists
21792         set gdbm_open d_gdbm_open
21793         eval $inlibc
21794         case "$d_gdbm_open" in
21795         $undef)
21796                 t_gdbm="$undef"
21797                 echo "We won't be including <gdbm.h>"
21798                 ;;
21799         esac
21800         ;;
21801 esac
21802 val="$t_gdbm"
21803 set i_gdbm
21804 eval $setvar
21805
21806 : see if this is a ieeefp.h system
21807 case "$i_ieeefp" in
21808 '' ) set ieeefp.h i_ieeefp
21809      eval $inhdr
21810      ;;
21811 esac
21812
21813 : see if this is a libutil.h system
21814 set libutil.h i_libutil
21815 eval $inhdr
21816
21817 : see if mach cthreads are available
21818 if test "X$usethreads" = "X$define"; then
21819         set mach/cthreads.h i_machcthr
21820         eval $inhdr
21821 else
21822         i_machcthr="$undef"
21823 fi
21824
21825 : see if this is a mntent.h system
21826 set mntent.h i_mntent
21827 eval $inhdr
21828
21829 : see if net/errno.h is available
21830 val=''
21831 set net/errno.h val
21832 eval $inhdr
21833
21834 : Unfortunately, it causes problems on some systems.  Arrgh.
21835 case "$val" in
21836 $define)
21837         cat > try.c <<'EOM'
21838 #include <stdio.h>
21839 #include <errno.h>
21840 #include <net/errno.h>
21841 int func()
21842 {
21843         return ENOTSOCK;
21844 }
21845 EOM
21846         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21847                 echo "We'll be including <net/errno.h>." >&4
21848         else
21849                 echo "We won't be including <net/errno.h>." >&4
21850                 val="$undef"
21851         fi
21852         $rm_try
21853         ;;
21854 esac
21855 set i_neterrno
21856 eval $setvar
21857
21858 : see if netinet/tcp.h is available
21859 set netinet/tcp.h i_netinettcp
21860 eval $inhdr
21861
21862 : see if this is a poll.h system
21863 set poll.h i_poll
21864 eval $inhdr
21865
21866 : see if this is a prot.h system
21867 set prot.h i_prot
21868 eval $inhdr
21869
21870 : Preprocessor symbols
21871 echo " "
21872 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21873 $cat <<'EOSH' > Cppsym.know
21874 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21875 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21876 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21877 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21878 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21879 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21880 bull c cadmus clipper CMU COFF COMPILER_VERSION
21881 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21882 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21883 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21884 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21885 GLIBC GLIBC_MINOR
21886 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21887 H3050R H3050RX hbullx20 hcx host_mips
21888 hp200 hp300 hp700 HP700 hp800 hp9000
21889 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21890 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21891 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21892 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21893 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21894 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21895 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21896 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21897 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21898 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21899 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21900 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21901 MATH_HAS_NO_SIDE_EFFECTS
21902 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21903 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21904 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21905 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21906 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21907 NetBSD news1500 news1700 news1800 news1900 news3700
21908 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21909 ns32016 ns32332 ns32k nsc32000
21910 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21911 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21912 pc532 pdp11 PGC PIC plexus PORTAR posix
21913 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21914 POSIX_C_SOURCE POSIX_SOURCE POWER
21915 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21916 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21917 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21918 sony sony_news sonyrisc sparc sparclite spectrum
21919 stardent stdc STDC_EXT stratos sun sun3 sun386
21920 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21921 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21922 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21923 sysV68 sysV88 Tek4132 Tek4300 titan
21924 TM3200 TM5400 TM5600
21925 tower tower32 tower32_200 tower32_600 tower32_700
21926 tower32_800 tower32_850 tss
21927 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21928 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21929 unix UNIX95 UNIX99 unixpc unos
21930 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21931 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21932 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21933 USGr4 USGr4_2
21934 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21935 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21936 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21937 z8000
21938 EOSH
21939 # Maybe put other stuff here too.
21940 cat <<EOSH >>Cppsym.know
21941 $osname
21942 EOSH
21943 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21944 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21945 $cat Cppsym.know > Cppsym.c
21946 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21947 $rm -f Cppsym.a Cppsym.b Cppsym.c
21948 cat <<EOSH > Cppsym
21949 $startsh
21950 if $test \$# -gt 0; then
21951     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21952     if $test -s Cppsym.got; then
21953         $rm -f Cppsym.got
21954         exit 0
21955     fi
21956     $rm -f Cppsym.got
21957     exit 1
21958 else
21959     $tr " " "$trnl" | ./Cppsym.try
21960     exit 0
21961 fi
21962 EOSH
21963 chmod +x Cppsym
21964 $eunicefix Cppsym
21965 cat <<EOSH > Cppsym.try
21966 $startsh
21967 cat <<'EOCP' > try.c
21968 #include <stdio.h>
21969 #if cpp_stuff == 1
21970 #define STRINGIFY(a)    "a"
21971 #endif
21972 #if cpp_stuff == 42
21973 #define StGiFy(a)  #a
21974 #define STRINGIFY(a)    StGiFy(a)
21975 #endif
21976 #if $cpp_stuff != 1 && $cpp_stuff != 42
21977 #   include "Bletch: How does this C preprocessor stringify macros?"
21978 #endif
21979 int main() {
21980 EOCP
21981 $awk \\
21982 EOSH
21983 cat <<'EOSH' >> Cppsym.try
21984 'length($1) > 0 {
21985     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21986     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21987     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21988     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21989 }'       >> try.c
21990 echo 'return 0;}' >> try.c
21991 EOSH
21992 cat <<EOSH >> Cppsym.try
21993 ccflags="$ccflags"
21994 case "$osname-$gccversion" in
21995 irix-) ccflags="\$ccflags -woff 1178" ;;
21996 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21997 esac
21998 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21999 EOSH
22000 chmod +x Cppsym.try
22001 $eunicefix Cppsym.try
22002 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22003 : Add in any linux cpp "predefined macros":
22004 case "$osname::$gccversion" in
22005   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22006     tHdrH=_tmpHdr
22007     rm -f $tHdrH'.h' $tHdrH
22008     touch $tHdrH'.h'
22009     # Filter out macro arguments, such as Linux's __INT8_C(c)
22010     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22011        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22012        if [ -s $tHdrH'_cppsym.real' ]; then
22013           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22014        fi
22015     fi
22016     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22017   ;;
22018 esac
22019 : now check the C compiler for additional symbols
22020 postprocess_cc_v=''
22021 case "$osname" in
22022 aix) postprocess_cc_v="|$tr , ' '" ;;
22023 esac
22024 $cat >ccsym <<EOS
22025 $startsh
22026 $cat >tmp.c <<EOF
22027 extern int foo;
22028 EOF
22029 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22030 do
22031         case "\$i" in
22032         -D*) echo "\$i" | $sed 's/^-D//';;
22033         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22034         esac
22035 done
22036 $rm_try
22037 EOS
22038 postprocess_cc_v=''
22039 chmod +x ccsym
22040 $eunicefix ccsym
22041 ./ccsym > ccsym1.raw
22042 if $test -s ccsym1.raw; then
22043        $sort ccsym1.raw | $uniq >ccsym.raw
22044 else
22045        mv ccsym1.raw ccsym.raw
22046 fi
22047
22048 $awk '/\=/ { print $0; next }
22049         { print $0"=1" }' ccsym.raw >ccsym.list
22050 $comm -13 Cppsym.true ccsym.list >ccsym.own
22051 $comm -12 Cppsym.true ccsym.list >ccsym.com
22052 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22053 also=''
22054 if $test -z ccsym.raw; then
22055         echo "Your C compiler doesn't seem to define any symbols!" >&4
22056         echo " "
22057         echo "However, your C preprocessor defines the following symbols:"
22058         $cat Cppsym.true
22059         ccsymbols=''
22060         cppsymbols=`$cat Cppsym.true`
22061         cppsymbols=`echo $cppsymbols`
22062         cppccsymbols="$cppsymbols"
22063 else
22064         if $test -s ccsym.com; then
22065                 echo "Your C compiler and pre-processor define these symbols:"
22066                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22067                 also='also '
22068                 symbols='ones'
22069                 cppccsymbols=`$cat ccsym.com`
22070                 cppccsymbols=`echo $cppccsymbols`
22071                 $test "$silent" || sleep 1
22072         fi
22073         if $test -s ccsym.cpp; then
22074                 $test "$also" && echo " "
22075                 echo "Your C pre-processor ${also}defines the following symbols:"
22076                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22077                 also='further '
22078                 cppsymbols=`$cat ccsym.cpp`
22079                 cppsymbols=`echo $cppsymbols`
22080                 $test "$silent" || sleep 1
22081         fi
22082         if $test -s ccsym.own; then
22083                 $test "$also" && echo " "
22084                 echo "Your C compiler ${also}defines the following cpp symbols:"
22085                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22086                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22087                 ccsymbols=`$cat ccsym.own`
22088                 ccsymbols=`echo $ccsymbols`
22089                 $test "$silent" || sleep 1
22090         fi
22091 fi
22092
22093 : see if this is a termio system
22094 val="$undef"
22095 val2="$undef"
22096 val3="$undef"
22097 if $test `./findhdr termios.h`; then
22098         set tcsetattr i_termios
22099         eval $inlibc
22100         val3="$i_termios"
22101 fi
22102 echo " "
22103 case "$val3" in
22104 "$define") echo "You have POSIX termios.h... good!" >&4;;
22105 *) if ./Cppsym pyr; then
22106                 case "`/bin/universe`" in
22107                 ucb) if $test `./findhdr sgtty.h`; then
22108                                 val2="$define"
22109                                 echo "<sgtty.h> found." >&4
22110                         else
22111                                 echo "System is pyramid with BSD universe."
22112                                 ./warn "<sgtty.h> not found--you could have problems."
22113                         fi;;
22114                 *) if $test `./findhdr termio.h`; then
22115                                 val="$define"
22116                                 echo "<termio.h> found." >&4
22117                         else
22118                                 echo "System is pyramid with USG universe."
22119                                 ./warn "<termio.h> not found--you could have problems."
22120                         fi;;
22121                 esac
22122         elif ./usg; then
22123                 if $test `./findhdr termio.h`; then
22124                         echo "<termio.h> found." >&4
22125                         val="$define"
22126                 elif $test `./findhdr sgtty.h`; then
22127                         echo "<sgtty.h> found." >&4
22128                         val2="$define"
22129                 else
22130                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
22131                 fi
22132         else
22133                 if $test `./findhdr sgtty.h`; then
22134                         echo "<sgtty.h> found." >&4
22135                         val2="$define"
22136                 elif $test `./findhdr termio.h`; then
22137                         echo "<termio.h> found." >&4
22138                         val="$define"
22139                 else
22140                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22141                 fi
22142         fi;;
22143 esac
22144 set i_termio; eval $setvar
22145 val=$val2; set i_sgtty; eval $setvar
22146 val=$val3; set i_termios; eval $setvar
22147
22148 : see if stdbool is available
22149 : we want a real compile instead of Inhdr because some Solaris systems
22150 : have stdbool.h, but it can only be used if the compiler indicates it
22151 : is sufficiently c99-compliant.
22152 echo " "
22153 $cat >try.c <<EOCP
22154 #include <stdio.h>
22155 #include <stdbool.h>
22156 int func(bool x)
22157 {
22158     return x ? 1 : 0;
22159 }
22160 int main(int argc, char **argv)
22161 {
22162     return func(0);
22163 }
22164 EOCP
22165 set try
22166 if eval $compile; then
22167         echo "<stdbool.h> found." >&4
22168         val="$define"
22169 else
22170         echo "<stdbool.h> NOT found." >&4
22171         val="$undef"
22172 fi
22173 $rm_try
22174 set i_stdbool
22175 eval $setvar
22176
22177 : see if stddef is available
22178 set stddef.h i_stddef
22179 eval $inhdr
22180
22181 : see if sys/access.h is available
22182 set sys/access.h i_sysaccess
22183 eval $inhdr
22184
22185 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22186 set sys/filio.h i_sysfilio
22187 eval $inhdr
22188 echo " "
22189 if $test `./findhdr sys/ioctl.h`; then
22190         val="$define"
22191         echo '<sys/ioctl.h> found.' >&4
22192 else
22193         val="$undef"
22194         if $test $i_sysfilio = "$define"; then
22195             echo '<sys/ioctl.h> NOT found.' >&4
22196         else
22197                 $test $i_sgtty = "$define" && xxx="sgtty.h"
22198                 $test $i_termio = "$define" && xxx="termio.h"
22199                 $test $i_termios = "$define" && xxx="termios.h"
22200 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22201         fi
22202 fi
22203 set i_sysioctl
22204 eval $setvar
22205
22206 : see if socket ioctl defs are in sys/sockio.h
22207 echo " "
22208 xxx=`./findhdr sys/sockio.h`
22209 if $test "$xxx"; then
22210         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22211                 val="$define"
22212                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22213         else
22214                 val="$undef"
22215                 echo "No socket ioctls found in <sys/sockio.h>." >&4
22216         fi
22217 else
22218         val="$undef"
22219         $cat <<EOM
22220 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22221 EOM
22222 fi
22223 set i_syssockio
22224 eval $setvar
22225
22226 : see if this is a syslog.h system
22227 set syslog.h i_syslog
22228 eval $inhdr
22229
22230 : see if this is a sys/mode.h system
22231 set sys/mode.h i_sysmode
22232 eval $inhdr
22233
22234 : see if there is a sys/poll.h file
22235 set sys/poll.h i_syspoll
22236 eval $inhdr
22237
22238 : see if sys/resource.h has to be included
22239 set sys/resource.h i_sysresrc
22240 eval $inhdr
22241
22242 : see if sys/security.h is available
22243 set sys/security.h i_syssecrt
22244 eval $inhdr
22245
22246 : see if this is a sys/statvfs.h system
22247 set sys/statvfs.h i_sysstatvfs
22248 eval $inhdr
22249
22250 : see if this is a sys/un.h system
22251 set sys/un.h i_sysun
22252 eval $inhdr
22253
22254 : see if this is a sys/utsname.h system
22255 set sys/utsname.h i_sysutsname
22256 eval $inhdr
22257
22258 : see if this is a syswait system
22259 set sys/wait.h i_syswait
22260 eval $inhdr
22261
22262 : see if this is a ustat.h system
22263 set ustat.h i_ustat
22264 eval $inhdr
22265
22266 : see if this is an utime system
22267 set utime.h i_utime
22268 eval $inhdr
22269
22270 : see if this is a vfork system
22271 case "$d_vfork" in
22272 "$define")
22273         set vfork.h i_vfork
22274         eval $inhdr
22275         ;;
22276 *)
22277         i_vfork="$undef"
22278         ;;
22279 esac
22280
22281 : Check extensions
22282 echo " "
22283 echo "Looking for extensions..." >&4
22284 : If we are using the old config.sh, known_extensions may contain
22285 : old or inaccurate or duplicate values.
22286 known_extensions=''
22287 nonxs_extensions=''
22288 : We do not use find because it might not be available.
22289 : We do not just use MANIFEST because the user may have dropped
22290 : some additional extensions into the source tree and expect them
22291 : to be built.
22292
22293 : Function to recursively find available extensions, ignoring DynaLoader
22294 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22295 : In 5.10.1 and later, extensions are stored in directories
22296 : like File-Glob instead of the older File/Glob/.
22297 find_extensions='
22298     for xxx in *; do
22299         case "$xxx" in
22300             DynaLoader|dynaload) ;;
22301             *)
22302             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22303             leaf=`echo $xxx | $sed -e s/.*-//`;
22304             if $test -d File; then
22305                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
22306                     known_extensions="$known_extensions $1$this_ext";
22307                 elif $test -f $xxx/Makefile.PL; then
22308                     nonxs_extensions="$nonxs_extensions $1$this_ext";
22309                 else
22310                     if $test -d $xxx -a $# -lt 10; then
22311                         set $1$xxx/ $*;
22312                         cd "$xxx";
22313                         eval $find_extensions;
22314                         cd ..;
22315                         shift;
22316                     fi;
22317                 fi;
22318             else
22319                 echo " $known_extensions $nonxs_extensions" > $$.tmp;
22320                 if $contains " $this_ext " $$.tmp; then
22321                     echo >&4;
22322                     echo "Duplicate directories detected for extension $xxx" >&4;
22323                     echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22324                     case "$knowitall" in
22325                     "") dflt=y;;
22326                     *) dflt=n;;
22327                     esac;
22328                     . ../UU/myread;
22329                     case "$ans" in
22330                     n*|N*) ;;
22331                     *) echo >&4;
22332                        echo "Ok.  Stopping Configure." >&4;
22333                        echo "Please remove the duplicate directory (eg using git clean) and then re-run Configure" >&4;
22334                         exit 1;;
22335                     esac;
22336                     echo "Ok.  You will need to correct config.sh before running make." >&4;
22337                 fi;
22338                 $ls -1 $xxx > $$.tmp;
22339                 if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
22340                     known_extensions="$known_extensions $this_ext";
22341                 elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
22342                     known_extensions="$known_extensions $this_ext";
22343                 elif $test -d $xxx; then
22344                     nonxs_extensions="$nonxs_extensions $this_ext";
22345                 fi;
22346                 $rm -f $$.tmp;
22347             fi
22348             ;;
22349         esac;
22350     done'
22351 tdir=`pwd`
22352 cd "$rsrc/cpan"
22353 set X
22354 shift
22355 eval $find_extensions
22356 cd "$rsrc/dist"
22357 set X
22358 shift
22359 eval $find_extensions
22360 cd "$rsrc/ext"
22361 set X
22362 shift
22363 eval $find_extensions
22364 if $test -d File-Glob; then
22365     : All ext/ flattened
22366 else
22367     # Special case:  Add in modules that nest beyond the first level.
22368     # Currently threads/shared and Hash/Util/FieldHash, since they are
22369     # not picked up by the recursive find above (and adding in general
22370     # recursive finding breaks SDBM_File/sdbm).
22371     # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
22372     known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
22373 fi
22374 set X $known_extensions
22375 shift
22376 known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22377 set X $nonxs_extensions
22378 shift
22379 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22380 cd "$tdir"
22381
22382 : Now see which are supported on this system.
22383 avail_ext=''
22384 for xxx in $known_extensions ; do
22385         case "$xxx" in
22386         DB_File|db_file)
22387                 case "$i_db" in
22388                 $define) avail_ext="$avail_ext $xxx" ;;
22389                 esac
22390                 ;;
22391         GDBM_File|gdbm_fil)
22392                 case "$i_gdbm" in
22393                 $define) avail_ext="$avail_ext $xxx" ;;
22394                 esac
22395                 ;;
22396         I18N/Langinfo|i18n_lan)
22397                 case "$i_langinfo$d_nl_langinfo" in
22398                 $define$define) avail_ext="$avail_ext $xxx" ;;
22399                 esac
22400                 ;;
22401         IPC/SysV|ipc/sysv)
22402                 : XXX Do we need a useipcsysv variable here
22403                 case "${d_msg}${d_sem}${d_shm}" in
22404                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22405                 esac
22406                 ;;
22407         NDBM_File|ndbm_fil)
22408                 case "$d_ndbm" in
22409                 $define)
22410                     case "$osname-$use64bitint" in
22411                     hpux-define)
22412                         case "$libs" in
22413                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22414                         esac
22415                         ;;
22416                     *) avail_ext="$avail_ext $xxx" ;;
22417                     esac
22418                     ;;
22419                 esac
22420                 ;;
22421         ODBM_File|odbm_fil)
22422                 case "${i_dbm}${i_rpcsvcdbm}" in
22423                 *"${define}"*)
22424                     case "$d_cplusplus" in
22425                     define) ;; # delete as a function name will not work
22426                     *)  case "$osname-$use64bitint" in
22427                         hpux-define)
22428                             case "$libs" in
22429                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22430                             esac
22431                             ;;
22432                         *) avail_ext="$avail_ext $xxx" ;;
22433                         esac
22434                         ;;
22435                     esac
22436                     ;;
22437                 esac
22438                 ;;
22439         Opcode|opcode)
22440                 case "$useopcode" in
22441                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22442                 esac
22443                 ;;
22444         POSIX|posix)
22445                 case "$useposix" in
22446                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22447                 esac
22448                 ;;
22449         Socket|socket)
22450                 case "$d_socket" in
22451                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22452                 esac
22453                 ;;
22454         Sys/Syslog|sys/syslog)
22455                 : XXX syslog requires socket
22456                 case "$d_socket" in
22457                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22458                 esac
22459                 ;;
22460         Thread|thread)
22461                 case "$usethreads" in
22462                 true|$define|y)
22463                         case "$use5005threads" in
22464                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22465                         esac
22466                 esac
22467                 ;;
22468         threads|threads/shared)
22469                 # threads and threads::shared are special cases.
22470                 # To stop people from asking "Perl 5.8.0 was supposed
22471                 # to have this new fancy threads implementation but my
22472                 # perl doesn't have it" and from people trying to
22473                 # (re)install the threads module using CPAN.pm and
22474                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22475                 # the threads.pm and threads/shared.pm will always be
22476                 # there, croaking informatively ("you need to rebuild
22477                 # all of Perl with threads, sorry") when threads haven't
22478                 # been compiled in.
22479                 # --jhi
22480                 avail_ext="$avail_ext $xxx"
22481                 ;;
22482         VMS*)
22483                 ;;
22484         Win32*)
22485                 case "$osname" in
22486                 cygwin) avail_ext="$avail_ext $xxx" ;;
22487                 esac
22488                 ;;
22489         XS/APItest|xs/apitest)
22490                 # This is just for testing.  Skip it unless we have dynamic loading.
22491
22492                 case "$usedl" in
22493                 $define) avail_ext="$avail_ext $xxx" ;;
22494                 esac
22495                 ;;
22496         XS/Typemap|xs/typemap)
22497                 # This is just for testing.  Skip it unless we have dynamic loading.
22498                 case "$usedl" in
22499                 $define) avail_ext="$avail_ext $xxx" ;;
22500                 esac
22501                 ;;
22502         *)      avail_ext="$avail_ext $xxx"
22503                 ;;
22504         esac
22505 done
22506
22507 set X $avail_ext
22508 shift
22509 avail_ext="$*"
22510
22511 case "$onlyextensions" in
22512 '') ;;
22513 *)  keepextensions=''
22514     echo "You have requested that only certain extensions be included..." >&4
22515     for i in $onlyextensions; do
22516         case " $avail_ext " in
22517         *" $i "*)
22518             echo "Keeping extension $i."
22519             keepextensions="$keepextensions $i"
22520             ;;
22521         *) echo "Ignoring extension $i." ;;
22522         esac
22523     done
22524     avail_ext="$keepextensions"
22525     ;;
22526 esac
22527
22528 case "$noextensions" in
22529 '') ;;
22530 *)  keepextensions=''
22531     echo "You have requested that certain extensions be ignored..." >&4
22532     for i in $avail_ext; do
22533         case " $noextensions " in
22534         *" $i "*) echo "Ignoring extension $i." ;;
22535         *) echo "Keeping extension $i.";
22536            keepextensions="$keepextensions $i"
22537            ;;
22538         esac
22539     done
22540     avail_ext="$keepextensions"
22541     ;;
22542 esac
22543
22544 : Now see which nonxs extensions are supported on this system.
22545 : For now assume all are.
22546 nonxs_ext=''
22547 for xxx in $nonxs_extensions ; do
22548         case "$xxx" in
22549         *)      nonxs_ext="$nonxs_ext $xxx"
22550                 ;;
22551         esac
22552 done
22553
22554 set X $nonxs_ext
22555 shift
22556 nonxs_ext="$*"
22557
22558 case $usedl in
22559 $define)
22560         $cat <<EOM
22561 A number of extensions are supplied with $package.  You may choose to
22562 compile these extensions for dynamic loading (the default), compile
22563 them into the $package executable (static loading), or not include
22564 them at all.  Answer "none" to include no extensions.
22565 Note that DynaLoader is always built and need not be mentioned here.
22566
22567 EOM
22568         case "$dynamic_ext" in
22569         '')
22570                 : Exclude those listed in static_ext
22571                 dflt=''
22572                 for xxx in $avail_ext; do
22573                         case " $static_ext " in
22574                         *" $xxx "*) ;;
22575                         *) dflt="$dflt $xxx" ;;
22576                         esac
22577                 done
22578                 set X $dflt
22579                 shift
22580                 dflt="$*"
22581                 ;;
22582         *)      dflt="$dynamic_ext"
22583                 # Perhaps we are reusing an old out-of-date config.sh.
22584                 case "$hint" in
22585                 previous)
22586                         if test X"$dynamic_ext" != X"$avail_ext"; then
22587                                 $cat <<EOM
22588 NOTICE:  Your previous config.sh list may be incorrect.
22589 The extensions now available to you are
22590         ${avail_ext}
22591 but the default list from your previous config.sh is
22592         ${dynamic_ext}
22593
22594 EOM
22595                         fi
22596                         ;;
22597                 esac
22598                 ;;
22599         esac
22600         case "$dflt" in
22601         '')     dflt=none;;
22602         esac
22603         rp="What extensions do you wish to load dynamically?"
22604         . ./myread
22605         case "$ans" in
22606         none) dynamic_ext=' ' ;;
22607         *) dynamic_ext="$ans" ;;
22608         esac
22609
22610         case "$static_ext" in
22611         '')
22612                 : Exclude those already listed in dynamic linking
22613                 dflt=''
22614                 for xxx in $avail_ext; do
22615                         case " $dynamic_ext " in
22616                         *" $xxx "*) ;;
22617                         *) dflt="$dflt $xxx" ;;
22618                         esac
22619                 done
22620                 set X $dflt
22621                 shift
22622                 dflt="$*"
22623                 ;;
22624         *)  dflt="$static_ext"
22625                 ;;
22626         esac
22627
22628         case "$dflt" in
22629         '')     dflt=none;;
22630         esac
22631         rp="What extensions do you wish to load statically?"
22632         . ./myread
22633         case "$ans" in
22634         none) static_ext=' ' ;;
22635         *) static_ext="$ans" ;;
22636         esac
22637         ;;
22638 *)
22639         $cat <<EOM
22640 A number of extensions are supplied with $package.  Answer "none"
22641 to include no extensions.
22642 Note that DynaLoader is always built and need not be mentioned here.
22643
22644 EOM
22645         case "$static_ext" in
22646         '') dflt="$avail_ext" ;;
22647         *)      dflt="$static_ext"
22648                 # Perhaps we are reusing an old out-of-date config.sh.
22649                 case "$hint" in
22650                 previous)
22651                         if test X"$static_ext" != X"$avail_ext"; then
22652                                 $cat <<EOM
22653 NOTICE:  Your previous config.sh list may be incorrect.
22654 The extensions now available to you are
22655         ${avail_ext}
22656 but the default list from your previous config.sh is
22657         ${static_ext}
22658
22659 EOM
22660                         fi
22661                         ;;
22662                 esac
22663                 ;;
22664         esac
22665         : Exclude those that are not xs extensions
22666         case "$dflt" in
22667         '')     dflt=none;;
22668         esac
22669         rp="What extensions do you wish to include?"
22670         . ./myread
22671         case "$ans" in
22672         none) static_ext=' ' ;;
22673         *) static_ext="$ans" ;;
22674         esac
22675         ;;
22676 esac
22677 #
22678 # Encode is a special case.  If we are building Encode as a static
22679 # extension, we need to explicitly list its subextensions as well.
22680 # For other nested extensions, this is handled automatically by
22681 # the appropriate Makefile.PL.
22682 case " $static_ext " in
22683         *" Encode "*) # Add the subextensions of Encode
22684         cd "$rsrc/cpan"
22685         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22686                 static_ext="$static_ext Encode/$xxx"
22687         done
22688         cd "$tdir"
22689         ;;
22690 esac
22691
22692 set X $dynamic_ext $static_ext $nonxs_ext
22693 shift
22694 extensions="$*"
22695
22696 # Sanity check:  We require an extension suitable for use with
22697 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22698 # should show up as failures in the test suite, but it's helpful to
22699 # catch them now.) The 'extensions' list is normally sorted
22700 # alphabetically, so we need to accept either
22701 #    DB_File ... Fcntl ... IO  ....
22702 # or something like
22703 #    Fcntl ... NDBM_File ... IO  ....
22704 case " $extensions"  in
22705 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22706 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22707 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22708 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22709    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22710    ;;
22711 esac
22712
22713 : Remove libraries needed only for extensions
22714 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22715 : The exception is SunOS 4.x, which needs them.
22716 case "${osname}X${osvers}" in
22717 sunos*X4*)
22718     perllibs="$libs"
22719     ;;
22720 *) case "$usedl" in
22721     $define|true|[yY]*)
22722             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
22723             shift
22724             perllibs="$*"
22725             ;;
22726     *)  perllibs="$libs"
22727             ;;
22728     esac
22729     ;;
22730 esac
22731
22732 : Remove build directory name from cppstdin so it can be used from
22733 : either the present location or the final installed location.
22734 echo " "
22735 : Get out of the UU directory to get correct path name.
22736 cd ..
22737 case "$cppstdin" in
22738 `pwd`/cppstdin)
22739         echo "Stripping down cppstdin path name"
22740         cppstdin=cppstdin
22741         ;;
22742 esac
22743 cd UU
22744
22745 : end of configuration questions
22746 echo " "
22747 echo "End of configuration questions."
22748 echo " "
22749
22750 : back to where it started
22751 if test -d ../UU; then
22752         cd ..
22753 fi
22754
22755 : configuration may be unconditionally patched via a 'config.arch' file
22756 if $test -f config.arch; then
22757         echo "I see a config.arch file, loading it." >&4
22758         . ./config.arch
22759 fi
22760
22761 : configuration may be patched via a 'config.over' file
22762 if $test -f config.over; then
22763         echo " "
22764         dflt=y
22765         rp='I see a config.over file.  Do you wish to load it?'
22766         . UU/myread
22767         case "$ans" in
22768         n*) echo "OK, I'll ignore it.";;
22769         *)      . ./config.over
22770                 echo "Configuration override changes have been loaded."
22771                 ;;
22772         esac
22773 fi
22774
22775 : in case they want portability, strip down executable paths
22776 case "$d_portable" in
22777 "$define")
22778         echo " "
22779         echo "Stripping down executable paths..." >&4
22780         for file in $loclist $trylist; do
22781                 eval temp=\$$file
22782                 eval $file=`basename $temp`
22783         done
22784         ;;
22785 esac
22786
22787 : create config.sh file
22788 echo " "
22789 echo "Creating config.sh..." >&4
22790 $spitshell <<EOT >config.sh
22791 $startsh
22792 #
22793 # This file was produced by running the Configure script. It holds all the
22794 # definitions figured out by Configure. Should you modify one of these values,
22795 # do not forget to propagate your changes by running "Configure -der". You may
22796 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22797 #
22798
22799 # Package name      : $package
22800 # Source directory  : $src
22801 # Configuration time: $cf_time
22802 # Configured by     : $cf_by
22803 # Target system     : $myuname
22804
22805 EOT
22806 : Add in command line options if available
22807 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22808
22809 $spitshell <<EOT >>config.sh
22810
22811 Author='$Author'
22812 Date='$Date'
22813 Header='$Header'
22814 Id='$Id'
22815 Locker='$Locker'
22816 Log='$Log'
22817 RCSfile='$RCSfile'
22818 Revision='$Revision'
22819 Source='$Source'
22820 State='$State'
22821 _a='$_a'
22822 _exe='$_exe'
22823 _o='$_o'
22824 afs='$afs'
22825 afsroot='$afsroot'
22826 alignbytes='$alignbytes'
22827 ansi2knr='$ansi2knr'
22828 aphostname='$aphostname'
22829 api_revision='$api_revision'
22830 api_subversion='$api_subversion'
22831 api_version='$api_version'
22832 api_versionstring='$api_versionstring'
22833 ar='$ar'
22834 archlib='$archlib'
22835 archlibexp='$archlibexp'
22836 archname64='$archname64'
22837 archname='$archname'
22838 archobjs='$archobjs'
22839 asctime_r_proto='$asctime_r_proto'
22840 awk='$awk'
22841 baserev='$baserev'
22842 bash='$bash'
22843 bin='$bin'
22844 bin_ELF='$bin_ELF'
22845 binexp='$binexp'
22846 bison='$bison'
22847 byacc='$byacc'
22848 byteorder='$byteorder'
22849 c='$c'
22850 castflags='$castflags'
22851 cat='$cat'
22852 cc='$cc'
22853 cccdlflags='$cccdlflags'
22854 ccdlflags='$ccdlflags'
22855 ccflags='$ccflags'
22856 ccflags_uselargefiles='$ccflags_uselargefiles'
22857 ccname='$ccname'
22858 ccsymbols='$ccsymbols'
22859 ccversion='$ccversion'
22860 cf_by='$cf_by'
22861 cf_email='$cf_email'
22862 cf_time='$cf_time'
22863 charbits='$charbits'
22864 charsize='$charsize'
22865 chgrp='$chgrp'
22866 chmod='$chmod'
22867 chown='$chown'
22868 clocktype='$clocktype'
22869 comm='$comm'
22870 compress='$compress'
22871 contains='$contains'
22872 cp='$cp'
22873 cpio='$cpio'
22874 cpp='$cpp'
22875 cpp_stuff='$cpp_stuff'
22876 cppccsymbols='$cppccsymbols'
22877 cppflags='$cppflags'
22878 cpplast='$cpplast'
22879 cppminus='$cppminus'
22880 cpprun='$cpprun'
22881 cppstdin='$cppstdin'
22882 cppsymbols='$cppsymbols'
22883 crypt_r_proto='$crypt_r_proto'
22884 cryptlib='$cryptlib'
22885 csh='$csh'
22886 ctermid_r_proto='$ctermid_r_proto'
22887 ctime_r_proto='$ctime_r_proto'
22888 d_Gconvert='$d_Gconvert'
22889 d_PRIEUldbl='$d_PRIEUldbl'
22890 d_PRIFUldbl='$d_PRIFUldbl'
22891 d_PRIGUldbl='$d_PRIGUldbl'
22892 d_PRIXU64='$d_PRIXU64'
22893 d_PRId64='$d_PRId64'
22894 d_PRIeldbl='$d_PRIeldbl'
22895 d_PRIfldbl='$d_PRIfldbl'
22896 d_PRIgldbl='$d_PRIgldbl'
22897 d_PRIi64='$d_PRIi64'
22898 d_PRIo64='$d_PRIo64'
22899 d_PRIu64='$d_PRIu64'
22900 d_PRIx64='$d_PRIx64'
22901 d_SCNfldbl='$d_SCNfldbl'
22902 d__fwalk='$d__fwalk'
22903 d_access='$d_access'
22904 d_accessx='$d_accessx'
22905 d_aintl='$d_aintl'
22906 d_alarm='$d_alarm'
22907 d_archlib='$d_archlib'
22908 d_asctime64='$d_asctime64'
22909 d_asctime_r='$d_asctime_r'
22910 d_atolf='$d_atolf'
22911 d_atoll='$d_atoll'
22912 d_attribute_deprecated='$d_attribute_deprecated'
22913 d_attribute_format='$d_attribute_format'
22914 d_attribute_malloc='$d_attribute_malloc'
22915 d_attribute_nonnull='$d_attribute_nonnull'
22916 d_attribute_noreturn='$d_attribute_noreturn'
22917 d_attribute_pure='$d_attribute_pure'
22918 d_attribute_unused='$d_attribute_unused'
22919 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22920 d_bcmp='$d_bcmp'
22921 d_bcopy='$d_bcopy'
22922 d_bsd='$d_bsd'
22923 d_bsdgetpgrp='$d_bsdgetpgrp'
22924 d_bsdsetpgrp='$d_bsdsetpgrp'
22925 d_builtin_choose_expr='$d_builtin_choose_expr'
22926 d_builtin_expect='$d_builtin_expect'
22927 d_bzero='$d_bzero'
22928 d_c99_variadic_macros='$d_c99_variadic_macros'
22929 d_casti32='$d_casti32'
22930 d_castneg='$d_castneg'
22931 d_charvspr='$d_charvspr'
22932 d_chown='$d_chown'
22933 d_chroot='$d_chroot'
22934 d_chsize='$d_chsize'
22935 d_class='$d_class'
22936 d_clearenv='$d_clearenv'
22937 d_closedir='$d_closedir'
22938 d_cmsghdr_s='$d_cmsghdr_s'
22939 d_const='$d_const'
22940 d_copysignl='$d_copysignl'
22941 d_cplusplus='$d_cplusplus'
22942 d_crypt='$d_crypt'
22943 d_crypt_r='$d_crypt_r'
22944 d_csh='$d_csh'
22945 d_ctermid='$d_ctermid'
22946 d_ctermid_r='$d_ctermid_r'
22947 d_ctime64='$d_ctime64'
22948 d_ctime_r='$d_ctime_r'
22949 d_cuserid='$d_cuserid'
22950 d_dbl_dig='$d_dbl_dig'
22951 d_dbminitproto='$d_dbminitproto'
22952 d_difftime64='$d_difftime64'
22953 d_difftime='$d_difftime'
22954 d_dir_dd_fd='$d_dir_dd_fd'
22955 d_dirfd='$d_dirfd'
22956 d_dirnamlen='$d_dirnamlen'
22957 d_dlerror='$d_dlerror'
22958 d_dlopen='$d_dlopen'
22959 d_dlsymun='$d_dlsymun'
22960 d_dosuid='$d_dosuid'
22961 d_drand48_r='$d_drand48_r'
22962 d_drand48proto='$d_drand48proto'
22963 d_dup2='$d_dup2'
22964 d_eaccess='$d_eaccess'
22965 d_endgrent='$d_endgrent'
22966 d_endgrent_r='$d_endgrent_r'
22967 d_endhent='$d_endhent'
22968 d_endhostent_r='$d_endhostent_r'
22969 d_endnent='$d_endnent'
22970 d_endnetent_r='$d_endnetent_r'
22971 d_endpent='$d_endpent'
22972 d_endprotoent_r='$d_endprotoent_r'
22973 d_endpwent='$d_endpwent'
22974 d_endpwent_r='$d_endpwent_r'
22975 d_endsent='$d_endsent'
22976 d_endservent_r='$d_endservent_r'
22977 d_eofnblk='$d_eofnblk'
22978 d_eunice='$d_eunice'
22979 d_faststdio='$d_faststdio'
22980 d_fchdir='$d_fchdir'
22981 d_fchmod='$d_fchmod'
22982 d_fchown='$d_fchown'
22983 d_fcntl='$d_fcntl'
22984 d_fcntl_can_lock='$d_fcntl_can_lock'
22985 d_fd_macros='$d_fd_macros'
22986 d_fd_set='$d_fd_set'
22987 d_fds_bits='$d_fds_bits'
22988 d_fgetpos='$d_fgetpos'
22989 d_finite='$d_finite'
22990 d_finitel='$d_finitel'
22991 d_flexfnam='$d_flexfnam'
22992 d_flock='$d_flock'
22993 d_flockproto='$d_flockproto'
22994 d_fork='$d_fork'
22995 d_fp_class='$d_fp_class'
22996 d_fpathconf='$d_fpathconf'
22997 d_fpclass='$d_fpclass'
22998 d_fpclassify='$d_fpclassify'
22999 d_fpclassl='$d_fpclassl'
23000 d_fpos64_t='$d_fpos64_t'
23001 d_frexpl='$d_frexpl'
23002 d_fs_data_s='$d_fs_data_s'
23003 d_fseeko='$d_fseeko'
23004 d_fsetpos='$d_fsetpos'
23005 d_fstatfs='$d_fstatfs'
23006 d_fstatvfs='$d_fstatvfs'
23007 d_fsync='$d_fsync'
23008 d_ftello='$d_ftello'
23009 d_ftime='$d_ftime'
23010 d_futimes='$d_futimes'
23011 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23012 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23013 d_getaddrinfo='$d_getaddrinfo'
23014 d_getcwd='$d_getcwd'
23015 d_getespwnam='$d_getespwnam'
23016 d_getfsstat='$d_getfsstat'
23017 d_getgrent='$d_getgrent'
23018 d_getgrent_r='$d_getgrent_r'
23019 d_getgrgid_r='$d_getgrgid_r'
23020 d_getgrnam_r='$d_getgrnam_r'
23021 d_getgrps='$d_getgrps'
23022 d_gethbyaddr='$d_gethbyaddr'
23023 d_gethbyname='$d_gethbyname'
23024 d_gethent='$d_gethent'
23025 d_gethname='$d_gethname'
23026 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23027 d_gethostbyname_r='$d_gethostbyname_r'
23028 d_gethostent_r='$d_gethostent_r'
23029 d_gethostprotos='$d_gethostprotos'
23030 d_getitimer='$d_getitimer'
23031 d_getlogin='$d_getlogin'
23032 d_getlogin_r='$d_getlogin_r'
23033 d_getmnt='$d_getmnt'
23034 d_getmntent='$d_getmntent'
23035 d_getnameinfo='$d_getnameinfo'
23036 d_getnbyaddr='$d_getnbyaddr'
23037 d_getnbyname='$d_getnbyname'
23038 d_getnent='$d_getnent'
23039 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23040 d_getnetbyname_r='$d_getnetbyname_r'
23041 d_getnetent_r='$d_getnetent_r'
23042 d_getnetprotos='$d_getnetprotos'
23043 d_getpagsz='$d_getpagsz'
23044 d_getpbyname='$d_getpbyname'
23045 d_getpbynumber='$d_getpbynumber'
23046 d_getpent='$d_getpent'
23047 d_getpgid='$d_getpgid'
23048 d_getpgrp2='$d_getpgrp2'
23049 d_getpgrp='$d_getpgrp'
23050 d_getppid='$d_getppid'
23051 d_getprior='$d_getprior'
23052 d_getprotobyname_r='$d_getprotobyname_r'
23053 d_getprotobynumber_r='$d_getprotobynumber_r'
23054 d_getprotoent_r='$d_getprotoent_r'
23055 d_getprotoprotos='$d_getprotoprotos'
23056 d_getprpwnam='$d_getprpwnam'
23057 d_getpwent='$d_getpwent'
23058 d_getpwent_r='$d_getpwent_r'
23059 d_getpwnam_r='$d_getpwnam_r'
23060 d_getpwuid_r='$d_getpwuid_r'
23061 d_getsbyname='$d_getsbyname'
23062 d_getsbyport='$d_getsbyport'
23063 d_getsent='$d_getsent'
23064 d_getservbyname_r='$d_getservbyname_r'
23065 d_getservbyport_r='$d_getservbyport_r'
23066 d_getservent_r='$d_getservent_r'
23067 d_getservprotos='$d_getservprotos'
23068 d_getspnam='$d_getspnam'
23069 d_getspnam_r='$d_getspnam_r'
23070 d_gettimeod='$d_gettimeod'
23071 d_gmtime64='$d_gmtime64'
23072 d_gmtime_r='$d_gmtime_r'
23073 d_gnulibc='$d_gnulibc'
23074 d_grpasswd='$d_grpasswd'
23075 d_hasmntopt='$d_hasmntopt'
23076 d_htonl='$d_htonl'
23077 d_ilogbl='$d_ilogbl'
23078 d_inc_version_list='$d_inc_version_list'
23079 d_index='$d_index'
23080 d_inetaton='$d_inetaton'
23081 d_inetntop='$d_inetntop'
23082 d_inetpton='$d_inetpton'
23083 d_int64_t='$d_int64_t'
23084 d_ip_mreq='$d_ip_mreq'
23085 d_ip_mreq_source='$d_ip_mreq_source'
23086 d_ipv6_mreq='$d_ipv6_mreq'
23087 d_ipv6_mreq_source='$d_ipv6_mreq_source'
23088 d_isascii='$d_isascii'
23089 d_isblank='$d_isblank'
23090 d_isfinite='$d_isfinite'
23091 d_isinf='$d_isinf'
23092 d_isnan='$d_isnan'
23093 d_isnanl='$d_isnanl'
23094 d_killpg='$d_killpg'
23095 d_lchown='$d_lchown'
23096 d_ldbl_dig='$d_ldbl_dig'
23097 d_libm_lib_version='$d_libm_lib_version'
23098 d_link='$d_link'
23099 d_localtime64='$d_localtime64'
23100 d_localtime_r='$d_localtime_r'
23101 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
23102 d_locconv='$d_locconv'
23103 d_lockf='$d_lockf'
23104 d_longdbl='$d_longdbl'
23105 d_longlong='$d_longlong'
23106 d_lseekproto='$d_lseekproto'
23107 d_lstat='$d_lstat'
23108 d_madvise='$d_madvise'
23109 d_malloc_good_size='$d_malloc_good_size'
23110 d_malloc_size='$d_malloc_size'
23111 d_mblen='$d_mblen'
23112 d_mbstowcs='$d_mbstowcs'
23113 d_mbtowc='$d_mbtowc'
23114 d_memchr='$d_memchr'
23115 d_memcmp='$d_memcmp'
23116 d_memcpy='$d_memcpy'
23117 d_memmove='$d_memmove'
23118 d_memset='$d_memset'
23119 d_mkdir='$d_mkdir'
23120 d_mkdtemp='$d_mkdtemp'
23121 d_mkfifo='$d_mkfifo'
23122 d_mkstemp='$d_mkstemp'
23123 d_mkstemps='$d_mkstemps'
23124 d_mktime64='$d_mktime64'
23125 d_mktime='$d_mktime'
23126 d_mmap='$d_mmap'
23127 d_modfl='$d_modfl'
23128 d_modfl_pow32_bug='$d_modfl_pow32_bug'
23129 d_modflproto='$d_modflproto'
23130 d_mprotect='$d_mprotect'
23131 d_msg='$d_msg'
23132 d_msg_ctrunc='$d_msg_ctrunc'
23133 d_msg_dontroute='$d_msg_dontroute'
23134 d_msg_oob='$d_msg_oob'
23135 d_msg_peek='$d_msg_peek'
23136 d_msg_proxy='$d_msg_proxy'
23137 d_msgctl='$d_msgctl'
23138 d_msgget='$d_msgget'
23139 d_msghdr_s='$d_msghdr_s'
23140 d_msgrcv='$d_msgrcv'
23141 d_msgsnd='$d_msgsnd'
23142 d_msync='$d_msync'
23143 d_munmap='$d_munmap'
23144 d_mymalloc='$d_mymalloc'
23145 d_ndbm='$d_ndbm'
23146 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
23147 d_nice='$d_nice'
23148 d_nl_langinfo='$d_nl_langinfo'
23149 d_nv_preserves_uv='$d_nv_preserves_uv'
23150 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
23151 d_off64_t='$d_off64_t'
23152 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23153 d_oldpthreads='$d_oldpthreads'
23154 d_oldsock='$d_oldsock'
23155 d_open3='$d_open3'
23156 d_pathconf='$d_pathconf'
23157 d_pause='$d_pause'
23158 d_perl_otherlibdirs='$d_perl_otherlibdirs'
23159 d_phostname='$d_phostname'
23160 d_pipe='$d_pipe'
23161 d_poll='$d_poll'
23162 d_portable='$d_portable'
23163 d_prctl='$d_prctl'
23164 d_prctl_set_name='$d_prctl_set_name'
23165 d_printf_format_null='$d_printf_format_null'
23166 d_procselfexe='$d_procselfexe'
23167 d_pseudofork='$d_pseudofork'
23168 d_pthread_atfork='$d_pthread_atfork'
23169 d_pthread_attr_setscope='$d_pthread_attr_setscope'
23170 d_pthread_yield='$d_pthread_yield'
23171 d_pwage='$d_pwage'
23172 d_pwchange='$d_pwchange'
23173 d_pwclass='$d_pwclass'
23174 d_pwcomment='$d_pwcomment'
23175 d_pwexpire='$d_pwexpire'
23176 d_pwgecos='$d_pwgecos'
23177 d_pwpasswd='$d_pwpasswd'
23178 d_pwquota='$d_pwquota'
23179 d_qgcvt='$d_qgcvt'
23180 d_quad='$d_quad'
23181 d_random_r='$d_random_r'
23182 d_readdir64_r='$d_readdir64_r'
23183 d_readdir='$d_readdir'
23184 d_readdir_r='$d_readdir_r'
23185 d_readlink='$d_readlink'
23186 d_readv='$d_readv'
23187 d_recvmsg='$d_recvmsg'
23188 d_rename='$d_rename'
23189 d_rewinddir='$d_rewinddir'
23190 d_rmdir='$d_rmdir'
23191 d_safebcpy='$d_safebcpy'
23192 d_safemcpy='$d_safemcpy'
23193 d_sanemcmp='$d_sanemcmp'
23194 d_sbrkproto='$d_sbrkproto'
23195 d_scalbnl='$d_scalbnl'
23196 d_sched_yield='$d_sched_yield'
23197 d_scm_rights='$d_scm_rights'
23198 d_seekdir='$d_seekdir'
23199 d_select='$d_select'
23200 d_sem='$d_sem'
23201 d_semctl='$d_semctl'
23202 d_semctl_semid_ds='$d_semctl_semid_ds'
23203 d_semctl_semun='$d_semctl_semun'
23204 d_semget='$d_semget'
23205 d_semop='$d_semop'
23206 d_sendmsg='$d_sendmsg'
23207 d_setegid='$d_setegid'
23208 d_seteuid='$d_seteuid'
23209 d_setgrent='$d_setgrent'
23210 d_setgrent_r='$d_setgrent_r'
23211 d_setgrps='$d_setgrps'
23212 d_sethent='$d_sethent'
23213 d_sethostent_r='$d_sethostent_r'
23214 d_setitimer='$d_setitimer'
23215 d_setlinebuf='$d_setlinebuf'
23216 d_setlocale='$d_setlocale'
23217 d_setlocale_r='$d_setlocale_r'
23218 d_setnent='$d_setnent'
23219 d_setnetent_r='$d_setnetent_r'
23220 d_setpent='$d_setpent'
23221 d_setpgid='$d_setpgid'
23222 d_setpgrp2='$d_setpgrp2'
23223 d_setpgrp='$d_setpgrp'
23224 d_setprior='$d_setprior'
23225 d_setproctitle='$d_setproctitle'
23226 d_setprotoent_r='$d_setprotoent_r'
23227 d_setpwent='$d_setpwent'
23228 d_setpwent_r='$d_setpwent_r'
23229 d_setregid='$d_setregid'
23230 d_setresgid='$d_setresgid'
23231 d_setresuid='$d_setresuid'
23232 d_setreuid='$d_setreuid'
23233 d_setrgid='$d_setrgid'
23234 d_setruid='$d_setruid'
23235 d_setsent='$d_setsent'
23236 d_setservent_r='$d_setservent_r'
23237 d_setsid='$d_setsid'
23238 d_setvbuf='$d_setvbuf'
23239 d_sfio='$d_sfio'
23240 d_shm='$d_shm'
23241 d_shmat='$d_shmat'
23242 d_shmatprototype='$d_shmatprototype'
23243 d_shmctl='$d_shmctl'
23244 d_shmdt='$d_shmdt'
23245 d_shmget='$d_shmget'
23246 d_sigaction='$d_sigaction'
23247 d_signbit='$d_signbit'
23248 d_sigprocmask='$d_sigprocmask'
23249 d_sigsetjmp='$d_sigsetjmp'
23250 d_sin6_scope_id='$d_sin6_scope_id'
23251 d_sitearch='$d_sitearch'
23252 d_snprintf='$d_snprintf'
23253 d_sockaddr_in6='$d_sockaddr_in6'
23254 d_sockaddr_sa_len='$d_sockaddr_sa_len'
23255 d_sockatmark='$d_sockatmark'
23256 d_sockatmarkproto='$d_sockatmarkproto'
23257 d_socket='$d_socket'
23258 d_socklen_t='$d_socklen_t'
23259 d_sockpair='$d_sockpair'
23260 d_socks5_init='$d_socks5_init'
23261 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23262 d_sqrtl='$d_sqrtl'
23263 d_srand48_r='$d_srand48_r'
23264 d_srandom_r='$d_srandom_r'
23265 d_sresgproto='$d_sresgproto'
23266 d_sresuproto='$d_sresuproto'
23267 d_statblks='$d_statblks'
23268 d_statfs_f_flags='$d_statfs_f_flags'
23269 d_statfs_s='$d_statfs_s'
23270 d_static_inline='$d_static_inline'
23271 d_statvfs='$d_statvfs'
23272 d_stdio_cnt_lval='$d_stdio_cnt_lval'
23273 d_stdio_ptr_lval='$d_stdio_ptr_lval'
23274 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23275 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23276 d_stdio_stream_array='$d_stdio_stream_array'
23277 d_stdiobase='$d_stdiobase'
23278 d_stdstdio='$d_stdstdio'
23279 d_strchr='$d_strchr'
23280 d_strcoll='$d_strcoll'
23281 d_strctcpy='$d_strctcpy'
23282 d_strerrm='$d_strerrm'
23283 d_strerror='$d_strerror'
23284 d_strerror_r='$d_strerror_r'
23285 d_strftime='$d_strftime'
23286 d_strlcat='$d_strlcat'
23287 d_strlcpy='$d_strlcpy'
23288 d_strtod='$d_strtod'
23289 d_strtol='$d_strtol'
23290 d_strtold='$d_strtold'
23291 d_strtoll='$d_strtoll'
23292 d_strtoq='$d_strtoq'
23293 d_strtoul='$d_strtoul'
23294 d_strtoull='$d_strtoull'
23295 d_strtouq='$d_strtouq'
23296 d_strxfrm='$d_strxfrm'
23297 d_suidsafe='$d_suidsafe'
23298 d_symlink='$d_symlink'
23299 d_syscall='$d_syscall'
23300 d_syscallproto='$d_syscallproto'
23301 d_sysconf='$d_sysconf'
23302 d_sysernlst='$d_sysernlst'
23303 d_syserrlst='$d_syserrlst'
23304 d_system='$d_system'
23305 d_tcgetpgrp='$d_tcgetpgrp'
23306 d_tcsetpgrp='$d_tcsetpgrp'
23307 d_telldir='$d_telldir'
23308 d_telldirproto='$d_telldirproto'
23309 d_time='$d_time'
23310 d_timegm='$d_timegm'
23311 d_times='$d_times'
23312 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23313 d_tm_tm_zone='$d_tm_tm_zone'
23314 d_tmpnam_r='$d_tmpnam_r'
23315 d_truncate='$d_truncate'
23316 d_ttyname_r='$d_ttyname_r'
23317 d_tzname='$d_tzname'
23318 d_u32align='$d_u32align'
23319 d_ualarm='$d_ualarm'
23320 d_umask='$d_umask'
23321 d_uname='$d_uname'
23322 d_union_semun='$d_union_semun'
23323 d_unordered='$d_unordered'
23324 d_unsetenv='$d_unsetenv'
23325 d_usleep='$d_usleep'
23326 d_usleepproto='$d_usleepproto'
23327 d_ustat='$d_ustat'
23328 d_vendorarch='$d_vendorarch'
23329 d_vendorbin='$d_vendorbin'
23330 d_vendorlib='$d_vendorlib'
23331 d_vendorscript='$d_vendorscript'
23332 d_vfork='$d_vfork'
23333 d_void_closedir='$d_void_closedir'
23334 d_voidsig='$d_voidsig'
23335 d_voidtty='$d_voidtty'
23336 d_volatile='$d_volatile'
23337 d_vprintf='$d_vprintf'
23338 d_vsnprintf='$d_vsnprintf'
23339 d_wait4='$d_wait4'
23340 d_waitpid='$d_waitpid'
23341 d_wcstombs='$d_wcstombs'
23342 d_wctomb='$d_wctomb'
23343 d_writev='$d_writev'
23344 d_xenix='$d_xenix'
23345 date='$date'
23346 db_hashtype='$db_hashtype'
23347 db_prefixtype='$db_prefixtype'
23348 db_version_major='$db_version_major'
23349 db_version_minor='$db_version_minor'
23350 db_version_patch='$db_version_patch'
23351 defvoidused='$defvoidused'
23352 direntrytype='$direntrytype'
23353 dlext='$dlext'
23354 dlsrc='$dlsrc'
23355 doublesize='$doublesize'
23356 drand01='$drand01'
23357 drand48_r_proto='$drand48_r_proto'
23358 dtrace='$dtrace'
23359 dynamic_ext='$dynamic_ext'
23360 eagain='$eagain'
23361 ebcdic='$ebcdic'
23362 echo='$echo'
23363 egrep='$egrep'
23364 emacs='$emacs'
23365 endgrent_r_proto='$endgrent_r_proto'
23366 endhostent_r_proto='$endhostent_r_proto'
23367 endnetent_r_proto='$endnetent_r_proto'
23368 endprotoent_r_proto='$endprotoent_r_proto'
23369 endpwent_r_proto='$endpwent_r_proto'
23370 endservent_r_proto='$endservent_r_proto'
23371 eunicefix='$eunicefix'
23372 exe_ext='$exe_ext'
23373 expr='$expr'
23374 extensions='$extensions'
23375 extern_C='$extern_C'
23376 extras='$extras'
23377 fflushNULL='$fflushNULL'
23378 fflushall='$fflushall'
23379 find='$find'
23380 firstmakefile='$firstmakefile'
23381 flex='$flex'
23382 fpossize='$fpossize'
23383 fpostype='$fpostype'
23384 freetype='$freetype'
23385 from='$from'
23386 full_ar='$full_ar'
23387 full_csh='$full_csh'
23388 full_sed='$full_sed'
23389 gccansipedantic='$gccansipedantic'
23390 gccosandvers='$gccosandvers'
23391 gccversion='$gccversion'
23392 getgrent_r_proto='$getgrent_r_proto'
23393 getgrgid_r_proto='$getgrgid_r_proto'
23394 getgrnam_r_proto='$getgrnam_r_proto'
23395 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23396 gethostbyname_r_proto='$gethostbyname_r_proto'
23397 gethostent_r_proto='$gethostent_r_proto'
23398 getlogin_r_proto='$getlogin_r_proto'
23399 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23400 getnetbyname_r_proto='$getnetbyname_r_proto'
23401 getnetent_r_proto='$getnetent_r_proto'
23402 getprotobyname_r_proto='$getprotobyname_r_proto'
23403 getprotobynumber_r_proto='$getprotobynumber_r_proto'
23404 getprotoent_r_proto='$getprotoent_r_proto'
23405 getpwent_r_proto='$getpwent_r_proto'
23406 getpwnam_r_proto='$getpwnam_r_proto'
23407 getpwuid_r_proto='$getpwuid_r_proto'
23408 getservbyname_r_proto='$getservbyname_r_proto'
23409 getservbyport_r_proto='$getservbyport_r_proto'
23410 getservent_r_proto='$getservent_r_proto'
23411 getspnam_r_proto='$getspnam_r_proto'
23412 gidformat='$gidformat'
23413 gidsign='$gidsign'
23414 gidsize='$gidsize'
23415 gidtype='$gidtype'
23416 glibpth='$glibpth'
23417 gmake='$gmake'
23418 gmtime_r_proto='$gmtime_r_proto'
23419 gnulibc_version='$gnulibc_version'
23420 grep='$grep'
23421 groupcat='$groupcat'
23422 groupstype='$groupstype'
23423 gzip='$gzip'
23424 h_fcntl='$h_fcntl'
23425 h_sysfile='$h_sysfile'
23426 hint='$hint'
23427 hostcat='$hostcat'
23428 html1dir='$html1dir'
23429 html1direxp='$html1direxp'
23430 html3dir='$html3dir'
23431 html3direxp='$html3direxp'
23432 i16size='$i16size'
23433 i16type='$i16type'
23434 i32size='$i32size'
23435 i32type='$i32type'
23436 i64size='$i64size'
23437 i64type='$i64type'
23438 i8size='$i8size'
23439 i8type='$i8type'
23440 i_arpainet='$i_arpainet'
23441 i_assert='$i_assert'
23442 i_bsdioctl='$i_bsdioctl'
23443 i_crypt='$i_crypt'
23444 i_db='$i_db'
23445 i_dbm='$i_dbm'
23446 i_dirent='$i_dirent'
23447 i_dld='$i_dld'
23448 i_dlfcn='$i_dlfcn'
23449 i_fcntl='$i_fcntl'
23450 i_float='$i_float'
23451 i_fp='$i_fp'
23452 i_fp_class='$i_fp_class'
23453 i_gdbm='$i_gdbm'
23454 i_gdbm_ndbm='$i_gdbm_ndbm'
23455 i_gdbmndbm='$i_gdbmndbm'
23456 i_grp='$i_grp'
23457 i_ieeefp='$i_ieeefp'
23458 i_inttypes='$i_inttypes'
23459 i_langinfo='$i_langinfo'
23460 i_libutil='$i_libutil'
23461 i_limits='$i_limits'
23462 i_locale='$i_locale'
23463 i_machcthr='$i_machcthr'
23464 i_malloc='$i_malloc'
23465 i_mallocmalloc='$i_mallocmalloc'
23466 i_math='$i_math'
23467 i_memory='$i_memory'
23468 i_mntent='$i_mntent'
23469 i_ndbm='$i_ndbm'
23470 i_netdb='$i_netdb'
23471 i_neterrno='$i_neterrno'
23472 i_netinettcp='$i_netinettcp'
23473 i_niin='$i_niin'
23474 i_poll='$i_poll'
23475 i_prot='$i_prot'
23476 i_pthread='$i_pthread'
23477 i_pwd='$i_pwd'
23478 i_rpcsvcdbm='$i_rpcsvcdbm'
23479 i_sfio='$i_sfio'
23480 i_sgtty='$i_sgtty'
23481 i_shadow='$i_shadow'
23482 i_socks='$i_socks'
23483 i_stdarg='$i_stdarg'
23484 i_stdbool='$i_stdbool'
23485 i_stddef='$i_stddef'
23486 i_stdlib='$i_stdlib'
23487 i_string='$i_string'
23488 i_sunmath='$i_sunmath'
23489 i_sysaccess='$i_sysaccess'
23490 i_sysdir='$i_sysdir'
23491 i_sysfile='$i_sysfile'
23492 i_sysfilio='$i_sysfilio'
23493 i_sysin='$i_sysin'
23494 i_sysioctl='$i_sysioctl'
23495 i_syslog='$i_syslog'
23496 i_sysmman='$i_sysmman'
23497 i_sysmode='$i_sysmode'
23498 i_sysmount='$i_sysmount'
23499 i_sysndir='$i_sysndir'
23500 i_sysparam='$i_sysparam'
23501 i_syspoll='$i_syspoll'
23502 i_sysresrc='$i_sysresrc'
23503 i_syssecrt='$i_syssecrt'
23504 i_sysselct='$i_sysselct'
23505 i_syssockio='$i_syssockio'
23506 i_sysstat='$i_sysstat'
23507 i_sysstatfs='$i_sysstatfs'
23508 i_sysstatvfs='$i_sysstatvfs'
23509 i_systime='$i_systime'
23510 i_systimek='$i_systimek'
23511 i_systimes='$i_systimes'
23512 i_systypes='$i_systypes'
23513 i_sysuio='$i_sysuio'
23514 i_sysun='$i_sysun'
23515 i_sysutsname='$i_sysutsname'
23516 i_sysvfs='$i_sysvfs'
23517 i_syswait='$i_syswait'
23518 i_termio='$i_termio'
23519 i_termios='$i_termios'
23520 i_time='$i_time'
23521 i_unistd='$i_unistd'
23522 i_ustat='$i_ustat'
23523 i_utime='$i_utime'
23524 i_values='$i_values'
23525 i_varargs='$i_varargs'
23526 i_varhdr='$i_varhdr'
23527 i_vfork='$i_vfork'
23528 ignore_versioned_solibs='$ignore_versioned_solibs'
23529 inc_version_list='$inc_version_list'
23530 inc_version_list_init='$inc_version_list_init'
23531 incpath='$incpath'
23532 inews='$inews'
23533 initialinstalllocation='$initialinstalllocation'
23534 installarchlib='$installarchlib'
23535 installbin='$installbin'
23536 installhtml1dir='$installhtml1dir'
23537 installhtml3dir='$installhtml3dir'
23538 installman1dir='$installman1dir'
23539 installman3dir='$installman3dir'
23540 installprefix='$installprefix'
23541 installprefixexp='$installprefixexp'
23542 installprivlib='$installprivlib'
23543 installscript='$installscript'
23544 installsitearch='$installsitearch'
23545 installsitebin='$installsitebin'
23546 installsitehtml1dir='$installsitehtml1dir'
23547 installsitehtml3dir='$installsitehtml3dir'
23548 installsitelib='$installsitelib'
23549 installsiteman1dir='$installsiteman1dir'
23550 installsiteman3dir='$installsiteman3dir'
23551 installsitescript='$installsitescript'
23552 installstyle='$installstyle'
23553 installusrbinperl='$installusrbinperl'
23554 installvendorarch='$installvendorarch'
23555 installvendorbin='$installvendorbin'
23556 installvendorhtml1dir='$installvendorhtml1dir'
23557 installvendorhtml3dir='$installvendorhtml3dir'
23558 installvendorlib='$installvendorlib'
23559 installvendorman1dir='$installvendorman1dir'
23560 installvendorman3dir='$installvendorman3dir'
23561 installvendorscript='$installvendorscript'
23562 intsize='$intsize'
23563 issymlink='$issymlink'
23564 ivdformat='$ivdformat'
23565 ivsize='$ivsize'
23566 ivtype='$ivtype'
23567 known_extensions='$known_extensions'
23568 ksh='$ksh'
23569 ld='$ld'
23570 ld_can_script='$ld_can_script'
23571 lddlflags='$lddlflags'
23572 ldflags='$ldflags'
23573 ldflags_uselargefiles='$ldflags_uselargefiles'
23574 ldlibpthname='$ldlibpthname'
23575 less='$less'
23576 lib_ext='$lib_ext'
23577 libc='$libc'
23578 libperl='$libperl'
23579 libpth='$libpth'
23580 libs='$libs'
23581 libsdirs='$libsdirs'
23582 libsfiles='$libsfiles'
23583 libsfound='$libsfound'
23584 libspath='$libspath'
23585 libswanted='$libswanted'
23586 libswanted_uselargefiles='$libswanted_uselargefiles'
23587 line='$line'
23588 lint='$lint'
23589 lkflags='$lkflags'
23590 ln='$ln'
23591 lns='$lns'
23592 localtime_r_proto='$localtime_r_proto'
23593 locincpth='$locincpth'
23594 loclibpth='$loclibpth'
23595 longdblsize='$longdblsize'
23596 longlongsize='$longlongsize'
23597 longsize='$longsize'
23598 lp='$lp'
23599 lpr='$lpr'
23600 ls='$ls'
23601 lseeksize='$lseeksize'
23602 lseektype='$lseektype'
23603 mad='$mad'
23604 madlyh='$madlyh'
23605 madlyobj='$madlyobj'
23606 madlysrc='$madlysrc'
23607 mail='$mail'
23608 mailx='$mailx'
23609 make='$make'
23610 make_set_make='$make_set_make'
23611 mallocobj='$mallocobj'
23612 mallocsrc='$mallocsrc'
23613 malloctype='$malloctype'
23614 man1dir='$man1dir'
23615 man1direxp='$man1direxp'
23616 man1ext='$man1ext'
23617 man3dir='$man3dir'
23618 man3direxp='$man3direxp'
23619 man3ext='$man3ext'
23620 mips_type='$mips_type'
23621 mistrustnm='$mistrustnm'
23622 mkdir='$mkdir'
23623 mmaptype='$mmaptype'
23624 modetype='$modetype'
23625 more='$more'
23626 multiarch='$multiarch'
23627 mv='$mv'
23628 myarchname='$myarchname'
23629 mydomain='$mydomain'
23630 myhostname='$myhostname'
23631 myuname='$myuname'
23632 n='$n'
23633 need_va_copy='$need_va_copy'
23634 netdb_hlen_type='$netdb_hlen_type'
23635 netdb_host_type='$netdb_host_type'
23636 netdb_name_type='$netdb_name_type'
23637 netdb_net_type='$netdb_net_type'
23638 nm='$nm'
23639 nm_opt='$nm_opt'
23640 nm_so_opt='$nm_so_opt'
23641 nonxs_ext='$nonxs_ext'
23642 nroff='$nroff'
23643 nvEUformat='$nvEUformat'
23644 nvFUformat='$nvFUformat'
23645 nvGUformat='$nvGUformat'
23646 nv_overflows_integers_at='$nv_overflows_integers_at'
23647 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23648 nveformat='$nveformat'
23649 nvfformat='$nvfformat'
23650 nvgformat='$nvgformat'
23651 nvsize='$nvsize'
23652 nvtype='$nvtype'
23653 o_nonblock='$o_nonblock'
23654 obj_ext='$obj_ext'
23655 old_pthread_create_joinable='$old_pthread_create_joinable'
23656 optimize='$optimize'
23657 orderlib='$orderlib'
23658 osname='$osname'
23659 osvers='$osvers'
23660 otherlibdirs='$otherlibdirs'
23661 package='$package'
23662 pager='$pager'
23663 passcat='$passcat'
23664 patchlevel='$patchlevel'
23665 path_sep='$path_sep'
23666 perl5='$perl5'
23667 perl='$perl'
23668 perl_patchlevel='$perl_patchlevel'
23669 perl_static_inline='$perl_static_inline'
23670 perladmin='$perladmin'
23671 perllibs='$perllibs'
23672 perlpath='$perlpath'
23673 pg='$pg'
23674 phostname='$phostname'
23675 pidtype='$pidtype'
23676 plibpth='$plibpth'
23677 pmake='$pmake'
23678 pr='$pr'
23679 prefix='$prefix'
23680 prefixexp='$prefixexp'
23681 privlib='$privlib'
23682 privlibexp='$privlibexp'
23683 procselfexe='$procselfexe'
23684 prototype='$prototype'
23685 ptrsize='$ptrsize'
23686 quadkind='$quadkind'
23687 quadtype='$quadtype'
23688 randbits='$randbits'
23689 randfunc='$randfunc'
23690 random_r_proto='$random_r_proto'
23691 randseedtype='$randseedtype'
23692 ranlib='$ranlib'
23693 rd_nodata='$rd_nodata'
23694 readdir64_r_proto='$readdir64_r_proto'
23695 readdir_r_proto='$readdir_r_proto'
23696 revision='$revision'
23697 rm='$rm'
23698 rm_try='$rm_try'
23699 rmail='$rmail'
23700 run='$run'
23701 runnm='$runnm'
23702 sGMTIME_max='$sGMTIME_max'
23703 sGMTIME_min='$sGMTIME_min'
23704 sLOCALTIME_max='$sLOCALTIME_max'
23705 sLOCALTIME_min='$sLOCALTIME_min'
23706 sPRIEUldbl='$sPRIEUldbl'
23707 sPRIFUldbl='$sPRIFUldbl'
23708 sPRIGUldbl='$sPRIGUldbl'
23709 sPRIXU64='$sPRIXU64'
23710 sPRId64='$sPRId64'
23711 sPRIeldbl='$sPRIeldbl'
23712 sPRIfldbl='$sPRIfldbl'
23713 sPRIgldbl='$sPRIgldbl'
23714 sPRIi64='$sPRIi64'
23715 sPRIo64='$sPRIo64'
23716 sPRIu64='$sPRIu64'
23717 sPRIx64='$sPRIx64'
23718 sSCNfldbl='$sSCNfldbl'
23719 sched_yield='$sched_yield'
23720 scriptdir='$scriptdir'
23721 scriptdirexp='$scriptdirexp'
23722 sed='$sed'
23723 seedfunc='$seedfunc'
23724 selectminbits='$selectminbits'
23725 selecttype='$selecttype'
23726 sendmail='$sendmail'
23727 setgrent_r_proto='$setgrent_r_proto'
23728 sethostent_r_proto='$sethostent_r_proto'
23729 setlocale_r_proto='$setlocale_r_proto'
23730 setnetent_r_proto='$setnetent_r_proto'
23731 setprotoent_r_proto='$setprotoent_r_proto'
23732 setpwent_r_proto='$setpwent_r_proto'
23733 setservent_r_proto='$setservent_r_proto'
23734 sh='$sh'
23735 shar='$shar'
23736 sharpbang='$sharpbang'
23737 shmattype='$shmattype'
23738 shortsize='$shortsize'
23739 shrpenv='$shrpenv'
23740 shsharp='$shsharp'
23741 sig_count='$sig_count'
23742 sig_name='$sig_name'
23743 sig_name_init='$sig_name_init'
23744 sig_num='$sig_num'
23745 sig_num_init='$sig_num_init'
23746 sig_size='$sig_size'
23747 signal_t='$signal_t'
23748 sitearch='$sitearch'
23749 sitearchexp='$sitearchexp'
23750 sitebin='$sitebin'
23751 sitebinexp='$sitebinexp'
23752 sitehtml1dir='$sitehtml1dir'
23753 sitehtml1direxp='$sitehtml1direxp'
23754 sitehtml3dir='$sitehtml3dir'
23755 sitehtml3direxp='$sitehtml3direxp'
23756 sitelib='$sitelib'
23757 sitelib_stem='$sitelib_stem'
23758 sitelibexp='$sitelibexp'
23759 siteman1dir='$siteman1dir'
23760 siteman1direxp='$siteman1direxp'
23761 siteman3dir='$siteman3dir'
23762 siteman3direxp='$siteman3direxp'
23763 siteprefix='$siteprefix'
23764 siteprefixexp='$siteprefixexp'
23765 sitescript='$sitescript'
23766 sitescriptexp='$sitescriptexp'
23767 sizesize='$sizesize'
23768 sizetype='$sizetype'
23769 sleep='$sleep'
23770 smail='$smail'
23771 so='$so'
23772 sockethdr='$sockethdr'
23773 socketlib='$socketlib'
23774 socksizetype='$socksizetype'
23775 sort='$sort'
23776 spackage='$spackage'
23777 spitshell='$spitshell'
23778 srand48_r_proto='$srand48_r_proto'
23779 srandom_r_proto='$srandom_r_proto'
23780 src='$src'
23781 ssizetype='$ssizetype'
23782 st_ino_sign='$st_ino_sign'
23783 st_ino_size='$st_ino_size'
23784 startperl='$startperl'
23785 startsh='$startsh'
23786 static_ext='$static_ext'
23787 stdchar='$stdchar'
23788 stdio_base='$stdio_base'
23789 stdio_bufsiz='$stdio_bufsiz'
23790 stdio_cnt='$stdio_cnt'
23791 stdio_filbuf='$stdio_filbuf'
23792 stdio_ptr='$stdio_ptr'
23793 stdio_stream_array='$stdio_stream_array'
23794 strerror_r_proto='$strerror_r_proto'
23795 strings='$strings'
23796 submit='$submit'
23797 subversion='$subversion'
23798 sysman='$sysman'
23799 tail='$tail'
23800 tar='$tar'
23801 targetarch='$targetarch'
23802 tbl='$tbl'
23803 tee='$tee'
23804 test='$test'
23805 timeincl='$timeincl'
23806 timetype='$timetype'
23807 tmpnam_r_proto='$tmpnam_r_proto'
23808 to='$to'
23809 touch='$touch'
23810 tr='$tr'
23811 trnl='$trnl'
23812 troff='$troff'
23813 ttyname_r_proto='$ttyname_r_proto'
23814 u16size='$u16size'
23815 u16type='$u16type'
23816 u32size='$u32size'
23817 u32type='$u32type'
23818 u64size='$u64size'
23819 u64type='$u64type'
23820 u8size='$u8size'
23821 u8type='$u8type'
23822 uidformat='$uidformat'
23823 uidsign='$uidsign'
23824 uidsize='$uidsize'
23825 uidtype='$uidtype'
23826 uname='$uname'
23827 uniq='$uniq'
23828 uquadtype='$uquadtype'
23829 use5005threads='$use5005threads'
23830 use64bitall='$use64bitall'
23831 use64bitint='$use64bitint'
23832 usecrosscompile='$usecrosscompile'
23833 usedevel='$usedevel'
23834 usedl='$usedl'
23835 usedtrace='$usedtrace'
23836 usefaststdio='$usefaststdio'
23837 useithreads='$useithreads'
23838 usekernprocpathname='$usekernprocpathname'
23839 uselargefiles='$uselargefiles'
23840 uselongdouble='$uselongdouble'
23841 usemallocwrap='$usemallocwrap'
23842 usemorebits='$usemorebits'
23843 usemultiplicity='$usemultiplicity'
23844 usemymalloc='$usemymalloc'
23845 usenm='$usenm'
23846 usensgetexecutablepath='$usensgetexecutablepath'
23847 useopcode='$useopcode'
23848 useperlio='$useperlio'
23849 useposix='$useposix'
23850 usereentrant='$usereentrant'
23851 userelocatableinc='$userelocatableinc'
23852 usesfio='$usesfio'
23853 useshrplib='$useshrplib'
23854 usesitecustomize='$usesitecustomize'
23855 usesocks='$usesocks'
23856 usethreads='$usethreads'
23857 usevendorprefix='$usevendorprefix'
23858 usevfork='$usevfork'
23859 usrinc='$usrinc'
23860 uuname='$uuname'
23861 uvXUformat='$uvXUformat'
23862 uvoformat='$uvoformat'
23863 uvsize='$uvsize'
23864 uvtype='$uvtype'
23865 uvuformat='$uvuformat'
23866 uvxformat='$uvxformat'
23867 vaproto='$vaproto'
23868 vendorarch='$vendorarch'
23869 vendorarchexp='$vendorarchexp'
23870 vendorbin='$vendorbin'
23871 vendorbinexp='$vendorbinexp'
23872 vendorhtml1dir='$vendorhtml1dir'
23873 vendorhtml1direxp='$vendorhtml1direxp'
23874 vendorhtml3dir='$vendorhtml3dir'
23875 vendorhtml3direxp='$vendorhtml3direxp'
23876 vendorlib='$vendorlib'
23877 vendorlib_stem='$vendorlib_stem'
23878 vendorlibexp='$vendorlibexp'
23879 vendorman1dir='$vendorman1dir'
23880 vendorman1direxp='$vendorman1direxp'
23881 vendorman3dir='$vendorman3dir'
23882 vendorman3direxp='$vendorman3direxp'
23883 vendorprefix='$vendorprefix'
23884 vendorprefixexp='$vendorprefixexp'
23885 vendorscript='$vendorscript'
23886 vendorscriptexp='$vendorscriptexp'
23887 version='$version'
23888 version_patchlevel_string='$version_patchlevel_string'
23889 versiononly='$versiononly'
23890 vi='$vi'
23891 voidflags='$voidflags'
23892 xlibpth='$xlibpth'
23893 yacc='$yacc'
23894 yaccflags='$yaccflags'
23895 zcat='$zcat'
23896 zip='$zip'
23897 EOT
23898
23899 : add special variables
23900 $test -f $src/patchlevel.h && \
23901 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23902 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23903 echo "PERL_CONFIG_SH=true" >>config.sh
23904
23905 : propagate old symbols
23906 if $test -f UU/config.sh; then
23907         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23908         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23909                 config.sh config.sh UU/oldconfig.sh |\
23910                 $sort | $uniq -u >UU/oldsyms
23911         set X `$cat UU/oldsyms`
23912         shift
23913         case $# in
23914         0) ;;
23915         *)
23916                 $cat <<EOM
23917 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23918 EOM
23919                 echo ": Variables propagated from previous config.sh file." >>config.sh
23920                 for sym in `$cat UU/oldsyms`; do
23921                         echo "    Propagating $hint variable "'$'"$sym..."
23922                         eval 'tmp="$'"${sym}"'"'
23923                         echo "$tmp" | \
23924                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23925                 done
23926                 ;;
23927         esac
23928 fi
23929
23930 : Finish up by extracting the .SH files
23931 case "$alldone" in
23932 exit)
23933         $rm -rf UU
23934         echo "Extraction done."
23935         exit 0
23936         ;;
23937 cont)
23938         ;;
23939 '')
23940         dflt=''
23941         nostick=true
23942         $cat <<EOM
23943
23944 If you'd like to make any changes to the config.sh file before I begin
23945 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23946
23947 EOM
23948         rp="Press return or use a shell escape to edit config.sh:"
23949         . UU/myread
23950         nostick=''
23951         case "$ans" in
23952         '') ;;
23953         *) : in case they cannot read
23954                 sh 1>&4 -c "$ans";;
23955         esac
23956         ;;
23957 esac
23958
23959 : if this fails, just run all the .SH files by hand
23960 . ./config.sh
23961
23962 echo " "
23963 exec 1>&4
23964 pwd=`pwd`
23965 . ./UU/extract
23966 cd "$pwd"
23967
23968 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23969         dflt=y
23970         case "$silent" in
23971         true) ;;
23972         *)
23973                 $cat <<EOM
23974
23975 Now you need to generate make dependencies by running "$make depend".
23976 You might prefer to run it in background: "$make depend > makedepend.out &"
23977 It can take a while, so you might not want to run it right now.
23978
23979 EOM
23980                 ;;
23981         esac
23982         rp="Run $make depend now?"
23983         . UU/myread
23984         case "$ans" in
23985         y*)
23986                 $make depend && echo "Now you must run '$make'."
23987                 ;;
23988         *)
23989                 echo "You must run '$make depend' then '$make'."
23990                 ;;
23991         esac
23992 elif test -f [Mm]akefile; then
23993         echo " "
23994         echo "Now you must run a $make."
23995 else
23996         echo "Configure done."
23997 fi
23998
23999 if $test -f Policy.sh; then
24000     $cat <<EOM
24001
24002 If you compile $package on a different machine or from a different object
24003 directory, copy the Policy.sh file from this object directory to the
24004 new one before you run Configure -- this will help you with most of
24005 the policy defaults.
24006
24007 EOM
24008 fi
24009 if $test -f config.msg; then
24010     echo "Hmm.  I also noted the following information while running:"
24011     echo " "
24012     $cat config.msg >&4
24013     $rm -f config.msg
24014 fi
24015 $rm -f kit*isdone ark*isdone
24016 $rm -rf UU
24017
24018 : End of Configure
24019