This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
revise hash overhaul docs
[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.code.sf.net/p/dist/code/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 Tue May  7 23:44:53 CEST 2013 [metaconfig 3.5 PL0]
32 # (with additional metaconfig patches by perlbug@perl.org)
33
34 cat >c1$$ <<EOF
35 ARGGGHHHH!!!!!
36
37 SCO csh still thinks true is false.  Write to SCO today and tell them that next
38 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
39
40 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
41 we'd have to do is go in and swap the && and || tokens, wherever they are.)
42
43 [End of diatribe. We now return you to your regularly scheduled programming...]
44 EOF
45 cat >c2$$ <<EOF
46
47 OOPS!  You naughty creature!  You didn't run Configure with sh!
48 I will attempt to remedy the situation by running sh for you...
49 EOF
50
51 true || cat c1$$ c2$$
52 true || exec sh $0 $argv:q
53
54 (exit $?0) || cat c2$$
55 (exit $?0) || exec sh $0 $argv:q
56 rm -f c1$$ c2$$
57
58 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
59         cat <<EOF
60 ***
61 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
62 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
63 *** Please read the README.plan9 for further instructions.
64 *** Cannot continue, aborting.
65 ***
66 EOF
67         exit 1
68 fi
69
70 if test ! -c /dev/null ; then
71         cat <<EOF
72 ***
73 *** I'm sorry, but /dev/null appears to be a file rather than a device.
74 *** Please consult your operating sytem's notes for making a device
75 *** in /dev.
76 *** Cannot continue, aborting.
77 ***
78 EOF
79         exit 1
80 fi
81
82 : compute my invocation name
83 me=$0
84 case "$0" in
85 */*)
86         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
87         test "$me" || me=$0
88         ;;
89 esac
90
91 : Proper separator for the PATH environment variable
92 p_=:
93 : On OS/2 this directory should exist if this is not floppy only system ":-]"
94 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
95         if test -n "$OS2_SHELL"; then
96                 p_=\;
97                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
98                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
99                 is_os2=yes
100         elif test -n "$DJGPP"; then
101                 case "X${MACHTYPE:-nonesuchmach}" in
102                 *cygwin) ;;
103                 *) p_=\; ;;
104                 esac
105         fi
106 fi
107
108 : Proper PATH setting
109 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
110 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
111 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
112 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
113 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
114 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
115 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
116 paths="$paths /sbin /usr/sbin /usr/libexec"
117 paths="$paths /system/gnu_library/bin"
118
119 for p in $paths
120 do
121         case "$p_$PATH$p_" in
122         *$p_$p$p_*) ;;
123         *) test -d $p && PATH=$PATH$p_$p ;;
124         esac
125 done
126
127 PATH=.$p_$PATH
128 export PATH
129
130 : shall we be using ksh?
131 inksh=''
132 needksh=''
133 avoidksh=''
134 newsh=/bin/ksh
135 changesh=''
136 if (PATH=.; alias -x) >/dev/null 2>&1; then
137                 inksh=true
138 fi
139 if test -f /hp-ux -a -f /bin/ksh; then
140         needksh='to avoid sh bug in "here document" expansion'
141 fi
142 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
143         if test X`/usr/bin/uname -v` = X4; then
144                 avoidksh="to avoid AIX 4's /bin/sh"
145                 newsh=/usr/bin/bsh
146         fi
147 fi
148 if test -f /osf_boot -a -f /usr/sbin/setld; then
149         if test X`/usr/bin/uname -s` = XOSF1; then
150                 avoidksh="to avoid Digital UNIX' ksh"
151                 newsh=/bin/sh
152                 unset BIN_SH
153         fi
154 fi
155 case "$inksh/$needksh" in
156 /[a-z]*)
157                 ENV=''
158                 changesh=true
159                 reason="$needksh"
160         ;;
161 esac
162 case "$inksh/$avoidksh" in
163 true/[a-z]*)
164         changesh=true
165         reason="$avoidksh"
166         ;;
167 esac
168 case "$inksh/$needksh-$avoidksh-" in
169 true/--)
170                 cat <<EOM
171 (I see you are using the Korn shell.  Some ksh's blow up on $me,
172 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
173 EOM
174         ;;
175 esac
176 case "$changesh" in
177 true)
178         export newsh
179         echo "(Feeding myself to $newsh $reason.)"
180         case "$0" in
181         Configure|*/Configure) exec $newsh $0 "$@";;
182         *) exec $newsh Configure "$@";;
183         esac
184         ;;
185 esac
186 test -x "${newsh}" || unset newsh
187
188 : if needed, set CDPATH to a harmless value that is not chatty
189 : avoid bash 2.02 problems with empty CDPATH.
190 case "$CDPATH" in
191 '')     ;;
192 *)      case "$SHELL" in
193         *bash*) CDPATH='.' ;;
194         *) CDPATH='' ;;
195         esac
196         ;;
197 esac
198
199 : Configure runs within the UU subdirectory
200 test -d UU || mkdir UU
201 cd UU && rm -f ./*
202
203 ccname=''
204 ccversion=''
205 ccsymbols=''
206 cppccsymbols=''
207 cppsymbols=''
208 from=''
209 run=''
210 targetarch=''
211 to=''
212 usecrosscompile=''
213 extern_C=''
214 mistrustnm=''
215 usedevel=''
216 perllibs=''
217 dynamic_ext=''
218 extensions=''
219 known_extensions=''
220 nonxs_ext=''
221 static_ext=''
222 useopcode=''
223 useposix=''
224 extras=''
225 d_bsd=''
226 d_eunice=''
227 d_xenix=''
228 eunicefix=''
229 ar=''
230 awk=''
231 bash=''
232 bison=''
233 byacc=''
234 cat=''
235 chgrp=''
236 chmod=''
237 chown=''
238 comm=''
239 compress=''
240 cp=''
241 cpio=''
242 cpp=''
243 csh=''
244 date=''
245 echo=''
246 egrep=''
247 emacs=''
248 expr=''
249 find=''
250 flex=''
251 gmake=''
252 grep=''
253 gzip=''
254 inews=''
255 ksh=''
256 less=''
257 line=''
258 lint=''
259 ln=''
260 lp=''
261 lpr=''
262 ls=''
263 mail=''
264 mailx=''
265 make=''
266 mkdir=''
267 more=''
268 mv=''
269 nm=''
270 nroff=''
271 perl=''
272 pg=''
273 pmake=''
274 pr=''
275 rm=''
276 rmail=''
277 sed=''
278 sendmail=''
279 shar=''
280 sleep=''
281 smail=''
282 sort=''
283 submit=''
284 tail=''
285 tar=''
286 tbl=''
287 tee=''
288 test=''
289 touch=''
290 tr=''
291 troff=''
292 uname=''
293 uniq=''
294 uuname=''
295 vi=''
296 zcat=''
297 zip=''
298 full_ar=''
299 full_sed=''
300 libswanted=''
301 hint=''
302 myuname=''
303 osname=''
304 osvers=''
305 Author=''
306 Date=''
307 Header=''
308 Id=''
309 Locker=''
310 Log=''
311 RCSfile=''
312 Revision=''
313 Source=''
314 State=''
315 _a=''
316 _exe=''
317 _o=''
318 archobjs=''
319 exe_ext=''
320 firstmakefile=''
321 lib_ext=''
322 obj_ext=''
323 path_sep=''
324 rm_try=''
325 afs=''
326 afsroot=''
327 alignbytes=''
328 ansi2knr=''
329 archlib=''
330 archlibexp=''
331 d_archlib=''
332 installarchlib=''
333 archname=''
334 myarchname=''
335 useversionedarchname=''
336 d_atolf=''
337 d_atoll=''
338 baserev=''
339 bin=''
340 binexp=''
341 initialinstalllocation=''
342 installbin=''
343 userelocatableinc=''
344 byteorder=''
345 cc=''
346 ccflags=''
347 cppflags=''
348 ldflags=''
349 lkflags=''
350 locincpth=''
351 optimize=''
352 cf_email=''
353 cf_by=''
354 cf_time=''
355 charbits=''
356 charsize=''
357 contains=''
358 cpp_stuff=''
359 cpplast=''
360 cppminus=''
361 cpprun=''
362 cppstdin=''
363 d__fwalk=''
364 d_access=''
365 d_accessx=''
366 d_aintl=''
367 d_alarm=''
368 asctime_r_proto=''
369 d_asctime_r=''
370 d_attribute_deprecated=''
371 d_attribute_format=''
372 d_attribute_malloc=''
373 d_attribute_nonnull=''
374 d_attribute_noreturn=''
375 d_attribute_pure=''
376 d_attribute_unused=''
377 d_attribute_warn_unused_result=''
378 d_printf_format_null=''
379 d_bcmp=''
380 d_bcopy=''
381 d_builtin_choose_expr=''
382 d_builtin_expect=''
383 d_bzero=''
384 d_c99_variadic_macros=''
385 d_casti32=''
386 castflags=''
387 d_castneg=''
388 d_chown=''
389 d_chroot=''
390 d_chsize=''
391 d_class=''
392 d_clearenv=''
393 d_closedir=''
394 d_void_closedir=''
395 d_cmsghdr_s=''
396 d_const=''
397 d_copysignl=''
398 d_cplusplus=''
399 cryptlib=''
400 d_crypt=''
401 crypt_r_proto=''
402 d_crypt_r=''
403 d_csh=''
404 full_csh=''
405 d_ctermid=''
406 ctermid_r_proto=''
407 d_ctermid_r=''
408 ctime_r_proto=''
409 d_ctime_r=''
410 d_cuserid=''
411 d_dbl_dig=''
412 d_dbminitproto=''
413 d_difftime=''
414 d_dir_dd_fd=''
415 d_dirfd=''
416 d_dlerror=''
417 d_dlopen=''
418 d_dlsymun=''
419 d_dosuid=''
420 d_suidsafe=''
421 d_drand48_r=''
422 drand48_r_proto=''
423 d_drand48proto=''
424 d_dup2=''
425 d_eaccess=''
426 d_endgrent=''
427 d_endgrent_r=''
428 endgrent_r_proto=''
429 d_endhent=''
430 d_endhostent_r=''
431 endhostent_r_proto=''
432 d_endnent=''
433 d_endnetent_r=''
434 endnetent_r_proto=''
435 d_endpent=''
436 d_endprotoent_r=''
437 endprotoent_r_proto=''
438 d_endpwent=''
439 d_endpwent_r=''
440 endpwent_r_proto=''
441 d_endsent=''
442 d_endservent_r=''
443 endservent_r_proto=''
444 d_faststdio=''
445 d_fchdir=''
446 d_fchmod=''
447 d_fchown=''
448 d_fcntl=''
449 d_fcntl_can_lock=''
450 d_fd_macros=''
451 d_fd_set=''
452 d_fds_bits=''
453 d_fgetpos=''
454 d_finite=''
455 d_finitel=''
456 d_flexfnam=''
457 d_flock=''
458 d_flockproto=''
459 d_fork=''
460 d_fp_class=''
461 d_fpclass=''
462 d_fpclassify=''
463 d_fpclassl=''
464 d_fpos64_t=''
465 d_frexpl=''
466 d_fs_data_s=''
467 d_fseeko=''
468 d_fsetpos=''
469 d_fstatfs=''
470 d_fsync=''
471 d_ftello=''
472 d_ftime=''
473 d_gettimeod=''
474 d_futimes=''
475 d_Gconvert=''
476 d_getaddrinfo=''
477 d_getcwd=''
478 d_getespwnam=''
479 d_getfsstat=''
480 d_getgrent=''
481 d_getgrent_r=''
482 getgrent_r_proto=''
483 d_getgrgid_r=''
484 getgrgid_r_proto=''
485 d_getgrnam_r=''
486 getgrnam_r_proto=''
487 d_getgrps=''
488 d_gethbyaddr=''
489 d_gethbyname=''
490 d_gethent=''
491 aphostname=''
492 d_gethname=''
493 d_phostname=''
494 d_uname=''
495 d_gethostbyaddr_r=''
496 gethostbyaddr_r_proto=''
497 d_gethostbyname_r=''
498 gethostbyname_r_proto=''
499 d_gethostent_r=''
500 gethostent_r_proto=''
501 d_gethostprotos=''
502 d_getitimer=''
503 d_getlogin=''
504 d_getlogin_r=''
505 getlogin_r_proto=''
506 d_getmnt=''
507 d_getmntent=''
508 d_getnameinfo=''
509 d_getnbyaddr=''
510 d_getnbyname=''
511 d_getnent=''
512 d_getnetbyaddr_r=''
513 getnetbyaddr_r_proto=''
514 d_getnetbyname_r=''
515 getnetbyname_r_proto=''
516 d_getnetent_r=''
517 getnetent_r_proto=''
518 d_getnetprotos=''
519 d_getpagsz=''
520 d_getpent=''
521 d_getpgid=''
522 d_getpgrp2=''
523 d_bsdgetpgrp=''
524 d_getpgrp=''
525 d_getppid=''
526 d_getprior=''
527 d_getpbyname=''
528 d_getpbynumber=''
529 d_getprotobyname_r=''
530 getprotobyname_r_proto=''
531 d_getprotobynumber_r=''
532 getprotobynumber_r_proto=''
533 d_getprotoent_r=''
534 getprotoent_r_proto=''
535 d_getprotoprotos=''
536 d_getprpwnam=''
537 d_getpwent=''
538 d_getpwent_r=''
539 getpwent_r_proto=''
540 d_getpwnam_r=''
541 getpwnam_r_proto=''
542 d_getpwuid_r=''
543 getpwuid_r_proto=''
544 d_getsent=''
545 d_getservbyname_r=''
546 getservbyname_r_proto=''
547 d_getservbyport_r=''
548 getservbyport_r_proto=''
549 d_getservent_r=''
550 getservent_r_proto=''
551 d_getservprotos=''
552 d_getspnam=''
553 d_getspnam_r=''
554 getspnam_r_proto=''
555 d_getsbyname=''
556 d_getsbyport=''
557 d_gmtime_r=''
558 gmtime_r_proto=''
559 d_gnulibc=''
560 gnulibc_version=''
561 d_hasmntopt=''
562 d_htonl=''
563 d_ilogbl=''
564 d_inetaton=''
565 d_inetntop=''
566 d_inetpton=''
567 d_int64_t=''
568 d_isascii=''
569 d_isblank=''
570 d_isfinite=''
571 d_isinf=''
572 d_isnan=''
573 d_isnanl=''
574 d_killpg=''
575 d_lchown=''
576 d_ldbl_dig=''
577 d_libm_lib_version=''
578 d_link=''
579 d_localtime_r=''
580 d_localtime_r_needs_tzset=''
581 localtime_r_proto=''
582 d_locconv=''
583 d_lockf=''
584 d_longdbl=''
585 longdblsize=''
586 d_longlong=''
587 longlongsize=''
588 d_lseekproto=''
589 d_lstat=''
590 d_madvise=''
591 d_malloc_good_size=''
592 d_malloc_size=''
593 d_mblen=''
594 d_mbstowcs=''
595 d_mbtowc=''
596 d_memchr=''
597 d_memcmp=''
598 d_memcpy=''
599 d_memmove=''
600 d_memset=''
601 d_mkdir=''
602 d_mkdtemp=''
603 d_mkfifo=''
604 d_mkstemp=''
605 d_mkstemps=''
606 d_mktime=''
607 d_mmap=''
608 mmaptype=''
609 d_modfl=''
610 d_modfl_pow32_bug=''
611 d_modflproto=''
612 d_mprotect=''
613 d_msg=''
614 d_msgctl=''
615 d_msgget=''
616 d_msghdr_s=''
617 d_msgrcv=''
618 d_msgsnd=''
619 d_msync=''
620 d_munmap=''
621 d_nice=''
622 d_nl_langinfo=''
623 d_off64_t=''
624 d_open3=''
625 d_fpathconf=''
626 d_pathconf=''
627 d_pause=''
628 d_pipe=''
629 d_poll=''
630 d_portable=''
631 d_prctl=''
632 d_prctl_set_name=''
633 d_procselfexe=''
634 procselfexe=''
635 d_old_pthread_create_joinable=''
636 old_pthread_create_joinable=''
637 d_pthread_atfork=''
638 d_pthread_attr_setscope=''
639 d_pthread_yield=''
640 d_sched_yield=''
641 sched_yield=''
642 d_qgcvt=''
643 d_random_r=''
644 random_r_proto=''
645 d_readdir64_r=''
646 readdir64_r_proto=''
647 d_readdir=''
648 d_rewinddir=''
649 d_seekdir=''
650 d_telldir=''
651 d_readdir_r=''
652 readdir_r_proto=''
653 d_readlink=''
654 d_readv=''
655 d_recvmsg=''
656 d_rename=''
657 d_rmdir=''
658 d_safebcpy=''
659 d_safemcpy=''
660 d_sanemcmp=''
661 d_sbrkproto=''
662 d_scalbnl=''
663 d_select=''
664 d_sem=''
665 d_semctl=''
666 d_semget=''
667 d_semop=''
668 d_sendmsg=''
669 d_setegid=''
670 d_seteuid=''
671 d_setgrent=''
672 d_setgrent_r=''
673 setgrent_r_proto=''
674 d_setgrps=''
675 d_sethent=''
676 d_sethostent_r=''
677 sethostent_r_proto=''
678 d_setitimer=''
679 d_setlinebuf=''
680 d_setlocale=''
681 d_setlocale_r=''
682 setlocale_r_proto=''
683 d_setnent=''
684 d_setnetent_r=''
685 setnetent_r_proto=''
686 d_setpent=''
687 d_setpgid=''
688 d_setpgrp2=''
689 d_bsdsetpgrp=''
690 d_setpgrp=''
691 d_setprior=''
692 d_setproctitle=''
693 d_setprotoent_r=''
694 setprotoent_r_proto=''
695 d_setpwent=''
696 d_setpwent_r=''
697 setpwent_r_proto=''
698 d_setregid=''
699 d_setresgid=''
700 d_setresuid=''
701 d_setreuid=''
702 d_setrgid=''
703 d_setruid=''
704 d_setsent=''
705 d_setservent_r=''
706 setservent_r_proto=''
707 d_setsid=''
708 d_setvbuf=''
709 d_sfio=''
710 usesfio=''
711 d_shm=''
712 d_shmat=''
713 d_shmatprototype=''
714 shmattype=''
715 d_shmctl=''
716 d_shmdt=''
717 d_shmget=''
718 d_sigaction=''
719 d_signbit=''
720 d_sigprocmask=''
721 d_sigsetjmp=''
722 usesitecustomize=''
723 d_snprintf=''
724 d_vsnprintf=''
725 d_sockatmark=''
726 d_sockatmarkproto=''
727 d_ip_mreq=''
728 d_ip_mreq_source=''
729 d_ipv6_mreq=''
730 d_ipv6_mreq_source=''
731 d_msg_ctrunc=''
732 d_msg_dontroute=''
733 d_msg_oob=''
734 d_msg_peek=''
735 d_msg_proxy=''
736 d_oldsock=''
737 d_scm_rights=''
738 d_sin6_scope_id=''
739 d_sockaddr_in6=''
740 d_sockaddr_sa_len=''
741 d_socket=''
742 d_sockpair=''
743 sockethdr=''
744 socketlib=''
745 d_socklen_t=''
746 d_socks5_init=''
747 d_sprintf_returns_strlen=''
748 d_sqrtl=''
749 d_srand48_r=''
750 srand48_r_proto=''
751 d_srandom_r=''
752 srandom_r_proto=''
753 d_sresgproto=''
754 d_sresuproto=''
755 d_statblks=''
756 d_statfs_f_flags=''
757 d_statfs_s=''
758 d_static_inline=''
759 perl_static_inline=''
760 d_fstatvfs=''
761 d_statvfs=''
762 d_stdio_cnt_lval=''
763 d_stdio_ptr_lval=''
764 d_stdio_ptr_lval_nochange_cnt=''
765 d_stdio_ptr_lval_sets_cnt=''
766 d_stdiobase=''
767 d_stdstdio=''
768 stdio_base=''
769 stdio_bufsiz=''
770 stdio_cnt=''
771 stdio_filbuf=''
772 stdio_ptr=''
773 d_index=''
774 d_strchr=''
775 d_strcoll=''
776 d_strctcpy=''
777 d_strerrm=''
778 d_strerror=''
779 d_sysernlst=''
780 d_syserrlst=''
781 d_strerror_r=''
782 strerror_r_proto=''
783 d_strftime=''
784 d_strlcat=''
785 d_strlcpy=''
786 d_strtod=''
787 d_strtol=''
788 d_strtold=''
789 d_strtoll=''
790 d_strtoq=''
791 d_strtoul=''
792 d_strtoull=''
793 d_strtouq=''
794 d_strxfrm=''
795 d_symlink=''
796 d_syscall=''
797 d_syscallproto=''
798 d_sysconf=''
799 d_system=''
800 d_tcgetpgrp=''
801 d_tcsetpgrp=''
802 d_telldirproto=''
803 d_time=''
804 timetype=''
805 d_asctime64=''
806 d_ctime64=''
807 d_difftime64=''
808 d_gmtime64=''
809 d_localtime64=''
810 d_mktime64=''
811 d_timegm=''
812 clocktype=''
813 d_times=''
814 d_tmpnam_r=''
815 tmpnam_r_proto=''
816 d_truncate=''
817 d_ttyname_r=''
818 ttyname_r_proto=''
819 d_tzname=''
820 d_u32align=''
821 d_ualarm=''
822 d_umask=''
823 d_semctl_semid_ds=''
824 d_semctl_semun=''
825 d_union_semun=''
826 d_unordered=''
827 d_unsetenv=''
828 d_usleep=''
829 d_usleepproto=''
830 d_ustat=''
831 d_pseudofork=''
832 d_vfork=''
833 usevfork=''
834 d_voidsig=''
835 signal_t=''
836 d_volatile=''
837 d_charvspr=''
838 d_vprintf=''
839 d_wait4=''
840 d_waitpid=''
841 d_wcstombs=''
842 d_wctomb=''
843 d_writev=''
844 dlext=''
845 bin_ELF=''
846 cccdlflags=''
847 ccdlflags=''
848 dlsrc=''
849 ld=''
850 ld_can_script=''
851 lddlflags=''
852 usedl=''
853 doublesize=''
854 bootstrap_charset=''
855 ebcdic=''
856 fflushNULL=''
857 fflushall=''
858 fpossize=''
859 fpostype=''
860 gccansipedantic=''
861 gccosandvers=''
862 gccversion=''
863 gidformat=''
864 gidsign=''
865 gidsize=''
866 gidtype=''
867 groupstype=''
868 h_fcntl=''
869 h_sysfile=''
870 html1dir=''
871 html1direxp=''
872 installhtml1dir=''
873 html3dir=''
874 html3direxp=''
875 installhtml3dir=''
876 i_arpainet=''
877 i_assert=''
878 i_crypt=''
879 db_hashtype=''
880 db_prefixtype=''
881 db_version_major=''
882 db_version_minor=''
883 db_version_patch=''
884 i_db=''
885 i_dbm=''
886 i_rpcsvcdbm=''
887 d_dirnamlen=''
888 direntrytype=''
889 i_dirent=''
890 i_dld=''
891 i_dlfcn=''
892 i_fcntl=''
893 i_float=''
894 i_fp=''
895 i_fp_class=''
896 i_gdbm=''
897 d_grpasswd=''
898 i_grp=''
899 i_ieeefp=''
900 i_inttypes=''
901 i_langinfo=''
902 i_libutil=''
903 i_limits=''
904 i_locale=''
905 i_machcthr=''
906 i_malloc=''
907 i_mallocmalloc=''
908 i_math=''
909 i_memory=''
910 i_mntent=''
911 d_gdbm_ndbm_h_uses_prototypes=''
912 d_gdbmndbm_h_uses_prototypes=''
913 d_ndbm=''
914 d_ndbm_h_uses_prototypes=''
915 i_gdbm_ndbm=''
916 i_gdbmndbm=''
917 i_ndbm=''
918 i_netdb=''
919 i_neterrno=''
920 i_netinettcp=''
921 i_niin=''
922 i_sysin=''
923 i_poll=''
924 i_prot=''
925 i_pthread=''
926 d_pwage=''
927 d_pwchange=''
928 d_pwclass=''
929 d_pwcomment=''
930 d_pwexpire=''
931 d_pwgecos=''
932 d_pwpasswd=''
933 d_pwquota=''
934 i_pwd=''
935 i_sfio=''
936 i_shadow=''
937 i_socks=''
938 i_stdbool=''
939 i_stddef=''
940 i_stdlib=''
941 i_string=''
942 strings=''
943 i_sunmath=''
944 i_sysaccess=''
945 i_sysdir=''
946 i_sysfile=''
947 d_voidtty=''
948 i_bsdioctl=''
949 i_sysfilio=''
950 i_sysioctl=''
951 i_syssockio=''
952 i_syslog=''
953 i_sysmman=''
954 i_sysmode=''
955 i_sysmount=''
956 i_sysndir=''
957 i_sysparam=''
958 i_syspoll=''
959 i_sysresrc=''
960 i_syssecrt=''
961 i_sysselct=''
962 i_sysstat=''
963 i_sysstatfs=''
964 i_sysstatvfs=''
965 i_systimes=''
966 i_systypes=''
967 i_sysuio=''
968 i_sysun=''
969 i_sysutsname=''
970 i_sysvfs=''
971 i_syswait=''
972 i_sgtty=''
973 i_termio=''
974 i_termios=''
975 d_tm_tm_gmtoff=''
976 d_tm_tm_zone=''
977 i_systime=''
978 i_systimek=''
979 i_time=''
980 timeincl=''
981 i_unistd=''
982 i_ustat=''
983 i_utime=''
984 i_values=''
985 i_stdarg=''
986 i_varargs=''
987 i_varhdr=''
988 i_vfork=''
989 d_inc_version_list=''
990 inc_version_list=''
991 inc_version_list_init=''
992 installprefix=''
993 installprefixexp=''
994 installstyle=''
995 installusrbinperl=''
996 intsize=''
997 longsize=''
998 shortsize=''
999 issymlink=''
1000 libc=''
1001 ldlibpthname=''
1002 libperl=''
1003 shrpenv=''
1004 useshrplib=''
1005 glibpth=''
1006 libpth=''
1007 loclibpth=''
1008 plibpth=''
1009 xlibpth=''
1010 ignore_versioned_solibs=''
1011 libs=''
1012 libsdirs=''
1013 libsfiles=''
1014 libsfound=''
1015 libspath=''
1016 lns=''
1017 d_PRIEUldbl=''
1018 d_PRIFUldbl=''
1019 d_PRIGUldbl=''
1020 d_PRIeldbl=''
1021 d_PRIfldbl=''
1022 d_PRIgldbl=''
1023 d_SCNfldbl=''
1024 sPRIEUldbl=''
1025 sPRIFUldbl=''
1026 sPRIGUldbl=''
1027 sPRIeldbl=''
1028 sPRIfldbl=''
1029 sPRIgldbl=''
1030 sSCNfldbl=''
1031 lseeksize=''
1032 lseektype=''
1033 mad=''
1034 madlyh=''
1035 madlyobj=''
1036 madlysrc=''
1037 make_set_make=''
1038 d_mymalloc=''
1039 freetype=''
1040 mallocobj=''
1041 mallocsrc=''
1042 malloctype=''
1043 usemallocwrap=''
1044 usemymalloc=''
1045 installman1dir=''
1046 man1dir=''
1047 man1direxp=''
1048 man1ext=''
1049 installman3dir=''
1050 man3dir=''
1051 man3direxp=''
1052 man3ext=''
1053 modetype=''
1054 multiarch=''
1055 mydomain=''
1056 myhostname=''
1057 phostname=''
1058 c=''
1059 n=''
1060 d_eofnblk=''
1061 eagain=''
1062 o_nonblock=''
1063 rd_nodata=''
1064 need_va_copy=''
1065 netdb_hlen_type=''
1066 netdb_host_type=''
1067 netdb_name_type=''
1068 netdb_net_type=''
1069 groupcat=''
1070 hostcat=''
1071 passcat=''
1072 orderlib=''
1073 ranlib=''
1074 d_perl_otherlibdirs=''
1075 otherlibdirs=''
1076 package=''
1077 spackage=''
1078 pager=''
1079 api_revision=''
1080 api_subversion=''
1081 api_version=''
1082 api_versionstring=''
1083 patchlevel=''
1084 perl_patchlevel=''
1085 revision=''
1086 subversion=''
1087 version=''
1088 version_patchlevel_string=''
1089 perl5=''
1090 perladmin=''
1091 perlpath=''
1092 d_nv_preserves_uv=''
1093 d_nv_zero_is_allbits_zero=''
1094 i16size=''
1095 i16type=''
1096 i32size=''
1097 i32type=''
1098 i64size=''
1099 i64type=''
1100 i8size=''
1101 i8type=''
1102 ivsize=''
1103 ivtype=''
1104 nv_overflows_integers_at=''
1105 nv_preserves_uv_bits=''
1106 nvsize=''
1107 nvtype=''
1108 u16size=''
1109 u16type=''
1110 u32size=''
1111 u32type=''
1112 u64size=''
1113 u64type=''
1114 u8size=''
1115 u8type=''
1116 uvsize=''
1117 uvtype=''
1118 ivdformat=''
1119 nvEUformat=''
1120 nvFUformat=''
1121 nvGUformat=''
1122 nveformat=''
1123 nvfformat=''
1124 nvgformat=''
1125 uvXUformat=''
1126 uvoformat=''
1127 uvuformat=''
1128 uvxformat=''
1129 pidtype=''
1130 prefix=''
1131 prefixexp=''
1132 installprivlib=''
1133 privlib=''
1134 privlibexp=''
1135 prototype=''
1136 ptrsize=''
1137 d_PRIXU64=''
1138 d_PRId64=''
1139 d_PRIi64=''
1140 d_PRIo64=''
1141 d_PRIu64=''
1142 d_PRIx64=''
1143 sPRIXU64=''
1144 sPRId64=''
1145 sPRIi64=''
1146 sPRIo64=''
1147 sPRIu64=''
1148 sPRIx64=''
1149 d_quad=''
1150 quadkind=''
1151 quadtype=''
1152 uquadtype=''
1153 drand01=''
1154 randbits=''
1155 randfunc=''
1156 randseedtype=''
1157 seedfunc=''
1158 installscript=''
1159 scriptdir=''
1160 scriptdirexp=''
1161 selectminbits=''
1162 selecttype=''
1163 sh=''
1164 sig_count=''
1165 sig_name=''
1166 sig_name_init=''
1167 sig_num=''
1168 sig_num_init=''
1169 sig_size=''
1170 d_sitearch=''
1171 installsitearch=''
1172 sitearch=''
1173 sitearchexp=''
1174 installsitebin=''
1175 sitebin=''
1176 sitebinexp=''
1177 installsitehtml1dir=''
1178 sitehtml1dir=''
1179 sitehtml1direxp=''
1180 installsitehtml3dir=''
1181 sitehtml3dir=''
1182 sitehtml3direxp=''
1183 installsitelib=''
1184 sitelib=''
1185 sitelib_stem=''
1186 sitelibexp=''
1187 installsiteman1dir=''
1188 siteman1dir=''
1189 siteman1direxp=''
1190 installsiteman3dir=''
1191 siteman3dir=''
1192 siteman3direxp=''
1193 siteprefix=''
1194 siteprefixexp=''
1195 installsitescript=''
1196 sitescript=''
1197 sitescriptexp=''
1198 sizesize=''
1199 sizetype=''
1200 so=''
1201 socksizetype=''
1202 sharpbang=''
1203 shsharp=''
1204 spitshell=''
1205 src=''
1206 ssizetype=''
1207 st_ino_sign=''
1208 st_ino_size=''
1209 startperl=''
1210 startsh=''
1211 stdchar=''
1212 d_stdio_stream_array=''
1213 stdio_stream_array=''
1214 sysman=''
1215 sGMTIME_max=''
1216 sGMTIME_min=''
1217 sLOCALTIME_max=''
1218 sLOCALTIME_min=''
1219 trnl=''
1220 uidformat=''
1221 uidsign=''
1222 uidsize=''
1223 uidtype=''
1224 archname64=''
1225 use64bitall=''
1226 use64bitint=''
1227 dtrace=''
1228 usedtrace=''
1229 usefaststdio=''
1230 usekernprocpathname=''
1231 ccflags_uselargefiles=''
1232 ldflags_uselargefiles=''
1233 libswanted_uselargefiles=''
1234 uselargefiles=''
1235 uselongdouble=''
1236 usemorebits=''
1237 usemultiplicity=''
1238 nm_opt=''
1239 nm_so_opt=''
1240 runnm=''
1241 usenm=''
1242 usensgetexecutablepath=''
1243 useperlio=''
1244 usesocks=''
1245 d_oldpthreads=''
1246 use5005threads=''
1247 useithreads=''
1248 usereentrant=''
1249 usethreads=''
1250 incpath=''
1251 mips_type=''
1252 usrinc=''
1253 vaproto=''
1254 d_vendorarch=''
1255 installvendorarch=''
1256 vendorarch=''
1257 vendorarchexp=''
1258 d_vendorbin=''
1259 installvendorbin=''
1260 vendorbin=''
1261 vendorbinexp=''
1262 installvendorhtml1dir=''
1263 vendorhtml1dir=''
1264 vendorhtml1direxp=''
1265 installvendorhtml3dir=''
1266 vendorhtml3dir=''
1267 vendorhtml3direxp=''
1268 d_vendorlib=''
1269 installvendorlib=''
1270 vendorlib=''
1271 vendorlib_stem=''
1272 vendorlibexp=''
1273 installvendorman1dir=''
1274 vendorman1dir=''
1275 vendorman1direxp=''
1276 installvendorman3dir=''
1277 vendorman3dir=''
1278 vendorman3direxp=''
1279 usevendorprefix=''
1280 vendorprefix=''
1281 vendorprefixexp=''
1282 d_vendorscript=''
1283 installvendorscript=''
1284 vendorscript=''
1285 vendorscriptexp=''
1286 versiononly=''
1287 defvoidused=''
1288 voidflags=''
1289 yacc=''
1290 yaccflags=''
1291 CONFIG=''
1292
1293 : Detect odd OSs
1294 define='define'
1295 undef='undef'
1296 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1297 rmlist=''
1298
1299 : We must find out about Eunice early
1300 eunicefix=':'
1301 if test -f /etc/unixtovms; then
1302         eunicefix=/etc/unixtovms
1303 fi
1304 if test -f /etc/unixtovms.exe; then
1305         eunicefix=/etc/unixtovms.exe
1306 fi
1307
1308 : Set executable suffix now -- needed before hints available
1309 if test -f "/libs/version.library"; then
1310 : Amiga OS
1311     _exe=""
1312 elif test -f "/system/gnu_library/bin/ar.pm"; then
1313 : Stratus VOS
1314     _exe=".pm"
1315 elif test -n "$DJGPP"; then
1316 : DOS DJGPP
1317     _exe=".exe"
1318 elif test -d c:/. -o -n "$is_os2" ; then
1319 : OS/2 or cygwin
1320     _exe=".exe"
1321 fi
1322
1323 groupstype=''
1324 i_whoami=''
1325 : Trailing extension.  Override this in a hint file, if needed.
1326 : Extra object files, if any, needed on this platform.
1327 archobjs=''
1328 archname=''
1329 : Possible local include directories to search.
1330 : Set locincpth to "" in a hint file to defeat local include searches.
1331 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1332 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1333 :
1334 : no include file wanted by default
1335 inclwanted=''
1336
1337 : Enable -DEBUGGING and -DDEBUGGING from the command line
1338 EBUGGING=''
1339 DEBUGGING=''
1340
1341 libnames=''
1342 : change the next line if compiling for Xenix/286 on Xenix/386
1343 xlibpth='/usr/lib/386 /lib/386'
1344 : Possible local library directories to search.
1345 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1346 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1347
1348 : general looking path for locating libraries
1349 glibpth="/lib /usr/lib $xlibpth"
1350 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1351 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1352 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1353 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1354
1355 : Private path used by Configure to find libraries.  Its value
1356 : is prepended to libpth. This variable takes care of special
1357 : machines, like the mips.  Usually, it should be empty.
1358 plibpth=''
1359
1360 : default library list
1361 libswanted=''
1362 : some systems want to use only the non-versioned libso:s
1363 ignore_versioned_solibs=''
1364 : set usethreads on the Configure command line to enable threads.
1365 usereentrant='undef'
1366 : full support for void wanted by default
1367 defvoidused=15
1368
1369 ccname=''
1370 ccversion=''
1371 perllibs=''
1372 : set useposix=false in your hint file to disable the POSIX extension.
1373 useposix=true
1374 : set useopcode=false in your hint file to disable the Opcode extension.
1375 useopcode=true
1376 archname64=''
1377 ccflags_uselargefiles=''
1378 ldflags_uselargefiles=''
1379 libswanted_uselargefiles=''
1380 : set usemultiplicity on the Configure command line to enable multiplicity.
1381 : set usesocks on the Configure command line to enable socks.
1382 : List of libraries we want.
1383 : If anyone needs extra -lxxx, put those in a hint file.
1384 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1385 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1386 : We probably want to search /usr/shlib before most other libraries.
1387 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1388 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1389 glibpth="/usr/shlib $glibpth"
1390 : Do not use vfork unless overridden by a hint file.
1391 usevfork=false
1392
1393 : Find the basic shell for Bourne shell scripts
1394 case "$sh" in
1395 '')
1396         case "$SYSTYPE" in
1397         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1398         *) xxx='/bin/sh';;
1399         esac
1400         if test -f "$xxx"; then
1401                 sh="$xxx"
1402         else
1403                 : Build up a list and do a single loop so we can 'break' out.
1404                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1405                 for xxx in sh bash ksh pdksh ash; do
1406                         for p in $pth; do
1407                                 try="$try ${p}/${xxx}"
1408                         done
1409                 done
1410                 for xxx in $try; do
1411                         if test -f "$xxx"; then
1412                                 sh="$xxx";
1413                                 break
1414                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1415                                 sh="$xxx";
1416                                 break
1417                         elif test -f "$xxx.exe"; then
1418                                 sh="$xxx";
1419                                 break
1420                         fi
1421                 done
1422         fi
1423         ;;
1424 esac
1425
1426 case "$sh" in
1427 '')     cat >&2 <<EOM
1428 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1429
1430 Usually it's in /bin/sh.  How did you even get this far?
1431 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1432 we'll try to straighten this all out.
1433 EOM
1434         exit 1
1435         ;;
1436 esac
1437
1438 : see if sh knows # comments
1439 if `$sh -c '#' >/dev/null 2>&1`; then
1440         shsharp=true
1441         spitshell=cat
1442         xcat=/bin/cat
1443         test -f $xcat$_exe || xcat=/usr/bin/cat
1444         if test ! -f $xcat$_exe; then
1445                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1446                         if test -f $p/cat$_exe; then
1447                                 xcat=$p/cat
1448                                 break
1449                         fi
1450                 done
1451                 if test ! -f $xcat$_exe; then
1452                         echo "Can't find cat anywhere!"
1453                         exit 1
1454                 fi
1455         fi
1456         echo "#!$xcat" >sharp
1457         $eunicefix sharp
1458         chmod +x sharp
1459         ./sharp > today 2>/dev/null
1460         if test -s today; then
1461                 sharpbang='#!'
1462         else
1463                 echo "#! $xcat" > sharp
1464                 $eunicefix sharp
1465                 chmod +x sharp
1466                 ./sharp > today 2>/dev/null
1467                 if test -s today; then
1468                         sharpbang='#! '
1469                 else
1470                         sharpbang=': use '
1471                 fi
1472         fi
1473 else
1474         echo " "
1475         echo "Your $sh doesn't grok # comments--I will strip them later on."
1476         shsharp=false
1477         cd ..
1478         echo "exec grep -v '^[  ]*#'" >spitshell
1479         chmod +x spitshell
1480         $eunicefix spitshell
1481         spitshell=`pwd`/spitshell
1482         cd UU
1483         echo "I presume that if # doesn't work, #! won't work either!"
1484         sharpbang=': use '
1485 fi
1486 rm -f sharp today
1487
1488 : figure out how to guarantee sh startup
1489 case "$startsh" in
1490 '') startsh=${sharpbang}${sh} ;;
1491 *)
1492 esac
1493 cat >sharp <<EOSS
1494 $startsh
1495 set abc
1496 test "$?abc" != 1
1497 EOSS
1498
1499 chmod +x sharp
1500 $eunicefix sharp
1501 if ./sharp; then
1502         : echo "Yup, it does."
1503 else
1504         echo "Hmm... '$startsh' does not guarantee sh startup..."
1505         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1506 fi
1507 rm -f sharp
1508
1509 : Save command line options in file UU/cmdline.opt for later use in
1510 : generating config.sh.
1511 cat > cmdline.opt <<EOSH
1512 : Configure command line arguments.
1513 config_arg0='$0'
1514 config_args='$*'
1515 config_argc=$#
1516 EOSH
1517 argn=1
1518 args_exp=''
1519 args_sep=''
1520 for arg in "$@"; do
1521         cat >>cmdline.opt <<EOSH
1522 config_arg$argn='$arg'
1523 EOSH
1524         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1525 $arg
1526 EOC
1527         arg_exp=`cat cmdl.opt`
1528         args_exp="$args_exp$args_sep'$arg_exp'"
1529         argn=`expr $argn + 1`
1530         args_sep=' '
1531 done
1532 rm -f cmdl.opt
1533
1534 : produce awk script to parse command line options
1535 cat >options.awk <<'EOF'
1536 BEGIN {
1537         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1538
1539         len = length(optstr);
1540         for (i = 1; i <= len; i++) {
1541                 c = substr(optstr, i, 1);
1542                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1543                 if (a == ":") {
1544                         arg[c] = 1;
1545                         i++;
1546                 }
1547                 opt[c] = 1;
1548         }
1549 }
1550 {
1551         expect = 0;
1552         str = $0;
1553         if (substr(str, 1, 1) != "-") {
1554                 printf("'%s'\n", str);
1555                 next;
1556         }
1557         len = length($0);
1558         for (i = 2; i <= len; i++) {
1559                 c = substr(str, i, 1);
1560                 if (!opt[c]) {
1561                         printf("-%s\n", substr(str, i));
1562                         next;
1563                 }
1564                 printf("-%s\n", c);
1565                 if (arg[c]) {
1566                         if (i < len)
1567                                 printf("'%s'\n", substr(str, i + 1));
1568                         else
1569                                 expect = 1;
1570                         next;
1571                 }
1572         }
1573 }
1574 END {
1575         if (expect)
1576                 print "?";
1577 }
1578 EOF
1579
1580 : process the command line options
1581 set X `for arg in "$@"; do echo "X$arg"; done |
1582         sed -e s/X// | awk -f options.awk`
1583 eval "set $*"
1584 shift
1585 rm -f options.awk
1586
1587 : set up default values
1588 fastread=''
1589 reuseval=false
1590 config_sh=''
1591 alldone=''
1592 error=''
1593 silent=''
1594 extractsh=''
1595 override=''
1596 knowitall=''
1597 rm -f optdef.sh posthint.sh
1598 cat >optdef.sh <<EOS
1599 $startsh
1600 EOS
1601
1602
1603 : option parsing
1604 while test $# -gt 0; do
1605         case "$1" in
1606         -d) shift; fastread=yes;;
1607         -e) shift; alldone=cont;;
1608         -f)
1609                 shift
1610                 cd ..
1611                 if test -r "$1"; then
1612                         config_sh="$1"
1613                 else
1614                         echo "$me: cannot read config file $1." >&2
1615                         error=true
1616                 fi
1617                 cd UU
1618                 shift;;
1619         --help|\
1620         -h) shift; error=true;;
1621         -r) shift; reuseval=true;;
1622         -s) shift; silent=true; realsilent=true;;
1623         -E) shift; alldone=exit;;
1624         -K) shift; knowitall=true;;
1625         -O) shift; override=true;;
1626         -S) shift; silent=true; extractsh=true;;
1627         -D)
1628                 shift
1629                 case "$1" in
1630                 *=)
1631                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1632                         echo "$me: ignoring -D $1" >&2
1633                         ;;
1634                 *=*) echo "$1" | \
1635                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1636                 *) echo "$1='define'" >> optdef.sh;;
1637                 esac
1638                 shift
1639                 ;;
1640         -U)
1641                 shift
1642                 case "$1" in
1643                 *=) echo "$1" >> optdef.sh;;
1644                 *=*)
1645                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1646                         echo "$me: ignoring -U $1" >&2
1647                         ;;
1648                 *) echo "$1='undef'" >> optdef.sh;;
1649                 esac
1650                 shift
1651                 ;;
1652         -A)
1653             shift
1654             xxx=''
1655             yyy="$1"
1656             zzz=''
1657             uuu=undef
1658             case "$yyy" in
1659             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1660                  case "$zzz" in
1661                  *:*) zzz='' ;;
1662                  *)   xxx=append
1663                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1664                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1665                  esac
1666                  ;;
1667             esac
1668             case "$xxx" in
1669             '')  case "$yyy" in
1670                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1671                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1672                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1673                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1674                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1675                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1676                  esac
1677                  ;;
1678             esac
1679             case "$xxx" in
1680             append)
1681                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1682             clear)
1683                 echo "$yyy=''"                  >> posthint.sh ;;
1684             define)
1685                 case "$zzz" in
1686                 '') zzz=define ;;
1687                 esac
1688                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1689             eval)
1690                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1691             prepend)
1692                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1693             undef)
1694                 case "$zzz" in
1695                 '') zzz="$uuu" ;;
1696                 esac
1697                 echo "$yyy=$zzz"                >> posthint.sh ;;
1698             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1699             esac
1700             shift
1701             ;;
1702         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1703             exit 0;;
1704         --) break;;
1705         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1706         *) break;;
1707         esac
1708 done
1709
1710 case "$error" in
1711 true)
1712         cat >&2 <<EOM
1713 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1714                  [-U symbol] [-U symbol=] [-A command:symbol...]
1715   -d : use defaults for all answers.
1716   -e : go on without questioning past the production of config.sh.
1717   -f : specify an alternate default configuration file.
1718   -h : print this help message and exit (with an error status).
1719   -r : reuse C symbols value if possible (skips costly nm extraction).
1720   -s : silent mode, only echoes questions and essential information.
1721   -D : define symbol to have some value:
1722          -D symbol         symbol gets the value 'define'
1723          -D symbol=value   symbol gets the value 'value'
1724        common used examples (see INSTALL for more info):
1725          -Duse64bitint            use 64bit integers
1726          -Duse64bitall            use 64bit integers and pointers
1727          -Dusethreads             use thread support
1728          -Dinc_version_list=none  do not include older perl trees in @INC
1729          -DEBUGGING=none          DEBUGGING options
1730          -Dcc=gcc                 choose your compiler
1731          -Dprefix=/opt/perl5      choose your destination
1732   -E : stop at the end of questions, after having produced config.sh.
1733   -K : do not use unless you know what you are doing.
1734   -O : let -D and -U override definitions from loaded configuration file.
1735   -S : perform variable substitutions on all .SH files (can mix with -f)
1736   -U : undefine symbol:
1737          -U symbol    symbol gets the value 'undef'
1738          -U symbol=   symbol gets completely empty
1739        e.g.:  -Uversiononly
1740   -A : manipulate symbol after the platform specific hints have been applied:
1741          -A append:symbol=value   append value to symbol
1742          -A symbol=value          like append:, but with a separating space
1743          -A define:symbol=value   define symbol to have value
1744          -A clear:symbol          define symbol to be ''
1745          -A define:symbol         define symbol to be 'define'
1746          -A eval:symbol=value     define symbol to be eval of value
1747          -A prepend:symbol=value  prepend value to symbol
1748          -A undef:symbol          define symbol to be 'undef'
1749          -A undef:symbol=         define symbol to be ''
1750        e.g.:  -A prepend:libswanted='cl pthread '
1751               -A ccflags=-DSOME_MACRO
1752   -V : print version number and exit (with a zero status).
1753 EOM
1754         exit 1
1755         ;;
1756 esac
1757
1758 : Sanity checks
1759 case "$fastread$alldone" in
1760 yescont|yesexit) ;;
1761 *)
1762         case "$extractsh" in
1763         true) ;;
1764         *)
1765                 if test ! -t 0; then
1766                         echo "Say 'sh Configure', not 'sh <Configure'"
1767                         exit 1
1768                 fi
1769                 ;;
1770         esac
1771         ;;
1772 esac
1773
1774 exec 4>&1
1775 case "$silent" in
1776 true) exec 1>/dev/null;;
1777 esac
1778
1779 : run the defines and the undefines, if any, but leave the file out there...
1780 touch optdef.sh
1781 . ./optdef.sh
1782 : create the posthint manipulation script and leave the file out there...
1783 touch posthint.sh
1784
1785 : set package name
1786 package='perl5'
1787 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1788 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1789 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1790 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1791 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1792 esac
1793
1794 : Some greps do not return status, grrr.
1795 echo "grimblepritz" >grimble
1796 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1797         contains=contains
1798 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1799         contains=grep
1800 else
1801         contains=contains
1802 fi
1803 rm -f grimble
1804 : the following should work in any shell
1805 case "$contains" in
1806 contains*)
1807         echo " "
1808         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1809         cat >contains <<'EOSS'
1810 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1811 EOSS
1812 chmod +x contains
1813 esac
1814
1815 : Find the path to the source tree
1816 case "$src" in
1817 '') case "$0" in
1818     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1819          case "$src" in
1820          /*)    ;;
1821          .)     ;;
1822          *)     src=`cd ../$src && pwd` ;;
1823          esac
1824          ;;
1825     *)   src='.';;
1826     esac;;
1827 esac
1828 case "$src" in
1829 '')     src=/
1830         rsrc=/
1831         ;;
1832 /*)     rsrc="$src";;
1833 *)      rsrc="../$src";;
1834 esac
1835 if test -f $rsrc/Configure && \
1836         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1837 then
1838    : found it, so we are ok.
1839 else
1840         rsrc=''
1841         for src in . .. ../.. ../../.. ../../../..; do
1842                 if test -f ../$src/Configure && \
1843                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1844                 then
1845                         rsrc=../$src
1846                         break
1847                 fi
1848         done
1849 fi
1850 case "$rsrc" in
1851 '')
1852         cat <<EOM >&4
1853
1854 Sorry, I can't seem to locate the source dir for $package.  Please start
1855 Configure with an explicit path -- i.e. /some/path/Configure.
1856
1857 EOM
1858         exit 1
1859         ;;
1860 ../.)   rsrc='..';;
1861 *)
1862         echo " "
1863         echo "Sources for $package found in \"$src\"." >&4
1864         ;;
1865 esac
1866
1867 : script used to extract .SH files with variable substitutions
1868 cat >extract <<'EOS'
1869 PERL_CONFIG_SH=true
1870 echo "Doing variable substitutions on .SH files..."
1871 if test -f MANIFEST; then
1872         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1873 else
1874         echo "(Looking for .SH files under the source directory.)"
1875         set x `(cd "$src"; find . -name "*.SH" -print)`
1876 fi
1877 shift
1878 case $# in
1879 0) set x `(cd "$src"; echo *.SH)`; shift;;
1880 esac
1881 if test ! -f "$src/$1"; then
1882         shift
1883 fi
1884 mkdir_p='
1885 name=$1;
1886 create="";
1887 while test $name; do
1888         if test ! -d "$name"; then
1889                 create="$name $create";
1890                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1891                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1892         else
1893                 name="";
1894         fi;
1895 done;
1896 for file in $create; do
1897         mkdir $file;
1898 done
1899 '
1900 for file in $*; do
1901         case "$src" in
1902         ".")
1903                 case "$file" in
1904                 */*)
1905                         dir=`expr X$file : 'X\(.*\)/'`
1906                         file=`expr X$file : 'X.*/\(.*\)'`
1907                         (cd "$dir" && . ./$file)
1908                         ;;
1909                 *)
1910                         . ./$file
1911                         ;;
1912                 esac
1913                 ;;
1914         *)
1915                 case "$file" in
1916                 */*)
1917                         dir=`expr X$file : 'X\(.*\)/'`
1918                         file=`expr X$file : 'X.*/\(.*\)'`
1919                         (set x $dir; shift; eval $mkdir_p)
1920                         sh <"$src/$dir/$file"
1921                         ;;
1922                 *)
1923                         sh <"$src/$file"
1924                         ;;
1925                 esac
1926                 ;;
1927         esac
1928 done
1929 if test -f "$src/config_h.SH"; then
1930         if test ! -f config.h; then
1931         : oops, they left it out of MANIFEST, probably, so do it anyway.
1932         . "$src/config_h.SH"
1933         fi
1934 fi
1935 EOS
1936
1937 : extract files and exit if asked to do so
1938 case "$extractsh" in
1939 true)
1940         case "$realsilent" in
1941         true) ;;
1942         *) exec 1>&4;;
1943         esac
1944         case "$config_sh" in
1945         '') config_sh='config.sh';;
1946         esac
1947         echo " "
1948         echo "Fetching answers from $config_sh..."
1949         cd ..
1950         . $config_sh
1951         test "$override" && . ./optdef.sh
1952         echo " "
1953         . UU/extract
1954         rm -rf UU
1955         echo "Extraction done."
1956         exit 0
1957         ;;
1958 esac
1959
1960 : Eunice requires " " instead of "", can you believe it
1961 echo " "
1962 : Here we go...
1963 echo "Beginning of configuration questions for $package."
1964
1965 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1966
1967 : first determine how to suppress newline on echo command
1968 echo " "
1969 echo "Checking echo to see how to suppress newlines..."
1970 (echo "hi there\c" ; echo " ") >.echotmp
1971 if $contains c .echotmp >/dev/null 2>&1 ; then
1972         echo "...using -n."
1973         n='-n'
1974         c=''
1975 else
1976         cat <<'EOM'
1977 ...using \c
1978 EOM
1979         n=''
1980         c='\c'
1981 fi
1982 echo $n "The star should be here-->$c"
1983 echo '*'
1984 rm -f .echotmp
1985
1986 : Now test for existence of everything in MANIFEST
1987 echo " "
1988 if test -f "$rsrc/MANIFEST"; then
1989         echo "First let's make sure your kit is complete.  Checking..." >&4
1990         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1991                 (split -l 50 2>/dev/null || split -50)
1992         rm -f missing
1993         tmppwd=`pwd`
1994         for filelist in x??; do
1995                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1996                         >/dev/null 2>>"$tmppwd/missing")
1997         done
1998         if test -s missing; then
1999                 cat missing >&4
2000                 cat >&4 <<'EOM'
2001
2002 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2003
2004 You have the option of continuing the configuration process, despite the
2005 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2006 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2007 and contact the author (perlbug@perl.org).
2008
2009 EOM
2010                 echo $n "Continue? [n] $c" >&4
2011                 read ans
2012                 case "$ans" in
2013                 y*)
2014                         echo "Continuing..." >&4
2015                         rm -f missing
2016                         ;;
2017                 *)
2018                         echo "ABORTING..." >&4
2019                         kill $$
2020                         ;;
2021                 esac
2022         else
2023                 echo "Looks good..."
2024         fi
2025 else
2026         echo "There is no MANIFEST file.  I hope your kit is complete !"
2027 fi
2028 rm -f missing x??
2029
2030 : Find the appropriate value for a newline for tr
2031 echo " "
2032 if test -n "$DJGPP"; then
2033        trnl='\012'
2034 fi
2035 if test X"$trnl" = X; then
2036         case "`echo foo|tr '\n' x 2>/dev/null`" in
2037         foox) trnl='\n' ;;
2038         esac
2039 fi
2040 if test X"$trnl" = X; then
2041         case "`echo foo|tr '\012' x 2>/dev/null`" in
2042         foox) trnl='\012' ;;
2043         esac
2044 fi
2045 if test X"$trnl" = X; then
2046        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2047        fooxy) trnl='\n\r' ;;
2048        esac
2049 fi
2050 if test X"$trnl" = X; then
2051         cat <<EOM >&2
2052
2053 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2054
2055 EOM
2056         exit 1
2057 fi
2058
2059 : compute the number of columns on the terminal for proper question formatting
2060 case "$COLUMNS" in
2061 '') COLUMNS='80';;
2062 esac
2063
2064 : set up the echo used in my read
2065 myecho="case \"\$xxxm\" in
2066 '') echo $n \"\$rp $c\" >&4;;
2067 *) case \"\$rp\" in
2068         '') echo $n \"[\$xxxm] $c\";;
2069         *)
2070                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2071                         echo \"\$rp\" >&4
2072                         echo $n \"[\$xxxm] $c\" >&4
2073                 else
2074                         echo $n \"\$rp [\$xxxm] $c\" >&4
2075                 fi
2076                 ;;
2077         esac;;
2078 esac"
2079
2080 : now set up to do reads with possible shell escape and default assignment
2081 cat <<EOSC >myread
2082 $startsh
2083 xxxm=\$dflt
2084 $myecho
2085 ans='!'
2086 case "\$fastread" in
2087 yes) case "\$dflt" in
2088         '') ;;
2089         *) ans='';
2090                 case "\$silent-\$rp" in
2091                 true-) ;;
2092                 *) echo " " >&4;;
2093                 esac;;
2094         esac;;
2095 *) case "\$silent" in
2096         true) case "\$rp" in
2097                 '') ans='';;
2098                 esac;;
2099         esac;;
2100 esac
2101 while expr "X\$ans" : "X!" >/dev/null; do
2102         read answ
2103         set x \$xxxm
2104         shift
2105         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2106         case  "\$answ" in
2107         "!")
2108                 sh 1>&4
2109                 echo " "
2110                 $myecho
2111                 ;;
2112         !*)
2113                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2114                 shift
2115                 sh 1>&4 -c "\$*"
2116                 echo " "
2117                 $myecho
2118                 ;;
2119         "\$ans")
2120                 case "\$ans" in
2121                 \\&*)
2122                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2123                         shift
2124                         case "\$1" in
2125                         -d)
2126                                 fastread=yes
2127                                 echo "(OK, I'll run with -d after this question.)" >&4
2128                                 ;;
2129                         -*)
2130                                 echo "*** Sorry, \$1 not supported yet." >&4
2131                                 ;;
2132                         esac
2133                         $myecho
2134                         ans=!
2135                         ;;
2136                 esac;;
2137         *)
2138                 case "\$aok" in
2139                 y)
2140                         echo "*** Substitution done -- please confirm."
2141                         xxxm="\$ans"
2142                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2143                         xxxm="\$ans"
2144                         ans=!
2145                         ;;
2146                 *)
2147                         echo "*** Error -- try again."
2148                         ans=!
2149                         ;;
2150                 esac
2151                 $myecho
2152                 ;;
2153         esac
2154         case "\$ans\$xxxm\$nostick" in
2155         '')
2156                 ans=!
2157                 $myecho
2158                 ;;
2159         esac
2160 done
2161 case "\$ans" in
2162 '') ans="\$xxxm";;
2163 esac
2164 EOSC
2165
2166 : create .config dir to save info across Configure sessions
2167 test -d ../.config || mkdir ../.config
2168 cat >../.config/README <<EOF
2169 This directory created by Configure to save information that should
2170 persist across sessions for $package.
2171
2172 You may safely delete it if you wish.
2173 EOF
2174
2175 : See if we are using a devel version and want that
2176 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2177 case "$usedevel" in
2178 $define|true|[yY]*)
2179     usedevel="$define" ;;
2180 *) case "$xversion" in
2181    *[13579])
2182         cat >&4 <<EOH
2183 *** WHOA THERE!!! ***
2184
2185     This is an UNSTABLE DEVELOPMENT release.
2186     The version of this $package distribution is $xversion, that is, odd,
2187     (as opposed to even) and that signifies a development release.
2188     If you want a maintenance release, you want an even-numbered version.
2189
2190     Do ***NOT*** install this into production use.
2191     Data corruption and crashes are possible.
2192
2193     It is most seriously suggested that you do not continue any further
2194     unless you want to help in developing and debugging Perl.
2195
2196     If you *still* want to build perl, you can answer 'y' now,
2197     or pass -Dusedevel to Configure.
2198
2199 EOH
2200         rp='Do you really want to continue?'
2201         dflt='n'
2202         . ./myread
2203         case "$ans" in
2204         [yY]) echo >&4 "Okay, continuing."
2205               usedevel="$define" ;;
2206         *) echo >&4 "Okay, bye."
2207            exit 1
2208            ;;
2209         esac
2210         ;;
2211     esac
2212     usedevel="$undef"
2213     ;;
2214 esac
2215 case "$usedevel" in
2216 $define|true|[yY]*)
2217         case "$versiononly" in
2218         '') versiononly="$define" ;;
2219         esac
2220         case "$installusrbinperl" in
2221         '') installusrbinperl="$undef" ;;
2222         esac
2223         ;;
2224 esac
2225
2226 : general instructions
2227 needman=true
2228 firsttime=true
2229 user=`(logname) 2>/dev/null`
2230 case "$user" in
2231 '') user=`whoami 2>&1`;;
2232 esac
2233 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2234         firsttime=false
2235         echo " "
2236         rp='Would you like to see the instructions?'
2237         dflt=n
2238         . ./myread
2239         case "$ans" in
2240         [yY]*) ;;
2241         *) needman=false;;
2242         esac
2243 fi
2244 if $needman; then
2245         cat <<EOH
2246
2247 This installation shell script will examine your system and ask you questions
2248 to determine how the perl5 package should be installed. If you get
2249 stuck on a question, you may use a ! shell escape to start a subshell or
2250 execute a command.  Many of the questions will have default answers in square
2251 brackets; typing carriage return will give you the default.
2252
2253 On some of the questions which ask for file or directory names you are allowed
2254 to use the ~name construct to specify the login directory belonging to "name",
2255 even if you don't have a shell which knows about that.  Questions where this is
2256 allowed will be marked "(~name ok)".
2257
2258 EOH
2259         rp=''
2260         dflt='Type carriage return to continue'
2261         . ./myread
2262         cat <<'EOH'
2263
2264 The prompter used in this script allows you to use shell variables and
2265 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2266 in the default answer, as if the default line was a set of arguments given to a
2267 script shell.  This means you may also use $* to repeat the whole default line,
2268 so you do not have to re-type everything to add something to the default.
2269
2270 Every time there is a substitution, you will have to confirm.  If there is an
2271 error (e.g. an unmatched backtick), the default answer will remain unchanged
2272 and you will be prompted again.
2273
2274 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2275 the questions and use the computed defaults (or the previous answers if there
2276 was already a config.sh file). Type 'Configure -h' for a list of options.
2277 You may also start interactively and then answer '& -d' at any prompt to turn
2278 on the non-interactive behaviour for the remainder of the execution.
2279
2280 EOH
2281         . ./myread
2282         cat <<EOH
2283
2284 Much effort has been expended to ensure that this shell script will run on any
2285 Unix system.  If despite that it blows up on yours, your best bet is to edit
2286 Configure and run it again.  If you can't run Configure for some reason,
2287 you'll have to generate a config.sh file by hand.  Whatever problems you
2288 have, let me (perlbug@perl.org) know how I blew it.
2289
2290 This installation script affects things in two ways:
2291
2292 1) it may do direct variable substitutions on some of the files included
2293    in this kit.
2294 2) it builds a config.h file for inclusion in C programs.  You may edit
2295    any of these files as the need arises after running this script.
2296
2297 If you make a mistake on a question, there is no easy way to back up to it
2298 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2299 files.  Configure will offer to let you do this before it runs the SH files.
2300
2301 EOH
2302         dflt='Type carriage return to continue'
2303         . ./myread
2304         case "$firsttime" in
2305         true) echo $user >>../.config/instruct;;
2306         esac
2307 fi
2308
2309 : find out where common programs are
2310 echo " "
2311 echo "Locating common programs..." >&4
2312 cat <<EOSC >loc
2313 $startsh
2314 case \$# in
2315 0) exit 1;;
2316 esac
2317 thing=\$1
2318 shift
2319 dflt=\$1
2320 shift
2321 for dir in \$*; do
2322         case "\$thing" in
2323         .)
2324         if test -d \$dir/\$thing; then
2325                 echo \$dir
2326                 exit 0
2327         fi
2328         ;;
2329         *)
2330         for thisthing in \$dir/\$thing; do
2331                 : just loop through to pick last item
2332         done
2333         if test -f \$thisthing; then
2334                 echo \$thisthing
2335                 exit 0
2336         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2337                 echo \$thisthing
2338                 exit 0
2339         elif test -f \$dir/\$thing.exe; then
2340                 if test -n "$DJGPP"; then
2341                         echo \$dir/\$thing.exe
2342                 elif test "$eunicefix" != ":"; then
2343                         : on Eunice apparently
2344                         echo \$dir/\$thing
2345                 fi
2346                 exit 0
2347         fi
2348         ;;
2349         esac
2350 done
2351 echo \$dflt
2352 exit 1
2353 EOSC
2354 chmod +x loc
2355 $eunicefix loc
2356 loclist="
2357 awk
2358 cat
2359 chmod
2360 comm
2361 cp
2362 echo
2363 expr
2364 grep
2365 ls
2366 mkdir
2367 rm
2368 sed
2369 sort
2370 touch
2371 tr
2372 uniq
2373 "
2374 trylist="
2375 ar
2376 bison
2377 byacc
2378 cpp
2379 csh
2380 date
2381 egrep
2382 gmake
2383 gzip
2384 less
2385 ln
2386 make
2387 more
2388 nm
2389 nroff
2390 perl
2391 pg
2392 test
2393 uname
2394 zip
2395 "
2396 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2397 pth="$pth /lib /usr/lib"
2398 for file in $loclist; do
2399         eval xxx=\$$file
2400         case "$xxx" in
2401         /*|?:[\\/]*)
2402                 if test -f "$xxx"; then
2403                         : ok
2404                 else
2405                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2406                         xxx=`./loc $file $file $pth`
2407                 fi
2408                 ;;
2409         '') xxx=`./loc $file $file $pth`;;
2410         *) xxx=`./loc $xxx $xxx $pth`;;
2411         esac
2412         eval $file=$xxx$_exe
2413         eval _$file=$xxx
2414         case "$xxx" in
2415         /*)
2416                 echo $file is in $xxx.
2417                 ;;
2418         ?:[\\/]*)
2419                 echo $file is in $xxx.
2420                 ;;
2421         *)
2422                 echo "I don't know where '$file' is, and my life depends on it." >&4
2423                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2424                 exit 1
2425                 ;;
2426         esac
2427 done
2428 echo " "
2429 echo "Don't worry if any of the following aren't found..."
2430 say=offhand
2431 for file in $trylist; do
2432         eval xxx=\$$file
2433         case "$xxx" in
2434         /*|?:[\\/]*)
2435                 if test -f "$xxx"; then
2436                         : ok
2437                 else
2438                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2439                         xxx=`./loc $file $file $pth`
2440                 fi
2441                 ;;
2442         '') xxx=`./loc $file $file $pth`;;
2443         *) xxx=`./loc $xxx $xxx $pth`;;
2444         esac
2445         eval $file=$xxx$_exe
2446         eval _$file=$xxx
2447         case "$xxx" in
2448         /*)
2449                 echo $file is in $xxx.
2450                 ;;
2451         ?:[\\/]*)
2452                 echo $file is in $xxx.
2453                 ;;
2454         *)
2455                 echo "I don't see $file out there, $say."
2456                 say=either
2457                 ;;
2458         esac
2459 done
2460 case "$egrep" in
2461 egrep)
2462         echo "Substituting grep for egrep."
2463         egrep=$grep
2464         _egrep=$grep
2465         ;;
2466 esac
2467 case "$less" in
2468 '')     ;;
2469 *)      if $less -R </dev/null >/dev/null; then
2470                echo "Substituting less -R for less."
2471                less="$less -R"
2472                _less=$less
2473         fi
2474         ;;
2475 esac
2476 case "$ln" in
2477 ln)
2478         echo "Substituting cp for ln."
2479         ln=$cp
2480         _ln=$cp
2481         ;;
2482 esac
2483 case "$make" in
2484 make)
2485         case "$gmake" in
2486         gmake)
2487         echo "I can't find make or gmake, and my life depends on it." >&4
2488         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2489         exit 1
2490         ;;
2491         esac
2492         ;;
2493 esac
2494 case "$gmake" in
2495 gmake)  ;;
2496 *)      # We can't have osname yet.
2497         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2498                 # Assume that gmake, if found, is definitely GNU make
2499                 # and prefer it over the system make.
2500                 echo "Substituting gmake for make."
2501                 make=$gmake
2502                 _make=$gmake
2503         fi
2504         ;;
2505 esac
2506 case "$test" in
2507 test)
2508         echo "Hopefully test is built into your sh."
2509         ;;
2510 *)
2511         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2512                 echo "Using the test built into your sh."
2513                 test=test
2514                 _test=test
2515         fi
2516         ;;
2517 esac
2518 case "$echo" in
2519 echo)
2520         echo "Hopefully echo is built into your sh."
2521         ;;
2522 '') ;;
2523 *)
2524         echo " "
2525 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2526         $echo $n "hi there$c" >foo1
2527         echo $n "hi there$c" >foo2
2528         if cmp foo1 foo2 >/dev/null 2>&1; then
2529                 echo "They are compatible.  In fact, they may be identical."
2530         else
2531                 case "$n" in
2532                 '-n') n='' c='\c';;
2533                 *) n='-n' c='';;
2534                 esac
2535                 cat <<FOO
2536 They are not compatible!  You are probably running ksh on a non-USG system.
2537 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2538 have echo built in and we may have to run some Bourne shell scripts.  That
2539 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2540
2541 FOO
2542                 $echo $n "The star should be here-->$c"
2543                 $echo "*"
2544         fi
2545         $rm -f foo1 foo2
2546         ;;
2547 esac
2548
2549 # This question was auctioned at YAPC::Europe-2007 in Vienna
2550 # I never promised you could answer it. I only auctioned the question.
2551 cat <<FOO
2552 The following message is sponsored by
2553
2554   Dresden.pm<--The stars should be here.
2555
2556 Dear Perl user, system administrator or package
2557 maintainer, the Perl community sends greetings to
2558 you. Do you (emblematical) greet back [Y/n]? n
2559
2560 FOO
2561
2562 : Check what type of C compiler we use
2563 cat <<EOS >trygcc
2564 $startsh
2565 EOS
2566 cat <<'EOSC' >>trygcc
2567 case "$cc" in
2568 '') ;;
2569 *)  $rm -f try try.*
2570     $cat >try.c <<EOM
2571 int main(int argc, char *argv[]) {
2572   return 0;
2573 }
2574 EOM
2575     if $cc -o try $ccflags $ldflags try.c; then
2576        :
2577     else
2578         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2579         despair=yes
2580         trygcc=yes
2581         case "$cc" in
2582         *gcc*) trygcc=no ;;
2583         esac
2584         # Skip this test because it gives a false match on output like:
2585         #    ./trygcc: line 23: cc: command not found
2586         # case "`$cc -v -c try.c 2>&1`" in
2587         # *gcc*) trygcc=no ;;
2588         # esac
2589         if $test X"$trygcc" = Xyes; then
2590             if gcc -o try -c try.c; then
2591                 echo " "
2592                 echo "You seem to have a working gcc, though." >&4
2593                 # Switching compilers may undo the work of hints files.
2594                 # The most common problem is -D_REENTRANT for threads.
2595                 # This heuristic catches that case, but gets false positives
2596                 # if -Dusethreads was not actually specified.  Better to
2597                 # bail out here with a useful message than fail 
2598                 # mysteriously later. Should we perhaps just try to
2599                 # re-invoke Configure -Dcc=gcc config_args ?
2600                 if $test -f usethreads.cbu; then
2601                         $cat >&4 <<EOM 
2602
2603 *** However, any setting of the C compiler flags (e.g. for thread support)
2604 *** will be lost.  It may be necessary for you to restart Configure and
2605 *** add -Dcc=gcc to your Configure command line.
2606
2607 EOM
2608                         rp="Would you like to go ahead and try gcc anyway?"
2609                         dflt=n
2610                 else
2611                         rp="Would you like to use it?"
2612                         dflt=y
2613                 fi
2614                 if $test -f myread; then
2615                     . ./myread
2616                 else
2617                     if $test -f UU/myread; then
2618                         . ./UU/myread
2619                     else
2620                         echo "Cannot find myread, sorry.  Aborting." >&2
2621                         exit 1
2622                     fi
2623                 fi  
2624                 case "$ans" in
2625                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2626                 esac
2627             fi
2628         fi
2629     fi
2630     $rm -f try try.*
2631     ;;
2632 esac
2633 EOSC
2634
2635 cat <<EOS >checkcc
2636 $startsh
2637 EOS
2638 cat <<'EOSC' >>checkcc
2639 case "$cc" in        
2640 '') ;;
2641 *)  $rm -f try try.*              
2642     $cat >try.c <<EOM
2643 int main(int argc, char *argv[]) {
2644   return 0;
2645 }
2646 EOM
2647     if $cc -o try $ccflags $ldflags try.c; then
2648        :
2649     else
2650         if $test X"$despair" = Xyes; then
2651            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2652         fi
2653         $cat >&4 <<EOM         
2654 You need to find a working C compiler.
2655 Either (purchase and) install the C compiler supplied by your OS vendor,
2656 or for a free C compiler try http://gcc.gnu.org/
2657 I cannot continue any further, aborting.
2658 EOM
2659         exit 1
2660     fi
2661     $rm -f try try.*
2662     ;;
2663 esac
2664 EOSC
2665
2666 : determine whether symbolic links are supported
2667 echo " "
2668 $touch blurfl
2669 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2670         echo "Symbolic links are supported." >&4
2671         lns="$ln -s"
2672 else
2673         echo "Symbolic links are NOT supported." >&4
2674         lns="$ln"
2675 fi
2676 $rm -f blurfl sym
2677
2678 : determine whether symbolic links are supported
2679 echo " "
2680 case "$lns" in
2681 *"ln"*" -s")
2682         echo "Checking how to test for symbolic links..." >&4
2683         $lns blurfl sym
2684         if $test "X$issymlink" = X; then
2685                 case "$newsh" in
2686                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2687                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2688                 esac
2689                 if test $? = 0; then
2690                         issymlink="test -h"
2691                 else
2692                         echo "Your builtin 'test -h' may be broken." >&4
2693                         case "$test" in
2694                         /*)     ;;
2695                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2696                                 for p in $pth
2697                                 do
2698                                         if test -f "$p/$test"; then
2699                                                 test="$p/$test"
2700                                                 break
2701                                         fi
2702                                 done
2703                                 ;;
2704                         esac
2705                         case "$test" in
2706                         /*)
2707                                 echo "Trying external '$test -h'." >&4
2708                                 issymlink="$test -h"
2709                                 if $test ! -h sym >/dev/null 2>&1; then
2710                                         echo "External '$test -h' is broken, too." >&4
2711                                         issymlink=''
2712                                 fi
2713                                 ;;
2714                         *)      issymlink='' ;;
2715                         esac
2716                 fi              
2717         fi
2718         if $test "X$issymlink" = X; then
2719                 if $test -L sym 2>/dev/null; then
2720                         issymlink="$test -L"
2721                         echo "The builtin '$test -L' worked." >&4
2722                 fi
2723         fi
2724         if $test "X$issymlink" != X; then
2725                 echo "You can test for symbolic links with '$issymlink'." >&4
2726         else
2727                 echo "I do not know how you can test for symbolic links." >&4
2728         fi
2729         $rm -f blurfl sym
2730         ;;
2731 *)      echo "No symbolic links, so not testing for their testing..." >&4
2732         ;;
2733 esac
2734 echo " "
2735
2736 : Make symlinks util
2737 case "$mksymlinks" in
2738 $define|true|[yY]*)
2739         case "$src" in
2740         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2741                 exit 1
2742                 ;;
2743         *)      case "$lns:$issymlink" in
2744                 *"ln"*" -s:"*"test -"?)
2745                         echo "Creating the symbolic links..." >&4
2746                         echo "(First creating the subdirectories...)" >&4
2747                         cd ..
2748                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2749                                 read directory
2750                                 test -z "$directory" && break
2751                                 mkdir -p $directory
2752                         done
2753                         # Sanity check 1.
2754                         if test ! -d t/base; then
2755                                 echo "Failed to create the subdirectories.  Aborting." >&4
2756                                 exit 1
2757                         fi
2758                         echo "(Then creating the symlinks...)" >&4
2759                         awk '{print $1}' $src/MANIFEST | while true; do
2760                                 read filename
2761                                 test -z "$filename" && break
2762                                 if test -f $filename; then
2763                                         if $issymlink $filename; then
2764                                                 rm -f $filename
2765                                         fi
2766                                 fi
2767                                 if test -f $filename; then
2768                                         echo "$filename already exists, not symlinking."
2769                                 else
2770                                         ln -s $src/$filename $filename
2771                                 fi
2772                         done
2773                         # Sanity check 2.
2774                         if test ! -f t/base/lex.t; then
2775                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2776                                 exit 1
2777                         fi
2778                         cd UU
2779                         ;;
2780                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2781                         ;;
2782                 esac
2783                 ;;
2784         esac
2785         ;;
2786 esac
2787
2788 : Check for Cross-Compilation
2789 case "$usecrosscompile" in
2790 $define|true|[yY]*)
2791         $echo "Cross-compiling..."
2792         croak=''
2793         case "$cc" in
2794         *-*-gcc) # A cross-compiling gcc, probably.
2795             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2796             ar=$targetarch-ar
2797             # leave out ld, choosing it is more complex
2798             nm=$targetarch-nm
2799             ranlib=$targetarch-ranlib
2800             $echo 'extern int foo;' > try.c
2801             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2802             shift
2803             if $test $# -gt 0; then
2804                 incpth="$incpth $*"
2805                 incpth="`$echo $incpth|$sed 's/^ //'`"
2806                 echo "Guessing incpth '$incpth'." >&4
2807                 for i in $*; do
2808                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2809                     if $test -d $j; then
2810                         libpth="$libpth $j"
2811                     fi
2812                 done   
2813                 libpth="`$echo $libpth|$sed 's/^ //'`"
2814                 echo "Guessing libpth '$libpth'." >&4
2815             fi
2816             $rm -f try.c
2817             ;;
2818         esac
2819         case "$targetarch" in
2820         '') echo "Targetarch not defined." >&4; croak=y ;;
2821         *)  echo "Using targetarch $targetarch." >&4 ;;
2822         esac
2823         case "$incpth" in
2824         '') echo "Incpth not defined." >&4; croak=y ;;
2825         *)  echo "Using incpth '$incpth'." >&4 ;;
2826         esac
2827         case "$libpth" in
2828         '') echo "Libpth not defined." >&4; croak=y ;;
2829         *)  echo "Using libpth '$libpth'." >&4 ;;
2830         esac
2831         case "$usrinc" in
2832         '') for i in $incpth; do
2833                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2834                     usrinc=$i
2835                     echo "Guessing usrinc $usrinc." >&4
2836                     break
2837                 fi
2838             done
2839             case "$usrinc" in
2840             '') echo "Usrinc not defined." >&4; croak=y ;;
2841             esac
2842             ;;
2843         *)  echo "Using usrinc $usrinc." >&4 ;;
2844         esac
2845         case "$targethost" in
2846         '') echo "Targethost not defined." >&4; croak=y ;;
2847         *)  echo "Using targethost $targethost." >&4
2848         esac
2849         locincpth=' '
2850         loclibpth=' '
2851         case "$croak" in
2852         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2853         esac
2854         case "$src" in
2855         /*) run=$src/Cross/run
2856             targetmkdir=$src/Cross/mkdir
2857             to=$src/Cross/to
2858             from=$src/Cross/from
2859             ;;
2860         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2861             run=$pwd/Cross/run
2862             targetmkdir=$pwd/Cross/mkdir
2863             to=$pwd/Cross/to
2864             from=$pwd/Cross/from
2865             ;;
2866         esac
2867         case "$targetrun" in
2868         '') targetrun=ssh ;;
2869         esac
2870         case "$targetto" in
2871         '') targetto=scp ;;
2872         esac
2873         case "$targetfrom" in
2874         '') targetfrom=scp ;;
2875         esac
2876         run=$run-$targetrun
2877         to=$to-$targetto
2878         from=$from-$targetfrom
2879         case "$targetdir" in
2880         '')  targetdir=/tmp
2881              echo "Guessing targetdir $targetdir." >&4
2882              ;;
2883         esac
2884         case "$targetuser" in
2885         '')  targetuser=root
2886              echo "Guessing targetuser $targetuser." >&4
2887              ;;
2888         esac
2889         case "$targetfrom" in
2890         scp)    q=-q ;;
2891         *)      q='' ;;
2892         esac
2893         case "$targetrun" in
2894         ssh|rsh)
2895             cat >$run <<EOF
2896 #!/bin/sh
2897 case "\$1" in
2898 -cwd)
2899   shift
2900   cwd=\$1
2901   shift
2902   ;;
2903 esac
2904 case "\$cwd" in
2905 '') cwd=$targetdir ;;
2906 esac
2907 exe=\$1
2908 shift
2909 if $test ! -f \$exe.xok; then
2910   $to \$exe
2911   $touch \$exe.xok
2912 fi
2913 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2914 EOF
2915             ;;
2916         *)  echo "Unknown targetrun '$targetrun'" >&4
2917             exit 1
2918             ;;
2919         esac
2920         case "$targetmkdir" in
2921         */Cross/mkdir)
2922             cat >$targetmkdir <<EOF
2923 #!/bin/sh
2924 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2925 EOF
2926             $chmod a+rx $targetmkdir
2927             ;;
2928         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2929             exit 1
2930             ;;
2931         esac
2932         case "$targetto" in
2933         scp|rcp)
2934             cat >$to <<EOF
2935 #!/bin/sh
2936 for f in \$@
2937 do
2938   case "\$f" in
2939   /*)
2940     $targetmkdir \`dirname \$f\`
2941     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2942     ;;
2943   *)
2944     $targetmkdir $targetdir/\`dirname \$f\`
2945     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2946     ;;
2947   esac
2948 done
2949 exit 0
2950 EOF
2951             ;;
2952         cp) cat >$to <<EOF
2953 #!/bin/sh
2954 for f in \$@
2955 do
2956   case "\$f" in
2957   /*)
2958     $mkdir -p $targetdir/\`dirname \$f\`
2959     $cp \$f $targetdir/\$f || exit 1
2960     ;;
2961   *)
2962     $targetmkdir $targetdir/\`dirname \$f\`
2963     $cp \$f $targetdir/\$f || exit 1
2964     ;;
2965   esac
2966 done
2967 exit 0
2968 EOF
2969             ;;
2970         *)  echo "Unknown targetto '$targetto'" >&4
2971             exit 1
2972             ;;
2973         esac
2974         case "$targetfrom" in
2975         scp|rcp)
2976           cat >$from <<EOF
2977 #!/bin/sh
2978 for f in \$@
2979 do
2980   $rm -f \$f
2981   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2982 done
2983 exit 0
2984 EOF
2985             ;;
2986         cp) cat >$from <<EOF
2987 #!/bin/sh
2988 for f in \$@
2989 do
2990   $rm -f \$f
2991   cp $targetdir/\$f . || exit 1
2992 done
2993 exit 0
2994 EOF
2995             ;;
2996         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2997             exit 1
2998             ;;
2999         esac
3000         if $test ! -f $run; then
3001             echo "Target 'run' script '$run' not found." >&4
3002         else
3003             $chmod a+rx $run
3004         fi
3005         if $test ! -f $to; then
3006             echo "Target 'to' script '$to' not found." >&4
3007         else
3008             $chmod a+rx $to
3009         fi
3010         if $test ! -f $from; then
3011             echo "Target 'from' script '$from' not found." >&4
3012         else
3013             $chmod a+rx $from
3014         fi
3015         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3016             exit 1
3017         fi
3018         cat >&4 <<EOF
3019 Using '$run' for remote execution,
3020 and '$from' and '$to'
3021 for remote file transfer.
3022 EOF
3023         ;;
3024 *)      run=''
3025         to=:
3026         from=:
3027         usecrosscompile='undef'
3028         targetarch=''
3029         ;;
3030 esac
3031
3032 : see whether [:lower:] and [:upper:] are supported character classes
3033 echo " "
3034 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3035 ABYZ)
3036         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3037         up='[:upper:]'
3038         low='[:lower:]'
3039         ;;
3040 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3041         # (0xd9 and 0xe2), therefore that is a nice testing point.
3042         if test "X$up" = X -o "X$low" = X; then
3043             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3044             rs) up='[A-Z]'
3045                 low='[a-z]'
3046                 ;;
3047             esac
3048         fi
3049         if test "X$up" = X -o "X$low" = X; then
3050             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3051             rs) up='A-Z'
3052                 low='a-z'
3053                 ;;
3054             esac
3055         fi
3056         if test "X$up" = X -o "X$low" = X; then
3057             case "`echo RS | od -x 2>/dev/null`" in
3058             *D9E2*|*d9e2*)
3059                 echo "Hey, this might be EBCDIC." >&4
3060                 if test "X$up" = X -o "X$low" = X; then
3061                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3062                     rs) up='[A-IJ-RS-Z]'
3063                         low='[a-ij-rs-z]'
3064                         ;;
3065                     esac
3066                 fi
3067                 if test "X$up" = X -o "X$low" = X; then
3068                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3069                     rs) up='A-IJ-RS-Z'
3070                         low='a-ij-rs-z'
3071                         ;;
3072                     esac
3073                 fi
3074                 ;;
3075             esac
3076         fi
3077 esac
3078 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3079 rs)
3080     echo "Using $up and $low to convert case." >&4
3081     ;;
3082 *)
3083     echo "I don't know how to translate letters from upper to lower case." >&4
3084     echo "Your tr is not acting any way I know of." >&4
3085     exit 1
3086     ;;
3087 esac
3088 : set up the translation script tr, must be called with ./tr of course
3089 cat >tr <<EOSC
3090 $startsh
3091 case "\$1\$2" in
3092 '[A-Z][a-z]') exec $tr '$up' '$low';;
3093 '[a-z][A-Z]') exec $tr '$low' '$up';;
3094 esac
3095 exec $tr "\$@"
3096 EOSC
3097 chmod +x tr
3098 $eunicefix tr
3099
3100 : Try to determine whether config.sh was made on this system
3101 case "$config_sh" in
3102 '')
3103 myuname=`$uname -a 2>/dev/null`
3104 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3105 # Downcase everything to avoid ambiguity.
3106 # Remove slashes and single quotes so we can use parts of this in 
3107 # directory and file names.
3108 # Remove newlines so myuname is sane to use elsewhere.
3109 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3110 # because the A-Z/a-z are not consecutive.
3111 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3112         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3113 newmyuname="$myuname"
3114 dflt=n
3115 case "$knowitall" in
3116 '')
3117         if test -f ../config.sh; then
3118                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3119                         eval "`grep myuname= ../config.sh`"
3120                 fi
3121                 if test "X$myuname" = "X$newmyuname"; then
3122                         dflt=y
3123                 fi
3124         fi
3125         ;;
3126 *) dflt=y;;
3127 esac
3128
3129 : Get old answers from old config file if Configure was run on the
3130 : same system, otherwise use the hints.
3131 hint=default
3132 cd ..
3133 if test -f config.sh; then
3134         echo " "
3135         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3136         . UU/myread
3137         case "$ans" in
3138         n*|N*) echo "OK, I'll ignore it."
3139                 mv config.sh config.sh.old
3140                 myuname="$newmyuname"
3141                 ;;
3142         *)  echo "Fetching default answers from your old config.sh file..." >&4
3143                 tmp_n="$n"
3144                 tmp_c="$c"
3145                 tmp_sh="$sh"
3146                 . ./config.sh
3147                 cp config.sh UU
3148                 n="$tmp_n"
3149                 c="$tmp_c"
3150                 : Older versions did not always set $sh.  Catch re-use of such
3151                 : an old config.sh.
3152                 case "$sh" in
3153                 '') sh="$tmp_sh" ;;
3154                 esac
3155                 hint=previous
3156                 ;;
3157         esac
3158 fi
3159 . ./UU/checkcc
3160 if test ! -f config.sh; then
3161         $cat <<EOM
3162
3163 First time through, eh?  I have some defaults handy for some systems
3164 that need some extra help getting the Configure answers right:
3165
3166 EOM
3167         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3168         dflt=''
3169         : Half the following guesses are probably wrong... If you have better
3170         : tests or hints, please send them to perlbug@perl.org
3171         : The metaconfig authors would also appreciate a copy...
3172         $test -f /irix && osname=irix
3173         $test -f /xenix && osname=sco_xenix
3174         $test -f /dynix && osname=dynix
3175         $test -f /dnix && osname=dnix
3176         $test -f /lynx.os && osname=lynxos
3177         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3178         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3179         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3180         $test -f /bin/mips && /bin/mips && osname=mips
3181         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3182                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3183         $test -d /usr/apollo/bin && osname=apollo
3184         $test -f /etc/saf/_sactab && osname=svr4
3185         $test -d /usr/include/minix && osname=minix
3186         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3187         if $test -d /MachTen -o -d /MachTen_Folder; then
3188                 osname=machten
3189                 if $test -x /sbin/version; then
3190                         osvers=`/sbin/version | $awk '{print $2}' |
3191                         $sed -e 's/[A-Za-z]$//'`
3192                 elif $test -x /usr/etc/version; then
3193                         osvers=`/usr/etc/version | $awk '{print $2}' |
3194                         $sed -e 's/[A-Za-z]$//'`
3195                 else
3196                         osvers="$2.$3"
3197                 fi
3198         fi
3199
3200         $test -f /sys/posix.dll &&
3201                 $test -f /usr/bin/what &&
3202                 set X `/usr/bin/what /sys/posix.dll` &&
3203                 $test "$3" = UWIN &&
3204                 osname=uwin &&
3205                 osvers="$5"
3206
3207         if $test -f $uname; then
3208                 set X $myuname
3209                 shift
3210
3211                 case "$5" in
3212                 fps*) osname=fps ;;
3213                 mips*)
3214                         case "$4" in
3215                         umips) osname=umips ;;
3216                         *) osname=mips ;;
3217                         esac;;
3218                 [23]100) osname=mips ;;
3219                 next*) osname=next ;;
3220                 i386*)
3221                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3222                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3223                                 osname='sco'
3224                                 osvers=$tmp
3225                         elif $test -f /etc/kconfig; then
3226                                 osname=isc
3227                                 if test "$lns" = "$ln -s"; then
3228                                         osvers=4
3229                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3230                                         osvers=3
3231                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3232                                         osvers=2
3233                                 fi
3234                         fi
3235                         tmp=''
3236                         ;;
3237                 pc*)
3238                         if test -n "$DJGPP"; then
3239                                 osname=dos
3240                                 osvers=djgpp
3241                         fi
3242                         ;;
3243                 esac
3244
3245                 case "$1" in
3246                 aix) osname=aix
3247                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3248                         case "$tmp" in
3249                         # oslevel can fail with:
3250                         # oslevel: Unable to acquire lock.
3251                         *not\ found) osvers="$4"."$3" ;;
3252                         '<3240'|'<>3240') osvers=3.2.0 ;;
3253                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3254                         '=3250'|'>3250') osvers=3.2.5 ;;
3255                         *) osvers=$tmp;;
3256                         esac
3257                         ;;
3258                 bsd386) osname=bsd386
3259                         osvers=`$uname -r`
3260                         ;;
3261                 cygwin*) osname=cygwin
3262                         osvers="$3"
3263                         ;;
3264                 *dc.osx) osname=dcosx
3265                         osvers="$3"
3266                         ;;
3267                 dnix) osname=dnix
3268                         osvers="$3"
3269                         ;;
3270                 domainos) osname=apollo
3271                         osvers="$3"
3272                         ;;
3273                 dgux)   osname=dgux
3274                         osvers="$3"
3275                         ;;
3276                 dragonfly) osname=dragonfly
3277                         osvers="$3"
3278                         ;;
3279                 dynixptx*) osname=dynixptx
3280                         osvers=`echo "$4"|sed 's/^v//'`
3281                         ;;
3282                 freebsd) osname=freebsd
3283                         osvers="$3" ;;
3284                 genix)  osname=genix ;;
3285                 gnu)    osname=gnu
3286                         osvers="$3" ;;
3287                 hp*)    osname=hpux
3288                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3289                         ;;
3290                 irix*)  osname=irix
3291                         case "$3" in
3292                         4*) osvers=4 ;;
3293                         5*) osvers=5 ;;
3294                         *)      osvers="$3" ;;
3295                         esac
3296                         ;;
3297                 linux)  osname=linux
3298                         case "$3" in
3299                         *)      osvers="$3" ;;
3300                         esac
3301                         ;;
3302                 MiNT)   osname=mint
3303                         ;;
3304                 netbsd*) osname=netbsd
3305                         osvers="$3"
3306                         ;;
3307                 news-os) osvers="$3"
3308                         case "$3" in
3309                         4*) osname=newsos4 ;;
3310                         *) osname=newsos ;;
3311                         esac
3312                         ;;
3313                 next*) osname=next ;;
3314                 nonstop-ux) osname=nonstopux ;;
3315                 openbsd) osname=openbsd
3316                         osvers="$3"
3317                         ;;
3318                 os2)    osname=os2
3319                         osvers="$4"
3320                         ;;
3321                 POSIX-BC | posix-bc ) osname=posix-bc
3322                         osvers="$3"
3323                         ;;
3324                 powerux | power_ux | powermax_os | powermaxos | \
3325                 powerunix | power_unix) osname=powerux
3326                         osvers="$3"
3327                         ;;
3328                 qnx) osname=qnx
3329                         osvers="$4"
3330                         ;;
3331                 solaris) osname=solaris
3332                         case "$3" in
3333                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3334                         *)      osvers="$3" ;;
3335                         esac
3336                         ;;
3337                 sunos) osname=sunos
3338                         case "$3" in
3339                         5*) osname=solaris
3340                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3341                         *)      osvers="$3" ;;
3342                         esac
3343                         ;;
3344                 titanos) osname=titanos
3345                         case "$3" in
3346                         1*) osvers=1 ;;
3347                         2*) osvers=2 ;;
3348                         3*) osvers=3 ;;
3349                         4*) osvers=4 ;;
3350                         *)      osvers="$3" ;;
3351                         esac
3352                         ;;
3353                 ultrix) osname=ultrix
3354                         osvers="$3"
3355                         ;;
3356                 osf1|mls+)      case "$5" in
3357                                 alpha)
3358                                         osname=dec_osf
3359                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3360                                         case "$osvers" in
3361                                         [1-9].[0-9]*) ;;
3362                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3363                                         esac
3364                                         ;;
3365                         hp*)    osname=hp_osf1  ;;
3366                         mips)   osname=mips_osf1 ;;
3367                         esac
3368                         ;;
3369                 # UnixWare 7.1.2 is known as Open UNIX 8
3370                 openunix|unixware) osname=svr5
3371                         osvers="$4"
3372                         ;;
3373                 uts)    osname=uts
3374                         osvers="$3"
3375                         ;;
3376                 vos) osvers="$3"
3377                         ;;
3378                 $2) case "$osname" in
3379                         *isc*) ;;
3380                         *freebsd*) ;;
3381                         svr*)
3382                                 : svr4.x or possibly later
3383                                 case "svr$3" in
3384                                 ${osname}*)
3385                                         osname=svr$3
3386                                         osvers=$4
3387                                         ;;
3388                                 esac
3389                                 case "$osname" in
3390                                 svr4.0)
3391                                         : Check for ESIX
3392                                         if test -f /stand/boot ; then
3393                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3394                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3395                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3396                                                         if test -n "$isesix"; then
3397                                                                 osname=esix4
3398                                                         fi
3399                                                 fi
3400                                         fi
3401                                         ;;
3402                                 esac
3403                                 ;;
3404                         *)      if test -f /etc/systemid; then
3405                                         osname=sco
3406                                         set `echo $3 | $sed 's/\./ /g'` $4
3407                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3408                                                 osvers=$1.$2.$3
3409                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3410                                                 osvers=$1.$2
3411                                         elif $test -f $src/hints/sco_$1.sh; then
3412                                                 osvers=$1
3413                                         fi
3414                                 else
3415                                         case "$osname" in
3416                                         '') : Still unknown.  Probably a generic Sys V.
3417                                                 osname="sysv"
3418                                                 osvers="$3"
3419                                                 ;;
3420                                         esac
3421                                 fi
3422                                 ;;
3423                         esac
3424                         ;;
3425                 *)      case "$osname" in
3426                         '') : Still unknown.  Probably a generic BSD.
3427                                 osname="$1"
3428                                 osvers="$3"
3429                                 ;;
3430                         esac
3431                         ;;
3432                 esac
3433         else
3434                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3435                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3436                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3437                                 osname=news_os
3438                         fi
3439                         $rm -f UU/kernel.what
3440                 elif test -d c:/. -o -n "$is_os2" ; then
3441                         set X $myuname
3442                         osname=os2
3443                         osvers="$5"
3444                 fi
3445         fi
3446
3447         case "$targetarch" in
3448         '') ;;
3449         *)  hostarch=$osname
3450             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3451             osvers=''
3452             ;;
3453         esac
3454
3455         : Now look for a hint file osname_osvers, unless one has been
3456         : specified already.
3457         case "$hintfile" in
3458         ''|' ')
3459                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3460                 : Also try without trailing minor version numbers.
3461                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3462                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3463                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3464                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3465                 case "$file" in
3466                 '') dflt=none ;;
3467                 *)  case "$osvers" in
3468                         '') dflt=$file
3469                                 ;;
3470                         *)  if $test -f $src/hints/$file.sh ; then
3471                                         dflt=$file
3472                                 elif $test -f $src/hints/$xfile.sh ; then
3473                                         dflt=$xfile
3474                                 elif $test -f $src/hints/$xxfile.sh ; then
3475                                         dflt=$xxfile
3476                                 elif $test -f $src/hints/$xxxfile.sh ; then
3477                                         dflt=$xxxfile
3478                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3479                                         dflt=$xxxxfile
3480                                 elif $test -f "$src/hints/${osname}.sh" ; then
3481                                         dflt="${osname}"
3482                                 else
3483                                         dflt=none
3484                                 fi
3485                                 ;;
3486                         esac
3487                         ;;
3488                 esac
3489                 if $test -f Policy.sh ; then
3490                         case "$dflt" in
3491                         *Policy*) ;;
3492                         none) dflt="Policy" ;;
3493                         *) dflt="Policy $dflt" ;;
3494                         esac
3495                 fi
3496                 ;;
3497         *)
3498                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3499                 ;;
3500         esac
3501
3502         if $test -f Policy.sh ; then
3503                 $cat <<EOM
3504
3505 There's also a Policy hint file available, which should make the
3506 site-specific (policy) questions easier to answer.
3507 EOM
3508
3509         fi
3510
3511         $cat <<EOM
3512
3513 You may give one or more space-separated answers, or "none" if appropriate.
3514 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3515 previous run of Configure, you may specify it as well as or instead of
3516 OS-specific hints.  If hints are provided for your OS, you should use them:
3517 although Perl can probably be built without hints on many platforms, using
3518 hints often improve performance and may enable features that Configure can't
3519 set up on its own. If there are no hints that match your OS, specify "none";
3520 DO NOT give a wrong version or a wrong OS.
3521
3522 EOM
3523
3524         rp="Which of these apply, if any?"
3525         . UU/myread
3526         tans=$ans
3527         for file in $tans; do
3528                 if $test X$file = XPolicy -a -f Policy.sh; then
3529                         . Policy.sh
3530                         $cat Policy.sh >> UU/config.sh
3531                 elif $test -f $src/hints/$file.sh; then
3532                         . $src/hints/$file.sh
3533                         $cat $src/hints/$file.sh >> UU/config.sh
3534                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3535                         : nothing
3536                 else
3537                         : Give one chance to correct a possible typo.
3538                         echo "$file.sh does not exist"
3539                         dflt=$file
3540                         rp="hint to use instead?"
3541                         . UU/myread
3542                         for file in $ans; do
3543                                 if $test -f "$src/hints/$file.sh"; then
3544                                         . $src/hints/$file.sh
3545                                         $cat $src/hints/$file.sh >> UU/config.sh
3546                                 elif $test X$ans = X -o X$ans = Xnone ; then
3547                                         : nothing
3548                                 else
3549                                         echo "$file.sh does not exist -- ignored."
3550                                 fi
3551                         done
3552                 fi
3553         done
3554
3555         hint=recommended
3556         : Remember our hint file for later.
3557         if $test -f "$src/hints/$file.sh" ; then
3558                 hintfile="$file"
3559         else
3560                 hintfile=''
3561         fi
3562 fi
3563 cd UU
3564 ;;
3565 *)
3566         echo " "
3567         echo "Fetching default answers from $config_sh..." >&4
3568         tmp_n="$n"
3569         tmp_c="$c"
3570         cd ..
3571         cp $config_sh config.sh 2>/dev/null
3572         chmod +w config.sh
3573         . ./config.sh
3574         cd UU
3575         cp ../config.sh .
3576         n="$tmp_n"
3577         c="$tmp_c"
3578         hint=previous
3579         ;;
3580 esac
3581 test "$override" && . ./optdef.sh
3582
3583 : Restore computed paths
3584 for file in $loclist $trylist; do
3585         eval $file="\$_$file"
3586 done
3587
3588 cat << EOM
3589
3590 Configure uses the operating system name and version to set some defaults.
3591 The default value is probably right if the name rings a bell. Otherwise,
3592 since spelling matters for me, either accept the default or answer "none"
3593 to leave it blank.
3594
3595 EOM
3596 case "$osname" in
3597         ''|' ')
3598                 case "$hintfile" in
3599                 ''|' '|none) dflt=none ;;
3600                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3601                 esac
3602                 ;;
3603         *) dflt="$osname" ;;
3604 esac
3605 rp="Operating system name?"
3606 . ./myread
3607 case "$ans" in
3608 none)  osname='' ;;
3609 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3610 esac
3611 echo " "
3612 case "$osvers" in
3613         ''|' ')
3614                 case "$hintfile" in
3615                 ''|' '|none) dflt=none ;;
3616                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3617                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3618                         case "$dflt" in
3619                         ''|' ') dflt=none ;;
3620                         esac
3621                         ;;
3622                 esac
3623                 ;;
3624         *) dflt="$osvers" ;;
3625 esac
3626 rp="Operating system version?"
3627 . ./myread
3628 case "$ans" in
3629 none)  osvers='' ;;
3630 *) osvers="$ans" ;;
3631 esac
3632
3633
3634 . ./posthint.sh
3635
3636 : who configured the system
3637 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3638 case "$cf_by" in
3639 "")
3640         cf_by=`(logname) 2>/dev/null`
3641         case "$cf_by" in
3642         "")
3643                 cf_by=`(whoami) 2>/dev/null`
3644                 case "$cf_by" in
3645                 "") cf_by=unknown ;;
3646                 esac ;;
3647         esac ;;
3648 esac
3649
3650 : decide how portable to be.  Allow command line overrides.
3651 case "$d_portable" in
3652 "$undef") ;;
3653 *)      d_portable="$define" ;;
3654 esac
3655
3656 : set up shell script to do ~ expansion
3657 cat >filexp <<EOSS
3658 $startsh
3659 : expand filename
3660 case "\$1" in
3661  \~/*|\~)
3662         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3663         ;;
3664  \~*)
3665         if $test -f /bin/csh; then
3666                 /bin/csh -f -c "glob \$1"
3667                 failed=\$?
3668                 echo ""
3669                 exit \$failed
3670         else
3671                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3672                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3673                 if $test ! -d "\$dir"; then
3674                         me=\`basename \$0\`
3675                         echo "\$me: can't locate home directory for: \$name" >&2
3676                         exit 1
3677                 fi
3678                 case "\$1" in
3679                 */*)
3680                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3681                         ;;
3682                 *)
3683                         echo \$dir
3684                         ;;
3685                 esac
3686         fi
3687         ;;
3688 *)
3689         echo \$1
3690         ;;
3691 esac
3692 EOSS
3693 chmod +x filexp
3694 $eunicefix filexp
3695
3696 : now set up to get a file name
3697 cat <<EOS >getfile
3698 $startsh
3699 EOS
3700 cat <<'EOSC' >>getfile
3701 tilde=''
3702 fullpath=''
3703 already=''
3704 skip=''
3705 none_ok=''
3706 exp_file=''
3707 nopath_ok=''
3708 orig_rp="$rp"
3709 orig_dflt="$dflt"
3710 case "$gfpth" in
3711 '') gfpth='.' ;;
3712 esac
3713
3714 case "$fn" in
3715 *\(*)
3716         : getfile will accept an answer from the comma-separated list
3717         : enclosed in parentheses even if it does not meet other criteria.
3718         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3719         fn=`echo $fn | sed 's/(.*)//'`
3720         ;;
3721 esac
3722
3723 case "$fn" in
3724 *:*)
3725         loc_file=`expr $fn : '.*:\(.*\)'`
3726         fn=`expr $fn : '\(.*\):.*'`
3727         ;;
3728 esac
3729
3730 case "$fn" in
3731 *~*) tilde=true;;
3732 esac
3733 case "$fn" in
3734 */*) fullpath=true;;
3735 esac
3736 case "$fn" in
3737 *+*) skip=true;;
3738 esac
3739 case "$fn" in
3740 *n*) none_ok=true;;
3741 esac
3742 case "$fn" in
3743 *e*) exp_file=true;;
3744 esac
3745 case "$fn" in
3746 *p*) nopath_ok=true;;
3747 esac
3748
3749 case "$fn" in
3750 *f*) type='File';;
3751 *d*) type='Directory';;
3752 *l*) type='Locate';;
3753 esac
3754
3755 what="$type"
3756 case "$what" in
3757 Locate) what='File';;
3758 esac
3759
3760 case "$exp_file" in
3761 '')
3762         case "$d_portable" in
3763         "$define") ;;
3764         *) exp_file=true;;
3765         esac
3766         ;;
3767 esac
3768
3769 cd ..
3770 while test "$type"; do
3771         redo=''
3772         rp="$orig_rp"
3773         dflt="$orig_dflt"
3774         case "$tilde" in
3775         true) rp="$rp (~name ok)";;
3776         esac
3777         . UU/myread
3778         if test -f UU/getfile.ok && \
3779                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3780         then
3781                 value="$ans"
3782                 ansexp="$ans"
3783                 break
3784         fi
3785         case "$ans" in
3786         none)
3787                 value=''
3788                 ansexp=''
3789                 case "$none_ok" in
3790                 true) type='';;
3791                 esac
3792                 ;;
3793         *)
3794                 case "$tilde" in
3795                 '') value="$ans"
3796                         ansexp="$ans";;
3797                 *)
3798                         value=`UU/filexp $ans`
3799                         case $? in
3800                         0)
3801                                 if test "$ans" != "$value"; then
3802                                         echo "(That expands to $value on this system.)"
3803                                 fi
3804                                 ;;
3805                         *) value="$ans";;
3806                         esac
3807                         ansexp="$value"
3808                         case "$exp_file" in
3809                         '') value="$ans";;
3810                         esac
3811                         ;;
3812                 esac
3813                 case "$fullpath" in
3814                 true)
3815                         case "$ansexp" in
3816                         /*) value="$ansexp" ;;
3817                         [a-zA-Z]:/*) value="$ansexp" ;;
3818                         *)
3819                                 redo=true
3820                                 case "$already" in
3821                                 true)
3822                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3823                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3824                                         ;;
3825                                 *)
3826                                 echo "Please give a full path name, starting with slash." >&4
3827                                         case "$tilde" in
3828                                         true)
3829                                 echo "Note that using ~name is ok provided it expands well." >&4
3830                                                 already=true
3831                                                 ;;
3832                                         esac
3833                                 esac
3834                                 ;;
3835                         esac
3836                         ;;
3837                 esac
3838                 case "$redo" in
3839                 '')
3840                         case "$type" in
3841                         File)
3842                                 for fp in $gfpth; do
3843                                         if test "X$fp" = X.; then
3844                                             pf="$ansexp"
3845                                         else    
3846                                             pf="$fp/$ansexp"
3847                                         fi
3848                                         if test -f "$pf"; then
3849                                                 type=''
3850                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3851                                         then
3852                                                 echo "($value is not a plain file, but that's ok.)"
3853                                                 type=''
3854                                         fi
3855                                         if test X"$type" = X; then
3856                                             value="$pf"
3857                                             break
3858                                         fi
3859                                 done
3860                                 ;;
3861                         Directory)
3862                                 for fp in $gfpth; do
3863                                         if test "X$fp" = X.; then
3864                                             dir="$ans"
3865                                             direxp="$ansexp"
3866                                         else    
3867                                             dir="$fp/$ansexp"
3868                                             direxp="$fp/$ansexp"
3869                                         fi
3870                                         if test -d "$direxp"; then
3871                                                 type=''
3872                                                 value="$dir"
3873                                                 break
3874                                         fi
3875                                 done
3876                                 ;;
3877                         Locate)
3878                                 if test -d "$ansexp"; then
3879                                         echo "(Looking for $loc_file in directory $value.)"
3880                                         value="$value/$loc_file"
3881                                         ansexp="$ansexp/$loc_file"
3882                                 fi
3883                                 if test -f "$ansexp"; then
3884                                         type=''
3885                                 fi
3886                                 case "$nopath_ok" in
3887                                 true)   case "$value" in
3888                                         */*) ;;
3889                                         *)      echo "Assuming $value will be in people's path."
3890                                                 type=''
3891                                                 ;;
3892                                         esac
3893                                         ;;
3894                                 esac
3895                                 ;;
3896                         esac
3897
3898                         case "$skip" in
3899                         true) type='';
3900                         esac
3901
3902                         case "$type" in
3903                         '') ;;
3904                         *)
3905                                 if test "$fastread" = yes; then
3906                                         dflt=y
3907                                 else
3908                                         dflt=n
3909                                 fi
3910                                 rp="$what $value doesn't exist.  Use that name anyway?"
3911                                 . UU/myread
3912                                 dflt=''
3913                                 case "$ans" in
3914                                 y*) type='';;
3915                                 *) echo " ";;
3916                                 esac
3917                                 ;;
3918                         esac
3919                         ;;
3920                 esac
3921                 ;;
3922         esac
3923 done
3924 cd UU
3925 ans="$value"
3926 rp="$orig_rp"
3927 dflt="$orig_dflt"
3928 rm -f getfile.ok
3929 test "X$gfpthkeep" != Xy && gfpth=""
3930 EOSC
3931
3932 : determine root of directory hierarchy where package will be installed.
3933 case "$prefix" in
3934 '')
3935         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3936         ;;
3937 *?/)
3938         dflt=`echo "$prefix" | sed 's/.$//'`
3939         ;;
3940 *)
3941         dflt="$prefix"
3942         ;;
3943 esac
3944 $cat <<EOM
3945
3946 By default, $package will be installed in $dflt/bin, manual pages
3947 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3948 installation directories. Typically this is something like /usr/local.
3949 If you wish to have binaries under /usr/bin but other parts of the
3950 installation under /usr/local, that's ok: you will be prompted
3951 separately for each of the installation directories, the prefix being
3952 only used to set the defaults.
3953
3954 EOM
3955 fn=d~
3956 rp='Installation prefix to use?'
3957 . ./getfile
3958 oldprefix=''
3959 case "$prefix" in
3960 '') ;;
3961 *)
3962         case "$ans" in
3963         "$prefix") ;;
3964         *) oldprefix="$prefix";;
3965         esac
3966         ;;
3967 esac
3968 prefix="$ans"
3969 prefixexp="$ansexp"
3970
3971 : allow them to override the AFS root
3972 case "$afsroot" in
3973 '')     afsroot=/afs ;;
3974 *)      afsroot=$afsroot ;;
3975 esac
3976
3977 : is AFS running?
3978 echo " "
3979 case "$afs" in
3980 $define|true)   afs=true ;;
3981 $undef|false)   afs=false ;;
3982 *)      if $test -d $afsroot; then
3983                 afs=true
3984         else
3985                 afs=false
3986         fi
3987         ;;
3988 esac
3989 if $afs; then
3990         echo "AFS may be running... I'll be extra cautious then..." >&4
3991 else
3992         echo "AFS does not seem to be running..." >&4
3993 fi
3994
3995 : determine installation prefix for where package is to be installed.
3996 if $afs; then 
3997 $cat <<EOM
3998
3999 Since you are running AFS, I need to distinguish the directory in which
4000 files will reside from the directory in which they are installed (and from
4001 which they are presumably copied to the former directory by occult means).
4002
4003 EOM
4004         case "$installprefix" in
4005         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4006         *) dflt="$installprefix";;
4007         esac
4008 else
4009 $cat <<EOM
4010
4011 In some special cases, particularly when building $package for distribution,
4012 it is convenient to distinguish the directory in which files should be
4013 installed from the directory ($prefix) in which they will
4014 eventually reside.  For most users, these two directories are the same.
4015
4016 EOM
4017         case "$installprefix" in
4018         '') dflt=$prefix ;;
4019         *) dflt=$installprefix;;
4020         esac
4021 fi
4022 fn=d~
4023 rp='What installation prefix should I use for installing files?'
4024 . ./getfile
4025 installprefix="$ans"
4026 installprefixexp="$ansexp"
4027
4028 : Perform the prefixexp/installprefixexp correction if necessary
4029 cat <<EOS >installprefix
4030 $startsh
4031 EOS
4032 cat <<'EOSC' >>installprefix
4033 : Change installation prefix, if necessary.
4034 if $test X"$prefix" != X"$installprefix"; then
4035     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4036 else
4037     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4038 fi
4039 EOSC
4040 chmod +x installprefix
4041 $eunicefix installprefix
4042
4043 : Set variables such as privlib and privlibexp from the output of ./getfile
4044 : performing the prefixexp/installprefixexp correction if necessary.
4045 cat <<EOS >setprefixvar
4046 $startsh
4047 EOS
4048 cat <<'EOSC' >>setprefixvar
4049 eval "${prefixvar}=\"\$ans\""
4050 eval "${prefixvar}exp=\"\$ansexp\""
4051 . ./installprefix
4052 EOSC
4053 chmod +x setprefixvar
4054 $eunicefix setprefixvar
4055
4056 : set up the script used to warn in case of inconsistency
4057 cat <<EOS >whoa
4058 $startsh
4059 EOS
4060 cat <<'EOSC' >>whoa
4061 dflt=y
4062 case "$hint" in
4063     recommended)
4064         case "$hintfile" in
4065         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4066                 ;;
4067         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4068                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4069                 ;;
4070         esac
4071         ;;
4072     *)  echo " "
4073         echo "*** WHOA THERE!!! ***" >&4
4074         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4075         ;;
4076 esac
4077 rp="    Keep the $hint value?"
4078 . ./myread
4079 case "$ans" in
4080 y) td=$was; tu=$was;;
4081 esac
4082 EOSC
4083
4084 : function used to set '$1' to '$val'
4085 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4086 case "$val$was" in
4087 $define$undef) . ./whoa; eval "$var=\$td";;
4088 $undef$define) . ./whoa; eval "$var=\$tu";;
4089 *) eval "$var=$val";;
4090 esac'
4091
4092 : get the patchlevel
4093 echo " "
4094 echo "Getting the current patchlevel..." >&4
4095 if $test -r $rsrc/patchlevel.h;then
4096         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4097         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4098         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4099         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4100         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4101         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4102         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4103 else
4104         revision=0
4105         patchlevel=0
4106         subversion=0
4107         api_revision=0
4108         api_version=0
4109         api_subversion=0
4110         perl_patchlevel=0
4111         $echo "(You do not have patchlevel.h.  Eek.)"
4112 fi
4113 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4114 version_patchlevel_string="version $patchlevel subversion $subversion"
4115 case "$perl_patchlevel" in
4116 0|'') ;;
4117 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4118     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4119     ;;
4120 esac
4121
4122 $echo "(You have $package $version_patchlevel_string.)"
4123
4124 case "$osname" in
4125 dos|vms)
4126         : XXX Should be a Configure test for double-dots in filenames.
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 *)
4133         version=`echo $revision $patchlevel $subversion | \
4134                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4135         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4136                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4137         ;;
4138 esac
4139 : Special case the 5.005_xx maintenance series, which used 5.005
4140 : without any subversion label as a subdirectory in $sitelib
4141 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4142         api_versionstring='5.005'
4143 fi
4144
4145 : Do we want threads support and if so, what type
4146 case "$usethreads" in
4147 $define|true|[yY]*)     dflt='y';;
4148 *)     # Catch case where user specified ithreads or 5005threads but
4149        # forgot -Dusethreads (A.D. 4/2002)
4150        case "$useithreads$use5005threads" in
4151        *$define*)       dflt='y';;
4152        *)               dflt='n';;
4153        esac
4154        ;;
4155 esac
4156 cat <<EOM
4157
4158 Perl can be built to take advantage of threads on some systems.
4159 To do so, Configure can be run with -Dusethreads.
4160
4161 Note that Perl built with threading support runs slightly slower
4162 and uses more memory than plain Perl. The current implementation
4163 is believed to be stable, but it is fairly new, and so should be
4164 treated with caution.
4165
4166 If this doesn't make any sense to you, just accept the default '$dflt'.
4167 EOM
4168 rp='Build a threading Perl?'
4169 . ./myread
4170 case "$ans" in
4171 y|Y)    val="$define" ;;
4172 *)      val="$undef" ;;
4173 esac
4174 set usethreads
4175 eval $setvar
4176
4177 if $test $patchlevel -lt 9; then
4178     case "$usethreads" in
4179     $define)
4180         $cat <<EOM
4181
4182 Since release 5.6, Perl has had two different threading implementations,
4183 the newer interpreter-based version (ithreads) with one interpreter per
4184 thread, and the older 5.005 version (5005threads).
4185 The 5005threads version is effectively unmaintained and will probably be
4186 removed in Perl 5.10, so there should be no need to build a Perl using it
4187 unless needed for backwards compatibility with some existing 5.005threads
4188 code.
4189
4190 EOM
4191         : Default to ithreads unless overridden on command line or with
4192         : old config.sh
4193         dflt='y'
4194         case "$use5005threads" in
4195                 $define|true|[yY]*) dflt='n';;
4196         esac
4197         case "$useithreads" in
4198                 $undef|false|[nN]*) dflt='n';;
4199         esac
4200         rp='Use the newer interpreter-based ithreads?'
4201         . ./myread
4202         case "$ans" in
4203         y|Y)    val="$define" ;;
4204         *)      val="$undef" ;;
4205         esac
4206         set useithreads
4207         eval $setvar
4208         : Now set use5005threads to the opposite value.
4209         case "$useithreads" in
4210         $define) val="$undef" ;;
4211         *) val="$define" ;;
4212         esac
4213         set use5005threads
4214         eval $setvar
4215         ;;
4216     *)
4217         useithreads="$undef"
4218         use5005threads="$undef"
4219         ;;
4220     esac
4221
4222     case "$useithreads$use5005threads" in
4223     "$define$define")
4224         $cat >&4 <<EOM
4225
4226 You cannot have both the ithreads and the 5.005 threads enabled
4227 at the same time.  Disabling the 5.005 threads since they are
4228 much less stable than the ithreads.
4229
4230 EOM
4231         use5005threads="$undef"
4232         ;;
4233     esac
4234
4235 else
4236 : perl-5.9.x and later
4237
4238     if test X"$usethreads" = "X$define"; then
4239         case "$use5005threads" in
4240             $define|true|[yY]*)
4241                 $cat >&4 <<EOM
4242
4243 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4244
4245 EOM
4246             ;;
4247         esac
4248     fi
4249
4250     use5005threads="$undef"
4251     useithreads="$usethreads"
4252 fi
4253
4254 case "$d_oldpthreads" in
4255 '')     : Configure tests would be welcome here.  For now, assume undef.
4256         val="$undef" ;;
4257 *)      val="$d_oldpthreads" ;;
4258 esac
4259 set d_oldpthreads
4260 eval $setvar
4261
4262
4263 : Look for a hint-file generated 'call-back-unit'.  If the
4264 : user has specified that a threading perl is to be built,
4265 : we may need to set or change some other defaults.
4266 if $test -f usethreads.cbu; then
4267     echo "Your platform has some specific hints regarding threaded builds, using them..."
4268     . ./usethreads.cbu
4269 else
4270     case "$usethreads" in
4271         "$define"|true|[yY]*)
4272                 $cat <<EOM
4273 (Your platform does not have any specific hints for threaded builds.
4274  Assuming POSIX threads, then.)
4275 EOM
4276         ;;
4277     esac
4278 fi
4279
4280 : Check if multiplicity is required
4281 cat <<EOM
4282
4283 Perl can be built so that multiple Perl interpreters can coexist
4284 within the same Perl executable.
4285 EOM
4286
4287 case "$useithreads" in
4288 $define)
4289         cat <<EOM
4290 This multiple interpreter support is required for interpreter-based threads.
4291 EOM
4292         val="$define"
4293         ;;
4294 *)      case "$usemultiplicity" in
4295         $define|true|[yY]*)     dflt='y';;
4296         *) dflt='n';;
4297         esac
4298         echo " "
4299         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4300         rp='Build Perl for multiplicity?'
4301         . ./myread
4302         case "$ans" in
4303         y|Y)    val="$define" ;;
4304         *)      val="$undef" ;;
4305         esac
4306         ;;
4307 esac
4308 set usemultiplicity
4309 eval $setvar
4310
4311 : Check if morebits is requested
4312 case "$usemorebits" in
4313 "$define"|true|[yY]*)
4314         use64bitint="$define"
4315         uselongdouble="$define"
4316         usemorebits="$define"
4317         ;;
4318 *)      usemorebits="$undef"
4319         ;;
4320 esac
4321
4322 : Determine the C compiler to be used
4323 echo " "
4324 case "$cc" in
4325 '') dflt=cc;;
4326 *) dflt="$cc";;
4327 esac
4328 rp="Use which C compiler?"
4329 . ./myread
4330 cc="$ans"
4331
4332 : See whether they have no cc but they do have gcc
4333 . ./trygcc
4334 if $test -f cc.cbu; then
4335     . ./cc.cbu
4336 fi
4337 . ./checkcc
4338
4339 : make some quick guesses about what we are up against
4340 echo " "
4341 $echo $n "Hmm...  $c"
4342 echo exit 1 >bsd
4343 echo exit 1 >usg
4344 echo exit 1 >v7
4345 echo exit 1 >osf1
4346 echo exit 1 >eunice
4347 echo exit 1 >xenix
4348 echo exit 1 >venix
4349 echo exit 1 >os2
4350 d_bsd="$undef"
4351 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4352 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4353 then
4354         echo "Looks kind of like an OSF/1 system, but we'll see..."
4355         echo exit 0 >osf1
4356 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4357         xxx=`./loc addbib blurfl $pth`
4358         if $test -f $xxx; then
4359         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4360                 echo exit 0 >bsd
4361                 echo exit 0 >usg
4362         else
4363                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4364                         echo "Looks kind of like an extended USG system, but we'll see..."
4365                 else
4366                         echo "Looks kind of like a USG system, but we'll see..."
4367                 fi
4368                 echo exit 0 >usg
4369         fi
4370 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4371         echo "Looks kind of like a BSD system, but we'll see..."
4372         d_bsd="$define"
4373         echo exit 0 >bsd
4374 else
4375         echo "Looks kind of like a Version 7 system, but we'll see..."
4376         echo exit 0 >v7
4377 fi
4378 case "$eunicefix" in
4379 *unixtovms*)
4380         $cat <<'EOI'
4381 There is, however, a strange, musty smell in the air that reminds me of
4382 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4383 EOI
4384         echo exit 0 >eunice
4385         d_eunice="$define"
4386 : it so happens the Eunice I know will not run shell scripts in Unix format
4387         ;;
4388 *)
4389         echo " "
4390         echo "Congratulations.  You aren't running Eunice."
4391         d_eunice="$undef"
4392         ;;
4393 esac
4394 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4395 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4396 : semicolon as a patch separator
4397 case "$p_" in
4398 :) ;;
4399 *)
4400         $cat <<'EOI'
4401 I have the feeling something is not exactly right, however...don't tell me...
4402 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4403 (Or you may be running DOS with DJGPP.)
4404 EOI
4405         echo exit 0 >os2
4406         ;;
4407 esac
4408 if test -f /xenix; then
4409         echo "Actually, this looks more like a XENIX system..."
4410         echo exit 0 >xenix
4411         d_xenix="$define"
4412 else
4413         echo " "
4414         echo "It's not Xenix..."
4415         d_xenix="$undef"
4416 fi
4417 chmod +x xenix
4418 $eunicefix xenix
4419 if test -f /venix; then
4420         echo "Actually, this looks more like a VENIX system..."
4421         echo exit 0 >venix
4422 else
4423         echo " "
4424         if ./xenix; then
4425                 : null
4426         else
4427                 echo "Nor is it Venix..."
4428         fi
4429 fi
4430 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4431 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4432 $rm -f foo
4433
4434 : Check if we are using GNU gcc and what its version is
4435 echo " "
4436 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4437 $cat >try.c <<EOM
4438 #include <stdio.h>
4439 int main() {
4440 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4441 #ifdef __VERSION__
4442         printf("%s\n", __VERSION__);
4443 #else
4444         printf("%s\n", "1");
4445 #endif
4446 #endif
4447         return(0);
4448 }
4449 EOM
4450 if $cc -o try $ccflags $ldflags try.c; then
4451         gccversion=`$run ./try`
4452         case "$gccversion" in
4453         '') echo "You are not using GNU cc." ;;
4454         *)  echo "You are using GNU cc $gccversion."
4455             ccname=gcc
4456             ;;
4457         esac
4458 else
4459         echo " "
4460         echo "*** WHOA THERE!!! ***" >&4
4461         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4462         case "$knowitall" in
4463         '')
4464         echo "    You'd better start hunting for one and let me know about it." >&4
4465                 exit 1
4466                 ;;
4467         esac
4468 fi
4469 $rm -f try try.*
4470 case "$gccversion" in
4471 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4472 esac
4473 case "$gccversion" in
4474 '') gccosandvers='' ;;
4475 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4476    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4477    gccshortvers=''
4478    case "$gccosandvers" in
4479    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4480    $osname$osvers) ;; # looking good
4481    $osname*) cat <<EOM >&4
4482
4483 *** WHOA THERE!!! ***
4484
4485     Your gcc has not been compiled for the exact release of
4486     your operating system ($gccosandvers versus $osname$osvers).
4487
4488     In general it is a good idea to keep gcc synchronized with
4489     the operating system because otherwise serious problems
4490     may ensue when trying to compile software, like Perl.
4491
4492     I'm trying to be optimistic here, though, and will continue.
4493     If later during the configuration and build icky compilation
4494     problems appear (headerfile conflicts being the most common
4495     manifestation), I suggest reinstalling the gcc to match
4496     your operating system release.
4497
4498 EOM
4499       ;;
4500    *) gccosandvers='' ;; # failed to parse, better be silent
4501    esac
4502    ;;
4503 esac
4504 case "$ccname" in
4505 '') ccname="$cc" ;;
4506 esac
4507
4508 # gcc 3.* complain about adding -Idirectories that they already know about,
4509 # so we will take those off from locincpth.
4510 case "$gccversion" in
4511 3*)
4512     echo "main(){}">try.c
4513     for incdir in $locincpth; do
4514        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4515              grep '^c[cp]p*[01]: warning: changing search order '`
4516        if test "X$warn" != X; then
4517            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4518        fi
4519     done
4520     $rm -f try try.*
4521 esac
4522
4523 : What should the include directory be ?
4524 echo " "
4525 $echo $n "Hmm...  $c"
4526 dflt='/usr/include'
4527 incpath=''
4528 mips_type=''
4529 if $test -f /bin/mips && /bin/mips; then
4530         echo "Looks like a MIPS system..."
4531         $cat >usr.c <<'EOCP'
4532 #ifdef SYSTYPE_BSD43
4533 /bsd43
4534 #endif
4535 EOCP
4536         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4537                 dflt='/bsd43/usr/include'
4538                 incpath='/bsd43'
4539                 mips_type='BSD 4.3'
4540         else
4541                 mips_type='System V'
4542         fi
4543         $rm -f usr.c usr.out
4544         echo "and you're compiling with the $mips_type compiler and libraries."
4545         xxx_prompt=y
4546         echo "exit 0" >mips
4547 else
4548         echo "Doesn't look like a MIPS system."
4549         xxx_prompt=n
4550         echo "exit 1" >mips
4551 fi
4552 chmod +x mips
4553 $eunicefix mips
4554 case "$usrinc" in
4555 '') ;;
4556 *) dflt="$usrinc";;
4557 esac
4558 case "$xxx_prompt" in
4559 y)      fn=d/
4560         echo " "
4561         rp='Where are the include files you want to use?'
4562         . ./getfile
4563         usrinc="$ans"
4564         ;;
4565 *)      usrinc="$dflt"
4566         ;;
4567 esac
4568
4569 : see how we invoke the C preprocessor
4570 echo " "
4571 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4572 cat <<'EOT' >testcpp.c
4573 #define ABC abc
4574 #define XYZ xyz
4575 ABC.XYZ
4576 EOT
4577 cd ..
4578 if test ! -f cppstdin; then
4579         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4580                 # AIX cc -E doesn't show the absolute headerfile
4581                 # locations but we'll cheat by using the -M flag.
4582                 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
4583         else
4584                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4585         fi
4586 else
4587         echo "Keeping your $hint cppstdin wrapper."
4588 fi
4589 chmod 755 cppstdin
4590 wrapper=`pwd`/cppstdin
4591 ok='false'
4592 cd UU
4593
4594 if $test "X$cppstdin" != "X" && \
4595         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4596         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4597 then
4598         echo "You used to use $cppstdin $cppminus so we'll use that again."
4599         case "$cpprun" in
4600         '') echo "But let's see if we can live without a wrapper..." ;;
4601         *)
4602                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4603                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4604                 then
4605                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4606                         ok='true'
4607                 else
4608                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4609                 fi
4610                 ;;
4611         esac
4612 else
4613         case "$cppstdin" in
4614         '') ;;
4615         *)
4616                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4617                 ;;
4618         esac
4619 fi
4620
4621 if $ok; then
4622         : nothing
4623 elif echo '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"' -E -" will work...'; \
4630         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4631         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4632         echo "Yup, it does."
4633         x_cpp="$cc -E"
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 "Yipee, that works!"
4639         x_cpp="$cc -P"
4640         x_minus='';
4641 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4642         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4643         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4644         echo "At long last!"
4645         x_cpp="$cc -P"
4646         x_minus='-';
4647 elif echo 'No such luck, 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 "It works!"
4651         x_cpp="$cpp"
4652         x_minus='';
4653 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4654         $cpp - <testcpp.c >testcpp.out 2>&1; \
4655         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4656         echo "Hooray, it works!  I was beginning to wonder."
4657         x_cpp="$cpp"
4658         x_minus='-';
4659 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4660         $wrapper <testcpp.c >testcpp.out 2>&1; \
4661         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4662         x_cpp="$wrapper"
4663         x_minus=''
4664         echo "Eureka!"
4665 else
4666         dflt=''
4667         rp="No dice.  I can't find a C preprocessor.  Name one:"
4668         . ./myread
4669         x_cpp="$ans"
4670         x_minus=''
4671         $x_cpp <testcpp.c >testcpp.out 2>&1
4672         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4673                 echo "OK, that will do." >&4
4674         else
4675 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4676                 exit 1
4677         fi
4678 fi
4679
4680 case "$ok" in
4681 false)
4682         cppstdin="$x_cpp"
4683         cppminus="$x_minus"
4684         cpprun="$x_cpp"
4685         cpplast="$x_minus"
4686         set X $x_cpp
4687         shift
4688         case "$1" in
4689         "$cpp")
4690                 echo "Perhaps can we force $cc -E using a wrapper..."
4691                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4692                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4693                 then
4694                         echo "Yup, we can."
4695                         cppstdin="$wrapper"
4696                         cppminus='';
4697                 else
4698                         echo "Nope, we'll have to live without it..."
4699                 fi
4700                 ;;
4701         esac
4702         case "$cpprun" in
4703         "$wrapper")
4704                 cpprun=''
4705                 cpplast=''
4706                 ;;
4707         esac
4708         ;;
4709 esac
4710
4711 case "$cppstdin" in
4712 "$wrapper"|'cppstdin') ;;
4713 *) $rm -f $wrapper;;
4714 esac
4715 $rm -f testcpp.c testcpp.out
4716
4717 : Set private lib path
4718 case "$plibpth" in
4719 '') if ./mips; then
4720                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4721         fi;;
4722 esac
4723 case "$libpth" in
4724 ' ') dlist='';;
4725 '') dlist="$loclibpth $plibpth $glibpth";;
4726 *) dlist="$libpth";;
4727 esac
4728
4729 : Now check and see which directories actually exist, avoiding duplicates
4730 libpth=''
4731 for xxx in $dlist
4732 do
4733     if $test -d $xxx; then
4734                 case " $libpth " in
4735                 *" $xxx "*) ;;
4736                 *) libpth="$libpth $xxx";;
4737                 esac
4738     fi
4739 done
4740 $cat <<'EOM'
4741
4742 Some systems have incompatible or broken versions of libraries.  Among
4743 the directories listed in the question below, please remove any you
4744 know not to be holding relevant libraries, and add any that are needed.
4745 Say "none" for none.
4746
4747 EOM
4748 case "$libpth" in
4749 '') dflt='none';;
4750 *)
4751         set X $libpth
4752         shift
4753         dflt=${1+"$@"}
4754         ;;
4755 esac
4756 rp="Directories to use for library searches?"
4757 . ./myread
4758 case "$ans" in
4759 none) libpth=' ';;
4760 *) libpth="$ans";;
4761 esac
4762
4763 : compute shared library extension
4764 case "$so" in
4765 '')
4766         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4767                 dflt='sl'
4768         else
4769                 dflt='so'
4770         fi
4771         ;;
4772 *) dflt="$so";;
4773 esac
4774 $cat <<EOM
4775
4776 On some systems, shared libraries may be available.  Answer 'none' if
4777 you want to suppress searching of shared libraries for the remainder
4778 of this configuration.
4779
4780 EOM
4781 rp='What is the file extension used for shared libraries?'
4782 . ./myread
4783 so="$ans"
4784
4785 : Define several unixisms.
4786 : Hints files or command line option can be used to override them.
4787 : The convoluted testing is in case hints files set either the old
4788 : or the new name.
4789 case "$_exe" in
4790 '')     case "$exe_ext" in
4791         '')     ;;
4792         *)      _exe="$exe_ext" ;;
4793         esac
4794         ;;
4795 esac
4796 case "$_a" in
4797 '')     case "$lib_ext" in
4798     '') _a='.a';;
4799         *)      _a="$lib_ext" ;;
4800         esac
4801         ;;
4802 esac
4803 case "$_o" in
4804 '') case "$obj_ext" in
4805         '')     _o='.o';;
4806         *)      _o="$obj_ext";;
4807         esac
4808         ;;
4809 esac
4810 case "$p_" in
4811 '') case "$path_sep" in
4812         '')     p_=':';;
4813         *)      p_="$path_sep";;
4814         esac
4815         ;;
4816 esac
4817 exe_ext=$_exe
4818 lib_ext=$_a
4819 obj_ext=$_o
4820 path_sep=$p_
4821
4822 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4823
4824 : Which makefile gets called first.  This is used by make depend.
4825 case "$firstmakefile" in
4826 '') firstmakefile='makefile';;
4827 esac
4828
4829 : Check is we will use socks
4830 case "$usesocks" in
4831 $define|true|[yY]*)     dflt='y';;
4832 *) dflt='n';;
4833 esac
4834 cat <<EOM
4835
4836 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4837 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4838 to use the PerlIO abstraction layer, this will be implicitly selected.
4839
4840 If this doesn't make any sense to you, just accept the default '$dflt'.
4841 EOM
4842 rp='Build Perl for SOCKS?'
4843 . ./myread
4844 case "$ans" in
4845 y|Y)    val="$define" ;;
4846 *)      val="$undef" ;;
4847 esac
4848 set usesocks
4849 eval $setvar
4850
4851 : Check for uselongdouble support
4852 case "$ccflags" in
4853 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4854 esac
4855
4856 case "$uselongdouble" in
4857 $define|true|[yY]*)     dflt='y';;
4858 *) dflt='n';;
4859 esac
4860 cat <<EOM
4861
4862 Perl can be built to take advantage of long doubles which
4863 (if available) may give more accuracy and range for floating point numbers.
4864
4865 If this doesn't make any sense to you, just accept the default '$dflt'.
4866 EOM
4867 rp='Try to use long doubles if available?'
4868 . ./myread
4869 case "$ans" in
4870 y|Y)    val="$define"   ;;
4871 *)      val="$undef"    ;;
4872 esac
4873 set uselongdouble
4874 eval $setvar
4875
4876 case "$uselongdouble" in
4877 true|[yY]*) uselongdouble="$define" ;;
4878 esac
4879
4880 : Look for a hint-file generated 'call-back-unit'.  If the
4881 : user has specified that long doubles should be used,
4882 : we may need to set or change some other defaults.
4883 if $test -f uselongdouble.cbu; then
4884     echo "Your platform has some specific hints regarding long doubles, using them..."
4885     . ./uselongdouble.cbu
4886 else
4887     case "$uselongdouble" in
4888         $define)
4889                 $cat <<EOM
4890 (Your platform does not have any specific hints for long doubles.)
4891 EOM
4892         ;;
4893     esac
4894 fi
4895
4896 : Looking for optional libraries
4897 echo " "
4898 echo "Checking for optional libraries..." >&4
4899 case "$libs" in
4900 ' '|'') dflt='';;
4901 *) dflt="$libs";;
4902 esac
4903 case "$libswanted" in
4904 '') libswanted='c_s';;
4905 esac
4906 case "$usesocks" in
4907 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4908 esac
4909 libsfound=''
4910 libsfiles=''
4911 libsdirs=''
4912 libspath=''
4913 for thisdir in $libpth $xlibpth; do
4914   test -d $thisdir && libspath="$libspath $thisdir"
4915 done
4916 for thislib in $libswanted; do
4917         for thisdir in $libspath; do
4918             xxx=''
4919             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4920                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4921                 $test -f "$xxx" && eval $libscheck
4922                 $test -f "$xxx" && libstyle=shared
4923             fi
4924             if test ! -f "$xxx"; then
4925                 xxx=$thisdir/lib$thislib.$so
4926                 $test -f "$xxx" && eval $libscheck
4927                 $test -f "$xxx" && libstyle=shared
4928             fi
4929             if test ! -f "$xxx"; then
4930                 xxx=$thisdir/lib$thislib$_a
4931                 $test -f "$xxx" && eval $libscheck
4932                 $test -f "$xxx" && libstyle=static
4933             fi
4934             if test ! -f "$xxx"; then
4935                 xxx=$thisdir/$thislib$_a
4936                 $test -f "$xxx" && eval $libscheck
4937                 $test -f "$xxx" && libstyle=static
4938             fi
4939             if test ! -f "$xxx"; then
4940                 xxx=$thisdir/lib${thislib}_s$_a
4941                 $test -f "$xxx" && eval $libscheck
4942                 $test -f "$xxx" && libstyle=static
4943                 $test -f "$xxx" && thislib=${thislib}_s
4944             fi
4945             if test ! -f "$xxx"; then
4946                 xxx=$thisdir/Slib$thislib$_a
4947                 $test -f "$xxx" && eval $libscheck
4948                 $test -f "$xxx" && libstyle=static
4949             fi
4950             if $test -f "$xxx"; then
4951                 case "$libstyle" in
4952                 shared) echo "Found -l$thislib (shared)." ;;
4953                 static) echo "Found -l$thislib." ;;
4954                 *)      echo "Found -l$thislib ($libstyle)." ;;
4955                 esac
4956                 case " $dflt " in
4957                 *"-l$thislib "*);;
4958                 *) dflt="$dflt -l$thislib"
4959                    libsfound="$libsfound $xxx"
4960                    yyy=`basename $xxx`
4961                    libsfiles="$libsfiles $yyy"
4962                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4963                    case " $libsdirs " in
4964                    *" $yyy "*) ;;
4965                    *) libsdirs="$libsdirs $yyy" ;;
4966                    esac
4967                    ;;
4968                 esac
4969                 break
4970             fi
4971         done
4972         if $test ! -f "$xxx"; then
4973             echo "No -l$thislib."
4974         fi
4975 done
4976 set X $dflt
4977 shift
4978 dflt="$*"
4979 case "$libs" in
4980 '') dflt="$dflt";;
4981 *) dflt="$libs";;
4982 esac
4983 case "$dflt" in
4984 ' '|'') dflt='none';;
4985 esac
4986
4987 $cat <<EOM
4988
4989 In order to compile $package on your machine, a number of libraries
4990 are usually needed.  Include any other special libraries here as well.
4991 Say "none" for none.  The default list is almost always right.
4992 EOM
4993
4994 echo " "
4995 rp="What libraries to use?"
4996 . ./myread
4997 case "$ans" in
4998 none) libs=' ';;
4999 *) libs="$ans";;
5000 esac
5001
5002 : determine optimization, if desired, or use for debug flag also
5003 case "$optimize" in
5004 ' '|$undef) dflt='none';;
5005 '') dflt='-O';;
5006 *) dflt="$optimize";;
5007 esac
5008 $cat <<EOH
5009
5010 By default, $package compiles with the -O flag to use the optimizer.
5011 Alternately, you might want to use the symbolic debugger, which uses
5012 the -g flag (on traditional Unix systems).  Either flag can be
5013 specified here.  To use neither flag, specify the word "none".
5014
5015 EOH
5016 rp="What optimizer/debugger flag should be used?"
5017 . ./myread
5018 optimize="$ans"
5019 case "$optimize" in
5020 'none') optimize=" ";;
5021 esac
5022
5023 : Check what DEBUGGING is required from the command line
5024 : -DEBUGGING      or -DDEBUGGING or
5025 : -DEBUGGING=both                       = -g + -DDEBUGGING
5026 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5027 : -DEBUGGING=none or -UDEBUGGING        =
5028 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5029 case "$EBUGGING" in
5030 '')     ;;
5031 *)      DEBUGGING=$EBUGGING ;;
5032 esac
5033
5034 case "$DEBUGGING" in
5035 -g|both|$define)
5036     case "$optimize" in
5037         *-g*) ;;
5038         *)    optimize="$optimize -g" ;;
5039     esac ;;
5040 none|$undef)
5041     case "$optimize" in
5042         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5043                 shift
5044                 optimize="$*"
5045                 ;;
5046     esac ;;
5047 esac
5048
5049 dflt=''
5050 case "$DEBUGGING" in
5051 both|$define) dflt='-DDEBUGGING'
5052 esac
5053
5054 : argument order is deliberate, as the flag will start with - which set could
5055 : think is an option
5056 checkccflag='check=$1; flag=$2; callback=$3;
5057 echo " ";
5058 echo "Checking if your compiler accepts $flag" 2>&1;
5059 echo "int main(void) { return 0; }" > gcctest.c;
5060 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5061     echo "Yes, it does." 2>&1;
5062     if $test -s gcctest.out ; then
5063         echo "But your platform does not like it:";
5064         cat gcctest.out;
5065     else
5066         case "$ccflags" in
5067         *$check*)
5068             echo "Leaving current flags $ccflags alone." 2>&1
5069             ;;
5070         *) dflt="$dflt $flag";
5071             eval $callback
5072             ;;
5073         esac
5074     fi
5075 else
5076     echo "Nope, it does not, but that is ok." 2>&1;
5077 fi
5078 '
5079
5080 : We will not override a previous value, but we might want to
5081 : augment a hint file
5082 case "$hint" in
5083 default|recommended)
5084         case "$gccversion" in
5085         1*) dflt="$dflt -fpcc-struct-return" ;;
5086         esac
5087         case "$optimize:$DEBUGGING" in
5088         *-g*:old) dflt="$dflt -DDEBUGGING";;
5089         esac
5090         case "$gccversion" in
5091         2*) if $test -d /etc/conf/kconfig.d &&
5092                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5093                 then
5094                         # Interactive Systems (ISC) POSIX mode.
5095                         dflt="$dflt -posix"
5096                 fi
5097                 ;;
5098         esac
5099         case "$gccversion" in
5100         1*) ;;
5101         2.[0-8]*) ;;
5102         ?*)     set strict-aliasing -fno-strict-aliasing
5103                 eval $checkccflag
5104                 ;;
5105         esac
5106         # For gcc, adding -pipe speeds up compilations for some, but apparently
5107         # some assemblers can't read from stdin.  (It also slows down compilations
5108         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5109         case "$gccversion" in
5110         ?*)     set pipe -pipe
5111                 eval $checkccflag
5112                 ;;
5113         esac
5114
5115         # on x86_64 (at least) we require an extra library (libssp) in the
5116         # link command line. This library is not named, so I infer that it is
5117         # an implementation detail that may change. Hence the safest approach
5118         # is to add the flag to the flags passed to the compiler at link time,
5119         # as that way the compiler can do the right implementation dependant
5120         # thing. (NWC)
5121         case "$gccversion" in
5122         ?*)     set stack-protector -fstack-protector
5123                 eval $checkccflag
5124                 ;;
5125         esac
5126         ;;
5127 esac
5128
5129 case "$mips_type" in
5130 *BSD*|'') inclwanted="$locincpth $usrinc";;
5131 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5132 esac
5133 for thisincl in $inclwanted; do
5134         if $test -d $thisincl; then
5135                 if $test x$thisincl != x$usrinc; then
5136                         case "$dflt" in
5137                         *" -I$thisincl "*);;
5138                         *) dflt="$dflt -I$thisincl ";;
5139                         esac
5140                 fi
5141         fi
5142 done
5143
5144 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5145         xxx=true;
5146 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5147         xxx=true;
5148 else
5149         xxx=false;
5150 fi;
5151 if $xxx; then
5152         case "$dflt" in
5153         *$2*);;
5154         *) dflt="$dflt -D$2";;
5155         esac;
5156 fi'
5157
5158 set signal.h LANGUAGE_C; eval $inctest
5159
5160 case "$usesocks" in
5161 $define)
5162         ccflags="$ccflags -DSOCKS"
5163         ;;
5164 esac
5165
5166 case "$hint" in
5167 default|recommended) dflt="$ccflags $dflt" ;;
5168 *) dflt="$ccflags";;
5169 esac
5170
5171 case "$dflt" in
5172 ''|' ') dflt=none;;
5173 esac
5174
5175 $cat <<EOH
5176
5177 Your C compiler may want other flags.  For this question you should include
5178 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5179 but you should NOT include libraries or ld flags like -lwhatever.  If you
5180 want $package to honor its debug switch, you should include -DDEBUGGING here.
5181 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5182
5183 To use no flags, specify the word "none".
5184
5185 EOH
5186 set X $dflt
5187 shift
5188 dflt=${1+"$@"}
5189 rp="Any additional cc flags?"
5190 . ./myread
5191 case "$ans" in
5192 none) ccflags='';;
5193 *) ccflags="$ans";;
5194 esac
5195
5196 : the following weeds options from ccflags that are of no interest to cpp
5197 case "$cppflags" in
5198 '') cppflags="$ccflags" ;;
5199 *)  cppflags="$cppflags $ccflags" ;;
5200 esac
5201 case "$gccversion" in
5202 1*) cppflags="$cppflags -D__GNUC__"
5203 esac
5204 case "$mips_type" in
5205 '');;
5206 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5207 esac
5208 case "$cppflags" in
5209 '');;
5210 *)
5211         echo " "
5212         echo "Let me guess what the preprocessor flags are..." >&4
5213         set X $cppflags
5214         shift
5215         cppflags=''
5216         $cat >cpp.c <<'EOM'
5217 #define BLURFL foo
5218
5219 BLURFL xx LFRULB
5220 EOM
5221         previous=''
5222         for flag in $*
5223         do
5224                 case "$flag" in
5225                 -*) ftry="$flag";;
5226                 *) ftry="$previous $flag";;
5227                 esac
5228                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5229                         >cpp1.out 2>/dev/null && \
5230                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5231                         >cpp2.out 2>/dev/null && \
5232                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5233                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5234                 then
5235                         cppflags="$cppflags $ftry"
5236                         previous=''
5237                 else
5238                         previous="$flag"
5239                 fi
5240         done
5241         set X $cppflags
5242         shift
5243         cppflags=${1+"$@"}
5244         case "$cppflags" in
5245         *-*)  echo "They appear to be: $cppflags";;
5246         esac
5247         $rm -f cpp.c cpp?.out
5248         ;;
5249 esac
5250
5251 : flags used in final linking phase
5252 case "$ldflags" in
5253 '') if ./venix; then
5254                 dflt='-i -z'
5255         else
5256                 dflt=''
5257         fi
5258         case "$ccflags" in
5259         *-posix*) dflt="$dflt -posix" ;;
5260         esac
5261         ;;
5262 *) dflt="$ldflags";;
5263 esac
5264 # See note above about -fstack-protector
5265 case "$ccflags" in
5266 *-fstack-protector*) 
5267         case "$dflt" in
5268         *-fstack-protector*) ;; # Don't add it again
5269         *) dflt="$dflt -fstack-protector" ;; 
5270         esac
5271         ;;
5272 esac
5273
5274 : Try to guess additional flags to pick up local libraries.
5275 for thislibdir in $libpth; do
5276         case " $loclibpth " in
5277         *" $thislibdir "*)
5278                 case "$dflt " in
5279                 *"-L$thislibdir "*) ;;
5280                 *)  dflt="$dflt -L$thislibdir" ;;
5281                 esac
5282                 ;;
5283         esac
5284 done
5285
5286 case "$dflt" in
5287 '') dflt='none' ;;
5288 esac
5289
5290 $cat <<EOH
5291
5292 Your C linker may need flags.  For this question you should
5293 include -L/whatever and any other flags used by the C linker, but you
5294 should NOT include libraries like -lwhatever.
5295
5296 Make sure you include the appropriate -L/path flags if your C linker
5297 does not normally search all of the directories you specified above,
5298 namely
5299         $libpth
5300 To use no flags, specify the word "none".
5301
5302 EOH
5303
5304 rp="Any additional ld flags (NOT including libraries)?"
5305 . ./myread
5306 case "$ans" in
5307 none) ldflags='';;
5308 *) ldflags="$ans";;
5309 esac
5310 rmlist="$rmlist pdp11"
5311
5312 : coherency check
5313 echo " "
5314 echo "Checking your choice of C compiler and flags for coherency..." >&4
5315 $cat > try.c <<'EOF'
5316 #include <stdio.h>
5317 int main() { printf("Ok\n"); return(0); }
5318 EOF
5319 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5320 shift
5321 $cat >try.msg <<'EOM'
5322 I've tried to compile and run the following simple program:
5323
5324 EOM
5325 $cat try.c >> try.msg
5326
5327 $cat >> try.msg <<EOM
5328
5329 I used the command:
5330
5331         $*
5332         $run ./try
5333
5334 and I got the following output:
5335
5336 EOM
5337 dflt=y
5338 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5339         if $sh -c "$run ./try " >>try.msg 2>&1; then
5340                 xxx=`$run ./try`
5341                 case "$xxx" in
5342                 "Ok") dflt=n ;;
5343                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5344                         case " $libs " in
5345                         *" -lsfio "*)
5346                                 cat >> try.msg <<'EOQS'
5347 If $libs contains -lsfio, and sfio is mis-configured, then it
5348 sometimes (apparently) runs and exits with a 0 status, but with no
5349 output!  It may have to do with sfio's use of _exit vs. exit.
5350
5351 EOQS
5352                                 rp="You have a big problem.  Shall I abort Configure"
5353                                 dflt=y
5354                                 ;;
5355                         esac
5356                         ;;
5357                 esac
5358         else
5359                 echo "The program compiled OK, but exited with status $?." >>try.msg
5360                 rp="You have a problem.  Shall I abort Configure"
5361                 dflt=y
5362         fi
5363 else
5364         echo "I can't compile the test program." >>try.msg
5365         rp="You have a BIG problem.  Shall I abort Configure"
5366         dflt=y
5367 fi
5368 case "$dflt" in
5369 y)
5370         $cat try.msg >&4
5371         case "$knowitall" in
5372         '')
5373                 echo "(The supplied flags or libraries might be incorrect.)"
5374                 ;;
5375         *) dflt=n;;
5376         esac
5377         echo " "
5378         . ./myread
5379         case "$ans" in
5380         n*|N*) ;;
5381         *)      echo "Ok.  Stopping Configure." >&4
5382                 exit 1
5383                 ;;
5384         esac
5385         ;;
5386 n) echo "OK, that should do.";;
5387 esac
5388 $rm_try gcctest gcctest.out
5389
5390 : define a shorthand compile call
5391 compile='
5392 mc_file=$1;
5393 shift;
5394 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5395 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5396 exit 1;
5397 fi;
5398 esac;
5399 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5400 : define a shorthand compile call for compilations that should be ok.
5401 compile_ok='
5402 mc_file=$1;
5403 shift;
5404 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5405
5406 : determine filename position in cpp output
5407 echo " "
5408 echo "Computing filename position in cpp output for #include directives..." >&4
5409 case "$osname" in
5410 vos) testaccess=-e ;;
5411 *)   testaccess=-r ;;
5412 esac
5413 echo '#include <stdio.h>' > foo.c
5414 $cat >fieldn <<EOF
5415 $startsh
5416 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5417 $grep '^[       ]*#.*stdio\.h' | \
5418 while read cline; do
5419         pos=1
5420         set \$cline
5421         while $test \$# -gt 0; do
5422                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5423                         echo "\$pos"
5424                         exit 0
5425                 fi
5426                 shift
5427                 pos=\`expr \$pos + 1\`
5428         done
5429 done
5430 EOF
5431 chmod +x fieldn
5432 fieldn=`./fieldn`
5433 $rm -f foo.c fieldn
5434 case $fieldn in
5435 '') pos='???';;
5436 1) pos=first;;
5437 2) pos=second;;
5438 3) pos=third;;
5439 *) pos="${fieldn}th";;
5440 esac
5441 echo "Your cpp writes the filename in the $pos field of the line."
5442
5443 case "$osname" in
5444 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5445 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5446 *)   cppfilter='' ;;
5447 esac
5448 : locate header file
5449 $cat >findhdr <<EOF
5450 $startsh
5451 wanted=\$1
5452 name=''
5453 for usrincdir in $usrinc
5454 do
5455         if test -f \$usrincdir/\$wanted; then
5456                 echo "\$usrincdir/\$wanted"
5457                 exit 0
5458         fi
5459 done
5460 awkprg='{ print \$$fieldn }'
5461 echo "#include <\$wanted>" > foo\$\$.c
5462 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5463 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5464 while read cline; do
5465         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5466         case "\$name" in
5467         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5468         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5469         *) exit 2;;
5470         esac;
5471 done;
5472 #
5473 # status = 0: grep returned 0 lines, case statement not executed
5474 # status = 1: headerfile found
5475 # status = 2: while loop executed, no headerfile found
5476 #
5477 status=\$?
5478 $rm -f foo\$\$.c;
5479 if test \$status -eq 1; then
5480         exit 0;
5481 fi
5482 exit 1
5483 EOF
5484 chmod +x findhdr
5485
5486 : define an alternate in-header-list? function
5487 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5488 cont=true; xxf="echo \"<\$1> found.\" >&4";
5489 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5490 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5491 esac;
5492 case $# in 4) instead=instead;; *) instead="at last";; esac;
5493 while $test "$cont"; do
5494         xxx=`./findhdr $1`
5495         var=$2; eval "was=\$$2";
5496         if $test "$xxx" && $test -r "$xxx";
5497         then eval $xxf;
5498         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5499                 cont="";
5500         else eval $xxnf;
5501         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5502         set $yyy; shift; shift; yyy=$@;
5503         case $# in 0) cont="";;
5504         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5505                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5506         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5507                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5508         esac;
5509 done;
5510 while $test "$yyy";
5511 do set $yyy; var=$2; eval "was=\$$2";
5512         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5513         set $yyy; shift; shift; yyy=$@;
5514 done'
5515
5516 : see if stdlib is available
5517 set stdlib.h i_stdlib
5518 eval $inhdr
5519
5520 : check for lengths of integral types
5521 echo " "
5522 case "$intsize" in
5523 '')
5524         echo "Checking to see how big your integers are..." >&4
5525         $cat >try.c <<EOCP
5526 #include <stdio.h>
5527 #$i_stdlib I_STDLIB
5528 #ifdef I_STDLIB
5529 #include <stdlib.h>
5530 #endif
5531 int main()
5532 {
5533         printf("intsize=%d;\n", (int)sizeof(int));
5534         printf("longsize=%d;\n", (int)sizeof(long));
5535         printf("shortsize=%d;\n", (int)sizeof(short));
5536         exit(0);
5537 }
5538 EOCP
5539         set try
5540         if eval $compile_ok && $run ./try > /dev/null; then
5541                 eval `$run ./try`
5542                 echo "Your integers are $intsize bytes long."
5543                 echo "Your long integers are $longsize bytes long."
5544                 echo "Your short integers are $shortsize bytes long."
5545         else
5546                 $cat >&4 <<EOM
5547 !
5548 Help! I can't compile and run the intsize test program: please enlighten me!
5549 (This is probably a misconfiguration in your system or libraries, and
5550 you really ought to fix it.  Still, I'll try anyway.)
5551 !
5552 EOM
5553                 dflt=4
5554                 rp="What is the size of an integer (in bytes)?"
5555                 . ./myread
5556                 intsize="$ans"
5557                 dflt=$intsize
5558                 rp="What is the size of a long integer (in bytes)?"
5559                 . ./myread
5560                 longsize="$ans"
5561                 dflt=2
5562                 rp="What is the size of a short integer (in bytes)?"
5563                 . ./myread
5564                 shortsize="$ans"
5565         fi
5566         ;;
5567 esac
5568 $rm_try
5569
5570 : check for long long
5571 echo " "
5572 echo "Checking to see if you have long long..." >&4
5573 echo 'int main() { long long x = 7; return 0; }' > try.c
5574 set try
5575 if eval $compile; then
5576         val="$define"
5577         echo "You have long long."
5578 else
5579         val="$undef"
5580         echo "You do not have long long."
5581 fi
5582 $rm_try
5583 set d_longlong
5584 eval $setvar
5585
5586 : check for length of long long
5587 case "${d_longlong}${longlongsize}" in
5588 $define)
5589         echo " "
5590         echo "Checking to see how big your long longs are..." >&4
5591         $cat >try.c <<'EOCP'
5592 #include <stdio.h>
5593 int main()
5594 {
5595     printf("%d\n", (int)sizeof(long long));
5596     return(0);
5597 }
5598 EOCP
5599         set try
5600         if eval $compile_ok; then
5601                 longlongsize=`$run ./try`
5602                 echo "Your long longs are $longlongsize bytes long."
5603         else
5604                 dflt='8'
5605                 echo " "
5606                 echo "(I can't seem to compile the test program.  Guessing...)"
5607                 rp="What is the size of a long long (in bytes)?"
5608                 . ./myread
5609                 longlongsize="$ans"
5610         fi
5611         if $test "X$longsize" = "X$longlongsize"; then
5612                 echo "(That isn't any different from an ordinary long.)"
5613         fi
5614         ;;
5615 esac
5616 $rm_try
5617
5618 : see if inttypes.h is available
5619 : we want a real compile instead of Inhdr because some systems
5620 : have an inttypes.h which includes non-existent headers
5621 echo " "
5622 $cat >try.c <<EOCP
5623 #include <inttypes.h>
5624 int main() {
5625         static int32_t foo32 = 0x12345678;
5626 }
5627 EOCP
5628 set try
5629 if eval $compile; then
5630         echo "<inttypes.h> found." >&4
5631         val="$define"
5632 else
5633         echo "<inttypes.h> NOT found." >&4
5634         val="$undef"
5635 fi
5636 $rm_try
5637 set i_inttypes
5638 eval $setvar
5639
5640 : check for int64_t
5641 echo " "
5642 echo "Checking to see if you have int64_t..." >&4
5643 $cat >try.c <<EOCP
5644 #include <sys/types.h>
5645 #$i_inttypes I_INTTYPES
5646 #ifdef I_INTTYPES
5647 #include <inttypes.h>
5648 #endif
5649 int main() { int64_t x = 7; }
5650 EOCP
5651 set try
5652 if eval $compile; then
5653         val="$define"
5654         echo "You have int64_t."
5655 else
5656         val="$undef"
5657         echo "You do not have int64_t."
5658 fi
5659 $rm_try
5660 set d_int64_t
5661 eval $setvar
5662
5663 : Check if 64bit ints have a quad type
5664 echo " "
5665 echo "Checking which 64-bit integer type we could use..." >&4
5666
5667 case "$intsize" in
5668 8) val=int
5669    set quadtype
5670    eval $setvar
5671    val='"unsigned int"'
5672    set uquadtype
5673    eval $setvar
5674    quadkind=1
5675    ;;
5676 *) case "$longsize" in
5677    8) val=long
5678       set quadtype
5679       eval $setvar
5680       val='"unsigned long"'
5681       set uquadtype
5682       eval $setvar
5683       quadkind=2
5684       ;;
5685    *) case "$d_longlong:$longlongsize" in
5686       define:8)
5687         val='"long long"'
5688         set quadtype
5689         eval $setvar
5690         val='"unsigned long long"'
5691         set uquadtype
5692         eval $setvar
5693         quadkind=3
5694         ;;
5695       *) case "$d_int64_t" in
5696          define)
5697            val=int64_t
5698            set quadtype
5699            eval $setvar
5700            val=uint64_t
5701            set uquadtype
5702            eval $setvar
5703            quadkind=4
5704            ;;
5705          esac
5706          ;;
5707       esac
5708       ;;
5709    esac
5710    ;;
5711 esac
5712
5713 case "$quadtype" in
5714 '')     echo "Alas, no 64-bit integer types in sight." >&4
5715         d_quad="$undef"
5716         ;;
5717 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5718         d_quad="$define"
5719         ;;
5720 esac
5721
5722 : Do we want 64bit support
5723 case "$uselonglong" in
5724 "$define"|true|[yY]*)
5725         cat <<EOM >&4
5726
5727 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5728 EOM
5729         use64bitint="$define"
5730         ;;
5731 esac
5732 case "$use64bits" in
5733 "$define"|true|[yY]*)
5734         cat <<EOM >&4
5735
5736 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5737 EOM
5738         use64bitint="$define"
5739         ;;
5740 esac
5741 case "$use64bitints" in
5742 "$define"|true|[yY]*)
5743         cat <<EOM >&4
5744
5745 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5746 EOM
5747         use64bitint="$define"
5748         ;;
5749 esac
5750 case "$use64bitsint" in
5751 "$define"|true|[yY]*)
5752         cat <<EOM >&4
5753
5754 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5755 EOM
5756         use64bitint="$define"
5757         ;;
5758 esac
5759 case "$uselonglongs" in
5760 "$define"|true|[yY]*)
5761         cat <<EOM >&4
5762
5763 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5764 EOM
5765         use64bitint="$define"
5766         ;;
5767 esac
5768 case "$use64bitsall" in
5769 "$define"|true|[yY]*)
5770         cat <<EOM >&4
5771
5772 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5773 EOM
5774         use64bitall="$define"
5775         ;;
5776 esac
5777
5778 case "$ccflags" in
5779 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5780 esac
5781 case "$use64bitall" in
5782 "$define"|true|[yY]*) use64bitint="$define" ;;
5783 esac
5784
5785 case "$longsize" in
5786 8) cat <<EOM
5787
5788 You have natively 64-bit long integers.
5789 EOM
5790    val="$define"
5791    ;;
5792 *) case "$use64bitint" in
5793    "$define"|true|[yY]*) dflt='y';;
5794    *) dflt='n';;
5795    esac
5796    case "$d_quad" in
5797    "$define") ;;
5798    *) dflt='n' ;;
5799    esac
5800    cat <<EOM
5801
5802 Perl can be built to take advantage of 64-bit integer types
5803 on some systems.  To do so, Configure can be run with -Duse64bitint.
5804 Choosing this option will most probably introduce binary incompatibilities.
5805
5806 If this doesn't make any sense to you, just accept the default '$dflt'.
5807 (The default has been chosen based on your configuration.)
5808 EOM
5809    rp='Try to use 64-bit integers, if available?'
5810    . ./myread
5811    case "$ans" in
5812    [yY]*) val="$define" ;;
5813    *)     val="$undef"  ;;
5814    esac
5815    ;;
5816 esac
5817 set use64bitint
5818 eval $setvar
5819
5820 case "$use64bitall" in
5821 "$define"|true|[yY]*) dflt='y' ;;
5822 *) case "$longsize" in
5823    8) dflt='y' ;;
5824    *) dflt='n' ;;
5825    esac
5826    ;;
5827 esac
5828 cat <<EOM
5829
5830 You may also choose to try maximal 64-bitness.  It means using as much
5831 64-bitness as possible on the platform.  This in turn means even more
5832 binary incompatibilities.  On the other hand, your platform may not
5833 have any more 64-bitness available than what you already have chosen.
5834
5835 If this doesn't make any sense to you, just accept the default '$dflt'.
5836 (The default has been chosen based on your configuration.)
5837 EOM
5838 rp='Try to use maximal 64-bit support, if available?'
5839 . ./myread
5840 case "$ans" in
5841 [yY]*) val="$define" ;;
5842 *)     val="$undef"  ;;
5843 esac
5844 set use64bitall
5845 eval $setvar
5846 case "$use64bitall" in
5847 "$define")
5848         case "$use64bitint" in
5849         "$undef")
5850                 cat <<EOM
5851
5852 Since you have chosen a maximally 64-bit build, I'm also turning on
5853 the use of 64-bit integers.
5854 EOM
5855                 use64bitint="$define" ;;
5856         esac
5857         ;;
5858 esac
5859
5860 : Look for a hint-file generated 'call-back-unit'.  If the
5861 : user has specified that a 64-bit perl is to be built,
5862 : we may need to set or change some other defaults.
5863 if $test -f use64bitint.cbu; then
5864         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5865         . ./use64bitint.cbu
5866 fi
5867 case "$use64bitint" in
5868 "$define"|true|[yY]*)
5869         case "$longsize" in
5870         4) case "$archname64" in
5871            '') archname64=64int ;;
5872            esac
5873            ;;
5874         esac
5875         ;;
5876 esac
5877
5878 : Look for a hint-file generated 'call-back-unit'.  If the
5879 : user has specified that a maximally 64-bit perl is to be built,
5880 : we may need to set or change some other defaults.
5881 if $test -f use64bitall.cbu; then
5882         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5883         . ./use64bitall.cbu
5884 fi
5885 case "$use64bitall" in
5886 "$define"|true|[yY]*)
5887         case "$longsize" in
5888         4) case "$archname64" in
5889            ''|64int) archname64=64all ;;
5890            esac
5891            ;;
5892         esac
5893         ;;
5894 esac
5895
5896 case "$d_quad:$use64bitint" in
5897 $undef:$define)
5898         cat >&4 <<EOF
5899
5900 *** You have chosen to use 64-bit integers,
5901 *** but none can be found.
5902 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5903 *** Cannot continue, aborting.
5904
5905 EOF
5906         exit 1
5907         ;;
5908 esac
5909
5910 : check for length of double
5911 echo " "
5912 case "$doublesize" in
5913 '')
5914         echo "Checking to see how big your double precision numbers are..." >&4
5915         $cat >try.c <<EOCP
5916 #include <stdio.h>
5917 #$i_stdlib I_STDLIB
5918 #ifdef I_STDLIB
5919 #include <stdlib.h>
5920 #endif
5921 int main()
5922 {
5923     printf("%d\n", (int)sizeof(double));
5924     exit(0);
5925 }
5926 EOCP
5927         set try
5928         if eval $compile_ok; then
5929                 doublesize=`$run ./try`
5930                 echo "Your double is $doublesize bytes long."
5931         else
5932                 dflt='8'
5933                 echo "(I can't seem to compile the test program.  Guessing...)"
5934                 rp="What is the size of a double precision number (in bytes)?"
5935                 . ./myread
5936                 doublesize="$ans"
5937         fi
5938         ;;
5939 esac
5940 $rm_try
5941
5942 : check for long doubles
5943 echo " "
5944 echo "Checking to see if you have long double..." >&4
5945 echo 'int main() { long double x = 7.0; }' > try.c
5946 set try
5947 if eval $compile; then
5948         val="$define"
5949         echo "You have long double."
5950 else
5951         val="$undef"
5952         echo "You do not have long double."
5953 fi
5954 $rm_try
5955 set d_longdbl
5956 eval $setvar
5957
5958 : check for length of long double
5959 case "${d_longdbl}${longdblsize}" in
5960 $define)
5961         echo " "
5962         echo "Checking to see how big your long doubles are..." >&4
5963         $cat >try.c <<'EOCP'
5964 #include <stdio.h>
5965 int main()
5966 {
5967         printf("%d\n", sizeof(long double));
5968 }
5969 EOCP
5970         set try
5971         set try
5972         if eval $compile; then
5973                 longdblsize=`$run ./try`
5974                 echo "Your long doubles are $longdblsize bytes long."
5975         else
5976                 dflt='8'
5977                 echo " "
5978                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5979                 rp="What is the size of a long double (in bytes)?"
5980                 . ./myread
5981                 longdblsize="$ans"
5982         fi
5983         if $test "X$doublesize" = "X$longdblsize"; then
5984                 echo "That isn't any different from an ordinary double."
5985                 echo "I'll keep your setting anyway, but you may see some"
5986                 echo "harmless compilation warnings."
5987         fi
5988         ;;
5989 esac
5990 $rm_try
5991
5992 : determine the architecture name
5993 echo " "
5994 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5995         tarch=`arch`"-$osname"
5996 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5997         if uname -m > tmparch 2>&1 ; then
5998                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5999                         -e 's/$/'"-$osname/" tmparch`
6000         else
6001                 tarch="$osname"
6002         fi
6003         $rm -f tmparch
6004 else
6005         tarch="$osname"
6006 fi
6007 case "$myarchname" in
6008 ''|"$tarch") ;;
6009 *)
6010         echo "(Your architecture name used to be $myarchname.)"
6011         archname=''
6012         ;;
6013 esac
6014 case "$targetarch" in
6015 '') ;;
6016 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6017 esac
6018 myarchname="$tarch"
6019 case "$archname" in
6020 '') dflt="$tarch";;
6021 *) dflt="$archname";;
6022 esac
6023 rp='What is your architecture name'
6024 . ./myread
6025 archname="$ans"
6026
6027 : optionally add api version to the architecture for versioned archlibs
6028 case "$useversionedarchname" in
6029 $define|true|[yY]*) dflt='y';;
6030 *)                  dflt='n';;
6031 esac
6032 rp='Add the Perl API version to your archname?'
6033 . ./myread
6034 case "$ans" in
6035 y|Y)    useversionedarchname="$define" ;;
6036 *)      useversionedarchname="$undef" ;;
6037 esac
6038 case "$useversionedarchname" in
6039 $define)
6040         case "$archname" in
6041         *-$api_versionstring)
6042                 echo "...and architecture name already has -$api_versionstring" >&4
6043                 ;;
6044         *)
6045                 archname="$archname-$api_versionstring"
6046                 echo "...setting architecture name to $archname." >&4
6047                 ;;
6048         esac
6049         ;;
6050 esac
6051
6052 case "$usethreads" in
6053 $define)
6054         echo "Threads selected." >&4
6055         case "$archname" in
6056         *-thread*) echo "...and architecture name already has -thread." >&4
6057                 ;;
6058         *)      archname="$archname-thread"
6059                 echo "...setting architecture name to $archname." >&4
6060                 ;;
6061         esac
6062         ;;
6063 esac
6064 case "$usemultiplicity" in
6065 $define)
6066         echo "Multiplicity selected." >&4
6067         case "$archname" in
6068         *-multi*) echo "...and architecture name already has -multi." >&4
6069                 ;;
6070         *)      archname="$archname-multi"
6071                 echo "...setting architecture name to $archname." >&4
6072                 ;;
6073         esac
6074         ;;
6075 esac
6076 case "$use64bitint$use64bitall" in
6077 *"$define"*)
6078         case "$archname64" in
6079         '')
6080                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6081                 ;;
6082         *)
6083                 case "$use64bitint" in
6084                 "$define") echo "64 bit integers selected." >&4 ;;
6085                 esac
6086                 case "$use64bitall" in
6087                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6088                 esac
6089                 case "$archname" in
6090                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6091                         ;;
6092                 *)      archname="$archname-$archname64"
6093                         echo "...setting architecture name to $archname." >&4
6094                         ;;
6095                 esac
6096                 ;;
6097         esac
6098 esac
6099 case "$uselongdouble" in
6100 $define)
6101         echo "Long doubles selected." >&4
6102         case "$longdblsize" in
6103         $doublesize)
6104                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6105                 ;;
6106         *)
6107                 case "$archname" in
6108                 *-ld*) echo "...and architecture name already has -ld." >&4
6109                         ;;
6110                 *)      archname="$archname-ld"
6111                         echo "...setting architecture name to $archname." >&4
6112                         ;;
6113                 esac
6114                 ;;
6115         esac
6116         ;;
6117 esac
6118 if $test -f archname.cbu; then
6119         echo "Your platform has some specific hints for architecture name, using them..."
6120         . ./archname.cbu
6121 fi
6122
6123 : set the prefixit variable, to compute a suitable default value
6124 prefixit='case "$3" in
6125 ""|none)
6126         case "$oldprefix" in
6127         "") eval "$1=\"\$$2\"";;
6128         *)
6129                 case "$3" in
6130                 "") eval "$1=";;
6131                 none)
6132                         eval "tp=\"\$$2\"";
6133                         case "$tp" in
6134                         ""|" ") eval "$1=\"\$$2\"";;
6135                         *) eval "$1=";;
6136                         esac;;
6137                 esac;;
6138         esac;;
6139 *)
6140         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6141         case "$tp" in
6142         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6143         /*-$oldprefix/*|\~*-$oldprefix/*)
6144                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6145         *) eval "$1=\"\$$2\"";;
6146         esac;;
6147 esac'
6148
6149 : determine installation style
6150 : For now, try to deduce it from prefix unless it is already set.
6151 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6152 case "$installstyle" in
6153 '')     case "$prefix" in
6154                 *perl*) dflt='lib';;
6155                 *) dflt='lib/perl5' ;;
6156         esac
6157         ;;
6158 *)      dflt="$installstyle" ;;
6159 esac
6160 : Probably not worth prompting for this since we prompt for all
6161 : the directories individually, and the prompt would be too long and
6162 : confusing anyway.
6163 installstyle=$dflt
6164
6165 : determine where public executables go
6166 echo " "
6167 set dflt bin bin
6168 eval $prefixit
6169 fn=d~
6170 rp='Pathname where the public executables will reside?'
6171 . ./getfile
6172 if $test "X$ansexp" != "X$binexp"; then
6173         installbin=''
6174 fi
6175 prefixvar=bin
6176 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6177 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6178 :     this via initialinstalllocation
6179 . ./setprefixvar
6180
6181 case "$userelocatableinc" in
6182 $define|true|[yY]*)     dflt='y' ;;
6183 *)                      dflt='n' ;;
6184 esac
6185 cat <<EOM
6186
6187 Would you like to build Perl so that the installation is relocatable, so that
6188 library paths in @INC are determined relative to the path of the perl binary?
6189 This is not advised for system Perl installs, or if you need to run setid
6190 scripts or scripts under taint mode.
6191
6192 If this doesn't make any sense to you, just accept the default '$dflt'.
6193 EOM
6194 rp='Use relocatable @INC?'
6195 . ./myread
6196 case "$ans" in
6197 y|Y)    val="$define" ;;
6198 *)      val="$undef"  ;;
6199 esac
6200 set userelocatableinc
6201 eval $setvar
6202
6203 initialinstalllocation="$binexp"
6204 : Default prefix is now "up one level from where the binaries are"
6205 case "$userelocatableinc" in
6206 $define|true|[yY]*)
6207     bin=".../"
6208     binexp=".../"
6209     prefix=".../.."
6210     prefixexp=".../.."
6211     installprefixexp=".../.."
6212     ;;
6213 esac
6214
6215 : determine where private library files go
6216 : Usual default is /usr/local/lib/perl5/$version.
6217 : Also allow things like /opt/perl/lib/$version, since
6218 : /opt/perl/lib/perl5... would be redundant.
6219 : The default "style" setting is made in installstyle.U
6220 case "$installstyle" in
6221 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6222 *)       set dflt privlib lib/$version ;;
6223 esac
6224 eval $prefixit
6225 $cat <<EOM
6226
6227 There are some auxiliary files for $package that need to be put into a
6228 private library directory that is accessible by everyone.
6229
6230 EOM
6231 fn=$binexp
6232 fn=d~+
6233 rp='Pathname where the private library files will reside?'
6234 . ./getfile
6235 prefixvar=privlib
6236 . ./setprefixvar
6237
6238 : set the prefixup variable, to restore leading tilda escape
6239 prefixup='case "$prefixexp" in
6240 "$prefix") ;;
6241 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6242 esac'
6243
6244 : determine where public architecture dependent libraries go
6245 set archlib archlib
6246 eval $prefixit
6247 : privlib default is /usr/local/lib/$package/$version
6248 : archlib default is /usr/local/lib/$package/$version/$archname
6249 : privlib may have an optional trailing /share.
6250 tdflt=`echo $privlib | $sed 's,/share$,,'`
6251 tdflt=$tdflt/$archname
6252 case "$archlib" in
6253 '')     dflt=$tdflt
6254         ;;
6255 *)      dflt="$archlib"
6256     ;;
6257 esac
6258 $cat <<EOM
6259
6260 $spackage contains architecture-dependent library files.  If you are
6261 sharing libraries in a heterogeneous environment, you might store
6262 these files in a separate location.  Otherwise, you can just include
6263 them with the rest of the public library files.
6264
6265 EOM
6266 fn=$binexp
6267 fn=d+~
6268 rp='Where do you want to put the public architecture-dependent libraries?'
6269 . ./getfile
6270 prefixvar=archlib
6271 . ./setprefixvar
6272 if $test X"$archlib" = X"$privlib"; then
6273         d_archlib="$undef"
6274 else
6275         d_archlib="$define"
6276 fi
6277
6278 : see if setuid scripts can be secure
6279 $cat <<EOM
6280
6281 Some kernels have a bug that prevents setuid #! scripts from being
6282 secure.  Some sites have disabled setuid #! scripts because of this.
6283
6284 First let's decide if your kernel supports secure setuid #! scripts.
6285 (If setuid #! scripts would be secure but have been disabled anyway,
6286 don't say that they are secure if asked.)
6287
6288 EOM
6289
6290 val="$undef"
6291 if $test -d /dev/fd; then
6292         echo "#!$ls" >reflect
6293         chmod +x,u+s reflect
6294         ./reflect >flect 2>&1
6295         if $contains "/dev/fd" flect >/dev/null; then
6296                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6297                 val="$define"
6298         else
6299                 $cat <<EOM
6300 If you are not sure if they are secure, I can check but I'll need a
6301 username and password different from the one you are using right now.
6302 If you don't have such a username or don't want me to test, simply
6303 enter 'none'.
6304
6305 EOM
6306                 rp='Other username to test security of setuid scripts with?'
6307                 dflt='none'
6308                 . ./myread
6309                 case "$ans" in
6310                 n|none)
6311                         case "$d_suidsafe" in
6312                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6313                                 dflt=n;;
6314                         "$undef")
6315                                 echo "Well, the $hint value is *not* secure." >&4
6316                                 dflt=n;;
6317                         *)      echo "Well, the $hint value *is* secure." >&4
6318                                 dflt=y;;
6319                         esac
6320                         ;;
6321                 *)
6322                         $rm -f reflect flect
6323                         echo "#!$ls" >reflect
6324                         chmod +x,u+s reflect
6325                         echo >flect
6326                         chmod a+w flect
6327                         echo '"su" will (probably) prompt you for '"$ans's password."
6328                         su $ans -c './reflect >flect'
6329                         if $contains "/dev/fd" flect >/dev/null; then
6330                                 echo "Okay, it looks like setuid scripts are secure." >&4
6331                                 dflt=y
6332                         else
6333                                 echo "I don't think setuid scripts are secure." >&4
6334                                 dflt=n
6335                         fi
6336                         ;;
6337                 esac
6338                 rp='Does your kernel have *secure* setuid scripts?'
6339                 . ./myread
6340                 case "$ans" in
6341                 [yY]*)  val="$define";;
6342                 *)      val="$undef";;
6343                 esac
6344         fi
6345 else
6346         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6347         echo "(That's for file descriptors, not floppy disks.)"
6348         val="$undef"
6349 fi
6350 set d_suidsafe
6351 eval $setvar
6352
6353 $rm -f reflect flect
6354
6355 : now see if they want to do setuid emulation
6356 if $test $patchlevel -lt 11; then
6357 echo " "
6358 val="$undef"
6359 case "$d_suidsafe" in
6360 "$define")
6361         val="$undef"
6362         echo "No need to emulate SUID scripts since they are secure here." >&4
6363         ;;
6364 *)
6365         $cat <<EOM
6366 Some systems have disabled setuid scripts, especially systems where
6367 setuid scripts cannot be secure.  On systems where setuid scripts have
6368 been disabled, the setuid/setgid bits on scripts are currently
6369 useless.  It is possible for $package to detect those bits and emulate
6370 setuid/setgid in a secure fashion.  This emulation will only work if
6371 setuid scripts have been disabled in your kernel.
6372
6373 EOM
6374         case "$d_dosuid" in
6375         "$define") dflt=y ;;
6376         *) dflt=n ;;
6377         esac
6378         rp="Do you want to do setuid/setgid emulation?"
6379         . ./myread
6380         case "$ans" in
6381         [yY]*)  val="$define";;
6382         *)      val="$undef";;
6383         esac
6384         ;;
6385 esac
6386 set d_dosuid
6387 eval $setvar
6388 else
6389     case "$d_dosuid" in
6390         "$define")
6391         cat >&4 <<EOH
6392
6393 SUID emulation has been removed for 5.12
6394 Please re-run Configure without -Dd_dosuid
6395
6396 EOH
6397         exit 1;
6398         ;;
6399     esac
6400     d_dosuid=undef
6401 fi
6402
6403 : Find perl5.005 or later.
6404 echo "Looking for a previously installed perl5.005 or later... "
6405 case "$perl5" in
6406 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6407                 : Check if this perl is recent and can load a simple module
6408                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6409                         perl5=$tdir/perl
6410                         break;
6411                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6412                         perl5=$tdir/perl5
6413                         break;
6414                 fi
6415         done
6416         ;;
6417 *)      perl5="$perl5"
6418         ;;
6419 esac
6420 case "$perl5" in
6421 '')     echo "None found.  That's ok.";;
6422 *)      echo "Using $perl5." ;;
6423 esac
6424
6425 : Set the siteprefix variables
6426 $cat <<EOM
6427
6428 After $package is installed, you may wish to install various
6429 add-on modules and utilities.  Typically, these add-ons will
6430 be installed under $prefix with the rest
6431 of this package.  However, you may wish to install such add-ons
6432 elsewhere under a different prefix.
6433
6434 If you do not wish to put everything under a single prefix, that's
6435 ok.  You will be prompted for the individual locations; this siteprefix
6436 is only used to suggest the defaults.
6437
6438 The default should be fine for most people.
6439
6440 EOM
6441 fn=d~+
6442 rp='Installation prefix to use for add-on modules and utilities?'
6443 : XXX Here might be another good place for an installstyle setting.
6444 case "$siteprefix" in
6445 '') dflt=$prefix ;;
6446 *)  dflt=$siteprefix ;;
6447 esac
6448 . ./getfile
6449 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6450 oldsiteprefix=''
6451 case "$siteprefix" in
6452 '') ;;
6453 *)      case "$ans" in
6454         "$prefix") ;;
6455         *) oldsiteprefix="$prefix";;
6456         esac
6457         ;;
6458 esac
6459 siteprefix="$ans"
6460 siteprefixexp="$ansexp"
6461
6462 : determine where site specific libraries go.
6463 : Usual default is /usr/local/lib/perl5/site_perl/$version
6464 : The default "style" setting is made in installstyle.U
6465 : XXX No longer works with Prefixit stuff.
6466 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6467 case "$sitelib" in
6468 '') case "$installstyle" in
6469         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6470         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6471         esac
6472         ;;
6473 *)      dflt="$sitelib"
6474         ;;
6475 esac
6476 $cat <<EOM
6477
6478 The installation process will create a directory for
6479 site-specific extensions and modules.  Most users find it convenient
6480 to place all site-specific files in this directory rather than in the
6481 main distribution directory.
6482
6483 EOM
6484 fn=d~+
6485 rp='Pathname for the site-specific library files?'
6486 . ./getfile
6487 prefixvar=sitelib
6488 . ./setprefixvar
6489 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6490
6491 : Determine list of previous versions to include in @INC
6492 $cat > getverlist <<EOPL
6493 #!$perl5 -w
6494 use File::Basename;
6495 \$api_versionstring = "$api_versionstring";
6496 \$version = "$version";
6497 \$stem = "$sitelib_stem";
6498 \$archname = "$archname";
6499 EOPL
6500         $cat >> getverlist <<'EOPL'
6501 # The list found is store twice for each entry: the original name, and
6502 # the binary broken down version as pack "sss", so sorting is easy and
6503 # unambiguous. This will work for all versions that have a maximum of
6504 # three digit groups, separate by '.'s or '_'s. Names are extended with
6505 # ".0.0" to ensure at least three elements for the pack.
6506 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6507
6508 # Can't have leading @ because metaconfig interprets it as a command!
6509 ;@inc_version_list=();
6510 # XXX Redo to do opendir/readdir?
6511 if (-d $stem) {
6512     chdir($stem);
6513     ;@candidates = map {
6514         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6515     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6516 }
6517 else {
6518     ;@candidates = ();
6519 }
6520
6521 ($pversion, $aversion, $vsn5005) = map {
6522     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6523 foreach $d (@candidates) {
6524     if ($d->[1] lt $pversion) {
6525         if ($d->[1] ge $aversion) {
6526             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6527         }
6528         elsif ($d->[1] ge $vsn5005) {
6529             unshift(@inc_version_list, grep { -d } $d->[0]);
6530         }
6531     }
6532     else {
6533         # Skip newer version.  I.e. don't look in
6534         # 5.7.0 if we're installing 5.6.1.
6535     }
6536 }
6537
6538 if (@inc_version_list) {
6539     print join(' ', @inc_version_list);
6540 }
6541 else {
6542     # Blank space to preserve value for next Configure run.
6543     print " ";
6544 }
6545 EOPL
6546 chmod +x getverlist
6547 case "$inc_version_list" in
6548 '')     if test -x "$perl5$exe_ext"; then
6549                 dflt=`$perl5 getverlist`
6550         else
6551                 dflt='none'
6552         fi
6553         ;;
6554 $undef) dflt='none' ;;
6555 *)  eval dflt=\"$inc_version_list\" ;;
6556 esac
6557 case "$dflt" in
6558 ''|' ') dflt=none ;;
6559 esac
6560 case "$dflt" in
6561 5.005) dflt=none ;;
6562 esac
6563 $cat <<EOM
6564
6565 In order to ease the process of upgrading, this version of perl
6566 can be configured to use modules built and installed with earlier
6567 versions of perl that were installed under $prefix.  Specify here
6568 the list of earlier versions that this version of perl should check.
6569 If Configure detected no earlier versions of perl installed under
6570 $prefix, then the list will be empty.  Answer 'none' to tell perl
6571 to not search earlier versions.
6572
6573 The default should almost always be sensible, so if you're not sure,
6574 just accept the default.
6575 EOM
6576
6577 rp='List of earlier versions to include in @INC?'
6578 . ./myread
6579 case "$ans" in
6580 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6581 *) inc_version_list="$ans" ;;
6582 esac
6583 case "$inc_version_list" in
6584 ''|' ')
6585         inc_version_list_init='0'
6586         d_inc_version_list="$undef"
6587         ;;
6588 *)      inc_version_list_init=`echo $inc_version_list |
6589                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6590         d_inc_version_list="$define"
6591         ;;
6592 esac
6593 $rm -f getverlist
6594
6595 : see if malloc/malloc.h has to be included
6596 set malloc/malloc.h i_mallocmalloc
6597 eval $inhdr
6598
6599 : see if this is a malloc.h system
6600 : we want a real compile instead of Inhdr because some systems have a
6601 : malloc.h that just gives a compile error saying to use stdlib.h instead
6602 echo " "
6603 $cat >try.c <<EOCP
6604 #include <stdlib.h>
6605 #include <malloc.h>
6606 #$i_mallocmalloc I_MALLOCMALLOC
6607 #ifdef I_MALLOCMALLOC
6608 # include <malloc/malloc.h>
6609 #endif
6610
6611 int main () { return 0; }
6612 EOCP
6613 set try
6614 if eval $compile; then
6615     echo "<malloc.h> found." >&4
6616     val="$define"
6617 else
6618     echo "<malloc.h> NOT found." >&4
6619     val="$undef"
6620 fi
6621 $rm_try
6622 set i_malloc
6623 eval $setvar
6624
6625 : check for void type
6626 echo " "
6627 echo "Checking to see how well your C compiler groks the void type..." >&4
6628 case "$voidflags" in
6629 '')
6630         $cat >try.c <<EOCP
6631 #$i_stdlib I_STDLIB
6632 #ifdef I_STDLIB
6633 #include <stdlib.h>
6634 #endif
6635 #if TRY & 1
6636 void sub() {
6637 #else
6638 sub() {
6639 #endif
6640         extern void moo();      /* function returning void */
6641         void (*goo)();          /* ptr to func returning void */
6642 #if TRY & 8
6643         void *hue;              /* generic ptr */
6644 #endif
6645 #if TRY & 2
6646         void (*foo[10])();
6647 #endif
6648
6649 #if TRY & 4
6650         if(goo == moo) {
6651                 exit(0);
6652         }
6653 #endif
6654         exit(0);
6655 }
6656 int main() { sub(); }
6657 EOCP
6658         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6659                 voidflags=$defvoidused
6660         echo "Good.  It appears to support void to the level $package wants.">&4
6661                 if $contains warning .out >/dev/null 2>&1; then
6662                         echo "However, you might get some warnings that look like this:"
6663                         $cat .out
6664                 fi
6665         else
6666 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6667                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6668                         echo "It supports 1..."
6669                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6670                                 echo "It also supports 2..."
6671                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6672                                         voidflags=7
6673                                         echo "And it supports 4 but not 8 definitely."
6674                                 else
6675                                         echo "It doesn't support 4..."
6676                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6677                                                 voidflags=11
6678                                                 echo "But it supports 8."
6679                                         else
6680                                                 voidflags=3
6681                                                 echo "Neither does it support 8."
6682                                         fi
6683                                 fi
6684                         else
6685                                 echo "It does not support 2..."
6686                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6687                                         voidflags=13
6688                                         echo "But it supports 4 and 8."
6689                                 else
6690                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6691                                                 voidflags=5
6692                                                 echo "And it supports 4 but has not heard about 8."
6693                                         else
6694                                                 echo "However it supports 8 but not 4."
6695                                         fi
6696                                 fi
6697                         fi
6698                 else
6699                         echo "There is no support at all for void."
6700                         voidflags=0
6701                 fi
6702         fi
6703 esac
6704 case "$voidflags" in
6705 "$defvoidused") ;;
6706 *)      $cat >&4 <<'EOM'
6707   Support flag bits are:
6708     1: basic void declarations.
6709     2: arrays of pointers to functions returning void.
6710     4: operations between pointers to and addresses of void functions.
6711     8: generic void pointers.
6712 EOM
6713         dflt="$voidflags";
6714         rp="Your void support flags add up to what?"
6715         . ./myread
6716         voidflags="$ans"
6717         ;;
6718 esac
6719 $rm_try
6720
6721 : check for length of pointer
6722 echo " "
6723 case "$ptrsize" in
6724 '')
6725         echo "Checking to see how big your pointers are..." >&4
6726         if test "$voidflags" -gt 7; then
6727                 echo '#define VOID_PTR char *' > try.c
6728         else
6729                 echo '#define VOID_PTR void *' > try.c
6730         fi
6731         $cat >>try.c <<EOCP
6732 #include <stdio.h>
6733 #$i_stdlib I_STDLIB
6734 #ifdef I_STDLIB
6735 #include <stdlib.h>
6736 #endif
6737 int main()
6738 {
6739     printf("%d\n", (int)sizeof(VOID_PTR));
6740     exit(0);
6741 }
6742 EOCP
6743         set try
6744         if eval $compile_ok; then
6745                 ptrsize=`$run ./try`
6746                 echo "Your pointers are $ptrsize bytes long."
6747         else
6748                 dflt='4'
6749                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6750                 rp="What is the size of a pointer (in bytes)?"
6751                 . ./myread
6752                 ptrsize="$ans"
6753         fi
6754         ;;
6755 esac
6756 $rm_try
6757 case "$use64bitall" in
6758 "$define"|true|[yY]*)
6759         case "$ptrsize" in
6760         4)      cat <<EOM >&4
6761
6762 *** You have chosen a maximally 64-bit build,
6763 *** but your pointers are only 4 bytes wide.
6764 *** Please rerun Configure without -Duse64bitall.
6765 EOM
6766                 case "$d_quad" in
6767                 define)
6768                         cat <<EOM >&4
6769 *** Since you have quads, you could possibly try with -Duse64bitint.
6770 EOM
6771                         ;;
6772                 esac
6773                 cat <<EOM >&4
6774 *** Cannot continue, aborting.
6775
6776 EOM
6777
6778                 exit 1
6779                 ;;
6780         esac
6781         ;;
6782 esac
6783
6784
6785 : determine whether to use malloc wrapping
6786 echo " "
6787 case "$usemallocwrap" in
6788 [yY]*|true|$define)     dflt='y' ;;
6789 [nN]*|false|$undef)     dflt='n' ;;
6790 *)      case "$usedevel" in
6791         [yY]*|true|$define)     dflt='y' ;;
6792         *) dflt='n' ;;
6793         esac
6794         ;;
6795 esac
6796 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6797 . ./myread
6798 usemallocwrap="$ans"
6799 case "$ans" in
6800 y*|true)
6801         usemallocwrap="$define" ;;
6802 *)
6803         usemallocwrap="$undef" ;;
6804 esac
6805
6806 : determine which malloc to compile in
6807 echo " "
6808 case "$usemymalloc" in
6809 [yY]*|true|$define)     dflt='y' ;;
6810 [nN]*|false|$undef)     dflt='n' ;;
6811 *)      case "$ptrsize" in
6812         4) dflt='y' ;;
6813         *) dflt='n' ;;
6814         esac
6815         if test "$useithreads" = "$define"; then dflt='n'; fi
6816         ;;
6817 esac
6818 rp="Do you wish to attempt to use the malloc that comes with $package?"
6819 . ./myread
6820 usemymalloc="$ans"
6821 case "$ans" in
6822 y*|true)
6823         usemymalloc='y'
6824         mallocsrc='malloc.c'
6825         mallocobj="malloc$_o"
6826         d_mymalloc="$define"
6827         case "$libs" in
6828         *-lmalloc*)
6829                 : Remove malloc from list of libraries to use
6830                 echo "Removing unneeded -lmalloc from library list" >&4
6831                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6832                 shift
6833                 libs="$*"
6834                 echo "libs = $libs" >&4
6835                 ;;
6836         esac
6837         ;;
6838 *)
6839         usemymalloc='n'
6840         mallocsrc=''
6841         mallocobj=''
6842         d_mymalloc="$undef"
6843         ;;
6844 esac
6845
6846 : compute the return types of malloc and free
6847 echo " "
6848 $cat >malloc.c <<END
6849 #$i_malloc I_MALLOC
6850 #$i_stdlib I_STDLIB
6851 #include <stdio.h>
6852 #include <sys/types.h>
6853 #ifdef I_MALLOC
6854 #include <malloc.h>
6855 #endif
6856 #ifdef I_STDLIB
6857 #include <stdlib.h>
6858 #endif
6859 #ifdef TRY_MALLOC
6860 void *malloc();
6861 #endif
6862 #ifdef TRY_FREE
6863 void free();
6864 #endif
6865 END
6866 case "$malloctype" in
6867 '')
6868         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6869                 malloctype='void *'
6870         else
6871                 malloctype='char *'
6872         fi
6873         ;;
6874 esac
6875 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6876
6877 case "$freetype" in
6878 '')
6879         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6880                 freetype='void'
6881         else
6882                 freetype='int'
6883         fi
6884         ;;
6885 esac
6886 echo "Your system uses $freetype free(), it would seem." >&4
6887 $rm -f malloc.[co]
6888 : determine where site specific architecture-dependent libraries go.
6889 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6890 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6891 : sitelib may have an optional trailing /share.
6892 case "$sitearch" in
6893 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6894         dflt="$dflt/$archname"
6895         ;;
6896 *)      dflt="$sitearch"
6897         ;;
6898 esac
6899 set sitearch sitearch none
6900 eval $prefixit
6901 $cat <<EOM
6902
6903 The installation process will also create a directory for
6904 architecture-dependent site-specific extensions and modules.
6905
6906 EOM
6907 fn=d~+
6908 rp='Pathname for the site-specific architecture-dependent library files?'
6909 . ./getfile
6910 prefixvar=sitearch
6911 . ./setprefixvar
6912 if $test X"$sitearch" = X"$sitelib"; then
6913         d_sitearch="$undef"
6914 else
6915         d_sitearch="$define"
6916 fi
6917
6918 : Set the vendorprefix variables
6919 $cat <<EOM
6920
6921 The installation process will also create a directory for
6922 vendor-supplied add-ons.  Vendors who supply perl with their system
6923 may find it convenient to place all vendor-supplied files in this
6924 directory rather than in the main distribution directory.  This will
6925 ease upgrades between binary-compatible maintenance versions of perl.
6926
6927 Of course you may also use these directories in whatever way you see
6928 fit.  For example, you might use them to access modules shared over a
6929 company-wide network.
6930
6931 The default answer should be fine for most people.
6932 This causes further questions about vendor add-ons to be skipped
6933 and no vendor-specific directories will be configured for perl.
6934
6935 EOM
6936 rp='Do you want to configure vendor-specific add-on directories?'
6937 case "$usevendorprefix" in
6938 define|true|[yY]*) dflt=y ;;
6939 *)      : User may have set vendorprefix directly on Configure command line.
6940         case "$vendorprefix" in
6941         ''|' ') dflt=n ;;
6942         *)      dflt=y ;;
6943         esac
6944         ;;
6945 esac
6946 . ./myread
6947 case "$ans" in
6948 [yY]*)  fn=d~+
6949         rp='Installation prefix to use for vendor-supplied add-ons?'
6950         case "$vendorprefix" in
6951         '') dflt='' ;;
6952         *)  dflt=$vendorprefix ;;
6953         esac
6954         . ./getfile
6955         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6956         oldvendorprefix=''
6957         case "$vendorprefix" in
6958         '') ;;
6959         *)      case "$ans" in
6960                 "$prefix") ;;
6961                 *) oldvendorprefix="$prefix";;
6962                 esac
6963                 ;;
6964         esac
6965         usevendorprefix="$define"
6966         vendorprefix="$ans"
6967         vendorprefixexp="$ansexp"
6968         ;;
6969 *)      usevendorprefix="$undef"
6970         vendorprefix=''
6971         vendorprefixexp=''
6972         ;;
6973 esac
6974
6975 : Set the vendorlib variables
6976 case "$vendorprefix" in
6977 '')     d_vendorlib="$undef"
6978         vendorlib=''
6979         vendorlibexp=''
6980         ;;
6981 *)      d_vendorlib="$define"
6982         : determine where vendor-supplied modules go.
6983         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6984         case "$vendorlib" in
6985         '')
6986                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6987                 case "$installstyle" in
6988                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6989                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6990                 esac
6991                 ;;
6992         *)      dflt="$vendorlib"
6993                 ;;
6994         esac
6995         fn=d~+
6996         rp='Pathname for the vendor-supplied library files?'
6997         . ./getfile
6998         vendorlib="$ans"
6999         vendorlibexp="$ansexp"
7000         ;;
7001 esac
7002 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7003 prefixvar=vendorlib
7004 . ./installprefix
7005
7006 : Set the vendorarch variables
7007 case "$vendorprefix" in
7008 '')     d_vendorarch="$undef"
7009         vendorarch=''
7010         vendorarchexp=''
7011         ;;
7012 *)      d_vendorarch="$define"
7013         : determine where vendor-supplied architecture-dependent libraries go.
7014         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7015         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7016         : vendorlib may have an optional trailing /share.
7017         case "$vendorarch" in
7018         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7019                 dflt="$dflt/$archname"
7020                 ;;
7021         *)      dflt="$vendorarch" ;;
7022         esac
7023         fn=d~+
7024         rp='Pathname for vendor-supplied architecture-dependent files?'
7025         . ./getfile
7026         vendorarch="$ans"
7027         vendorarchexp="$ansexp"
7028         ;;
7029 esac
7030 prefixvar=vendorarch
7031 . ./installprefix
7032 if $test X"$vendorarch" = X"$vendorlib"; then
7033         d_vendorarch="$undef"
7034 else
7035         d_vendorarch="$define"
7036 fi
7037
7038 : Final catch-all directories to search
7039 $cat <<EOM
7040
7041 Lastly, you can have perl look in other directories for extensions and
7042 modules in addition to those already specified.
7043 These directories will be searched after 
7044         $sitearch 
7045         $sitelib 
7046 EOM
7047 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7048 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7049 echo ' '
7050 case "$otherlibdirs" in
7051 ''|' ') dflt='none' ;;
7052 *)      dflt="$otherlibdirs" ;;
7053 esac
7054 $cat <<EOM
7055 Enter a colon-separated set of extra paths to include in perl's @INC
7056 search path, or enter 'none' for no extra paths.
7057
7058 EOM
7059
7060 rp='Colon-separated list of additional directories for perl to search?'
7061 . ./myread
7062 case "$ans" in
7063 ' '|''|none)    otherlibdirs=' ' ;;     
7064 *)      otherlibdirs="$ans" ;;
7065 esac
7066 case "$otherlibdirs" in
7067 ' ') val=$undef ;;
7068 *)      val=$define ;;
7069 esac
7070 set d_perl_otherlibdirs
7071 eval $setvar
7072
7073 : Cruising for prototypes
7074 echo " "
7075 echo "Checking out function prototypes..." >&4
7076 $cat >prototype.c <<EOCP
7077 #$i_stdlib I_STDLIB
7078 #ifdef I_STDLIB
7079 #include <stdlib.h>
7080 #endif
7081 int main(int argc, char *argv[]) {
7082         exit(0);}
7083 EOCP
7084 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7085         echo "Your C compiler appears to support function prototypes."
7086         val="$define"
7087 else
7088         echo "Your C compiler doesn't seem to understand function prototypes."
7089         val="$undef"
7090 fi
7091 set prototype
7092 eval $setvar
7093 $rm -f prototype*
7094
7095 : Check if ansi2knr is required
7096 case "$prototype" in
7097 "$define") ;;
7098 *)      ansi2knr='ansi2knr'
7099         echo " "
7100         cat <<EOM >&4
7101
7102 $me:  FATAL ERROR:
7103 This version of $package can only be compiled by a compiler that 
7104 understands function prototypes.  Unfortunately, your C compiler 
7105         $cc $ccflags
7106 doesn't seem to understand them.  Sorry about that.
7107
7108 If GNU cc is available for your system, perhaps you could try that instead.  
7109
7110 Eventually, we hope to support building Perl with pre-ANSI compilers.
7111 If you would like to help in that effort, please contact <perlbug@perl.org>.
7112
7113 Aborting Configure now.
7114 EOM
7115         exit 2
7116         ;;
7117 esac
7118
7119 : DTrace support
7120 dflt_dtrace='/usr/sbin/dtrace'
7121 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7122
7123 cat <<EOM
7124
7125 Perl can be built to support DTrace on platforms that support it.
7126 DTrace is a diagnosis and performance analysis tool from Sun.
7127
7128 If this doesn't make any sense to you, just accept the default '$dflt'.
7129 EOM
7130
7131 while $test 1 ; do
7132         case "$usedtrace" in
7133         $define|true|[yY]*)
7134                 dflt='y'
7135                 ;;
7136         ?*)
7137                 dflt='y'
7138                 dflt_dtrace=$usedtrace
7139                 ;;
7140         *)
7141                 dflt='n'
7142                 ;;
7143         esac
7144
7145         rp='Support DTrace if available?'
7146         . ./myread
7147         case "$ans" in
7148         y|Y)    val="$define" ;;
7149         *)      val="$undef" ;;
7150         esac
7151         set usedtrace
7152         eval $setvar
7153
7154         test "X$usedtrace" != "X$define" && break
7155
7156         echo " "
7157         rp='Where is the dtrace executable?'
7158         dflt=$dflt_dtrace
7159         . ./getfile
7160         val="$ans"
7161         set dtrace
7162         eval $setvar
7163
7164         if $test -f $dtrace
7165         then
7166                 if $dtrace -h -s ../perldtrace.d \
7167                         -o perldtrace.tmp >/dev/null 2>&1 \
7168                         && rm -f perldtrace.tmp
7169                 then
7170                         echo " "
7171                         echo "Good: your $dtrace knows about the -h flag."
7172                 else
7173                         cat >&2 <<EOM
7174
7175 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7176 ***
7177 *** Your installed dtrace doesn't support the -h switch to compile a D
7178 *** program into a C header. Can't continue.
7179
7180 EOM
7181                         exit 1
7182                 fi
7183                 break;
7184         fi
7185
7186         case "$fastread" in
7187         yes)
7188                 cat >&2 <<EOM
7189
7190 *** $me:  Fatal Error:  $dtrace not found.
7191 *** Can't continue.
7192
7193 EOM
7194                 exit 1
7195                 ;;
7196         *)
7197                 echo "*** $dtrace was not found."
7198                 echo " "
7199                 ;;
7200         esac
7201 done
7202
7203 : See if we want extra modules installed
7204 echo " "
7205 case "$extras" in
7206 '') dflt='n';;
7207 *) dflt='y';;
7208 esac
7209 cat <<EOM
7210 Perl can be built with extra modules or bundles of modules which
7211 will be fetched from the CPAN and installed alongside Perl.
7212
7213 Notice that you will need access to the CPAN; either via the Internet,
7214 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7215 be asked later to configure the CPAN.pm module which will in turn do
7216 the installation of the rest of the extra modules or bundles.)
7217
7218 Notice also that if the modules require any external software such as
7219 libraries and headers (the libz library and the zlib.h header for the
7220 Compress::Zlib module, for example) you MUST have any such software
7221 already installed, this configuration process will NOT install such
7222 things for you.
7223
7224 If this doesn't make any sense to you, just accept the default '$dflt'.
7225 EOM
7226 rp='Install any extra modules (y or n)?'
7227 . ./myread
7228 case "$ans" in
7229 y|Y)
7230         cat <<EOM
7231
7232 Please list any extra modules or bundles to be installed from CPAN,
7233 with spaces between the names.  The names can be in any format the
7234 'install' command of CPAN.pm will understand.  (Answer 'none',
7235 without the quotes, to install no extra modules or bundles.)
7236 EOM
7237         rp='Extras?'
7238         dflt="$extras"
7239         . ./myread
7240         extras="$ans"
7241 esac
7242 case "$extras" in
7243 ''|'none')
7244         val=''
7245         $rm -f ../extras.lst
7246         ;;
7247 *)      echo "(Saving the list of extras for later...)"
7248         echo "$extras" > ../extras.lst
7249         val="'$extras'"
7250         ;;
7251 esac
7252 set extras
7253 eval $setvar
7254 echo " "
7255
7256 : determine where html pages for programs go
7257 set html1dir html1dir none
7258 eval $prefixit
7259 $cat <<EOM
7260
7261 If you wish to install html files for programs in $spackage, indicate
7262 the appropriate directory here.  To skip installing html files,
7263 answer "none".
7264 EOM
7265 case "$html1dir" in
7266 ''|none|$undef|' ') dflt=none ;;
7267 *) dflt=$html1dir ;;
7268 esac
7269 fn=dn+~
7270 rp="Directory for the main $spackage html pages?"
7271 . ./getfile
7272 prefixvar=html1dir
7273 . ./setprefixvar
7274 : Use ' ' for none so value is preserved next time through Configure
7275 $test X"$html1dir" = "X" && html1dir=' '
7276
7277 : determine where html pages for libraries and modules go
7278 set html3dir html3dir none
7279 eval $prefixit
7280 $cat <<EOM
7281
7282 If you wish to install html files for modules associated with $spackage,
7283 indicate the appropriate directory here.  To skip installing html files,
7284 answer "none".
7285 EOM
7286 : There is no obvious default.  If they have specified html1dir, then
7287 : try to key off that, possibly changing .../html1 into .../html3.
7288 case "$html3dir" in
7289 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7290 *) dflt=$html3dir ;;
7291 esac
7292 fn=dn+~
7293 rp="Directory for the $spackage module html pages?"
7294 . ./getfile
7295 prefixvar=html3dir
7296 . ./setprefixvar
7297 : Use ' ' for none so value is preserved next time through Configure
7298 $test X"$html3dir" = "X" && html3dir=' '
7299
7300 : determine whether to install perl also as /usr/bin/perl
7301
7302 echo " "
7303 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7304         $cat <<EOM
7305 Many scripts expect perl to be installed as /usr/bin/perl.
7306
7307 If you want to, I can install the perl you are about to compile
7308 as /usr/bin/perl (in addition to $bin/perl).
7309 EOM
7310         if test -f /usr/bin/perl; then
7311             $cat <<EOM
7312
7313 However, please note that because you already have a /usr/bin/perl,
7314 overwriting that with a new Perl would very probably cause problems.
7315 Therefore I'm assuming you don't want to do that (unless you insist).
7316
7317 EOM
7318             case "$installusrbinperl" in
7319             "$define"|[yY]*)    dflt='y';;
7320             *)                  dflt='n';;
7321             esac
7322         else
7323             $cat <<EOM
7324
7325 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7326
7327 EOM
7328             case "$installusrbinperl" in
7329             "$undef"|[nN]*)     dflt='n';;
7330             *)                  dflt='y';;
7331             esac
7332         fi
7333         rp="Do you want to install perl as /usr/bin/perl?"
7334         . ./myread
7335         case "$ans" in
7336         [yY]*)  val="$define";;
7337         *)      val="$undef" ;;
7338         esac
7339 else
7340         val="$undef"
7341 fi
7342 set installusrbinperl
7343 eval $setvar
7344
7345 : Check if we are using the GNU C library
7346 echo " "
7347 echo "Checking for GNU C Library..." >&4
7348 cat >try.c <<'EOCP'
7349 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7350    alone are insufficient to distinguish different versions, such as
7351    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7352    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7353 */
7354 #include <stdio.h>
7355 int main(void)
7356 {
7357 #ifdef __GLIBC__
7358 #   ifdef __GLIBC_MINOR__
7359 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7360 #           include <gnu/libc-version.h>
7361             printf("%s\n",  gnu_get_libc_version());
7362 #       else
7363             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7364 #       endif
7365 #   else
7366         printf("%d\n",  __GLIBC__);
7367 #   endif
7368     return 0;
7369 #else
7370     return 1;
7371 #endif
7372 }
7373 EOCP
7374 set try
7375 if eval $compile_ok && $run ./try > glibc.ver; then
7376         val="$define"
7377         gnulibc_version=`$cat glibc.ver`
7378         echo "You are using the GNU C Library version $gnulibc_version"
7379 else
7380         val="$undef"
7381         gnulibc_version=''
7382         echo "You are not using the GNU C Library"
7383 fi
7384 $rm_try glibc.ver
7385 set d_gnulibc
7386 eval $setvar
7387
7388 : see if nm is to be used to determine whether a symbol is defined or not
7389 case "$usenm" in
7390 '')
7391         dflt=''
7392         case "$d_gnulibc" in
7393         "$define")
7394                 echo " "
7395                 echo "nm probably won't work on the GNU C Library." >&4
7396                 dflt=n
7397                 ;;
7398         esac
7399         case "$dflt" in
7400         '') 
7401                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7402                         echo " "
7403                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7404                         echo "'nm' won't be sufficient on this sytem." >&4
7405                         dflt=n
7406                 fi
7407                 ;;
7408         esac
7409         case "$dflt" in
7410         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7411                 if $test $dflt -gt 20; then
7412                         dflt=y
7413                 else
7414                         dflt=n
7415                 fi
7416                 ;;
7417         esac
7418         ;;
7419 *)
7420         case "$usenm" in
7421         true|$define) dflt=y;;
7422         *) dflt=n;;
7423         esac
7424         ;;
7425 esac
7426 $cat <<EOM
7427
7428 I can use $nm to extract the symbols from your C libraries. This
7429 is a time consuming task which may generate huge output on the disk (up
7430 to 3 megabytes) but that should make the symbols extraction faster. The
7431 alternative is to skip the 'nm' extraction part and to compile a small
7432 test program instead to determine whether each symbol is present. If
7433 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7434 this may be the best solution.
7435
7436 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7437
7438 EOM
7439 rp="Shall I use $nm to extract C symbols from the libraries?"
7440 . ./myread
7441 case "$ans" in
7442 [Nn]*) usenm=false;;
7443 *) usenm=true;;
7444 esac
7445
7446 runnm=$usenm
7447 case "$reuseval" in
7448 true) runnm=false;;
7449 esac
7450
7451 : nm options which may be necessary
7452 case "$nm_opt" in
7453 '') if $test -f /mach_boot; then
7454                 nm_opt=''       # Mach
7455         elif $test -d /usr/ccs/lib; then
7456                 nm_opt='-p'     # Solaris (and SunOS?)
7457         elif $test -f /dgux; then
7458                 nm_opt='-p'     # DG-UX
7459         elif $test -f /lib64/rld; then
7460                 nm_opt='-p'     # 64-bit Irix
7461         else
7462                 nm_opt=''
7463         fi;;
7464 esac
7465
7466 : nm options which may be necessary for shared libraries but illegal
7467 : for archive libraries.  Thank you, Linux.
7468 case "$nm_so_opt" in
7469 '')     case "$myuname" in
7470         *linux*|gnu*)
7471                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7472                         nm_so_opt='--dynamic'
7473                 fi
7474                 ;;
7475         esac
7476         ;;
7477 esac
7478
7479 : Figure out where the libc is located
7480 case "$runnm" in
7481 true)
7482 : get list of predefined functions in a handy place
7483 echo " "
7484 case "$libc" in
7485 '') libc=unknown
7486         case "$libs" in
7487         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7488         esac
7489         ;;
7490 esac
7491 case "$libs" in
7492 '') ;;
7493 *)  for thislib in $libs; do
7494         case "$thislib" in
7495         -lc|-lc_s)
7496                 : Handle C library specially below.
7497                 ;;
7498         -l*)
7499                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7500                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7501                         :
7502                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7503                         :
7504                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7505                         :
7506                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7507                         :
7508                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7509                         :
7510                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7511                         :
7512                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7513                         :
7514                 else
7515                         try=''
7516                 fi
7517                 libnames="$libnames $try"
7518                 ;;
7519         *) libnames="$libnames $thislib" ;;
7520         esac
7521         done
7522         ;;
7523 esac
7524 xxx=normal
7525 case "$libc" in
7526 unknown)
7527         set /lib/libc.$so
7528         for xxx in $libpth; do
7529                 $test -r $1 || set $xxx/libc.$so
7530                 : The messy sed command sorts on library version numbers.
7531                 $test -r $1 || \
7532                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7533                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7534                                 h
7535                                 s/[0-9][0-9]*/0000&/g
7536                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7537                                 G
7538                                 s/\n/ /' | \
7539                          $sort | $sed -e 's/^.* //'`
7540                 eval set \$$#
7541         done
7542         $test -r $1 || set /usr/ccs/lib/libc.$so
7543         $test -r $1 || set /lib/libsys_s$_a
7544         ;;
7545 *)
7546         set blurfl
7547         ;;
7548 esac
7549 if $test -r "$1"; then
7550         echo "Your (shared) C library seems to be in $1."
7551         libc="$1"
7552 elif $test -r /lib/libc && $test -r /lib/clib; then
7553         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7554         xxx=apollo
7555         libc='/lib/clib /lib/libc'
7556         if $test -r /lib/syslib; then
7557                 echo "(Your math library is in /lib/syslib.)"
7558                 libc="$libc /lib/syslib"
7559         fi
7560 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7561         echo "Your C library seems to be in $libc, as you said before."
7562 elif $test -r $incpath/usr/lib/libc$_a; then
7563         libc=$incpath/usr/lib/libc$_a;
7564         echo "Your C library seems to be in $libc.  That's fine."
7565 elif $test -r /lib/libc$_a; then
7566         libc=/lib/libc$_a;
7567         echo "Your C library seems to be in $libc.  You're normal."
7568 else
7569         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7570                 :
7571         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7572                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7573         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7574                 :
7575         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7576                 :
7577         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7578                 :
7579         else
7580                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7581         fi
7582         if $test -r "$tans"; then
7583                 echo "Your C library seems to be in $tans, of all places."
7584                 libc=$tans
7585         else
7586                 libc='blurfl'
7587         fi
7588 fi
7589 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7590         dflt="$libc"
7591         cat <<EOM
7592
7593 If the guess above is wrong (which it might be if you're using a strange
7594 compiler, or your machine supports multiple models), you can override it here.
7595
7596 EOM
7597 else
7598         dflt=''
7599         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7600         cat >&4 <<EOM
7601 I can't seem to find your C library.  I've looked in the following places:
7602
7603 EOM
7604         $sed 's/^/      /' libpath
7605         cat <<EOM
7606
7607 None of these seems to contain your C library. I need to get its name...
7608
7609 EOM
7610 fi
7611 fn=f
7612 rp='Where is your C library?'
7613 . ./getfile
7614 libc="$ans"
7615
7616 echo " "
7617 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7618 set X `cat libnames`
7619 shift
7620 xxx=files
7621 case $# in 1) xxx=file; esac
7622 echo "Extracting names from the following $xxx for later perusal:" >&4
7623 echo " "
7624 $sed 's/^/      /' libnames >&4
7625 echo " "
7626 $echo $n "This may take a while...$c" >&4
7627
7628 for file in $*; do
7629         case $file in
7630         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7631         *) $nm $nm_opt $file 2>/dev/null;;
7632         esac
7633 done >libc.tmp
7634
7635 $echo $n ".$c"
7636 $grep fprintf libc.tmp > libc.ptf
7637 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7638 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7639 xxx='[ADTSIWi]'
7640 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7641         eval $xscan;\
7642         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7643                 eval $xrun
7644 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7645         eval $xscan;\
7646         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7647                 eval $xrun
7648 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7649         eval $xscan;\
7650         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7651                 eval $xrun
7652 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7653         eval $xscan;\
7654         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7655                 eval $xrun
7656 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7657         eval $xscan;\
7658         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7659                 eval $xrun
7660 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7661         eval $xscan;\
7662         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7663                 eval $xrun
7664 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7665                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7666         eval $xscan;\
7667         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7668                 eval $xrun
7669 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7670         eval $xscan;\
7671         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7672                 eval $xrun
7673 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7674         eval $xscan;\
7675         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7676                 eval $xrun
7677 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7678         eval $xscan;\
7679         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7680                 eval $xrun
7681 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7682         eval $xscan;\
7683         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7684                 eval $xrun
7685 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7686         eval $xscan;\
7687         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7688                 eval $xrun
7689 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7690         eval $xscan;\
7691         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7692                 eval $xrun
7693 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7694         eval $xscan;\
7695         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7696                 eval $xrun
7697 else
7698         $nm -p $* 2>/dev/null >libc.tmp
7699         $grep fprintf libc.tmp > libc.ptf
7700         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7701                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7702         then
7703                 nm_opt='-p'
7704                 eval $xrun
7705         else
7706                 echo " "
7707                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7708                 com=''
7709                 if $ar t $libc > libc.tmp && \
7710                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7711                 then
7712                         for thisname in $libnames $libc; do
7713                                 $ar t $thisname >>libc.tmp
7714                         done
7715                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7716                         echo "Ok." >&4
7717                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7718                         for thisname in $libnames $libc; do
7719                                 $ar tv $thisname >>libc.tmp
7720                                 emximp -o tmp.imp $thisname \
7721                                     2>/dev/null && \
7722                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7723                                     < tmp.imp >>libc.tmp
7724                                 $rm -f tmp.imp
7725                         done
7726                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7727                         echo "Ok." >&4
7728                 else
7729                         echo "$ar didn't seem to work right." >&4
7730                         echo "Maybe this is a Cray...trying bld instead..." >&4
7731                         if  bld t $libc | \
7732                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7733                                 $test -s libc.list
7734                         then
7735                                 for thisname in $libnames; do
7736                                         bld t $libnames | \
7737                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7738                                         $ar t $thisname >>libc.tmp
7739                                 done
7740                                 echo "Ok." >&4
7741                         else
7742                                 echo "That didn't work either.  Giving up." >&4
7743                                 exit 1
7744                         fi
7745                 fi
7746         fi
7747 fi
7748 nm_extract="$com"
7749 case "$PASE" in
7750 define)
7751     echo " "
7752     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7753     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7754     ;;
7755 *)  if $test -f /lib/syscalls.exp; then
7756         echo " "
7757         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7758         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7759                 /lib/syscalls.exp >>libc.list
7760     fi
7761     ;;
7762 esac
7763 ;;
7764 esac
7765 $rm -f libnames libpath
7766
7767 : see if dld is available
7768 set dld.h i_dld
7769 eval $inhdr
7770
7771 : Check if we are using C++
7772 echo " "
7773 echo "Checking for C++..." >&4
7774 $cat >try.c <<'EOCP'
7775 #include <stdio.h>
7776 int main(void)
7777 {
7778 #ifdef __cplusplus
7779     return 0;
7780 #else
7781     return 1;
7782 #endif
7783 }
7784 EOCP
7785 set try
7786 if eval $compile_ok && $run ./try; then
7787         val="$define"
7788         echo "You are using a C++ compiler."
7789 else
7790         val="$undef"
7791         echo "You are not using a C++ compiler."
7792 fi
7793 $rm_try cplusplus$$
7794 set d_cplusplus
7795 eval $setvar
7796
7797 : is a C symbol defined?
7798 csym='tlook=$1;
7799 case "$3" in
7800 -v) tf=libc.tmp; tdc="";;
7801 -a) tf=libc.tmp; tdc="[]";;
7802 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7803 esac;
7804 case "$d_cplusplus" in
7805     $define)    extern_C="extern \"C\"" ;;
7806     *)          extern_C="extern"       ;;
7807 esac;
7808 tx=yes;
7809 case "$reuseval-$4" in
7810 true-) ;;
7811 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7812 esac;
7813 case "$tx" in
7814 yes)
7815         tval=false;
7816         if $test "$runnm" = true; then
7817                 if $contains $tlook $tf >/dev/null 2>&1; then
7818                         tval=true;
7819                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7820                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7821                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7822                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7823                         $rm_try;
7824                 fi;
7825         else
7826                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7827                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7828                 $rm_try;
7829         fi;
7830         ;;
7831 *)
7832         case "$tval" in
7833         $define) tval=true;;
7834         *) tval=false;;
7835         esac;
7836         ;;
7837 esac;
7838 eval "$2=$tval"'
7839
7840 : define an is-in-libc? function
7841 inlibc='echo " "; td=$define; tu=$undef;
7842 sym=$1; var=$2; eval "was=\$$2";
7843 tx=yes;
7844 case "$reuseval$was" in
7845 true) ;;
7846 true*) tx=no;;
7847 esac;
7848 case "$tx" in
7849 yes)
7850         set $sym tres -f;
7851         eval $csym;
7852         case "$tres" in
7853         true)
7854                 echo "$sym() found." >&4;
7855                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7856         *)
7857                 echo "$sym() NOT found." >&4;
7858                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7859         esac;;
7860 *)
7861         case "$was" in
7862         $define) echo "$sym() found." >&4;;
7863         *) echo "$sym() NOT found." >&4;;
7864         esac;;
7865 esac'
7866
7867 : see if dlopen exists
7868 xxx_runnm="$runnm"
7869 xxx_ccflags="$ccflags"
7870 runnm=false
7871 : with g++ one needs -shared to get is-in-libc to work for dlopen
7872 case "$gccversion" in
7873 '')     ;;
7874 *)      case "$d_cplusplus" in
7875         "$define") ccflags="$ccflags -shared" ;;
7876         esac
7877         ;;
7878 esac
7879 set dlopen d_dlopen
7880 eval $inlibc
7881 runnm="$xxx_runnm"
7882 ccflags="$xxx_ccflags"
7883
7884 : see if this is a unistd.h system
7885 set unistd.h i_unistd
7886 eval $inhdr
7887
7888 : determine which dynamic loading, if any, to compile in
7889 echo " "
7890 dldir="ext/DynaLoader"
7891 case "$usedl" in
7892 $define|y|true)
7893         dflt='y'
7894         usedl="$define"
7895         ;;
7896 $undef|n|false)
7897         dflt='n'
7898         usedl="$undef"
7899         ;;
7900 *)
7901         dflt='n'
7902         case "$d_dlopen" in
7903             $define) dflt='y' ;;
7904         esac
7905         case "$i_dld" in
7906             $define) dflt='y' ;;
7907         esac
7908         : Does a dl_xxx.xs file exist for this operating system
7909         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7910         ;;
7911 esac
7912 rp="Do you wish to use dynamic loading?"
7913 . ./myread
7914 usedl="$ans"
7915 bin_ELF="$undef"
7916 case "$ans" in
7917 y*) usedl="$define"
7918         case "$dlsrc" in
7919         '')
7920                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7921                         dflt="$dldir/dl_${osname}.xs"
7922                 elif $test "$d_dlopen" = "$define" ; then
7923                         dflt="$dldir/dl_dlopen.xs"
7924                 elif $test "$i_dld" = "$define" ; then
7925                         dflt="$dldir/dl_dld.xs"
7926                 else
7927                         dflt=''
7928                 fi
7929                 ;;
7930         *)      dflt="$dldir/$dlsrc"
7931                 ;;
7932         esac
7933     echo "The following dynamic loading files are available:"
7934         : Can not go over to $dldir because getfile has path hard-coded in.
7935         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7936         rp="Source file to use for dynamic loading"
7937         fn="fne"
7938         gfpth="$src"
7939         . ./getfile
7940         usedl="$define"
7941         : emulate basename
7942         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7943
7944         $cat << EOM
7945
7946 Some systems may require passing special flags to $cc -c to
7947 compile modules that will be used to create a shared library.
7948 To use no flags, say "none".
7949
7950 EOM
7951     case "$cccdlflags" in
7952     '') case "$gccversion" in
7953                 '') case "$osname" in
7954                         hpux)   dflt='+z' ;;
7955                         next)   dflt='none' ;;
7956                         irix*)  dflt='-KPIC' ;;
7957                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7958                         sunos)  dflt='-pic' ;;
7959                         *)      dflt='none' ;;
7960                     esac
7961                         ;;
7962                 *)  case "$osname" in
7963                         darwin) dflt='none' ;;
7964                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7965                         *)      dflt='-fpic' ;;
7966                     esac ;;
7967             esac ;;
7968         ' ') dflt='none' ;;
7969     *)  dflt="$cccdlflags" ;;
7970     esac
7971     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7972     . ./myread
7973     case "$ans" in
7974     none) cccdlflags=' ' ;;
7975     *) cccdlflags="$ans" ;;
7976     esac
7977
7978     cat << EOM
7979
7980 Some systems use ld to create libraries that can be dynamically loaded,
7981 while other systems (such as those using ELF) use $cc.
7982
7983 EOM
7984
7985 : Determine if this is ELF
7986         $cat >try.c <<EOM
7987 /* Test for whether ELF binaries are produced */
7988 #include <fcntl.h>
7989 #$i_stdlib I_STDLIB
7990 #ifdef I_STDLIB
7991 #include <stdlib.h>
7992 #endif
7993 #$i_unistd I_UNISTD
7994 #ifdef I_UNISTD
7995 #include <unistd.h>
7996 #endif
7997 int main() {
7998         char b[4];
7999         int i = open("a.out",O_RDONLY);
8000         if(i == -1)
8001                 exit(1); /* fail */
8002         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8003                 exit(0); /* succeed (yes, it is ELF) */
8004         else
8005                 exit(1); /* fail */
8006 }
8007 EOM
8008         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8009                 bin_ELF="$define"
8010         fi
8011         $rm_try
8012
8013         case "$ld" in
8014         '')     if $test $bin_ELF = "$define"; then
8015                         cat <<EOM
8016 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8017 EOM
8018                         dflt="$cc"
8019                 else
8020                         echo "I'll use ld to build dynamic libraries."
8021                         dflt='ld'
8022                 fi
8023                 ;;
8024         *)      dflt="$ld"
8025                 ;;
8026         esac
8027
8028     rp="What command should be used to create dynamic libraries?"
8029     . ./myread
8030         ld="$ans"
8031
8032     cat << EOM
8033
8034 Some systems may require passing special flags to $ld to create a
8035 library that can be dynamically loaded.  If your ld flags include
8036 -L/other/path options to locate libraries outside your loader's normal
8037 search path, you may need to specify those -L options here as well.  To
8038 use no flags, say "none".
8039
8040 EOM
8041     case "$lddlflags" in
8042     '') case "$osname" in
8043                         haiku) dflt='-shared' ;;
8044                         hpux) dflt='-b';
8045                               case "$gccversion" in
8046                               '') dflt="$dflt +vnocompatwarnings" ;;
8047                               esac
8048                               ;;
8049                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8050                         next)  dflt='none' ;;
8051                         solaris) dflt='-G' ;;
8052                         sunos) dflt='-assert nodefinitions' ;;
8053                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8054                 *)     dflt='none' ;;
8055                         esac
8056                         ;;
8057     *) dflt="$lddlflags" ;;
8058     esac
8059
8060         : Try to guess additional flags to pick up local libraries.
8061         : Be careful not to append to a plain 'none'
8062         case "$dflt" in
8063         none) dflt='' ;;
8064         esac
8065         for thisflag in $ldflags; do
8066                 case "$thisflag" in
8067                 -L*|-R*|-Wl,-R*)
8068                         case " $dflt " in
8069                         *" $thisflag "*) ;;
8070                         *) dflt="$dflt $thisflag" ;;
8071                         esac
8072                         ;;
8073                 esac
8074         done
8075
8076         case "$dflt" in
8077         ''|' ') dflt='none' ;;
8078         esac
8079
8080         case "$ldflags" in
8081         *-fstack-protector*)
8082             case "$dflt" in
8083                         *-fstack-protector*) ;; # Don't add it again
8084                         *) dflt="$dflt -fstack-protector" ;; 
8085                 esac
8086                 ;;
8087         esac
8088
8089
8090     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8091     . ./myread
8092     case "$ans" in
8093     none) lddlflags=' ' ;;
8094     *) lddlflags="$ans" ;;
8095     esac
8096
8097         cat <<EOM
8098
8099 Some systems may require passing special flags to $cc to indicate that
8100 the resulting executable will use dynamic linking.  To use no flags,
8101 say "none".
8102
8103 EOM
8104     case "$ccdlflags" in
8105     '') case "$osname" in
8106             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8107             next|sunos) dflt='none' ;;
8108             *)          dflt='none' ;;
8109             esac ;;
8110     ' ')  dflt='none' ;;
8111     *)  dflt="$ccdlflags" ;;
8112     esac
8113     rp="Any special flags to pass to $cc to use dynamic linking?"
8114     . ./myread
8115     case "$ans" in
8116     none) ccdlflags=' ' ;;
8117     *) ccdlflags="$ans" ;;
8118     esac
8119     ;;
8120 *)  usedl="$undef"
8121         ld='ld'
8122     dlsrc='dl_none.xs'
8123     lddlflags=''
8124     ccdlflags=''
8125     ;;
8126 esac
8127
8128 ld_can_script="$undef"
8129 case "$bin_ELF$usedl" in
8130 $define$define)
8131     # Abuse try.h and a.out names for neat cleanup
8132     $cat >try.c <<EOM
8133 void foo() {}
8134 void bar() {}
8135 EOM
8136     $cat >try.h <<EOM
8137 LIBTEST_42 {
8138  global:
8139   foo;
8140  local: *;
8141  };
8142 EOM
8143     if $cc $cccdlflags $ccdlflags $ccflags \
8144            $ldflags $lddlflags -o a.out try.c \
8145            -Wl,--version-script=try.h >/dev/null 2>&1 \
8146        &&  $test -s a.out ; then
8147         echo "ld supports scripting" >&4
8148         ld_can_script="$define"
8149     else
8150         echo "ld does not support scripting" >&4
8151     fi
8152     $rm_try
8153     ;;
8154 esac
8155
8156 : Do we want a shared libperl?
8157 also=''
8158 case "$usedl" in
8159 $undef)
8160         # No dynamic loading being used, so don't bother even to prompt.
8161         useshrplib='false'
8162         ;;
8163 *)      case "$useshrplib" in
8164         '')     case "$osname" in
8165                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8166                         dflt=y
8167                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8168                         ;;
8169                 next*)
8170                         case "$osvers" in
8171                         4*)     dflt=y
8172                                 also='Building a shared libperl is needed for MAB support.'
8173                                 ;;
8174                         *)      dflt=n
8175                                 ;;
8176                         esac
8177                         ;;
8178                 *)      dflt=n
8179                         ;;
8180                 esac
8181                 ;;
8182         $define|true|[Yy]*)
8183                 dflt=y
8184                 ;;
8185         *)      dflt=n
8186                 ;;
8187         esac
8188         $cat << EOM
8189
8190 The perl executable is normally obtained by linking perlmain.c with
8191 libperl${_a}, any static extensions (usually just DynaLoader), and
8192 any other libraries needed on this system (such as -lm, etc.).  Since
8193 your system supports dynamic loading, it is probably possible to build
8194 a shared libperl.$so.  If you will have more than one executable linked
8195 to libperl.$so, this will significantly reduce the size of each
8196 executable, but it may have a noticeable effect on performance.  The
8197 default is probably sensible for your system.
8198 $also
8199
8200 EOM
8201         rp="Build a shared libperl.$so (y/n)"
8202         . ./myread
8203         case "$ans" in
8204         true|$define|[Yy]*)
8205                 useshrplib='true'  ;;
8206         *)      useshrplib='false' ;;
8207         esac
8208         ;;
8209 esac
8210
8211 case "$useshrplib" in
8212 true)
8213         case "$userelocatableinc" in
8214         true|define)
8215                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8216                 echo "See INSTALL for an explanation why that won't work." >&4
8217                 exit 4
8218                 ;;
8219         esac
8220         case "$libperl" in
8221         '')
8222                 # Figure out a good name for libperl.so.  Since it gets stored in
8223                 # a version-specific architecture-dependent library, the version
8224                 # number isn't really that important, except for making cc/ld happy.
8225                 #
8226                 # A name such as libperl.so.10.1
8227                 majmin="libperl.$so.$patchlevel.$subversion"
8228                 # A name such as libperl.so.100
8229                 majonly=`echo $patchlevel $subversion |
8230                         $awk '{printf "%d%02d", $1, $2}'`
8231                 majonly=libperl.$so.$majonly
8232                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8233                 # rely on figuring it out from the naming of libc.
8234                 case "${osname}${osvers}" in
8235                 next4*)
8236                         dflt=libperl.5.$so
8237                         # XXX How handle the --version stuff for MAB?
8238                         ;;
8239                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8240                         dflt=libperl.$so
8241                         ;;
8242                 cygwin*) # ld links now against the dll directly
8243                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8244                         majonly=`echo $patchlevel $subversion |
8245                                 $awk '{printf "%03d%03d", $1, $2}'`
8246                         majonly=cygperl5.$majonly.$so
8247                         dflt=$majmin
8248                         ;;
8249                 *)      # Try to guess based on whether libc has major.minor.
8250                         case "$libc" in
8251                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8252                         *libc.$so.[0-9]*) dflt=$majonly ;;
8253                         *)      dflt=libperl.$so ;;
8254                         esac
8255                         ;;
8256                 esac
8257                 ;;
8258         *)      dflt=$libperl
8259                 ;;
8260         esac
8261         cat << EOM
8262
8263 I need to select a good name for the shared libperl.  If your system uses
8264 library names with major and minor numbers, then you might want something
8265 like $majmin.  Alternatively, if your system uses a single version
8266 number for shared libraries, then you might want to use $majonly.
8267 Or, your system might be quite happy with a simple libperl.$so.
8268
8269 Since the shared libperl will get installed into a version-specific
8270 architecture-dependent directory, the version number of the shared perl
8271 library probably isn't important, so the default should be o.k.
8272
8273 EOM
8274         rp='What name do you want to give to the shared libperl?'
8275         . ./myread
8276         libperl=$ans
8277         echo "Ok, I'll use $libperl"
8278         ;;
8279 *)
8280         libperl="libperl${_a}"
8281         ;;
8282 esac
8283
8284 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8285 case "$shrpdir" in
8286 '') ;;
8287 *)      $cat >&4 <<EOM
8288 WARNING:  Use of the shrpdir variable for the installation location of
8289 the shared $libperl is not supported.  It was never documented and
8290 will not work in this version.  Let me (perlbug@perl.org)
8291 know of any problems this may cause.
8292
8293 EOM
8294         case "$shrpdir" in
8295         "$archlibexp/CORE")
8296                 $cat >&4 <<EOM
8297 But your current setting of $shrpdir is
8298 the default anyway, so it's harmless.
8299 EOM
8300                 ;;
8301         *)
8302                 $cat >&4 <<EOM
8303 Further, your current attempted setting of $shrpdir
8304 conflicts with the value of $archlibexp/CORE
8305 that installperl will use.
8306 EOM
8307                 ;;
8308         esac
8309         ;;
8310 esac
8311
8312 # How will the perl executable find the installed shared $libperl?
8313 # Add $xxx to ccdlflags.
8314 # If we can't figure out a command-line option, use $shrpenv to
8315 # set env LD_RUN_PATH.  The main perl makefile uses this.
8316 shrpdir=$archlibexp/CORE
8317 xxx=''
8318 tmp_shrpenv=''
8319 if "$useshrplib"; then
8320     case "$osname" in
8321         aix)
8322                 # We'll set it in Makefile.SH...
8323                 ;;
8324         solaris)
8325                 xxx="-R $shrpdir"
8326                 ;;
8327         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly)
8328                 xxx="-Wl,-R$shrpdir"
8329                 ;;
8330         bsdos|linux|irix*|dec_osf|gnu*)
8331                 xxx="-Wl,-rpath,$shrpdir"
8332                 ;;
8333         next)
8334                 # next doesn't like the default...
8335                 ;;
8336         haiku)
8337                 # Haiku doesn't like the default, either.
8338                 ;;
8339         hpux*)
8340                 # hpux doesn't like the default, either.
8341                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8342                 ;;
8343         cygwin)
8344                 # cygwin needs only ldlibpth
8345                 ;;
8346         *)
8347                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8348                 ;;
8349         esac
8350         case "$xxx" in
8351         '') ;;
8352         *)
8353                 # Only add $xxx if it isn't already in ccdlflags.
8354                 case " $ccdlflags " in
8355                 *" $xxx "*)     ;;
8356                 *)      ccdlflags="$ccdlflags $xxx"
8357                         cat <<EOM >&4
8358
8359 Adding $xxx to the flags
8360 passed to $ld so that the perl executable will find the
8361 installed shared $libperl.
8362
8363 EOM
8364                         ;;
8365                 esac
8366                 ;;
8367         esac
8368 fi
8369 # Fix ccdlflags in AIX for building external extensions.
8370 # (For building Perl itself bare -bE:perl.exp is needed,
8371 #  Makefile.SH takes care of this.)
8372 case "$osname" in
8373 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8374 esac
8375 # Respect a hint or command-line value.
8376 case "$shrpenv" in
8377 '') shrpenv="$tmp_shrpenv" ;;
8378 esac
8379 case "$ldlibpthname" in
8380 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8381 none)   ldlibpthname='' ;;
8382 esac
8383
8384 : determine where manual pages are on this system
8385 echo " "
8386 case "$sysman" in
8387 '') 
8388         syspath='/usr/share/man/man1 /usr/man/man1'
8389         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8390         syspath="$syspath /usr/man/u_man/man1"
8391         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8392         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8393         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8394         sysman=`./loc . /usr/man/man1 $syspath`
8395         ;;
8396 esac
8397 if $test -d "$sysman"; then
8398         echo "System manual is in $sysman." >&4
8399 else
8400         echo "Could not find manual pages in source form." >&4
8401 fi
8402
8403 : determine where manual pages go
8404 set man1dir man1dir none
8405 eval $prefixit
8406 $cat <<EOM
8407
8408 $spackage has manual pages available in source form.
8409 EOM
8410 case "$nroff" in
8411 nroff)
8412         echo "However, you don't have nroff, so they're probably useless to you."
8413         case "$man1dir" in
8414         '') man1dir="none";;
8415         esac;;
8416 esac
8417 echo "If you don't want the manual sources installed, answer 'none'."
8418 case "$man1dir" in
8419 ' ') dflt=none
8420         ;;
8421 '')
8422         lookpath="$prefixexp/share/man/man1"
8423         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8424         lookpath="$lookpath $prefixexp/man/p_man/man1"
8425         lookpath="$lookpath $prefixexp/man/u_man/man1"
8426         lookpath="$lookpath $prefixexp/man/man.1"
8427         case "$sysman" in
8428         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8429         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8430         esac
8431         set dflt
8432         eval $prefixup
8433         ;;
8434 *)  dflt="$man1dir"
8435         ;;
8436 esac
8437 echo " "
8438 fn=dn+~
8439 rp="Where do the main $spackage manual pages (source) go?"
8440 . ./getfile
8441 if $test "X$man1direxp" != "X$ansexp"; then
8442         installman1dir=''
8443 fi
8444 prefixvar=man1dir
8445 . ./setprefixvar
8446
8447 case "$man1dir" in
8448 '')     man1dir=' '
8449         installman1dir='';;
8450 esac
8451
8452 : What suffix to use on installed man pages
8453
8454 case "$man1dir" in
8455 ' ')
8456         man1ext='0'
8457         ;;
8458 *)
8459         rp="What suffix should be used for the main $spackage man pages?"
8460         case "$man1ext" in
8461         '')     case "$man1dir" in
8462                 *1)  dflt=1 ;;
8463                 *1p) dflt=1p ;;
8464                 *1pm) dflt=1pm ;;
8465                 *l) dflt=l;;
8466                 *n) dflt=n;;
8467                 *o) dflt=o;;
8468                 *p) dflt=p;;
8469                 *C) dflt=C;;
8470                 *L) dflt=L;;
8471                 *L1) dflt=L1;;
8472                 *) dflt=1;;
8473                 esac
8474                 ;;
8475         *)      dflt="$man1ext";;
8476         esac
8477         . ./myread
8478         man1ext="$ans"
8479         ;;
8480 esac
8481
8482 : see if we can have long filenames
8483 echo " "
8484 first=123456789abcdef
8485 $rm -f $first
8486 if (echo hi >$first) 2>/dev/null; then
8487         if $test -f 123456789abcde; then
8488                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8489                 val="$undef"
8490         else
8491                 echo 'You can have filenames longer than 14 characters.'>&4
8492                 val="$define"
8493         fi
8494 else
8495         $cat <<'EOM'
8496 You can't have filenames longer than 14 chars.
8497 You can't even think about them!
8498 EOM
8499         val="$undef"
8500 fi
8501 set d_flexfnam
8502 eval $setvar
8503 $rm -rf 123456789abcde*
8504
8505 : determine where library module manual pages go
8506 set man3dir man3dir none
8507 eval $prefixit
8508 $cat <<EOM
8509
8510 $spackage has manual pages for many of the library modules.
8511 EOM
8512
8513 case "$nroff" in
8514 nroff)
8515         $cat <<'EOM'
8516 However, you don't have nroff, so they're probably useless to you.
8517 EOM
8518         case "$man3dir" in
8519         '') man3dir="none";;
8520         esac;;
8521 esac
8522
8523 case "$d_flexfnam" in
8524 undef)
8525         $cat <<'EOM'
8526 However, your system can't handle the long file names like File::Basename.3.
8527 EOM
8528         case "$man3dir" in
8529         '') man3dir="none";;
8530         esac;;
8531 esac
8532
8533 echo "If you don't want the manual sources installed, answer 'none'."
8534 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8535 case "$man3dir" in
8536 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8537         if $test -d "$privlib/man/man3"; then
8538                 cat <<EOM >&4
8539
8540 WARNING:  Previous versions of perl installed man3 pages into
8541 $privlib/man/man3.  This version will suggest a
8542 new default of $dflt.
8543 EOM
8544                 tdflt=$dflt
8545                 dflt='n'
8546                 rp='Do you wish to preserve the old behavior?(y/n)'
8547                 . ./myread
8548                 case "$ans" in
8549                 y*) dflt="$privlib/man/man3" ;;
8550                 *)  dflt=$tdflt ;;
8551                 esac
8552     fi
8553         ;;
8554 *)      dflt="$man3dir" ;;
8555 esac
8556 case "$dflt" in
8557 ' ') dflt=none ;;
8558 esac
8559 echo " "
8560 fn=dn+~
8561 rp="Where do the $package library man pages (source) go?"
8562 . ./getfile
8563 prefixvar=man3dir
8564 . ./setprefixvar
8565
8566 case "$man3dir" in
8567 '')     man3dir=' '
8568         installman3dir='';;
8569 esac
8570
8571 : What suffix to use on installed man pages
8572 case "$man3dir" in
8573 ' ')
8574         man3ext='0'
8575         ;;
8576 *)
8577         rp="What suffix should be used for the $package library man pages?"
8578         case "$man3ext" in
8579         '')     case "$man3dir" in
8580                 *3)  dflt=3 ;;
8581                 *3p) dflt=3p ;;
8582                 *3pm) dflt=3pm ;;
8583                 *l) dflt=l;;
8584                 *n) dflt=n;;
8585                 *o) dflt=o;;
8586                 *p) dflt=p;;
8587                 *C) dflt=C;;
8588                 *L) dflt=L;;
8589                 *L3) dflt=L3;;
8590                 *) dflt=3;;
8591                 esac
8592                 ;;
8593         *)      dflt="$man3ext";;
8594         esac
8595         . ./myread
8596         man3ext="$ans"
8597         ;;
8598 esac
8599
8600 : see if we have to deal with yellow pages, now NIS.
8601 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8602         if $test -f /usr/etc/nibindd; then
8603                 echo " "
8604                 echo "I'm fairly confident you're on a NeXT."
8605                 echo " "
8606                 rp='Do you get the hosts file via NetInfo?'
8607                 dflt=y
8608                 case "$hostcat" in
8609                 nidump*) ;;
8610                 '') ;;
8611                 *) dflt=n;;
8612                 esac
8613                 . ./myread
8614                 case "$ans" in
8615                 y*) hostcat='nidump hosts .';;
8616                 *)      case "$hostcat" in
8617                         nidump*) hostcat='';;
8618                         esac
8619                         ;;
8620                 esac
8621         fi
8622         case "$hostcat" in
8623         nidump*) ;;
8624         *)
8625                 case "$hostcat" in
8626                 *ypcat*) dflt=y;;
8627                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8628                                 dflt=y
8629                         else
8630                                 dflt=n
8631                         fi;;
8632                 *) dflt=n;;
8633                 esac
8634                 echo " "
8635                 rp='Are you getting the hosts file via yellow pages?'
8636                 . ./myread
8637                 case "$ans" in
8638                 y*) hostcat='ypcat hosts';;
8639                 *) hostcat='cat /etc/hosts';;
8640                 esac
8641                 ;;
8642         esac
8643 fi
8644 case "$hostcat" in
8645 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8646 esac
8647 case "$groupcat" in
8648 '') test -f /etc/group && groupcat='cat /etc/group';;
8649 esac
8650 case "$passcat" in
8651 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8652 esac
8653
8654 : now get the host name
8655 echo " "
8656 echo "Figuring out host name..." >&4
8657 case "$myhostname" in
8658 '') cont=true
8659         echo 'Maybe "hostname" will work...'
8660         if tans=`sh -c hostname 2>&1` ; then
8661                 myhostname=$tans
8662                 phostname=hostname
8663                 cont=''
8664         fi
8665         ;;
8666 *) cont='';;
8667 esac
8668 if $test "$cont"; then
8669         if ./xenix; then
8670                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8671                 if tans=`cat /etc/systemid 2>&1` ; then
8672                         myhostname=$tans
8673                         phostname='cat /etc/systemid'
8674                         echo "Whadyaknow.  Xenix always was a bit strange..."
8675                         cont=''
8676                 fi
8677         elif $test -r /etc/systemid; then
8678                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8679         fi
8680 fi
8681 if $test "$cont"; then
8682         echo 'No, maybe "uuname -l" will work...'
8683         if tans=`sh -c 'uuname -l' 2>&1` ; then
8684                 myhostname=$tans
8685                 phostname='uuname -l'
8686         else
8687                 echo 'Strange.  Maybe "uname -n" will work...'
8688                 if tans=`sh -c 'uname -n' 2>&1` ; then
8689                         myhostname=$tans
8690                         phostname='uname -n'
8691                 else
8692                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8693                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8694                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8695                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8696                         else
8697                                 case "$myhostname" in
8698                                 '') echo "Does this machine have an identity crisis or something?"
8699                                         phostname='';;
8700                                 *)
8701                                         echo "Well, you said $myhostname before..."
8702                                         phostname='echo $myhostname';;
8703                                 esac
8704                         fi
8705                 fi
8706         fi
8707 fi
8708 case "$myhostname" in
8709 '') myhostname=noname ;;
8710 esac
8711 : you do not want to know about this
8712 set $myhostname
8713 myhostname=$1
8714
8715 : verify guess
8716 if $test "$myhostname" ; then
8717         dflt=y
8718         rp='Your host name appears to be "'$myhostname'".'" Right?"
8719         . ./myread
8720         case "$ans" in
8721         y*) ;;
8722         *) myhostname='';;
8723         esac
8724 fi
8725
8726 : bad guess or no guess
8727 while $test "X$myhostname" = X ; do
8728         dflt=''
8729         rp="Please type the (one word) name of your host:"
8730         . ./myread
8731         myhostname="$ans"
8732 done
8733
8734 : translate upper to lower if necessary
8735 case "$myhostname" in
8736 *[A-Z]*)
8737         echo "(Normalizing case in your host name)"
8738         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8739         ;;
8740 esac
8741
8742 case "$myhostname" in
8743 *.*)
8744         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8745         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8746         echo "(Trimming domain name from host name--host name is now $myhostname)"
8747         ;;
8748 *) case "$mydomain" in
8749         '')
8750                 {
8751                         test "X$hostcat" = "Xypcat hosts" &&
8752                         ypmatch "$myhostname" hosts 2>/dev/null |\
8753                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8754                         $test -s hosts
8755                 } || {
8756                         test "X$hostcat" != "X" &&
8757                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8758                                         /[       ]$myhostname[  . ]/p" > hosts
8759                 }
8760                 tmp_re="[       . ]"
8761                 if $test -f hosts; then
8762                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8763                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8764                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8765                                 hosts | $sort | $uniq | \
8766                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8767                         case `$echo X$dflt` in
8768                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8769                                 dflt=.
8770                                 ;;
8771                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8772                                 ;;
8773                         esac
8774                 else
8775                         echo "(I cannot locate a hosts database anywhere)"
8776                         dflt=.
8777                 fi
8778                 case "$dflt" in
8779                 .)
8780                         tans=`./loc resolv.conf X /etc /usr/etc`
8781                         if $test -f "$tans"; then
8782                                 echo "(Attempting domain name extraction from $tans)"
8783                                 dflt=.`$sed -n -e 's/   / /g' \
8784                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8785                                   -e 1q 2>/dev/null`
8786                                 case "$dflt" in
8787                                 .) dflt=.`$sed -n -e 's/        / /g' \
8788                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8789                                      -e 1q 2>/dev/null`
8790                                         ;;
8791                                 esac
8792                         fi
8793                         ;;
8794                 esac
8795                 case "$dflt" in
8796                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8797                         dflt=.`sh -c domainname 2>/dev/null`
8798                         case "$dflt" in
8799                         '') dflt='.';;
8800                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8801                         esac
8802                         ;;
8803                 esac
8804                 case "$dflt$osname" in
8805                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8806                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8807                         ;;
8808                 esac
8809                 case "$dflt" in
8810                 .) echo "(Lost all hope -- silly guess then)"
8811                         dflt='.nonet'
8812                         ;;
8813                 esac
8814                 $rm -f hosts
8815                 ;;
8816         *) dflt="$mydomain";;
8817         esac;;
8818 esac
8819 echo " "
8820 rp="What is your domain name?"
8821 . ./myread
8822 tans="$ans"
8823 case "$ans" in
8824 '') ;;
8825 .*) ;;
8826 *) tans=".$tans";;
8827 esac
8828 mydomain="$tans"
8829
8830 : translate upper to lower if necessary
8831 case "$mydomain" in
8832 *[A-Z]*)
8833         echo "(Normalizing case in your domain name)"
8834         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8835         ;;
8836 esac
8837
8838 : a little sanity check here
8839 case "$phostname" in
8840 '') ;;
8841 *)
8842         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8843         $myhostname$mydomain|$myhostname) ;;
8844         *)
8845                 case "$phostname" in
8846                 sed*)
8847                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8848                         ;;
8849                 *)
8850                         echo "(That doesn't agree with your $phostname command, by the way.)"
8851                         ;;
8852                 esac
8853         ;;
8854         esac
8855         ;;
8856 esac
8857
8858 : determine the e-mail address of the user who is running us
8859 $cat <<EOM
8860
8861 I need to get your e-mail address in Internet format if possible, i.e.
8862 something like user@host.domain. Please answer accurately since I have
8863 no easy means to double check it. The default value provided below
8864 is most probably close to reality but may not be valid from outside
8865 your organization...
8866
8867 EOM
8868 cont=x
8869 while test "$cont"; do
8870         case "$MAILDOMAIN" in
8871         '') maildomain="$myhostname$mydomain";;
8872         *)  maildomain="$MAILDOMAIN";;
8873         esac
8874         case "$cf_email" in
8875         '') dflt="$cf_by@$maildomain";;
8876         *)  dflt="$cf_email";;
8877         esac
8878         rp='What is your e-mail address?'
8879         . ./myread
8880         cf_email="$ans"
8881         case "$cf_email" in
8882         *@*.*) cont='' ;;
8883         *)
8884                 rp='Address does not look like an Internet one.  Use it anyway?'
8885                 case "$fastread" in
8886                 yes) dflt=y ;;
8887                 *) dflt=n ;;
8888                 esac
8889                 . ./myread
8890                 case "$ans" in
8891                 y*) cont='' ;;
8892                 *) echo " " ;;
8893                 esac
8894                 ;;
8895         esac
8896 done
8897
8898 : Ask e-mail of administrator
8899 $cat <<EOM
8900
8901 If you or somebody else will be maintaining perl at your site, please
8902 fill in the correct e-mail address here so that they may be contacted
8903 if necessary. Currently, the "perlbug" program included with perl
8904 will send mail to this address in addition to perlbug@perl.org. You may
8905 enter "none" for no administrator.
8906
8907 EOM
8908 case "$perladmin" in
8909 '') dflt="$cf_email";;
8910 *) dflt="$perladmin";;
8911 esac
8912 rp='Perl administrator e-mail address'
8913 . ./myread
8914 perladmin="$ans"
8915
8916 : determine whether to only install version-specific parts.
8917 echo " "
8918 $cat <<EOM
8919 Do you want to install only the version-specific parts of the perl
8920 distribution?  Usually you do *not* want to do this.
8921 EOM
8922 case "$versiononly" in
8923 "$define"|[Yy]*|true) dflt='y' ;;
8924 *) dflt='n';
8925 esac
8926 rp="Do you want to install only the version-specific parts of perl?"
8927 . ./myread
8928 case "$ans" in
8929 [yY]*)  val="$define";;
8930 *)      val="$undef" ;;
8931 esac
8932 set versiononly
8933 eval $setvar
8934
8935 case "$versiononly" in
8936 "$define") inc_version_list=''
8937            inc_version_list_init=0
8938            ;;
8939 esac
8940
8941 : figure out how to guarantee perl startup
8942 : XXX Note that this currently takes advantage of the bug that binexp ignores
8943 :     the Configure -Dinstallprefix setting, which in turn means that under
8944 :     relocatable @INC, initialinstalllocation is what binexp started as.
8945 case "$startperl" in
8946 '')
8947         case "$sharpbang" in
8948         *!)
8949                 $cat <<EOH
8950
8951 I can use the #! construct to start perl on your system. This will
8952 make startup of perl scripts faster, but may cause problems if you
8953 want to share those scripts and perl is not in a standard place
8954 ($initialinstalllocation/perl) on all your platforms. The alternative
8955 is to force a shell by starting the script with a single ':' character.
8956
8957 EOH
8958                 case "$versiononly" in
8959                 "$define")      dflt="$initialinstalllocation/perl$version";;
8960                 *)              dflt="$initialinstalllocation/perl";;
8961                 esac
8962                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8963                 . ./myread
8964                 case "$ans" in
8965                 none)   startperl=": # use perl";;
8966                 *)      startperl="#!$ans"
8967                         if $test 30 -lt `echo "$ans" | wc -c`; then
8968                                 $cat >&4 <<EOM
8969
8970 WARNING:  Some systems limit the #! command to 32 characters.
8971 If you experience difficulty running Perl scripts with #!, try
8972 installing Perl in a directory with a shorter pathname.
8973
8974 EOM
8975                         fi ;;
8976                 esac
8977                 ;;
8978         *) startperl=": # use perl"
8979                 ;;
8980         esac
8981         ;;
8982 esac
8983 echo "I'll use $startperl to start perl scripts."
8984
8985 : figure best path for perl in scripts
8986 case "$perlpath" in
8987 '')
8988         case "$versiononly" in
8989         "$define")      perlpath="$initialinstalllocation/perl$version";;
8990         *)              perlpath="$initialinstalllocation/perl";;
8991         esac
8992         case "$startperl" in
8993         *!*) ;;
8994         *)
8995                 $cat <<EOH
8996
8997 I will use the "eval 'exec'" idiom to start Perl on your system.
8998 I can use the full path of your Perl binary for this purpose, but
8999 doing so may cause problems if you want to share those scripts and
9000 Perl is not always in a standard place ($initialinstalllocation/perl).
9001
9002 EOH
9003                 dflt="$initialinstalllocation/perl"
9004                 rp="What path shall I use in \"eval 'exec'\"?"
9005                 . ./myread
9006                 perlpath="$ans"
9007                 ;;
9008         esac
9009         ;;
9010 esac
9011 case "$startperl" in
9012 *!*)    ;;
9013 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9014 esac
9015
9016 : determine where public executable scripts go
9017 set scriptdir scriptdir
9018 eval $prefixit
9019 case "$scriptdir" in
9020 '')
9021         dflt="$bin"
9022         : guess some guesses
9023         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9024         $test -d /usr/share/bin     && dflt=/usr/share/bin
9025         $test -d /usr/local/script  && dflt=/usr/local/script
9026         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9027         $test -d $prefixexp/script  && dflt=$prefixexp/script
9028         set dflt
9029         eval $prefixup
9030         ;;
9031 *)  dflt="$scriptdir"
9032         ;;
9033 esac
9034 $cat <<EOM
9035
9036 Some installations have a separate directory just for executable scripts so
9037 that they can mount it across multiple architectures but keep the scripts in
9038 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9039 Or you might just lump your scripts in with all your other executables.
9040
9041 EOM
9042 fn=d~
9043 rp='Where do you keep publicly executable scripts?'
9044 . ./getfile
9045 if $test "X$ansexp" != "X$scriptdirexp"; then
9046         installscript=''
9047 fi
9048 installscriptdir=''
9049 prefixvar=scriptdir
9050 . ./setprefixvar
9051 : A little fix up for an irregularly named variable.
9052 installscript="$installscriptdir"
9053
9054 : determine where add-on public executables go
9055 case "$sitebin" in
9056 '')     dflt=$siteprefix/bin ;;
9057 *)      dflt=$sitebin ;;
9058 esac
9059 fn=d~
9060 rp='Pathname where the add-on public executables should be installed?'
9061 . ./getfile
9062 prefixvar=sitebin
9063 . ./setprefixvar
9064
9065 : determine where add-on html pages go
9066 : There is no standard location, so try to copy the previously-selected
9067 : directory structure for the core html pages.
9068 case "$sitehtml1dir" in
9069 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9070 *)     dflt=$sitehtml1dir ;;
9071 esac
9072 case "$dflt" in
9073 ''|' ') dflt=none ;;
9074 esac
9075 fn=dn+~
9076 rp='Pathname where the site-specific html pages should be installed?'
9077 . ./getfile
9078 prefixvar=sitehtml1dir
9079 . ./setprefixvar
9080
9081 : determine where add-on library html pages go
9082 : There is no standard location, so try to copy the previously-selected
9083 : directory structure for the core html pages.
9084 case "$sitehtml3dir" in
9085 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9086 *)     dflt=$sitehtml3dir ;;
9087 esac
9088 case "$dflt" in
9089 ''|' ') dflt=none ;;
9090 esac
9091 fn=dn+~
9092 rp='Pathname where the site-specific library html pages should be installed?'
9093 . ./getfile
9094 prefixvar=sitehtml3dir
9095 . ./setprefixvar
9096
9097 : determine where add-on manual pages go
9098 case "$siteman1dir" in
9099 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9100 *)      dflt=$siteman1dir ;;
9101 esac
9102 case "$dflt" in
9103 ''|' ') dflt=none ;;
9104 esac
9105 fn=dn+~
9106 rp='Pathname where the site-specific manual pages should be installed?'
9107 . ./getfile
9108 prefixvar=siteman1dir
9109 . ./setprefixvar
9110
9111 : determine where add-on library man pages go
9112 case "$siteman3dir" in
9113 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9114 *)      dflt=$siteman3dir ;;
9115 esac
9116 case "$dflt" in
9117 ''|' ') dflt=none ;;
9118 esac
9119 fn=dn+~
9120 rp='Pathname where the site-specific library manual pages should be installed?'
9121 . ./getfile
9122 prefixvar=siteman3dir
9123 . ./setprefixvar
9124
9125 : determine where add-on public executable scripts go
9126 case "$sitescript" in
9127 '')     dflt=$siteprefix/script
9128         $test -d $dflt || dflt=$sitebin ;;
9129 *)  dflt="$sitescript" ;;
9130 esac
9131 fn=d~+
9132 rp='Pathname where add-on public executable scripts should be installed?'
9133 . ./getfile
9134 prefixvar=sitescript
9135 . ./setprefixvar
9136
9137 : Check if faststdio is requested and available
9138 case "$usefaststdio" in
9139 $define|true|[yY]*|'')
9140         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9141         case "$xversion" in
9142         [68])   dflt='y' ;;
9143         *)      dflt='n' ;;
9144         esac
9145         ;;
9146 *) dflt='n';;
9147 esac
9148 cat <<EOM
9149
9150 Perl can be built to use 'fast stdio', which means using the stdio
9151 library but also directly manipulating the stdio buffers to enable
9152 faster I/O.  Using stdio is better for backward compatibility (especially
9153 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9154 interface has been preferred instead of stdio.
9155
9156 If this doesn't make any sense to you, just accept the default '$dflt'.
9157 EOM
9158 rp='Use the "fast stdio" if available?'
9159 . ./myread
9160 case "$ans" in
9161 y|Y)    val="$define" ;;
9162 *)      val="$undef" ;;
9163 esac
9164 set usefaststdio
9165 eval $setvar
9166
9167
9168 : define an is-a-typedef? function
9169 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9170 case "$inclist" in
9171 "") inclist="sys/types.h";;
9172 esac;
9173 eval "varval=\$$var";
9174 case "$varval" in
9175 "")
9176         $rm -f temp.c;
9177         for inc in $inclist; do
9178                 echo "#include <$inc>" >>temp.c;
9179         done;
9180         echo "#ifdef $type" >> temp.c;
9181         echo "printf(\"We have $type\");" >> temp.c;
9182         echo "#endif" >> temp.c;
9183         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9184         if $contains $type temp.E >/dev/null 2>&1; then
9185                 eval "$var=\$type";
9186         else
9187                 eval "$var=\$def";
9188         fi;
9189         $rm -f temp.?;;
9190 *) eval "$var=\$varval";;
9191 esac'
9192
9193 : define an is-a-typedef? function that prompts if the type is not available.
9194 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9195 case "$inclist" in
9196 "") inclist="sys/types.h";;
9197 esac;
9198 eval "varval=\$$var";
9199 case "$varval" in
9200 "")
9201         $rm -f temp.c;
9202         for inc in $inclist; do
9203                 echo "#include <$inc>" >>temp.c;
9204         done;
9205         echo "#ifdef $type" >> temp.c;
9206         echo "printf(\"We have $type\");" >> temp.c;
9207         echo "#endif" >> temp.c;
9208         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9209         echo " " ;
9210         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9211         if $contains $type temp.E >/dev/null 2>&1; then
9212                 echo "$type found." >&4;
9213                 eval "$var=\$type";
9214         else
9215                 echo "$type NOT found." >&4;
9216                 dflt="$def";
9217                 . ./myread ;
9218                 eval "$var=\$ans";
9219         fi;
9220         $rm -f temp.?;;
9221 *) eval "$var=\$varval";;
9222 esac'
9223
9224 : see what type lseek is declared as in the kernel
9225 rp="What is the type used for lseek's offset on this system?"
9226 set off_t lseektype long stdio.h sys/types.h
9227 eval $typedef_ask
9228
9229 echo " "
9230 echo "Checking to see how big your file offsets are..." >&4
9231 $cat >try.c <<EOCP
9232 #include <sys/types.h>
9233 #include <stdio.h>
9234 int main()
9235 {
9236     printf("%d\n", (int)sizeof($lseektype));
9237     return(0);
9238 }
9239 EOCP
9240 set try
9241 if eval $compile_ok; then
9242         lseeksize=`$run ./try`
9243         echo "Your file offsets are $lseeksize bytes long."
9244 else
9245         dflt=$longsize
9246         echo " "
9247         echo "(I can't seem to compile the test program.  Guessing...)"
9248         rp="What is the size of your file offsets (in bytes)?"
9249         . ./myread
9250         lseeksize="$ans"
9251 fi
9252 $rm_try
9253
9254 : see what type file positions are declared as in the library
9255 rp="What is the type for file position used by fsetpos()?"
9256 set fpos_t fpostype long stdio.h sys/types.h
9257 eval $typedef_ask
9258
9259 : Check size for Fpos_t
9260 echo " "
9261 case "$fpostype" in
9262 *_t) zzz="$fpostype"    ;;
9263 *)   zzz="fpos_t"       ;;
9264 esac
9265 echo "Checking the size of $zzz..." >&4
9266 cat > try.c <<EOCP
9267 #include <sys/types.h>
9268 #include <stdio.h>
9269 #$i_stdlib I_STDLIB
9270 #ifdef I_STDLIB
9271 #include <stdlib.h>
9272 #endif
9273 int main() {
9274     printf("%d\n", (int)sizeof($fpostype));
9275     exit(0);
9276 }
9277 EOCP
9278 set try
9279 if eval $compile_ok; then
9280         yyy=`$run ./try`
9281         case "$yyy" in
9282         '')     fpossize=4
9283                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9284                 ;;
9285         *)      fpossize=$yyy
9286                 echo "Your $zzz is $fpossize bytes long."
9287                 ;;
9288         esac
9289 else
9290         dflt="$longsize"
9291         echo " " >&4
9292         echo "(I can't compile the test program.  Guessing...)" >&4
9293         rp="What is the size of your file positions (in bytes)?"
9294         . ./myread
9295         fpossize="$ans"
9296 fi
9297
9298 : Check for large file support
9299 # Backward compatibility (uselfs is deprecated).
9300 case "$uselfs" in
9301 "$define"|true|[yY]*)
9302         cat <<EOM >&4
9303
9304 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9305 EOM
9306         uselargefiles="$define"
9307         ;;
9308 esac
9309
9310 case "$lseeksize:$fpossize" in
9311 8:8) cat <<EOM
9312
9313 You can have files larger than 2 gigabytes.
9314 EOM
9315    val="$define" ;;
9316 *)    case "$uselargefiles" in
9317    "$undef"|false|[nN]*) dflt='n' ;;
9318    *)   dflt='y' ;;
9319    esac
9320    cat <<EOM
9321
9322 Perl can be built to understand large files (files larger than 2 gigabytes)
9323 on some systems.  To do so, Configure can be run with -Duselargefiles.
9324
9325 If this doesn't make any sense to you, just accept the default '$dflt'.
9326 EOM
9327    rp='Try to understand large files, if available?'
9328    . ./myread
9329    case "$ans" in
9330    y|Y)         val="$define" ;;
9331    *)           val="$undef"  ;;
9332    esac
9333    ;;
9334 esac
9335 set uselargefiles
9336 eval $setvar
9337 : Look for a hint-file generated 'call-back-unit'.  If the
9338 : user has specified that a large files perl is to be built,
9339 : we may need to set or change some other defaults.
9340 if $test -f uselargefiles.cbu; then
9341         echo "Your platform has some specific hints regarding large file builds, using them..."
9342         . ./uselargefiles.cbu
9343 fi
9344 case "$uselargefiles" in
9345 "$define")
9346         if $test -f uselargefiles.cbu; then
9347                 echo " "
9348                 echo "Rechecking to see how big your file offsets are..." >&4
9349                 $cat >try.c <<EOCP
9350 #include <sys/types.h>
9351 #include <stdio.h>
9352 int main()
9353 {
9354     printf("%d\n", (int)sizeof($lseektype));
9355     return(0);
9356 }
9357 EOCP
9358                 set try
9359                 if eval $compile_ok; then
9360                         lseeksize=`$run ./try`
9361                         $echo "Your file offsets are now $lseeksize bytes long."
9362                 else
9363                         dflt="$lseeksize"
9364                         echo " "
9365                         echo "(I can't seem to compile the test program.  Guessing...)"
9366                         rp="What is the size of your file offsets (in bytes)?"
9367                         . ./myread
9368                         lseeksize="$ans"
9369                 fi
9370                 case "$fpostype" in
9371                 *_t) zzz="$fpostype"    ;;
9372                 *)   zzz="fpos_t"       ;;
9373                 esac
9374                 $echo $n "Rechecking the size of $zzz...$c" >&4
9375                 $cat > try.c <<EOCP
9376 #include <sys/types.h>
9377 #include <stdio.h>
9378 #$i_stdlib I_STDLIB
9379 #ifdef I_STDLIB
9380 #include <stdlib.h>
9381 #endif
9382 int main() {
9383     printf("%d\n", (int)sizeof($fpostype));
9384     return(0);
9385 }
9386 EOCP
9387                 set try
9388                 if eval $compile_ok; then
9389                         yyy=`$run ./try`
9390                         dflt="$lseeksize"
9391                         case "$yyy" in
9392                         '')     echo " "
9393                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9394                                 ;;
9395                         *)      fpossize=$yyy
9396                                 echo " $fpossize bytes." >&4
9397                                 ;;
9398                         esac
9399                 else
9400                         dflt="$fpossize"
9401                         echo " "
9402                         echo "(I can't compile the test program.  Guessing...)" >&4
9403                         rp="What is the size of your file positions (in bytes)?"
9404                         . ./myread
9405                         fpossize="$ans"
9406                 fi
9407                 $rm_try
9408         fi
9409         ;;
9410 esac
9411
9412 : Check if we want perlio
9413 useperlio="$define"
9414
9415 : Set the vendorbin variables
9416 case "$vendorprefix" in
9417 '')     d_vendorbin="$undef"
9418         vendorbin=''
9419         vendorbinexp=''
9420         ;;
9421 *)      d_vendorbin="$define"
9422         : determine where vendor-supplied executables go.
9423         case "$vendorbin" in
9424         '') dflt=$vendorprefix/bin ;;
9425         *)      dflt="$vendorbin" ;;
9426         esac
9427         fn=d~+
9428         rp='Pathname for the vendor-supplied executables directory?'
9429         . ./getfile
9430         vendorbin="$ans"
9431         vendorbinexp="$ansexp"
9432         ;;
9433 esac
9434 prefixvar=vendorbin
9435 . ./installprefix
9436
9437 : Set the vendorhtml1dir variables
9438 case "$vendorprefix" in
9439 '')     vendorhtml1dir=''
9440         vendorhtml1direxp=''
9441         ;;
9442 *)      : determine where vendor-supplied html pages go.
9443         : There is no standard location, so try to copy the previously-selected
9444         : directory structure for the core html pages.
9445         : XXX Better default suggestions would be welcome.
9446         case "$vendorhtml1dir" in
9447         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9448         *)      dflt=$vendorhtml1dir ;;
9449         esac
9450         case "$dflt" in
9451         ''|' ') dflt=none ;;
9452         esac
9453         fn=dn+~
9454         rp='Pathname for the vendor-supplied html pages?'
9455         . ./getfile
9456         vendorhtml1dir="$ans"
9457         vendorhtml1direxp="$ansexp"
9458         ;;
9459 esac
9460 : Use ' ' for none so value is preserved next time through Configure
9461 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9462 prefixvar=vendorhtml1dir
9463 . ./installprefix
9464
9465 : Set the vendorhtml3dir variables
9466 case "$vendorprefix" in
9467 '')     vendorhtml3dir=''
9468         vendorhtml3direxp=''
9469         ;;
9470 *)      : determine where vendor-supplied module html pages go.
9471         : There is no standard location, so try to copy the previously-selected
9472         : directory structure for the core html pages.
9473         : XXX Better default suggestions would be welcome.
9474         case "$vendorhtml3dir" in
9475         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9476         *)      dflt=$vendorhtml3dir ;;
9477         esac
9478         case "$dflt" in
9479         ''|' ') dflt=none ;;
9480         esac
9481         fn=dn+~
9482         rp='Pathname for the vendor-supplied html pages?'
9483         . ./getfile
9484         vendorhtml3dir="$ans"
9485         vendorhtml3direxp="$ansexp"
9486         ;;
9487 esac
9488 : Use ' ' for none so value is preserved next time through Configure
9489 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9490 prefixvar=vendorhtml3dir
9491 . ./installprefix
9492
9493 : Set the vendorman1dir variables
9494 case "$vendorprefix" in
9495 '')     vendorman1dir=''
9496         vendorman1direxp=''
9497         ;;
9498 *)      : determine where vendor-supplied manual pages go.
9499         case "$vendorman1dir" in
9500         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9501         *)      dflt=$vendorman1dir ;;
9502         esac
9503         case "$dflt" in
9504         ''|' ') dflt=none ;;
9505         esac
9506         fn=nd~+
9507         rp='Pathname for the vendor-supplied manual section 1 pages?'
9508         . ./getfile
9509         vendorman1dir="$ans"
9510         vendorman1direxp="$ansexp"
9511         ;;
9512 esac
9513 : Use ' ' for none so value is preserved next time through Configure
9514 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9515 prefixvar=vendorman1dir
9516 . ./installprefix
9517
9518 : Set the vendorman3dir variables
9519 case "$vendorprefix" in
9520 '')     vendorman3dir=''
9521         vendorman3direxp=''
9522         ;;
9523 *)      : determine where vendor-supplied module manual pages go.
9524         case "$vendorman3dir" in
9525         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9526         *)      dflt=$vendorman3dir ;;
9527         esac
9528         case "$dflt" in
9529         ''|' ') dflt=none ;;
9530         esac
9531         fn=nd~+
9532         rp='Pathname for the vendor-supplied manual section 3 pages?'
9533         . ./getfile
9534         vendorman3dir="$ans"
9535         vendorman3direxp="$ansexp"
9536         ;;
9537 esac
9538 : Use ' ' for none so value is preserved next time through Configure
9539 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9540 prefixvar=vendorman3dir
9541 . ./installprefix
9542
9543 : Set the vendorscript variables
9544 case "$vendorprefix" in
9545 '')     d_vendorscript="$undef"
9546         vendorscript=''
9547         vendorscriptexp=''
9548         ;;
9549 *)      d_vendorscript="$define"
9550         : determine where vendor-supplied scripts go.
9551         case "$vendorscript" in
9552         '')     dflt=$vendorprefix/script
9553                 $test -d $dflt || dflt=$vendorbin ;;
9554         *)  dflt="$vendorscript" ;;
9555         esac
9556         $cat <<EOM
9557
9558 The installation process will create a directory for
9559 vendor-supplied scripts.
9560
9561 EOM
9562         fn=d~+
9563         rp='Pathname for the vendor-supplied scripts directory?'
9564         . ./getfile
9565         vendorscript="$ans"
9566         vendorscriptexp="$ansexp"
9567         ;;
9568 esac
9569 prefixvar=vendorscript
9570 . ./installprefix
9571
9572 : script used to emit important warnings
9573 cat >warn <<EOS
9574 $startsh
9575 if test \$# -gt 0; then
9576         echo "\$@" >msg
9577 else
9578         cat >msg
9579 fi
9580 echo "*** WARNING:" >&4
9581 sed -e 's/^/*** /' <msg >&4
9582 echo "*** " >&4
9583 cat msg >>config.msg
9584 echo " " >>config.msg
9585 rm -f msg
9586 EOS
9587 chmod +x warn
9588 $eunicefix warn
9589
9590 : see which of string.h or strings.h is needed
9591 echo " "
9592 strings=`./findhdr string.h`
9593 if $test "$strings" && $test -r "$strings"; then
9594         echo "Using <string.h> instead of <strings.h>." >&4
9595         val="$define"
9596 else
9597         val="$undef"
9598         strings=`./findhdr strings.h`
9599         if $test "$strings" && $test -r "$strings"; then
9600                 echo "Using <strings.h> instead of <string.h>." >&4
9601         else
9602                 ./warn "No string header found -- You'll surely have problems."
9603         fi
9604 fi
9605 set i_string
9606 eval $setvar
9607 case "$i_string" in
9608 "$undef") strings=`./findhdr strings.h`;;
9609 *)        strings=`./findhdr string.h`;;
9610 esac
9611
9612 : see if qgcvt exists
9613 set qgcvt d_qgcvt
9614 eval $inlibc
9615
9616 : Check print/scan long double stuff
9617 echo " "
9618
9619 if $test X"$d_longdbl" = X"$define"; then
9620
9621 echo "Checking how to print long doubles..." >&4
9622
9623 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9624         $cat >try.c <<'EOCP'
9625 #include <sys/types.h>
9626 #include <stdio.h>
9627 int main() {
9628   double d = 123.456;
9629   printf("%.3f\n", d);
9630 }
9631 EOCP
9632         set try
9633         if eval $compile; then
9634                 yyy=`$run ./try`
9635                 case "$yyy" in
9636                 123.456)
9637                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9638                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9639                         echo "We will use %f."
9640                         ;;
9641                 esac
9642         fi
9643 fi
9644
9645 if $test X"$sPRIfldbl" = X; then
9646         $cat >try.c <<'EOCP'
9647 #include <sys/types.h>
9648 #include <stdio.h>
9649 int main() {
9650   long double d = 123.456;
9651   printf("%.3Lf\n", d);
9652 }
9653 EOCP
9654         set try
9655         if eval $compile; then
9656                 yyy=`$run ./try`
9657                 case "$yyy" in
9658                 123.456)
9659                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9660                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9661                         echo "We will use %Lf."
9662                         ;;
9663                 esac
9664         fi
9665 fi
9666
9667 if $test X"$sPRIfldbl" = X; then
9668         $cat >try.c <<'EOCP'
9669 #include <sys/types.h>
9670 #include <stdio.h>
9671 int main() {
9672   long double d = 123.456;
9673   printf("%.3llf\n", d);
9674 }
9675 EOCP
9676         set try
9677         if eval $compile; then
9678                 yyy=`$run ./try`
9679                 case "$yyy" in
9680                 123.456)
9681                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9682                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9683                         echo "We will use %llf."
9684                         ;;
9685                 esac
9686         fi
9687 fi
9688
9689 if $test X"$sPRIfldbl" = X; then
9690         $cat >try.c <<'EOCP'
9691 #include <sys/types.h>
9692 #include <stdio.h>
9693 int main() {
9694   long double d = 123.456;
9695   printf("%.3lf\n", d);
9696 }
9697 EOCP
9698         set try
9699         if eval $compile; then
9700                 yyy=`$run ./try`
9701                 case "$yyy" in
9702                 123.456)
9703                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9704                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9705                         echo "We will use %lf."
9706                         ;;
9707                 esac
9708         fi
9709 fi
9710
9711 if $test X"$sPRIfldbl" = X; then
9712         echo "Cannot figure out how to print long doubles." >&4
9713 else
9714         sSCNfldbl=$sPRIfldbl    # expect consistency
9715 fi
9716
9717 $rm_try
9718
9719 fi # d_longdbl
9720
9721 case "$sPRIfldbl" in
9722 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9723         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9724         d_SCNfldbl="$undef";
9725         ;;
9726 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9727         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9728         d_SCNfldbl="$define";
9729         ;;
9730 esac
9731
9732 : Check how to convert floats to strings.
9733
9734 if test "X$d_Gconvert" = X; then
9735
9736 echo " "
9737 echo "Checking for an efficient way to convert floats to strings."
9738 echo " " > try.c
9739 case "$uselongdouble" in
9740 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9741 esac
9742 case "$d_longdbl" in
9743 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9744 esac
9745 case "$d_PRIgldbl" in
9746 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9747 esac
9748 $cat >>try.c <<EOP
9749 #ifdef TRY_gconvert
9750 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9751 char *myname = "gconvert";
9752 #endif
9753 #ifdef TRY_gcvt
9754 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9755 char *myname = "gcvt";
9756 #endif
9757 #ifdef TRY_qgcvt
9758 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9759 char *myname = "qgcvt";
9760 #define DOUBLETYPE long double
9761 #endif
9762 #ifdef TRY_sprintf
9763 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9764 #ifdef HAS_PRIgldbl
9765 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9766 #else
9767 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9768 #endif
9769 #else
9770 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9771 #endif
9772 char *myname = "sprintf";
9773 #endif
9774
9775 #ifndef DOUBLETYPE
9776 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9777 #define DOUBLETYPE long double
9778 #else
9779 #define DOUBLETYPE double
9780 #endif
9781 #endif
9782
9783 #include <stdio.h>
9784
9785 #$i_stdlib I_STDLIB
9786 #ifdef I_STDLIB
9787 #include <stdlib.h>
9788 #endif
9789 #$i_string I_STRING
9790 #ifdef I_STRING
9791 #  include <string.h>
9792 #else
9793 #  include <strings.h>
9794 #endif
9795
9796 int checkit(char *expect, char *got)
9797 {
9798     if (strcmp(expect, got)) {
9799                 printf("%s oddity:  Expected %s, got %s\n",
9800                         myname, expect, got);
9801                 exit(1);
9802         }
9803 }
9804
9805 int main()
9806 {
9807         char buf[64];
9808         buf[63] = '\0';
9809
9810         /* This must be 1st test on (which?) platform */
9811         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9812         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9813         checkit("0.1", buf);
9814
9815         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9816         checkit("0.01", buf);
9817
9818         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9819         checkit("0.001", buf);
9820
9821         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9822         checkit("0.0001", buf);
9823
9824         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9825         if (strlen(buf) > 5)
9826             checkit("9e-005", buf); /* for Microsoft ?? */
9827         else
9828             checkit("9e-05", buf);
9829
9830         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9831         checkit("1", buf);
9832
9833         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9834         checkit("1.1", buf);
9835
9836         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9837         checkit("1.01", buf);
9838
9839         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9840         checkit("1.001", buf);
9841
9842         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9843         checkit("1.0001", buf);
9844
9845         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9846         checkit("1.00001", buf);
9847
9848         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9849         checkit("1.000001", buf);
9850
9851         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9852         checkit("0", buf);
9853
9854         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9855         checkit("-1", buf);
9856
9857         /* Some Linux gcvt's give 1.e+5 here. */
9858         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9859         checkit("100000", buf);
9860
9861         /* Some Linux gcvt's give -1.e+5 here. */
9862         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9863         checkit("-100000", buf);
9864
9865         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9866         checkit("123.456", buf);
9867
9868         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9869         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9870         /* 34 should be enough to scare even long double
9871          * places into using the e notation. */
9872         if (strlen(buf) > 5)
9873             checkit("1e+034", buf); /* for Microsoft */
9874         else
9875             checkit("1e+34", buf);
9876
9877         /* For Perl, if you add additional tests here, also add them to
9878          * t/base/num.t for benefit of platforms not using Configure or
9879          * overriding d_Gconvert */
9880
9881         exit(0);
9882 }
9883 EOP
9884 : first add preferred functions to our list
9885 xxx_list=""
9886 for xxx_convert in $gconvert_preference; do
9887     case $xxx_convert in
9888     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9889     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9890     esac
9891 done
9892 : then add any others
9893 for xxx_convert in gconvert gcvt sprintf; do
9894     case "$xxx_list" in
9895     *$xxx_convert*) ;;
9896     *) xxx_list="$xxx_list $xxx_convert" ;;
9897     esac
9898 done
9899
9900 case "$d_longdbl$uselongdouble" in
9901 "$define$define")
9902     : again, add preferred functions to our list first
9903     xxx_ld_list=""
9904     for xxx_convert in $gconvert_ld_preference; do
9905         case $xxx_convert in
9906         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9907         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9908         esac
9909     done
9910     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9911     for xxx_convert in qgcvt sprintf $xxx_list; do
9912         case "$xxx_ld_list" in
9913         $xxx_convert*|*" $xxx_convert"*) ;;
9914         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9915         esac
9916     done
9917     : if sprintf cannot do long doubles, move it to the end
9918     if test "$d_PRIgldbl" != "$define"; then
9919         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9920     fi
9921     : if no qgcvt, remove it
9922     if test "$d_qgcvt" != "$define"; then
9923         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9924     fi
9925     : use the ld_list
9926     xxx_list="$xxx_ld_list"
9927     ;;
9928 esac
9929
9930 for xxx_convert in $xxx_list; do
9931         echo "Trying $xxx_convert..."
9932         $rm -f try try$_o core
9933         set try -DTRY_$xxx_convert
9934         if eval $compile; then
9935                 echo "$xxx_convert() found." >&4
9936                 if $run ./try; then
9937                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9938                         break;
9939                 else
9940                         echo "...But $xxx_convert didn't work as I expected."
9941                         xxx_convert=''
9942                 fi
9943         else
9944                 echo "$xxx_convert NOT found." >&4
9945         fi
9946 done
9947
9948 if test X$xxx_convert = X; then
9949     echo "*** WHOA THERE!!! ***" >&4
9950     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9951     xxx_convert=sprintf
9952 fi
9953
9954 case "$xxx_convert" in
9955 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9956 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9957 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9958 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9959    "$define$define$define")
9960       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9961    "$define$define$undef")
9962       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9963    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9964    esac
9965    ;;
9966 esac
9967
9968 fi
9969 $rm_try
9970
9971 : see if _fwalk exists
9972 set fwalk d__fwalk
9973 eval $inlibc
9974
9975 : Initialize h_fcntl
9976 h_fcntl=false
9977
9978 : Initialize h_sysfile
9979 h_sysfile=false
9980
9981 : access call always available on UNIX
9982 set access d_access
9983 eval $inlibc
9984
9985 : locate the flags for 'access()'
9986 case "$d_access" in
9987 "$define")
9988         echo " "
9989         $cat >access.c <<EOCP
9990 #include <sys/types.h>
9991 #ifdef I_FCNTL
9992 #include <fcntl.h>
9993 #endif
9994 #ifdef I_SYS_FILE
9995 #include <sys/file.h>
9996 #endif
9997 #ifdef I_UNISTD
9998 #include <unistd.h>
9999 #endif
10000 #$i_stdlib I_STDLIB
10001 #ifdef I_STDLIB
10002 #include <stdlib.h>
10003 #endif
10004 int main() {
10005         exit(R_OK);
10006 }
10007 EOCP
10008         : check sys/file.h first, no particular reason here
10009         if $test `./findhdr sys/file.h` && \
10010                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10011                 h_sysfile=true;
10012                 echo "<sys/file.h> defines the *_OK access constants." >&4
10013         elif $test `./findhdr fcntl.h` && \
10014                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10015                 h_fcntl=true;
10016                 echo "<fcntl.h> defines the *_OK access constants." >&4
10017         elif $test `./findhdr unistd.h` && \
10018                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10019                 echo "<unistd.h> defines the *_OK access constants." >&4
10020         else
10021                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10022         fi
10023         ;;
10024 esac
10025 $rm -f access*
10026
10027 : see if accessx exists
10028 set accessx d_accessx
10029 eval $inlibc
10030
10031 : see if aintl exists
10032 set aintl d_aintl
10033 eval $inlibc
10034
10035 : see if alarm exists
10036 set alarm d_alarm
10037 eval $inlibc
10038
10039 : see if 64bit time functions exists
10040
10041 set ctime64 d_ctime64
10042 eval $inlibc
10043
10044 set localtime64 d_localtime64
10045 eval $inlibc
10046
10047 set gmtime64 d_gmtime64
10048 eval $inlibc
10049
10050 set mktime64 d_mktime64
10051 eval $inlibc
10052
10053 set difftime64 d_difftime64
10054 eval $inlibc
10055
10056 set asctime64 d_asctime64
10057 eval $inlibc
10058
10059 : see if POSIX threads are available
10060 set pthread.h i_pthread
10061 eval $inhdr
10062
10063 : define a function to check prototypes
10064 $cat > protochk <<EOSH
10065 $startsh
10066 cc="$cc"
10067 optimize="$optimize"
10068 ccflags="$ccflags"
10069 prototype="$prototype"
10070 define="$define"
10071 rm_try="$rm_try"
10072 usethreads=$usethreads
10073 i_pthread=$i_pthread
10074 pthread_h_first=$pthread_h_first
10075 EOSH
10076
10077 $cat >> protochk <<'EOSH'
10078
10079 $rm_try
10080 foo="$1"
10081 shift
10082 while test $# -ge 2; do
10083         case "$1" in
10084                 $define) echo "#include <$2>" >> try.c ;;
10085                 literal) echo "$2" >> try.c ;;
10086         esac
10087     # Extra magic for the benefit of systems that need pthread.h
10088     # to be included early to correctly detect threadsafe functions.
10089     # Such functions must guarantee themselves, though, that the usethreads
10090     # and i_pthread have been defined, before calling protochk.
10091     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10092         echo "#include <pthread.h>" >> try.c
10093         pthread_h_done=yes
10094     fi
10095     shift 2
10096 done
10097 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10098 cat >> try.c <<'EOCP'
10099 #ifdef CAN_PROTOTYPE
10100 #define _(args) args
10101 #else
10102 #define _(args) ()
10103 #endif
10104 EOCP
10105 echo "$foo" >> try.c
10106 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10107 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10108 status=$?
10109 $rm_try
10110 exit $status
10111 EOSH
10112 chmod +x protochk
10113 $eunicefix protochk
10114
10115 : Define hasproto macro for Configure internal use
10116 hasproto='varname=$1; func=$2; shift; shift;
10117 while $test $# -ge 2; do
10118         case "$1" in
10119         $define) echo "#include <$2>";;
10120         esac ;
10121     shift 2;
10122 done > try.c;
10123 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10124 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10125         echo "$func() prototype found.";
10126         val="$define";
10127 else
10128         echo "$func() prototype NOT found.";
10129         val="$undef";
10130 fi;
10131 set $varname;
10132 eval $setvar;
10133 $rm_try tryout.c'
10134
10135 : see if sys/types.h has to be included
10136 set sys/types.h i_systypes
10137 eval $inhdr
10138
10139 : see if sys/select.h has to be included
10140 set sys/select.h i_sysselct
10141 eval $inhdr
10142
10143 : Define hasfield macro for Configure internal use
10144 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10145 while $test $# -ge 2; do
10146         case "$1" in
10147         $define) echo "#include <$2>";;
10148         esac ;
10149     shift 2;
10150 done > try.c;
10151 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10152 set try;
10153 if eval $compile; then
10154         val="$define";
10155 else
10156         val="$undef";
10157 fi;
10158 set $varname;
10159 eval $setvar;
10160 $rm_try'
10161
10162 : see if we should include time.h, sys/time.h, or both
10163 echo " "
10164 if test "X$timeincl" = X; then
10165         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10166         $echo $n "I'm now running the test program...$c"
10167         $cat >try.c <<EOCP
10168 #include <sys/types.h>
10169 #ifdef I_TIME
10170 #include <time.h>
10171 #endif
10172 #ifdef I_SYSTIME
10173 #ifdef SYSTIMEKERNEL
10174 #define KERNEL
10175 #endif
10176 #include <sys/time.h>
10177 #endif
10178 #ifdef I_SYSSELECT
10179 #include <sys/select.h>
10180 #endif
10181 #$i_stdlib I_STDLIB
10182 #ifdef I_STDLIB
10183 #include <stdlib.h>
10184 #endif
10185 int main()
10186 {
10187         struct tm foo;
10188 #ifdef S_TIMEVAL
10189         struct timeval bar;
10190 #endif
10191 #ifdef S_TIMEZONE
10192         struct timezone tzp;
10193 #endif
10194         if (foo.tm_sec == foo.tm_sec)
10195                 exit(0);
10196 #ifdef S_TIMEVAL
10197         if (bar.tv_sec == bar.tv_sec)
10198                 exit(0);
10199 #endif
10200         exit(1);
10201 }
10202 EOCP
10203         flags=''
10204         for s_timezone in '-DS_TIMEZONE' ''; do
10205         sysselect=''
10206         for s_timeval in '-DS_TIMEVAL' ''; do
10207         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10208         for i_time in '' '-DI_TIME'; do
10209         for i_systime in '-DI_SYSTIME' ''; do
10210                 case "$flags" in
10211                 '') $echo $n ".$c"
10212                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10213                         if eval $compile; then
10214                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10215                                 shift
10216                                 flags="$*"
10217                                 echo " "
10218                                 $echo $n "Succeeded with $flags$c"
10219                         fi
10220                         ;;
10221                 esac
10222         done
10223         done
10224         done
10225         done
10226         done
10227         timeincl=''
10228         echo " "
10229         case "$flags" in
10230         *SYSTIMEKERNEL*) i_systimek="$define"
10231                 timeincl=`./findhdr sys/time.h`
10232                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10233         *) i_systimek="$undef";;
10234         esac
10235         case "$flags" in
10236         *I_TIME*) i_time="$define"
10237                 timeincl=`./findhdr time.h`" $timeincl"
10238                 echo "We'll include <time.h>." >&4;;
10239         *) i_time="$undef";;
10240         esac
10241         case "$flags" in
10242         *I_SYSTIME*) i_systime="$define"
10243                 timeincl=`./findhdr sys/time.h`" $timeincl"
10244                 echo "We'll include <sys/time.h>." >&4;;
10245         *) i_systime="$undef";;
10246         esac
10247         $rm_try
10248 fi
10249 : see if struct tm knows about tm_zone
10250 case "$i_systime$i_time" in
10251 *$define*)
10252         echo " "
10253         echo "Checking to see if your struct tm has tm_zone field..." >&4
10254         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10255         eval $hasfield
10256         ;;
10257 *)      val="$undef"
10258         set d_tm_tm_zone
10259         eval $setvar
10260         ;;
10261 esac
10262 case "$d_tm_tm_zone" in
10263 "$define")      echo "Yes, it does."   ;;
10264 *)              echo "No, it doesn't." ;;
10265 esac
10266 : see if struct tm knows about tm_gmtoff
10267 case "$i_systime$i_time" in
10268 *$define*)
10269         echo " "
10270         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10271         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10272         eval $hasfield
10273         ;;
10274 *)      val="$undef"
10275         set d_tm_tm_gmtoff
10276         eval $setvar
10277         ;;
10278 esac
10279 case "$d_tm_tm_gmtoff" in
10280 "$define")      echo "Yes, it does."   ;;
10281 *)              echo "No, it doesn't." ;;
10282 esac
10283
10284 : see if asctime_r exists
10285 set asctime_r d_asctime_r
10286 eval $inlibc
10287 case "$d_asctime_r" in
10288 "$define")
10289         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10290         case "$d_asctime_r_proto:$usethreads" in
10291         ":define")      d_asctime_r_proto=define
10292                 set d_asctime_r_proto asctime_r $hdrs
10293                 eval $hasproto ;;
10294         *)      ;;
10295         esac
10296         case "$d_asctime_r_proto" in
10297         define)
10298         case "$asctime_r_proto" in
10299         ''|0) try='char* asctime_r(const struct tm*, char*);'
10300         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10301         esac
10302         case "$asctime_r_proto" in
10303         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10304         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10305         esac
10306         case "$asctime_r_proto" in
10307         ''|0) try='int asctime_r(const struct tm*, char*);'
10308         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10309         esac
10310         case "$asctime_r_proto" in
10311         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10312         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10313         esac
10314         case "$asctime_r_proto" in
10315         ''|0)   d_asctime_r=undef
10316                 asctime_r_proto=0
10317                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10318         * )     case "$asctime_r_proto" in
10319                 REENTRANT_PROTO*) ;;
10320                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10321                 esac
10322                 echo "Prototype: $try" ;;
10323         esac
10324         ;;
10325         *)      case "$usethreads" in
10326                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10327                 esac
10328                 d_asctime_r=undef
10329                 asctime_r_proto=0
10330                 ;;
10331         esac
10332         ;;
10333 *)      asctime_r_proto=0
10334         ;;
10335 esac
10336
10337 : see if atolf exists
10338 set atolf d_atolf
10339 eval $inlibc
10340
10341 : see if atoll exists
10342 set atoll d_atoll
10343 eval $inlibc
10344
10345 : Look for GCC-style attribute format
10346 case "$d_attribute_format" in
10347 '')
10348 echo " "
10349 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10350 $cat >attrib.c <<'EOCP'
10351 #include <stdio.h>
10352 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10353 EOCP
10354 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10355         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10356                 echo "Your C compiler doesn't support __attribute__((format))."
10357                 val="$undef"
10358         else
10359                 echo "Your C compiler supports __attribute__((format))."
10360                 val="$define"
10361         fi
10362 else
10363         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10364         val="$undef"
10365 fi
10366 ;;
10367 *) val="$d_attribute_format" ;;
10368 esac
10369 set d_attribute_format
10370 eval $setvar
10371 $rm -f attrib*
10372
10373 : Look for GCC-style attribute format with null format allowed
10374 case "$d_printf_format_null" in
10375 '') case "$d_attribute_format" in
10376     $define)
10377         echo " "
10378         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10379 $cat >attrib.c <<EOCP
10380 #include <stdio.h>
10381 #$i_stdlib I_STDLIB
10382 #ifdef I_STDLIB
10383 #include <stdlib.h>
10384 #endif
10385 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10386 int null_printf (char* pat,...) { return (int)pat; }
10387 int main () { exit(null_printf(NULL)); }
10388 EOCP
10389         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10390             : run the executable in case it produces a run-time warning
10391             if $run ./attrib >>attrib.out 2>&1; then
10392                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10393                     echo "Your C compiler doesn't allow __printf__ format to be null."
10394                     val="$undef"
10395                 else
10396                     echo "Your C compiler allows __printf__ format to be null."
10397                     val="$define"
10398                 fi
10399             else
10400             echo "Your C compiler executable failed with __printf__ format null."
10401             val="$undef"
10402         fi
10403     else
10404         echo "Your C compiler fails with __printf__ format null."
10405         val="$undef"
10406     fi
10407     ;;
10408     *)  val="$undef" ;;
10409     esac
10410 ;;
10411 *)  val="$d_printf_format_null" ;;
10412 esac
10413 set d_printf_format_null
10414 eval $setvar
10415 $rm -f attrib*
10416
10417 : Look for GCC-style attribute malloc
10418 case "$d_attribute_malloc" in
10419 '')
10420 echo " "
10421 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10422 $cat >attrib.c <<'EOCP'
10423 #include <stdio.h>
10424 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10425 EOCP
10426 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10427         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10428                 echo "Your C compiler doesn't support __attribute__((malloc))."
10429                 val="$undef"
10430         else
10431                 echo "Your C compiler supports __attribute__((malloc))."
10432                 val="$define"
10433         fi
10434 else
10435         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10436         val="$undef"
10437 fi
10438 ;;
10439 *) val="$d_attribute_malloc" ;;
10440 esac
10441 set d_attribute_malloc
10442 eval $setvar
10443 $rm -f attrib*
10444
10445 : Look for GCC-style attribute nonnull
10446 case "$d_attribute_nonnull" in
10447 '')
10448 echo " "
10449 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10450 $cat >attrib.c <<'EOCP'
10451 #include <stdio.h>
10452 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10453 EOCP
10454 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10455         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10456                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10457                 val="$undef"
10458         else
10459                 echo "Your C compiler supports __attribute__((nonnull))."
10460                 val="$define"
10461         fi
10462 else
10463         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10464         val="$undef"
10465 fi
10466 ;;
10467 *) val="$d_attribute_nonnull" ;;
10468 esac
10469 set d_attribute_nonnull
10470 eval $setvar
10471 $rm -f attrib*
10472
10473 : Look for GCC-style attribute noreturn
10474 case "$d_attribute_noreturn" in
10475 '')
10476 echo " "
10477 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10478 $cat >attrib.c <<'EOCP'
10479 #include <stdio.h>
10480 void fall_over_dead( void ) __attribute__((noreturn));
10481 EOCP
10482 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10483         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10484                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10485                 val="$undef"
10486         else
10487                 echo "Your C compiler supports __attribute__((noreturn))."
10488                 val="$define"
10489         fi
10490 else
10491         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10492         val="$undef"
10493 fi
10494 ;;
10495 *) val="$d_attribute_noreturn" ;;
10496 esac
10497 set d_attribute_noreturn
10498 eval $setvar
10499 $rm -f attrib*
10500
10501 : Look for GCC-style attribute pure
10502 case "$d_attribute_pure" in
10503 '')
10504 echo " "
10505 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10506 $cat >attrib.c <<'EOCP'
10507 #include <stdio.h>
10508 int square( int n ) __attribute__((pure));
10509 EOCP
10510 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10511         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10512                 echo "Your C compiler doesn't support __attribute__((pure))."
10513                 val="$undef"
10514         else
10515                 echo "Your C compiler supports __attribute__((pure))."
10516                 val="$define"
10517         fi
10518 else
10519         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10520         val="$undef"
10521 fi
10522 ;;
10523 *) val="$d_attribute_pure" ;;
10524 esac
10525 set d_attribute_pure
10526 eval $setvar
10527 $rm -f attrib*
10528
10529 : Look for GCC-style attribute unused
10530 case "$d_attribute_unused" in
10531 '')
10532 echo " "
10533 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10534 $cat >attrib.c <<'EOCP'
10535 #include <stdio.h>
10536 int do_something( int dummy __attribute__((unused)), int n );
10537 EOCP
10538 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10539         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10540                 echo "Your C compiler doesn't support __attribute__((unused))."
10541                 val="$undef"
10542         else
10543                 echo "Your C compiler supports __attribute__((unused))."
10544                 val="$define"
10545         fi
10546 else
10547         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10548         val="$undef"
10549 fi
10550 ;;
10551 *) val="$d_attribute_unused" ;;
10552 esac
10553 set d_attribute_unused
10554 eval $setvar
10555 $rm -f attrib*
10556
10557 : Look for GCC-style attribute deprecated
10558 case "$d_attribute_deprecated" in
10559 '')
10560 echo " "
10561 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10562 $cat >attrib.c <<'EOCP'
10563 #include <stdio.h>
10564 int I_am_deprecated(void) __attribute__((deprecated));
10565 EOCP
10566 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10567         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10568                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10569                 val="$undef"
10570         else
10571                 echo "Your C compiler supports __attribute__((deprecated))."
10572                 val="$define"
10573         fi
10574 else
10575         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10576         val="$undef"
10577 fi
10578 ;;
10579 *) val="$d_attribute_deprecated" ;;
10580 esac
10581 set d_attribute_deprecated
10582 eval $setvar
10583 $rm -f attrib*
10584
10585 : Look for GCC-style attribute warn_unused_result
10586 case "$d_attribute_warn_unused_result" in
10587 '')
10588 echo " "
10589 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10590 $cat >attrib.c <<'EOCP'
10591 #include <stdio.h>
10592 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10593 EOCP
10594 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10595         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10596                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10597                 val="$undef"
10598         else
10599                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10600                 val="$define"
10601         fi
10602 else
10603         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10604         val="$undef"
10605 fi
10606 ;;
10607 *) val="$d_attribute_warn_unused_result" ;;
10608 esac
10609 set d_attribute_warn_unused_result
10610 eval $setvar
10611 $rm -f attrib*
10612
10613 : see if bcmp exists
10614 set bcmp d_bcmp
10615 eval $inlibc
10616
10617 : see if bcopy exists
10618 set bcopy d_bcopy
10619 eval $inlibc
10620
10621 : see if getpgrp exists
10622 set getpgrp d_getpgrp
10623 eval $inlibc
10624
10625 case "$d_getpgrp" in
10626 "$define")
10627         echo " "
10628         echo "Checking to see which flavor of getpgrp is in use..."
10629         $cat >try.c <<EOP
10630 #$i_unistd I_UNISTD
10631 #include <sys/types.h>
10632 #ifdef I_UNISTD
10633 #  include <unistd.h>
10634 #endif
10635 #$i_stdlib I_STDLIB
10636 #ifdef I_STDLIB
10637 #include <stdlib.h>
10638 #endif
10639 int main()
10640 {
10641         if (getuid() == 0) {
10642                 printf("(I see you are running Configure as super-user...)\n");
10643                 setuid(1);
10644         }
10645 #ifdef TRY_BSD_PGRP
10646         if (getpgrp(1) == 0)
10647                 exit(0);
10648 #else
10649         if (getpgrp() > 0)
10650                 exit(0);
10651 #endif
10652         exit(1);
10653 }
10654 EOP
10655         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10656                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10657                 val="$define"
10658         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10659                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10660                 val="$undef"
10661         else
10662                 echo "I can't seem to compile and run the test program."
10663                 if ./usg; then
10664                         xxx="a USG one, i.e. you use getpgrp()."
10665                 else
10666                         # SVR4 systems can appear rather BSD-ish.
10667                         case "$i_unistd" in
10668                         $undef)
10669                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10670                                 val="$define"
10671                                 ;;
10672                         $define)
10673                                 xxx="probably a USG one, i.e. you use getpgrp()."
10674                                 val="$undef"
10675                                 ;;
10676                         esac
10677                 fi
10678                 echo "Assuming your getpgrp is $xxx" >&4
10679         fi
10680         ;;
10681 *) val="$undef";;
10682 esac
10683 set d_bsdgetpgrp
10684 eval $setvar
10685 $rm_try
10686
10687 : see if setpgrp exists
10688 set setpgrp d_setpgrp
10689 eval $inlibc
10690
10691 case "$d_setpgrp" in
10692 "$define")
10693         echo " "
10694         echo "Checking to see which flavor of setpgrp is in use..."
10695         $cat >try.c <<EOP
10696 #$i_unistd I_UNISTD
10697 #include <sys/types.h>
10698 #ifdef I_UNISTD
10699 #  include <unistd.h>
10700 #endif
10701 #$i_stdlib I_STDLIB
10702 #ifdef I_STDLIB
10703 #include <stdlib.h>
10704 #endif
10705 int main()
10706 {
10707         if (getuid() == 0) {
10708                 printf("(I see you are running Configure as super-user...)\n");
10709                 setuid(1);
10710         }
10711 #ifdef TRY_BSD_PGRP
10712         if (-1 == setpgrp(1, 1))
10713                 exit(0);
10714 #else
10715         if (setpgrp() != -1)
10716                 exit(0);
10717 #endif
10718         exit(1);
10719 }
10720 EOP
10721         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10722                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10723                 val="$define"
10724         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10725                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10726                 val="$undef"
10727         else
10728                 echo "(I can't seem to compile and run the test program.)"
10729                 if ./usg; then
10730                         xxx="a USG one, i.e. you use setpgrp()."
10731                 else
10732                         # SVR4 systems can appear rather BSD-ish.
10733                         case "$i_unistd" in
10734                         $undef)
10735                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10736                                 val="$define"
10737                                 ;;
10738                         $define)
10739                                 xxx="probably a USG one, i.e. you use setpgrp()."
10740                                 val="$undef"
10741                                 ;;
10742                         esac
10743                 fi
10744                 echo "Assuming your setpgrp is $xxx" >&4
10745         fi
10746         ;;
10747 *) val="$undef";;
10748 esac
10749 set d_bsdsetpgrp
10750 eval $setvar
10751 $rm_try
10752
10753 : Look for GCC-style __builtin_choose_expr
10754 case "$d_builtin_choose_expr" in
10755 '')
10756     echo " "
10757     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10758     $cat >try.c <<'EOCP'
10759 #include <assert.h>
10760 #include <stdlib.h>
10761 #include <stdio.h>
10762
10763 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10764
10765 int main(void) {
10766     assert( SYRINX(1) == 2112 );
10767     assert( SYRINX(1) != 5150 );
10768     assert( SYRINX(0) == 5150 );
10769     assert( SYRINX(0) != 2112 );
10770     puts( "All good!" );
10771     exit(0);
10772 }
10773
10774 EOCP
10775     set try
10776     if eval $compile && $run ./try; then
10777         echo "Your C compiler supports __builtin_choose_expr."
10778         val="$define"
10779     else
10780         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10781         val="$undef"
10782     fi
10783 ;;
10784 *) val="$d_builtin_choose_expr" ;;
10785 esac
10786
10787 set d_builtin_choose_expr
10788 eval $setvar
10789 $rm_try
10790
10791 : Look for GCC-style __builtin_expect
10792 case "$d_builtin_expect" in
10793 '')
10794     echo " "
10795     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10796     $cat >try.c <<'EOCP'
10797 int main(void) {
10798     int n = 50;
10799     if ( __builtin_expect(n, 0) ) n = 1;
10800     /* Remember shell exit code truth is 0, C truth is non-zero */
10801     return !(n == 1);
10802 }
10803 EOCP
10804     set try
10805     if eval $compile && $run ./try; then
10806         echo "Your C compiler supports __builtin_expect."
10807         val="$define"
10808     else
10809         echo "Your C compiler doesn't seem to understand __builtin_expect."
10810         val="$undef"
10811     fi
10812     ;;
10813 *) val="$d_builtin_expect" ;;
10814 esac
10815
10816 set d_builtin_expect
10817 eval $setvar
10818 $rm_try
10819
10820 : see if bzero exists
10821 set bzero d_bzero
10822 eval $inlibc
10823
10824 : see if stdarg is available
10825 echo " "
10826 if $test `./findhdr stdarg.h`; then
10827         echo "<stdarg.h> found." >&4
10828         valstd="$define"
10829 else
10830         echo "<stdarg.h> NOT found." >&4
10831         valstd="$undef"
10832 fi
10833
10834 : see if varags is available
10835 echo " "
10836 if $test `./findhdr varargs.h`; then
10837         echo "<varargs.h> found." >&4
10838 else
10839         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10840 fi
10841
10842 : set up the varargs testing programs
10843 $cat > varargs.c <<EOP
10844 #ifdef I_STDARG
10845 #include <stdarg.h>
10846 #endif
10847 #ifdef I_VARARGS
10848 #include <varargs.h>
10849 #endif
10850
10851 #ifdef I_STDARG
10852 int f(char *p, ...)
10853 #else
10854 int f(va_alist)
10855 va_dcl
10856 #endif
10857 {
10858         va_list ap;
10859 #ifndef I_STDARG
10860         char *p;
10861 #endif
10862 #ifdef I_STDARG
10863         va_start(ap,p);
10864 #else
10865         va_start(ap);
10866         p = va_arg(ap, char *);
10867 #endif
10868         va_end(ap);
10869         return 0;
10870 }
10871 EOP
10872 $cat > varargs <<EOP
10873 $startsh
10874 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10875         echo "true"
10876 else
10877         echo "false"
10878 fi
10879 $rm -f varargs$_o
10880 EOP
10881 chmod +x varargs
10882
10883 : now check which varargs header should be included
10884 echo " "
10885 i_varhdr=''
10886 val=''
10887 case "$valstd" in
10888 "$define")
10889         if `./varargs I_STDARG`; then
10890                 val='stdarg.h'
10891         elif `./varargs I_VARARGS`; then
10892                 val='varargs.h'
10893         fi
10894         ;;
10895 *)
10896         if `./varargs I_VARARGS`; then
10897                 val='varargs.h'
10898         fi
10899         ;;
10900 esac
10901 case "$val" in
10902 '')
10903         echo " "
10904         echo "*** WHOA THERE!!! ***" >&4
10905         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
10906         case "$knowitall" in
10907         '')
10908         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
10909                 exit 1
10910                 ;;
10911         esac
10912 echo "I could not find the definition for va_dcl... You have problems..." >&4
10913         val="$undef"; set i_stdarg; eval $setvar
10914         val="$undef"; set i_varargs; eval $setvar
10915         ;;
10916 *)
10917         set i_varhdr
10918         eval $setvar
10919         case "$i_varhdr" in
10920         stdarg.h)
10921                 val="$define"; set i_stdarg; eval $setvar
10922                 val="$undef"; set i_varargs; eval $setvar
10923                 ;;
10924         varargs.h)
10925                 val="$undef"; set i_stdarg; eval $setvar
10926                 val="$define"; set i_varargs; eval $setvar
10927                 ;;
10928         esac
10929         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10930 esac
10931 $rm -f varargs*
10932
10933 : see if the Compiler supports C99 variadic macros
10934 case "$i_stdarg$i_stdlib" in
10935     "$define$define")
10936     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10937     $cat >try.c <<EOCP
10938 #include <stdio.h>
10939 #include <stdarg.h>
10940
10941 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10942
10943 int main() {
10944   char buf[20];
10945   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10946   puts(buf);
10947   return 0;
10948 }
10949 EOCP
10950     set try
10951     if eval $compile && $run ./try 2>&1 >/dev/null; then
10952         case "`$run ./try`" in
10953             "123 456 789")
10954             echo "You have C99 variadic macros." >&4
10955             d_c99_variadic_macros="$define"
10956             ;;
10957             *)
10958             echo "You don't have functional C99 variadic macros." >&4
10959             d_c99_variadic_macros="$undef"
10960             ;;
10961         esac
10962     else
10963         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10964         d_c99_variadic_macros="$undef"
10965     fi
10966     $rm_try
10967     ;;
10968     *)
10969     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10970     d_c99_variadic_macros="$undef"
10971     ;;
10972 esac
10973
10974 : see if signal is declared as pointer to function returning int or void
10975 echo " "
10976 xxx=`./findhdr signal.h`
10977 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10978 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10979         echo "You have int (*signal())() instead of void." >&4
10980         val="$undef"
10981 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10982         echo "You have void (*signal())()." >&4
10983         val="$define"
10984 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10985         echo "You have int (*signal())() instead of void." >&4
10986         val="$undef"
10987 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10988         echo "You have void (*signal())()." >&4
10989         val="$define"
10990 else
10991         case "$d_voidsig" in
10992         '')
10993         echo "I can't determine whether signal handler returns void or int..." >&4
10994                 dflt=void
10995                 rp="What type does your signal handler return?"
10996                 . ./myread
10997                 case "$ans" in
10998                 v*) val="$define";;
10999                 *) val="$undef";;
11000                 esac;;
11001         "$define")
11002                 echo "As you already told me, signal handler returns void." >&4
11003                 val="$define"
11004                 ;;
11005         *)      echo "As you already told me, signal handler returns int." >&4
11006                 val="$undef"
11007                 ;;
11008         esac
11009 fi
11010 set d_voidsig
11011 eval $setvar
11012 case "$d_voidsig" in
11013 "$define") signal_t="void";;
11014 *) signal_t="int";;
11015 esac
11016 $rm -f $$.tmp
11017
11018 : check for ability to cast large floats to 32-bit ints.
11019 echo " "
11020 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11021 if $test "$intsize" -ge 4; then
11022         xxx=int
11023 else
11024         xxx=long
11025 fi
11026 $cat >try.c <<EOCP
11027 #include <stdio.h>
11028 #$i_stdlib I_STDLIB
11029 #ifdef I_STDLIB
11030 #include <stdlib.h>
11031 #endif
11032 #include <sys/types.h>
11033 #include <signal.h>
11034 $signal_t blech(int s) { exit(3); }
11035 int main()
11036 {
11037         $xxx i32;
11038         double f, g;
11039         int result = 0;
11040         char str[16];
11041         signal(SIGFPE, blech);
11042
11043         /* Don't let compiler optimize the test away.  Store the number
11044            in a writable string for gcc to pass to sscanf under HP-UX.
11045         */
11046         sprintf(str, "2147483647");
11047         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11048         g = 10 * f;
11049         i32  = ($xxx) g;
11050
11051         /* x86 processors will probably give 0x8000 0000, which is a
11052            sign change.  We don't want that.  We want to mimic SPARC
11053            behavior here, which is to preserve the sign and give
11054            back 0x7fff ffff.
11055         */
11056         if (i32 != ($xxx) f)
11057                 result |= 1;
11058         exit(result);
11059 }
11060 EOCP
11061 set try
11062 if eval $compile_ok; then
11063         $run ./try
11064         yyy=$?
11065 else
11066         echo "(I can't seem to compile the test program--assuming it can't)"
11067         yyy=1
11068 fi
11069 case "$yyy" in
11070 0)      val="$define"
11071         echo "Yup, it can."
11072         ;;
11073 *)      val="$undef"
11074         echo "Nope, it can't."
11075         ;;
11076 esac
11077 set d_casti32
11078 eval $setvar
11079 $rm_try
11080
11081 : check for ability to cast negative floats to unsigned
11082 echo " "
11083 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11084 $cat >try.c <<EOCP
11085 #include <stdio.h>
11086 #$i_stdlib I_STDLIB
11087 #ifdef I_STDLIB
11088 #include <stdlib.h>
11089 #endif
11090 #include <sys/types.h>
11091 #include <signal.h>
11092 $signal_t blech(int s) { exit(7); }
11093 $signal_t blech_in_list(int s) { exit(4); }
11094 unsigned long dummy_long(unsigned long p) { return p; }
11095 unsigned int dummy_int(unsigned int p) { return p; }
11096 unsigned short dummy_short(unsigned short p) { return p; }
11097 int main()
11098 {
11099         double f;
11100         unsigned long along;
11101         unsigned int aint;
11102         unsigned short ashort;
11103         int result = 0;
11104         char str[16];
11105
11106         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11107            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11108            optimized the whole file away
11109         */
11110         /* Store the number in a writable string for gcc to pass to
11111            sscanf under HP-UX.
11112         */
11113         sprintf(str, "-123");
11114         sscanf(str, "%lf", &f);  /* f = -123.; */
11115
11116         signal(SIGFPE, blech);
11117         along = (unsigned long)f;
11118         aint = (unsigned int)f;
11119         ashort = (unsigned short)f;
11120         if (along != (unsigned long)-123)
11121                 result |= 1;
11122         if (aint != (unsigned int)-123)
11123                 result |= 1;
11124         if (ashort != (unsigned short)-123)
11125                 result |= 1;
11126         sprintf(str, "1073741824.");
11127         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11128         f = f + f;
11129         along = 0;
11130         along = (unsigned long)f;
11131         if (along != 0x80000000)
11132                 result |= 2;
11133         f -= 1.;
11134         along = 0;
11135         along = (unsigned long)f;
11136         if (along != 0x7fffffff)
11137                 result |= 1;
11138         f += 2.;
11139         along = 0;
11140         along = (unsigned long)f;
11141         if (along != 0x80000001)
11142                 result |= 2;
11143         if (result)
11144                 exit(result);
11145         signal(SIGFPE, blech_in_list);
11146         sprintf(str, "123.");
11147         sscanf(str, "%lf", &f);  /* f = 123.; */
11148         along = dummy_long((unsigned long)f);
11149         aint = dummy_int((unsigned int)f);
11150         ashort = dummy_short((unsigned short)f);
11151         if (along != (unsigned long)123)
11152                 result |= 4;
11153         if (aint != (unsigned int)123)
11154                 result |= 4;
11155         if (ashort != (unsigned short)123)
11156                 result |= 4;
11157         exit(result);
11158
11159 }
11160 EOCP
11161 set try
11162 if eval $compile_ok; then
11163         $run ./try
11164         castflags=$?
11165 else
11166         echo "(I can't seem to compile the test program--assuming it can't)"
11167         castflags=7
11168 fi
11169 case "$castflags" in
11170 0)      val="$define"
11171         echo "Yup, it can."
11172         ;;
11173 *)      val="$undef"
11174         echo "Nope, it can't."
11175         ;;
11176 esac
11177 set d_castneg
11178 eval $setvar
11179 $rm_try
11180
11181 : see if vprintf exists
11182 echo " "
11183 if set vprintf val -f d_vprintf; eval $csym; $val; then
11184         echo 'vprintf() found.' >&4
11185         val="$define"
11186         $cat >try.c <<EOF
11187 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11188 #$i_varargs I_VARARGS
11189
11190 #$i_stdlib I_STDLIB
11191 #$i_unistd I_UNISTD
11192
11193 #ifdef I_STDARG
11194 #  include <stdarg.h>
11195 #else /* I_VARARGS */
11196 #  include <varargs.h>
11197 #endif
11198
11199 #ifdef I_UNISTD
11200 #  include <unistd.h>
11201 #endif
11202
11203 #ifdef I_STDLIB
11204 #  include <stdlib.h>
11205 #endif
11206
11207 #include <stdio.h> /* vsprintf prototype */
11208
11209 #ifdef I_STDARG
11210 void xxx(int n, ...)
11211 {
11212     va_list args;
11213     char buf[10];
11214     va_start(args, n);
11215     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11216 }
11217 int main() { xxx(1, "foo"); }
11218
11219 #else /* I_VARARGS */
11220
11221 xxx(va_alist)
11222 va_dcl
11223 {
11224     va_list args;
11225     char buf[10];
11226     va_start(args);
11227     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11228 }
11229 int main() { xxx("foo"); }
11230
11231 #endif
11232
11233 EOF
11234         set try
11235         if eval $compile_ok; then
11236                 if $run ./try; then
11237                         echo "Your vsprintf() returns (int)." >&4
11238                         val2="$undef"
11239                 else
11240                         echo "Your vsprintf() returns (char*)." >&4
11241                         val2="$define"
11242                 fi
11243         else
11244                 echo 'I am unable to compile the vsprintf() test program.' >&4
11245                 # We shouldn't get here.  If we do, assume the standard signature,
11246                 # not the old BSD one.
11247                 echo 'Guessing that vsprintf() returns (int).' >&4
11248                 val2="$undef"
11249         fi
11250 else
11251         echo 'vprintf() NOT found.' >&4
11252         val="$undef"
11253         val2="$undef"
11254 fi
11255 $rm_try
11256 set d_vprintf
11257 eval $setvar
11258 val=$val2
11259 set d_charvspr
11260 eval $setvar
11261
11262 : see if chown exists
11263 set chown d_chown
11264 eval $inlibc
11265
11266 : see if chroot exists
11267 set chroot d_chroot
11268 eval $inlibc
11269
11270 : see if chsize exists
11271 set chsize d_chsize
11272 eval $inlibc
11273
11274 : see if class exists
11275 set class d_class
11276 eval $inlibc
11277
11278 : see if clearenv exists
11279 set clearenv d_clearenv
11280 eval $inlibc
11281
11282 : Define hasstruct macro for Configure internal use
11283 hasstruct='varname=$1; struct=$2; shift; shift;
11284 while $test $# -ge 2; do
11285         case "$1" in
11286         $define) echo "#include <$2>";;
11287         esac ;
11288     shift 2;
11289 done > try.c;
11290 echo "int main () { struct $struct foo; }" >> try.c;
11291 set try;
11292 if eval $compile; then
11293         val="$define";
11294 else
11295         val="$undef";
11296 fi;
11297 set $varname;
11298 eval $setvar;
11299 $rm_try'
11300
11301 : see whether socket exists
11302 socketlib=''
11303 sockethdr=''
11304 echo " "
11305 $echo $n "Hmm... $c" >&4
11306 if set socket val -f d_socket; eval $csym; $val; then
11307         echo "Looks like you have Berkeley networking support." >&4
11308         d_socket="$define"
11309         if set setsockopt val -f; eval $csym; $val; then
11310                 d_oldsock="$undef"
11311         else
11312                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11313                 d_oldsock="$define"
11314         fi
11315 else
11316         if $contains socklib libc.list >/dev/null 2>&1; then
11317                 echo "Looks like you have Berkeley networking support." >&4
11318                 d_socket="$define"
11319                 : we will have to assume that it supports the 4.2 BSD interface
11320                 d_oldsock="$undef"
11321         else
11322                 echo "You don't have Berkeley networking in libc$_a..." >&4
11323                 if test "X$d_socket" = "X$define"; then
11324                    echo "...but you seem to believe that you have sockets." >&4
11325                 else
11326                         for net in net socket
11327                         do
11328                                 if test -f /usr/lib/lib$net$_a; then
11329                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11330                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11331                                         if $contains socket libc.list >/dev/null 2>&1; then
11332                                                 d_socket="$define"
11333                                                 socketlib="-l$net"
11334                                                 case "$net" in
11335                                                 net)
11336                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11337                                                         sockethdr="-I/usr/netinclude"
11338                                                         ;;
11339                                                 esac
11340                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11341                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11342                                                         d_oldsock="$undef"
11343                                                 else
11344                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11345                                                         d_oldsock="$define"
11346                                                 fi
11347                                                 break
11348                                         fi
11349                                 fi
11350                         done
11351                         if test "X$d_socket" != "X$define"; then
11352                            echo "or anywhere else I see." >&4
11353                            d_socket="$undef"
11354                            d_oldsock="$undef"
11355                         fi
11356                 fi
11357         fi
11358 fi
11359
11360 : see if socketpair exists
11361 set socketpair d_sockpair
11362 eval $inlibc
11363
11364
11365 echo " "
11366 echo "Checking the availability sa_len in the sock struct ..." >&4
11367 $cat >try.c <<EOF
11368 #include <sys/types.h>
11369 #include <sys/socket.h>
11370 int main() {
11371 struct sockaddr sa;
11372 return (sa.sa_len);
11373 }
11374 EOF
11375 val="$undef"
11376 set try; if eval $compile; then
11377         val="$define"
11378 fi
11379 set d_sockaddr_sa_len; eval $setvar
11380 $rm_try
11381
11382 echo " "
11383 echo "Checking the availability struct sockaddr_in6 ..." >&4
11384 $cat >try.c <<EOF
11385 #include <sys/types.h>
11386 #include <sys/socket.h>
11387 #include <netinet/in.h>
11388 int main() {
11389 struct sockaddr_in6 sin6;
11390 return (sin6.sin6_family);
11391 }
11392 EOF
11393 val="$undef"
11394 set try; if eval $compile; then
11395         val="$define"
11396 fi
11397 set d_sockaddr_in6; eval $setvar
11398 $rm_try
11399
11400 echo " "
11401 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11402 $cat >try.c <<EOF
11403 #include <sys/types.h>
11404 #include <sys/socket.h>
11405 #include <netinet/in.h>
11406 int main() {
11407 struct sockaddr_in6 sin6;
11408 return (sin6.sin6_scope_id);
11409 }
11410 EOF
11411 val="$undef"
11412 set try; if eval $compile; then
11413         val="$define"
11414 fi
11415 set d_sin6_scope_id; eval $setvar
11416 $rm_try
11417
11418 echo " "
11419 echo "Checking the availability struct ip_mreq ..." >&4
11420 $cat >try.c <<EOF
11421 #include <sys/types.h>
11422 #include <sys/socket.h>
11423 #include <netinet/in.h>
11424 int main() {
11425 struct ip_mreq mreq;
11426 return (mreq.imr_multiaddr.s_addr);
11427 }
11428 EOF
11429 val="$undef"
11430 set try; if eval $compile; then
11431        val="$define"
11432 fi
11433 set d_ip_mreq; eval $setvar
11434 $rm_try
11435
11436 echo " "
11437 echo "Checking the availability struct ip_mreq_source ..." >&4
11438 $cat >try.c <<EOF
11439 #include <sys/types.h>
11440 #include <sys/socket.h>
11441 #include <netinet/in.h>
11442 int main() {
11443 struct ip_mreq_source mreq;
11444 return (mreq.imr_multiaddr.s_addr);
11445 }
11446 EOF
11447 val="$undef"
11448 set try; if eval $compile; then
11449        val="$define"
11450 fi
11451 set d_ip_mreq_source; eval $setvar
11452 $rm_try
11453
11454 echo " "
11455 echo "Checking the availability struct ipv6_mreq ..." >&4
11456 $cat >try.c <<EOF
11457 #include <sys/types.h>
11458 #include <sys/socket.h>
11459 #include <netinet/in.h>
11460 int main() {
11461 struct ipv6_mreq mreq;
11462 return (mreq.ipv6mr_interface);
11463 }
11464 EOF
11465 val="$undef"
11466 set try; if eval $compile; then
11467         val="$define"
11468 fi
11469 set d_ipv6_mreq; eval $setvar
11470 $rm_try
11471
11472 echo " "
11473 echo "Checking the availability struct ipv6_mreq_source ..." >&4
11474 $cat >try.c <<EOF
11475 #include <sys/types.h>
11476 #include <sys/socket.h>
11477 #include <netinet/in.h>
11478 int main() {
11479 struct ipv6_mreq_source mreq;
11480 return (mreq.imr_multiaddr.s_addr);
11481 }
11482 EOF
11483 val="$undef"
11484 set try; if eval $compile; then
11485        val="$define"
11486 fi
11487 set d_ipv6_mreq_source; eval $setvar
11488 $rm_try
11489
11490 echo " "
11491 echo "Checking the availability of certain socket constants..." >&4
11492 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11493         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11494         $cat >try.c <<EOF
11495 #include <sys/types.h>
11496 #include <sys/socket.h>
11497 int main() {
11498     int i = $ENUM;
11499 }
11500 EOF
11501         val="$undef"
11502         set try; if eval $compile; then
11503                 val="$define"
11504         fi
11505         set d_${enum}; eval $setvar
11506         $rm_try
11507 done
11508
11509 : see if this is a sys/uio.h system
11510 set sys/uio.h i_sysuio
11511 eval $inhdr
11512
11513 : Check for cmsghdr support
11514 echo " "
11515 echo "Checking to see if your system supports struct cmsghdr..." >&4
11516 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11517 eval $hasstruct
11518 case "$d_cmsghdr_s" in
11519 "$define")      echo "Yes, it does."   ;;
11520 *)              echo "No, it doesn't." ;;
11521 esac
11522
11523
11524 : check for const keyword
11525 echo " "
11526 echo 'Checking to see if your C compiler knows about "const"...' >&4
11527 $cat >const.c <<'EOCP'
11528 typedef struct spug { int drokk; } spug;
11529 int main()
11530 {
11531         const char *foo;
11532         const spug y = { 0 };
11533 }
11534 EOCP
11535 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11536         val="$define"
11537         echo "Yup, it does."
11538 else
11539         val="$undef"
11540         echo "Nope, it doesn't."
11541 fi
11542 set d_const
11543 eval $setvar
11544
11545 : see if copysignl exists
11546 set copysignl d_copysignl
11547 eval $inlibc
11548
11549 : see if crypt exists
11550 echo " "
11551 set crypt d_crypt
11552 eval $inlibc
11553 case "$d_crypt" in
11554 $define) cryptlib='' ;;
11555 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11556                 echo 'crypt() found.' >&4
11557                 val="$define"
11558                 cryptlib=''
11559         else
11560                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11561                 if $test -z "$cryptlib"; then
11562                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11563                 else
11564                         cryptlib=-lcrypt
11565                 fi
11566                 if $test -z "$cryptlib"; then
11567                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11568                 else
11569                         cryptlib=-lcrypt
11570                 fi
11571                 if $test -z "$cryptlib"; then
11572                         cryptlib=`./loc libcrypt$_a "" $libpth`
11573                 else
11574                         cryptlib=-lcrypt
11575                 fi
11576                 if $test -z "$cryptlib"; then
11577                         echo 'crypt() NOT found.' >&4
11578                         val="$undef"
11579                 else
11580                         val="$define"
11581                 fi
11582         fi
11583         set d_crypt
11584         eval $setvar
11585         ;;
11586 esac
11587
11588 : see if this is a crypt.h system
11589 set crypt.h i_crypt
11590 eval $inhdr
11591
11592 : see if crypt_r exists
11593 set crypt_r d_crypt_r
11594 eval $inlibc
11595 case "$d_crypt_r" in
11596 "$define")
11597         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11598         case "$d_crypt_r_proto:$usethreads" in
11599         ":define")      d_crypt_r_proto=define
11600                 set d_crypt_r_proto crypt_r $hdrs
11601                 eval $hasproto ;;
11602         *)      ;;
11603         esac
11604         case "$d_crypt_r_proto" in
11605         define)
11606         case "$crypt_r_proto" in
11607         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11608         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11609         esac
11610         case "$crypt_r_proto" in
11611         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11612         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11613         esac
11614         case "$crypt_r_proto" in
11615         ''|0)   d_crypt_r=undef
11616                 crypt_r_proto=0
11617                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11618         * )     case "$crypt_r_proto" in
11619                 REENTRANT_PROTO*) ;;
11620                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11621                 esac
11622                 echo "Prototype: $try" ;;
11623         esac
11624         ;;
11625         *)      case "$usethreads" in
11626                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11627                 esac
11628                 d_crypt_r=undef
11629                 crypt_r_proto=0
11630                 ;;
11631         esac
11632         ;;
11633 *)      crypt_r_proto=0
11634         ;;
11635 esac
11636
11637 : get csh whereabouts
11638 case "$csh" in
11639 'csh') val="$undef" ;;
11640 *) val="$define" ;;
11641 esac
11642 set d_csh
11643 eval $setvar
11644 : Respect a hint or command line value for full_csh.
11645 case "$full_csh" in
11646 '') full_csh=$csh ;;
11647 esac
11648
11649 : see if ctermid exists
11650 set ctermid d_ctermid
11651 eval $inlibc
11652
11653 : see if ctermid_r exists
11654 set ctermid_r d_ctermid_r
11655 eval $inlibc
11656 case "$d_ctermid_r" in
11657 "$define")
11658         hdrs="$i_systypes sys/types.h define stdio.h "
11659         case "$d_ctermid_r_proto:$usethreads" in
11660         ":define")      d_ctermid_r_proto=define
11661                 set d_ctermid_r_proto ctermid_r $hdrs
11662                 eval $hasproto ;;
11663         *)      ;;
11664         esac
11665         case "$d_ctermid_r_proto" in
11666         define)
11667         case "$ctermid_r_proto" in
11668         ''|0) try='char* ctermid_r(char*);'
11669         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11670         esac
11671         case "$ctermid_r_proto" in
11672         ''|0)   d_ctermid_r=undef
11673                 ctermid_r_proto=0
11674                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11675         * )     case "$ctermid_r_proto" in
11676                 REENTRANT_PROTO*) ;;
11677                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11678                 esac
11679                 echo "Prototype: $try" ;;
11680         esac
11681         ;;
11682         *)      case "$usethreads" in
11683                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11684                 esac
11685                 d_ctermid_r=undef
11686                 ctermid_r_proto=0
11687                 ;;
11688         esac
11689         ;;
11690 *)      ctermid_r_proto=0
11691         ;;
11692 esac
11693
11694 : see if ctime_r exists
11695 set ctime_r d_ctime_r
11696 eval $inlibc
11697 case "$d_ctime_r" in
11698 "$define")
11699         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11700         case "$d_ctime_r_proto:$usethreads" in
11701         ":define")      d_ctime_r_proto=define
11702                 set d_ctime_r_proto ctime_r $hdrs
11703                 eval $hasproto ;;
11704         *)      ;;
11705         esac
11706         case "$d_ctime_r_proto" in
11707         define)
11708         case "$ctime_r_proto" in
11709         ''|0) try='char* ctime_r(const time_t*, char*);'
11710         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11711         esac
11712         case "$ctime_r_proto" in
11713         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11714         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11715         esac
11716         case "$ctime_r_proto" in
11717         ''|0) try='int ctime_r(const time_t*, char*);'
11718         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11719         esac
11720         case "$ctime_r_proto" in
11721         ''|0) try='int ctime_r(const time_t*, char*, int);'
11722         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11723         esac
11724         case "$ctime_r_proto" in
11725         ''|0)   d_ctime_r=undef
11726                 ctime_r_proto=0
11727                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11728         * )     case "$ctime_r_proto" in
11729                 REENTRANT_PROTO*) ;;
11730                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11731                 esac
11732                 echo "Prototype: $try" ;;
11733         esac
11734         ;;
11735         *)      case "$usethreads" in
11736                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11737                 esac
11738                 d_ctime_r=undef
11739                 ctime_r_proto=0
11740                 ;;
11741         esac
11742         ;;
11743 *)      ctime_r_proto=0
11744         ;;
11745 esac
11746
11747 : see if cuserid exists
11748 set cuserid d_cuserid
11749 eval $inlibc
11750
11751 : see if this is a limits.h system
11752 set limits.h i_limits
11753 eval $inhdr
11754
11755 : see if this is a float.h system
11756 set float.h i_float
11757 eval $inhdr
11758
11759 : See if number of significant digits in a double precision number is known
11760 echo " "
11761 $cat >dbl_dig.c <<EOM
11762 #$i_limits I_LIMITS
11763 #$i_float I_FLOAT
11764 #ifdef I_LIMITS
11765 #include <limits.h>
11766 #endif
11767 #ifdef I_FLOAT
11768 #include <float.h>
11769 #endif
11770 #ifdef DBL_DIG
11771 printf("Contains DBL_DIG");
11772 #endif
11773 EOM
11774 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11775 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11776         echo "DBL_DIG found." >&4
11777         val="$define"
11778 else
11779         echo "DBL_DIG NOT found." >&4
11780         val="$undef"
11781 fi
11782 $rm -f dbl_dig.?
11783 set d_dbl_dig
11784 eval $setvar
11785
11786 : see if dbm.h is available
11787 : see if dbmclose exists
11788 set dbmclose d_dbmclose
11789 eval $inlibc
11790
11791 case "$d_dbmclose" in
11792 $define)
11793         set dbm.h i_dbm
11794         eval $inhdr
11795         case "$i_dbm" in
11796         $define)
11797                 val="$undef"
11798                 set i_rpcsvcdbm
11799                 eval $setvar
11800                 ;;
11801         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11802                 eval $inhdr
11803                 ;;
11804         esac
11805         ;;
11806 *)      echo "We won't be including <dbm.h>"
11807         val="$undef"
11808         set i_dbm
11809         eval $setvar
11810         val="$undef"
11811         set i_rpcsvcdbm
11812         eval $setvar
11813         ;;
11814 esac
11815
11816 : see if prototype for dbminit is available
11817 echo " "
11818 set d_dbminitproto dbminit $i_dbm dbm.h
11819 eval $hasproto
11820
11821 : see if difftime exists
11822 set difftime d_difftime
11823 eval $inlibc
11824
11825 : see if this is a dirent system
11826 echo " "
11827 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11828         val="$define"
11829         echo "<dirent.h> found." >&4
11830 else
11831         val="$undef"
11832         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11833                 echo "<sys/dir.h> found." >&4
11834                 echo " "
11835         else
11836                 xinc=`./findhdr sys/ndir.h`
11837         fi
11838         echo "<dirent.h> NOT found." >&4
11839 fi
11840 set i_dirent
11841 eval $setvar
11842
11843 : Look for type of directory structure.
11844 echo " "
11845 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11846
11847 case "$direntrytype" in
11848 ''|' ')
11849         case "$i_dirent" in
11850         $define) guess1='struct dirent' ;;
11851         *) guess1='struct direct'  ;;
11852         esac
11853         ;;
11854 *)      guess1="$direntrytype"
11855         ;;
11856 esac
11857
11858 case "$guess1" in
11859 'struct dirent') guess2='struct direct' ;;
11860 *) guess2='struct dirent' ;;
11861 esac
11862
11863 if $contains "$guess1" try.c >/dev/null 2>&1; then
11864         direntrytype="$guess1"
11865         echo "Your directory entries are $direntrytype." >&4
11866 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11867         direntrytype="$guess2"
11868         echo "Your directory entries seem to be $direntrytype." >&4
11869 else
11870         echo "I don't recognize your system's directory entries." >&4
11871         rp="What type is used for directory entries on this system?"
11872         dflt="$guess1"
11873         . ./myread
11874         direntrytype="$ans"
11875 fi
11876 $rm_try
11877
11878 : see if the directory entry stores field length
11879 echo " "
11880 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11881 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11882         echo "Good, your directory entry keeps length information in d_namlen." >&4
11883         val="$define"
11884 else
11885         echo "Your directory entry does not know about the d_namlen field." >&4
11886         val="$undef"
11887 fi
11888 set d_dirnamlen
11889 eval $setvar
11890 $rm_try
11891
11892 : Look for DIR.dd_fd
11893 case "$i_dirent" in
11894 "$define")
11895     echo "Checking to see if DIR has a dd_fd member variable" >&4
11896     $cat >try.c <<EOCP
11897 #$i_stdlib I_STDLIB
11898 #ifdef I_STDLIB
11899 #include <stdlib.h>
11900 #endif
11901 #include <dirent.h>
11902
11903 int main() {
11904     DIR dir;
11905     dir.dd_fd = 1;
11906     return 0;
11907 }
11908 EOCP
11909     val=$undef
11910     set try
11911     if eval $compile; then
11912         echo "Yes, it does."
11913         val="$define"
11914     else
11915         echo "No, it does not."
11916         val="$undef"
11917     fi
11918     ;;
11919 *)
11920     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11921     val="$undef"
11922     ;;
11923 esac
11924 set d_dir_dd_fd
11925 eval $setvar
11926 $rm_try
11927
11928 : see if this is an sysdir system
11929 set sys/dir.h i_sysdir
11930 eval $inhdr
11931
11932 : see if this is an sysndir system
11933 set sys/ndir.h i_sysndir
11934 eval $inhdr
11935
11936 : Look for dirfd
11937 echo " "
11938 $cat >dirfd.c <<EOM
11939 #include <stdio.h>
11940 #$i_stdlib I_STDLIB
11941 #ifdef I_STDLIB
11942 #include <stdlib.h>
11943 #endif
11944 #$i_dirent I_DIRENT             /**/
11945 #$i_sysdir I_SYS_DIR            /**/
11946 #$i_sysndir I_SYS_NDIR          /**/
11947 #$i_systypes I_SYS_TYPES        /**/
11948 #if defined(I_SYS_TYPES)
11949 #include <sys/types.h>
11950 #endif
11951 #if defined(I_DIRENT)
11952 #include <dirent.h>
11953 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11954 #include <sys/dir.h>
11955 #endif
11956 #else
11957 #ifdef I_SYS_NDIR
11958 #include <sys/ndir.h>
11959 #else
11960 #ifdef I_SYS_DIR
11961 #ifdef hp9000s500
11962 #include <ndir.h>       /* may be wrong in the future */
11963 #else
11964 #include <sys/dir.h>
11965 #endif
11966 #endif
11967 #endif
11968 #endif 
11969 int main() {
11970         DIR *dirp = opendir(".");
11971         if (dirfd(dirp) >= 0)
11972                 exit(0);
11973         else
11974                 exit(1);
11975 }
11976 EOM
11977 val=$undef
11978 set dirfd
11979 if eval $compile; then
11980         val="$define"
11981 fi
11982 case "$val" in
11983 $define)        echo "dirfd() found." >&4       ;;
11984 *)              echo "dirfd() NOT found." >&4   ;;
11985 esac
11986 set d_dirfd
11987 eval $setvar
11988 $rm -f dirfd*
11989
11990 : see if dlerror exists
11991 xxx_runnm="$runnm"
11992 runnm=false
11993 set dlerror d_dlerror
11994 eval $inlibc
11995 runnm="$xxx_runnm"
11996
11997 : see if dlfcn is available
11998 set dlfcn.h i_dlfcn
11999 eval $inhdr
12000
12001 : Check what extension to use for shared libs
12002 case "$usedl" in
12003 $define|y|true)
12004         $cat << EOM
12005
12006 On a few systems, the dynamically loaded modules that perl generates and uses
12007 will need a different extension than shared libs. The default will probably
12008 be appropriate.
12009
12010 EOM
12011         case "$dlext" in
12012         '')     dflt="$so" ;;
12013         *)      dflt="$dlext" ;;
12014         esac
12015         rp='What is the extension of dynamically loaded modules'
12016         . ./myread
12017         dlext="$ans"
12018         ;;
12019 *)
12020         dlext="none"
12021         ;;
12022 esac
12023
12024 : Check if dlsym need a leading underscore
12025 echo " "
12026 val="$undef"
12027
12028 case "$dlsrc" in
12029 dl_dlopen.xs)
12030         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12031         $cat >dyna.c <<'EOM'
12032 fred () { }
12033 EOM
12034
12035 $cat >fred.c<<EOM
12036
12037 #include <stdio.h>
12038 #$i_stdlib I_STDLIB
12039 #ifdef I_STDLIB
12040 #include <stdlib.h>
12041 #endif
12042 #$i_dlfcn I_DLFCN
12043 #ifdef I_DLFCN
12044 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12045 #else
12046 #include <sys/types.h>
12047 #include <nlist.h>
12048 #include <link.h>
12049 #endif
12050
12051 extern int fred() ;
12052
12053 int main()
12054 {
12055     void * handle ;
12056     void * symbol ;
12057 #ifndef RTLD_LAZY
12058     int mode = 1 ;
12059 #else
12060     int mode = RTLD_LAZY ;
12061 #endif
12062     handle = dlopen("./dyna.$dlext", mode) ;
12063     if (handle == NULL) {
12064         printf ("1\n") ;
12065         fflush (stdout) ;
12066         exit(0);
12067     }
12068     symbol = dlsym(handle, "fred") ;
12069     if (symbol == NULL) {
12070         /* try putting a leading underscore */
12071         symbol = dlsym(handle, "_fred") ;
12072         if (symbol == NULL) {
12073             printf ("2\n") ;
12074             fflush (stdout) ;
12075             exit(0);
12076         }
12077         printf ("3\n") ;
12078     }
12079     else
12080         printf ("4\n") ;
12081     fflush (stdout) ;
12082     exit(0);
12083 }
12084 EOM
12085         : Call the object file tmp-dyna.o in case dlext=o.
12086         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12087                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12088                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12089                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12090                 xxx=`$run ./fred`
12091                 case $xxx in
12092                 1)      echo "Test program failed using dlopen." >&4
12093                         echo "Perhaps you should not use dynamic loading." >&4;;
12094                 2)      echo "Test program failed using dlsym." >&4
12095                         echo "Perhaps you should not use dynamic loading." >&4;;
12096                 3)      echo "dlsym needs a leading underscore" >&4
12097                         val="$define" ;;
12098                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12099                 esac
12100         else
12101                 echo "I can't compile and run the test program." >&4
12102                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12103         fi
12104         ;;
12105 esac
12106
12107 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12108
12109 set d_dlsymun
12110 eval $setvar
12111
12112 : see if drand48_r exists
12113 set drand48_r d_drand48_r
12114 eval $inlibc
12115 case "$d_drand48_r" in
12116 "$define")
12117         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12118         case "$d_drand48_r_proto:$usethreads" in
12119         ":define")      d_drand48_r_proto=define
12120                 set d_drand48_r_proto drand48_r $hdrs
12121                 eval $hasproto ;;
12122         *)      ;;
12123         esac
12124         case "$d_drand48_r_proto" in
12125         define)
12126         case "$drand48_r_proto" in
12127         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12128         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12129         esac
12130         case "$drand48_r_proto" in
12131         ''|0)   d_drand48_r=undef
12132                 drand48_r_proto=0
12133                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12134         * )     case "$drand48_r_proto" in
12135                 REENTRANT_PROTO*) ;;
12136                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12137                 esac
12138                 echo "Prototype: $try" ;;
12139         esac
12140         ;;
12141         *)      case "$usethreads" in
12142                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12143                 esac
12144                 d_drand48_r=undef
12145                 drand48_r_proto=0
12146                 ;;
12147         esac
12148         ;;
12149 *)      drand48_r_proto=0
12150         ;;
12151 esac
12152
12153 : see if prototype for drand48 is available
12154 echo " "
12155 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12156 eval $hasproto
12157
12158 : see if dup2 exists
12159 set dup2 d_dup2
12160 eval $inlibc
12161
12162 : see if eaccess exists
12163 set eaccess d_eaccess
12164 eval $inlibc
12165
12166 : see if endgrent exists
12167 set endgrent d_endgrent
12168 eval $inlibc
12169
12170 : see if this is an grp system
12171 set grp.h i_grp
12172 eval $inhdr
12173
12174 case "$i_grp" in
12175 $define)
12176         xxx=`./findhdr grp.h`
12177         $cppstdin $cppflags $cppminus < $xxx >$$.h
12178
12179         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12180                 val="$define"
12181         else
12182                 val="$undef"
12183         fi
12184         set d_grpasswd
12185         eval $setvar
12186
12187         $rm -f $$.h
12188         ;;
12189 *)
12190         val="$undef";
12191         set d_grpasswd; eval $setvar
12192         ;;
12193 esac
12194
12195 : see if endgrent_r exists
12196 set endgrent_r d_endgrent_r
12197 eval $inlibc
12198 case "$d_endgrent_r" in
12199 "$define")
12200         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12201         case "$d_endgrent_r_proto:$usethreads" in
12202         ":define")      d_endgrent_r_proto=define
12203                 set d_endgrent_r_proto endgrent_r $hdrs
12204                 eval $hasproto ;;
12205         *)      ;;
12206         esac
12207         case "$d_endgrent_r_proto" in
12208         define)
12209         case "$endgrent_r_proto" in
12210         ''|0) try='int endgrent_r(FILE**);'
12211         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12212         esac
12213         case "$endgrent_r_proto" in
12214         ''|0) try='void endgrent_r(FILE**);'
12215         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12216         esac
12217         case "$endgrent_r_proto" in
12218         ''|0)   d_endgrent_r=undef
12219                 endgrent_r_proto=0
12220                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12221         * )     case "$endgrent_r_proto" in
12222                 REENTRANT_PROTO*) ;;
12223                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12224                 esac
12225                 echo "Prototype: $try" ;;
12226         esac
12227         ;;
12228         *)      case "$usethreads" in
12229                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12230                 esac
12231                 d_endgrent_r=undef
12232                 endgrent_r_proto=0
12233                 ;;
12234         esac
12235         ;;
12236 *)      endgrent_r_proto=0
12237         ;;
12238 esac
12239
12240 : see if endhostent exists
12241 set endhostent d_endhent
12242 eval $inlibc
12243
12244 : see if this is a netdb.h system
12245 set netdb.h i_netdb
12246 eval $inhdr
12247
12248 : see if endhostent_r exists
12249 set endhostent_r d_endhostent_r
12250 eval $inlibc
12251 case "$d_endhostent_r" in
12252 "$define")
12253         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12254         case "$d_endhostent_r_proto:$usethreads" in
12255         ":define")      d_endhostent_r_proto=define
12256                 set d_endhostent_r_proto endhostent_r $hdrs
12257                 eval $hasproto ;;
12258         *)      ;;
12259         esac
12260         case "$d_endhostent_r_proto" in
12261         define)
12262         case "$endhostent_r_proto" in
12263         ''|0) try='int endhostent_r(struct hostent_data*);'
12264         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12265         esac
12266         case "$endhostent_r_proto" in
12267         ''|0) try='void endhostent_r(struct hostent_data*);'
12268         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12269         esac
12270         case "$endhostent_r_proto" in
12271         ''|0)   d_endhostent_r=undef
12272                 endhostent_r_proto=0
12273                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12274         * )     case "$endhostent_r_proto" in
12275                 REENTRANT_PROTO*) ;;
12276                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12277                 esac
12278                 echo "Prototype: $try" ;;
12279         esac
12280         ;;
12281         *)      case "$usethreads" in
12282                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12283                 esac
12284                 d_endhostent_r=undef
12285                 endhostent_r_proto=0
12286                 ;;
12287         esac
12288         ;;
12289 *)      endhostent_r_proto=0
12290         ;;
12291 esac
12292
12293 : see if endnetent exists
12294 set endnetent d_endnent
12295 eval $inlibc
12296
12297 : see if endnetent_r exists
12298 set endnetent_r d_endnetent_r
12299 eval $inlibc
12300 case "$d_endnetent_r" in
12301 "$define")
12302         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12303         case "$d_endnetent_r_proto:$usethreads" in
12304         ":define")      d_endnetent_r_proto=define
12305                 set d_endnetent_r_proto endnetent_r $hdrs
12306                 eval $hasproto ;;
12307         *)      ;;
12308         esac
12309         case "$d_endnetent_r_proto" in
12310         define)
12311         case "$endnetent_r_proto" in
12312         ''|0) try='int endnetent_r(struct netent_data*);'
12313         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12314         esac
12315         case "$endnetent_r_proto" in
12316         ''|0) try='void endnetent_r(struct netent_data*);'
12317         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12318         esac
12319         case "$endnetent_r_proto" in
12320         ''|0)   d_endnetent_r=undef
12321                 endnetent_r_proto=0
12322                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12323         * )     case "$endnetent_r_proto" in
12324                 REENTRANT_PROTO*) ;;
12325                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12326                 esac
12327                 echo "Prototype: $try" ;;
12328         esac
12329         ;;
12330         *)      case "$usethreads" in
12331                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12332                 esac
12333                 d_endnetent_r=undef
12334                 endnetent_r_proto=0
12335                 ;;
12336         esac
12337         ;;
12338 *)      endnetent_r_proto=0
12339         ;;
12340 esac
12341
12342 : see if endprotoent exists
12343 set endprotoent d_endpent
12344 eval $inlibc
12345
12346 : see if endprotoent_r exists
12347 set endprotoent_r d_endprotoent_r
12348 eval $inlibc
12349 case "$d_endprotoent_r" in
12350 "$define")
12351         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12352         case "$d_endprotoent_r_proto:$usethreads" in
12353         ":define")      d_endprotoent_r_proto=define
12354                 set d_endprotoent_r_proto endprotoent_r $hdrs
12355                 eval $hasproto ;;
12356         *)      ;;
12357         esac
12358         case "$d_endprotoent_r_proto" in
12359         define)
12360         case "$endprotoent_r_proto" in
12361         ''|0) try='int endprotoent_r(struct protoent_data*);'
12362         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12363         esac
12364         case "$endprotoent_r_proto" in
12365         ''|0) try='void endprotoent_r(struct protoent_data*);'
12366         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12367         esac
12368         case "$endprotoent_r_proto" in
12369         ''|0)   d_endprotoent_r=undef
12370                 endprotoent_r_proto=0
12371                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12372         * )     case "$endprotoent_r_proto" in
12373                 REENTRANT_PROTO*) ;;
12374                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12375                 esac
12376                 echo "Prototype: $try" ;;
12377         esac
12378         ;;
12379         *)      case "$usethreads" in
12380                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12381                 esac
12382                 d_endprotoent_r=undef
12383                 endprotoent_r_proto=0
12384                 ;;
12385         esac
12386         ;;
12387 *)      endprotoent_r_proto=0
12388         ;;
12389 esac
12390
12391 : see if endpwent exists
12392 set endpwent d_endpwent
12393 eval $inlibc
12394
12395 : see if this is a pwd.h system
12396 set pwd.h i_pwd
12397 eval $inhdr
12398
12399 case "$i_pwd" in
12400 $define)
12401         xxx=`./findhdr pwd.h`
12402         $cppstdin $cppflags $cppminus < $xxx >$$.h
12403
12404         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12405                 val="$define"
12406         else
12407                 val="$undef"
12408         fi
12409         set d_pwquota
12410         eval $setvar
12411
12412         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12413                 val="$define"
12414         else
12415                 val="$undef"
12416         fi
12417         set d_pwage
12418         eval $setvar
12419
12420         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12421                 val="$define"
12422         else
12423                 val="$undef"
12424         fi
12425         set d_pwchange
12426         eval $setvar
12427
12428         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12429                 val="$define"
12430         else
12431                 val="$undef"
12432         fi
12433         set d_pwclass
12434         eval $setvar
12435
12436         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12437                 val="$define"
12438         else
12439                 val="$undef"
12440         fi
12441         set d_pwexpire
12442         eval $setvar
12443
12444         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12445                 val="$define"
12446         else
12447                 val="$undef"
12448         fi
12449         set d_pwcomment
12450         eval $setvar
12451
12452         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12453                 val="$define"
12454         else
12455                 val="$undef"
12456         fi
12457         set d_pwgecos
12458         eval $setvar
12459
12460         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12461                 val="$define"
12462         else
12463                 val="$undef"
12464         fi
12465         set d_pwpasswd
12466         eval $setvar
12467
12468         $rm -f $$.h
12469         ;;
12470 *)
12471         val="$undef"; 
12472         set d_pwquota; eval $setvar
12473         set d_pwage; eval $setvar
12474         set d_pwchange; eval $setvar
12475         set d_pwclass; eval $setvar
12476         set d_pwexpire; eval $setvar
12477         set d_pwcomment; eval $setvar
12478         set d_pwgecos; eval $setvar
12479         set d_pwpasswd; eval $setvar
12480         ;;
12481 esac
12482
12483 : see if endpwent_r exists
12484 set endpwent_r d_endpwent_r
12485 eval $inlibc
12486 case "$d_endpwent_r" in
12487 "$define")
12488         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12489         case "$d_endpwent_r_proto:$usethreads" in
12490         ":define")      d_endpwent_r_proto=define
12491                 set d_endpwent_r_proto endpwent_r $hdrs
12492                 eval $hasproto ;;
12493         *)      ;;
12494         esac
12495         case "$d_endpwent_r_proto" in
12496         define)
12497         case "$endpwent_r_proto" in
12498         ''|0) try='int endpwent_r(FILE**);'
12499         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12500         esac
12501         case "$endpwent_r_proto" in
12502         ''|0) try='void endpwent_r(FILE**);'
12503         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12504         esac
12505         case "$endpwent_r_proto" in
12506         ''|0)   d_endpwent_r=undef
12507                 endpwent_r_proto=0
12508                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12509         * )     case "$endpwent_r_proto" in
12510                 REENTRANT_PROTO*) ;;
12511                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12512                 esac
12513                 echo "Prototype: $try" ;;
12514         esac
12515         ;;
12516         *)      case "$usethreads" in
12517                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12518                 esac
12519                 d_endpwent_r=undef
12520                 endpwent_r_proto=0
12521                 ;;
12522         esac
12523         ;;
12524 *)      endpwent_r_proto=0
12525         ;;
12526 esac
12527
12528 : see if endservent exists
12529 set endservent d_endsent
12530 eval $inlibc
12531
12532 : see if endservent_r exists
12533 set endservent_r d_endservent_r
12534 eval $inlibc
12535 case "$d_endservent_r" in
12536 "$define")
12537         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12538         case "$d_endservent_r_proto:$usethreads" in
12539         ":define")      d_endservent_r_proto=define
12540                 set d_endservent_r_proto endservent_r $hdrs
12541                 eval $hasproto ;;
12542         *)      ;;
12543         esac
12544         case "$d_endservent_r_proto" in
12545         define)
12546         case "$endservent_r_proto" in
12547         ''|0) try='int endservent_r(struct servent_data*);'
12548         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12549         esac
12550         case "$endservent_r_proto" in
12551         ''|0) try='void endservent_r(struct servent_data*);'
12552         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12553         esac
12554         case "$endservent_r_proto" in
12555         ''|0)   d_endservent_r=undef
12556                 endservent_r_proto=0
12557                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12558         * )     case "$endservent_r_proto" in
12559                 REENTRANT_PROTO*) ;;
12560                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12561                 esac
12562                 echo "Prototype: $try" ;;
12563         esac
12564         ;;
12565         *)      case "$usethreads" in
12566                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12567                 esac
12568                 d_endservent_r=undef
12569                 endservent_r_proto=0
12570                 ;;
12571         esac
12572         ;;
12573 *)      endservent_r_proto=0
12574         ;;
12575 esac
12576
12577 : Locate the flags for 'open()'
12578 echo " "
12579 $cat >try.c <<EOCP
12580 #include <sys/types.h>
12581 #ifdef I_FCNTL
12582 #include <fcntl.h>
12583 #endif
12584 #ifdef I_SYS_FILE
12585 #include <sys/file.h>
12586 #endif
12587 #$i_stdlib I_STDLIB
12588 #ifdef I_STDLIB
12589 #include <stdlib.h>
12590 #endif
12591 int main() {
12592         if(O_RDONLY);
12593 #ifdef O_TRUNC
12594         exit(0);
12595 #else
12596         exit(1);
12597 #endif
12598 }
12599 EOCP
12600 : check sys/file.h first to get FREAD on Sun
12601 if $test `./findhdr sys/file.h` && \
12602                 set try -DI_SYS_FILE && eval $compile; then
12603         h_sysfile=true;
12604         echo "<sys/file.h> defines the O_* constants..." >&4
12605         if $run ./try; then
12606                 echo "and you have the 3 argument form of open()." >&4
12607                 val="$define"
12608         else
12609                 echo "but not the 3 argument form of open().  Oh, well." >&4
12610                 val="$undef"
12611         fi
12612 elif $test `./findhdr fcntl.h` && \
12613                 set try -DI_FCNTL && eval $compile; then
12614         h_fcntl=true;
12615         echo "<fcntl.h> defines the O_* constants..." >&4
12616         if $run ./try; then
12617                 echo "and you have the 3 argument form of open()." >&4
12618                 val="$define"
12619         else
12620                 echo "but not the 3 argument form of open().  Oh, well." >&4
12621                 val="$undef"
12622         fi
12623 else
12624         val="$undef"
12625         echo "I can't find the O_* constant definitions!  You got problems." >&4
12626 fi
12627 set d_open3
12628 eval $setvar
12629 $rm_try
12630
12631 : see if this is a sys/file.h system
12632 val=''
12633 set sys/file.h val
12634 eval $inhdr
12635
12636 : do we need to include sys/file.h ?
12637 case "$val" in
12638 "$define")
12639         echo " "
12640         if $h_sysfile; then
12641                 val="$define"
12642                 echo "We'll be including <sys/file.h>." >&4
12643         else
12644                 val="$undef"
12645                 echo "We won't be including <sys/file.h>." >&4
12646         fi
12647         ;;
12648 *)
12649         h_sysfile=false
12650         ;;
12651 esac
12652 set i_sysfile
12653 eval $setvar
12654
12655 : see if fcntl.h is there
12656 val=''
12657 set fcntl.h val
12658 eval $inhdr
12659
12660 : see if we can include fcntl.h
12661 case "$val" in
12662 "$define")
12663         echo " "
12664         if $h_fcntl; then
12665                 val="$define"
12666                 echo "We'll be including <fcntl.h>." >&4
12667         else
12668                 val="$undef"
12669                 if $h_sysfile; then
12670         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12671                 else
12672                         echo "We won't be including <fcntl.h>." >&4
12673                 fi
12674         fi
12675         ;;
12676 *)
12677         h_fcntl=false
12678         val="$undef"
12679         ;;
12680 esac
12681 set i_fcntl
12682 eval $setvar
12683
12684 : see if fork exists
12685 set fork d_fork
12686 eval $inlibc
12687
12688 : see if pipe exists
12689 set pipe d_pipe
12690 eval $inlibc
12691
12692 : check for non-blocking I/O stuff
12693 case "$h_sysfile" in
12694 true) echo "#include <sys/file.h>" > head.c;;
12695 *)
12696        case "$h_fcntl" in
12697        true) echo "#include <fcntl.h>" > head.c;;
12698        *) echo "#include <sys/fcntl.h>" > head.c;;
12699        esac
12700        ;;
12701 esac
12702 echo " "
12703 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12704 case "$o_nonblock" in
12705 '')
12706         $cat head.c > try.c
12707         $cat >>try.c <<EOCP
12708 #include <stdio.h>
12709 #$i_stdlib I_STDLIB
12710 #ifdef I_STDLIB
12711 #include <stdlib.h>
12712 #endif
12713 #$i_fcntl I_FCNTL
12714 #ifdef I_FCNTL
12715 #include <fcntl.h>
12716 #endif
12717 int main() {
12718 #ifdef O_NONBLOCK
12719         printf("O_NONBLOCK\n");
12720         exit(0);
12721 #endif
12722 #ifdef O_NDELAY
12723         printf("O_NDELAY\n");
12724         exit(0);
12725 #endif
12726 #ifdef FNDELAY
12727         printf("FNDELAY\n");
12728         exit(0);
12729 #endif
12730         exit(0);
12731 }
12732 EOCP
12733         set try
12734         if eval $compile_ok; then
12735                 o_nonblock=`$run ./try`
12736                 case "$o_nonblock" in
12737                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12738                 *) echo "Seems like we can use $o_nonblock.";;
12739                 esac
12740         else
12741                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12742         fi
12743         ;;
12744 *) echo "Using $hint value $o_nonblock.";;
12745 esac
12746 $rm_try
12747
12748 echo " "
12749 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12750 case "$eagain" in
12751 '')
12752         case "$d_fork:$d_pipe" in
12753         define:define)
12754         $cat head.c > try.c
12755         $cat >>try.c <<EOCP
12756 #include <errno.h>
12757 #include <sys/types.h>
12758 #include <signal.h>
12759 #include <stdio.h>
12760 #$i_stdlib I_STDLIB
12761 #ifdef I_STDLIB
12762 #include <stdlib.h>
12763 #endif
12764 #$i_fcntl I_FCNTL
12765 #ifdef I_FCNTL
12766 #include <fcntl.h>
12767 #endif
12768 #define MY_O_NONBLOCK $o_nonblock
12769 #ifndef errno  /* XXX need better Configure test */
12770 extern int errno;
12771 #endif
12772 #$i_unistd I_UNISTD
12773 #ifdef I_UNISTD
12774 #include <unistd.h>
12775 #endif
12776 #$i_string I_STRING
12777 #ifdef I_STRING
12778 #include <string.h>
12779 #else
12780 #include <strings.h>
12781 #endif
12782 $signal_t blech(int x) { exit(3); }
12783 EOCP
12784         $cat >> try.c <<'EOCP'
12785 int main()
12786 {
12787         int pd[2];
12788         int pu[2];
12789         char buf[1];
12790         char string[100];
12791
12792         pipe(pd);       /* Down: child -> parent */
12793         pipe(pu);       /* Up: parent -> child */
12794         if (0 != fork()) {
12795                 int ret;
12796                 close(pd[1]);   /* Parent reads from pd[0] */
12797                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12798 #ifdef F_SETFL
12799                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12800                         exit(1);
12801 #else
12802                 exit(4);
12803 #endif
12804                 signal(SIGALRM, blech);
12805                 alarm(5);
12806                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12807                         exit(2);
12808                 sprintf(string, "%d\n", ret);
12809                 write(2, string, strlen(string));
12810                 alarm(0);
12811 #ifdef EAGAIN
12812                 if (errno == EAGAIN) {
12813                         printf("EAGAIN\n");
12814                         goto ok;
12815                 }
12816 #endif
12817 #ifdef EWOULDBLOCK
12818                 if (errno == EWOULDBLOCK)
12819                         printf("EWOULDBLOCK\n");
12820 #endif
12821         ok:
12822                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12823                 sleep(2);                               /* Give it time to close our pipe */
12824                 alarm(5);
12825                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12826                 alarm(0);
12827                 sprintf(string, "%d\n", ret);
12828                 write(4, string, strlen(string));
12829                 exit(0);
12830         }
12831
12832         close(pd[0]);                   /* We write to pd[1] */
12833         close(pu[1]);                   /* We read from pu[0] */
12834         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12835         close(pd[1]);                   /* Pipe pd is now fully closed! */
12836         exit(0);                                /* Bye bye, thank you for playing! */
12837 }
12838 EOCP
12839         set try
12840         if eval $compile_ok; then
12841                 echo "$startsh" >mtry
12842                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12843                 chmod +x mtry
12844                 ./mtry >/dev/null 2>&1
12845                 case $? in
12846                 0) eagain=`$cat try.out`;;
12847                 1) echo "Could not perform non-blocking setting!";;
12848                 2) echo "I did a successful read() for something that was not there!";;
12849                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12850                 4) echo "Could not find F_SETFL!";;
12851                 *) echo "Something terribly wrong happened during testing.";;
12852                 esac
12853                 rd_nodata=`$cat try.ret`
12854                 echo "A read() system call with no data present returns $rd_nodata."
12855                 case "$rd_nodata" in
12856                 0|-1) ;;
12857                 *)
12858                         echo "(That's peculiar, fixing that to be -1.)"
12859                         rd_nodata=-1
12860                         ;;
12861                 esac
12862                 case "$eagain" in
12863                 '')
12864                         echo "Forcing errno EAGAIN on read() with no data available."
12865                         eagain=EAGAIN
12866                         ;;
12867                 *)
12868                         echo "Your read() sets errno to $eagain when no data is available."
12869                         ;;
12870                 esac
12871                 status=`$cat try.err`
12872                 case "$status" in
12873                 0) echo "And it correctly returns 0 to signal EOF.";;
12874                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12875                 *) echo "However, your read() returns '$status' on EOF??";;
12876                 esac
12877                 val="$define"
12878                 if test "$status" = "$rd_nodata"; then
12879                         echo "WARNING: you can't distinguish between EOF and no data!"
12880                         val="$undef"
12881                 fi
12882         else
12883                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12884                 eagain=EAGAIN
12885         fi
12886         ;;
12887         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12888                 eagain=EAGAIN
12889                 val="$define"
12890                 ;;
12891         esac
12892         set d_eofnblk
12893         eval $setvar
12894         ;;
12895 *)
12896         echo "Using $hint value $eagain."
12897         echo "Your read() returns $rd_nodata when no data is present."
12898         case "$d_eofnblk" in
12899         "$define") echo "And you can see EOF because read() returns 0.";;
12900         "$undef") echo "But you can't see EOF status from read() returned value.";;
12901         *)
12902                 echo "(Assuming you can't see EOF status from read anyway.)"
12903                 d_eofnblk=$undef
12904                 ;;
12905         esac
12906         ;;
12907 esac
12908 $rm_try head.c mtry
12909
12910 : see if _ptr and _cnt from stdio act std
12911 echo " "
12912
12913 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12914         echo "(Looks like you have stdio.h from BSD.)"
12915         case "$stdio_ptr" in
12916         '') stdio_ptr='((fp)->_p)'
12917                 ptr_lval=$define
12918                 ;;
12919         *)      ptr_lval=$d_stdio_ptr_lval;;
12920         esac
12921         case "$stdio_cnt" in
12922         '') stdio_cnt='((fp)->_r)'
12923                 cnt_lval=$define
12924                 ;;
12925         *)      cnt_lval=$d_stdio_cnt_lval;;
12926         esac
12927         case "$stdio_base" in
12928         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12929         esac
12930         case "$stdio_bufsiz" in
12931         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12932         esac
12933 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12934         echo "(Looks like you have stdio.h from Linux.)"
12935         case "$stdio_ptr" in
12936         '') stdio_ptr='((fp)->_IO_read_ptr)'
12937                 ptr_lval=$define
12938                 ;;
12939         *)      ptr_lval=$d_stdio_ptr_lval;;
12940         esac
12941         case "$stdio_cnt" in
12942         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12943                 cnt_lval=$undef
12944                 ;;
12945         *)      cnt_lval=$d_stdio_cnt_lval;;
12946         esac
12947         case "$stdio_base" in
12948         '') stdio_base='((fp)->_IO_read_base)';;
12949         esac
12950         case "$stdio_bufsiz" in
12951         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12952         esac
12953 else
12954         case "$stdio_ptr" in
12955         '') stdio_ptr='((fp)->_ptr)'
12956                 ptr_lval=$define
12957                 ;;
12958         *)      ptr_lval=$d_stdio_ptr_lval;;
12959         esac
12960         case "$stdio_cnt" in
12961         '') stdio_cnt='((fp)->_cnt)'
12962                 cnt_lval=$define
12963                 ;;
12964         *)      cnt_lval=$d_stdio_cnt_lval;;
12965         esac
12966         case "$stdio_base" in
12967         '') stdio_base='((fp)->_base)';;
12968         esac
12969         case "$stdio_bufsiz" in
12970         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12971         esac
12972 fi
12973
12974 : test whether _ptr and _cnt really work
12975 echo "Checking how std your stdio is..." >&4
12976 $cat >try.c <<EOP
12977 #include <stdio.h>
12978 #$i_stdlib I_STDLIB
12979 #ifdef I_STDLIB
12980 #include <stdlib.h>
12981 #endif
12982 #define FILE_ptr(fp)    $stdio_ptr
12983 #define FILE_cnt(fp)    $stdio_cnt
12984 int main() {
12985         FILE *fp = fopen("try.c", "r");
12986         char c = getc(fp);
12987         if (
12988                 18 <= FILE_cnt(fp) &&
12989                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12990         )
12991                 exit(0);
12992         exit(1);
12993 }
12994 EOP
12995 val="$undef"
12996 set try
12997 if eval $compile && $to try.c; then
12998         if $run ./try; then
12999                 echo "Your stdio acts pretty std."
13000                 val="$define"
13001         else
13002                 echo "Your stdio isn't very std."
13003         fi
13004 else
13005         echo "Your stdio doesn't appear very std."
13006 fi
13007 $rm_try
13008
13009 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13010 # direct buffer manipulation no longer works.  The Configure tests
13011 # should be changed to correctly detect this, but until then,
13012 # the following check should at least let perl compile and run.
13013 # (This quick fix should be updated before 5.8.1.)
13014 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13015 # A. Dougherty, June 3, 2002.
13016 case "$d_gnulibc" in
13017 $define)
13018         case "$gnulibc_version" in
13019         2.[01]*)  ;;
13020         2.2) ;;
13021         2.2.[0-9]) ;;
13022         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13023                 val="$undef"
13024                 ;;
13025         esac
13026         ;;
13027 esac
13028 set d_stdstdio
13029 eval $setvar
13030
13031 : Can _ptr be used as an lvalue?
13032 case "$d_stdstdio$ptr_lval" in
13033 $define$define) val=$define ;;
13034 *) val=$undef ;;
13035 esac
13036 set d_stdio_ptr_lval
13037 eval $setvar
13038
13039 : Can _cnt be used as an lvalue?
13040 case "$d_stdstdio$cnt_lval" in
13041 $define$define) val=$define ;;
13042 *) val=$undef ;;
13043 esac
13044 set d_stdio_cnt_lval
13045 eval $setvar
13046
13047
13048 : test whether setting _ptr sets _cnt as a side effect
13049 d_stdio_ptr_lval_sets_cnt="$undef"
13050 d_stdio_ptr_lval_nochange_cnt="$undef"
13051 case "$d_stdio_ptr_lval$d_stdstdio" in
13052 $define$define)
13053         echo "Checking to see what happens if we set the stdio ptr..." >&4
13054 $cat >try.c <<EOP
13055 #include <stdio.h>
13056 /* Can we scream? */
13057 /* Eat dust sed :-) */
13058 /* In the buffer space, no one can hear you scream. */
13059 #$i_stdlib I_STDLIB
13060 #ifdef I_STDLIB
13061 #include <stdlib.h>
13062 #endif
13063 #define FILE_ptr(fp)    $stdio_ptr
13064 #define FILE_cnt(fp)    $stdio_cnt
13065 #include <sys/types.h>
13066 int main() {
13067         FILE *fp = fopen("try.c", "r");
13068         int c;
13069         char *ptr;
13070         size_t cnt;
13071         if (!fp) {
13072             puts("Fail even to read");
13073             exit(1);
13074         }
13075         c = getc(fp); /* Read away the first # */
13076         if (c == EOF) {
13077             puts("Fail even to read");
13078             exit(1);
13079         }
13080         if (!(
13081                 18 <= FILE_cnt(fp) &&
13082                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13083         )) {
13084                 puts("Fail even to read");
13085                 exit (1);
13086         }
13087         ptr = (char*) FILE_ptr(fp);
13088         cnt = (size_t)FILE_cnt(fp);
13089
13090         FILE_ptr(fp) += 42;
13091
13092         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13093                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13094                 exit (1);
13095         }
13096         if (FILE_cnt(fp) <= 20) {
13097                 printf ("Fail (<20 chars to test)");
13098                 exit (1);
13099         }
13100         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13101                 puts("Fail compare");
13102                 exit (1);
13103         }
13104         if (cnt == FILE_cnt(fp)) {
13105                 puts("Pass_unchanged");
13106                 exit (0);
13107         }
13108         if (FILE_cnt(fp) == (cnt - 42)) {
13109                 puts("Pass_changed");
13110                 exit (0);
13111         }
13112         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13113         return 1;
13114
13115 }
13116 EOP
13117         set try
13118         if eval $compile && $to try.c; then
13119                 case `$run ./try` in
13120                 Pass_changed)
13121                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13122                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13123                 Pass_unchanged)
13124                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13125                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13126                 Fail*)
13127                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13128                 *)
13129                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13130         esac
13131         else
13132                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13133         fi
13134         $rm_try
13135         ;;
13136 esac
13137
13138 : see if _base is also standard
13139 val="$undef"
13140 case "$d_stdstdio" in
13141 $define)
13142         $cat >try.c <<EOP
13143 #include <stdio.h>
13144 #$i_stdlib I_STDLIB
13145 #ifdef I_STDLIB
13146 #include <stdlib.h>
13147 #endif
13148 #define FILE_base(fp)   $stdio_base
13149 #define FILE_bufsiz(fp) $stdio_bufsiz
13150 int main() {
13151         FILE *fp = fopen("try.c", "r");
13152         char c = getc(fp);
13153         if (
13154                 19 <= FILE_bufsiz(fp) &&
13155                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13156         )
13157                 exit(0);
13158         exit(1);
13159 }
13160 EOP
13161         set try
13162         if eval $compile && $to try.c; then
13163                 if $run ./try; then
13164                         echo "And its _base field acts std."
13165                         val="$define"
13166                 else
13167                         echo "But its _base field isn't std."
13168                 fi
13169         else
13170                 echo "However, it seems to be lacking the _base field."
13171         fi
13172         $rm_try
13173         ;;
13174 esac
13175 set d_stdiobase
13176 eval $setvar
13177
13178 : see if fast_stdio exists
13179 val="$undef"
13180 case "$d_stdstdio:$d_stdio_ptr_lval" in
13181 "$define:$define")
13182         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13183         *$define*)
13184                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13185                 val="$define"
13186                 ;;
13187         esac
13188         ;;
13189 esac
13190 set d_faststdio
13191 eval $setvar
13192
13193
13194
13195 : see if fchdir exists
13196 set fchdir d_fchdir
13197 eval $inlibc
13198
13199 : see if fchmod exists
13200 set fchmod d_fchmod
13201 eval $inlibc
13202
13203 : see if fchown exists
13204 set fchown d_fchown
13205 eval $inlibc
13206
13207 : see if this is an fcntl system
13208 set fcntl d_fcntl
13209 eval $inlibc
13210
13211 : See if fcntl-based locking works.
13212 echo " "
13213 $cat >try.c <<EOCP
13214 #$i_stdlib I_STDLIB
13215 #ifdef I_STDLIB
13216 #include <stdlib.h>
13217 #endif
13218 #include <unistd.h>
13219 #include <fcntl.h>
13220 #include <signal.h>
13221 $signal_t blech(int x) { exit(3); }
13222 int main() {
13223 #if defined(F_SETLK) && defined(F_SETLKW)
13224      struct flock flock;
13225      int retval, fd;
13226      fd = open("try.c", O_RDONLY);
13227      flock.l_type = F_RDLCK;
13228      flock.l_whence = SEEK_SET;
13229      flock.l_start = flock.l_len = 0;
13230      signal(SIGALRM, blech);
13231      alarm(10);
13232      retval = fcntl(fd, F_SETLK, &flock);
13233      close(fd);
13234      (retval < 0 ? exit(2) : exit(0));
13235 #else
13236      exit(2);
13237 #endif
13238 }
13239 EOCP
13240 echo "Checking if fcntl-based file locking works... "
13241 case "$d_fcntl" in
13242 "$define")
13243         set try
13244         if eval $compile_ok; then
13245                 if $run ./try; then
13246                         echo "Yes, it seems to work."
13247                         val="$define"
13248                 else
13249                         echo "Nope, it didn't work."
13250                         val="$undef"
13251                         case "$?" in
13252                         3) $cat >&4 <<EOM
13253 ***
13254 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13255 *** This is (almost) impossible.
13256 *** If your NFS lock daemons are not feeling well, something like
13257 *** this may happen, please investigate.  Cannot continue, aborting.
13258 ***
13259 EOM
13260                                 exit 1
13261                                 ;;
13262                         esac
13263                 fi
13264         else
13265                 echo "I'm unable to compile the test program, so I'll assume not."
13266                 val="$undef"
13267         fi
13268         ;;
13269 *) val="$undef";
13270         echo "Nope, since you don't even have fcntl()."
13271         ;;
13272 esac
13273 set d_fcntl_can_lock
13274 eval $setvar
13275 $rm_try
13276
13277 : check for fd_set items
13278 $cat <<EOM
13279
13280 Checking to see how well your C compiler handles fd_set and friends ...
13281 EOM
13282 $cat >try.c <<EOCP
13283 #$i_stdlib I_STDLIB
13284 #ifdef I_STDLIB
13285 #include <stdlib.h>
13286 #endif
13287 #$i_systime I_SYS_TIME
13288 #$i_sysselct I_SYS_SELECT
13289 #$d_socket HAS_SOCKET
13290 #include <sys/types.h>
13291 #ifdef HAS_SOCKET
13292 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13293 #endif
13294 #ifdef I_SYS_TIME
13295 #include <sys/time.h>
13296 #endif
13297 #ifdef I_SYS_SELECT
13298 #include <sys/select.h>
13299 #endif
13300 int main() {
13301         fd_set fds;
13302
13303 #ifdef TRYBITS
13304         if(fds.fds_bits);
13305 #endif
13306
13307 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13308         exit(0);
13309 #else
13310         exit(1);
13311 #endif
13312 }
13313 EOCP
13314 set try -DTRYBITS
13315 if eval $compile; then
13316         d_fds_bits="$define"
13317         d_fd_set="$define"
13318         echo "Well, your system knows about the normal fd_set typedef..." >&4
13319         if $run ./try; then
13320                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13321                 d_fd_macros="$define"
13322         else
13323                 $cat >&4 <<'EOM'
13324 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13325 EOM
13326                 d_fd_macros="$undef"
13327         fi
13328 else
13329         $cat <<'EOM'
13330 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13331 EOM
13332         set try
13333         if eval $compile; then
13334                 d_fds_bits="$undef"
13335                 d_fd_set="$define"
13336                 echo "Well, your system has some sort of fd_set available..." >&4
13337                 if $run ./try; then
13338                         echo "and you have the normal fd_set macros." >&4
13339                         d_fd_macros="$define"
13340                 else
13341                         $cat <<'EOM'
13342 but not the normal fd_set macros!  Gross!  More work for me...
13343 EOM
13344                         d_fd_macros="$undef"
13345                 fi
13346         else
13347         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13348                 d_fd_set="$undef"
13349                 d_fds_bits="$undef"
13350                 d_fd_macros="$undef"
13351         fi
13352 fi
13353 $rm_try
13354
13355 : see if fgetpos exists
13356 set fgetpos d_fgetpos
13357 eval $inlibc
13358
13359 : see if finite exists
13360 set finite d_finite
13361 eval $inlibc
13362
13363 : see if finitel exists
13364 set finitel d_finitel
13365 eval $inlibc
13366
13367 : see if flock exists
13368 set flock d_flock
13369 eval $inlibc
13370
13371 : see if prototype for flock is available
13372 echo " "
13373 set d_flockproto flock $i_sysfile sys/file.h
13374 eval $hasproto
13375
13376 : see if fp_class exists
13377 set fp_class d_fp_class
13378 eval $inlibc
13379
13380 : see if pathconf exists
13381 set pathconf d_pathconf
13382 eval $inlibc
13383
13384 : see if fpathconf exists
13385 set fpathconf d_fpathconf
13386 eval $inlibc
13387
13388 : see if fpclass exists
13389 set fpclass d_fpclass
13390 eval $inlibc
13391
13392 : see if fpclassify exists
13393 set fpclassify d_fpclassify
13394 eval $inlibc
13395
13396 : see if fpclassl exists
13397 set fpclassl d_fpclassl
13398 eval $inlibc
13399
13400 : check for fpos64_t
13401 echo " "
13402 echo "Checking to see if you have fpos64_t..." >&4
13403 $cat >try.c <<EOCP
13404 #include <stdio.h>
13405 int main() { fpos64_t x = 7; }
13406 EOCP
13407 set try
13408 if eval $compile; then
13409         val="$define"
13410         echo "You have fpos64_t."
13411 else
13412         val="$undef"
13413         echo "You do not have fpos64_t."
13414         case "$fpossize" in
13415         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13416         esac
13417 fi
13418 $rm_try
13419 set d_fpos64_t
13420 eval $setvar
13421
13422 : see if frexpl exists
13423 set frexpl d_frexpl
13424 eval $inlibc
13425
13426 : see if this is a sys/param system
13427 set sys/param.h i_sysparam
13428 eval $inhdr
13429
13430 : see if this is a sys/mount.h system
13431 set sys/mount.h i_sysmount
13432 eval $inhdr
13433
13434 : Check for fs_data_s
13435 echo " "
13436 echo "Checking to see if your system supports struct fs_data..." >&4
13437 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13438 eval $hasstruct
13439 case "$d_fs_data_s" in
13440 "$define")      echo "Yes, it does."   ;;
13441 *)              echo "No, it doesn't." ;;
13442 esac
13443
13444 : see if fseeko exists
13445 set fseeko d_fseeko
13446 eval $inlibc
13447 case "$longsize" in
13448 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13449 esac
13450
13451 : see if fsetpos exists
13452 set fsetpos d_fsetpos
13453 eval $inlibc
13454
13455 : see if fstatfs exists
13456 set fstatfs d_fstatfs
13457 eval $inlibc
13458
13459 : see if statvfs exists
13460 set statvfs d_statvfs
13461 eval $inlibc
13462
13463 : see if fstatvfs exists
13464 set fstatvfs d_fstatvfs
13465 eval $inlibc
13466
13467
13468 : see if fsync exists
13469 set fsync d_fsync
13470 eval $inlibc
13471
13472 : see if ftello exists
13473 set ftello d_ftello
13474 eval $inlibc
13475 case "$longsize" in
13476 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13477 esac
13478
13479 : check for a working futimes
13480 d_futimes="$undef"
13481 echo " "
13482 echo "Checking if you have a working futimes()" >&4
13483 $cat >try.c <<EOCP
13484 #include <stdio.h>
13485 #include <sys/time.h>
13486 #include <errno.h>
13487 #include <fcntl.h>
13488
13489 int main ()
13490 {
13491     int fd, rv;
13492     fd = open ("try.c", O_RDWR);
13493     if (-1 == fd) exit (1);
13494     rv = futimes (fd, NULL);
13495     exit (rv == -1 ? errno : 0);
13496 }
13497 EOCP
13498 set try
13499 if eval $compile; then
13500     `$run ./try`
13501     rc=$?
13502     case "$rc" in
13503         0)  echo "Yes, you have" >&4
13504             d_futimes="$define"
13505             ;;
13506         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13507             ;;
13508     esac
13509 else
13510     echo "No, it does not (probably harmless)" >&4
13511 fi
13512 $rm_try
13513
13514 : see if ndbm.h is available
13515 set ndbm.h i_ndbm
13516 eval $inhdr
13517 : Compatibility location for RedHat 7.1
13518 set gdbm/ndbm.h i_gdbmndbm
13519 eval $inhdr
13520 : Compatibility location for Debian 4.0
13521 set gdbm-ndbm.h i_gdbm_ndbm
13522 eval $inhdr
13523
13524 val="$undef"
13525 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13526         : see if dbm_open exists
13527         set dbm_open d_dbm_open
13528         eval $inlibc
13529         case "$d_dbm_open" in
13530         $undef)
13531                 i_ndbm="$undef"
13532                 i_gdbmndbm="$undef"
13533                 i_gdbm_ndbm="$undef"
13534                 echo "We won't be including <ndbm.h>"
13535                 val="$undef"
13536                 ;;
13537         *) val="$define"
13538            ;;
13539         esac
13540 fi
13541 set d_ndbm
13542 eval $setvar
13543
13544 ndbm_hdr_protochk='name=$1; hdr=$2;
13545 eval "ihdr=\$""i_$name";
13546 val="$undef";
13547 if $test "$ihdr" = "$define"; then
13548         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13549         case "$d_cplusplus" in
13550         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13551         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13552         esac;
13553         case "$val" in
13554         $define) $echo "Your <$hdr> seems to have prototypes";;
13555         *) $echo "Your <$hdr> does not seem to have prototypes";;
13556         esac;
13557 fi;
13558 set "d_${name}_h_uses_prototypes";
13559 eval $setvar'
13560
13561 set ndbm ndbm.h
13562 eval $ndbm_hdr_protochk
13563 set gdbmndbm gdbm/ndbm.h
13564 eval $ndbm_hdr_protochk
13565 set gdbm_ndbm gdbm-ndbm.h
13566 eval $ndbm_hdr_protochk
13567
13568 : see if getaddrinfo exists
13569 set getaddrinfo d_getaddrinfo
13570 eval $inlibc
13571
13572 : see if getcwd exists
13573 set getcwd d_getcwd
13574 eval $inlibc
13575
13576 : see if getespwnam exists
13577 set getespwnam d_getespwnam
13578 eval $inlibc
13579
13580 : see if getfsstat exists
13581 set getfsstat d_getfsstat
13582 eval $inlibc
13583
13584 : see if getgrent exists
13585 set getgrent d_getgrent
13586 eval $inlibc
13587
13588 : see if getgrent_r exists
13589 set getgrent_r d_getgrent_r
13590 eval $inlibc
13591 case "$d_getgrent_r" in
13592 "$define")
13593         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13594         case "$d_getgrent_r_proto:$usethreads" in
13595         ":define")      d_getgrent_r_proto=define
13596                 set d_getgrent_r_proto getgrent_r $hdrs
13597                 eval $hasproto ;;
13598         *)      ;;
13599         esac
13600         case "$d_getgrent_r_proto" in
13601         define)
13602         case "$getgrent_r_proto" in
13603         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13604         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13605         esac
13606         case "$getgrent_r_proto" in
13607         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13608         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13609         esac
13610         case "$getgrent_r_proto" in
13611         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13612         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13613         esac
13614         case "$getgrent_r_proto" in
13615         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13616         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13617         esac
13618         case "$getgrent_r_proto" in
13619         ''|0) try='int getgrent_r(struct group*, char*, int);'
13620         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13621         esac
13622         case "$getgrent_r_proto" in
13623         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13624         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13625         esac
13626         case "$getgrent_r_proto" in
13627         ''|0)   d_getgrent_r=undef
13628                 getgrent_r_proto=0
13629                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13630         * )     case "$getgrent_r_proto" in
13631                 REENTRANT_PROTO*) ;;
13632                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13633                 esac
13634                 echo "Prototype: $try" ;;
13635         esac
13636         ;;
13637         *)      case "$usethreads" in
13638                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13639                 esac
13640                 d_getgrent_r=undef
13641                 getgrent_r_proto=0
13642                 ;;
13643         esac
13644         ;;
13645 *)      getgrent_r_proto=0
13646         ;;
13647 esac
13648
13649 : see if getgrgid_r exists
13650 set getgrgid_r d_getgrgid_r
13651 eval $inlibc
13652 case "$d_getgrgid_r" in
13653 "$define")
13654         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13655         case "$d_getgrgid_r_proto:$usethreads" in
13656         ":define")      d_getgrgid_r_proto=define
13657                 set d_getgrgid_r_proto getgrgid_r $hdrs
13658                 eval $hasproto ;;
13659         *)      ;;
13660         esac
13661         case "$d_getgrgid_r_proto" in
13662         define)
13663         case "$getgrgid_r_proto" in
13664         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13665         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13666         esac
13667         case "$getgrgid_r_proto" in
13668         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13669         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13670         esac
13671         case "$getgrgid_r_proto" in
13672         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13673         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13674         esac
13675         case "$getgrgid_r_proto" in
13676         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13677         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13678         esac
13679         case "$getgrgid_r_proto" in
13680         ''|0)   d_getgrgid_r=undef
13681                 getgrgid_r_proto=0
13682                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13683         * )     case "$getgrgid_r_proto" in
13684                 REENTRANT_PROTO*) ;;
13685                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13686                 esac
13687                 echo "Prototype: $try" ;;
13688         esac
13689         ;;
13690         *)      case "$usethreads" in
13691                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13692                 esac
13693                 d_getgrgid_r=undef
13694                 getgrgid_r_proto=0
13695                 ;;
13696         esac
13697         ;;
13698 *)      getgrgid_r_proto=0
13699         ;;
13700 esac
13701
13702 : see if getgrnam_r exists
13703 set getgrnam_r d_getgrnam_r
13704 eval $inlibc
13705 case "$d_getgrnam_r" in
13706 "$define")
13707         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13708         case "$d_getgrnam_r_proto:$usethreads" in
13709         ":define")      d_getgrnam_r_proto=define
13710                 set d_getgrnam_r_proto getgrnam_r $hdrs
13711                 eval $hasproto ;;
13712         *)      ;;
13713         esac
13714         case "$d_getgrnam_r_proto" in
13715         define)
13716         case "$getgrnam_r_proto" in
13717         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13718         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13719         esac
13720         case "$getgrnam_r_proto" in
13721         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13722         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13723         esac
13724         case "$getgrnam_r_proto" in
13725         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13726         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13727         esac
13728         case "$getgrnam_r_proto" in
13729         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13730         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13731         esac
13732         case "$getgrnam_r_proto" in
13733         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13734         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13735         esac
13736         case "$getgrnam_r_proto" in
13737         ''|0)   d_getgrnam_r=undef
13738                 getgrnam_r_proto=0
13739                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13740         * )     case "$getgrnam_r_proto" in
13741                 REENTRANT_PROTO*) ;;
13742                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13743                 esac
13744                 echo "Prototype: $try" ;;
13745         esac
13746         ;;
13747         *)      case "$usethreads" in
13748                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13749                 esac
13750                 d_getgrnam_r=undef
13751                 getgrnam_r_proto=0
13752                 ;;
13753         esac
13754         ;;
13755 *)      getgrnam_r_proto=0
13756         ;;
13757 esac
13758
13759 : see if gethostbyaddr exists
13760 set gethostbyaddr d_gethbyaddr
13761 eval $inlibc
13762
13763 : see if gethostbyname exists
13764 set gethostbyname d_gethbyname
13765 eval $inlibc
13766
13767 : see if gethostent exists
13768 set gethostent d_gethent
13769 eval $inlibc
13770
13771 : see how we will look up host name
13772 echo " "
13773 call=''
13774 if set gethostname val -f d_gethname; eval $csym; $val; then
13775         echo 'gethostname() found.' >&4
13776         d_gethname="$define"
13777         call=gethostname
13778 fi
13779 if set uname val -f d_uname; eval $csym; $val; then
13780         if ./xenix; then
13781                 $cat <<'EOM'
13782 uname() was found, but you're running xenix, and older versions of xenix
13783 have a broken uname(). If you don't really know whether your xenix is old
13784 enough to have a broken system call, use the default answer.
13785
13786 EOM
13787                 dflt=y
13788                 case "$d_uname" in
13789                 "$define") dflt=n;;
13790                 esac
13791                 rp='Is your uname() broken?'
13792                 . ./myread
13793                 case "$ans" in
13794                 n*) d_uname="$define"; call=uname;;
13795                 esac
13796         else
13797                 echo 'uname() found.' >&4
13798                 d_uname="$define"
13799                 case "$call" in
13800                 '') call=uname ;;
13801                 esac
13802         fi
13803 fi
13804 case "$d_gethname" in
13805 '') d_gethname="$undef";;
13806 esac
13807 case "$d_uname" in
13808 '') d_uname="$undef";;
13809 esac
13810 case "$d_uname$d_gethname" in
13811 *define*)
13812         dflt=n
13813         cat <<EOM
13814
13815 Every now and then someone has a $call() that lies about the hostname
13816 but can't be fixed for political or economic reasons.  If you wish, I can
13817 pretend $call() isn't there and maybe compute hostname at run-time
13818 thanks to the '$phostname' command.
13819
13820 EOM
13821         rp="Shall I ignore $call() from now on?"
13822         . ./myread
13823         case "$ans" in
13824         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13825         esac;;
13826 esac
13827 case "$phostname" in
13828 '') aphostname='';;
13829 *) case "$aphostname" in
13830         /*) ;;
13831         *) set X $phostname
13832                 shift
13833                 file=$1
13834                 shift
13835                 file=`./loc $file $file $pth`
13836                 aphostname=`echo $file $*`
13837                 ;;
13838         esac
13839         ;;
13840 esac
13841 case "$d_uname$d_gethname" in
13842 *define*) ;;
13843 *)
13844         case "$phostname" in
13845         '')
13846                 echo "There will be no way for $package to get your hostname." >&4;;
13847         *)
13848         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13849                 ;;
13850         esac;;
13851 esac
13852 case "$d_phostname" in
13853 '') d_phostname="$undef";;
13854 esac
13855
13856 : see if gethostbyaddr_r exists
13857 set gethostbyaddr_r d_gethostbyaddr_r
13858 eval $inlibc
13859 case "$d_gethostbyaddr_r" in
13860 "$define")
13861         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13862         case "$d_gethostbyaddr_r_proto:$usethreads" in
13863         ":define")      d_gethostbyaddr_r_proto=define
13864                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13865                 eval $hasproto ;;
13866         *)      ;;
13867         esac
13868         case "$d_gethostbyaddr_r_proto" in
13869         define)
13870         case "$gethostbyaddr_r_proto" in
13871         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13872         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13873         esac
13874         case "$gethostbyaddr_r_proto" in
13875         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13876         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13877         esac
13878         case "$gethostbyaddr_r_proto" in
13879         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13880         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13881         esac
13882         case "$gethostbyaddr_r_proto" in
13883         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13884         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13885         esac
13886         case "$gethostbyaddr_r_proto" in
13887         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13888         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13889         esac
13890         case "$gethostbyaddr_r_proto" in
13891         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13892         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13893         esac
13894         case "$gethostbyaddr_r_proto" in
13895         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13896         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13897         esac
13898         case "$gethostbyaddr_r_proto" in
13899         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13900         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13901         esac
13902         case "$gethostbyaddr_r_proto" in
13903         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13904         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13905         esac
13906         case "$gethostbyaddr_r_proto" in
13907         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13908         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13909         esac
13910         case "$gethostbyaddr_r_proto" in
13911         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13912         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13913         esac
13914         case "$gethostbyaddr_r_proto" in
13915         ''|0)   d_gethostbyaddr_r=undef
13916                 gethostbyaddr_r_proto=0
13917                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13918         * )     case "$gethostbyaddr_r_proto" in
13919                 REENTRANT_PROTO*) ;;
13920                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13921                 esac
13922                 echo "Prototype: $try" ;;
13923         esac
13924         ;;
13925         *)      case "$usethreads" in
13926                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13927                 esac
13928                 d_gethostbyaddr_r=undef
13929                 gethostbyaddr_r_proto=0
13930                 ;;
13931         esac
13932         ;;
13933 *)      gethostbyaddr_r_proto=0
13934         ;;
13935 esac
13936
13937 : see if gethostbyname_r exists
13938 set gethostbyname_r d_gethostbyname_r
13939 eval $inlibc
13940 case "$d_gethostbyname_r" in
13941 "$define")
13942         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13943         case "$d_gethostbyname_r_proto:$usethreads" in
13944         ":define")      d_gethostbyname_r_proto=define
13945                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13946                 eval $hasproto ;;
13947         *)      ;;
13948         esac
13949         case "$d_gethostbyname_r_proto" in
13950         define)
13951         case "$gethostbyname_r_proto" in
13952         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13953         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13954         esac
13955         case "$gethostbyname_r_proto" in
13956         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13957         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13958         esac
13959         case "$gethostbyname_r_proto" in
13960         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13961         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13962         esac
13963         case "$gethostbyname_r_proto" in
13964         ''|0)   d_gethostbyname_r=undef
13965                 gethostbyname_r_proto=0
13966                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13967         * )     case "$gethostbyname_r_proto" in
13968                 REENTRANT_PROTO*) ;;
13969                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13970                 esac
13971                 echo "Prototype: $try" ;;
13972         esac
13973         ;;
13974         *)      case "$usethreads" in
13975                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13976                 esac
13977                 d_gethostbyname_r=undef
13978                 gethostbyname_r_proto=0
13979                 ;;
13980         esac
13981         ;;
13982 *)      gethostbyname_r_proto=0
13983         ;;
13984 esac
13985
13986 : see if gethostent_r exists
13987 set gethostent_r d_gethostent_r
13988 eval $inlibc
13989 case "$d_gethostent_r" in
13990 "$define")
13991         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13992         case "$d_gethostent_r_proto:$usethreads" in
13993         ":define")      d_gethostent_r_proto=define
13994                 set d_gethostent_r_proto gethostent_r $hdrs
13995                 eval $hasproto ;;
13996         *)      ;;
13997         esac
13998         case "$d_gethostent_r_proto" in
13999         define)
14000         case "$gethostent_r_proto" in
14001         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14002         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14003         esac
14004         case "$gethostent_r_proto" in
14005         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14006         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14007         esac
14008         case "$gethostent_r_proto" in
14009         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14010         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14011         esac
14012         case "$gethostent_r_proto" in
14013         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14014         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14015         esac
14016         case "$gethostent_r_proto" in
14017         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14018         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14019         esac
14020         case "$gethostent_r_proto" in
14021         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14022         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14023         esac
14024         case "$gethostent_r_proto" in
14025         ''|0)   d_gethostent_r=undef
14026                 gethostent_r_proto=0
14027                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14028         * )     case "$gethostent_r_proto" in
14029                 REENTRANT_PROTO*) ;;
14030                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14031                 esac
14032                 echo "Prototype: $try" ;;
14033         esac
14034         ;;
14035         *)      case "$usethreads" in
14036                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14037                 esac
14038                 d_gethostent_r=undef
14039                 gethostent_r_proto=0
14040                 ;;
14041         esac
14042         ;;
14043 *)      gethostent_r_proto=0
14044         ;;
14045 esac
14046
14047 : see if prototypes for various gethostxxx netdb.h functions are available
14048 echo " "
14049 set d_gethostprotos gethostent $i_netdb netdb.h
14050 eval $hasproto
14051
14052 : see if getitimer exists
14053 set getitimer d_getitimer
14054 eval $inlibc
14055
14056 : see if getlogin exists
14057 set getlogin d_getlogin
14058 eval $inlibc
14059
14060 : see if getlogin_r exists
14061 set getlogin_r d_getlogin_r
14062 eval $inlibc
14063 case "$d_getlogin_r" in
14064 "$define")
14065         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14066         case "$d_getlogin_r_proto:$usethreads" in
14067         ":define")      d_getlogin_r_proto=define
14068                 set d_getlogin_r_proto getlogin_r $hdrs
14069                 eval $hasproto ;;
14070         *)      ;;
14071         esac
14072         case "$d_getlogin_r_proto" in
14073         define)
14074         case "$getlogin_r_proto" in
14075         ''|0) try='int getlogin_r(char*, size_t);'
14076         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14077         esac
14078         case "$getlogin_r_proto" in
14079         ''|0) try='int getlogin_r(char*, int);'
14080         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14081         esac
14082         case "$getlogin_r_proto" in
14083         ''|0) try='char* getlogin_r(char*, size_t);'
14084         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14085         esac
14086         case "$getlogin_r_proto" in
14087         ''|0) try='char* getlogin_r(char*, int);'
14088         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14089         esac
14090         case "$getlogin_r_proto" in
14091         ''|0)   d_getlogin_r=undef
14092                 getlogin_r_proto=0
14093                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14094         * )     case "$getlogin_r_proto" in
14095                 REENTRANT_PROTO*) ;;
14096                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14097                 esac
14098                 echo "Prototype: $try" ;;
14099         esac
14100         ;;
14101         *)      case "$usethreads" in
14102                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14103                 esac
14104                 d_getlogin_r=undef
14105                 getlogin_r_proto=0
14106                 ;;
14107         esac
14108         ;;
14109 *)      getlogin_r_proto=0
14110         ;;
14111 esac
14112
14113 : see if getmnt exists
14114 set getmnt d_getmnt
14115 eval $inlibc
14116
14117 : see if getmntent exists
14118 set getmntent d_getmntent
14119 eval $inlibc
14120
14121 : see if getnameinfo exists
14122 set getnameinfo d_getnameinfo
14123 eval $inlibc
14124
14125 : see if getnetbyaddr exists
14126 set getnetbyaddr d_getnbyaddr
14127 eval $inlibc
14128
14129 : see if getnetbyname exists
14130 set getnetbyname d_getnbyname
14131 eval $inlibc
14132
14133 : see if getnetent exists
14134 set getnetent d_getnent
14135 eval $inlibc
14136
14137 : see if getnetbyaddr_r exists
14138 set getnetbyaddr_r d_getnetbyaddr_r
14139 eval $inlibc
14140 case "$d_getnetbyaddr_r" in
14141 "$define")
14142         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14143         case "$d_getnetbyaddr_r_proto:$usethreads" in
14144         ":define")      d_getnetbyaddr_r_proto=define
14145                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14146                 eval $hasproto ;;
14147         *)      ;;
14148         esac
14149         case "$d_getnetbyaddr_r_proto" in
14150         define)
14151         case "$getnetbyaddr_r_proto" in
14152         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14153         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14154         esac
14155         case "$getnetbyaddr_r_proto" in
14156         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14157         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14158         esac
14159         case "$getnetbyaddr_r_proto" in
14160         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14161         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14162         esac
14163         case "$getnetbyaddr_r_proto" in
14164         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14165         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14166         esac
14167         case "$getnetbyaddr_r_proto" in
14168         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14169         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14170         esac
14171         case "$getnetbyaddr_r_proto" in
14172         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14173         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14174         esac
14175         case "$getnetbyaddr_r_proto" in
14176         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14177         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14178         esac
14179         case "$getnetbyaddr_r_proto" in
14180         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14181         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14182         esac
14183         case "$getnetbyaddr_r_proto" in
14184         ''|0)   d_getnetbyaddr_r=undef
14185                 getnetbyaddr_r_proto=0
14186                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14187         * )     case "$getnetbyaddr_r_proto" in
14188                 REENTRANT_PROTO*) ;;
14189                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14190                 esac
14191                 echo "Prototype: $try" ;;
14192         esac
14193         ;;
14194         *)      case "$usethreads" in
14195                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14196                 esac
14197                 d_getnetbyaddr_r=undef
14198                 getnetbyaddr_r_proto=0
14199                 ;;
14200         esac
14201         ;;
14202 *)      getnetbyaddr_r_proto=0
14203         ;;
14204 esac
14205
14206 : see if getnetbyname_r exists
14207 set getnetbyname_r d_getnetbyname_r
14208 eval $inlibc
14209 case "$d_getnetbyname_r" in
14210 "$define")
14211         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14212         case "$d_getnetbyname_r_proto:$usethreads" in
14213         ":define")      d_getnetbyname_r_proto=define
14214                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14215                 eval $hasproto ;;
14216         *)      ;;
14217         esac
14218         case "$d_getnetbyname_r_proto" in
14219         define)
14220         case "$getnetbyname_r_proto" in
14221         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14222         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14223         esac
14224         case "$getnetbyname_r_proto" in
14225         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14226         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14227         esac
14228         case "$getnetbyname_r_proto" in
14229         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14230         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14231         esac
14232         case "$getnetbyname_r_proto" in
14233         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14234         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14235         esac
14236         case "$getnetbyname_r_proto" in
14237         ''|0)   d_getnetbyname_r=undef
14238                 getnetbyname_r_proto=0
14239                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14240         * )     case "$getnetbyname_r_proto" in
14241                 REENTRANT_PROTO*) ;;
14242                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14243                 esac
14244                 echo "Prototype: $try" ;;
14245         esac
14246         ;;
14247         *)      case "$usethreads" in
14248                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14249                 esac
14250                 d_getnetbyname_r=undef
14251                 getnetbyname_r_proto=0
14252                 ;;
14253         esac
14254         ;;
14255 *)      getnetbyname_r_proto=0
14256         ;;
14257 esac
14258
14259 : see if getnetent_r exists
14260 set getnetent_r d_getnetent_r
14261 eval $inlibc
14262 case "$d_getnetent_r" in
14263 "$define")
14264         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14265         case "$d_getnetent_r_proto:$usethreads" in
14266         ":define")      d_getnetent_r_proto=define
14267                 set d_getnetent_r_proto getnetent_r $hdrs
14268                 eval $hasproto ;;
14269         *)      ;;
14270         esac
14271         case "$d_getnetent_r_proto" in
14272         define)
14273         case "$getnetent_r_proto" in
14274         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14275         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14276         esac
14277         case "$getnetent_r_proto" in
14278         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14279         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14280         esac
14281         case "$getnetent_r_proto" in
14282         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14283         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14284         esac
14285         case "$getnetent_r_proto" in
14286         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14287         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14288         esac
14289         case "$getnetent_r_proto" in
14290         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14291         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14292         esac
14293         case "$getnetent_r_proto" in
14294         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14295         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14296         esac
14297         case "$getnetent_r_proto" in
14298         ''|0)   d_getnetent_r=undef
14299                 getnetent_r_proto=0
14300                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14301         * )     case "$getnetent_r_proto" in
14302                 REENTRANT_PROTO*) ;;
14303                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14304                 esac
14305                 echo "Prototype: $try" ;;
14306         esac
14307         ;;
14308         *)      case "$usethreads" in
14309                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14310                 esac
14311                 d_getnetent_r=undef
14312                 getnetent_r_proto=0
14313                 ;;
14314         esac
14315         ;;
14316 *)      getnetent_r_proto=0
14317         ;;
14318 esac
14319
14320 : see if prototypes for various getnetxxx netdb.h functions are available
14321 echo " "
14322 set d_getnetprotos getnetent $i_netdb netdb.h
14323 eval $hasproto
14324
14325 : see if getpagesize exists
14326 set getpagesize d_getpagsz
14327 eval $inlibc
14328
14329 : Optional checks for getprotobyname and getprotobynumber
14330
14331 : see if getprotobyname exists
14332 set getprotobyname d_getpbyname
14333 eval $inlibc
14334
14335 : see if getprotobynumber exists
14336 set getprotobynumber d_getpbynumber
14337 eval $inlibc
14338
14339 : see if getprotoent exists
14340 set getprotoent d_getpent
14341 eval $inlibc
14342
14343 : see if getpgid exists
14344 set getpgid d_getpgid
14345 eval $inlibc
14346
14347 : see if getpgrp2 exists
14348 set getpgrp2 d_getpgrp2
14349 eval $inlibc
14350
14351 : see if getppid exists
14352 set getppid d_getppid
14353 eval $inlibc
14354
14355 : see if getpriority exists
14356 set getpriority d_getprior
14357 eval $inlibc
14358
14359 : see if getprotobyname_r exists
14360 set getprotobyname_r d_getprotobyname_r
14361 eval $inlibc
14362 case "$d_getprotobyname_r" in
14363 "$define")
14364         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14365         case "$d_getprotobyname_r_proto:$usethreads" in
14366         ":define")      d_getprotobyname_r_proto=define
14367                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14368                 eval $hasproto ;;
14369         *)      ;;
14370         esac
14371         case "$d_getprotobyname_r_proto" in
14372         define)
14373         case "$getprotobyname_r_proto" in
14374         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14375         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14376         esac
14377         case "$getprotobyname_r_proto" in
14378         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14379         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14380         esac
14381         case "$getprotobyname_r_proto" in
14382         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14383         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14384         esac
14385         case "$getprotobyname_r_proto" in
14386         ''|0)   d_getprotobyname_r=undef
14387                 getprotobyname_r_proto=0
14388                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14389         * )     case "$getprotobyname_r_proto" in
14390                 REENTRANT_PROTO*) ;;
14391                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14392                 esac
14393                 echo "Prototype: $try" ;;
14394         esac
14395         ;;
14396         *)      case "$usethreads" in
14397                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14398                 esac
14399                 d_getprotobyname_r=undef
14400                 getprotobyname_r_proto=0
14401                 ;;
14402         esac
14403         ;;
14404 *)      getprotobyname_r_proto=0
14405         ;;
14406 esac
14407
14408 : see if getprotobynumber_r exists
14409 set getprotobynumber_r d_getprotobynumber_r
14410 eval $inlibc
14411 case "$d_getprotobynumber_r" in
14412 "$define")
14413         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14414         case "$d_getprotobynumber_r_proto:$usethreads" in
14415         ":define")      d_getprotobynumber_r_proto=define
14416                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14417                 eval $hasproto ;;
14418         *)      ;;
14419         esac
14420         case "$d_getprotobynumber_r_proto" in
14421         define)
14422         case "$getprotobynumber_r_proto" in
14423         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14424         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14425         esac
14426         case "$getprotobynumber_r_proto" in
14427         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14428         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14429         esac
14430         case "$getprotobynumber_r_proto" in
14431         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14432         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14433         esac
14434         case "$getprotobynumber_r_proto" in
14435         ''|0)   d_getprotobynumber_r=undef
14436                 getprotobynumber_r_proto=0
14437                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14438         * )     case "$getprotobynumber_r_proto" in
14439                 REENTRANT_PROTO*) ;;
14440                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14441                 esac
14442                 echo "Prototype: $try" ;;
14443         esac
14444         ;;
14445         *)      case "$usethreads" in
14446                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14447                 esac
14448                 d_getprotobynumber_r=undef
14449                 getprotobynumber_r_proto=0
14450                 ;;
14451         esac
14452         ;;
14453 *)      getprotobynumber_r_proto=0
14454         ;;
14455 esac
14456
14457 : see if getprotoent_r exists
14458 set getprotoent_r d_getprotoent_r
14459 eval $inlibc
14460 case "$d_getprotoent_r" in
14461 "$define")
14462         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14463         case "$d_getprotoent_r_proto:$usethreads" in
14464         ":define")      d_getprotoent_r_proto=define
14465                 set d_getprotoent_r_proto getprotoent_r $hdrs
14466                 eval $hasproto ;;
14467         *)      ;;
14468         esac
14469         case "$d_getprotoent_r_proto" in
14470         define)
14471         case "$getprotoent_r_proto" in
14472         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14473         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14474         esac
14475         case "$getprotoent_r_proto" in
14476         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14477         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14478         esac
14479         case "$getprotoent_r_proto" in
14480         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14481         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14482         esac
14483         case "$getprotoent_r_proto" in
14484         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14485         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14486         esac
14487         case "$getprotoent_r_proto" in
14488         ''|0)   d_getprotoent_r=undef
14489                 getprotoent_r_proto=0
14490                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14491         * )     case "$getprotoent_r_proto" in
14492                 REENTRANT_PROTO*) ;;
14493                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14494                 esac
14495                 echo "Prototype: $try" ;;
14496         esac
14497         ;;
14498         *)      case "$usethreads" in
14499                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14500                 esac
14501                 d_getprotoent_r=undef
14502                 getprotoent_r_proto=0
14503                 ;;
14504         esac
14505         ;;
14506 *)      getprotoent_r_proto=0
14507         ;;
14508 esac
14509
14510 : see if prototypes for various getprotoxxx netdb.h functions are available
14511 echo " "
14512 set d_getprotoprotos getprotoent $i_netdb netdb.h
14513 eval $hasproto
14514
14515 : see if getprpwnam exists
14516 set getprpwnam d_getprpwnam
14517 eval $inlibc
14518
14519 : see if getpwent exists
14520 set getpwent d_getpwent
14521 eval $inlibc
14522
14523 : see if getpwent_r exists
14524 set getpwent_r d_getpwent_r
14525 eval $inlibc
14526 case "$d_getpwent_r" in
14527 "$define")
14528         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14529         case "$d_getpwent_r_proto:$usethreads" in
14530         ":define")      d_getpwent_r_proto=define
14531                 set d_getpwent_r_proto getpwent_r $hdrs
14532                 eval $hasproto ;;
14533         *)      ;;
14534         esac
14535         case "$d_getpwent_r_proto" in
14536         define)
14537         case "$getpwent_r_proto" in
14538         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14539         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14540         esac
14541         case "$getpwent_r_proto" in
14542         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14543         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14544         esac
14545         case "$getpwent_r_proto" in
14546         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14547         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14548         esac
14549         case "$getpwent_r_proto" in
14550         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14551         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14552         esac
14553         case "$getpwent_r_proto" in
14554         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14555         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14556         esac
14557         case "$getpwent_r_proto" in
14558         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14559         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14560         esac
14561         case "$getpwent_r_proto" in
14562         ''|0)   d_getpwent_r=undef
14563                 getpwent_r_proto=0
14564                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14565         * )     case "$getpwent_r_proto" in
14566                 REENTRANT_PROTO*) ;;
14567                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14568                 esac
14569                 echo "Prototype: $try" ;;
14570         esac
14571         ;;
14572         *)      case "$usethreads" in
14573                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14574                 esac
14575                 d_getpwent_r=undef
14576                 getpwent_r_proto=0
14577                 ;;
14578         esac
14579         ;;
14580 *)      getpwent_r_proto=0
14581         ;;
14582 esac
14583
14584 : see if getpwnam_r exists
14585 set getpwnam_r d_getpwnam_r
14586 eval $inlibc
14587 case "$d_getpwnam_r" in
14588 "$define")
14589         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14590         case "$d_getpwnam_r_proto:$usethreads" in
14591         ":define")      d_getpwnam_r_proto=define
14592                 set d_getpwnam_r_proto getpwnam_r $hdrs
14593                 eval $hasproto ;;
14594         *)      ;;
14595         esac
14596         case "$d_getpwnam_r_proto" in
14597         define)
14598         case "$getpwnam_r_proto" in
14599         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14600         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14601         esac
14602         case "$getpwnam_r_proto" in
14603         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14604         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14605         esac
14606         case "$getpwnam_r_proto" in
14607         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14608         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14609         esac
14610         case "$getpwnam_r_proto" in
14611         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14612         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14613         esac
14614         case "$getpwnam_r_proto" in
14615         ''|0)   d_getpwnam_r=undef
14616                 getpwnam_r_proto=0
14617                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14618         * )     case "$getpwnam_r_proto" in
14619                 REENTRANT_PROTO*) ;;
14620                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14621                 esac
14622                 echo "Prototype: $try" ;;
14623         esac
14624         ;;
14625         *)      case "$usethreads" in
14626                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14627                 esac
14628                 d_getpwnam_r=undef
14629                 getpwnam_r_proto=0
14630                 ;;
14631         esac
14632         ;;
14633 *)      getpwnam_r_proto=0
14634         ;;
14635 esac
14636
14637 : see if getpwuid_r exists
14638 set getpwuid_r d_getpwuid_r
14639 eval $inlibc
14640 case "$d_getpwuid_r" in
14641 "$define")
14642         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14643         case "$d_getpwuid_r_proto:$usethreads" in
14644         ":define")      d_getpwuid_r_proto=define
14645                 set d_getpwuid_r_proto getpwuid_r $hdrs
14646                 eval $hasproto ;;
14647         *)      ;;
14648         esac
14649         case "$d_getpwuid_r_proto" in
14650         define)
14651         case "$getpwuid_r_proto" in
14652         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14653         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14654         esac
14655         case "$getpwuid_r_proto" in
14656         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14657         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14658         esac
14659         case "$getpwuid_r_proto" in
14660         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14661         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14662         esac
14663         case "$getpwuid_r_proto" in
14664         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14665         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14666         esac
14667         case "$getpwuid_r_proto" in
14668         ''|0)   d_getpwuid_r=undef
14669                 getpwuid_r_proto=0
14670                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14671         * )     case "$getpwuid_r_proto" in
14672                 REENTRANT_PROTO*) ;;
14673                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14674                 esac
14675                 echo "Prototype: $try" ;;
14676         esac
14677         ;;
14678         *)      case "$usethreads" in
14679                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14680                 esac
14681                 d_getpwuid_r=undef
14682                 getpwuid_r_proto=0
14683                 ;;
14684         esac
14685         ;;
14686 *)      getpwuid_r_proto=0
14687         ;;
14688 esac
14689
14690 : Optional checks for getsbyname and getsbyport
14691
14692 : see if getservbyname exists
14693 set getservbyname d_getsbyname
14694 eval $inlibc
14695
14696 : see if getservbyport exists
14697 set getservbyport d_getsbyport
14698 eval $inlibc
14699
14700 : see if getservent exists
14701 set getservent d_getsent
14702 eval $inlibc
14703
14704 : see if getservbyname_r exists
14705 set getservbyname_r d_getservbyname_r
14706 eval $inlibc
14707 case "$d_getservbyname_r" in
14708 "$define")
14709         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14710         case "$d_getservbyname_r_proto:$usethreads" in
14711         ":define")      d_getservbyname_r_proto=define
14712                 set d_getservbyname_r_proto getservbyname_r $hdrs
14713                 eval $hasproto ;;
14714         *)      ;;
14715         esac
14716         case "$d_getservbyname_r_proto" in
14717         define)
14718         case "$getservbyname_r_proto" in
14719         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14720         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14721         esac
14722         case "$getservbyname_r_proto" in
14723         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14724         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14725         esac
14726         case "$getservbyname_r_proto" in
14727         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14728         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14729         esac
14730         case "$getservbyname_r_proto" in
14731         ''|0)   d_getservbyname_r=undef
14732                 getservbyname_r_proto=0
14733                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14734         * )     case "$getservbyname_r_proto" in
14735                 REENTRANT_PROTO*) ;;
14736                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14737                 esac
14738                 echo "Prototype: $try" ;;
14739         esac
14740         ;;
14741         *)      case "$usethreads" in
14742                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14743                 esac
14744                 d_getservbyname_r=undef
14745                 getservbyname_r_proto=0
14746                 ;;
14747         esac
14748         ;;
14749 *)      getservbyname_r_proto=0
14750         ;;
14751 esac
14752
14753 : see if getservbyport_r exists
14754 set getservbyport_r d_getservbyport_r
14755 eval $inlibc
14756 case "$d_getservbyport_r" in
14757 "$define")
14758         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14759         case "$d_getservbyport_r_proto:$usethreads" in
14760         ":define")      d_getservbyport_r_proto=define
14761                 set d_getservbyport_r_proto getservbyport_r $hdrs
14762                 eval $hasproto ;;
14763         *)      ;;
14764         esac
14765         case "$d_getservbyport_r_proto" in
14766         define)
14767         case "$getservbyport_r_proto" in
14768         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14769         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14770         esac
14771         case "$getservbyport_r_proto" in
14772         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14773         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14774         esac
14775         case "$getservbyport_r_proto" in
14776         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14777         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14778         esac
14779         case "$getservbyport_r_proto" in
14780         ''|0)   d_getservbyport_r=undef
14781                 getservbyport_r_proto=0
14782                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14783         * )     case "$getservbyport_r_proto" in
14784                 REENTRANT_PROTO*) ;;
14785                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14786                 esac
14787                 echo "Prototype: $try" ;;
14788         esac
14789         ;;
14790         *)      case "$usethreads" in
14791                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14792                 esac
14793                 d_getservbyport_r=undef
14794                 getservbyport_r_proto=0
14795                 ;;
14796         esac
14797         ;;
14798 *)      getservbyport_r_proto=0
14799         ;;
14800 esac
14801
14802 : see if getservent_r exists
14803 set getservent_r d_getservent_r
14804 eval $inlibc
14805 case "$d_getservent_r" in
14806 "$define")
14807         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14808         case "$d_getservent_r_proto:$usethreads" in
14809         ":define")      d_getservent_r_proto=define
14810                 set d_getservent_r_proto getservent_r $hdrs
14811                 eval $hasproto ;;
14812         *)      ;;
14813         esac
14814         case "$d_getservent_r_proto" in
14815         define)
14816         case "$getservent_r_proto" in
14817         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14818         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14819         esac
14820         case "$getservent_r_proto" in
14821         ''|0) try='int getservent_r(struct servent*, char*, int);'
14822         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14823         esac
14824         case "$getservent_r_proto" in
14825         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14826         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14827         esac
14828         case "$getservent_r_proto" in
14829         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14830         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14831         esac
14832         case "$getservent_r_proto" in
14833         ''|0)   d_getservent_r=undef
14834                 getservent_r_proto=0
14835                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14836         * )     case "$getservent_r_proto" in
14837                 REENTRANT_PROTO*) ;;
14838                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14839                 esac
14840                 echo "Prototype: $try" ;;
14841         esac
14842         ;;
14843         *)      case "$usethreads" in
14844                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14845                 esac
14846                 d_getservent_r=undef
14847                 getservent_r_proto=0
14848                 ;;
14849         esac
14850         ;;
14851 *)      getservent_r_proto=0
14852         ;;
14853 esac
14854
14855 : see if prototypes for various getservxxx netdb.h functions are available
14856 echo " "
14857 set d_getservprotos getservent $i_netdb netdb.h
14858 eval $hasproto
14859
14860 : see if getspnam exists
14861 set getspnam d_getspnam
14862 eval $inlibc
14863
14864 : see if this is a shadow.h system
14865 set shadow.h i_shadow
14866 eval $inhdr
14867
14868 : see if getspnam_r exists
14869 set getspnam_r d_getspnam_r
14870 eval $inlibc
14871 case "$d_getspnam_r" in
14872 "$define")
14873         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14874         case "$d_getspnam_r_proto:$usethreads" in
14875         ":define")      d_getspnam_r_proto=define
14876                 set d_getspnam_r_proto getspnam_r $hdrs
14877                 eval $hasproto ;;
14878         *)      ;;
14879         esac
14880         case "$d_getspnam_r_proto" in
14881         define)
14882         case "$getspnam_r_proto" in
14883         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14884         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14885         esac
14886         case "$getspnam_r_proto" in
14887         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14888         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14889         esac
14890         case "$getspnam_r_proto" in
14891         ''|0)   d_getspnam_r=undef
14892                 getspnam_r_proto=0
14893                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14894         * )     case "$getspnam_r_proto" in
14895                 REENTRANT_PROTO*) ;;
14896                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14897                 esac
14898                 echo "Prototype: $try" ;;
14899         esac
14900         ;;
14901         *)      case "$usethreads" in
14902                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14903                 esac
14904                 d_getspnam_r=undef
14905                 getspnam_r_proto=0
14906                 ;;
14907         esac
14908         ;;
14909 *)      getspnam_r_proto=0
14910         ;;
14911 esac
14912
14913 : see if gettimeofday or ftime exists
14914 set gettimeofday d_gettimeod
14915 eval $inlibc
14916 case "$d_gettimeod" in
14917 "$undef")
14918         set ftime d_ftime 
14919         eval $inlibc
14920         ;;
14921 *)
14922         val="$undef"; set d_ftime; eval $setvar
14923         ;;
14924 esac
14925 case "$d_gettimeod$d_ftime" in
14926 "$undef$undef")
14927         echo " "
14928         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14929         ;;
14930 esac
14931
14932 : see if gmtime_r exists
14933 set gmtime_r d_gmtime_r
14934 eval $inlibc
14935 case "$d_gmtime_r" in
14936 "$define")
14937         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14938         case "$d_gmtime_r_proto:$usethreads" in
14939         ":define")      d_gmtime_r_proto=define
14940                 set d_gmtime_r_proto gmtime_r $hdrs
14941                 eval $hasproto ;;
14942         *)      ;;
14943         esac
14944         case "$d_gmtime_r_proto" in
14945         define)
14946         case "$gmtime_r_proto" in
14947         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14948         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14949         esac
14950         case "$gmtime_r_proto" in
14951         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14952         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14953         esac
14954         case "$gmtime_r_proto" in
14955         ''|0)   d_gmtime_r=undef
14956                 gmtime_r_proto=0
14957                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14958         * )     case "$gmtime_r_proto" in
14959                 REENTRANT_PROTO*) ;;
14960                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14961                 esac
14962                 echo "Prototype: $try" ;;
14963         esac
14964         ;;
14965         *)      case "$usethreads" in
14966                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14967                 esac
14968                 d_gmtime_r=undef
14969                 gmtime_r_proto=0
14970                 ;;
14971         esac
14972         ;;
14973 *)      gmtime_r_proto=0
14974         ;;
14975 esac
14976
14977 : see if hasmntopt exists
14978 set hasmntopt d_hasmntopt
14979 eval $inlibc
14980
14981 : see if this is a netinet/in.h or sys/in.h system
14982 set netinet/in.h i_niin sys/in.h i_sysin
14983 eval $inhdr
14984
14985 : see if arpa/inet.h has to be included
14986 set arpa/inet.h i_arpainet
14987 eval $inhdr
14988
14989 : see if htonl --and friends-- exists
14990 val=''
14991 set htonl val
14992 eval $inlibc
14993
14994 : Maybe they are macros.
14995 case "$val" in
14996 $undef)
14997         $cat >htonl.c <<EOM
14998 #include <stdio.h>
14999 #include <sys/types.h>
15000 #$i_niin I_NETINET_IN
15001 #$i_sysin I_SYS_IN
15002 #$i_arpainet I_ARPA_INET
15003 #ifdef I_NETINET_IN
15004 #include <netinet/in.h>
15005 #endif
15006 #ifdef I_SYS_IN
15007 #include <sys/in.h>
15008 #endif
15009 #ifdef I_ARPA_INET
15010 #include <arpa/inet.h>
15011 #endif
15012 #ifdef htonl
15013 printf("Defined as a macro.");
15014 #endif
15015 EOM
15016         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15017         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15018                 val="$define"
15019                 echo "But it seems to be defined as a macro." >&4
15020         fi
15021         $rm -f htonl.?
15022         ;;
15023 esac
15024 set d_htonl
15025 eval $setvar
15026
15027 : see if ilogbl exists
15028 set ilogbl d_ilogbl
15029 eval $inlibc
15030
15031 : index or strchr
15032 echo " "
15033 if set index val -f; eval $csym; $val; then
15034         if set strchr val -f d_strchr; eval $csym; $val; then
15035                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15036                         val="$define"
15037                         vali="$undef"
15038                         echo "strchr() found." >&4
15039                 else
15040                         val="$undef"
15041                         vali="$define"
15042                         echo "index() found." >&4
15043                 fi
15044         else
15045                 val="$undef"
15046                 vali="$define"
15047                 echo "index() found." >&4
15048         fi
15049 else
15050         if set strchr val -f d_strchr; eval $csym; $val; then
15051                 val="$define"
15052                 vali="$undef"
15053                 echo "strchr() found." >&4
15054         else
15055                 echo "No index() or strchr() found!" >&4
15056                 val="$undef"
15057                 vali="$undef"
15058         fi
15059 fi
15060 set d_strchr; eval $setvar
15061 val="$vali"
15062 set d_index; eval $setvar
15063
15064 : check whether inet_aton exists
15065 set inet_aton d_inetaton
15066 eval $inlibc
15067
15068 : see if inet_ntop exists
15069 set inet_ntop d_inetntop
15070 eval $inlibc
15071
15072 : see if inet_pton exists
15073 set inet_pton d_inetpton
15074 eval $inlibc
15075
15076 : Look for isascii
15077 echo " "
15078 $cat >isascii.c <<EOCP
15079 #include <stdio.h>
15080 #include <ctype.h>
15081 #$i_stdlib I_STDLIB
15082 #ifdef I_STDLIB
15083 #include <stdlib.h>
15084 #endif
15085 int main() {
15086         int c = 'A';
15087         if (isascii(c))
15088                 exit(0);
15089         else
15090                 exit(1);
15091 }
15092 EOCP
15093 set isascii
15094 if eval $compile; then
15095         echo "isascii() found." >&4
15096         val="$define"
15097 else
15098         echo "isascii() NOT found." >&4
15099         val="$undef"
15100 fi
15101 set d_isascii
15102 eval $setvar
15103 $rm -f isascii*
15104
15105 : Look for isblank
15106 echo " "
15107 $cat >isblank.c <<'EOCP'
15108 #include <stdio.h>
15109 #include <ctype.h>
15110 int main() {
15111         int c = ' ';
15112         if (isblank(c))
15113                 return 0 ;
15114         else
15115                 return 1 ;
15116 }
15117 EOCP
15118 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15119         echo "isblank() found." >&4
15120         val="$define"
15121 else
15122         echo "isblank() NOT found." >&4
15123         val="$undef"
15124 fi
15125 set d_isblank
15126 eval $setvar
15127 $rm -f isblank*
15128
15129 : see if isfinite exists
15130 set isfinite d_isfinite
15131 eval $inlibc
15132
15133 : see if isinf exists
15134 set isinf d_isinf
15135 eval $inlibc
15136
15137 : see if isnan exists
15138 set isnan d_isnan
15139 eval $inlibc
15140
15141 : see if isnanl exists
15142 set isnanl d_isnanl
15143 eval $inlibc
15144
15145 : see if killpg exists
15146 set killpg d_killpg
15147 eval $inlibc
15148
15149 : see if lchown exists
15150 echo " "
15151 $cat > try.c <<'EOCP'
15152 /* System header to define __stub macros and hopefully few prototypes,
15153     which can conflict with char lchown(); below.  */
15154 #include <assert.h>
15155 /* Override any gcc2 internal prototype to avoid an error.  */
15156 /* We use char because int might match the return type of a gcc2
15157    builtin and then its argument prototype would still apply.  */
15158 char lchown();
15159 int main() {
15160     /*  The GNU C library defines this for functions which it implements
15161         to always fail with ENOSYS.  Some functions are actually named
15162         something starting with __ and the normal name is an alias.  */
15163 #if defined (__stub_lchown) || defined (__stub___lchown)
15164 choke me
15165 #else
15166 lchown();
15167 #endif
15168 ; return 0; }
15169 EOCP
15170 set try
15171 if eval $compile; then
15172     $echo "lchown() found." >&4
15173     val="$define"
15174 else
15175     $echo "lchown() NOT found." >&4
15176     val="$undef"
15177 fi
15178 set d_lchown
15179 eval $setvar
15180
15181 : See if number of significant digits in a double precision number is known
15182 echo " "
15183 $cat >ldbl_dig.c <<EOM
15184 #$i_limits I_LIMITS
15185 #$i_float I_FLOAT
15186 #ifdef I_LIMITS
15187 #include <limits.h>
15188 #endif
15189 #ifdef I_FLOAT
15190 #include <float.h>
15191 #endif
15192 #ifdef LDBL_DIG
15193 printf("Contains LDBL_DIG");
15194 #endif
15195 EOM
15196 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15197 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15198         echo "LDBL_DIG found." >&4
15199         val="$define"
15200 else
15201         echo "LDBL_DIG NOT found." >&4
15202         val="$undef"
15203 fi
15204 $rm -f ldbl_dig.?
15205 set d_ldbl_dig
15206 eval $setvar
15207
15208 : see if this is a math.h system
15209 set math.h i_math
15210 eval $inhdr
15211
15212 : check to see if math.h defines _LIB_VERSION
15213 d_libm_lib_version="$undef"
15214 case $i_math in
15215     $define)
15216         echo " "
15217         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15218         $cat >try.c <<EOCP
15219 #include <unistd.h>
15220 #include <math.h>
15221 int main (int argc, char *argv[])
15222 {
15223     printf ("%d\n", _LIB_VERSION);
15224     return (0);
15225     } /* main */
15226 EOCP
15227         set try
15228         if eval $compile; then
15229             foo=`$run ./try`
15230             echo "Yes, it does ($foo)" >&4
15231             d_libm_lib_version="$define"
15232         else
15233             echo "No, it does not (probably harmless)" >&4
15234             fi
15235         $rm_try
15236         ;;
15237
15238     esac
15239
15240 : see if link exists
15241 set link d_link
15242 eval $inlibc
15243
15244 : see if localtime_r exists
15245 set localtime_r d_localtime_r
15246 eval $inlibc
15247 case "$d_localtime_r" in
15248 "$define")
15249         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15250         case "$d_localtime_r_proto:$usethreads" in
15251         ":define")      d_localtime_r_proto=define
15252                 set d_localtime_r_proto localtime_r $hdrs
15253                 eval $hasproto ;;
15254         *)      ;;
15255         esac
15256         case "$d_localtime_r_proto" in
15257         define)
15258         case "$localtime_r_proto" in
15259         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15260         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15261         esac
15262         case "$localtime_r_proto" in
15263         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15264         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15265         esac
15266         case "$localtime_r_proto" in
15267         ''|0)   d_localtime_r=undef
15268                 localtime_r_proto=0
15269                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15270         * )     case "$localtime_r_proto" in
15271                 REENTRANT_PROTO*) ;;
15272                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15273                 esac
15274                 echo "Prototype: $try" ;;
15275         esac
15276         ;;
15277         *)      case "$usethreads" in
15278                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15279                 esac
15280                 d_localtime_r=undef
15281                 localtime_r_proto=0
15282                 ;;
15283         esac
15284         ;;
15285 *)      localtime_r_proto=0
15286         ;;
15287 esac
15288
15289 : see if localtime_r calls tzset
15290 case "$localtime_r_proto" in
15291 REENTRANT_PROTO*)
15292         $cat >try.c <<EOCP
15293 /*  Does our libc's localtime_r call tzset ?
15294  *  return 0 if so, 1 otherwise.
15295  */
15296 #$i_systypes    I_SYS_TYPES
15297 #$i_unistd      I_UNISTD
15298 #$i_time        I_TIME
15299 #$i_stdlib      I_STDLIB
15300 #$i_string      I_STRING
15301 #$i_malloc      I_MALLOC
15302 #ifdef I_SYS_TYPES
15303 #  include <sys/types.h>
15304 #endif
15305 #ifdef I_UNISTD
15306 #  include <unistd.h>
15307 #endif
15308 #ifdef I_TIME
15309 #  include <time.h>
15310 #endif
15311 #ifdef I_STDLIB
15312 #include <stdlib.h>
15313 #endif
15314 #ifdef I_STRING
15315 #  include <string.h>
15316 #else
15317 #  include <strings.h>
15318 #endif
15319 #ifdef I_MALLOC
15320 #  include <malloc.h>
15321 #endif
15322 int main()
15323 {
15324     time_t t = time(0L);
15325     char w_tz[]="TZ" "=GMT+5",
15326          e_tz[]="TZ" "=GMT-5",
15327         *tz_e = (char*)malloc(16),
15328         *tz_w = (char*)malloc(16);
15329     struct tm tm_e, tm_w;
15330     memset(&tm_e,'\0',sizeof(struct tm));
15331     memset(&tm_w,'\0',sizeof(struct tm));
15332     strcpy(tz_e,e_tz);
15333     strcpy(tz_w,w_tz);
15334
15335     putenv(tz_e);
15336     localtime_r(&t, &tm_e);
15337
15338     putenv(tz_w);
15339     localtime_r(&t, &tm_w);
15340
15341     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15342         return 1;
15343     return 0;
15344 }
15345 EOCP
15346         set try
15347         if eval $compile; then
15348             if $run ./try; then
15349                 d_localtime_r_needs_tzset=undef;
15350             else
15351                 d_localtime_r_needs_tzset=define;
15352             fi;
15353         else
15354             d_localtime_r_needs_tzset=undef;
15355         fi;
15356      ;;
15357   *)
15358      d_localtime_r_needs_tzset=undef;
15359      ;;
15360 esac
15361 $rm_try
15362
15363 : see if localeconv exists
15364 set localeconv d_locconv
15365 eval $inlibc
15366
15367 : see if lockf exists
15368 set lockf d_lockf
15369 eval $inlibc
15370
15371 : see if prototype for lseek is available
15372 echo " "
15373 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15374 eval $hasproto
15375
15376 : see if lstat exists
15377 set lstat d_lstat
15378 eval $inlibc
15379
15380 : see if madvise exists
15381 set madvise d_madvise
15382 eval $inlibc
15383
15384 : see if malloc_size exists
15385 set malloc_size d_malloc_size
15386 eval $inlibc
15387
15388 : see if malloc_size_good exists
15389 set malloc_good_size d_malloc_good_size
15390 eval $inlibc
15391
15392 : see if mblen exists
15393 set mblen d_mblen
15394 eval $inlibc
15395
15396 : see if mbstowcs exists
15397 set mbstowcs d_mbstowcs
15398 eval $inlibc
15399
15400 : see if mbtowc exists
15401 set mbtowc d_mbtowc
15402 eval $inlibc
15403
15404 : see if memchr exists
15405 set memchr d_memchr
15406 eval $inlibc
15407
15408 : see if memcmp exists
15409 set memcmp d_memcmp
15410 eval $inlibc
15411
15412 : see if memcpy exists
15413 set memcpy d_memcpy
15414 eval $inlibc
15415
15416 : see if memmove exists
15417 set memmove d_memmove
15418 eval $inlibc
15419
15420 : see if memset exists
15421 set memset d_memset
15422 eval $inlibc
15423
15424 : see if mkdir exists
15425 set mkdir d_mkdir
15426 eval $inlibc
15427
15428 : see if mkdtemp exists
15429 set mkdtemp d_mkdtemp
15430 eval $inlibc
15431
15432 : see if mkfifo exists
15433 set mkfifo d_mkfifo
15434 eval $inlibc
15435
15436 : see if mkstemp exists
15437 set mkstemp d_mkstemp
15438 eval $inlibc
15439
15440 : see if mkstemps exists
15441 set mkstemps d_mkstemps
15442 eval $inlibc
15443
15444 : see if mktime exists
15445 set mktime d_mktime
15446 eval $inlibc
15447
15448 : see if this is a sys/mman.h system
15449 set sys/mman.h i_sysmman
15450 eval $inhdr
15451
15452 : see if mmap exists
15453 set mmap d_mmap
15454 eval $inlibc
15455 : see what shmat returns
15456 : default to something harmless
15457 mmaptype='void *'
15458 case "$i_sysmman$d_mmap" in
15459 "$define$define")
15460         $cat >mmap.c <<'END'
15461 #include <sys/mman.h>
15462 void *mmap();
15463 END
15464         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15465                 mmaptype='void *'
15466         else
15467                 mmaptype='caddr_t'
15468         fi
15469         echo "and it returns ($mmaptype)." >&4
15470         ;;
15471 esac
15472
15473
15474
15475 : see if sqrtl exists
15476 set sqrtl d_sqrtl
15477 eval $inlibc
15478
15479 : see if scalbnl exists
15480 set scalbnl d_scalbnl
15481 eval $inlibc
15482
15483 : see if modfl exists
15484 set modfl d_modfl
15485 eval $inlibc
15486
15487 : see if prototype for modfl is available
15488 echo " "
15489 set d_modflproto modfl $i_math math.h
15490 eval $hasproto
15491
15492 d_modfl_pow32_bug="$undef"
15493
15494 case "$d_longdbl$d_modfl" in
15495 $define$define)
15496         $cat <<EOM
15497 Checking to see whether your modfl() is okay for large values...
15498 EOM
15499 $cat >try.c <<EOCP
15500 #include <math.h>
15501 #include <stdio.h>
15502 EOCP
15503 if $test "X$d_modflproto" != "X$define"; then
15504         $cat >>try.c <<EOCP
15505 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15506 long double modfl (long double, long double *);
15507 EOCP
15508 fi
15509 $cat >>try.c <<EOCP
15510 int main() {
15511     long double nv = 4294967303.15;
15512     long double v, w;
15513     v = modfl(nv, &w);
15514 #ifdef __GLIBC__
15515     printf("glibc");
15516 #endif
15517     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15518     return 0;
15519 }
15520 EOCP
15521         case "$osname:$gccversion" in
15522         aix:)   saveccflags="$ccflags"
15523                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15524         esac
15525         set try
15526         if eval $compile; then
15527                 foo=`$run ./try`
15528                 case "$foo" in
15529                 *" 4294967303.150000 1.150000 4294967302.000000")
15530                         echo >&4 "Your modfl() is broken for large values."
15531                         d_modfl_pow32_bug="$define"
15532                         case "$foo" in
15533                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15534                         ;;
15535                         esac
15536                         ;;
15537                 *" 4294967303.150000 0.150000 4294967303.000000")
15538                         echo >&4 "Your modfl() seems okay for large values."
15539                         ;;
15540                 *)      echo >&4 "I don't understand your modfl() at all."
15541                         d_modfl="$undef"
15542                         ;;
15543                 esac
15544                 $rm_try
15545         else
15546                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15547                 d_modfl="$undef"
15548         fi
15549         case "$osname:$gccversion" in
15550         aix:)   ccflags="$saveccflags" ;; # restore
15551         esac
15552         ;;
15553 esac
15554
15555 if $test "$uselongdouble" = "$define"; then
15556     message=""
15557     if $test "$d_sqrtl" != "$define"; then
15558         message="$message sqrtl"
15559     fi
15560     if $test "$d_modfl" != "$define"; then
15561         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15562             echo "You have both aintl and copysignl, so I can emulate modfl."
15563         else
15564             message="$message modfl"
15565         fi
15566     fi
15567     if $test "$d_frexpl" != "$define"; then
15568         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15569             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15570         else
15571             message="$message frexpl"
15572         fi
15573     fi
15574
15575     if $test "$message" != ""; then
15576         $cat <<EOM >&4
15577
15578 *** You requested the use of long doubles but you do not seem to have
15579 *** the following mathematical functions needed for long double support:
15580 ***    $message
15581 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15582 *** Cannot continue, aborting.
15583
15584 EOM
15585
15586         exit 1
15587     fi
15588 fi
15589
15590 : see if mprotect exists
15591 set mprotect d_mprotect
15592 eval $inlibc
15593
15594 : see if msgctl exists
15595 set msgctl d_msgctl
15596 eval $inlibc
15597
15598 : see if msgget exists
15599 set msgget d_msgget
15600 eval $inlibc
15601
15602 : see if msgsnd exists
15603 set msgsnd d_msgsnd
15604 eval $inlibc
15605
15606 : see if msgrcv exists
15607 set msgrcv d_msgrcv
15608 eval $inlibc
15609
15610 : see how much of the 'msg*(2)' library is present.
15611 h_msg=true
15612 echo " "
15613 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15614 *"$undef"*) h_msg=false;;
15615 esac
15616 case "$osname" in
15617 freebsd)
15618     case "`ipcs 2>&1`" in
15619     "SVID messages"*"not configured"*)
15620         echo "Your $osname does not have the msg*(2) configured." >&4
15621         h_msg=false
15622         val="$undef"
15623         set msgctl d_msgctl
15624         eval $setvar
15625         set msgget d_msgget
15626         eval $setvar
15627         set msgsnd d_msgsnd
15628         eval $setvar
15629         set msgrcv d_msgrcv
15630         eval $setvar
15631         ;;
15632     esac
15633     ;;
15634 esac
15635 : we could also check for sys/ipc.h ...
15636 if $h_msg && $test `./findhdr sys/msg.h`; then
15637         echo "You have the full msg*(2) library." >&4
15638         val="$define"
15639 else
15640         echo "You don't have the full msg*(2) library." >&4
15641         val="$undef"
15642 fi
15643 set d_msg
15644 eval $setvar
15645
15646 : Check for msghdr_s
15647 echo " "
15648 echo "Checking to see if your system supports struct msghdr..." >&4
15649 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15650 eval $hasstruct
15651 case "$d_msghdr_s" in
15652 "$define")      echo "Yes, it does."   ;;
15653 *)              echo "No, it doesn't." ;;
15654 esac
15655
15656
15657 : see if msync exists
15658 set msync d_msync
15659 eval $inlibc
15660
15661 : see if munmap exists
15662 set munmap d_munmap
15663 eval $inlibc
15664
15665 : see if nice exists
15666 set nice d_nice
15667 eval $inlibc
15668
15669 : see if this is a langinfo.h system
15670 set langinfo.h i_langinfo
15671 eval $inhdr
15672
15673 : see if nl_langinfo exists
15674 set nl_langinfo d_nl_langinfo
15675 eval $inlibc
15676
15677 : check for volatile keyword
15678 echo " "
15679 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15680 $cat >try.c <<'EOCP'
15681 int main()
15682 {
15683         typedef struct _goo_struct goo_struct;
15684         goo_struct * volatile goo = ((goo_struct *)0);
15685         struct _goo_struct {
15686                 long long_int;
15687                 int reg_int;
15688                 char char_var;
15689         };
15690         typedef unsigned short foo_t;
15691         char *volatile foo;
15692         volatile int bar;
15693         volatile foo_t blech;
15694         foo = foo;
15695 }
15696 EOCP
15697 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15698         val="$define"
15699         echo "Yup, it does."
15700 else
15701         val="$undef"
15702         echo "Nope, it doesn't."
15703 fi
15704 set d_volatile
15705 eval $setvar
15706 $rm_try
15707
15708 : Check basic sizes
15709 echo " "
15710 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15711
15712 case "$use64bitint:$d_quad:$quadtype" in
15713 define:define:?*)
15714         ivtype="$quadtype"
15715         uvtype="$uquadtype"
15716         ivsize=8
15717         uvsize=8
15718         ;;
15719 *)      ivtype="long"
15720         uvtype="unsigned long"
15721         ivsize=$longsize
15722         uvsize=$longsize
15723         ;;
15724 esac
15725
15726 case "$uselongdouble:$d_longdbl" in
15727 define:define)
15728         nvtype="long double"
15729         nvsize=$longdblsize
15730         ;;
15731 *)      nvtype=double
15732         nvsize=$doublesize
15733         ;;
15734 esac
15735
15736 $echo "(IV will be "$ivtype", $ivsize bytes)"
15737 $echo "(UV will be "$uvtype", $uvsize bytes)"
15738 $echo "(NV will be "$nvtype", $nvsize bytes)"
15739
15740 $cat >try.c <<EOCP
15741 #$i_inttypes I_INTTYPES
15742 #ifdef I_INTTYPES
15743 #include <inttypes.h>
15744 #endif
15745 #include <stdio.h>
15746 int main() {
15747 #ifdef INT8
15748    int8_t i =  INT8_MAX;
15749   uint8_t u = UINT8_MAX;
15750   printf("int8_t\n");
15751 #endif
15752 #ifdef INT16
15753    int16_t i =  INT16_MAX;
15754   uint16_t i = UINT16_MAX;
15755   printf("int16_t\n");
15756 #endif
15757 #ifdef INT32
15758    int32_t i =  INT32_MAX;
15759   uint32_t u = UINT32_MAX;
15760   printf("int32_t\n");
15761 #endif
15762 }
15763 EOCP
15764
15765 i8type="signed char"
15766 u8type="unsigned char"
15767 i8size=1
15768 u8size=1
15769
15770 case "$i16type" in
15771 '')     case "$shortsize" in
15772         2)      i16type=short
15773                 u16type="unsigned short"
15774                 i16size=$shortsize
15775                 u16size=$shortsize
15776                 ;;
15777         esac
15778         ;;
15779 esac
15780 case "$i16type" in
15781 '')     set try -DINT16
15782         if eval $compile; then
15783                 case "`$run ./try`" in
15784                 int16_t)
15785                         i16type=int16_t
15786                         u16type=uint16_t
15787                         i16size=2
15788                         u16size=2
15789                         ;;
15790                 esac
15791         fi
15792         ;;
15793 esac
15794 case "$i16type" in
15795 '')     if $test $shortsize -ge 2; then
15796                 i16type=short
15797                 u16type="unsigned short"
15798                 i16size=$shortsize
15799                 u16size=$shortsize
15800         fi
15801         ;;
15802 esac
15803
15804 case "$i32type" in
15805 '')     case "$longsize" in
15806         4)      i32type=long
15807                 u32type="unsigned long"
15808                 i32size=$longsize
15809                 u32size=$longsize
15810                 ;;
15811         *)      case "$intsize" in
15812                 4)      i32type=int
15813                         u32type="unsigned int"
15814                         i32size=$intsize
15815                         u32size=$intsize
15816                         ;;
15817                 esac
15818                 ;;
15819         esac
15820         ;;
15821 esac
15822 case "$i32type" in
15823 '')     set try -DINT32
15824         if eval $compile; then
15825                 case "`$run ./try`" in
15826                 int32_t)
15827                         i32type=int32_t
15828                         u32type=uint32_t
15829                         i32size=4
15830                         u32size=4
15831                         ;;
15832                 esac
15833         fi
15834         ;;
15835 esac
15836 case "$i32type" in
15837 '')     if $test $intsize -ge 4; then
15838                 i32type=int
15839                 u32type="unsigned int"
15840                 i32size=$intsize
15841                 u32size=$intsize
15842         fi
15843         ;;
15844 esac
15845
15846 case "$i64type" in
15847 '')     case "$d_quad:$quadtype" in
15848         define:?*)
15849                 i64type="$quadtype"
15850                 u64type="$uquadtype"
15851                 i64size=8
15852                 u64size=8
15853                 ;;
15854         esac
15855         ;;
15856 esac
15857
15858 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15859 : volatile so that the compiler has to store it out to memory.
15860 if test X"$d_volatile" = X"$define"; then
15861         volatile=volatile
15862 fi
15863 $cat <<EOP >try.c
15864 #include <stdio.h>
15865 #$i_stdlib I_STDLIB
15866 #ifdef I_STDLIB
15867 #include <stdlib.h>
15868 #endif
15869 #include <sys/types.h>
15870 #include <signal.h>
15871 #ifdef SIGFPE
15872 $volatile int bletched = 0;
15873 $signal_t blech(int s) { bletched = 1; }
15874 #endif
15875 int main() {
15876     $uvtype u = 0;
15877     $nvtype d;
15878     int     n = 8 * $uvsize;
15879     int     i;
15880 #ifdef SIGFPE
15881     signal(SIGFPE, blech);
15882 #endif
15883
15884     for (i = 0; i < n; i++) {
15885       u = u << 1 | ($uvtype)1;
15886       d = ($nvtype)u;
15887       if (($uvtype)d != u)
15888         break;
15889       if (d <= 0)
15890         break;
15891       d = ($nvtype)(u - 1);
15892       if (($uvtype)d != (u - 1))
15893         break;
15894 #ifdef SIGFPE
15895       if (bletched)
15896         break;
15897 #endif
15898     }
15899     printf("%d\n", ((i == n) ? -n : i));
15900     exit(0);
15901 }
15902 EOP
15903 set try
15904
15905 d_nv_preserves_uv="$undef"
15906 if eval $compile; then
15907         nv_preserves_uv_bits="`$run ./try`"
15908 fi
15909 case "$nv_preserves_uv_bits" in
15910 \-[1-9]*)
15911         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15912         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15913         d_nv_preserves_uv="$define"
15914         ;;
15915 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15916         d_nv_preserves_uv="$undef" ;;
15917 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15918         nv_preserves_uv_bits="0" ;;
15919 esac
15920 $rm_try
15921
15922 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15923 : volatile so that the compiler has to store it out to memory.
15924 if test X"$d_volatile" = X"$define"; then
15925         volatile=volatile
15926 fi
15927 $cat <<EOP >try.c
15928 #include <stdio.h>
15929
15930 typedef $nvtype NV;
15931
15932 int
15933 main() {
15934   NV value = 2;
15935   int count = 1;
15936
15937   while(count < 256) {
15938     $volatile NV up = value + 1.0;
15939     $volatile NV negated = -value;
15940     $volatile NV down = negated - 1.0;
15941     $volatile NV got_up = up - value;
15942     int up_good = got_up == 1.0;
15943     int got_down = down - negated;
15944     int down_good = got_down == -1.0;
15945
15946     if (down_good != up_good) {
15947       fprintf(stderr,
15948               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15949               up_good, (double) got_up, down_good, (double) got_down,
15950               count, (double) value);
15951       return 1;
15952     }
15953     if (!up_good) {
15954       while (1) {
15955         if (count > 8) {
15956           count -= 8;
15957           fputs("256.0", stdout);
15958         } else {
15959           count--;
15960           fputs("2.0", stdout);
15961         }
15962         if (!count) {
15963           puts("");
15964           return 0;
15965         }
15966         fputs("*", stdout);
15967       }
15968     }
15969     value *= 2;
15970     ++count;
15971   }
15972   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15973           count, (double) value);
15974   return 1;
15975 }
15976 EOP
15977 set try
15978
15979 nv_overflows_integers_at='0'
15980 if eval $compile; then
15981     xxx="`$run ./try`"
15982     case "$?" in
15983         0)
15984             case "$xxx" in
15985                 2*)  cat >&4 <<EOM
15986 The largest integer your NVs can preserve is equal to $xxx
15987 EOM
15988                     nv_overflows_integers_at="$xxx"
15989                     ;;
15990                 *)  cat >&4 <<EOM
15991 Cannot determine the largest integer value your NVs can hold, unexpected output
15992 '$xxx'
15993 EOM
15994                     ;;
15995             esac
15996             ;;
15997         *)  cat >&4 <<EOM
15998 Cannot determine the largest integer value your NVs can hold
15999 EOM
16000             ;;
16001     esac
16002 fi
16003 $rm_try
16004
16005 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16006 : volatile so that the compiler has to store it out to memory.
16007 if test X"$d_volatile" = X"$define"; then
16008         volatile=volatile
16009 fi
16010 $cat <<EOP >try.c
16011 #include <stdio.h>
16012 #$i_stdlib I_STDLIB
16013 #ifdef I_STDLIB
16014 #include <stdlib.h>
16015 #endif
16016 #$i_string I_STRING
16017 #ifdef I_STRING
16018 #  include <string.h>
16019 #else
16020 #  include <strings.h>
16021 #endif
16022 #include <sys/types.h>
16023 #include <signal.h>
16024 #ifdef SIGFPE
16025 $volatile int bletched = 0;
16026 $signal_t blech(int s) { bletched = 1; }
16027 #endif
16028
16029 int checkit($nvtype d, char *where) {
16030     unsigned char *p = (char *)&d;
16031     unsigned char *end = p + sizeof(d);
16032     int fail = 0;
16033
16034     while (p < end)
16035         fail += *p++;
16036
16037     if (!fail)
16038         return 0;
16039
16040     p = (char *)&d;
16041     printf("No - %s: 0x", where);
16042     while (p < end)
16043         printf ("%02X", *p++);
16044     printf("\n");
16045     return 1;
16046 }
16047
16048 int main(int argc, char **argv) {
16049     $nvtype d = 0.0;
16050     int fail = 0;
16051     fail += checkit(d, "0.0");
16052
16053     /* The compiler shouldn't be assuming that bletched is 0  */
16054     d = bletched;
16055
16056     fail += checkit(d, "bleched");
16057
16058 #ifdef SIGFPE
16059     signal(SIGFPE, blech);
16060 #endif
16061
16062     /* Paranoia - the compiler should have no way of knowing that ANSI says
16063        that argv[argc] will always be NULL.  Actually, if it did assume this it
16064        would be buggy, as this is C and main() can be called from elsewhere in
16065        the program.  */
16066     d = argv[argc] ? 1 : 0;
16067
16068     if (d) {
16069         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16070     }
16071
16072     fail += checkit(d, "ternary");
16073
16074     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16075
16076     if (d != 0.0) {
16077         printf("No - memset doesn't give 0.0\n");
16078         /* This might just blow up:  */
16079         printf("(gives %g)\n", d);
16080         return 1;
16081     }
16082
16083 #ifdef SIGFPE
16084     if (bletched) {
16085         printf("No - something bleched\n");
16086         return 1;
16087     }
16088 #endif
16089     if (fail) {
16090       printf("No - %d fail(s)\n", fail);
16091       return 1;
16092     }
16093     printf("Yes\n");
16094     return 0;
16095 }
16096 EOP
16097 set try
16098
16099 d_nv_zero_is_allbits_zero="$undef"
16100 if eval $compile; then
16101     xxx="`$run ./try`"
16102     case "$?" in
16103         0)
16104             case "$xxx" in
16105                 Yes)  cat >&4 <<EOM
16106 0.0 is represented as all bits zero in memory
16107 EOM
16108                     d_nv_zero_is_allbits_zero="$define"
16109                     ;;
16110                 *)  cat >&4 <<EOM
16111 0.0 is not represented as all bits zero in memory
16112 EOM
16113                     d_nv_zero_is_allbits_zero="$undef"
16114                     ;;
16115             esac
16116             ;;
16117         *)  cat >&4 <<EOM
16118 0.0 is not represented as all bits zero in memory
16119 EOM
16120             d_nv_zero_is_allbits_zero="$undef"
16121             ;;
16122     esac
16123 fi
16124 $rm_try
16125
16126 : check for off64_t
16127 echo " "
16128 echo "Checking to see if you have off64_t..." >&4
16129 $cat >try.c <<EOCP
16130 #include <sys/types.h>
16131 #include <unistd.h>
16132 int main() { off64_t x = 7; }
16133 EOCP
16134 set try
16135 if eval $compile; then
16136         val="$define"
16137         echo "You have off64_t."
16138 else
16139         val="$undef"
16140         echo "You do not have off64_t."
16141         case "$lseeksize" in
16142         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16143         esac
16144 fi
16145 $rm_try
16146 set d_off64_t
16147 eval $setvar
16148
16149 : how to create joinable pthreads
16150 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16151         echo " "
16152         echo "Checking what constant to use for creating joinable pthreads..." >&4
16153         $cat >try.c <<'EOCP'
16154 #include <pthread.h>
16155 int main() {
16156     int detachstate = JOINABLE;
16157 }
16158 EOCP
16159         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16160         if eval $compile; then
16161                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16162                 val="$undef" # Yes, undef.
16163                 set d_old_pthread_create_joinable
16164                 eval $setvar
16165                 val=""
16166                 set old_pthread_create_joinable
16167                 eval $setvar
16168         else
16169                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16170                 if eval $compile; then
16171                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16172                         val="$define"
16173                         set d_old_pthread_create_joinable
16174                         eval $setvar
16175                         val=PTHREAD_CREATE_UNDETACHED
16176                         set old_pthread_create_joinable
16177                         eval $setvar
16178                 else
16179                         set try -DJOINABLE=__UNDETACHED
16180                         if eval $compile; then
16181                                 echo "You seem to use __UNDETACHED." >&4
16182                                 val="$define"
16183                                 set d_old_pthread_create_joinable
16184                                 eval $setvar
16185                                 val=__UNDETACHED
16186                                 set old_pthread_create_joinable
16187                                 eval $setvar
16188                         else
16189                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16190                                 val="$define"
16191                                 set d_old_pthread_create_joinable
16192                                 eval $setvar
16193                                 val=0
16194                                 set old_pthread_create_joinable
16195                                 eval $setvar
16196                         fi
16197                 fi
16198         fi
16199         $rm_try
16200 else
16201     d_old_pthread_create_joinable="$undef"
16202     old_pthread_create_joinable=""
16203 fi
16204
16205 : see if pause exists
16206 set pause d_pause
16207 eval $inlibc
16208
16209 : see if poll exists
16210 set poll d_poll
16211 eval $inlibc
16212
16213 : see if prctl exists
16214 set prctl d_prctl
16215 eval $inlibc
16216
16217 : see if prctl supports PR_SET_NAME
16218 d_prctl_set_name=$undef
16219 case $d_prctl in
16220     $define)
16221         $cat >try.c <<EOM
16222 #include <sys/prctl.h>
16223
16224 int main (int argc, char *argv[])
16225 {
16226     return (prctl (PR_SET_NAME, "Test"));
16227     } /* main */
16228 EOM
16229         set try
16230         if eval $compile_ok && $run ./try; then
16231             echo "Your prctl (PR_SET_NAME, ...) works"
16232             d_prctl_set_name=$define
16233             fi
16234         $rm_try
16235         ;;
16236     esac
16237
16238 : see if readlink exists
16239 set readlink d_readlink
16240 eval $inlibc
16241
16242 : Check if exe is symlink to abs path of executing program
16243 echo " "
16244 procselfexe=''
16245 val="$undef"
16246 case "$d_readlink" in
16247     "$define")
16248         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16249         : more tidy to avoid an extra level of symlink
16250         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16251         while test $# -gt 0; do
16252             type=$1; try=$2
16253             shift; shift
16254             if $issymlink $try; then
16255                 $ls -l $try > reflect
16256                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16257                     echo "You have $type-like $try."
16258                     procselfexe='"'$try'"'
16259                     val="$define"
16260                     : This will break out of the loop
16261                     set X; shift
16262                 fi
16263             fi
16264         done
16265         ;;
16266 esac
16267 $rm -f reflect
16268 set d_procselfexe
16269 eval $setvar
16270
16271 : backward compatibility for d_hvfork
16272 if test X$d_hvfork != X; then
16273         d_vfork="$d_hvfork"
16274         d_hvfork=''
16275 fi
16276 : see if there is a vfork
16277 val=''
16278 set vfork val
16279 eval $inlibc
16280
16281 d_pseudofork=$undef
16282
16283 : Ok, but do we want to use it. vfork is reportedly unreliable in
16284 : perl on Solaris 2.x, and probably elsewhere.
16285 case "$val" in
16286 $define)
16287         echo " "
16288         case "$usevfork" in
16289         false) dflt='n';;
16290         *) dflt='y';;
16291         esac
16292         cat <<'EOM'
16293
16294 Perl can only use a vfork() that doesn't suffer from strict
16295 restrictions on calling functions or modifying global data in
16296 the child.  For example, glibc-2.1 contains such a vfork()
16297 that is unsuitable.  If your system provides a proper fork()
16298 call, chances are that you do NOT want perl to use vfork().
16299
16300 EOM
16301         rp="Do you still want to use vfork()?"
16302         . ./myread
16303         case "$ans" in
16304         y|Y) ;;
16305         *)
16306                 echo "Ok, we won't use vfork()."
16307                 val="$undef"
16308                 ;;
16309         esac
16310         ;;
16311 esac
16312 set d_vfork
16313 eval $setvar
16314 case "$d_vfork" in
16315 $define) usevfork='true';;
16316 *) usevfork='false';;
16317 esac
16318
16319 : see whether the pthread_atfork exists
16320 $cat >try.c <<EOP
16321 #include <pthread.h>
16322 #include <stdio.h>
16323 int main() {
16324 #ifdef  PTHREAD_ATFORK
16325         pthread_atfork(NULL,NULL,NULL);
16326 #endif
16327 }
16328 EOP
16329
16330 : see if pthread_atfork exists
16331 set try -DPTHREAD_ATFORK
16332 if eval $compile; then
16333     val="$define"
16334 else
16335     val="$undef"
16336 fi
16337 case "$usethreads" in
16338 $define)
16339         case "$val" in
16340         $define) echo 'pthread_atfork found.' >&4        ;;
16341         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16342         esac
16343 esac
16344 set d_pthread_atfork
16345 eval $setvar
16346
16347 : see if pthread_attr_setscope exists
16348 set pthread_attr_setscope d_pthread_attr_setscope
16349 eval $inlibc
16350
16351 : see whether the various POSIXish _yields exist
16352 $cat >try.c <<EOP
16353 #include <pthread.h>
16354 #include <stdio.h>
16355 int main() {
16356 #ifdef SCHED_YIELD
16357         sched_yield();
16358 #else
16359 #ifdef PTHREAD_YIELD
16360         pthread_yield();
16361 #else
16362 #ifdef PTHREAD_YIELD_NULL
16363         pthread_yield(NULL);
16364 #endif
16365 #endif
16366 #endif
16367 }
16368 EOP
16369 : see if sched_yield exists
16370 set try -DSCHED_YIELD
16371 if eval $compile; then
16372     val="$define"
16373     sched_yield='sched_yield()'
16374 else
16375     val="$undef"
16376 fi
16377 case "$usethreads" in
16378 $define)
16379         case "$val" in
16380         $define) echo 'sched_yield() found.' >&4        ;;
16381         *)       echo 'sched_yield() NOT found.' >&4    ;;
16382         esac
16383 esac
16384 set d_sched_yield
16385 eval $setvar
16386
16387 : see if pthread_yield exists
16388 set try -DPTHREAD_YIELD
16389 if eval $compile; then
16390     val="$define"
16391     case "$sched_yield" in
16392     '') sched_yield='pthread_yield()' ;;
16393     esac
16394 else
16395     set try -DPTHREAD_YIELD_NULL
16396     if eval $compile; then
16397         val="$define"
16398         case "$sched_yield" in
16399         '') sched_yield='pthread_yield(NULL)' ;;
16400         esac
16401     else
16402         val="$undef"
16403     fi
16404 fi
16405 case "$usethreads" in
16406 $define)
16407         case "$val" in
16408         $define) echo 'pthread_yield() found.' >&4      ;;
16409         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16410         esac
16411         ;;
16412 esac
16413 set d_pthread_yield
16414 eval $setvar
16415 case "$sched_yield" in
16416 '') sched_yield=undef ;;
16417 esac
16418 $rm_try
16419
16420 : see if random_r exists
16421 set random_r d_random_r
16422 eval $inlibc
16423 case "$d_random_r" in
16424 "$define")
16425         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16426         case "$d_random_r_proto:$usethreads" in
16427         ":define")      d_random_r_proto=define
16428                 set d_random_r_proto random_r $hdrs
16429                 eval $hasproto ;;
16430         *)      ;;
16431         esac
16432         case "$d_random_r_proto" in
16433         define)
16434         case "$random_r_proto" in
16435         ''|0) try='int random_r(int*, struct random_data*);'
16436         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16437         esac
16438         case "$random_r_proto" in
16439         ''|0) try='int random_r(long*, struct random_data*);'
16440         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16441         esac
16442         case "$random_r_proto" in
16443         ''|0) try='int random_r(struct random_data*, int32_t*);'
16444         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16445         esac
16446         case "$random_r_proto" in
16447         ''|0)   d_random_r=undef
16448                 random_r_proto=0
16449                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16450         * )     case "$random_r_proto" in
16451                 REENTRANT_PROTO*) ;;
16452                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16453                 esac
16454                 echo "Prototype: $try" ;;
16455         esac
16456         ;;
16457         *)      case "$usethreads" in
16458                 define) echo "random_r has no prototype, not using it." >&4 ;;
16459                 esac
16460                 d_random_r=undef
16461                 random_r_proto=0
16462                 ;;
16463         esac
16464         ;;
16465 *)      random_r_proto=0
16466         ;;
16467 esac
16468
16469 : see if readdir and friends exist
16470 set readdir d_readdir
16471 eval $inlibc
16472 set seekdir d_seekdir
16473 eval $inlibc
16474 set telldir d_telldir
16475 eval $inlibc
16476 set rewinddir d_rewinddir
16477 eval $inlibc
16478
16479 : see if readdir64_r exists
16480 set readdir64_r d_readdir64_r
16481 eval $inlibc
16482 case "$d_readdir64_r" in
16483 "$define")
16484         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16485         case "$d_readdir64_r_proto:$usethreads" in
16486         ":define")      d_readdir64_r_proto=define
16487                 set d_readdir64_r_proto readdir64_r $hdrs
16488                 eval $hasproto ;;
16489         *)      ;;
16490         esac
16491         case "$d_readdir64_r_proto" in
16492         define)
16493         case "$readdir64_r_proto" in
16494         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16495         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16496         esac
16497         case "$readdir64_r_proto" in
16498         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16499         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16500         esac
16501         case "$readdir64_r_proto" in
16502         ''|0)   d_readdir64_r=undef
16503                 readdir64_r_proto=0
16504                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16505         * )     case "$readdir64_r_proto" in
16506                 REENTRANT_PROTO*) ;;
16507                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16508                 esac
16509                 echo "Prototype: $try" ;;
16510         esac
16511         ;;
16512         *)      case "$usethreads" in
16513                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16514                 esac
16515                 d_readdir64_r=undef
16516                 readdir64_r_proto=0
16517                 ;;
16518         esac
16519         ;;
16520 *)      readdir64_r_proto=0
16521         ;;
16522 esac
16523
16524 : see if readdir_r exists
16525 set readdir_r d_readdir_r
16526 eval $inlibc
16527 case "$d_readdir_r" in
16528 "$define")
16529         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16530         case "$d_readdir_r_proto:$usethreads" in
16531         ":define")      d_readdir_r_proto=define
16532                 set d_readdir_r_proto readdir_r $hdrs
16533                 eval $hasproto ;;
16534         *)      ;;
16535         esac
16536         case "$d_readdir_r_proto" in
16537         define)
16538         case "$readdir_r_proto" in
16539         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16540         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16541         esac
16542         case "$readdir_r_proto" in
16543         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16544         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16545         esac
16546         case "$readdir_r_proto" in
16547         ''|0)   d_readdir_r=undef
16548                 readdir_r_proto=0
16549                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16550         * )     case "$readdir_r_proto" in
16551                 REENTRANT_PROTO*) ;;
16552                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16553                 esac
16554                 echo "Prototype: $try" ;;
16555         esac
16556         ;;
16557         *)      case "$usethreads" in
16558                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16559                 esac
16560                 d_readdir_r=undef
16561                 readdir_r_proto=0
16562                 ;;
16563         esac
16564         ;;
16565 *)      readdir_r_proto=0
16566         ;;
16567 esac
16568
16569 : see if readv exists
16570 set readv d_readv
16571 eval $inlibc
16572
16573 : see if recvmsg exists
16574 set recvmsg d_recvmsg
16575 eval $inlibc
16576
16577 : see if rename exists
16578 set rename d_rename
16579 eval $inlibc
16580
16581 : see if rmdir exists
16582 set rmdir d_rmdir
16583 eval $inlibc
16584
16585 : see if memory.h is available.
16586 val=''
16587 set memory.h val
16588 eval $inhdr
16589
16590 : See if it conflicts with string.h
16591 case "$val" in
16592 $define)
16593         case "$strings" in
16594         '') ;;
16595         *)
16596                 $cppstdin $cppflags $cppminus < $strings > mem.h
16597                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16598                         echo " "
16599                         echo "We won't be including <memory.h>."
16600                         val="$undef"
16601                 fi
16602                 $rm -f mem.h
16603                 ;;
16604         esac
16605 esac
16606 set i_memory
16607 eval $setvar
16608
16609 : can bcopy handle overlapping blocks?
16610 echo " "
16611 val="$undef"
16612 case "$d_memmove" in
16613 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16614 *)      case "$d_bcopy" in
16615         "$define")
16616                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16617                 $cat >try.c <<EOCP
16618 #$i_memory I_MEMORY
16619 #$i_stdlib I_STDLIB
16620 #$i_string I_STRING
16621 #$i_unistd I_UNISTD
16622 EOCP
16623         $cat >>try.c <<'EOCP'
16624 #include <stdio.h>
16625 #ifdef I_MEMORY
16626 #  include <memory.h>
16627 #endif
16628 #ifdef I_STDLIB
16629 #  include <stdlib.h>
16630 #endif
16631 #ifdef I_STRING
16632 #  include <string.h>
16633 #else
16634 #  include <strings.h>
16635 #endif
16636 #ifdef I_UNISTD
16637 #  include <unistd.h>  /* Needed for NetBSD */
16638 #endif
16639 int main()
16640 {
16641 char buf[128], abc[128];
16642 char *b;
16643 int len;
16644 int off;
16645 int align;
16646
16647 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16648    try to store the string in read-only memory. */
16649 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16650
16651 for (align = 7; align >= 0; align--) {
16652         for (len = 36; len; len--) {
16653                 b = buf+align;
16654                 bcopy(abc, b, len);
16655                 for (off = 1; off <= len; off++) {
16656                         bcopy(b, b+off, len);
16657                         bcopy(b+off, b, len);
16658                         if (bcmp(b, abc, len))
16659                                 exit(1);
16660                 }
16661         }
16662 }
16663 exit(0);
16664 }
16665 EOCP
16666                 set try
16667                 if eval $compile_ok; then
16668                         if $run ./try 2>/dev/null; then
16669                                 echo "Yes, it can."
16670                                 val="$define"
16671                         else
16672                                 echo "It can't, sorry."
16673                         fi
16674                 else
16675                         echo "(I can't compile the test program, so we'll assume not...)"
16676                 fi
16677                 ;;
16678         esac
16679         $rm_try
16680         ;;
16681 esac
16682 set d_safebcpy
16683 eval $setvar
16684
16685 : can memcpy handle overlapping blocks?
16686 echo " "
16687 val="$undef"
16688 case "$d_memmove" in
16689 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16690 *)      case "$d_memcpy" in
16691         "$define")
16692                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16693                 $cat >try.c <<EOCP
16694 #$i_memory I_MEMORY
16695 #$i_stdlib I_STDLIB
16696 #$i_string I_STRING
16697 #$i_unistd I_UNISTD
16698 EOCP
16699         $cat >>try.c <<'EOCP'
16700 #include <stdio.h>
16701 #ifdef I_MEMORY
16702 #  include <memory.h>
16703 #endif
16704 #ifdef I_STDLIB
16705 #  include <stdlib.h>
16706 #endif
16707 #ifdef I_STRING
16708 #  include <string.h>
16709 #else
16710 #  include <strings.h>
16711 #endif
16712 #ifdef I_UNISTD
16713 #  include <unistd.h>  /* Needed for NetBSD */
16714 #endif
16715 int main()
16716 {
16717 char buf[128], abc[128];
16718 char *b;
16719 int len;
16720 int off;
16721 int align;
16722
16723 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16724    try to store the string in read-only memory. */
16725 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16726
16727 for (align = 7; align >= 0; align--) {
16728         for (len = 36; len; len--) {
16729                 b = buf+align;
16730                 memcpy(b, abc, len);
16731                 for (off = 1; off <= len; off++) {
16732                         memcpy(b+off, b, len);
16733                         memcpy(b, b+off, len);
16734                         if (memcmp(b, abc, len))
16735                                 exit(1);
16736                 }
16737         }
16738 }
16739 exit(0);
16740 }
16741 EOCP
16742                 set try
16743                 if eval $compile_ok; then
16744                         if $run ./try 2>/dev/null; then
16745                                 echo "Yes, it can."
16746                                 val="$define"
16747                         else
16748                                 echo "It can't, sorry."
16749                         fi
16750                 else
16751                         echo "(I can't compile the test program, so we'll assume not...)"
16752                 fi
16753                 ;;
16754         esac
16755         $rm_try
16756         ;;
16757 esac
16758 set d_safemcpy
16759 eval $setvar
16760
16761 : can memcmp be trusted to compare relative magnitude?
16762 val="$undef"
16763 case "$d_memcmp" in
16764 "$define")
16765         echo " "
16766         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16767         $cat >try.c <<EOCP
16768 #$i_memory I_MEMORY
16769 #$i_stdlib I_STDLIB
16770 #$i_string I_STRING
16771 #$i_unistd I_UNISTD
16772 EOCP
16773         $cat >>try.c <<'EOCP'
16774 #include <stdio.h>
16775 #ifdef I_MEMORY
16776 #  include <memory.h>
16777 #endif
16778 #ifdef I_STDLIB
16779 #  include <stdlib.h>
16780 #endif
16781 #ifdef I_STRING
16782 #  include <string.h>
16783 #else
16784 #  include <strings.h>
16785 #endif
16786 #ifdef I_UNISTD
16787 #  include <unistd.h>  /* Needed for NetBSD */
16788 #endif
16789 int main()
16790 {
16791 char a = -1;
16792 char b = 0;
16793 if ((a < b) && memcmp(&a, &b, 1) < 0)
16794         exit(1);
16795 exit(0);
16796 }
16797 EOCP
16798         set try
16799         if eval $compile_ok; then
16800                 if $run ./try 2>/dev/null; then
16801                         echo "Yes, it can."
16802                         val="$define"
16803                 else
16804                         echo "No, it can't (it uses signed chars)."
16805                 fi
16806         else
16807                 echo "(I can't compile the test program, so we'll assume not...)"
16808         fi
16809         ;;
16810 esac
16811 $rm_try
16812 set d_sanemcmp
16813 eval $setvar
16814
16815 : see if prototype for sbrk is available
16816 echo " "
16817 set d_sbrkproto sbrk $i_unistd unistd.h
16818 eval $hasproto
16819
16820 : see if select exists
16821 set select d_select
16822 eval $inlibc
16823
16824 : see if semctl exists
16825 set semctl d_semctl
16826 eval $inlibc
16827
16828 : see if semget exists
16829 set semget d_semget
16830 eval $inlibc
16831
16832 : see if semop exists
16833 set semop d_semop
16834 eval $inlibc
16835
16836 : see how much of the 'sem*(2)' library is present.
16837 h_sem=true
16838 echo " "
16839 case "$d_semctl$d_semget$d_semop" in
16840 *"$undef"*) h_sem=false;;
16841 esac
16842 case "$osname" in
16843 freebsd)
16844     case "`ipcs 2>&1`" in
16845     "SVID messages"*"not configured"*)
16846         echo "Your $osname does not have the sem*(2) configured." >&4
16847         h_sem=false
16848         val="$undef"
16849         set semctl d_semctl
16850         eval $setvar
16851         set semget d_semget
16852         eval $setvar
16853         set semop d_semop
16854         eval $setvar
16855         ;;
16856     esac
16857     ;;
16858 esac
16859 : we could also check for sys/ipc.h ...
16860 if $h_sem && $test `./findhdr sys/sem.h`; then
16861         echo "You have the full sem*(2) library." >&4
16862         val="$define"
16863 else
16864         echo "You don't have the full sem*(2) library." >&4
16865         val="$undef"
16866 fi
16867 set d_sem
16868 eval $setvar
16869
16870 : see whether sys/sem.h defines union semun
16871 echo " "
16872 $cat > try.c <<'END'
16873 #include <sys/types.h>
16874 #include <sys/ipc.h>
16875 #include <sys/sem.h>
16876 int main () { union semun semun; semun.buf = 0; }
16877 END
16878 set try
16879 if eval $compile; then
16880     echo "You have union semun in <sys/sem.h>." >&4
16881     val="$define"
16882 else
16883     echo "You do not have union semun in <sys/sem.h>." >&4
16884     val="$undef"
16885 fi
16886 $rm_try
16887 set d_union_semun
16888 eval $setvar
16889
16890 : see how to do semctl IPC_STAT
16891 case "$d_sem" in
16892 $define)
16893     echo " "
16894     $cat > tryh.h <<END
16895 #ifndef S_IRUSR
16896 #   ifdef S_IREAD
16897 #       define S_IRUSR S_IREAD
16898 #       define S_IWUSR S_IWRITE
16899 #       define S_IXUSR S_IEXEC
16900 #   else
16901 #       define S_IRUSR 0400
16902 #       define S_IWUSR 0200
16903 #       define S_IXUSR 0100
16904 #   endif
16905 #   define S_IRGRP (S_IRUSR>>3)
16906 #   define S_IWGRP (S_IWUSR>>3)
16907 #   define S_IXGRP (S_IXUSR>>3)
16908 #   define S_IROTH (S_IRUSR>>6)
16909 #   define S_IWOTH (S_IWUSR>>6)
16910 #   define S_IXOTH (S_IXUSR>>6)
16911 #endif
16912 #ifndef S_IRWXU
16913 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16914 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16915 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16916 #endif
16917 END
16918     : see whether semctl IPC_STAT can use union semun
16919     case "$d_semctl_semun" in
16920     '')
16921       val="$undef"
16922       $cat > try.c <<END
16923 #include <sys/types.h>
16924 #include <sys/ipc.h>
16925 #include <sys/sem.h>
16926 #include <sys/stat.h>
16927 #include <stdio.h>
16928 #include <errno.h>
16929 #include "tryh.h"
16930 #ifndef errno
16931 extern int errno;
16932 #endif
16933 #$d_union_semun HAS_UNION_SEMUN
16934 int main() {
16935     union semun
16936 #ifndef HAS_UNION_SEMUN
16937     {
16938         int val;
16939         struct semid_ds *buf;
16940         unsigned short *array;
16941     }
16942 #endif
16943     arg;
16944     int sem, st;
16945
16946 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16947     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16948     if (sem > -1) {
16949         struct semid_ds argbuf;
16950         arg.buf = &argbuf;
16951 #       ifdef IPC_STAT
16952         st = semctl(sem, 0, IPC_STAT, arg);
16953         if (st == 0)
16954             printf("semun\n");
16955         else
16956 #       endif /* IPC_STAT */
16957             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16958 #       ifdef IPC_RMID
16959         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16960 #       endif /* IPC_RMID */
16961             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16962     } else
16963 #endif /* IPC_PRIVATE && ... */
16964         printf("semget failed: errno = %d\n", errno);
16965   return 0;
16966 }
16967 END
16968       set try
16969       if eval $compile; then
16970           xxx=`$run ./try`
16971           case "$xxx" in
16972           semun) val="$define" ;;
16973           esac
16974       fi
16975       $rm_try
16976       set d_semctl_semun
16977       eval $setvar
16978       ;;
16979     esac
16980     case "$d_semctl_semun" in
16981     $define)
16982         echo "You can use union semun for semctl IPC_STAT." >&4
16983         also='also'
16984         ;;
16985     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16986         also=''
16987         ;;
16988     esac
16989
16990     : see whether semctl IPC_STAT can use struct semid_ds pointer
16991     case "$d_semctl_semid_ds" in
16992     '')
16993       val="$undef"
16994       $cat > try.c <<'END'
16995 #include <sys/types.h>
16996 #include <sys/ipc.h>
16997 #include <sys/sem.h>
16998 #include <sys/stat.h>
16999 #include "tryh.h"
17000 #include <stdio.h>
17001 #include <errno.h>
17002 #ifndef errno
17003 extern int errno;
17004 #endif
17005 int main() {
17006     struct semid_ds arg;
17007     int sem, st;
17008
17009 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17010     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17011     if (sem > -1) {
17012 #       ifdef IPC_STAT
17013         st = semctl(sem, 0, IPC_STAT, &arg);
17014         if (st == 0)
17015             printf("semid_ds\n");
17016         else
17017 #       endif /* IPC_STAT */
17018             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17019 #       ifdef IPC_RMID
17020         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17021 #       endif /* IPC_RMID */
17022             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17023     } else
17024 #endif /* IPC_PRIVATE && ... */
17025         printf("semget failed: errno = %d\n", errno);
17026
17027     return 0;
17028 }
17029 END
17030       set try
17031       if eval $compile; then
17032           xxx=`$run ./try`
17033           case "$xxx" in
17034           semid_ds) val="$define" ;;
17035           esac
17036       fi
17037       $rm_try
17038       set d_semctl_semid_ds
17039       eval $setvar
17040       ;;
17041     esac
17042     case "$d_semctl_semid_ds" in
17043     $define)
17044         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17045         ;;
17046     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17047         ;;
17048     esac
17049     ;;
17050 *)  val="$undef"
17051
17052     # We do not have the full sem*(2) library, so assume we can not
17053     # use either.
17054
17055     set d_semctl_semun
17056     eval $setvar
17057
17058     set d_semctl_semid_ds
17059     eval $setvar
17060     ;;
17061 esac
17062 $rm_try tryh.h
17063
17064 : see if sendmsg exists
17065 set sendmsg d_sendmsg
17066 eval $inlibc
17067
17068 : see if setegid exists
17069 set setegid d_setegid
17070 eval $inlibc
17071
17072 : see if seteuid exists
17073 set seteuid d_seteuid
17074 eval $inlibc
17075
17076 : see if setgrent exists
17077 set setgrent d_setgrent
17078 eval $inlibc
17079
17080 : see if setgrent_r exists
17081 set setgrent_r d_setgrent_r
17082 eval $inlibc
17083 case "$d_setgrent_r" in
17084 "$define")
17085         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17086         case "$d_setgrent_r_proto:$usethreads" in
17087         ":define")      d_setgrent_r_proto=define
17088                 set d_setgrent_r_proto setgrent_r $hdrs
17089                 eval $hasproto ;;
17090         *)      ;;
17091         esac
17092         case "$d_setgrent_r_proto" in
17093         define)
17094         case "$setgrent_r_proto" in
17095         ''|0) try='int setgrent_r(FILE**);'
17096         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17097         esac
17098         case "$setgrent_r_proto" in
17099         ''|0) try='void setgrent_r(FILE**);'
17100         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17101         esac
17102         case "$setgrent_r_proto" in
17103         ''|0)   d_setgrent_r=undef
17104                 setgrent_r_proto=0
17105                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17106         * )     case "$setgrent_r_proto" in
17107                 REENTRANT_PROTO*) ;;
17108                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17109                 esac
17110                 echo "Prototype: $try" ;;
17111         esac
17112         ;;
17113         *)      case "$usethreads" in
17114                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17115                 esac
17116                 d_setgrent_r=undef
17117                 setgrent_r_proto=0
17118                 ;;
17119         esac
17120         ;;
17121 *)      setgrent_r_proto=0
17122         ;;
17123 esac
17124
17125 : see if sethostent exists
17126 set sethostent d_sethent
17127 eval $inlibc
17128
17129 : see if sethostent_r exists
17130 set sethostent_r d_sethostent_r
17131 eval $inlibc
17132 case "$d_sethostent_r" in
17133 "$define")
17134         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17135         case "$d_sethostent_r_proto:$usethreads" in
17136         ":define")      d_sethostent_r_proto=define
17137                 set d_sethostent_r_proto sethostent_r $hdrs
17138                 eval $hasproto ;;
17139         *)      ;;
17140         esac
17141         case "$d_sethostent_r_proto" in
17142         define)
17143         case "$sethostent_r_proto" in
17144         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17145         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17146         esac
17147         case "$sethostent_r_proto" in
17148         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17149         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17150         esac
17151         case "$sethostent_r_proto" in
17152         ''|0)   d_sethostent_r=undef
17153                 sethostent_r_proto=0
17154                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17155         * )     case "$sethostent_r_proto" in
17156                 REENTRANT_PROTO*) ;;
17157                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17158                 esac
17159                 echo "Prototype: $try" ;;
17160         esac
17161         ;;
17162         *)      case "$usethreads" in
17163                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17164                 esac
17165                 d_sethostent_r=undef
17166                 sethostent_r_proto=0
17167                 ;;
17168         esac
17169         ;;
17170 *)      sethostent_r_proto=0
17171         ;;
17172 esac
17173
17174 : see if setitimer exists
17175 set setitimer d_setitimer
17176 eval $inlibc
17177
17178 : see if setlinebuf exists
17179 set setlinebuf d_setlinebuf
17180 eval $inlibc
17181
17182 : see if setlocale exists
17183 set setlocale d_setlocale
17184 eval $inlibc
17185
17186 : see if locale.h is available
17187 set locale.h i_locale
17188 eval $inhdr
17189
17190 : see if setlocale_r exists
17191 set setlocale_r d_setlocale_r
17192 eval $inlibc
17193 case "$d_setlocale_r" in
17194 "$define")
17195         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17196         case "$d_setlocale_r_proto:$usethreads" in
17197         ":define")      d_setlocale_r_proto=define
17198                 set d_setlocale_r_proto setlocale_r $hdrs
17199                 eval $hasproto ;;
17200         *)      ;;
17201         esac
17202         case "$d_setlocale_r_proto" in
17203         define)
17204         case "$setlocale_r_proto" in
17205         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17206         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17207         esac
17208         case "$setlocale_r_proto" in
17209         ''|0)   d_setlocale_r=undef
17210                 setlocale_r_proto=0
17211                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17212         * )     case "$setlocale_r_proto" in
17213                 REENTRANT_PROTO*) ;;
17214                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17215                 esac
17216                 echo "Prototype: $try" ;;
17217         esac
17218         ;;
17219         *)      case "$usethreads" in
17220                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17221                 esac
17222                 d_setlocale_r=undef
17223                 setlocale_r_proto=0
17224                 ;;
17225         esac
17226         ;;
17227 *)      setlocale_r_proto=0
17228         ;;
17229 esac
17230
17231 : see if setnetent exists
17232 set setnetent d_setnent
17233 eval $inlibc
17234
17235 : see if setnetent_r exists
17236 set setnetent_r d_setnetent_r
17237 eval $inlibc
17238 case "$d_setnetent_r" in
17239 "$define")
17240         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17241         case "$d_setnetent_r_proto:$usethreads" in
17242         ":define")      d_setnetent_r_proto=define
17243                 set d_setnetent_r_proto setnetent_r $hdrs
17244                 eval $hasproto ;;
17245         *)      ;;
17246         esac
17247         case "$d_setnetent_r_proto" in
17248         define)
17249         case "$setnetent_r_proto" in
17250         ''|0) try='int setnetent_r(int, struct netent_data*);'
17251         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17252         esac
17253         case "$setnetent_r_proto" in
17254         ''|0) try='void setnetent_r(int, struct netent_data*);'
17255         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17256         esac
17257         case "$setnetent_r_proto" in
17258         ''|0)   d_setnetent_r=undef
17259                 setnetent_r_proto=0
17260                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17261         * )     case "$setnetent_r_proto" in
17262                 REENTRANT_PROTO*) ;;
17263                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17264                 esac
17265                 echo "Prototype: $try" ;;
17266         esac
17267         ;;
17268         *)      case "$usethreads" in
17269                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17270                 esac
17271                 d_setnetent_r=undef
17272                 setnetent_r_proto=0
17273                 ;;
17274         esac
17275         ;;
17276 *)      setnetent_r_proto=0
17277         ;;
17278 esac
17279
17280 : see if setprotoent exists
17281 set setprotoent d_setpent
17282 eval $inlibc
17283
17284 : see if setpgid exists
17285 set setpgid d_setpgid
17286 eval $inlibc
17287
17288 : see if setpgrp2 exists
17289 set setpgrp2 d_setpgrp2
17290 eval $inlibc
17291
17292 : see if setpriority exists
17293 set setpriority d_setprior
17294 eval $inlibc
17295
17296 : see if setproctitle exists
17297 set setproctitle d_setproctitle
17298 eval $inlibc
17299
17300 : see if setprotoent_r exists
17301 set setprotoent_r d_setprotoent_r
17302 eval $inlibc
17303 case "$d_setprotoent_r" in
17304 "$define")
17305         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17306         case "$d_setprotoent_r_proto:$usethreads" in
17307         ":define")      d_setprotoent_r_proto=define
17308                 set d_setprotoent_r_proto setprotoent_r $hdrs
17309                 eval $hasproto ;;
17310         *)      ;;
17311         esac
17312         case "$d_setprotoent_r_proto" in
17313         define)
17314         case "$setprotoent_r_proto" in
17315         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17316         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17317         esac
17318         case "$setprotoent_r_proto" in
17319         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17320         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17321         esac
17322         case "$setprotoent_r_proto" in
17323         ''|0)   d_setprotoent_r=undef
17324                 setprotoent_r_proto=0
17325                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17326         * )     case "$setprotoent_r_proto" in
17327                 REENTRANT_PROTO*) ;;
17328                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17329                 esac
17330                 echo "Prototype: $try" ;;
17331         esac
17332         ;;
17333         *)      case "$usethreads" in
17334                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17335                 esac
17336                 d_setprotoent_r=undef
17337                 setprotoent_r_proto=0
17338                 ;;
17339         esac
17340         ;;
17341 *)      setprotoent_r_proto=0
17342         ;;
17343 esac
17344
17345 : see if setpwent exists
17346 set setpwent d_setpwent
17347 eval $inlibc
17348
17349 : see if setpwent_r exists
17350 set setpwent_r d_setpwent_r
17351 eval $inlibc
17352 case "$d_setpwent_r" in
17353 "$define")
17354         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17355         case "$d_setpwent_r_proto:$usethreads" in
17356         ":define")      d_setpwent_r_proto=define
17357                 set d_setpwent_r_proto setpwent_r $hdrs
17358                 eval $hasproto ;;
17359         *)      ;;
17360         esac
17361         case "$d_setpwent_r_proto" in
17362         define)
17363         case "$setpwent_r_proto" in
17364         ''|0) try='int setpwent_r(FILE**);'
17365         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17366         esac
17367         case "$setpwent_r_proto" in
17368         ''|0) try='void setpwent_r(FILE**);'
17369         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17370         esac
17371         case "$setpwent_r_proto" in
17372         ''|0)   d_setpwent_r=undef
17373                 setpwent_r_proto=0
17374                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17375         * )     case "$setpwent_r_proto" in
17376                 REENTRANT_PROTO*) ;;
17377                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17378                 esac
17379                 echo "Prototype: $try" ;;
17380         esac
17381         ;;
17382         *)      case "$usethreads" in
17383                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17384                 esac
17385                 d_setpwent_r=undef
17386                 setpwent_r_proto=0
17387                 ;;
17388         esac
17389         ;;
17390 *)      setpwent_r_proto=0
17391         ;;
17392 esac
17393
17394 : see if setregid exists
17395 set setregid d_setregid
17396 eval $inlibc
17397 set setresgid d_setresgid
17398 eval $inlibc
17399
17400 : see if setreuid exists
17401 set setreuid d_setreuid
17402 eval $inlibc
17403 set setresuid d_setresuid
17404 eval $inlibc
17405
17406 : see if setrgid exists
17407 set setrgid d_setrgid
17408 eval $inlibc
17409
17410 : see if setruid exists
17411 set setruid d_setruid
17412 eval $inlibc
17413
17414 : see if setservent exists
17415 set setservent d_setsent
17416 eval $inlibc
17417
17418 : see if setservent_r exists
17419 set setservent_r d_setservent_r
17420 eval $inlibc
17421 case "$d_setservent_r" in
17422 "$define")
17423         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17424         case "$d_setservent_r_proto:$usethreads" in
17425         ":define")      d_setservent_r_proto=define
17426                 set d_setservent_r_proto setservent_r $hdrs
17427                 eval $hasproto ;;
17428         *)      ;;
17429         esac
17430         case "$d_setservent_r_proto" in
17431         define)
17432         case "$setservent_r_proto" in
17433         ''|0) try='int setservent_r(int, struct servent_data*);'
17434         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17435         esac
17436         case "$setservent_r_proto" in
17437         ''|0) try='void setservent_r(int, struct servent_data*);'
17438         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17439         esac
17440         case "$setservent_r_proto" in
17441         ''|0)   d_setservent_r=undef
17442                 setservent_r_proto=0
17443                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17444         * )     case "$setservent_r_proto" in
17445                 REENTRANT_PROTO*) ;;
17446                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17447                 esac
17448                 echo "Prototype: $try" ;;
17449         esac
17450         ;;
17451         *)      case "$usethreads" in
17452                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17453                 esac
17454                 d_setservent_r=undef
17455                 setservent_r_proto=0
17456                 ;;
17457         esac
17458         ;;
17459 *)      setservent_r_proto=0
17460         ;;
17461 esac
17462
17463 : see if setsid exists
17464 set setsid d_setsid
17465 eval $inlibc
17466
17467 : see if setvbuf exists
17468 set setvbuf d_setvbuf
17469 eval $inlibc
17470
17471 : see if sfio.h is available
17472 set sfio.h i_sfio
17473 eval $inhdr
17474
17475 : see if sfio library is available
17476 case "$i_sfio" in
17477 $define)
17478         val=''
17479         set sfreserve val
17480         eval $inlibc
17481         ;;
17482 *)
17483         val="$undef"
17484         ;;
17485 esac
17486 : Ok, but do we want to use it.
17487 case "$val" in
17488 $define)
17489         case "$usesfio" in
17490         true|$define|[yY]*) dflt='y';;
17491         *) dflt='n';;
17492         esac
17493         echo "$package can use the sfio library, but it is experimental."
17494         rp="You seem to have sfio available, do you want to try using it?"
17495         . ./myread
17496         case "$ans" in
17497         y|Y)    echo "Ok, turning on sfio then."
17498                 val="$define"
17499                 ;;
17500         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17501                 val="$undef"
17502                 ;;
17503         esac
17504         ;;
17505 *)      case "$usesfio" in
17506         true|$define|[yY]*)
17507                 echo "Sorry, cannot find sfio on this machine." >&4
17508                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17509                 val="$undef"
17510                 ;;
17511         esac
17512         ;;
17513 esac
17514 set d_sfio
17515 eval $setvar
17516 case "$d_sfio" in
17517 $define) usesfio='true';;
17518 *) usesfio='false';;
17519 esac
17520 case "$d_sfio" in
17521 $define) ;;
17522 *)      : Remove sfio from list of libraries to use
17523         case "$libs" in
17524         *-lsfio*)
17525                 echo "Removing unneeded -lsfio from library list" >&4
17526                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17527                 shift
17528                 libs="$*"
17529                 echo "libs = $libs" >&4
17530                 ;;
17531         esac
17532 ;;
17533 esac
17534
17535
17536 : see if shmctl exists
17537 set shmctl d_shmctl
17538 eval $inlibc
17539
17540 : see if shmget exists
17541 set shmget d_shmget
17542 eval $inlibc
17543
17544 : see if shmat exists
17545 set shmat d_shmat
17546 eval $inlibc
17547 : see what shmat returns
17548 case "$d_shmat" in
17549 "$define")
17550         $cat >shmat.c <<'END'
17551 #include <sys/shm.h>
17552 void *shmat();
17553 END
17554         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17555                 shmattype='void *'
17556         else
17557                 shmattype='char *'
17558         fi
17559         echo "and it returns ($shmattype)." >&4
17560         : see if a prototype for shmat is available
17561         xxx=`./findhdr sys/shm.h`
17562         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17563         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17564                 val="$define"
17565         else
17566                 val="$undef"
17567         fi
17568         $rm -f shmat.[co]
17569         ;;
17570 *)
17571         val="$undef"
17572         ;;
17573 esac
17574 set d_shmatprototype
17575 eval $setvar
17576
17577 : see if shmdt exists
17578 set shmdt d_shmdt
17579 eval $inlibc
17580
17581 : see how much of the 'shm*(2)' library is present.
17582 h_shm=true
17583 echo " "
17584 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17585 *"$undef"*) h_shm=false;;
17586 esac
17587 case "$osname" in
17588 freebsd)
17589     case "`ipcs 2>&1`" in
17590     "SVID shared memory"*"not configured"*)
17591         echo "Your $osname does not have the shm*(2) configured." >&4
17592         h_shm=false
17593         val="$undef"
17594         set shmctl d_shmctl
17595         evat $setvar
17596         set shmget d_shmget
17597         evat $setvar
17598         set shmat d_shmat
17599         evat $setvar
17600         set shmdt d_shmdt
17601         evat $setvar
17602         ;;
17603     esac
17604     ;;
17605 esac
17606 : we could also check for sys/ipc.h ...
17607 if $h_shm && $test `./findhdr sys/shm.h`; then
17608         echo "You have the full shm*(2) library." >&4
17609         val="$define"
17610 else
17611         echo "You don't have the full shm*(2) library." >&4
17612         val="$undef"
17613 fi
17614 set d_shm
17615 eval $setvar
17616
17617 : see if we have sigaction
17618 echo " "
17619 if set sigaction val -f d_sigaction; eval $csym; $val; then
17620         echo 'sigaction() found.' >&4
17621         $cat > try.c <<EOP
17622 #include <stdio.h>
17623 #include <sys/types.h>
17624 #include <signal.h>
17625 #$i_stdlib I_STDLIB
17626 #ifdef I_STDLIB
17627 #include <stdlib.h>
17628 #endif
17629 int main()
17630 {
17631     struct sigaction act, oact;
17632     act.sa_flags = 0;
17633     oact.sa_handler = 0;
17634     /* so that act and oact are used */
17635     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17636 }
17637 EOP
17638         set try
17639         if eval $compile_ok; then
17640                 val="$define"
17641         else
17642                 echo "But you don't seem to have a useable struct sigaction." >&4
17643                 val="$undef"
17644         fi
17645 else
17646         echo 'sigaction NOT found.' >&4
17647         val="$undef"
17648 fi
17649 set d_sigaction; eval $setvar
17650 $rm_try
17651
17652 : see if this is a sunmath.h system
17653 set sunmath.h i_sunmath
17654 eval $inhdr
17655
17656 : see if signbit exists
17657 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17658 $cat >try.c <<EOCP
17659 #$i_math I_MATH
17660 #$i_sunmath I_SUNMATH
17661 #ifdef I_MATH
17662 #  include <math.h>
17663 #endif
17664 #ifdef I_SUNMATH  /* Solaris special math library */
17665 #  include <sunmath.h>
17666 #endif
17667 #define NV $nvtype
17668 int main(int argc, char **argv)
17669 {
17670     NV x = 0.0;
17671     NV y = -0.0;
17672     if ((signbit(x) == 0) && (signbit(y) != 0))
17673         return 0;
17674     else
17675         return 1;
17676 }
17677 EOCP
17678 val="$undef"
17679 set try
17680 if eval $compile; then
17681     if $run ./try; then
17682         $echo "Yes." >&4
17683         val="$define"
17684     else
17685         $echo "Signbit seems to be available, but doesn't work as I expected."
17686         $echo "I won't use it." >&4
17687         val="$undef"
17688     fi
17689 else
17690     $echo "Nope." >&4
17691     dflt="$undef"
17692 fi
17693 set d_signbit
17694 eval $setvar
17695 $rm_try
17696
17697 : see if sigprocmask exists
17698 set sigprocmask d_sigprocmask
17699 eval $inlibc
17700
17701 : see if sigsetjmp exists
17702 echo " "
17703 case "$d_sigsetjmp" in
17704 '')
17705         $cat >try.c <<EOP
17706 #include <setjmp.h>
17707 #$i_stdlib I_STDLIB
17708 #ifdef I_STDLIB
17709 #include <stdlib.h>
17710 #endif
17711 sigjmp_buf env;
17712 int set = 1;
17713 int main()
17714 {
17715         if (sigsetjmp(env,1))
17716                 exit(set);
17717         set = 0;
17718         siglongjmp(env, 1);
17719         exit(1);
17720 }
17721 EOP
17722         set try
17723         if eval $compile; then
17724                 if $run ./try >/dev/null 2>&1; then
17725                         echo "POSIX sigsetjmp found." >&4
17726                         val="$define"
17727                 else
17728                         $cat >&4 <<EOM
17729 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17730 I'll ignore them.
17731 EOM
17732                         val="$undef"
17733                 fi
17734         else
17735                 echo "sigsetjmp not found." >&4
17736                 val="$undef"
17737         fi
17738         ;;
17739 *) val="$d_sigsetjmp"
17740         case "$d_sigsetjmp" in
17741         $define) echo "POSIX sigsetjmp found." >&4;;
17742         $undef) echo "sigsetjmp not found." >&4;;
17743         esac
17744         ;;
17745 esac
17746 set d_sigsetjmp
17747 eval $setvar
17748 $rm_try
17749
17750 : see if snprintf exists
17751 set snprintf d_snprintf
17752 eval $inlibc
17753
17754 : see if vsnprintf exists
17755 set vsnprintf d_vsnprintf
17756 eval $inlibc
17757
17758 case "$d_snprintf-$d_vsnprintf" in
17759 "$define-$define")
17760     $cat <<EOM
17761 Checking whether your snprintf() and vsnprintf() work okay...
17762 EOM
17763     $cat >try.c <<'EOCP'
17764 /* v?snprintf testing logic courtesy of Russ Allbery.
17765  * According to C99:
17766  * - if the buffer is too short it still must be \0-terminated
17767  * - if the buffer is too short the potentially required length
17768  *   must be returned and not -1
17769  * - if the buffer is NULL the potentially required length
17770  *   must be returned and not -1 or core dump
17771  */
17772 #include <stdio.h>
17773 #include <stdarg.h>
17774
17775 char buf[2];
17776
17777 int test (char *format, ...)
17778 {
17779     va_list args;
17780     int count;
17781
17782     va_start (args, format);
17783     count = vsnprintf (buf, sizeof buf, format, args);
17784     va_end (args);
17785     return count;
17786 }
17787
17788 int main ()
17789 {
17790     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17791              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17792 }
17793 EOCP
17794     set try
17795     if eval $compile; then
17796         `$run ./try`
17797         case "$?" in
17798         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17799         *) cat <<EOM >&4
17800 Your snprintf() and snprintf() don't seem to be working okay.
17801 EOM
17802            d_snprintf="$undef"
17803            d_vsnprintf="$undef"
17804            ;;
17805         esac
17806     else
17807         echo "(I can't seem to compile the test program--assuming they don't)"
17808         d_snprintf="$undef"
17809         d_vsnprintf="$undef"
17810     fi
17811     $rm_try
17812     ;;
17813 esac
17814
17815 : see if sockatmark exists
17816 set sockatmark d_sockatmark
17817 eval $inlibc
17818
17819 : see if prototype for sockatmark is available
17820 echo " "
17821 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17822 eval $hasproto
17823
17824 : see if socks5_init exists
17825 set socks5_init d_socks5_init
17826 eval $inlibc
17827
17828 : see if sprintf returns the length of the string in the buffer as per ANSI
17829 $echo "Checking whether sprintf returns the length of the string..." >&4
17830 $cat <<EOP >try.c
17831 #include <stdio.h>
17832 #$i_stdlib I_STDLIB
17833 #ifdef I_STDLIB
17834 #include <stdlib.h>
17835 #endif
17836 #$i_string I_STRING
17837 #ifdef I_STRING
17838 #  include <string.h>
17839 #else
17840 #  include <strings.h>
17841 #endif
17842 #$i_math I_MATH
17843 #ifdef I_MATH
17844 #include <math.h>
17845 #endif
17846
17847 char buffer[256];
17848
17849 int check (size_t expect, int test) {
17850   size_t got = strlen(buffer);
17851   if (expect == got)
17852     return 0;
17853
17854   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17855        test, buffer);
17856   exit (test);
17857 }
17858
17859 int main(int argc, char **argv) {
17860   int test = 0;
17861
17862   check(sprintf(buffer, ""), ++test);
17863   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17864   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17865
17866   return 0;
17867 }
17868 EOP
17869 set try
17870
17871 if eval $compile; then
17872     xxx="`$run ./try`"
17873     case "$?" in
17874         0) cat >&4 <<EOM
17875 sprintf returns the length of the string (as ANSI says it should)
17876 EOM
17877         d_sprintf_returns_strlen="$define"
17878         ;;
17879         *) cat >&4 <<EOM
17880 sprintf does not return the length of the string (how old is this system?)
17881 EOM
17882         d_sprintf_returns_strlen="$undef"
17883         ;;
17884     esac
17885 else
17886     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17887     d_sprintf_returns_strlen="$undef"
17888 fi
17889 $rm_try
17890
17891 : see if srand48_r exists
17892 set srand48_r d_srand48_r
17893 eval $inlibc
17894 case "$d_srand48_r" in
17895 "$define")
17896         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17897         case "$d_srand48_r_proto:$usethreads" in
17898         ":define")      d_srand48_r_proto=define
17899                 set d_srand48_r_proto srand48_r $hdrs
17900                 eval $hasproto ;;
17901         *)      ;;
17902         esac
17903         case "$d_srand48_r_proto" in
17904         define)
17905         case "$srand48_r_proto" in
17906         ''|0) try='int srand48_r(long, struct drand48_data*);'
17907         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17908         esac
17909         case "$srand48_r_proto" in
17910         ''|0)   d_srand48_r=undef
17911                 srand48_r_proto=0
17912                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17913         * )     case "$srand48_r_proto" in
17914                 REENTRANT_PROTO*) ;;
17915                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17916                 esac
17917                 echo "Prototype: $try" ;;
17918         esac
17919         ;;
17920         *)      case "$usethreads" in
17921                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17922                 esac
17923                 d_srand48_r=undef
17924                 srand48_r_proto=0
17925                 ;;
17926         esac
17927         ;;
17928 *)      srand48_r_proto=0
17929         ;;
17930 esac
17931
17932 : see if srandom_r exists
17933 set srandom_r d_srandom_r
17934 eval $inlibc
17935 case "$d_srandom_r" in
17936 "$define")
17937         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17938         case "$d_srandom_r_proto:$usethreads" in
17939         ":define")      d_srandom_r_proto=define
17940                 set d_srandom_r_proto srandom_r $hdrs
17941                 eval $hasproto ;;
17942         *)      ;;
17943         esac
17944         case "$d_srandom_r_proto" in
17945         define)
17946         case "$srandom_r_proto" in
17947         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17948         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17949         esac
17950         case "$srandom_r_proto" in
17951         ''|0)   d_srandom_r=undef
17952                 srandom_r_proto=0
17953                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17954         * )     case "$srandom_r_proto" in
17955                 REENTRANT_PROTO*) ;;
17956                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17957                 esac
17958                 echo "Prototype: $try" ;;
17959         esac
17960         ;;
17961         *)      case "$usethreads" in
17962                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17963                 esac
17964                 d_srandom_r=undef
17965                 srandom_r_proto=0
17966                 ;;
17967         esac
17968         ;;
17969 *)      srandom_r_proto=0
17970         ;;
17971 esac
17972
17973 : see if prototype for setresgid is available
17974 echo " "
17975 set d_sresgproto setresgid $i_unistd unistd.h
17976 eval $hasproto
17977
17978 : see if prototype for setresuid is available
17979 echo " "
17980 set d_sresuproto setresuid $i_unistd unistd.h
17981 eval $hasproto
17982
17983 : see if sys/stat.h is available
17984 set sys/stat.h i_sysstat
17985 eval $inhdr
17986
17987 : see if stat knows about block sizes
17988 echo " "
17989 echo "Checking to see if your struct stat has st_blocks field..." >&4
17990 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17991 eval $hasfield
17992
17993 : see if this is a sys/vfs.h system
17994 set sys/vfs.h i_sysvfs
17995 eval $inhdr
17996
17997 : see if this is a sys/statfs.h system
17998 set sys/statfs.h i_sysstatfs
17999 eval $inhdr
18000
18001 : Check for statfs_s
18002 echo " "
18003 echo "Checking to see if your system supports struct statfs..." >&4
18004 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
18005 eval $hasstruct
18006 case "$d_statfs_s" in
18007 "$define")      echo "Yes, it does."   ;;
18008 *)              echo "No, it doesn't." ;;
18009 esac
18010
18011
18012 : see if struct statfs knows about f_flags
18013 case "$d_statfs_s" in
18014 define)
18015         echo " "
18016         echo "Checking to see if your struct statfs has f_flags field..." >&4
18017         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
18018         eval $hasfield
18019         ;;
18020 *)      val="$undef"
18021         set d_statfs_f_flags
18022         eval $setvar
18023         ;;
18024 esac
18025 case "$d_statfs_f_flags" in
18026 "$define")      echo "Yes, it does."   ;;
18027 *)              echo "No, it doesn't." ;;
18028 esac
18029
18030 : see what flavor, if any, of static inline is supported
18031 echo " "
18032 echo "Checking to see if your system supports static inline..."
18033 $cat > try.c <<'EOCP'
18034 #include <stdlib.h>
18035 extern int f_via_a(int x);
18036 extern int f_via_b(int x);
18037 int main(int argc, char **argv)
18038 {
18039     int y;
18040
18041     y = f_via_a(0);
18042 #ifdef USE_B
18043     y = f_via_b(0);
18044 #endif
18045     if (y == 42) {
18046         return EXIT_SUCCESS;
18047     }
18048     else {
18049         return EXIT_FAILURE;
18050     }
18051 }
18052 EOCP
18053 $cat > a.c <<'EOCP'
18054 static INLINE int f(int x) {
18055     int y;
18056     y = x + 42;
18057     return y;
18058 }
18059
18060 int f_via_a(int x)
18061 {
18062     return f(x);
18063 }
18064 EOCP
18065 $cat > b.c <<'EOCP'
18066 extern int f(int x);
18067
18068 int f_via_b(int x)
18069 {
18070     return f(x);
18071 }
18072 EOCP
18073
18074 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18075 case "$perl_static_inline" in
18076 '')     # Check the various possibilities, and break out on success.
18077         # For gcc, prefer __inline__, which will still permit 
18078         # cflags.SH to add in -ansi.
18079         case "$gccversion" in
18080                 '') xxx="inline __inline__ __inline _inline";;
18081                 *)  xxx="__inline__ inline __inline _inline";;
18082         esac
18083         for inline in $xxx; do
18084                 set try -DINLINE=$inline a.c
18085                 if eval $compile && $run ./try; then
18086                         # Now make sure there is no external linkage of static
18087                         # functions
18088                         set try -DINLINE=$inline -DUSE_B a.c b.c
18089                         if eval $compile && $run ./try; then
18090                                 $echo "Your compiler supports static $inline, " >&4
18091                                 $echo "but it also creates an external definition," >&4
18092                                 $echo "so I won't use it." >&4
18093                                 val=$undef
18094                         else
18095                                 $echo "Your compiler supports static $inline." >&4
18096                                 val=$define
18097                                 perl_static_inline="static $inline";
18098                                 break;
18099                         fi
18100                 else
18101                         $echo "Your compiler does NOT support static $inline." >&4
18102                         val="$undef"
18103                 fi
18104         done
18105         ;;
18106 *inline*) # Some variant of inline exists.
18107         echo "Keeping your $hint value of $perl_static_inline."
18108         val=$define
18109         ;;
18110 static)  # No inline capabilities
18111         echo "Keeping your $hint value of $perl_static_inline."
18112         val=$undef
18113         ;;
18114 *)  # Unrecognized previous value -- blindly trust the supplied
18115         # value and hope it makes sense.  Use old value for
18116         # d_static_inline, if there is one.
18117         echo "Keeping your $hint value of $perl_static_inline."
18118         case "$d_static_inline" in
18119                 '') val=$define ;;
18120                 *)  val=$d_static_inline ;;
18121         esac
18122         ;;
18123 esac
18124 # Fallback to plain 'static' if nothing worked.
18125 case "$perl_static_inline" in
18126 '')
18127         perl_static_inline="static"
18128         val=$undef
18129         ;;
18130 esac
18131 set d_static_inline
18132 eval $setvar
18133 $rm -f a.[co] b.[co]
18134 $rm_try
18135
18136 : Check stream access
18137 $cat >&4 <<EOM
18138 Checking how to access stdio streams by file descriptor number...
18139 EOM
18140 case "$stdio_stream_array" in
18141 '')     $cat >try.c <<EOCP
18142 #include <stdio.h>
18143 int main() {
18144   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18145     printf("yes\n");
18146 }
18147 EOCP
18148         for s in _iob __iob __sF
18149         do
18150                 set try -DSTDIO_STREAM_ARRAY=$s
18151                 if eval $compile; then
18152                         case "`$run ./try`" in
18153                         yes)    stdio_stream_array=$s; break ;;
18154                         esac
18155                 fi
18156         done
18157         $rm_try
18158 esac
18159 case "$stdio_stream_array" in
18160 '')     $cat >&4 <<EOM
18161 I can't figure out how to access stdio streams by file descriptor number.
18162 EOM
18163         d_stdio_stream_array="$undef"
18164         ;;
18165 *)      $cat >&4 <<EOM
18166 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18167 EOM
18168         d_stdio_stream_array="$define"
18169         ;;
18170 esac
18171
18172 : see if strcoll exists
18173 set strcoll d_strcoll
18174 eval $inlibc
18175
18176 : check for structure copying
18177 echo " "
18178 echo "Checking to see if your C compiler can copy structs..." >&4
18179 $cat >try.c <<'EOCP'
18180 int main()
18181 {
18182         struct blurfl {
18183                 int dyick;
18184         } foo, bar;
18185
18186         foo = bar;
18187 }
18188 EOCP
18189 if $cc -c try.c >/dev/null 2>&1 ; then
18190         val="$define"
18191         echo "Yup, it can."
18192 else
18193         val="$undef"
18194         echo "Nope, it can't."
18195 fi
18196 set d_strctcpy
18197 eval $setvar
18198 $rm_try
18199
18200 : see if strerror and/or sys_errlist[] exist
18201 echo " "
18202 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18203     if set strerror val -f d_strerror; eval $csym; $val; then
18204                 echo 'strerror() found.' >&4
18205                 d_strerror="$define"
18206                 d_strerrm='strerror(e)'
18207                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18208                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
18209                         d_syserrlst="$define"
18210                 else
18211                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
18212                         d_syserrlst="$undef"
18213                 fi
18214     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18215                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18216                 echo 'strerror() found in string header.' >&4
18217                 d_strerror="$define"
18218                 d_strerrm='strerror(e)'
18219                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18220                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18221                                 d_syserrlst="$define"
18222                 else
18223                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18224                         d_syserrlst="$undef"
18225                 fi
18226     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18227                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18228                 d_strerror="$undef"
18229                 d_syserrlst="$define"
18230                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18231     else
18232                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18233                 d_strerror="$undef"
18234                 d_syserrlst="$undef"
18235                 d_strerrm='"unknown"'
18236     fi
18237 fi
18238
18239 : see if strerror_r exists
18240 set strerror_r d_strerror_r
18241 eval $inlibc
18242 case "$d_strerror_r" in
18243 "$define")
18244         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18245         case "$d_strerror_r_proto:$usethreads" in
18246         ":define")      d_strerror_r_proto=define
18247                 set d_strerror_r_proto strerror_r $hdrs
18248                 eval $hasproto ;;
18249         *)      ;;
18250         esac
18251         case "$d_strerror_r_proto" in
18252         define)
18253         case "$strerror_r_proto" in
18254         ''|0) try='int strerror_r(int, char*, size_t);'
18255         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18256         esac
18257         case "$strerror_r_proto" in
18258         ''|0) try='int strerror_r(int, char*, int);'
18259         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18260         esac
18261         case "$strerror_r_proto" in
18262         ''|0) try='char* strerror_r(int, char*, size_t);'
18263         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18264         esac
18265         case "$strerror_r_proto" in
18266         ''|0)   d_strerror_r=undef
18267                 strerror_r_proto=0
18268                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18269         * )     case "$strerror_r_proto" in
18270                 REENTRANT_PROTO*) ;;
18271                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18272                 esac
18273                 echo "Prototype: $try" ;;
18274         esac
18275         ;;
18276         *)      case "$usethreads" in
18277                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18278                 esac
18279                 d_strerror_r=undef
18280                 strerror_r_proto=0
18281                 ;;
18282         esac
18283         ;;
18284 *)      strerror_r_proto=0
18285         ;;
18286 esac
18287
18288 : see if strftime exists
18289 set strftime d_strftime
18290 eval $inlibc
18291
18292 : see if strlcat exists
18293 set strlcat d_strlcat
18294 eval $inlibc
18295
18296 : see if strlcpy exists
18297 set strlcpy d_strlcpy
18298 eval $inlibc
18299
18300 : see if strtod exists
18301 set strtod d_strtod
18302 eval $inlibc
18303
18304 : see if strtol exists
18305 set strtol d_strtol
18306 eval $inlibc
18307
18308 : see if strtold exists
18309 set strtold d_strtold
18310 eval $inlibc
18311
18312 : see if strtoll exists
18313 set strtoll d_strtoll
18314 eval $inlibc
18315
18316 case "$d_longlong-$d_strtoll" in
18317 "$define-$define")
18318         $cat <<EOM
18319 Checking whether your strtoll() works okay...
18320 EOM
18321         $cat >try.c <<'EOCP'
18322 #include <errno.h>
18323 #ifdef __hpux
18324 #define strtoll __strtoll
18325 #endif
18326 #ifdef __EMX__
18327 #define strtoll _strtoll
18328 #endif
18329 #include <stdio.h>
18330 extern long long int strtoll(char *s, char **, int);
18331 static int bad = 0;
18332 int check(char *s, long long ell, int een) {
18333         long long gll;
18334         errno = 0;
18335         gll = strtoll(s, 0, 10);
18336         if (!((gll == ell) && (errno == een)))
18337                 bad++;
18338 }
18339 int main() {
18340         check(" 1",                                      1LL, 0);
18341         check(" 0",                                      0LL, 0);
18342         check("-1",                                     -1LL, 0);
18343         check("-9223372036854775808", -9223372036854775808LL, 0);
18344         check("-9223372036854775808", -9223372036854775808LL, 0);
18345         check(" 9223372036854775807",  9223372036854775807LL, 0);
18346         check("-9223372036854775808", -9223372036854775808LL, 0);
18347         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18348         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18349         if (!bad)
18350                 printf("ok\n");
18351 }
18352 EOCP
18353         set try
18354         if eval $compile; then
18355                 yyy=`$run ./try`
18356                 case "$yyy" in
18357                 ok) echo "Your strtoll() seems to be working okay." ;;
18358                 *) cat <<EOM >&4
18359 Your strtoll() doesn't seem to be working okay.
18360 EOM
18361                    d_strtoll="$undef"
18362                    ;;
18363                 esac
18364         else
18365                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18366                 d_strtoll="$undef"
18367         fi
18368         ;;
18369 esac
18370
18371 : see if strtoq exists
18372 set strtoq d_strtoq
18373 eval $inlibc
18374
18375 : see if strtoul exists
18376 set strtoul d_strtoul
18377 eval $inlibc
18378
18379 case "$d_strtoul" in
18380 "$define")
18381         $cat <<EOM
18382 Checking whether your strtoul() works okay...
18383 EOM
18384         $cat >try.c <<'EOCP'
18385 #include <errno.h>
18386 #include <stdio.h>
18387 extern unsigned long int strtoul(char *s, char **, int);
18388 static int bad = 0;
18389 void check(char *s, unsigned long eul, int een) {
18390         unsigned long gul;
18391         errno = 0;
18392         gul = strtoul(s, 0, 10);
18393         if (!((gul == eul) && (errno == een)))
18394                 bad++;
18395 }
18396 int main() {
18397         check(" 1", 1L, 0);
18398         check(" 0", 0L, 0);
18399 EOCP
18400         case "$longsize" in
18401         8)
18402             $cat >>try.c <<'EOCP'
18403         check("18446744073709551615", 18446744073709551615UL, 0);
18404         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18405 #if 0 /* strtoul() for /^-/ strings is undefined. */
18406         check("-1", 18446744073709551615UL, 0);
18407         check("-18446744073709551614", 2, 0);
18408         check("-18446744073709551615", 1, 0);
18409         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18410         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18411 #endif
18412 EOCP
18413                 ;;
18414         4)
18415                     $cat >>try.c <<'EOCP'
18416         check("4294967295", 4294967295UL, 0);
18417         check("4294967296", 4294967295UL, ERANGE);
18418 #if 0 /* strtoul() for /^-/ strings is undefined. */
18419         check("-1", 4294967295UL, 0);
18420         check("-4294967294", 2, 0);
18421         check("-4294967295", 1, 0);
18422         check("-4294967296", 4294967295UL, ERANGE);
18423         check("-4294967297", 4294967295UL, ERANGE);
18424 #endif
18425 EOCP
18426                 ;;
18427         *)
18428 : Should we write these tests to be more portable by sprintf-ing
18429 : ~0 and then manipulating that char string as input for strtol?
18430                 ;;
18431         esac
18432         $cat >>try.c <<'EOCP'
18433         if (!bad)
18434                 printf("ok\n");
18435         return 0;
18436 }
18437 EOCP
18438         set try
18439         if eval $compile; then
18440                 case "`$run ./try`" in
18441                 ok) echo "Your strtoul() seems to be working okay." ;;
18442                 *) cat <<EOM >&4
18443 Your strtoul() doesn't seem to be working okay.
18444 EOM
18445                    d_strtoul="$undef"
18446                    ;;
18447                 esac
18448         else
18449                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18450                 d_strtoul="$undef"
18451         fi
18452         ;;
18453 esac
18454
18455 : see if strtoull exists
18456 set strtoull d_strtoull
18457 eval $inlibc
18458
18459 case "$d_longlong-$d_strtoull" in
18460 "$define-$define")
18461         $cat <<EOM
18462 Checking whether your strtoull() works okay...
18463 EOM
18464         $cat >try.c <<'EOCP'
18465 #include <errno.h>
18466 #ifdef __hpux
18467 #define strtoull __strtoull
18468 #endif
18469 #include <stdio.h>
18470 extern unsigned long long int strtoull(char *s, char **, int);
18471 static int bad = 0;
18472 int check(char *s, long long eull, int een) {
18473         long long gull;
18474         errno = 0;
18475         gull = strtoull(s, 0, 10);
18476         if (!((gull == eull) && (errno == een)))
18477                 bad++;
18478 }
18479 int main() {
18480         check(" 1",                                        1LL, 0);
18481         check(" 0",                                        0LL, 0);
18482         check("18446744073709551615",  18446744073709551615ULL, 0);
18483         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18484 #if 0 /* strtoull() for /^-/ strings is undefined. */
18485         check("-1",                    18446744073709551615ULL, 0);
18486         check("-18446744073709551614",                     2LL, 0);
18487         check("-18446744073709551615",                     1LL, 0);
18488         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18489         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18490 #endif
18491         if (!bad)
18492                 printf("ok\n");
18493 }
18494 EOCP
18495         set try
18496         if eval $compile; then
18497                 case "`$run ./try`" in
18498                 ok) echo "Your strtoull() seems to be working okay." ;;
18499                 *) cat <<EOM >&4
18500 Your strtoull() doesn't seem to be working okay.
18501 EOM
18502                    d_strtoull="$undef"
18503                    ;;
18504                 esac
18505         else
18506                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18507                 d_strtoull="$undef"
18508         fi
18509         ;;
18510 esac
18511
18512 : see if strtouq exists
18513 set strtouq d_strtouq
18514 eval $inlibc
18515
18516 case "$d_strtouq" in
18517 "$define")
18518         $cat <<EOM
18519 Checking whether your strtouq() works okay...
18520 EOM
18521         $cat >try.c <<'EOCP'
18522 #include <errno.h>
18523 #include <stdio.h>
18524 extern unsigned long long int strtouq(char *s, char **, int);
18525 static int bad = 0;
18526 void check(char *s, unsigned long long eull, int een) {
18527         unsigned long long gull;
18528         errno = 0;
18529         gull = strtouq(s, 0, 10);
18530         if (!((gull == eull) && (errno == een)))
18531                 bad++;
18532 }
18533 int main() {
18534         check(" 1",                                        1LL, 0);
18535         check(" 0",                                        0LL, 0);
18536         check("18446744073709551615",  18446744073709551615ULL, 0);
18537         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18538 #if 0 /* strtouq() for /^-/ strings is undefined. */
18539         check("-1",                    18446744073709551615ULL, 0);
18540         check("-18446744073709551614",                     2LL, 0);
18541         check("-18446744073709551615",                     1LL, 0);
18542         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18543         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18544 #endif
18545         if (!bad)
18546                 printf("ok\n");
18547         return 0;
18548 }
18549 EOCP
18550         set try
18551         if eval $compile; then
18552                 case "`$run ./try`" in
18553                 ok) echo "Your strtouq() seems to be working okay." ;;
18554                 *) cat <<EOM >&4
18555 Your strtouq() doesn't seem to be working okay.
18556 EOM
18557                    d_strtouq="$undef"
18558                    ;;
18559                 esac
18560         else
18561                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18562                 d_strtouq="$undef"
18563         fi
18564         ;;
18565 esac
18566
18567 : see if strxfrm exists
18568 set strxfrm d_strxfrm
18569 eval $inlibc
18570
18571 : see if symlink exists
18572 set symlink d_symlink
18573 eval $inlibc
18574
18575 : see if syscall exists
18576 set syscall d_syscall
18577 eval $inlibc
18578
18579 : see if prototype for syscall is available
18580 echo " "
18581 set d_syscallproto syscall $i_unistd unistd.h
18582 eval $hasproto
18583
18584 : see if sysconf exists
18585 set sysconf d_sysconf
18586 eval $inlibc
18587
18588 : see if system exists
18589 set system d_system
18590 eval $inlibc
18591
18592 : see if tcgetpgrp exists
18593 set tcgetpgrp d_tcgetpgrp
18594 eval $inlibc
18595
18596 : see if tcsetpgrp exists
18597 set tcsetpgrp d_tcsetpgrp
18598 eval $inlibc
18599
18600 : see if prototype for telldir is available
18601 echo " "
18602 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18603 eval $hasproto
18604
18605 : see if time exists
18606 echo " "
18607 if test "X$d_time" = X -o X"$timetype" = X; then
18608     if set time val -f d_time; eval $csym; $val; then
18609                 echo 'time() found.' >&4
18610                 val="$define"
18611                 rp="What is the type returned by time() on this system?"
18612                 set time_t timetype long stdio.h sys/types.h
18613                 eval $typedef_ask
18614     else
18615                 echo 'time() not found, hope that will do.' >&4
18616                 val="$undef"
18617                 timetype='int';
18618     fi
18619     set d_time
18620     eval $setvar
18621 fi
18622
18623 : see if timegm exists
18624 set timegm d_timegm
18625 eval $inlibc
18626
18627 : see if this is a sys/times.h system
18628 set sys/times.h i_systimes
18629 eval $inhdr
18630
18631 : see if times exists
18632 echo " "
18633 if set times val -f d_times; eval $csym; $val; then
18634         echo 'times() found.' >&4
18635         d_times="$define"
18636         inc=''
18637         case "$i_systimes" in
18638         "$define") inc='sys/times.h';;
18639         esac
18640         rp="What is the type returned by times() on this system?"
18641         set clock_t clocktype long stdio.h sys/types.h $inc
18642         eval $typedef_ask
18643 else
18644         echo 'times() NOT found, hope that will do.' >&4
18645         d_times="$undef"
18646         clocktype='int'
18647 fi
18648
18649 : see if tmpnam_r exists
18650 set tmpnam_r d_tmpnam_r
18651 eval $inlibc
18652 case "$d_tmpnam_r" in
18653 "$define")
18654         hdrs="$i_systypes sys/types.h define stdio.h "
18655         case "$d_tmpnam_r_proto:$usethreads" in
18656         ":define")      d_tmpnam_r_proto=define
18657                 set d_tmpnam_r_proto tmpnam_r $hdrs
18658                 eval $hasproto ;;
18659         *)      ;;
18660         esac
18661         case "$d_tmpnam_r_proto" in
18662         define)
18663         case "$tmpnam_r_proto" in
18664         ''|0) try='char* tmpnam_r(char*);'
18665         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18666         esac
18667         case "$tmpnam_r_proto" in
18668         ''|0)   d_tmpnam_r=undef
18669                 tmpnam_r_proto=0
18670                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18671         * )     case "$tmpnam_r_proto" in
18672                 REENTRANT_PROTO*) ;;
18673                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18674                 esac
18675                 echo "Prototype: $try" ;;
18676         esac
18677         ;;
18678         *)      case "$usethreads" in
18679                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18680                 esac
18681                 d_tmpnam_r=undef
18682                 tmpnam_r_proto=0
18683                 ;;
18684         esac
18685         ;;
18686 *)      tmpnam_r_proto=0
18687         ;;
18688 esac
18689
18690 : see if truncate exists
18691 set truncate d_truncate
18692 eval $inlibc
18693
18694 : see if ttyname_r exists
18695 set ttyname_r d_ttyname_r
18696 eval $inlibc
18697 case "$d_ttyname_r" in
18698 "$define")
18699         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18700         case "$d_ttyname_r_proto:$usethreads" in
18701         ":define")      d_ttyname_r_proto=define
18702                 set d_ttyname_r_proto ttyname_r $hdrs
18703                 eval $hasproto ;;
18704         *)      ;;
18705         esac
18706         case "$d_ttyname_r_proto" in
18707         define)
18708         case "$ttyname_r_proto" in
18709         ''|0) try='int ttyname_r(int, char*, size_t);'
18710         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18711         esac
18712         case "$ttyname_r_proto" in
18713         ''|0) try='int ttyname_r(int, char*, int);'
18714         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18715         esac
18716         case "$ttyname_r_proto" in
18717         ''|0) try='char* ttyname_r(int, char*, int);'
18718         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18719         esac
18720         case "$ttyname_r_proto" in
18721         ''|0)   d_ttyname_r=undef
18722                 ttyname_r_proto=0
18723                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18724         * )     case "$ttyname_r_proto" in
18725                 REENTRANT_PROTO*) ;;
18726                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18727                 esac
18728                 echo "Prototype: $try" ;;
18729         esac
18730         ;;
18731         *)      case "$usethreads" in
18732                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18733                 esac
18734                 d_ttyname_r=undef
18735                 ttyname_r_proto=0
18736                 ;;
18737         esac
18738         ;;
18739 *)      ttyname_r_proto=0
18740         ;;
18741 esac
18742
18743 : see if tzname[] exists
18744 echo " "
18745 if set tzname val -a d_tzname; eval $csym; $val; then
18746         val="$define"
18747         echo 'tzname[] found.' >&4
18748 else
18749         val="$undef"
18750         echo 'tzname[] NOT found.' >&4
18751 fi
18752 set d_tzname
18753 eval $setvar
18754
18755 : Check if is a multiplatform env
18756 case "$osname" in
18757 next|darwin) multiarch="$define" ;;
18758 esac
18759 case "$multiarch" in
18760 ''|[nN]*) multiarch="$undef" ;;
18761 esac
18762
18763 : check for ordering of bytes in a UV
18764 echo " "
18765 case "$usecrosscompile$multiarch" in
18766 *$define*)
18767         $cat <<EOM
18768 You seem to be either cross-compiling or doing a multiarchitecture build,
18769 skipping the byteorder check.
18770
18771 EOM
18772         byteorder='ffff'
18773         ;;
18774 *)
18775         case "$byteorder" in
18776         '')
18777                 $cat <<'EOM'
18778 In the following, larger digits indicate more significance.  A big-endian
18779 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18780 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18781 machines may have weird orders like 3412.  A Cray will report 87654321,
18782 an Alpha will report 12345678. If the test program works the default is
18783 probably right.
18784 I'm now running the test program...
18785 EOM
18786                 $cat >try.c <<EOCP
18787 #include <stdio.h>
18788 #$i_stdlib I_STDLIB
18789 #ifdef I_STDLIB
18790 #include <stdlib.h>
18791 #endif
18792 #include <sys/types.h>
18793 typedef $uvtype UV;
18794 int main()
18795 {
18796         int i;
18797         union {
18798                 UV l;
18799                 char c[$uvsize];
18800         } u;
18801
18802         if ($uvsize > 4)
18803                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18804         else
18805                 u.l = (UV)0x04030201;
18806         for (i = 0; i < $uvsize; i++)
18807                 printf("%c", u.c[i]+'0');
18808         printf("\n");
18809         exit(0);
18810 }
18811 EOCP
18812                 xxx_prompt=y
18813                 set try
18814                 if eval $compile && $run ./try > /dev/null; then
18815                         dflt=`$run ./try`
18816                         case "$dflt" in
18817                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18818                                 echo "(The test program ran ok.)"
18819                                 echo "byteorder=$dflt"
18820                                 xxx_prompt=n
18821                         ;;
18822                         ????|????????) echo "(The test program ran ok.)" ;;
18823                         *) echo "(The test program didn't run right for some reason.)" ;;
18824                         esac
18825                 else
18826                         dflt='4321'
18827                         cat <<'EOM'
18828 (I can't seem to compile the test program.  Guessing big-endian...)
18829 EOM
18830                 fi
18831                 case "$xxx_prompt" in
18832                 y)
18833                         rp="What is the order of bytes in $uvtype?"
18834                         . ./myread
18835                         byteorder="$ans"
18836                         ;;
18837                 *)      byteorder=$dflt
18838                         ;;
18839                 esac
18840                 ;;
18841         esac
18842         $rm_try
18843         ;;
18844 esac
18845
18846 : Checking 32bit alignedness
18847 $cat <<EOM
18848
18849 Checking to see whether you can access character data unalignedly...
18850 EOM
18851 case "$d_u32align" in
18852 '')   $cat >try.c <<EOCP
18853 #include <stdio.h>
18854 #$i_stdlib I_STDLIB
18855 #ifdef I_STDLIB
18856 #include <stdlib.h>
18857 #endif
18858 #define U32 $u32type
18859 #define BYTEORDER 0x$byteorder
18860 #define U8 $u8type
18861 #include <signal.h>
18862 #ifdef SIGBUS
18863 $signal_t bletch(int s) { exit(4); }
18864 #endif
18865 int main() {
18866 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18867     volatile U8 buf[8];
18868     volatile U32 *up;
18869     int i;
18870
18871     if (sizeof(U32) != 4) {
18872         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18873         exit(1);
18874     }
18875
18876     fflush(stdout);
18877
18878 #ifdef SIGBUS
18879     signal(SIGBUS, bletch);
18880 #endif
18881
18882     buf[0] = 0;
18883     buf[1] = 0;
18884     buf[2] = 0;
18885     buf[3] = 1;
18886     buf[4] = 0;
18887     buf[5] = 0;
18888     buf[6] = 0;
18889     buf[7] = 1;
18890
18891     for (i = 0; i < 4; i++) {
18892         up = (U32*)(buf + i);
18893         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18894                (*up == 1 << (8*(3-i)))  /* little-endian */
18895               )
18896            )
18897         {
18898             printf("read failed (%x)\n", *up);
18899             exit(2);
18900         }
18901     }
18902
18903     /* write test */
18904     for (i = 0; i < 4; i++) {
18905         up = (U32*)(buf + i);
18906         *up = 0xBeef;
18907         if (*up != 0xBeef) {
18908             printf("write failed (%x)\n", *up);
18909             exit(3);
18910         }
18911     }
18912
18913     exit(0);
18914 #else
18915     printf("1\n");
18916     exit(1);
18917 #endif
18918     return 0;
18919 }
18920 EOCP
18921 set try
18922 if eval $compile_ok; then
18923         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18924         $run ./try 2>&1 >/dev/null
18925         case "$?" in
18926         0)      cat >&4 <<EOM
18927 You can access character data pretty unalignedly.
18928 EOM
18929                 d_u32align="$undef"
18930                 ;;
18931         *)      cat >&4 <<EOM
18932 It seems that you must access character data in an aligned manner.
18933 EOM
18934                 d_u32align="$define"
18935                 ;;
18936         esac
18937 else
18938         rp='Can you access character data at unaligned addresses?'
18939         dflt='n'
18940         . ./myread
18941         case "$ans" in
18942         [yY]*)  d_u32align="$undef"  ;;
18943         *)      d_u32align="$define" ;;
18944         esac
18945 fi
18946 $rm_try
18947 ;;
18948 esac
18949
18950 : see if ualarm exists
18951 set ualarm d_ualarm
18952 eval $inlibc
18953
18954 : see if umask exists
18955 set umask d_umask
18956 eval $inlibc
18957
18958 : see if unordered exists
18959 set unordered d_unordered
18960 eval $inlibc
18961
18962 : see if unsetenv exists
18963 set unsetenv d_unsetenv
18964 eval $inlibc
18965
18966 : see if usleep exists
18967 set usleep d_usleep
18968 eval $inlibc
18969
18970 : see if prototype for usleep is available
18971 echo " "
18972 set d_usleepproto usleep $i_unistd unistd.h
18973 eval $hasproto
18974
18975 : see if ustat exists
18976 set ustat d_ustat
18977 eval $inlibc
18978
18979 : see if closedir exists
18980 set closedir d_closedir
18981 eval $inlibc
18982
18983 case "$d_closedir" in
18984 "$define")
18985         echo " "
18986         echo "Checking whether closedir() returns a status..." >&4
18987         cat > try.c <<EOM
18988 #$i_dirent I_DIRENT             /**/
18989 #$i_sysdir I_SYS_DIR            /**/
18990 #$i_sysndir I_SYS_NDIR          /**/
18991 #$i_systypes I_SYS_TYPES        /**/
18992
18993 #if defined(I_SYS_TYPES)
18994 #include <sys/types.h>
18995 #endif
18996 #if defined(I_DIRENT)
18997 #include <dirent.h>
18998 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18999 #include <sys/dir.h>
19000 #endif
19001 #else
19002 #ifdef I_SYS_NDIR
19003 #include <sys/ndir.h>
19004 #else
19005 #ifdef I_SYS_DIR
19006 #ifdef hp9000s500
19007 #include <ndir.h>       /* may be wrong in the future */
19008 #else
19009 #include <sys/dir.h>
19010 #endif
19011 #endif
19012 #endif
19013 #endif
19014 int main() { return closedir(opendir(".")); }
19015 EOM
19016         set try
19017         if eval $compile_ok; then
19018                 if $run ./try > /dev/null 2>&1 ; then
19019                         echo "Yes, it does."
19020                         val="$undef"
19021                 else
19022                         echo "No, it doesn't."
19023                         val="$define"
19024                 fi
19025         else
19026                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19027                 val="$define"
19028         fi
19029         ;;
19030 *)
19031         val="$undef";
19032         ;;
19033 esac
19034 set d_void_closedir
19035 eval $setvar
19036 $rm_try
19037
19038 : see if there is a wait4
19039 set wait4 d_wait4
19040 eval $inlibc
19041
19042 : see if waitpid exists
19043 set waitpid d_waitpid
19044 eval $inlibc
19045
19046 : see if wcstombs exists
19047 set wcstombs d_wcstombs
19048 eval $inlibc
19049
19050 : see if wctomb exists
19051 set wctomb d_wctomb
19052 eval $inlibc
19053
19054 : see if writev exists
19055 set writev d_writev
19056 eval $inlibc
19057
19058 : preserve RCS keywords in files with variable substitution, grrr
19059 Date='$Date'
19060 Id='$Id'
19061 Log='$Log'
19062 RCSfile='$RCSfile'
19063 Revision='$Revision'
19064
19065 : check for alignment requirements
19066 echo " "
19067 case "$usecrosscompile" in
19068 *$define*)
19069         $cat <<EOM
19070 You seem to be cross-compiling.  Skipping the memory alignment check.
19071
19072 EOM
19073         case "$alignbytes" in
19074         '') alignbytes=8 ;;
19075         esac
19076         ;;
19077 *)
19078         case "$alignbytes" in
19079         '') echo "Checking alignment constraints..." >&4
19080                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
19081                         $cat >try.c <<'EOCP'
19082 typedef long double NV;
19083 EOCP
19084                 else
19085                         $cat >try.c <<'EOCP'
19086 typedef double NV;
19087 EOCP
19088                 fi
19089                 $cat >>try.c <<'EOCP'
19090 #include <stdio.h>
19091 struct foobar {
19092         char foo;
19093         NV bar;
19094 } try_algn;
19095 int main()
19096 {
19097     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19098     return(0);
19099 }
19100 EOCP
19101                 set try
19102                 if eval $compile_ok; then
19103                         dflt=`$run ./try`
19104                 else
19105                         dflt='8'
19106                         echo "(I can't seem to compile the test program...)"
19107                 fi
19108                 case "$multiarch" in
19109                 *$define*)
19110                         : The usual safe value is 8, but Darwin with -Duselongdouble
19111                         : needs 16.  Hence, we will take 8 as a minimum, but allow
19112                         : Configure to pick a larger value if needed.
19113                         if $test "$dflt" -lt 8; then
19114                             dflt='8'
19115                                 echo "Setting alignment to 8 for multiarch support.">&4
19116                         fi
19117                         ;;
19118                 esac
19119                 ;;
19120         *) dflt="$alignbytes"
19121                 ;;
19122         esac
19123         rp="Doubles must be aligned on a how-many-byte boundary?"
19124         . ./myread
19125         alignbytes="$ans"
19126         $rm_try
19127         ;;
19128 esac
19129
19130
19131 : set the base revision
19132 baserev=5.0
19133
19134 : Determine if this is an EBCDIC system
19135 echo " "
19136 echo "Determining whether or not we are on an EBCDIC system..." >&4
19137 $cat >try.c <<'EOM'
19138 int main()
19139 {
19140   if ('M'==0xd4) return 0;
19141   return 1;
19142 }
19143 EOM
19144
19145 case "$BOOTSTRAP_CHARSET" in
19146     Y|y|define) bootstrap_charset=$define       ;;
19147     *)          bootstrap_charset=$undef        ;;
19148 esac
19149
19150 val=$undef
19151 set try
19152 if eval $compile_ok; then
19153         if $run ./try; then
19154                 echo "You seem to speak EBCDIC." >&4
19155                 val="$define"
19156         else
19157                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19158         fi
19159 else
19160         echo "I'm unable to compile the test program." >&4
19161         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19162 fi
19163 $rm_try
19164 set ebcdic
19165 eval $setvar
19166
19167 : length of character in bytes. Is always 1, otherwise it isnt C
19168 : This used to be a test using sizeof
19169 charsize=1
19170
19171 : Check for the number of bits in a character
19172 case "$charbits" in
19173 '')     echo "Checking how long a character is (in bits)..." >&4
19174         $cat >try.c <<EOCP
19175 #include <stdio.h>
19176 int main ()
19177 {
19178     int n;
19179     unsigned char c;
19180     for (c = 1, n = 0; c; c <<= 1, n++) ;
19181     printf ("%d\n", n);
19182     return (0);
19183     }
19184 EOCP
19185         set try
19186         if eval $compile_ok; then
19187                 dflt=`$run ./try`
19188         else
19189                 dflt='8'
19190                 echo "(I can't seem to compile the test program.  Guessing...)"
19191         fi
19192         ;;
19193 *)
19194         dflt="$charbits"
19195         ;;
19196 esac
19197 rp="What is the length of a character (in bits)?"
19198 . ./myread
19199 charbits="$ans"
19200 $rm_try
19201 case "$charbits" in
19202 8)      ;;
19203 *)      cat >&4 << EOM
19204 Your system has an unsigned character size of $charbits bits, which
19205 is rather unusual (normally it is 8 bits).  Perl likely will not work
19206 correctly on your system, with subtle bugs in various places.
19207 EOM
19208         rp='Do you really want to continue?'
19209         dflt='n'
19210         . ./myread
19211         case "$ans" in
19212                 [yY])   echo >&4 "Okay, continuing."    ;;
19213                 *)      exit 1                          ;;
19214         esac
19215 esac
19216
19217 : how do we concatenate cpp tokens here?
19218 echo " "
19219 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19220 $cat >cpp_stuff.c <<'EOCP'
19221 #define RCAT(a,b)a/**/b
19222 #define ACAT(a,b)a ## b
19223 RCAT(Rei,ser)
19224 ACAT(Cir,cus)
19225 EOCP
19226 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19227 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19228         echo "Oh!  Smells like ANSI's been here." >&4
19229         echo "We can catify or stringify, separately or together!"
19230         cpp_stuff=42
19231 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19232         echo "Ah, yes!  The good old days!" >&4
19233         echo "However, in the good old days we don't know how to stringify and"
19234         echo "catify at the same time."
19235         cpp_stuff=1
19236 else
19237         $cat >&4 <<EOM
19238 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19239 You're going to have to edit the values of CAT[2-5] in config.h...
19240 EOM
19241         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19242 fi
19243 $rm -f cpp_stuff.*
19244
19245 : see if this is a db.h system
19246 set db.h i_db
19247 eval $inhdr
19248
19249 case "$i_db" in
19250 $define)
19251         : Check db version.
19252         echo " "
19253         echo "Checking Berkeley DB version ..." >&4
19254         $cat >try.c <<EOCP
19255 #$d_const HASCONST
19256 #ifndef HASCONST
19257 #define const
19258 #endif
19259 #include <sys/types.h>
19260 #include <stdio.h>
19261 #$i_stdlib I_STDLIB
19262 #ifdef I_STDLIB
19263 #include <stdlib.h>
19264 #endif
19265 #include <db.h>
19266 int main(int argc, char *argv[])
19267 {
19268 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19269     int Major, Minor, Patch ;
19270     unsigned long Version ;
19271     (void)db_version(&Major, &Minor, &Patch) ;
19272     if (argc == 2) {
19273         printf("%d %d %d %d %d %d\n",
19274                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19275                Major, Minor, Patch);
19276         exit(0);
19277     }
19278     printf("You have Berkeley DB Version 2 or greater.\n");
19279
19280     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19281                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19282     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19283                 Major, Minor, Patch) ;
19284
19285     /* check that db.h & libdb are compatible */
19286     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19287         printf("db.h and libdb are incompatible.\n") ;
19288         exit(3);
19289     }
19290
19291     printf("db.h and libdb are compatible.\n") ;
19292
19293     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19294                 + DB_VERSION_PATCH ;
19295
19296     /* needs to be >= 2.3.4 */
19297     if (Version < 2003004) {
19298     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19299         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19300         exit(2);
19301     }
19302
19303     exit(0);
19304 #else
19305 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19306     if (argc == 2) {
19307         printf("1 0 0\n");
19308         exit(0);
19309     }
19310     printf("You have Berkeley DB Version 1.\n");
19311     exit(0);    /* DB version < 2: the coast is clear. */
19312 #else
19313     exit(1);    /* <db.h> not Berkeley DB? */
19314 #endif
19315 #endif
19316 }
19317 EOCP
19318         set try
19319         if eval $compile_ok && $run ./try; then
19320                 echo 'Looks OK.' >&4
19321                 set `$run ./try 1`
19322                 db_version_major=$1
19323                 db_version_minor=$2
19324                 db_version_patch=$3
19325         else
19326                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19327                 i_db=$undef
19328                 case " $libs " in
19329                 *"-ldb "*)
19330                         : Remove db from list of libraries to use
19331                         echo "Removing unusable -ldb from library list" >&4
19332                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19333                         shift
19334                         libs="$*"
19335                         echo "libs = $libs" >&4
19336                         ;;
19337                 esac
19338         fi
19339         $rm_try
19340         ;;
19341 esac
19342
19343 case "$i_db" in
19344 define)
19345         : Check the return type needed for hash
19346         echo " "
19347         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19348         $cat >try.c <<EOCP
19349 #$d_const HASCONST
19350 #ifndef HASCONST
19351 #define const
19352 #endif
19353 #include <sys/types.h>
19354 #include <db.h>
19355
19356 #ifndef DB_VERSION_MAJOR
19357 u_int32_t hash_cb (ptr, size)
19358 const void *ptr;
19359 size_t size;
19360 {
19361 }
19362 HASHINFO info;
19363 int main()
19364 {
19365         info.hash = hash_cb;
19366 }
19367 #endif
19368 EOCP
19369         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19370                 if $contains warning try.out >>/dev/null 2>&1 ; then
19371                         db_hashtype='int'
19372                 else
19373                         db_hashtype='u_int32_t'
19374                 fi
19375         else
19376                 : XXX Maybe we should just give up here.
19377                 db_hashtype=u_int32_t
19378                 $cat try.out >&4
19379                 echo "Help:  I can't seem to compile the db test program." >&4
19380                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19381         fi
19382         $rm_try
19383         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19384         ;;
19385 *)      db_hashtype=u_int32_t
19386         ;;
19387 esac
19388 case "$i_db" in
19389 define)
19390         : Check the return type needed for prefix
19391         echo " "
19392         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19393         cat >try.c <<EOCP
19394 #$d_const HASCONST
19395 #ifndef HASCONST
19396 #define const
19397 #endif
19398 #include <sys/types.h>
19399 #include <db.h>
19400
19401 #ifndef DB_VERSION_MAJOR
19402 size_t prefix_cb (key1, key2)
19403 const DBT *key1;
19404 const DBT *key2;
19405 {
19406 }
19407 BTREEINFO info;
19408 int main()
19409 {
19410         info.prefix = prefix_cb;
19411 }
19412 #endif
19413 EOCP
19414         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19415                 if $contains warning try.out >>/dev/null 2>&1 ; then
19416                         db_prefixtype='int'
19417                 else
19418                         db_prefixtype='size_t'
19419                 fi
19420         else
19421                 db_prefixtype='size_t'
19422                 : XXX Maybe we should just give up here.
19423                 $cat try.out >&4
19424                 echo "Help:  I can't seem to compile the db test program." >&4
19425                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19426         fi
19427         $rm_try
19428         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19429         ;;
19430 *)      db_prefixtype='size_t'
19431         ;;
19432 esac
19433
19434 : How can we generate normalized random numbers ?
19435 echo " "
19436 echo "Looking for a random number function..." >&4
19437 case "$randfunc" in
19438 '')
19439         if set drand48 val -f; eval $csym; $val; then
19440                 dflt="drand48"
19441                 echo "Good, found drand48()." >&4
19442         elif set random val -f; eval $csym; $val; then
19443                 dflt="random"
19444                 echo "OK, found random()." >&4
19445         else
19446                 dflt="rand"
19447                 echo "Yick, looks like I have to use rand()." >&4
19448         fi
19449         echo " "
19450         ;;
19451 *)
19452         dflt="$randfunc"
19453         ;;
19454 esac
19455 cont=true
19456
19457 case "$ccflags" in
19458 *-Dmy_rand=*|*-Dmy_srand=*)
19459         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19460         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19461         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19462         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19463         ;;
19464 esac
19465
19466 while $test "$cont"; do
19467         rp="Use which function to generate random numbers?"
19468         . ./myread
19469         if $test "$ans" = "$dflt"; then
19470                 : null
19471         else
19472                 randbits=''
19473         fi
19474         randfunc="$ans"
19475         if set $ans val -f; eval $csym; $val; then
19476                 cont=''
19477         else
19478                 dflt=y
19479                 rp="I cannot find function $ans. Use that name anyway?"
19480                 . ./myread
19481                 dflt=rand
19482                 case "$ans" in
19483                         [yY]*) cont='';;
19484                 esac
19485         fi
19486         case "$cont" in
19487         '')
19488                 case "$randfunc" in
19489                 drand48)
19490                         drand01="drand48()"
19491                         seedfunc="srand48"
19492                         randbits=48
19493                         randseedtype=long
19494                         ;;
19495                 rand|random)
19496                         case "$randbits" in
19497                         '')
19498 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19499                                 $cat >try.c <<EOCP
19500 #$i_unistd I_UNISTD
19501 #$i_stdlib I_STDLIB
19502 #include <stdio.h>
19503 #ifdef I_UNISTD
19504 #  include <unistd.h>
19505 #endif
19506 #ifdef I_STDLIB
19507 #  include <stdlib.h>
19508 #endif
19509 int main()
19510 {
19511         int i;
19512         unsigned long tmp;
19513         unsigned long max = 0L;
19514
19515         for (i = 1000; i; i--) {
19516                 tmp = (unsigned long) $randfunc();
19517                 if (tmp > max) max = tmp;
19518         }
19519         for (i = 0; max; i++)
19520                 max /= 2;
19521         printf("%d\n",i);
19522 }
19523 EOCP
19524                                 set try
19525                                 if eval $compile_ok; then
19526                                         dflt=`try`
19527                                 else
19528                                         dflt='?'
19529                                         echo "(I can't seem to compile the test program...)"
19530                                 fi
19531                                 ;;
19532                         *)
19533                                 dflt="$randbits"
19534                                 ;;
19535                         esac
19536                         rp="How many bits does your $randfunc() function produce?"
19537                         . ./myread
19538                         randbits="$ans"
19539                         $rm_try
19540                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19541                         seedfunc="s$randfunc"
19542                         randseedtype=unsigned
19543                         ;;
19544                 *)
19545                         dflt="31"
19546                         rp="How many bits does your $randfunc() function produce?"
19547                         . ./myread
19548                         randbits="$ans"
19549                         seedfunc="s$randfunc"
19550                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19551                         if set $seedfunc val -f; eval $csym; $val; then
19552                                 echo "(Using $seedfunc() to seed random generator)"
19553                         else
19554                                 echo "(Warning: no $seedfunc() to seed random generator)"
19555                                 seedfunc=rand
19556                         fi
19557                         randseedtype=unsigned
19558                         ;;
19559                 esac
19560                 ;;
19561         esac
19562 done
19563
19564 : Check how to flush
19565 echo " "
19566 $cat >&4 <<EOM
19567 Checking how to flush all pending stdio output...
19568 EOM
19569 # I only know how to find the first 32 possibly open files on SunOS.
19570 # See also hints/sunos_4_1.sh and util.c  --AD
19571 case "$osname" in
19572 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19573 esac
19574 $cat >>try.c <<EOCP
19575 #include <stdio.h>
19576 #$i_stdlib I_STDLIB
19577 #ifdef I_STDLIB
19578 #include <stdlib.h>
19579 #endif
19580 #$i_unistd I_UNISTD
19581 #ifdef I_UNISTD
19582 # include <unistd.h>
19583 #endif
19584 #$d_sysconf HAS_SYSCONF
19585 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19586 #ifdef HAS_STDIO_STREAM_ARRAY
19587 # define STDIO_STREAM_ARRAY $stdio_stream_array
19588 #endif
19589 int main() {
19590   FILE* p;
19591   unlink("try.out");
19592   p = fopen("try.out", "w");
19593 #ifdef TRY_FPUTC
19594   fputc('x', p);
19595 #else
19596 # ifdef TRY_FPRINTF
19597   fprintf(p, "x");
19598 # endif
19599 #endif
19600 #ifdef TRY_FFLUSH_NULL
19601   fflush(NULL);
19602 #endif
19603 #ifdef TRY_FFLUSH_ALL
19604   {
19605     long open_max = -1;
19606 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19607     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19608 # else
19609 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19610     open_max = sysconf(_SC_OPEN_MAX);
19611 #  else
19612 #   ifdef FOPEN_MAX
19613     open_max = FOPEN_MAX;
19614 #   else
19615 #    ifdef OPEN_MAX
19616     open_max = OPEN_MAX;
19617 #    else
19618 #     ifdef _NFILE
19619     open_max = _NFILE;
19620 #     endif
19621 #    endif
19622 #   endif
19623 #  endif
19624 # endif
19625 # ifdef HAS_STDIO_STREAM_ARRAY
19626     if (open_max > 0) {
19627       long i;
19628       for (i = 0; i < open_max; i++)
19629             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19630                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19631                 STDIO_STREAM_ARRAY[i]._flag)
19632                 fflush(&STDIO_STREAM_ARRAY[i]);
19633     }
19634   }
19635 # endif
19636 #endif
19637   _exit(42);
19638 }
19639 EOCP
19640 : first we have to find out how _not_ to flush
19641 $to try.c
19642 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19643     output=''
19644     set try -DTRY_FPUTC
19645     if eval $compile; then
19646             $run ./try 2>/dev/null
19647             code="$?"
19648             $from try.out
19649             if $test ! -s try.out -a "X$code" = X42; then
19650                 output=-DTRY_FPUTC
19651             fi
19652     fi
19653     case "$output" in
19654     '')
19655             set try -DTRY_FPRINTF
19656             if eval $compile; then
19657                     $run ./try 2>/dev/null
19658                     code="$?"
19659                     $from try.out
19660                     if $test ! -s try.out -a "X$code" = X42; then
19661                         output=-DTRY_FPRINTF
19662                     fi
19663             fi
19664         ;;
19665     esac
19666 fi
19667 : check for fflush NULL behaviour
19668 case "$fflushNULL" in
19669 '')     set try -DTRY_FFLUSH_NULL $output
19670         if eval $compile; then
19671                 $run ./try 2>/dev/null
19672                 code="$?"
19673                 $from try.out
19674                 if $test -s try.out -a "X$code" = X42; then
19675                         fflushNULL="`$cat try.out`"
19676                 else
19677                         if $test "X$code" != X42; then
19678                                 $cat >&4 <<EOM
19679 (If this test failed, don't worry, we'll try another method shortly.)
19680 EOM
19681                         fi
19682                 fi
19683         fi
19684         $rm -f core try.core core.try.*
19685         case "$fflushNULL" in
19686         x)      $cat >&4 <<EOM
19687 Your fflush(NULL) works okay for output streams.
19688 Let's see if it clobbers input pipes...
19689 EOM
19690 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19691 # bug that improperly flushes the input end of pipes.  So we avoid the
19692 # autoflush on fork/system/exec support for now. :-(
19693 $cat >tryp.c <<EOCP
19694 #include <stdio.h>
19695 int
19696 main(int argc, char **argv)
19697 {
19698     char buf[1024];
19699     int i;
19700     char *bp = buf;
19701     while (1) {
19702         while ((i = getc(stdin)) != -1
19703                && (*bp++ = i) != '\n'
19704                && bp < &buf[1024])
19705         /* DO NOTHING */ ;
19706         *bp = '\0';
19707         fprintf(stdout, "%s", buf);
19708         fflush(NULL);
19709         if (i == -1)
19710             return 0;
19711         bp = buf;
19712     }
19713 }
19714 EOCP
19715                 fflushNULL="$define"
19716                 set tryp
19717                 if eval $compile; then
19718                     $rm -f tryp.out
19719                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19720                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19721                        $cat >&4 <<EOM
19722 fflush(NULL) seems to behave okay with input streams.
19723 EOM
19724                         fflushNULL="$define"
19725                     else
19726                         $cat >&4 <<EOM
19727 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19728 EOM
19729                         fflushNULL="$undef"
19730                     fi
19731                 fi
19732                 $rm -f core tryp.c tryp.core core.tryp.*
19733                 ;;
19734         '')     $cat >&4 <<EOM
19735 Your fflush(NULL) isn't working (contrary to ANSI C).
19736 EOM
19737                 fflushNULL="$undef"
19738                 ;;
19739         *)      $cat >&4 <<EOM
19740 Cannot figure out whether your fflush(NULL) works or not.
19741 I'm assuming it doesn't (contrary to ANSI C).
19742 EOM
19743                 fflushNULL="$undef"
19744                 ;;
19745         esac
19746         ;;
19747 $define|true|[yY]*)
19748         fflushNULL="$define"
19749         ;;
19750 *)
19751         fflushNULL="$undef"
19752         ;;
19753 esac
19754 : check explicit looping only if NULL did not work, and if the pipe
19755 : bug does not show up on an explicit flush too
19756 case "$fflushNULL" in
19757 "$undef")
19758         $cat >tryp.c <<EOCP
19759 #include <stdio.h>
19760 int
19761 main(int argc, char **argv)
19762 {
19763     char buf[1024];
19764     int i;
19765     char *bp = buf;
19766     while (1) {
19767         while ((i = getc(stdin)) != -1
19768                && (*bp++ = i) != '\n'
19769                && bp < &buf[1024])
19770         /* DO NOTHING */ ;
19771         *bp = '\0';
19772         fprintf(stdout, "%s", buf);
19773         fflush(stdin);
19774         if (i == -1)
19775             return 0;
19776         bp = buf;
19777     }
19778 }
19779 EOCP
19780         set tryp
19781         if eval $compile; then
19782             $rm -f tryp.out
19783             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19784             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19785                $cat >&4 <<EOM
19786 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19787 EOM
19788                 : now check for fflushall behaviour
19789                 case "$fflushall" in
19790                 '')     set try -DTRY_FFLUSH_ALL $output
19791                         if eval $compile; then
19792                                 $cat >&4 <<EOM
19793 (Now testing the other method--but note that this also may fail.)
19794 EOM
19795                                 $run ./try 2>/dev/null
19796                                 code=$?
19797                                 $from try.out
19798                                 if $test -s try.out -a "X$code" = X42; then
19799                                         fflushall="`$cat try.out`"
19800                                 fi
19801                         fi
19802                         $rm_try
19803                         case "$fflushall" in
19804                         x)      $cat >&4 <<EOM
19805 Whew. Flushing explicitly all the stdio streams works.
19806 EOM
19807                                 fflushall="$define"
19808                                 ;;
19809                         '')     $cat >&4 <<EOM
19810 Sigh. Flushing explicitly all the stdio streams doesn't work.
19811 EOM
19812                                 fflushall="$undef"
19813                                 ;;
19814                         *)      $cat >&4 <<EOM
19815 Cannot figure out whether flushing stdio streams explicitly works or not.
19816 I'm assuming it doesn't.
19817 EOM
19818                                 fflushall="$undef"
19819                                 ;;
19820                         esac
19821                         ;;
19822                 "$define"|true|[yY]*)
19823                         fflushall="$define"
19824                         ;;
19825                 *)
19826                         fflushall="$undef"
19827                         ;;
19828                 esac
19829             else
19830                 $cat >&4 <<EOM
19831 All is futile.  Even fflush(stdin) clobbers input pipes!
19832 EOM
19833                 fflushall="$undef"
19834             fi
19835         else
19836             fflushall="$undef"
19837         fi
19838         $rm -f core tryp.c tryp.core core.tryp.*
19839         ;;
19840 *)      fflushall="$undef"
19841         ;;
19842 esac
19843
19844 case "$fflushNULL$fflushall" in
19845 undefundef)
19846         $cat <<EOM
19847 OK, I give up.  I cannot figure out how to flush pending stdio output.
19848 We won't be flushing handles at all before fork/exec/popen.
19849 EOM
19850         ;;
19851 esac
19852 $rm_try tryp
19853
19854 : Store the full pathname to the ar program for use in the C program
19855 : Respect a hint or command line value for full_ar.
19856 case "$full_ar" in
19857 '') full_ar=$ar ;;
19858 esac
19859
19860 : Store the full pathname to the sed program for use in the C program
19861 full_sed=$sed
19862
19863 : see what type gids are declared as in the kernel
19864 echo " "
19865 echo "Looking for the type for group ids returned by getgid()."
19866 set gid_t gidtype xxx stdio.h sys/types.h
19867 eval $typedef
19868 case "$gidtype" in
19869 xxx)
19870         xxx=`./findhdr sys/user.h`
19871         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19872         case $1 in
19873         unsigned) dflt="$1 $2" ;;
19874         *) dflt="$1" ;;
19875         esac
19876         ;;
19877 *) dflt="$gidtype";;
19878 esac
19879 case "$gidtype" in
19880 gid_t) echo "gid_t found." ;;
19881 *)      rp="What is the type for group ids returned by getgid()?"
19882         . ./myread
19883         gidtype="$ans"
19884         ;;
19885 esac
19886
19887 : Check the size of GID
19888 echo " "
19889 case "$gidtype" in
19890 *_t) zzz="$gidtype"     ;;
19891 *)   zzz="gid"          ;;
19892 esac
19893 echo "Checking the size of $zzz..." >&4
19894 cat > try.c <<EOCP
19895 #include <sys/types.h>
19896 #include <stdio.h>
19897 #$i_stdlib I_STDLIB
19898 #ifdef I_STDLIB
19899 #include <stdlib.h>
19900 #endif
19901 int main() {
19902     printf("%d\n", (int)sizeof($gidtype));
19903     exit(0);
19904 }
19905 EOCP
19906 set try
19907 if eval $compile_ok; then
19908         yyy=`$run ./try`
19909         case "$yyy" in
19910         '')     gidsize=4
19911                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19912                 ;;
19913         *)      gidsize=$yyy
19914                 echo "Your $zzz is $gidsize bytes long."
19915                 ;;
19916         esac
19917 else
19918         gidsize=4
19919         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19920 fi
19921
19922
19923 : Check if GID is signed
19924 echo " "
19925 case "$gidtype" in
19926 *_t) zzz="$gidtype"     ;;
19927 *)   zzz="gid"          ;;
19928 esac
19929 echo "Checking the sign of $zzz..." >&4
19930 cat > try.c <<EOCP
19931 #include <sys/types.h>
19932 #include <stdio.h>
19933 int main() {
19934         $gidtype foo = -1;
19935         if (foo < 0)
19936                 printf("-1\n");
19937         else
19938                 printf("1\n");
19939 }
19940 EOCP
19941 set try
19942 if eval $compile; then
19943         yyy=`$run ./try`
19944         case "$yyy" in
19945         '')     gidsign=1
19946                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19947                 ;;
19948         *)      gidsign=$yyy
19949                 case "$gidsign" in
19950                  1) echo "Your $zzz is unsigned." ;;
19951                 -1) echo "Your $zzz is signed."   ;;
19952                 esac
19953                 ;;
19954         esac
19955 else
19956         gidsign=1
19957         echo "(I can't compile the test program--guessing unsigned.)" >&4
19958 fi
19959
19960
19961 : Check 64bit sizes
19962 echo " "
19963
19964 if $test X"$quadtype" != X; then
19965
19966 echo "Checking how to print 64-bit integers..." >&4
19967
19968 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19969         $cat >try.c <<'EOCP'
19970 #include <sys/types.h>
19971 #include <stdio.h>
19972 int main() {
19973   int q = 12345678901;
19974   printf("%ld\n", q);
19975 }
19976 EOCP
19977         set try
19978         if eval $compile; then
19979                 yyy=`$run ./try`
19980                 case "$yyy" in
19981                 12345678901)
19982                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19983                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19984                         echo "We will use %d."
19985                         ;;
19986                 esac
19987         fi
19988 fi
19989
19990 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19991         $cat >try.c <<'EOCP'
19992 #include <sys/types.h>
19993 #include <stdio.h>
19994 int main() {
19995   long q = 12345678901;
19996   printf("%ld\n", q);
19997 }
19998 EOCP
19999         set try
20000         if eval $compile; then
20001                 yyy=`$run ./try`
20002                 case "$yyy" in
20003                 12345678901)
20004                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20005                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20006                         echo "We will use %ld."
20007                         ;;
20008                 esac
20009         fi
20010 fi
20011
20012 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20013         $cat >try.c <<'EOCP'
20014 #include <sys/types.h>
20015 #include <inttypes.h>
20016 #include <stdio.h>
20017 int main() {
20018   int64_t q = 12345678901;
20019   printf("%" PRId64 "\n", q);
20020 }
20021 EOCP
20022         set try
20023         if eval $compile; then
20024                 yyy=`$run ./try`
20025                 case "$yyy" in
20026                 12345678901)
20027                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20028                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20029                         echo "We will use the C9X style."
20030                         ;;
20031                 esac
20032         fi
20033 fi
20034
20035 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20036         $cat >try.c <<EOCP
20037 #include <sys/types.h>
20038 #include <stdio.h>
20039 int main() {
20040   $quadtype q = 12345678901;
20041   printf("%Ld\n", q);
20042 }
20043 EOCP
20044         set try
20045         if eval $compile; then
20046                 yyy=`$run ./try`
20047                 case "$yyy" in
20048                 12345678901)
20049                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20050                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20051                         echo "We will use %Ld."
20052                         ;;
20053                 esac
20054         fi
20055 fi
20056
20057 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20058         $cat >try.c <<'EOCP'
20059 #include <sys/types.h>
20060 #include <stdio.h>
20061 int main() {
20062   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20063   printf("%lld\n", q);
20064 }
20065 EOCP
20066         set try
20067         if eval $compile; then
20068                 yyy=`$run ./try`
20069                 case "$yyy" in
20070                 12345678901)
20071                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20072                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20073                         echo "We will use the %lld style."
20074                         ;;
20075                 esac
20076         fi
20077 fi
20078
20079 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20080         $cat >try.c <<EOCP
20081 #include <sys/types.h>
20082 #include <stdio.h>
20083 int main() {
20084   $quadtype q = 12345678901;
20085   printf("%qd\n", q);
20086 }
20087 EOCP
20088         set try
20089         if eval $compile; then
20090                 yyy=`$run ./try`
20091                 case "$yyy" in
20092                 12345678901)
20093                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20094                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20095                         echo "We will use %qd."
20096                         ;;
20097                 esac
20098         fi
20099 fi
20100
20101 if $test X"$sPRId64" = X; then
20102         echo "Cannot figure out how to print 64-bit integers." >&4
20103 fi
20104 $rm_try
20105
20106 fi
20107
20108 case "$sPRId64" in
20109 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20110         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20111         ;;
20112 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20113         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20114         ;;
20115 esac
20116
20117 : Check format strings for internal types
20118 echo " "
20119 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20120
20121 if $test X"$ivsize" = X8; then
20122         ivdformat="$sPRId64"
20123         uvuformat="$sPRIu64"
20124         uvoformat="$sPRIo64"
20125         uvxformat="$sPRIx64"
20126         uvXUformat="$sPRIXU64"
20127 else
20128         if $test X"$ivsize" = X"$longsize"; then
20129                 ivdformat='"ld"'
20130                 uvuformat='"lu"'
20131                 uvoformat='"lo"'
20132                 uvxformat='"lx"'
20133                 uvXUformat='"lX"'
20134         else
20135                 if $test X"$ivsize" = X"$intsize"; then
20136                         ivdformat='"d"'
20137                         uvuformat='"u"'
20138                         uvoformat='"o"'
20139                         uvxformat='"x"'
20140                         uvXUformat='"X"'
20141                 else
20142                         : far out
20143                         if $test X"$ivsize" = X"$shortsize"; then
20144                                 ivdformat='"hd"'
20145                                 uvuformat='"hu"'
20146                                 uvoformat='"ho"'
20147                                 uvxformat='"hx"'
20148                                 uvXUformat='"hX"'
20149                         fi
20150                 fi
20151         fi
20152 fi
20153
20154 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20155         nveformat="$sPRIeldbl"
20156         nvfformat="$sPRIfldbl"
20157         nvgformat="$sPRIgldbl"
20158         nvEUformat="$sPRIEUldbl"
20159         nvFUformat="$sPRIFUldbl"
20160         nvGUformat="$sPRIGUldbl"
20161 else
20162         nveformat='"e"'
20163         nvfformat='"f"'
20164         nvgformat='"g"'
20165         nvEUformat='"E"'
20166         nvFUformat='"F"'
20167         nvGUformat='"G"'
20168 fi
20169
20170 case "$ivdformat" in
20171 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20172     exit 1
20173     ;;
20174 esac
20175
20176 : Check format string for GID
20177
20178 echo " "
20179 $echo "Checking the format string to be used for gids..." >&4
20180
20181 case "$gidsign" in
20182 -1)     if $test X"$gidsize" = X"$ivsize"; then
20183                 gidformat="$ivdformat"
20184         else
20185                 if $test X"$gidsize" = X"$longsize"; then
20186                         gidformat='"ld"'
20187                 else
20188                         if $test X"$gidsize" = X"$intsize"; then
20189                                 gidformat='"d"'
20190                         else
20191                                 if $test X"$gidsize" = X"$shortsize"; then
20192                                         gidformat='"hd"'
20193                                 fi
20194                         fi
20195                 fi
20196         fi
20197         ;;
20198 *)      if $test X"$gidsize" = X"$uvsize"; then
20199                 gidformat="$uvuformat"
20200         else
20201                 if $test X"$gidsize" = X"$longsize"; then
20202                         gidformat='"lu"'
20203                 else
20204                         if $test X"$gidsize" = X"$intsize"; then
20205                                 gidformat='"u"'
20206                         else
20207                                 if $test X"$gidsize" = X"$shortsize"; then
20208                                         gidformat='"hu"'
20209                                 fi
20210                         fi
20211                 fi
20212         fi
20213         ;;
20214 esac
20215
20216 : see if getgroups exists
20217 set getgroups d_getgrps
20218 eval $inlibc
20219
20220 : see if setgroups exists
20221 set setgroups d_setgrps
20222 eval $inlibc
20223
20224 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20225 echo " "
20226 case "$d_getgrps$d_setgrps" in
20227 *define*)
20228         case "$groupstype" in
20229         '') dflt="$gidtype" ;;
20230         *)  dflt="$groupstype" ;;
20231         esac
20232         $cat <<EOM
20233 What type of pointer is the second argument to getgroups() and setgroups()?
20234 Usually this is the same as group ids, $gidtype, but not always.
20235
20236 EOM
20237         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20238         . ./myread
20239         groupstype="$ans"
20240         ;;
20241 *)  groupstype="$gidtype";;
20242 esac
20243
20244 : MAD = Misc Attribute Definition
20245
20246 if $test $patchlevel -lt 9; then
20247 : MAD is not available in 5.8.x or earlier.
20248     ans=n;
20249 else
20250     case "$mad" in
20251     $define|true|[yY]*) dflt='y' ;;
20252     *)                  dflt='n' ;;
20253     esac
20254     cat <<EOM
20255
20256 Would you like to build with Misc Attribute Decoration? This is development
20257 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20258 overhead on the interpreter.
20259
20260 If this doesn't make any sense to you, just accept the default '$dflt'.
20261 EOM
20262     rp='Build Perl with MAD?'
20263     . ./myread
20264 fi
20265 case "$ans" in
20266 y|Y)    val="$define"
20267         madlyh='madly.h madly.act madly.tab'
20268         madlysrc='madly.c'
20269         madlyobj="madly$_o" ;;
20270 *)      val="$undef"
20271         madlyh=''
20272         madlysrc=''
20273         madlyobj='' ;;
20274 esac
20275 set mad
20276 eval $setvar
20277
20278 : check whether make sets MAKE
20279 echo " "
20280 echo "Checking if your $make program sets \$(MAKE)..." >&4
20281 case "$make_set_make" in
20282 '')
20283         $sed 's/^X //' > testmake.mak << 'EOF'
20284 Xall:
20285 X       @echo 'maketemp="$(MAKE)"'
20286 EOF
20287         case "`$make -f testmake.mak 2>/dev/null`" in
20288         *maketemp=*) make_set_make='#' ;;
20289         *)      make_set_make="MAKE=$make" ;;
20290         esac
20291         $rm -f testmake.mak
20292         ;;
20293 esac
20294 case "$make_set_make" in
20295 '#') echo "Yup, it does.";;
20296 *) echo "Nope, it doesn't.";;
20297 esac
20298
20299 : see what type is used for mode_t
20300 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20301 set mode_t modetype int stdio.h sys/types.h
20302 eval $typedef_ask
20303
20304 : see if we need va_copy
20305 echo " "
20306 case "$i_stdarg" in
20307 "$define")
20308         $cat >try.c <<EOCP
20309 #include <stdarg.h>
20310 #include <stdio.h>
20311 #$i_stdlib I_STDLIB
20312 #ifdef I_STDLIB
20313 #include <stdlib.h>
20314 #endif
20315 #include <signal.h>
20316
20317 int
20318 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20319 {
20320   return vfprintf(f, fmt, *valp);
20321 }
20322
20323 int
20324 myvfprintf(FILE *f, const  char *fmt, va_list val)
20325 {
20326   return ivfprintf(f, fmt, &val);
20327 }
20328
20329 int
20330 myprintf(char *fmt, ...)
20331 {
20332   va_list val;
20333   va_start(val, fmt);
20334   return myvfprintf(stdout, fmt, val);
20335 }
20336
20337 int
20338 main(int ac, char **av)
20339 {
20340   signal(SIGSEGV, exit);
20341
20342   myprintf("%s%cs all right, then\n", "that", '\'');
20343   exit(0);
20344 }
20345 EOCP
20346         set try
20347         if eval $compile && $run ./try 2>&1 >/dev/null; then
20348                 case "`$run ./try`" in
20349                 "that's all right, then")
20350                         okay=yes
20351                         ;;
20352                 esac
20353         fi
20354         case "$okay" in
20355         yes)    echo "It seems that you don't need va_copy()." >&4
20356                 need_va_copy="$undef"
20357                 ;;
20358         *)      echo "It seems that va_copy() or similar will be needed." >&4
20359                 need_va_copy="$define"
20360                 ;;
20361         esac
20362         $rm_try
20363         ;;
20364 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20365         need_va_copy="$undef"
20366         ;;
20367 esac
20368
20369 : see what type is used for size_t
20370 rp="What is the type used for the length parameter for string functions?"
20371 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20372 eval $typedef_ask
20373
20374 : check for type of arguments to gethostbyaddr. 
20375 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20376         case "$d_gethbyaddr" in
20377         $define)
20378                 $cat <<EOM
20379
20380 Checking to see what type of arguments are accepted by gethostbyaddr().
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                 : The first arg can 'char *' or 'void *'
20388                 : The second arg is some of integral type
20389                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20390                         for yyy in size_t long int; do
20391                                 case "$netdb_host_type" in
20392                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20393                                         if ./protochk "$try" $hdrs; then
20394                                                 echo "Your system accepts $xxx for the first arg."
20395                                                 echo "...and $yyy for the second arg."
20396                                                 netdb_host_type="$xxx"
20397                                                 netdb_hlen_type="$yyy"
20398                                         fi
20399                                         ;;
20400                                 esac
20401                         done
20402                 done
20403                 : In case none of those worked, prompt the user.
20404                 case "$netdb_host_type" in
20405                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20406                         dflt='char *'
20407                         . ./myread
20408                         netdb_host_type=$ans
20409                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20410                         dflt="$sizetype"
20411                         . ./myread
20412                         netdb_hlen_type=$ans
20413                         ;;
20414                 esac
20415                 ;;
20416         *)      : no gethostbyaddr, so pick harmless defaults
20417                 netdb_host_type='char *'
20418                 netdb_hlen_type="$sizetype"
20419                 ;;
20420         esac
20421         # Remove the "const" if needed. -- but then we'll have a 
20422         # prototype clash!
20423         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20424 fi
20425
20426 : check for type of argument to gethostbyname. 
20427 if test "X$netdb_name_type" = X ; then
20428         case "$d_gethbyname" in
20429         $define)
20430                 $cat <<EOM
20431
20432 Checking to see what type of argument is accepted by gethostbyname().
20433 EOM
20434                 hdrs="$define sys/types.h
20435                         $d_socket sys/socket.h 
20436                         $i_niin netinet/in.h 
20437                         $i_netdb netdb.h
20438                         $i_unistd unistd.h"
20439                 for xxx in "const char *" "char *"; do
20440                         case "$netdb_name_type" in
20441                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20442                                 if ./protochk "$try" $hdrs; then
20443                                         echo "Your system accepts $xxx."
20444                                         netdb_name_type="$xxx"
20445                                 fi
20446                                 ;;
20447                         esac
20448                 done
20449                 : In case none of those worked, prompt the user.
20450                 case "$netdb_name_type" in
20451                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20452                         dflt='char *'
20453                         . ./myread
20454                         netdb_name_type=$ans
20455                         ;;
20456                 esac
20457                 ;;
20458         *)      : no gethostbyname, so pick harmless default
20459                 netdb_name_type='char *'
20460                 ;;
20461         esac
20462 fi
20463
20464 : check for type of 1st argument to getnetbyaddr. 
20465 if test "X$netdb_net_type" = X ; then
20466         case "$d_getnbyaddr" in
20467         $define)
20468                 $cat <<EOM
20469
20470 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20471 EOM
20472                 hdrs="$define sys/types.h
20473                         $d_socket sys/socket.h 
20474                         $i_niin netinet/in.h 
20475                         $i_netdb netdb.h
20476                         $i_unistd unistd.h"
20477                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20478                         case "$netdb_net_type" in
20479                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20480                                 if ./protochk "$try" $hdrs; then
20481                                         echo "Your system accepts $xxx."
20482                                         netdb_net_type="$xxx"
20483                                 fi
20484                                 ;;
20485                         esac
20486                 done
20487                 : In case none of those worked, prompt the user.
20488                 case "$netdb_net_type" in
20489                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20490                         dflt='long'
20491                         . ./myread
20492                         netdb_net_type=$ans
20493                         ;;
20494                 esac
20495                 ;;
20496         *)      : no getnetbyaddr, so pick harmless default
20497                 netdb_net_type='long'
20498                 ;;
20499         esac
20500 fi
20501 : locate the preferred pager for this system
20502 fn=f/
20503 case "$pager" in
20504 '')
20505         dflt=''
20506         case "$pg" in
20507         /*) dflt=$pg;;
20508         [a-zA-Z]:/*) dflt=$pg;;
20509         esac
20510         case "$more" in
20511         /*) dflt=$more;;
20512         [a-zA-Z]:/*) dflt=$more;;
20513         esac
20514         case "$less" in
20515         /*) dflt=$less;;
20516         [a-zA-Z]:/*) dflt=$less;;
20517         esac
20518         case "$dflt" in
20519         '') dflt=/usr/ucb/more;;
20520         esac
20521         ;;
20522 *)      dflt="$pager"
20523         ;;
20524 esac
20525 fn="f/($dflt)"
20526 echo " "
20527 rp='What pager is used on your system?'
20528 . ./getfile
20529 pager="$ans"
20530
20531 : see what type pids are declared as in the kernel
20532 rp="What is the type of process ids on this system?"
20533 set pid_t pidtype int stdio.h sys/types.h
20534 eval $typedef_ask
20535
20536 : see if ar generates random libraries by itself
20537 echo " "
20538 echo "Checking how to generate random libraries on your machine..." >&4
20539 echo 'int bar1() { return bar2(); }' > bar1.c
20540 echo 'int bar2() { return 2; }' > bar2.c
20541 $cat > foo.c <<EOP
20542 #$i_stdlib I_STDLIB
20543 #ifdef I_STDLIB
20544 #include <stdlib.h>
20545 #endif
20546 int main() { printf("%d\n", bar1()); exit(0); }
20547 EOP
20548 $cc $ccflags -c bar1.c >/dev/null 2>&1
20549 $cc $ccflags -c bar2.c >/dev/null 2>&1
20550 $cc $ccflags -c foo.c >/dev/null 2>&1
20551 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20552 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20553         $run ./foobar >/dev/null 2>&1; then
20554         echo "$ar appears to generate random libraries itself."
20555         orderlib=false
20556         if [ "X$ranlib" = "X" ]; then
20557             ranlib=":"
20558         fi
20559 elif $ar s bar$_a >/dev/null 2>&1 &&
20560         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20561         $run ./foobar >/dev/null 2>&1; then
20562                 echo "a table of contents needs to be added with '$ar s'."
20563                 orderlib=false
20564                 ranlib="$ar s"
20565 elif $ar ts bar$_a >/dev/null 2>&1 &&
20566         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20567         $run ./foobar >/dev/null 2>&1; then
20568                 echo "a table of contents needs to be added with '$ar ts'."
20569                 orderlib=false
20570                 ranlib="$ar ts"
20571 else
20572         case "$ranlib" in
20573         :) ranlib='';;
20574         '')
20575                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20576                 $test -f $ranlib || ranlib=''
20577                 ;;
20578         esac
20579         if $test -n "$ranlib"; then
20580                 echo "your system has '$ranlib'; we'll use that."
20581                 orderlib=false
20582         else
20583                 echo "your system doesn't seem to support random libraries"
20584                 echo "so we'll use lorder and tsort to order the libraries."
20585                 orderlib=true
20586                 ranlib=":"
20587         fi
20588 fi
20589 $rm -f foo* bar*
20590
20591 : see if this is a values.h system
20592 set values.h i_values
20593 eval $inhdr
20594
20595 : Check the max offset that gmtime and localtime accept
20596 echo "Checking max offsets that gmtime () accepts"
20597
20598 case $i_values in
20599     define) yyy="#include <values.h>" ;;
20600     *)      yyy="" ;;
20601     esac
20602
20603 case "$sGMTIME_min/$sGMTIME_max" in
20604     0/0|/)
20605         $cat >try.c <<EOCP
20606 #include <sys/types.h>
20607 #include <stdio.h>
20608 #include <time.h>
20609 $yyy
20610
20611 int i;
20612 struct tm *tmp;
20613 time_t pt;
20614
20615 void gm_check (time_t t, int min_year, int max_year)
20616 {
20617     tmp = gmtime (&t);
20618     if ( tmp == NULL ||
20619         /* Check tm_year overflow */
20620          tmp->tm_year < min_year || tmp->tm_year > max_year)
20621         tmp = NULL;
20622     else
20623         pt = t;
20624     } /* gm_check */
20625
20626 int check_max ()
20627 {
20628     tmp = NULL;
20629     pt  = 0;
20630 #ifdef MAXLONG
20631     gm_check (MAXLONG, 69, 0x7fffffff);
20632 #endif
20633     if (tmp == NULL || tmp->tm_year < 0) {
20634         for (i = 63; i >= 0; i--) {
20635             time_t x = pt | ((time_t)1 << i);
20636             if (x < 0 || x < pt) continue;
20637             gm_check (x, 69, 0x7fffffff);
20638             }
20639         }
20640     printf ("sGMTIME_max=%ld\n", pt);
20641     return (0);
20642     } /* check_max */
20643
20644 int check_min ()
20645 {
20646     tmp = NULL;
20647     pt  = 0;
20648 #ifdef MINLONG
20649     gm_check (MINLONG, -1900, 70);
20650 #endif
20651     if (tmp == NULL) {
20652         for (i = 36; i >= 0; i--) {
20653             time_t x = pt - ((time_t)1 << i);
20654             if (x > 0) continue;
20655             gm_check (x, -1900, 70);
20656             }
20657         }
20658     printf ("sGMTIME_min=%ld\n", pt);
20659     return (0);
20660     } /* check_min */
20661
20662 int main (int argc, char *argv[])
20663 {
20664     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20665     check_max ();
20666     check_min ();
20667     return (0);
20668     } /* main */
20669 EOCP
20670         set try
20671         if eval $compile; then
20672             eval `$run ./try`
20673         else
20674             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20675             fi
20676         $rm_try
20677         ;;
20678     esac
20679
20680 echo "Checking max offsets that localtime () accepts"
20681
20682 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20683     0/0|/)
20684         $cat >try.c <<EOCP
20685 #include <sys/types.h>
20686 #include <stdio.h>
20687 #include <time.h>
20688 $yyy
20689
20690 int i;
20691 struct tm *tmp;
20692 time_t pt;
20693
20694 void local_check (time_t t, int min_year, int max_year)
20695 {
20696     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20697         tmp = NULL;
20698     else
20699         tmp = localtime (&t);
20700     if ( tmp == NULL ||
20701         /* Check tm_year overflow */
20702          tmp->tm_year < min_year || tmp->tm_year > max_year)
20703         tmp = NULL;
20704     else
20705         pt = t;
20706     } /* local_check */
20707
20708 int check_max ()
20709 {
20710     tmp = NULL;
20711     pt  = 0;
20712 #ifdef MAXLONG
20713     local_check (MAXLONG, 69, 0x7fffffff);
20714 #endif
20715     if (tmp == NULL || tmp->tm_year < 0) {
20716         for (i = 63; i >= 0; i--) {
20717             time_t x = pt | ((time_t)1 << i);
20718             if (x < 0 || x < pt) continue;
20719             local_check (x, 69, 0x7fffffff);
20720             }
20721         }
20722     printf ("sLOCALTIME_max=%ld\n", pt);
20723     return (0);
20724    } /* check_max */
20725
20726 int check_min ()
20727 {
20728     tmp = NULL;
20729     pt  = 0;
20730 #ifdef MINLONG
20731     local_check (MINLONG, -1900, 70);
20732 #endif
20733     if (tmp == NULL) {
20734         for (i = 36; i >= 0; i--) {
20735             time_t x = pt - ((time_t)1 << i);
20736             if (x > 0) continue;
20737             local_check (x, -1900, 70);
20738             }
20739         }
20740     printf ("sLOCALTIME_min=%ld\n", pt);
20741     return (0);
20742     } /* check_min */
20743
20744 int main (int argc, char *argv[])
20745 {
20746     check_max ();
20747     check_min ();
20748     return (0);
20749     } /* main */
20750 EOCP
20751         set try
20752         if eval $compile; then
20753             eval `$run ./try`
20754         else
20755             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20756             fi
20757         $rm_try
20758         ;;
20759     esac
20760
20761 : check for type of arguments to select.
20762 case "$selecttype" in
20763 '') case "$d_select" in
20764         $define)
20765                 echo " "
20766                 $cat <<EOM
20767 Checking to see what type of arguments are accepted by select().
20768 EOM
20769                 hdrs="$define sys/types.h
20770                         $i_systime sys/time.h
20771                         $i_sysselct sys/select.h
20772                         $d_socket sys/socket.h"
20773                 : The first arg can be int, unsigned, or size_t
20774                 : The last arg may or may not be 'const'
20775                 val=''
20776                 : void pointer has been seen but using that
20777                 : breaks the selectminbits test
20778                 for xxx in 'fd_set *' 'int *'; do
20779                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20780                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20781                                         case "$val" in
20782                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20783                                                 if ./protochk "$try" $hdrs; then
20784                                                         echo "Your system accepts $xxx."
20785                                                         val="$xxx"
20786                                                 fi
20787                                                 ;;
20788                                         esac
20789                                 done
20790                         done
20791                 done
20792                 case "$val" in
20793                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20794                         case "$d_fd_set" in
20795                                 $define) dflt="fd_set *" ;;
20796                                 *)              dflt="int *" ;;
20797                         esac
20798                         . ./myread
20799                         val=$ans
20800                         ;;
20801                 esac
20802                 selecttype="$val"
20803                 ;;
20804         *)      : no select, so pick a harmless default
20805                 selecttype='int *'
20806                 ;;
20807         esac
20808         ;;
20809 esac
20810
20811 : check for the select 'width'
20812 case "$selectminbits" in
20813 '') safebits=`expr $ptrsize \* 8`
20814     case "$d_select" in
20815         $define)
20816                 $cat <<EOM
20817
20818 Checking to see on how many bits at a time your select() operates...
20819 EOM
20820                 $cat >try.c <<EOCP
20821 #include <sys/types.h>
20822 #$i_time I_TIME
20823 #$i_systime I_SYS_TIME
20824 #$i_systimek I_SYS_TIME_KERNEL
20825 #ifdef I_TIME
20826 #   include <time.h>
20827 #endif
20828 #ifdef I_SYS_TIME
20829 #   ifdef I_SYS_TIME_KERNEL
20830 #       define KERNEL
20831 #   endif
20832 #   include <sys/time.h>
20833 #   ifdef I_SYS_TIME_KERNEL
20834 #       undef KERNEL
20835 #   endif
20836 #endif
20837 #$i_sysselct I_SYS_SELECT
20838 #ifdef I_SYS_SELECT
20839 #include <sys/select.h>
20840 #endif
20841 #$d_socket HAS_SOCKET
20842 #ifdef HAS_SOCKET
20843 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20844 #endif
20845 #include <stdio.h>
20846 #$i_stdlib I_STDLIB
20847 #ifdef I_STDLIB
20848 #include <stdlib.h>
20849 #endif
20850 $selecttype b;
20851 #define S sizeof(*(b))
20852 #define MINBITS 64
20853 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20854 #define NBITS  (NBYTES * 8)
20855 int main() {
20856     char *s = (char *)malloc(NBYTES);
20857     struct timeval t;
20858     int i;
20859     FILE* fp;
20860     int fd;
20861
20862     if (!s)
20863         exit(1);
20864     fclose(stdin);
20865     fp = fopen("try.c", "r");
20866     if (fp == 0)
20867       exit(2);
20868     fd = fileno(fp);
20869     if (fd < 0)
20870       exit(3);
20871     b = ($selecttype)s;
20872     for (i = 0; i < NBITS; i++)
20873         FD_SET(i, b);
20874     t.tv_sec  = 0;
20875     t.tv_usec = 0;
20876     select(fd + 1, b, 0, 0, &t);
20877     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20878     free(s);
20879     printf("%d\n", i + 1);
20880     return 0;
20881 }
20882 EOCP
20883                 set try
20884                 if eval $compile_ok; then
20885                         selectminbits=`$run ./try`
20886                         case "$selectminbits" in
20887                         '')     cat >&4 <<EOM
20888 Cannot figure out on how many bits at a time your select() operates.
20889 I'll play safe and guess it is $safebits bits.
20890 EOM
20891                                 selectminbits=$safebits
20892                                 bits="$safebits bits"
20893                                 ;;
20894                         1)      bits="1 bit" ;;
20895                         *)      bits="$selectminbits bits" ;;
20896                         esac
20897                         echo "Your select() operates on $bits at a time." >&4
20898                 else
20899                         rp='What is the minimum number of bits your select() operates on?'
20900                         case "$byteorder" in
20901                         12345678)       dflt=64 ;;
20902                         1234)           dflt=32 ;;
20903                         *)              dflt=1  ;;
20904                         esac
20905                         . ./myread
20906                         val=$ans
20907                         selectminbits="$val"
20908                 fi
20909                 $rm_try
20910                 ;;
20911         *)      : no select, so pick a harmless default
20912                 selectminbits=$safebits
20913                 ;;
20914         esac
20915         ;;
20916 esac
20917
20918 : Trace out the files included by signal.h, then look for SIGxxx names.
20919 if [ "X$fieldn" = X ]; then
20920         : Just make some guesses.  We check them later.
20921         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20922 else
20923         xxx=`echo '#include <signal.h>' |
20924         $cppstdin $cppminus $cppflags 2>/dev/null |
20925         $grep '^[       ]*#.*include' |
20926         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20927                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20928 fi
20929 xxxfiles=''
20930 for xx in $xxx /dev/null ; do
20931         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20932 done
20933 case "$xxxfiles" in
20934 '')     xxxfiles=`./findhdr signal.h` ;;
20935 esac
20936 xxx=`awk '
20937 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20938         print substr($2, 4, 20)
20939 }
20940 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20941         print substr($3, 4, 20)
20942 }' $xxxfiles`
20943 : Append some common names just in case the awk scan failed.
20944 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20945 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20946 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20947 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20948 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20949
20950 : generate a few handy files for later
20951 $cat > signal.c <<EOCP
20952 #include <sys/types.h>
20953 #include <signal.h>
20954 #$i_stdlib I_STDLIB
20955 #ifdef I_STDLIB
20956 #include <stdlib.h>
20957 #endif
20958 #include <stdio.h>
20959 int main() {
20960
20961 /* Strange style to avoid deeply-nested #if/#else/#endif */
20962 #ifndef NSIG
20963 #  ifdef _NSIG
20964 #    define NSIG (_NSIG)
20965 #  endif
20966 #endif
20967
20968 #ifndef NSIG
20969 #  ifdef SIGMAX
20970 #    define NSIG (SIGMAX+1)
20971 #  endif
20972 #endif
20973
20974 #ifndef NSIG
20975 #  ifdef SIG_MAX
20976 #    define NSIG (SIG_MAX+1)
20977 #  endif
20978 #endif
20979
20980 #ifndef NSIG
20981 #  ifdef _SIG_MAX
20982 #    define NSIG (_SIG_MAX+1)
20983 #  endif
20984 #endif
20985
20986 #ifndef NSIG
20987 #  ifdef MAXSIG
20988 #    define NSIG (MAXSIG+1)
20989 #  endif
20990 #endif
20991
20992 #ifndef NSIG
20993 #  ifdef MAX_SIG
20994 #    define NSIG (MAX_SIG+1)
20995 #  endif
20996 #endif
20997
20998 #ifndef NSIG
20999 #  ifdef SIGARRAYSIZE
21000 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21001 #  endif
21002 #endif
21003
21004 #ifndef NSIG
21005 #  ifdef _sys_nsig
21006 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
21007 #  endif
21008 #endif
21009
21010 /* Default to some arbitrary number that's big enough to get most
21011    of the common signals.
21012 */
21013 #ifndef NSIG
21014 #    define NSIG 50
21015 #endif
21016
21017 printf("NSIG %d\n", NSIG);
21018
21019 #ifndef JUST_NSIG
21020
21021 EOCP
21022
21023 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21024 {
21025         printf "#ifdef SIG"; printf $1; printf "\n"
21026         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21027         printf $1; printf ");\n"
21028         printf "#endif\n"
21029 }
21030 END {
21031         printf "#endif /* JUST_NSIG */\n";
21032         printf "exit(0);\n}\n";
21033 }
21034 ' >>signal.c
21035 $cat >signal.awk <<'EOP'
21036 BEGIN { ndups = 0 }
21037 $1 ~ /^NSIG$/ { nsig = $2 }
21038 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21039     if ($2 > maxsig) { maxsig = $2 }
21040     if (sig_name[$2]) {
21041         dup_name[ndups] = $1
21042         dup_num[ndups] = $2
21043         ndups++
21044     }
21045     else {
21046         sig_name[$2] = $1
21047         sig_num[$2] = $2
21048     }
21049 }
21050 END {
21051     if (nsig == 0) {
21052         nsig = maxsig + 1
21053     }
21054     printf("NSIG %d\n", nsig);
21055     for (n = 1; n < nsig; n++) {
21056         if (sig_name[n]) {
21057             printf("%s %d\n", sig_name[n], sig_num[n])
21058         }
21059         else {
21060             printf("NUM%d %d\n", n, n)
21061         }
21062     }
21063     for (n = 0; n < ndups; n++) {
21064         printf("%s %d\n", dup_name[n], dup_num[n])
21065     }
21066 }
21067 EOP
21068 $cat >signal_cmd <<EOS
21069 $startsh
21070 if $test -s signal.lst; then
21071     echo "Using your existing signal.lst file"
21072         exit 0
21073 fi
21074 xxx="$xxx"
21075 EOS
21076 $cat >>signal_cmd <<'EOS'
21077
21078 set signal
21079 if eval $compile_ok; then
21080         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21081                 $uniq | $awk -f signal.awk >signal.lst
21082 else
21083         echo "(I can't seem be able to compile the whole test program)" >&4
21084         echo "(I'll try it in little pieces.)" >&4
21085         set signal -DJUST_NSIG
21086         if eval $compile_ok; then
21087                 $run ./signal$_exe > signal.nsg
21088                 $cat signal.nsg
21089         else
21090                 echo "I can't seem to figure out how many signals you have." >&4
21091                 echo "Guessing 50." >&4
21092                 echo 'NSIG 50' > signal.nsg
21093         fi
21094         : Now look at all the signal names, one at a time.
21095         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21096                 $cat > signal.c <<EOCP
21097 #include <sys/types.h>
21098 #include <signal.h>
21099 #include <stdio.h>
21100 int main() {
21101 printf("$xx %d\n", SIG${xx});
21102 return 0;
21103 }
21104 EOCP
21105                 set signal
21106                 if eval $compile; then
21107                         echo "SIG${xx} found."
21108                         $run ./signal$_exe  >> signal.ls1
21109                 else
21110                         echo "SIG${xx} NOT found."
21111                 fi
21112         done
21113         if $test -s signal.ls1; then
21114                 $cat signal.nsg signal.ls1 |
21115                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21116         fi
21117
21118 fi
21119 if $test -s signal.lst; then
21120         :
21121 else
21122         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21123         echo 'kill -l' >signal
21124         set X `csh -f <signal`
21125         $rm -f signal
21126         shift
21127         case $# in
21128         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21129         esac
21130         echo $@ | $tr ' ' $trnl | \
21131             $awk '{ printf "%s %d\n", $1, ++s; }
21132                   END { printf "NSIG %d\n", ++s }' >signal.lst
21133 fi
21134 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21135 EOS
21136 chmod a+x signal_cmd
21137 $eunicefix signal_cmd
21138
21139 : generate list of signal names
21140 echo " "
21141 case "$sig_name_init" in
21142 '') doinit=yes ;;
21143 *)  case "$sig_num_init" in
21144     ''|*,*) doinit=yes ;;
21145     esac ;;
21146 esac
21147 case "$doinit" in
21148 yes)
21149         echo "Generating a list of signal names and numbers..." >&4
21150         . ./signal_cmd
21151         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21152         sig_name=`$awk 'BEGIN { printf "ZERO " }
21153                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21154         sig_num=`$awk  'BEGIN { printf "0 " }
21155                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21156         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21157                              !/^NSIG/   { printf "\"%s\", ", $1 }
21158                              END        { printf "0\n" }' signal.lst`
21159         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21160                              !/^NSIG/   { printf "%d, ", $2}
21161                              END        { printf "0\n"}' signal.lst`
21162         ;;
21163 esac
21164 echo "The following $sig_count signals are available:"
21165 echo " "
21166 echo $sig_name | $awk \
21167 'BEGIN { linelen = 0 }
21168 {
21169         for (i = 1; i <= NF; i++) {
21170                 name = "SIG" $i " "
21171                 linelen = linelen + length(name)
21172                 if (linelen > 70) {
21173                         printf "\n"
21174                         linelen = length(name)
21175                 }
21176                 printf "%s", name
21177         }
21178         printf "\n"
21179 }'
21180 sig_size=`echo $sig_name | awk '{print NF}'`
21181 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21182
21183 : Check size of size
21184 echo " "
21185 case "$sizetype" in
21186 *_t) zzz="$sizetype"    ;;
21187 *)   zzz="filesize"     ;;
21188 esac
21189 echo "Checking the size of $zzz..." >&4
21190 cat > try.c <<EOCP
21191 #include <sys/types.h>
21192 #include <stdio.h>
21193 #$i_stdlib I_STDLIB
21194 #ifdef I_STDLIB
21195 #include <stdlib.h>
21196 #endif
21197 int main() {
21198     printf("%d\n", (int)sizeof($sizetype));
21199     exit(0);
21200 }
21201 EOCP
21202 set try
21203 if eval $compile_ok; then
21204         yyy=`$run ./try`
21205         case "$yyy" in
21206         '')     sizesize=4
21207                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21208                 ;;
21209         *)      sizesize=$yyy
21210                 echo "Your $zzz size is $sizesize bytes."
21211                 ;;
21212         esac
21213 else
21214         sizesize=4
21215         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21216 fi
21217
21218
21219 : check for socklen_t
21220 echo " "
21221 echo "Checking to see if you have socklen_t..." >&4
21222 $cat >try.c <<EOCP
21223 #include <sys/types.h>
21224 #$d_socket HAS_SOCKET
21225 #ifdef HAS_SOCKET
21226 #include <sys/socket.h>
21227 #endif
21228 int main() { socklen_t x = 16; }
21229 EOCP
21230 set try
21231 if eval $compile; then
21232         val="$define"
21233         echo "You have socklen_t."
21234 else
21235         val="$undef"
21236         echo "You do not have socklen_t."
21237         case "$sizetype" in
21238         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21239         esac
21240 fi
21241 $rm_try
21242 set d_socklen_t
21243 eval $setvar
21244
21245 : see if this is a socks.h system
21246 set socks.h i_socks
21247 eval $inhdr
21248
21249 : check for type of the size argument to socket calls
21250 case "$d_socket" in
21251 "$define")
21252         $cat <<EOM
21253
21254 Checking to see what type is the last argument of accept().
21255 EOM
21256         yyy=''
21257         case "$d_socklen_t" in
21258         "$define") yyy="$yyy socklen_t"
21259         esac
21260         yyy="$yyy $sizetype int long unsigned"
21261         for xxx in $yyy; do
21262                 case "$socksizetype" in
21263                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21264                         case "$usesocks" in
21265                         "$define")
21266                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21267                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21268                                         socksizetype="$xxx"
21269                                 fi
21270                                 ;;
21271                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21272                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21273                                         socksizetype="$xxx"
21274                                 fi
21275                                 ;;
21276                         esac
21277                         ;;
21278                 esac
21279         done
21280 : In case none of those worked, prompt the user.
21281         case "$socksizetype" in
21282         '')     rp='What is the type for socket address structure sizes?'
21283                 dflt='int'
21284                 . ./myread
21285                 socksizetype=$ans
21286                 ;;
21287         esac
21288         ;;
21289 *)      : no sockets, so pick relatively harmless default
21290         socksizetype='int'
21291         ;;
21292 esac
21293
21294 : see what type is used for signed size_t
21295 set ssize_t ssizetype int stdio.h sys/types.h
21296 eval $typedef
21297 dflt="$ssizetype"
21298 $cat > try.c <<EOM
21299 #include <stdio.h>
21300 #$i_stdlib I_STDLIB
21301 #ifdef I_STDLIB
21302 #include <stdlib.h>
21303 #endif
21304 #include <sys/types.h>
21305 #define Size_t $sizetype
21306 #define SSize_t $dflt
21307 int main()
21308 {
21309         if (sizeof(Size_t) == sizeof(SSize_t))
21310                 printf("$dflt\n");
21311         else if (sizeof(Size_t) == sizeof(int))
21312                 printf("int\n");
21313         else
21314                 printf("long\n");
21315         exit(0);
21316 }
21317 EOM
21318 echo " "
21319 set try
21320 if eval $compile_ok && $run ./try > /dev/null; then
21321         ssizetype=`$run ./try`
21322         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21323 else
21324         $cat >&4 <<EOM
21325 Help! I can't compile and run the ssize_t test program: please enlighten me!
21326 (This is probably a misconfiguration in your system or libraries, and
21327 you really ought to fix it.  Still, I'll try anyway.)
21328
21329 I need a type that is the same size as $sizetype, but is guaranteed to
21330 be signed.  Common values are ssize_t, int and long.
21331
21332 EOM
21333         rp="What signed type is the same size as $sizetype?"
21334         . ./myread
21335         ssizetype="$ans"
21336 fi
21337 $rm_try
21338
21339 : Check the size of st_ino
21340 $echo " "
21341 $echo "Checking the size of st_ino..." >&4
21342 $cat > try.c <<EOCP
21343 #include <sys/stat.h>
21344 #include <stdio.h>
21345 #$i_stdlib I_STDLIB
21346 #ifdef I_STDLIB
21347 #include <stdlib.h>
21348 #endif
21349 int main() {
21350     struct stat st;
21351     printf("%d\n", (int)sizeof(st.st_ino));
21352     exit(0);
21353 }
21354 EOCP
21355 set try
21356 if eval $compile_ok; then
21357         val=`$run ./try`
21358         case "$val" in
21359         '')     st_ino_size=4
21360                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21361                 ;;
21362         *)      st_ino_size=$val
21363                 $echo "Your st_ino is $st_ino_size bytes long."
21364                 ;;
21365         esac
21366 else
21367         st_ino_size=4
21368         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21369 fi
21370 $rm_try
21371
21372 : Check if st_ino is signed
21373 $echo " "
21374 $echo "Checking the sign of st_ino..." >&4
21375 $cat > try.c <<EOCP
21376 #include <sys/stat.h>
21377 #include <stdio.h>
21378 int main() {
21379         struct stat foo;
21380         foo.st_ino = -1;
21381         if (foo.st_ino < 0)
21382                 printf("-1\n");
21383         else
21384                 printf("1\n");
21385 }
21386 EOCP
21387 set try
21388 if eval $compile; then
21389         val=`$run ./try`
21390         case "$val" in
21391         '')     st_ino_sign=1
21392                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21393                 ;;
21394         *)      st_ino_sign=$val
21395                 case "$st_ino_sign" in
21396                  1) $echo "Your st_ino is unsigned." ;;
21397                 -1) $echo "Your st_ino is signed."   ;;
21398                 esac
21399                 ;;
21400         esac
21401 else
21402         st_ino_sign=1
21403         $echo "(I can't compile the test program--guessing unsigned.)" >&4
21404 fi
21405 $rm_try
21406
21407 : see what type of char stdio uses.
21408 echo " "
21409 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21410 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21411         echo "Your stdio uses unsigned chars." >&4
21412         stdchar="unsigned char"
21413 else
21414         echo "Your stdio uses signed chars." >&4
21415         stdchar="char"
21416 fi
21417 $rm -f stdioh
21418
21419 : see what type uids are declared as in the kernel
21420 echo " "
21421 echo "Looking for the type for user ids returned by getuid()."
21422 set uid_t uidtype xxx stdio.h sys/types.h
21423 eval $typedef
21424 case "$uidtype" in
21425 xxx)
21426         xxx=`./findhdr sys/user.h`
21427         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21428         case $1 in
21429         unsigned) dflt="$1 $2" ;;
21430         *) dflt="$1" ;;
21431         esac
21432         ;;
21433 *) dflt="$uidtype";;
21434 esac
21435 case "$uidtype" in
21436 uid_t)  echo "uid_t found." ;;
21437 *)      rp="What is the type for user ids returned by getuid()?"
21438         . ./myread
21439         uidtype="$ans"
21440         ;;
21441 esac
21442
21443 : Check size of UID
21444 echo " "
21445 case "$uidtype" in
21446 *_t) zzz="$uidtype"     ;;
21447 *)   zzz="uid"          ;;
21448 esac
21449 echo "Checking the size of $zzz..." >&4
21450 cat > try.c <<EOCP
21451 #include <sys/types.h>
21452 #include <stdio.h>
21453 #$i_stdlib I_STDLIB
21454 #ifdef I_STDLIB
21455 #include <stdlib.h>
21456 #endif
21457 int main() {
21458     printf("%d\n", (int)sizeof($uidtype));
21459     exit(0);
21460 }
21461 EOCP
21462 set try
21463 if eval $compile_ok; then
21464         yyy=`$run ./try`
21465         case "$yyy" in
21466         '')     uidsize=4
21467                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21468                 ;;
21469         *)      uidsize=$yyy
21470                 echo "Your $zzz is $uidsize bytes long."
21471                 ;;
21472         esac
21473 else
21474         uidsize=4
21475         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21476 fi
21477
21478 : Check if UID is signed
21479 echo " "
21480 case "$uidtype" in
21481 *_t) zzz="$uidtype"     ;;
21482 *)   zzz="uid"          ;;
21483 esac
21484 echo "Checking the sign of $zzz..." >&4
21485 cat > try.c <<EOCP
21486 #include <sys/types.h>
21487 #include <stdio.h>
21488 int main() {
21489         $uidtype foo = -1;
21490         if (foo < 0)
21491                 printf("-1\n");
21492         else
21493                 printf("1\n");
21494 }
21495 EOCP
21496 set try
21497 if eval $compile; then
21498         yyy=`$run ./try`
21499         case "$yyy" in
21500         '')     uidsign=1
21501                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21502                 ;;
21503         *)      uidsign=$yyy
21504                 case "$uidsign" in
21505                  1) echo "Your $zzz is unsigned." ;;
21506                 -1) echo "Your $zzz is signed."   ;;
21507                 esac
21508                 ;;
21509         esac
21510 else
21511         uidsign=1
21512         echo "(I can't compile the test program--guessing unsigned.)" >&4
21513 fi
21514
21515
21516 : Check format string for UID
21517 echo " "
21518 $echo "Checking the format string to be used for uids..." >&4
21519
21520 case "$uidsign" in
21521 -1)     if $test X"$uidsize" = X"$ivsize"; then
21522                 uidformat="$ivdformat"
21523         else
21524                 if $test X"$uidsize" = X"$longsize"; then
21525                         uidformat='"ld"'
21526                 else
21527                         if $test X"$uidsize" = X"$intsize"; then
21528                                 uidformat='"d"'
21529                         else
21530                                 if $test X"$uidsize" = X"$shortsize"; then
21531                                         uidformat='"hd"'
21532                                 fi
21533                         fi
21534                 fi
21535         fi
21536         ;;
21537 *)      if $test X"$uidsize" = X"$uvsize"; then
21538                 uidformat="$uvuformat"
21539         else
21540                 if $test X"$uidsize" = X"$longsize"; then
21541                         uidformat='"lu"'
21542                 else
21543                         if $test X"$uidsize" = X"$intsize"; then
21544                                 uidformat='"u"'
21545                         else
21546                                 if $test X"$uidsize" = X"$shortsize"; then
21547                                         uidformat='"hu"'
21548                                 fi
21549                         fi
21550                 fi
21551         fi
21552         ;;
21553 esac
21554
21555 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21556 echo " "
21557 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21558 $cat >try.c <<'EOM'
21559 /* Intentionally a long probe as I'd like to sanity check that the exact
21560    approach is going to work, as thinking it will work, but only having it
21561    part working at runtime is worse than not having it.  */
21562
21563 #include <sys/types.h>
21564 #include <sys/sysctl.h>
21565 #include <sys/param.h>
21566 #include <stdio.h>
21567 #include <string.h>
21568 #include <stdlib.h>
21569 #include <unistd.h>
21570
21571 int
21572 main(int argc, char **argv) {
21573     char *buffer;
21574     char *argv_leaf = strrchr(argv[0], '/');
21575     char *buffer_leaf;
21576     size_t size = 0;
21577     int mib[4];
21578
21579     mib[0] = CTL_KERN;
21580     mib[1] = KERN_PROC;
21581     mib[2] = KERN_PROC_PATHNAME;
21582     mib[3] = -1;
21583
21584     if (!argv_leaf) {
21585         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21586         return 1;
21587     }
21588
21589     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21590         perror("sysctl");
21591         return 2;
21592     }
21593
21594     if (size < strlen(argv_leaf) + 1) {
21595         fprintf(stderr, "size %lu is too short for a path\n",
21596                 (unsigned long) size);
21597         return 3;
21598     }
21599
21600     if (size > MAXPATHLEN * MAXPATHLEN) {
21601         fprintf(stderr, "size %lu is too long for a path\n",
21602                 (unsigned long) size);
21603         return 4;
21604     }
21605
21606     buffer = malloc(size);
21607     if (!buffer) {
21608         perror("malloc");
21609         return 5;
21610     }
21611
21612     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21613         perror("sysctl");
21614         return 6;
21615     }
21616
21617     if (strlen(buffer) + 1 != size) {
21618         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21619                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21620         return 7;
21621     }
21622
21623
21624     if (*buffer != '/') {
21625         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21626         return 8;
21627     }
21628
21629     if (strstr(buffer, "/./")) {
21630         fprintf(stderr, "Contains /./: '%s'\n", buffer);
21631         return 9;
21632     }
21633
21634     if (strstr(buffer, "/../")) {
21635         fprintf(stderr, "Contains /../: '%s'\n", buffer);
21636         return 10;
21637     }
21638
21639     buffer_leaf = strrchr(buffer, '/');
21640     if (strcmp(buffer_leaf, argv_leaf) != 0) {
21641         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21642         return 11;
21643     }
21644
21645     free(buffer);
21646
21647     return 0;
21648 }
21649 EOM
21650
21651 val=$undef
21652 set try
21653 if eval $compile; then
21654         if $run ./try; then
21655                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21656                 val="$define"
21657         else
21658                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21659                 val="$undef"
21660         fi
21661 else
21662         echo "I'm unable to compile the test program." >&4
21663         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21664         val="$undef"
21665 fi
21666 $rm_try
21667 set usekernprocpathname
21668 eval $setvar
21669
21670 : Determine if we can use _NSGetExecutablePath to find executing program
21671 echo " "
21672 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21673 $cat >try.c <<'EOM'
21674 /* Intentionally a long probe as I'd like to sanity check that the exact
21675    approach is going to work, as thinking it will work, but only having it
21676    part working at runtime is worse than not having it.  */
21677 #include <mach-o/dyld.h>
21678 #include <stdio.h>
21679 #include <stdlib.h>
21680 #include <sys/param.h>
21681 #include <string.h>
21682
21683 int
21684 main(int argc, char **argv) {
21685     char buf[1];
21686     uint32_t size = sizeof(buf);
21687     int result;
21688     char *buffer;
21689     char *tidied;
21690     char *argv_leaf = strrchr(argv[0], '/');
21691     char *tidied_leaf;
21692
21693     if (!argv_leaf) {
21694         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21695         return 1;
21696     }
21697
21698     _NSGetExecutablePath(buf, &size);
21699     if (size > MAXPATHLEN * MAXPATHLEN) {
21700         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21701                 (unsigned int) size);
21702         return 2;
21703     }
21704
21705     buffer = malloc(size);
21706     if (!buffer) {
21707         perror("malloc");
21708         return 3;
21709     }
21710
21711     result = _NSGetExecutablePath(buffer, &size);
21712     if (result != 0) {
21713         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21714                 result, (unsigned int) size);
21715         return 4;
21716     }
21717
21718     tidied = realpath(buffer, NULL);
21719     if (!tidied) {
21720         perror("realpath");
21721         return 5;
21722     }
21723
21724     free(buffer);
21725
21726     if (*tidied != '/') {
21727         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21728         return 6;
21729     }
21730
21731     if (strstr(tidied, "/./")) {
21732         fprintf(stderr, "Contains /./: '%s'\n", tidied);
21733         return 7;
21734     }
21735
21736     if (strstr(tidied, "/../")) {
21737         fprintf(stderr, "Contains /../: '%s'\n", tidied);
21738         return 8;
21739     }
21740
21741     tidied_leaf = strrchr(tidied, '/');
21742     if (strcmp(tidied_leaf, argv_leaf) != 0) {
21743         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21744         return 9;
21745     }
21746
21747     free(tidied);
21748
21749     return 0;
21750 }
21751 EOM
21752
21753 val=$undef
21754 set try
21755 if eval $compile; then
21756         if $run ./try; then
21757                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21758                 val="$define"
21759         else
21760                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21761         fi
21762 else
21763         echo "I'm unable to compile the test program." >&4
21764         echo "I'll assume no _NSGetExecutablePath here." >&4
21765 fi
21766 $rm_try
21767 set usensgetexecutablepath
21768 eval $setvar
21769
21770 : Check if site customization support was requested
21771 case "$usesitecustomize" in
21772     $define|true|[Yy]*)
21773         usesitecustomize="$define"
21774         ;;
21775     *)
21776         usesitecustomize="$undef"
21777         ;;
21778     esac
21779
21780 : see if prototypes support variable argument declarations
21781 echo " "
21782 case "$prototype$i_stdarg" in
21783 $define$define)
21784         echo "It appears we'll be able to prototype varargs functions." >&4
21785         val="$define"
21786         ;;
21787 *)
21788         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21789         val="$undef"
21790         ;;
21791 esac
21792 set vaproto
21793 eval $setvar
21794
21795 : determine compiler compiler
21796 case "$yacc" in
21797 '')
21798         dflt=yacc;;
21799 *)
21800         dflt="$yacc";;
21801 esac
21802 echo " "
21803 comp='yacc'
21804 if $test -f "$byacc$_exe"; then
21805         dflt="$byacc"
21806         comp="byacc or $comp"
21807 fi
21808 if $test -f "$bison$_exe"; then
21809         comp="$comp or bison -y"
21810 fi
21811 rp="Which compiler compiler ($comp) shall I use?"
21812 . ./myread
21813 yacc="$ans"
21814 case "$yacc" in
21815 *bis*)
21816         case "$yacc" in
21817         *-y*) ;;
21818         *)
21819                 yacc="$yacc -y"
21820                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21821                 ;;
21822         esac
21823         ;;
21824 esac
21825
21826 : see if this is a assert.h system
21827 set assert.h i_assert
21828 eval $inhdr
21829
21830 : see if this is a fp.h system
21831 set fp.h i_fp
21832 eval $inhdr
21833
21834 : see if this is a fp_class.h system
21835 set fp_class.h i_fp_class
21836 eval $inhdr
21837
21838 : see if gdbm.h is available
21839 set gdbm.h t_gdbm
21840 eval $inhdr
21841 case "$t_gdbm" in
21842 $define)
21843         : see if gdbm_open exists
21844         set gdbm_open d_gdbm_open
21845         eval $inlibc
21846         case "$d_gdbm_open" in
21847         $undef)
21848                 t_gdbm="$undef"
21849                 echo "We won't be including <gdbm.h>"
21850                 ;;
21851         esac
21852         ;;
21853 esac
21854 val="$t_gdbm"
21855 set i_gdbm
21856 eval $setvar
21857
21858 : see if this is a ieeefp.h system
21859 case "$i_ieeefp" in
21860 '' ) set ieeefp.h i_ieeefp
21861      eval $inhdr
21862      ;;
21863 esac
21864
21865 : see if this is a libutil.h system
21866 set libutil.h i_libutil
21867 eval $inhdr
21868
21869 : see if mach cthreads are available
21870 if test "X$usethreads" = "X$define"; then
21871         set mach/cthreads.h i_machcthr
21872         eval $inhdr
21873 else
21874         i_machcthr="$undef"
21875 fi
21876
21877 : see if this is a mntent.h system
21878 set mntent.h i_mntent
21879 eval $inhdr
21880
21881 : see if net/errno.h is available
21882 val=''
21883 set net/errno.h val
21884 eval $inhdr
21885
21886 : Unfortunately, it causes problems on some systems.  Arrgh.
21887 case "$val" in
21888 $define)
21889         cat > try.c <<'EOM'
21890 #include <stdio.h>
21891 #include <errno.h>
21892 #include <net/errno.h>
21893 int func()
21894 {
21895         return ENOTSOCK;
21896 }
21897 EOM
21898         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21899                 echo "We'll be including <net/errno.h>." >&4
21900         else
21901                 echo "We won't be including <net/errno.h>." >&4
21902                 val="$undef"
21903         fi
21904         $rm_try
21905         ;;
21906 esac
21907 set i_neterrno
21908 eval $setvar
21909
21910 : see if netinet/tcp.h is available
21911 set netinet/tcp.h i_netinettcp
21912 eval $inhdr
21913
21914 : see if this is a poll.h system
21915 set poll.h i_poll
21916 eval $inhdr
21917
21918 : see if this is a prot.h system
21919 set prot.h i_prot
21920 eval $inhdr
21921
21922 : Preprocessor symbols
21923 echo " "
21924 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21925 $cat <<'EOSH' > Cppsym.know
21926 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21927 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21928 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21929 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21930 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21931 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21932 bull c cadmus clipper CMU COFF COMPILER_VERSION
21933 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21934 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21935 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21936 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21937 GLIBC GLIBC_MINOR
21938 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21939 H3050R H3050RX hbullx20 hcx host_mips
21940 hp200 hp300 hp700 HP700 hp800 hp9000
21941 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21942 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21943 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21944 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21945 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21946 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21947 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21948 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21949 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21950 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21951 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21952 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21953 MATH_HAS_NO_SIDE_EFFECTS
21954 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21955 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21956 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21957 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21958 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21959 NetBSD news1500 news1700 news1800 news1900 news3700
21960 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21961 ns32016 ns32332 ns32k nsc32000
21962 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21963 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21964 pc532 pdp11 PGC PIC plexus PORTAR posix
21965 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21966 POSIX_C_SOURCE POSIX_SOURCE POWER
21967 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21968 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21969 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21970 sony sony_news sonyrisc sparc sparclite spectrum
21971 stardent stdc STDC_EXT stratos sun sun3 sun386
21972 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21973 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21974 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21975 sysV68 sysV88 Tek4132 Tek4300 titan
21976 TM3200 TM5400 TM5600
21977 tower tower32 tower32_200 tower32_600 tower32_700
21978 tower32_800 tower32_850 tss
21979 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21980 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21981 unix UNIX95 UNIX99 unixpc unos
21982 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21983 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21984 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21985 USGr4 USGr4_2
21986 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21987 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21988 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21989 z8000
21990 EOSH
21991 # Maybe put other stuff here too.
21992 cat <<EOSH >>Cppsym.know
21993 $osname
21994 EOSH
21995 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21996 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21997 $cat Cppsym.know > Cppsym.c
21998 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21999 $rm -f Cppsym.a Cppsym.b Cppsym.c
22000 cat <<EOSH > Cppsym
22001 $startsh
22002 if $test \$# -gt 0; then
22003     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22004     if $test -s Cppsym.got; then
22005         $rm -f Cppsym.got
22006         exit 0
22007     fi
22008     $rm -f Cppsym.got
22009     exit 1
22010 else
22011     $tr " " "$trnl" | ./Cppsym.try
22012     exit 0
22013 fi
22014 EOSH
22015 chmod +x Cppsym
22016 $eunicefix Cppsym
22017 cat <<EOSH > Cppsym.try
22018 $startsh
22019 cat <<'EOCP' > try.c
22020 #include <stdio.h>
22021 #if cpp_stuff == 1
22022 #define STRINGIFY(a)    "a"
22023 #endif
22024 #if cpp_stuff == 42
22025 #define StGiFy(a)  #a
22026 #define STRINGIFY(a)    StGiFy(a)
22027 #endif
22028 #if $cpp_stuff != 1 && $cpp_stuff != 42
22029 #   include "Bletch: How does this C preprocessor stringify macros?"
22030 #endif
22031 int main() {
22032 EOCP
22033 $awk \\
22034 EOSH
22035 cat <<'EOSH' >> Cppsym.try
22036 'length($1) > 0 {
22037     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22038     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22039     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22040     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22041 }'       >> try.c
22042 echo 'return 0;}' >> try.c
22043 EOSH
22044 cat <<EOSH >> Cppsym.try
22045 ccflags="$ccflags"
22046 case "$osname-$gccversion" in
22047 irix-) ccflags="\$ccflags -woff 1178" ;;
22048 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22049 esac
22050 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
22051 EOSH
22052 chmod +x Cppsym.try
22053 $eunicefix Cppsym.try
22054 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22055 : Add in any linux cpp "predefined macros":
22056 case "$osname::$gccversion" in
22057   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22058     tHdrH=_tmpHdr
22059     rm -f $tHdrH'.h' $tHdrH
22060     touch $tHdrH'.h'
22061     # Filter out macro arguments, such as Linux's __INT8_C(c)
22062     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22063        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22064        if [ -s $tHdrH'_cppsym.real' ]; then
22065           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22066        fi
22067     fi
22068     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22069   ;;
22070 esac
22071 : now check the C compiler for additional symbols
22072 postprocess_cc_v=''
22073 case "$osname" in
22074 aix) postprocess_cc_v="|$tr , ' '" ;;
22075 esac
22076 $cat >ccsym <<EOS
22077 $startsh
22078 $cat >tmp.c <<EOF
22079 extern int foo;
22080 EOF
22081 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22082 do
22083         case "\$i" in
22084         -D*) echo "\$i" | $sed 's/^-D//';;
22085         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22086         esac
22087 done
22088 $rm_try
22089 EOS
22090 postprocess_cc_v=''
22091 chmod +x ccsym
22092 $eunicefix ccsym
22093 ./ccsym > ccsym1.raw
22094 if $test -s ccsym1.raw; then
22095        $sort ccsym1.raw | $uniq >ccsym.raw
22096 else
22097        mv ccsym1.raw ccsym.raw
22098 fi
22099
22100 $awk '/\=/ { print $0; next }
22101         { print $0"=1" }' ccsym.raw >ccsym.list
22102 $comm -13 Cppsym.true ccsym.list >ccsym.own
22103 $comm -12 Cppsym.true ccsym.list >ccsym.com
22104 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22105 also=''
22106 if $test -z ccsym.raw; then
22107         echo "Your C compiler doesn't seem to define any symbols!" >&4
22108         echo " "
22109         echo "However, your C preprocessor defines the following symbols:"
22110         $cat Cppsym.true
22111         ccsymbols=''
22112         cppsymbols=`$cat Cppsym.true`
22113         cppsymbols=`echo $cppsymbols`
22114         cppccsymbols="$cppsymbols"
22115 else
22116         if $test -s ccsym.com; then
22117                 echo "Your C compiler and pre-processor define these symbols:"
22118                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22119                 also='also '
22120                 symbols='ones'
22121                 cppccsymbols=`$cat ccsym.com`
22122                 cppccsymbols=`echo $cppccsymbols`
22123                 $test "$silent" || sleep 1
22124         fi
22125         if $test -s ccsym.cpp; then
22126                 $test "$also" && echo " "
22127                 echo "Your C pre-processor ${also}defines the following symbols:"
22128                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22129                 also='further '
22130                 cppsymbols=`$cat ccsym.cpp`
22131                 cppsymbols=`echo $cppsymbols`
22132                 $test "$silent" || sleep 1
22133         fi
22134         if $test -s ccsym.own; then
22135                 $test "$also" && echo " "
22136                 echo "Your C compiler ${also}defines the following cpp symbols:"
22137                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22138                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22139                 ccsymbols=`$cat ccsym.own`
22140                 ccsymbols=`echo $ccsymbols`
22141                 $test "$silent" || sleep 1
22142         fi
22143 fi
22144
22145 : see if this is a termio system
22146 val="$undef"
22147 val2="$undef"
22148 val3="$undef"
22149 if $test `./findhdr termios.h`; then
22150         set tcsetattr i_termios
22151         eval $inlibc
22152         val3="$i_termios"
22153 fi
22154 echo " "
22155 case "$val3" in
22156 "$define") echo "You have POSIX termios.h... good!" >&4;;
22157 *) if ./Cppsym pyr; then
22158                 case "`/bin/universe`" in
22159                 ucb) if $test `./findhdr sgtty.h`; then
22160                                 val2="$define"
22161                                 echo "<sgtty.h> found." >&4
22162                         else
22163                                 echo "System is pyramid with BSD universe."
22164                                 ./warn "<sgtty.h> not found--you could have problems."
22165                         fi;;
22166                 *) if $test `./findhdr termio.h`; then
22167                                 val="$define"
22168                                 echo "<termio.h> found." >&4
22169                         else
22170                                 echo "System is pyramid with USG universe."
22171                                 ./warn "<termio.h> not found--you could have problems."
22172                         fi;;
22173                 esac
22174         elif ./usg; then
22175                 if $test `./findhdr termio.h`; then
22176                         echo "<termio.h> found." >&4
22177                         val="$define"
22178                 elif $test `./findhdr sgtty.h`; then
22179                         echo "<sgtty.h> found." >&4
22180                         val2="$define"
22181                 else
22182                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
22183                 fi
22184         else
22185                 if $test `./findhdr sgtty.h`; then
22186                         echo "<sgtty.h> found." >&4
22187                         val2="$define"
22188                 elif $test `./findhdr termio.h`; then
22189                         echo "<termio.h> found." >&4
22190                         val="$define"
22191                 else
22192                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22193                 fi
22194         fi;;
22195 esac
22196 set i_termio; eval $setvar
22197 val=$val2; set i_sgtty; eval $setvar
22198 val=$val3; set i_termios; eval $setvar
22199
22200 : see if stdbool is available
22201 : we want a real compile instead of Inhdr because some Solaris systems
22202 : have stdbool.h, but it can only be used if the compiler indicates it
22203 : is sufficiently c99-compliant.
22204 echo " "
22205 $cat >try.c <<EOCP
22206 #include <stdio.h>
22207 #include <stdbool.h>
22208 int func(bool x)
22209 {
22210     return x ? 1 : 0;
22211 }
22212 int main(int argc, char **argv)
22213 {
22214     return func(0);
22215 }
22216 EOCP
22217 set try
22218 if eval $compile; then
22219         echo "<stdbool.h> found." >&4
22220         val="$define"
22221 else
22222         echo "<stdbool.h> NOT found." >&4
22223         val="$undef"
22224 fi
22225 $rm_try
22226 set i_stdbool
22227 eval $setvar
22228
22229 : see if stddef is available
22230 set stddef.h i_stddef
22231 eval $inhdr
22232
22233 : see if sys/access.h is available
22234 set sys/access.h i_sysaccess
22235 eval $inhdr
22236
22237 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22238 set sys/filio.h i_sysfilio
22239 eval $inhdr
22240 echo " "
22241 if $test `./findhdr sys/ioctl.h`; then
22242         val="$define"
22243         echo '<sys/ioctl.h> found.' >&4
22244 else
22245         val="$undef"
22246         if $test $i_sysfilio = "$define"; then
22247             echo '<sys/ioctl.h> NOT found.' >&4
22248         else
22249                 $test $i_sgtty = "$define" && xxx="sgtty.h"
22250                 $test $i_termio = "$define" && xxx="termio.h"
22251                 $test $i_termios = "$define" && xxx="termios.h"
22252 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22253         fi
22254 fi
22255 set i_sysioctl
22256 eval $setvar
22257
22258 : see if socket ioctl defs are in sys/sockio.h
22259 echo " "
22260 xxx=`./findhdr sys/sockio.h`
22261 if $test "$xxx"; then
22262         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22263                 val="$define"
22264                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22265         else
22266                 val="$undef"
22267                 echo "No socket ioctls found in <sys/sockio.h>." >&4
22268         fi
22269 else
22270         val="$undef"
22271         $cat <<EOM
22272 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22273 EOM
22274 fi
22275 set i_syssockio
22276 eval $setvar
22277
22278 : see if this is a syslog.h system
22279 set syslog.h i_syslog
22280 eval $inhdr
22281
22282 : see if this is a sys/mode.h system
22283 set sys/mode.h i_sysmode
22284 eval $inhdr
22285
22286 : see if there is a sys/poll.h file
22287 set sys/poll.h i_syspoll
22288 eval $inhdr
22289
22290 : see if sys/resource.h has to be included
22291 set sys/resource.h i_sysresrc
22292 eval $inhdr
22293
22294 : see if sys/security.h is available
22295 set sys/security.h i_syssecrt
22296 eval $inhdr
22297
22298 : see if this is a sys/statvfs.h system
22299 set sys/statvfs.h i_sysstatvfs
22300 eval $inhdr
22301
22302 : see if this is a sys/un.h system
22303 set sys/un.h i_sysun
22304 eval $inhdr
22305
22306 : see if this is a sys/utsname.h system
22307 set sys/utsname.h i_sysutsname
22308 eval $inhdr
22309
22310 : see if this is a syswait system
22311 set sys/wait.h i_syswait
22312 eval $inhdr
22313
22314 : see if this is a ustat.h system
22315 set ustat.h i_ustat
22316 eval $inhdr
22317
22318 : see if this is an utime system
22319 set utime.h i_utime
22320 eval $inhdr
22321
22322 : see if this is a vfork system
22323 case "$d_vfork" in
22324 "$define")
22325         set vfork.h i_vfork
22326         eval $inhdr
22327         ;;
22328 *)
22329         i_vfork="$undef"
22330         ;;
22331 esac
22332
22333 : Check extensions
22334 echo " "
22335 echo "Looking for extensions..." >&4
22336 : If we are using the old config.sh, known_extensions may contain
22337 : old or inaccurate or duplicate values.
22338 known_extensions=''
22339 nonxs_extensions=''
22340 : We do not use find because it might not be available.
22341 : We do not just use MANIFEST because the user may have dropped
22342 : some additional extensions into the source tree and expect them
22343 : to be built.
22344
22345 : Function to recursively find available extensions, ignoring DynaLoader
22346 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22347 : In 5.10.1 and later, extensions are stored in directories
22348 : like File-Glob instead of the older File/Glob/.
22349 find_extensions='
22350     for xxx in *; do
22351         case "$xxx" in
22352             DynaLoader|dynaload) ;;
22353             *)
22354             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22355             leaf=`echo $xxx | $sed -e s/.*-//`;
22356             if $test -d File; then
22357                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
22358                     known_extensions="$known_extensions $1$this_ext";
22359                 elif $test -f $xxx/Makefile.PL; then
22360                     nonxs_extensions="$nonxs_extensions $1$this_ext";
22361                 else
22362                     if $test -d $xxx -a $# -lt 10; then
22363                         set $1$xxx/ $*;
22364                         cd "$xxx";
22365                         eval $find_extensions;
22366                         cd ..;
22367                         shift;
22368                     fi;
22369                 fi;
22370             else
22371                 echo " $known_extensions $nonxs_extensions" > $$.tmp;
22372                 if $contains " $this_ext " $$.tmp; then
22373                     echo >&4;
22374                     echo "Duplicate directories detected for extension $xxx" >&4;
22375                     echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22376                     case "$knowitall" in
22377                     "") dflt=y;;
22378                     *) dflt=n;;
22379                     esac;
22380                     . ../UU/myread;
22381                     case "$ans" in
22382                     n*|N*) ;;
22383                     *) echo >&4;
22384                        echo "Ok.  Stopping Configure." >&4;
22385                        echo "Please remove the duplicate directory (eg using git clean) and then re-run Configure" >&4;
22386                         exit 1;;
22387                     esac;
22388                     echo "Ok.  You will need to correct config.sh before running make." >&4;
22389                 fi;
22390                 $ls -1 $xxx > $$.tmp;
22391                 if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
22392                     known_extensions="$known_extensions $this_ext";
22393                 elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
22394                     known_extensions="$known_extensions $this_ext";
22395                 elif $test -d $xxx; then
22396                     nonxs_extensions="$nonxs_extensions $this_ext";
22397                 fi;
22398                 $rm -f $$.tmp;
22399             fi
22400             ;;
22401         esac;
22402     done'
22403 tdir=`pwd`
22404 cd "$rsrc/cpan"
22405 set X
22406 shift
22407 eval $find_extensions
22408 cd "$rsrc/dist"
22409 set X
22410 shift
22411 eval $find_extensions
22412 cd "$rsrc/ext"
22413 set X
22414 shift
22415 eval $find_extensions
22416 if $test -d File-Glob; then
22417     : All ext/ flattened
22418 else
22419     # Special case:  Add in modules that nest beyond the first level.
22420     # Currently threads/shared and Hash/Util/FieldHash, since they are
22421     # not picked up by the recursive find above (and adding in general
22422     # recursive finding breaks SDBM_File/sdbm).
22423     # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
22424     known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
22425 fi
22426 set X $known_extensions
22427 shift
22428 known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22429 set X $nonxs_extensions
22430 shift
22431 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22432 cd "$tdir"
22433
22434 : Now see which are supported on this system.
22435 avail_ext=''
22436 for xxx in $known_extensions ; do
22437         case "$xxx" in
22438         DB_File|db_file)
22439                 case "$i_db" in
22440                 $define) avail_ext="$avail_ext $xxx" ;;
22441                 esac
22442                 ;;
22443         GDBM_File|gdbm_fil)
22444                 case "$i_gdbm" in
22445                 $define) avail_ext="$avail_ext $xxx" ;;
22446                 esac
22447                 ;;
22448         I18N/Langinfo|i18n_lan)
22449                 case "$i_langinfo$d_nl_langinfo" in
22450                 $define$define) avail_ext="$avail_ext $xxx" ;;
22451                 esac
22452                 ;;
22453         IPC/SysV|ipc/sysv)
22454                 : XXX Do we need a useipcsysv variable here
22455                 case "${d_msg}${d_sem}${d_shm}" in
22456                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22457                 esac
22458                 ;;
22459         NDBM_File|ndbm_fil)
22460                 case "$d_ndbm" in
22461                 $define)
22462                     case "$osname-$use64bitint" in
22463                     hpux-define)
22464                         case "$libs" in
22465                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22466                         esac
22467                         ;;
22468                     *) avail_ext="$avail_ext $xxx" ;;
22469                     esac
22470                     ;;
22471                 esac
22472                 ;;
22473         ODBM_File|odbm_fil)
22474                 case "${i_dbm}${i_rpcsvcdbm}" in
22475                 *"${define}"*)
22476                     case "$d_cplusplus" in
22477                     define) ;; # delete as a function name will not work
22478                     *)  case "$osname-$use64bitint" in
22479                         hpux-define)
22480                             case "$libs" in
22481                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22482                             esac
22483                             ;;
22484                         *) avail_ext="$avail_ext $xxx" ;;
22485                         esac
22486                         ;;
22487                     esac
22488                     ;;
22489                 esac
22490                 ;;
22491         Opcode|opcode)
22492                 case "$useopcode" in
22493                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22494                 esac
22495                 ;;
22496         POSIX|posix)
22497                 case "$useposix" in
22498                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22499                 esac
22500                 ;;
22501         Socket|socket)
22502                 case "$d_socket" in
22503                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22504                 esac
22505                 ;;
22506         Sys/Syslog|sys/syslog)
22507                 : XXX syslog requires socket
22508                 case "$d_socket" in
22509                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22510                 esac
22511                 ;;
22512         Thread|thread)
22513                 case "$usethreads" in
22514                 true|$define|y)
22515                         case "$use5005threads" in
22516                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22517                         esac
22518                 esac
22519                 ;;
22520         threads|threads/shared)
22521                 # threads and threads::shared are special cases.
22522                 # To stop people from asking "Perl 5.8.0 was supposed
22523                 # to have this new fancy threads implementation but my
22524                 # perl doesn't have it" and from people trying to
22525                 # (re)install the threads module using CPAN.pm and
22526                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22527                 # the threads.pm and threads/shared.pm will always be
22528                 # there, croaking informatively ("you need to rebuild
22529                 # all of Perl with threads, sorry") when threads haven't
22530                 # been compiled in.
22531                 # --jhi
22532                 avail_ext="$avail_ext $xxx"
22533                 ;;
22534         VMS*)
22535                 ;;
22536         Win32*)
22537                 case "$osname" in
22538                 cygwin) avail_ext="$avail_ext $xxx" ;;
22539                 esac
22540                 ;;
22541         XS/APItest|xs/apitest)
22542                 # This is just for testing.  Skip it unless we have dynamic loading.
22543
22544                 case "$usedl" in
22545                 $define) avail_ext="$avail_ext $xxx" ;;
22546                 esac
22547                 ;;
22548         XS/Typemap|xs/typemap)
22549                 # This is just for testing.  Skip it unless we have dynamic loading.
22550                 case "$usedl" in
22551                 $define) avail_ext="$avail_ext $xxx" ;;
22552                 esac
22553                 ;;
22554         *)      avail_ext="$avail_ext $xxx"
22555                 ;;
22556         esac
22557 done
22558
22559 set X $avail_ext
22560 shift
22561 avail_ext="$*"
22562
22563 case "$onlyextensions" in
22564 '') ;;
22565 *)  keepextensions=''
22566     echo "You have requested that only certain extensions be included..." >&4
22567     for i in $onlyextensions; do
22568         case " $avail_ext " in
22569         *" $i "*)
22570             echo "Keeping extension $i."
22571             keepextensions="$keepextensions $i"
22572             ;;
22573         *) echo "Ignoring extension $i." ;;
22574         esac
22575     done
22576     avail_ext="$keepextensions"
22577     ;;
22578 esac
22579
22580 case "$noextensions" in
22581 '') ;;
22582 *)  keepextensions=''
22583     echo "You have requested that certain extensions be ignored..." >&4
22584     for i in $avail_ext; do
22585         case " $noextensions " in
22586         *" $i "*) echo "Ignoring extension $i." ;;
22587         *) echo "Keeping extension $i.";
22588            keepextensions="$keepextensions $i"
22589            ;;
22590         esac
22591     done
22592     avail_ext="$keepextensions"
22593     ;;
22594 esac
22595
22596 : Now see which nonxs extensions are supported on this system.
22597 : For now assume all are.
22598 nonxs_ext=''
22599 for xxx in $nonxs_extensions ; do
22600         case "$xxx" in
22601         *)      nonxs_ext="$nonxs_ext $xxx"
22602                 ;;
22603         esac
22604 done
22605
22606 set X $nonxs_ext
22607 shift
22608 nonxs_ext="$*"
22609
22610 case $usedl in
22611 $define)
22612         $cat <<EOM
22613 A number of extensions are supplied with $package.  You may choose to
22614 compile these extensions for dynamic loading (the default), compile
22615 them into the $package executable (static loading), or not include
22616 them at all.  Answer "none" to include no extensions.
22617 Note that DynaLoader is always built and need not be mentioned here.
22618
22619 EOM
22620         case "$dynamic_ext" in
22621         '')
22622                 : Exclude those listed in static_ext
22623                 dflt=''
22624                 for xxx in $avail_ext; do
22625                         case " $static_ext " in
22626                         *" $xxx "*) ;;
22627                         *) dflt="$dflt $xxx" ;;
22628                         esac
22629                 done
22630                 set X $dflt
22631                 shift
22632                 dflt="$*"
22633                 ;;
22634         *)      dflt="$dynamic_ext"
22635                 # Perhaps we are reusing an old out-of-date config.sh.
22636                 case "$hint" in
22637                 previous)
22638                         if test X"$dynamic_ext" != X"$avail_ext"; then
22639                                 $cat <<EOM
22640 NOTICE:  Your previous config.sh list may be incorrect.
22641 The extensions now available to you are
22642         ${avail_ext}
22643 but the default list from your previous config.sh is
22644         ${dynamic_ext}
22645
22646 EOM
22647                         fi
22648                         ;;
22649                 esac
22650                 ;;
22651         esac
22652         case "$dflt" in
22653         '')     dflt=none;;
22654         esac
22655         rp="What extensions do you wish to load dynamically?"
22656         . ./myread
22657         case "$ans" in
22658         none) dynamic_ext=' ' ;;
22659         *) dynamic_ext="$ans" ;;
22660         esac
22661
22662         case "$static_ext" in
22663         '')
22664                 : Exclude those already listed in dynamic linking
22665                 dflt=''
22666                 for xxx in $avail_ext; do
22667                         case " $dynamic_ext " in
22668                         *" $xxx "*) ;;
22669                         *) dflt="$dflt $xxx" ;;
22670                         esac
22671                 done
22672                 set X $dflt
22673                 shift
22674                 dflt="$*"
22675                 ;;
22676         *)  dflt="$static_ext"
22677                 ;;
22678         esac
22679
22680         case "$dflt" in
22681         '')     dflt=none;;
22682         esac
22683         rp="What extensions do you wish to load statically?"
22684         . ./myread
22685         case "$ans" in
22686         none) static_ext=' ' ;;
22687         *) static_ext="$ans" ;;
22688         esac
22689         ;;
22690 *)
22691         $cat <<EOM
22692 A number of extensions are supplied with $package.  Answer "none"
22693 to include no extensions.
22694 Note that DynaLoader is always built and need not be mentioned here.
22695
22696 EOM
22697         case "$static_ext" in
22698         '') dflt="$avail_ext" ;;
22699         *)      dflt="$static_ext"
22700                 # Perhaps we are reusing an old out-of-date config.sh.
22701                 case "$hint" in
22702                 previous)
22703                         if test X"$static_ext" != X"$avail_ext"; then
22704                                 $cat <<EOM
22705 NOTICE:  Your previous config.sh list may be incorrect.
22706 The extensions now available to you are
22707         ${avail_ext}
22708 but the default list from your previous config.sh is
22709         ${static_ext}
22710
22711 EOM
22712                         fi
22713                         ;;
22714                 esac
22715                 ;;
22716         esac
22717         : Exclude those that are not xs extensions
22718         case "$dflt" in
22719         '')     dflt=none;;
22720         esac
22721         rp="What extensions do you wish to include?"
22722         . ./myread
22723         case "$ans" in
22724         none) static_ext=' ' ;;
22725         *) static_ext="$ans" ;;
22726         esac
22727         ;;
22728 esac
22729 #
22730 # Encode is a special case.  If we are building Encode as a static
22731 # extension, we need to explicitly list its subextensions as well.
22732 # For other nested extensions, this is handled automatically by
22733 # the appropriate Makefile.PL.
22734 case " $static_ext " in
22735         *" Encode "*) # Add the subextensions of Encode
22736         cd "$rsrc/cpan"
22737         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22738                 static_ext="$static_ext Encode/$xxx"
22739         done
22740         cd "$tdir"
22741         ;;
22742 esac
22743
22744 set X $dynamic_ext $static_ext $nonxs_ext
22745 shift
22746 extensions="$*"
22747
22748 # Sanity check:  We require an extension suitable for use with
22749 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22750 # should show up as failures in the test suite, but it's helpful to
22751 # catch them now.) The 'extensions' list is normally sorted
22752 # alphabetically, so we need to accept either
22753 #    DB_File ... Fcntl ... IO  ....
22754 # or something like
22755 #    Fcntl ... NDBM_File ... IO  ....
22756 case " $extensions"  in
22757 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22758 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22759 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22760 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22761    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22762    ;;
22763 esac
22764
22765 : Remove libraries needed only for extensions
22766 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22767 : The exception is SunOS 4.x, which needs them.
22768 case "${osname}X${osvers}" in
22769 sunos*X4*)
22770     perllibs="$libs"
22771     ;;
22772 *) case "$usedl" in
22773     $define|true|[yY]*)
22774             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
22775             shift
22776             perllibs="$*"
22777             ;;
22778     *)  perllibs="$libs"
22779             ;;
22780     esac
22781     ;;
22782 esac
22783
22784 : Remove build directory name from cppstdin so it can be used from
22785 : either the present location or the final installed location.
22786 echo " "
22787 : Get out of the UU directory to get correct path name.
22788 cd ..
22789 case "$cppstdin" in
22790 `pwd`/cppstdin)
22791         echo "Stripping down cppstdin path name"
22792         cppstdin=cppstdin
22793         ;;
22794 esac
22795 cd UU
22796
22797 : end of configuration questions
22798 echo " "
22799 echo "End of configuration questions."
22800 echo " "
22801
22802 : back to where it started
22803 if test -d ../UU; then
22804         cd ..
22805 fi
22806
22807 : configuration may be unconditionally patched via a 'config.arch' file
22808 if $test -f config.arch; then
22809         echo "I see a config.arch file, loading it." >&4
22810         . ./config.arch
22811 fi
22812
22813 : configuration may be patched via a 'config.over' file
22814 if $test -f config.over; then
22815         echo " "
22816         dflt=y
22817         rp='I see a config.over file.  Do you wish to load it?'
22818         . UU/myread
22819         case "$ans" in
22820         n*) echo "OK, I'll ignore it.";;
22821         *)      . ./config.over
22822                 echo "Configuration override changes have been loaded."
22823                 ;;
22824         esac
22825 fi
22826
22827 : in case they want portability, strip down executable paths
22828 case "$d_portable" in
22829 "$define")
22830         echo " "
22831         echo "Stripping down executable paths..." >&4
22832         for file in $loclist $trylist; do
22833                 eval temp=\$$file
22834                 eval $file=`basename $temp`
22835         done
22836         ;;
22837 esac
22838
22839 : create config.sh file
22840 echo " "
22841 echo "Creating config.sh..." >&4
22842 $spitshell <<EOT >config.sh
22843 $startsh
22844 #
22845 # This file was produced by running the Configure script. It holds all the
22846 # definitions figured out by Configure. Should you modify one of these values,
22847 # do not forget to propagate your changes by running "Configure -der". You may
22848 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22849 #
22850
22851 # Package name      : $package
22852 # Source directory  : $src
22853 # Configuration time: $cf_time
22854 # Configured by     : $cf_by
22855 # Target system     : $myuname
22856
22857 EOT
22858 : Add in command line options if available
22859 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22860
22861 $spitshell <<EOT >>config.sh
22862
22863 Author='$Author'
22864 Date='$Date'
22865 Header='$Header'
22866 Id='$Id'
22867 Locker='$Locker'
22868 Log='$Log'
22869 RCSfile='$RCSfile'
22870 Revision='$Revision'
22871 Source='$Source'
22872 State='$State'
22873 _a='$_a'
22874 _exe='$_exe'
22875 _o='$_o'
22876 afs='$afs'
22877 afsroot='$afsroot'
22878 alignbytes='$alignbytes'
22879 ansi2knr='$ansi2knr'
22880 aphostname='$aphostname'
22881 api_revision='$api_revision'
22882 api_subversion='$api_subversion'
22883 api_version='$api_version'
22884 api_versionstring='$api_versionstring'
22885 ar='$ar'
22886 archlib='$archlib'
22887 archlibexp='$archlibexp'
22888 archname64='$archname64'
22889 archname='$archname'
22890 archobjs='$archobjs'
22891 asctime_r_proto='$asctime_r_proto'
22892 awk='$awk'
22893 baserev='$baserev'
22894 bash='$bash'
22895 bin='$bin'
22896 bin_ELF='$bin_ELF'
22897 binexp='$binexp'
22898 bison='$bison'
22899 bootstrap_charset='$bootstrap_charset'
22900 byacc='$byacc'
22901 byteorder='$byteorder'
22902 c='$c'
22903 castflags='$castflags'
22904 cat='$cat'
22905 cc='$cc'
22906 cccdlflags='$cccdlflags'
22907 ccdlflags='$ccdlflags'
22908 ccflags='$ccflags'
22909 ccflags_uselargefiles='$ccflags_uselargefiles'
22910 ccname='$ccname'
22911 ccsymbols='$ccsymbols'
22912 ccversion='$ccversion'
22913 cf_by='$cf_by'
22914 cf_email='$cf_email'
22915 cf_time='$cf_time'
22916 charbits='$charbits'
22917 charsize='$charsize'
22918 chgrp='$chgrp'
22919 chmod='$chmod'
22920 chown='$chown'
22921 clocktype='$clocktype'
22922 comm='$comm'
22923 compress='$compress'
22924 contains='$contains'
22925 cp='$cp'
22926 cpio='$cpio'
22927 cpp='$cpp'
22928 cpp_stuff='$cpp_stuff'
22929 cppccsymbols='$cppccsymbols'
22930 cppflags='$cppflags'
22931 cpplast='$cpplast'
22932 cppminus='$cppminus'
22933 cpprun='$cpprun'
22934 cppstdin='$cppstdin'
22935 cppsymbols='$cppsymbols'
22936 crypt_r_proto='$crypt_r_proto'
22937 cryptlib='$cryptlib'
22938 csh='$csh'
22939 ctermid_r_proto='$ctermid_r_proto'
22940 ctime_r_proto='$ctime_r_proto'
22941 d_Gconvert='$d_Gconvert'
22942 d_PRIEUldbl='$d_PRIEUldbl'
22943 d_PRIFUldbl='$d_PRIFUldbl'
22944 d_PRIGUldbl='$d_PRIGUldbl'
22945 d_PRIXU64='$d_PRIXU64'
22946 d_PRId64='$d_PRId64'
22947 d_PRIeldbl='$d_PRIeldbl'
22948 d_PRIfldbl='$d_PRIfldbl'
22949 d_PRIgldbl='$d_PRIgldbl'
22950 d_PRIi64='$d_PRIi64'
22951 d_PRIo64='$d_PRIo64'
22952 d_PRIu64='$d_PRIu64'
22953 d_PRIx64='$d_PRIx64'
22954 d_SCNfldbl='$d_SCNfldbl'
22955 d__fwalk='$d__fwalk'
22956 d_access='$d_access'
22957 d_accessx='$d_accessx'
22958 d_aintl='$d_aintl'
22959 d_alarm='$d_alarm'
22960 d_archlib='$d_archlib'
22961 d_asctime64='$d_asctime64'
22962 d_asctime_r='$d_asctime_r'
22963 d_atolf='$d_atolf'
22964 d_atoll='$d_atoll'
22965 d_attribute_deprecated='$d_attribute_deprecated'
22966 d_attribute_format='$d_attribute_format'
22967 d_attribute_malloc='$d_attribute_malloc'
22968 d_attribute_nonnull='$d_attribute_nonnull'
22969 d_attribute_noreturn='$d_attribute_noreturn'
22970 d_attribute_pure='$d_attribute_pure'
22971 d_attribute_unused='$d_attribute_unused'
22972 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22973 d_bcmp='$d_bcmp'
22974 d_bcopy='$d_bcopy'
22975 d_bsd='$d_bsd'
22976 d_bsdgetpgrp='$d_bsdgetpgrp'
22977 d_bsdsetpgrp='$d_bsdsetpgrp'
22978 d_builtin_choose_expr='$d_builtin_choose_expr'
22979 d_builtin_expect='$d_builtin_expect'
22980 d_bzero='$d_bzero'
22981 d_c99_variadic_macros='$d_c99_variadic_macros'
22982 d_casti32='$d_casti32'
22983 d_castneg='$d_castneg'
22984 d_charvspr='$d_charvspr'
22985 d_chown='$d_chown'
22986 d_chroot='$d_chroot'
22987 d_chsize='$d_chsize'
22988 d_class='$d_class'
22989 d_clearenv='$d_clearenv'
22990 d_closedir='$d_closedir'
22991 d_cmsghdr_s='$d_cmsghdr_s'
22992 d_const='$d_const'
22993 d_copysignl='$d_copysignl'
22994 d_cplusplus='$d_cplusplus'
22995 d_crypt='$d_crypt'
22996 d_crypt_r='$d_crypt_r'
22997 d_csh='$d_csh'
22998 d_ctermid='$d_ctermid'
22999 d_ctermid_r='$d_ctermid_r'
23000 d_ctime64='$d_ctime64'
23001 d_ctime_r='$d_ctime_r'
23002 d_cuserid='$d_cuserid'
23003 d_dbl_dig='$d_dbl_dig'
23004 d_dbminitproto='$d_dbminitproto'
23005 d_difftime64='$d_difftime64'
23006 d_difftime='$d_difftime'
23007 d_dir_dd_fd='$d_dir_dd_fd'
23008 d_dirfd='$d_dirfd'
23009 d_dirnamlen='$d_dirnamlen'
23010 d_dlerror='$d_dlerror'
23011 d_dlopen='$d_dlopen'
23012 d_dlsymun='$d_dlsymun'
23013 d_dosuid='$d_dosuid'
23014 d_drand48_r='$d_drand48_r'
23015 d_drand48proto='$d_drand48proto'
23016 d_dup2='$d_dup2'
23017 d_eaccess='$d_eaccess'
23018 d_endgrent='$d_endgrent'
23019 d_endgrent_r='$d_endgrent_r'
23020 d_endhent='$d_endhent'
23021 d_endhostent_r='$d_endhostent_r'
23022 d_endnent='$d_endnent'
23023 d_endnetent_r='$d_endnetent_r'
23024 d_endpent='$d_endpent'
23025 d_endprotoent_r='$d_endprotoent_r'
23026 d_endpwent='$d_endpwent'
23027 d_endpwent_r='$d_endpwent_r'
23028 d_endsent='$d_endsent'
23029 d_endservent_r='$d_endservent_r'
23030 d_eofnblk='$d_eofnblk'
23031 d_eunice='$d_eunice'
23032 d_faststdio='$d_faststdio'
23033 d_fchdir='$d_fchdir'
23034 d_fchmod='$d_fchmod'
23035 d_fchown='$d_fchown'
23036 d_fcntl='$d_fcntl'
23037 d_fcntl_can_lock='$d_fcntl_can_lock'
23038 d_fd_macros='$d_fd_macros'
23039 d_fd_set='$d_fd_set'
23040 d_fds_bits='$d_fds_bits'
23041 d_fgetpos='$d_fgetpos'
23042 d_finite='$d_finite'
23043 d_finitel='$d_finitel'
23044 d_flexfnam='$d_flexfnam'
23045 d_flock='$d_flock'
23046 d_flockproto='$d_flockproto'
23047 d_fork='$d_fork'
23048 d_fp_class='$d_fp_class'
23049 d_fpathconf='$d_fpathconf'
23050 d_fpclass='$d_fpclass'
23051 d_fpclassify='$d_fpclassify'
23052 d_fpclassl='$d_fpclassl'
23053 d_fpos64_t='$d_fpos64_t'
23054 d_frexpl='$d_frexpl'
23055 d_fs_data_s='$d_fs_data_s'
23056 d_fseeko='$d_fseeko'
23057 d_fsetpos='$d_fsetpos'
23058 d_fstatfs='$d_fstatfs'
23059 d_fstatvfs='$d_fstatvfs'
23060 d_fsync='$d_fsync'
23061 d_ftello='$d_ftello'
23062 d_ftime='$d_ftime'
23063 d_futimes='$d_futimes'
23064 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23065 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23066 d_getaddrinfo='$d_getaddrinfo'
23067 d_getcwd='$d_getcwd'
23068 d_getespwnam='$d_getespwnam'
23069 d_getfsstat='$d_getfsstat'
23070 d_getgrent='$d_getgrent'
23071 d_getgrent_r='$d_getgrent_r'
23072 d_getgrgid_r='$d_getgrgid_r'
23073 d_getgrnam_r='$d_getgrnam_r'
23074 d_getgrps='$d_getgrps'
23075 d_gethbyaddr='$d_gethbyaddr'
23076 d_gethbyname='$d_gethbyname'
23077 d_gethent='$d_gethent'
23078 d_gethname='$d_gethname'
23079 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23080 d_gethostbyname_r='$d_gethostbyname_r'
23081 d_gethostent_r='$d_gethostent_r'
23082 d_gethostprotos='$d_gethostprotos'
23083 d_getitimer='$d_getitimer'
23084 d_getlogin='$d_getlogin'
23085 d_getlogin_r='$d_getlogin_r'
23086 d_getmnt='$d_getmnt'
23087 d_getmntent='$d_getmntent'
23088 d_getnameinfo='$d_getnameinfo'
23089 d_getnbyaddr='$d_getnbyaddr'
23090 d_getnbyname='$d_getnbyname'
23091 d_getnent='$d_getnent'
23092 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23093 d_getnetbyname_r='$d_getnetbyname_r'
23094 d_getnetent_r='$d_getnetent_r'
23095 d_getnetprotos='$d_getnetprotos'
23096 d_getpagsz='$d_getpagsz'
23097 d_getpbyname='$d_getpbyname'
23098 d_getpbynumber='$d_getpbynumber'
23099 d_getpent='$d_getpent'
23100 d_getpgid='$d_getpgid'
23101 d_getpgrp2='$d_getpgrp2'
23102 d_getpgrp='$d_getpgrp'
23103 d_getppid='$d_getppid'
23104 d_getprior='$d_getprior'
23105 d_getprotobyname_r='$d_getprotobyname_r'
23106 d_getprotobynumber_r='$d_getprotobynumber_r'
23107 d_getprotoent_r='$d_getprotoent_r'
23108 d_getprotoprotos='$d_getprotoprotos'
23109 d_getprpwnam='$d_getprpwnam'
23110 d_getpwent='$d_getpwent'
23111 d_getpwent_r='$d_getpwent_r'
23112 d_getpwnam_r='$d_getpwnam_r'
23113 d_getpwuid_r='$d_getpwuid_r'
23114 d_getsbyname='$d_getsbyname'
23115 d_getsbyport='$d_getsbyport'
23116 d_getsent='$d_getsent'
23117 d_getservbyname_r='$d_getservbyname_r'
23118 d_getservbyport_r='$d_getservbyport_r'
23119 d_getservent_r='$d_getservent_r'
23120 d_getservprotos='$d_getservprotos'
23121 d_getspnam='$d_getspnam'
23122 d_getspnam_r='$d_getspnam_r'
23123 d_gettimeod='$d_gettimeod'
23124 d_gmtime64='$d_gmtime64'
23125 d_gmtime_r='$d_gmtime_r'
23126 d_gnulibc='$d_gnulibc'
23127 d_grpasswd='$d_grpasswd'
23128 d_hasmntopt='$d_hasmntopt'
23129 d_htonl='$d_htonl'
23130 d_ilogbl='$d_ilogbl'
23131 d_inc_version_list='$d_inc_version_list'
23132 d_index='$d_index'
23133 d_inetaton='$d_inetaton'
23134 d_inetntop='$d_inetntop'
23135 d_inetpton='$d_inetpton'
23136 d_int64_t='$d_int64_t'
23137 d_ip_mreq='$d_ip_mreq'
23138 d_ip_mreq_source='$d_ip_mreq_source'
23139 d_ipv6_mreq='$d_ipv6_mreq'
23140 d_ipv6_mreq_source='$d_ipv6_mreq_source'
23141 d_isascii='$d_isascii'
23142 d_isblank='$d_isblank'
23143 d_isfinite='$d_isfinite'
23144 d_isinf='$d_isinf'
23145 d_isnan='$d_isnan'
23146 d_isnanl='$d_isnanl'
23147 d_killpg='$d_killpg'
23148 d_lchown='$d_lchown'
23149 d_ldbl_dig='$d_ldbl_dig'
23150 d_libm_lib_version='$d_libm_lib_version'
23151 d_link='$d_link'
23152 d_localtime64='$d_localtime64'
23153 d_localtime_r='$d_localtime_r'
23154 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
23155 d_locconv='$d_locconv'
23156 d_lockf='$d_lockf'
23157 d_longdbl='$d_longdbl'
23158 d_longlong='$d_longlong'
23159 d_lseekproto='$d_lseekproto'
23160 d_lstat='$d_lstat'
23161 d_madvise='$d_madvise'
23162 d_malloc_good_size='$d_malloc_good_size'
23163 d_malloc_size='$d_malloc_size'
23164 d_mblen='$d_mblen'
23165 d_mbstowcs='$d_mbstowcs'
23166 d_mbtowc='$d_mbtowc'
23167 d_memchr='$d_memchr'
23168 d_memcmp='$d_memcmp'
23169 d_memcpy='$d_memcpy'
23170 d_memmove='$d_memmove'
23171 d_memset='$d_memset'
23172 d_mkdir='$d_mkdir'
23173 d_mkdtemp='$d_mkdtemp'
23174 d_mkfifo='$d_mkfifo'
23175 d_mkstemp='$d_mkstemp'
23176 d_mkstemps='$d_mkstemps'
23177 d_mktime64='$d_mktime64'
23178 d_mktime='$d_mktime'
23179 d_mmap='$d_mmap'
23180 d_modfl='$d_modfl'
23181 d_modfl_pow32_bug='$d_modfl_pow32_bug'
23182 d_modflproto='$d_modflproto'
23183 d_mprotect='$d_mprotect'
23184 d_msg='$d_msg'
23185 d_msg_ctrunc='$d_msg_ctrunc'
23186 d_msg_dontroute='$d_msg_dontroute'
23187 d_msg_oob='$d_msg_oob'
23188 d_msg_peek='$d_msg_peek'
23189 d_msg_proxy='$d_msg_proxy'
23190 d_msgctl='$d_msgctl'
23191 d_msgget='$d_msgget'
23192 d_msghdr_s='$d_msghdr_s'
23193 d_msgrcv='$d_msgrcv'
23194 d_msgsnd='$d_msgsnd'
23195 d_msync='$d_msync'
23196 d_munmap='$d_munmap'
23197 d_mymalloc='$d_mymalloc'
23198 d_ndbm='$d_ndbm'
23199 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
23200 d_nice='$d_nice'
23201 d_nl_langinfo='$d_nl_langinfo'
23202 d_nv_preserves_uv='$d_nv_preserves_uv'
23203 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
23204 d_off64_t='$d_off64_t'
23205 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23206 d_oldpthreads='$d_oldpthreads'
23207 d_oldsock='$d_oldsock'
23208 d_open3='$d_open3'
23209 d_pathconf='$d_pathconf'
23210 d_pause='$d_pause'
23211 d_perl_otherlibdirs='$d_perl_otherlibdirs'
23212 d_phostname='$d_phostname'
23213 d_pipe='$d_pipe'
23214 d_poll='$d_poll'
23215 d_portable='$d_portable'
23216 d_prctl='$d_prctl'
23217 d_prctl_set_name='$d_prctl_set_name'
23218 d_printf_format_null='$d_printf_format_null'
23219 d_procselfexe='$d_procselfexe'
23220 d_pseudofork='$d_pseudofork'
23221 d_pthread_atfork='$d_pthread_atfork'
23222 d_pthread_attr_setscope='$d_pthread_attr_setscope'
23223 d_pthread_yield='$d_pthread_yield'
23224 d_pwage='$d_pwage'
23225 d_pwchange='$d_pwchange'
23226 d_pwclass='$d_pwclass'
23227 d_pwcomment='$d_pwcomment'
23228 d_pwexpire='$d_pwexpire'
23229 d_pwgecos='$d_pwgecos'
23230 d_pwpasswd='$d_pwpasswd'
23231 d_pwquota='$d_pwquota'
23232 d_qgcvt='$d_qgcvt'
23233 d_quad='$d_quad'
23234 d_random_r='$d_random_r'
23235 d_readdir64_r='$d_readdir64_r'
23236 d_readdir='$d_readdir'
23237 d_readdir_r='$d_readdir_r'
23238 d_readlink='$d_readlink'
23239 d_readv='$d_readv'
23240 d_recvmsg='$d_recvmsg'
23241 d_rename='$d_rename'
23242 d_rewinddir='$d_rewinddir'
23243 d_rmdir='$d_rmdir'
23244 d_safebcpy='$d_safebcpy'
23245 d_safemcpy='$d_safemcpy'
23246 d_sanemcmp='$d_sanemcmp'
23247 d_sbrkproto='$d_sbrkproto'
23248 d_scalbnl='$d_scalbnl'
23249 d_sched_yield='$d_sched_yield'
23250 d_scm_rights='$d_scm_rights'
23251 d_seekdir='$d_seekdir'
23252 d_select='$d_select'
23253 d_sem='$d_sem'
23254 d_semctl='$d_semctl'
23255 d_semctl_semid_ds='$d_semctl_semid_ds'
23256 d_semctl_semun='$d_semctl_semun'
23257 d_semget='$d_semget'
23258 d_semop='$d_semop'
23259 d_sendmsg='$d_sendmsg'
23260 d_setegid='$d_setegid'
23261 d_seteuid='$d_seteuid'
23262 d_setgrent='$d_setgrent'
23263 d_setgrent_r='$d_setgrent_r'
23264 d_setgrps='$d_setgrps'
23265 d_sethent='$d_sethent'
23266 d_sethostent_r='$d_sethostent_r'
23267 d_setitimer='$d_setitimer'
23268 d_setlinebuf='$d_setlinebuf'
23269 d_setlocale='$d_setlocale'
23270 d_setlocale_r='$d_setlocale_r'
23271 d_setnent='$d_setnent'
23272 d_setnetent_r='$d_setnetent_r'
23273 d_setpent='$d_setpent'
23274 d_setpgid='$d_setpgid'
23275 d_setpgrp2='$d_setpgrp2'
23276 d_setpgrp='$d_setpgrp'
23277 d_setprior='$d_setprior'
23278 d_setproctitle='$d_setproctitle'
23279 d_setprotoent_r='$d_setprotoent_r'
23280 d_setpwent='$d_setpwent'
23281 d_setpwent_r='$d_setpwent_r'
23282 d_setregid='$d_setregid'
23283 d_setresgid='$d_setresgid'
23284 d_setresuid='$d_setresuid'
23285 d_setreuid='$d_setreuid'
23286 d_setrgid='$d_setrgid'
23287 d_setruid='$d_setruid'
23288 d_setsent='$d_setsent'
23289 d_setservent_r='$d_setservent_r'
23290 d_setsid='$d_setsid'
23291 d_setvbuf='$d_setvbuf'
23292 d_sfio='$d_sfio'
23293 d_shm='$d_shm'
23294 d_shmat='$d_shmat'
23295 d_shmatprototype='$d_shmatprototype'
23296 d_shmctl='$d_shmctl'
23297 d_shmdt='$d_shmdt'
23298 d_shmget='$d_shmget'
23299 d_sigaction='$d_sigaction'
23300 d_signbit='$d_signbit'
23301 d_sigprocmask='$d_sigprocmask'
23302 d_sigsetjmp='$d_sigsetjmp'
23303 d_sin6_scope_id='$d_sin6_scope_id'
23304 d_sitearch='$d_sitearch'
23305 d_snprintf='$d_snprintf'
23306 d_sockaddr_in6='$d_sockaddr_in6'
23307 d_sockaddr_sa_len='$d_sockaddr_sa_len'
23308 d_sockatmark='$d_sockatmark'
23309 d_sockatmarkproto='$d_sockatmarkproto'
23310 d_socket='$d_socket'
23311 d_socklen_t='$d_socklen_t'
23312 d_sockpair='$d_sockpair'
23313 d_socks5_init='$d_socks5_init'
23314 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23315 d_sqrtl='$d_sqrtl'
23316 d_srand48_r='$d_srand48_r'
23317 d_srandom_r='$d_srandom_r'
23318 d_sresgproto='$d_sresgproto'
23319 d_sresuproto='$d_sresuproto'
23320 d_statblks='$d_statblks'
23321 d_statfs_f_flags='$d_statfs_f_flags'
23322 d_statfs_s='$d_statfs_s'
23323 d_static_inline='$d_static_inline'
23324 d_statvfs='$d_statvfs'
23325 d_stdio_cnt_lval='$d_stdio_cnt_lval'
23326 d_stdio_ptr_lval='$d_stdio_ptr_lval'
23327 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23328 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23329 d_stdio_stream_array='$d_stdio_stream_array'
23330 d_stdiobase='$d_stdiobase'
23331 d_stdstdio='$d_stdstdio'
23332 d_strchr='$d_strchr'
23333 d_strcoll='$d_strcoll'
23334 d_strctcpy='$d_strctcpy'
23335 d_strerrm='$d_strerrm'
23336 d_strerror='$d_strerror'
23337 d_strerror_r='$d_strerror_r'
23338 d_strftime='$d_strftime'
23339 d_strlcat='$d_strlcat'
23340 d_strlcpy='$d_strlcpy'
23341 d_strtod='$d_strtod'
23342 d_strtol='$d_strtol'
23343 d_strtold='$d_strtold'
23344 d_strtoll='$d_strtoll'
23345 d_strtoq='$d_strtoq'
23346 d_strtoul='$d_strtoul'
23347 d_strtoull='$d_strtoull'
23348 d_strtouq='$d_strtouq'
23349 d_strxfrm='$d_strxfrm'
23350 d_suidsafe='$d_suidsafe'
23351 d_symlink='$d_symlink'
23352 d_syscall='$d_syscall'
23353 d_syscallproto='$d_syscallproto'
23354 d_sysconf='$d_sysconf'
23355 d_sysernlst='$d_sysernlst'
23356 d_syserrlst='$d_syserrlst'
23357 d_system='$d_system'
23358 d_tcgetpgrp='$d_tcgetpgrp'
23359 d_tcsetpgrp='$d_tcsetpgrp'
23360 d_telldir='$d_telldir'
23361 d_telldirproto='$d_telldirproto'
23362 d_time='$d_time'
23363 d_timegm='$d_timegm'
23364 d_times='$d_times'
23365 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23366 d_tm_tm_zone='$d_tm_tm_zone'
23367 d_tmpnam_r='$d_tmpnam_r'
23368 d_truncate='$d_truncate'
23369 d_ttyname_r='$d_ttyname_r'
23370 d_tzname='$d_tzname'
23371 d_u32align='$d_u32align'
23372 d_ualarm='$d_ualarm'
23373 d_umask='$d_umask'
23374 d_uname='$d_uname'
23375 d_union_semun='$d_union_semun'
23376 d_unordered='$d_unordered'
23377 d_unsetenv='$d_unsetenv'
23378 d_usleep='$d_usleep'
23379 d_usleepproto='$d_usleepproto'
23380 d_ustat='$d_ustat'
23381 d_vendorarch='$d_vendorarch'
23382 d_vendorbin='$d_vendorbin'
23383 d_vendorlib='$d_vendorlib'
23384 d_vendorscript='$d_vendorscript'
23385 d_vfork='$d_vfork'
23386 d_void_closedir='$d_void_closedir'
23387 d_voidsig='$d_voidsig'
23388 d_voidtty='$d_voidtty'
23389 d_volatile='$d_volatile'
23390 d_vprintf='$d_vprintf'
23391 d_vsnprintf='$d_vsnprintf'
23392 d_wait4='$d_wait4'
23393 d_waitpid='$d_waitpid'
23394 d_wcstombs='$d_wcstombs'
23395 d_wctomb='$d_wctomb'
23396 d_writev='$d_writev'
23397 d_xenix='$d_xenix'
23398 date='$date'
23399 db_hashtype='$db_hashtype'
23400 db_prefixtype='$db_prefixtype'
23401 db_version_major='$db_version_major'
23402 db_version_minor='$db_version_minor'
23403 db_version_patch='$db_version_patch'
23404 defvoidused='$defvoidused'
23405 direntrytype='$direntrytype'
23406 dlext='$dlext'
23407 dlsrc='$dlsrc'
23408 doublesize='$doublesize'
23409 drand01='$drand01'
23410 drand48_r_proto='$drand48_r_proto'
23411 dtrace='$dtrace'
23412 dynamic_ext='$dynamic_ext'
23413 eagain='$eagain'
23414 ebcdic='$ebcdic'
23415 echo='$echo'
23416 egrep='$egrep'
23417 emacs='$emacs'
23418 endgrent_r_proto='$endgrent_r_proto'
23419 endhostent_r_proto='$endhostent_r_proto'
23420 endnetent_r_proto='$endnetent_r_proto'
23421 endprotoent_r_proto='$endprotoent_r_proto'
23422 endpwent_r_proto='$endpwent_r_proto'
23423 endservent_r_proto='$endservent_r_proto'
23424 eunicefix='$eunicefix'
23425 exe_ext='$exe_ext'
23426 expr='$expr'
23427 extensions='$extensions'
23428 extern_C='$extern_C'
23429 extras='$extras'
23430 fflushNULL='$fflushNULL'
23431 fflushall='$fflushall'
23432 find='$find'
23433 firstmakefile='$firstmakefile'
23434 flex='$flex'
23435 fpossize='$fpossize'
23436 fpostype='$fpostype'
23437 freetype='$freetype'
23438 from='$from'
23439 full_ar='$full_ar'
23440 full_csh='$full_csh'
23441 full_sed='$full_sed'
23442 gccansipedantic='$gccansipedantic'
23443 gccosandvers='$gccosandvers'
23444 gccversion='$gccversion'
23445 getgrent_r_proto='$getgrent_r_proto'
23446 getgrgid_r_proto='$getgrgid_r_proto'
23447 getgrnam_r_proto='$getgrnam_r_proto'
23448 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23449 gethostbyname_r_proto='$gethostbyname_r_proto'
23450 gethostent_r_proto='$gethostent_r_proto'
23451 getlogin_r_proto='$getlogin_r_proto'
23452 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23453 getnetbyname_r_proto='$getnetbyname_r_proto'
23454 getnetent_r_proto='$getnetent_r_proto'
23455 getprotobyname_r_proto='$getprotobyname_r_proto'
23456 getprotobynumber_r_proto='$getprotobynumber_r_proto'
23457 getprotoent_r_proto='$getprotoent_r_proto'
23458 getpwent_r_proto='$getpwent_r_proto'
23459 getpwnam_r_proto='$getpwnam_r_proto'
23460 getpwuid_r_proto='$getpwuid_r_proto'
23461 getservbyname_r_proto='$getservbyname_r_proto'
23462 getservbyport_r_proto='$getservbyport_r_proto'
23463 getservent_r_proto='$getservent_r_proto'
23464 getspnam_r_proto='$getspnam_r_proto'
23465 gidformat='$gidformat'
23466 gidsign='$gidsign'
23467 gidsize='$gidsize'
23468 gidtype='$gidtype'
23469 glibpth='$glibpth'
23470 gmake='$gmake'
23471 gmtime_r_proto='$gmtime_r_proto'
23472 gnulibc_version='$gnulibc_version'
23473 grep='$grep'
23474 groupcat='$groupcat'
23475 groupstype='$groupstype'
23476 gzip='$gzip'
23477 h_fcntl='$h_fcntl'
23478 h_sysfile='$h_sysfile'
23479 hint='$hint'
23480 hostcat='$hostcat'
23481 html1dir='$html1dir'
23482 html1direxp='$html1direxp'
23483 html3dir='$html3dir'
23484 html3direxp='$html3direxp'
23485 i16size='$i16size'
23486 i16type='$i16type'
23487 i32size='$i32size'
23488 i32type='$i32type'
23489 i64size='$i64size'
23490 i64type='$i64type'
23491 i8size='$i8size'
23492 i8type='$i8type'
23493 i_arpainet='$i_arpainet'
23494 i_assert='$i_assert'
23495 i_bsdioctl='$i_bsdioctl'
23496 i_crypt='$i_crypt'
23497 i_db='$i_db'
23498 i_dbm='$i_dbm'
23499 i_dirent='$i_dirent'
23500 i_dld='$i_dld'
23501 i_dlfcn='$i_dlfcn'
23502 i_fcntl='$i_fcntl'
23503 i_float='$i_float'
23504 i_fp='$i_fp'
23505 i_fp_class='$i_fp_class'
23506 i_gdbm='$i_gdbm'
23507 i_gdbm_ndbm='$i_gdbm_ndbm'
23508 i_gdbmndbm='$i_gdbmndbm'
23509 i_grp='$i_grp'
23510 i_ieeefp='$i_ieeefp'
23511 i_inttypes='$i_inttypes'
23512 i_langinfo='$i_langinfo'
23513 i_libutil='$i_libutil'
23514 i_limits='$i_limits'
23515 i_locale='$i_locale'
23516 i_machcthr='$i_machcthr'
23517 i_malloc='$i_malloc'
23518 i_mallocmalloc='$i_mallocmalloc'
23519 i_math='$i_math'
23520 i_memory='$i_memory'
23521 i_mntent='$i_mntent'
23522 i_ndbm='$i_ndbm'
23523 i_netdb='$i_netdb'
23524 i_neterrno='$i_neterrno'
23525 i_netinettcp='$i_netinettcp'
23526 i_niin='$i_niin'
23527 i_poll='$i_poll'
23528 i_prot='$i_prot'
23529 i_pthread='$i_pthread'
23530 i_pwd='$i_pwd'
23531 i_rpcsvcdbm='$i_rpcsvcdbm'
23532 i_sfio='$i_sfio'
23533 i_sgtty='$i_sgtty'
23534 i_shadow='$i_shadow'
23535 i_socks='$i_socks'
23536 i_stdarg='$i_stdarg'
23537 i_stdbool='$i_stdbool'
23538 i_stddef='$i_stddef'
23539 i_stdlib='$i_stdlib'
23540 i_string='$i_string'
23541 i_sunmath='$i_sunmath'
23542 i_sysaccess='$i_sysaccess'
23543 i_sysdir='$i_sysdir'
23544 i_sysfile='$i_sysfile'
23545 i_sysfilio='$i_sysfilio'
23546 i_sysin='$i_sysin'
23547 i_sysioctl='$i_sysioctl'
23548 i_syslog='$i_syslog'
23549 i_sysmman='$i_sysmman'
23550 i_sysmode='$i_sysmode'
23551 i_sysmount='$i_sysmount'
23552 i_sysndir='$i_sysndir'
23553 i_sysparam='$i_sysparam'
23554 i_syspoll='$i_syspoll'
23555 i_sysresrc='$i_sysresrc'
23556 i_syssecrt='$i_syssecrt'
23557 i_sysselct='$i_sysselct'
23558 i_syssockio='$i_syssockio'
23559 i_sysstat='$i_sysstat'
23560 i_sysstatfs='$i_sysstatfs'
23561 i_sysstatvfs='$i_sysstatvfs'
23562 i_systime='$i_systime'
23563 i_systimek='$i_systimek'
23564 i_systimes='$i_systimes'
23565 i_systypes='$i_systypes'
23566 i_sysuio='$i_sysuio'
23567 i_sysun='$i_sysun'
23568 i_sysutsname='$i_sysutsname'
23569 i_sysvfs='$i_sysvfs'
23570 i_syswait='$i_syswait'
23571 i_termio='$i_termio'
23572 i_termios='$i_termios'
23573 i_time='$i_time'
23574 i_unistd='$i_unistd'
23575 i_ustat='$i_ustat'
23576 i_utime='$i_utime'
23577 i_values='$i_values'
23578 i_varargs='$i_varargs'
23579 i_varhdr='$i_varhdr'
23580 i_vfork='$i_vfork'
23581 ignore_versioned_solibs='$ignore_versioned_solibs'
23582 inc_version_list='$inc_version_list'
23583 inc_version_list_init='$inc_version_list_init'
23584 incpath='$incpath'
23585 inews='$inews'
23586 initialinstalllocation='$initialinstalllocation'
23587 installarchlib='$installarchlib'
23588 installbin='$installbin'
23589 installhtml1dir='$installhtml1dir'
23590 installhtml3dir='$installhtml3dir'
23591 installman1dir='$installman1dir'
23592 installman3dir='$installman3dir'
23593 installprefix='$installprefix'
23594 installprefixexp='$installprefixexp'
23595 installprivlib='$installprivlib'
23596 installscript='$installscript'
23597 installsitearch='$installsitearch'
23598 installsitebin='$installsitebin'
23599 installsitehtml1dir='$installsitehtml1dir'
23600 installsitehtml3dir='$installsitehtml3dir'
23601 installsitelib='$installsitelib'
23602 installsiteman1dir='$installsiteman1dir'
23603 installsiteman3dir='$installsiteman3dir'
23604 installsitescript='$installsitescript'
23605 installstyle='$installstyle'
23606 installusrbinperl='$installusrbinperl'
23607 installvendorarch='$installvendorarch'
23608 installvendorbin='$installvendorbin'
23609 installvendorhtml1dir='$installvendorhtml1dir'
23610 installvendorhtml3dir='$installvendorhtml3dir'
23611 installvendorlib='$installvendorlib'
23612 installvendorman1dir='$installvendorman1dir'
23613 installvendorman3dir='$installvendorman3dir'
23614 installvendorscript='$installvendorscript'
23615 intsize='$intsize'
23616 issymlink='$issymlink'
23617 ivdformat='$ivdformat'
23618 ivsize='$ivsize'
23619 ivtype='$ivtype'
23620 known_extensions='$known_extensions'
23621 ksh='$ksh'
23622 ld='$ld'
23623 ld_can_script='$ld_can_script'
23624 lddlflags='$lddlflags'
23625 ldflags='$ldflags'
23626 ldflags_uselargefiles='$ldflags_uselargefiles'
23627 ldlibpthname='$ldlibpthname'
23628 less='$less'
23629 lib_ext='$lib_ext'
23630 libc='$libc'
23631 libperl='$libperl'
23632 libpth='$libpth'
23633 libs='$libs'
23634 libsdirs='$libsdirs'
23635 libsfiles='$libsfiles'
23636 libsfound='$libsfound'
23637 libspath='$libspath'
23638 libswanted='$libswanted'
23639 libswanted_uselargefiles='$libswanted_uselargefiles'
23640 line='$line'
23641 lint='$lint'
23642 lkflags='$lkflags'
23643 ln='$ln'
23644 lns='$lns'
23645 localtime_r_proto='$localtime_r_proto'
23646 locincpth='$locincpth'
23647 loclibpth='$loclibpth'
23648 longdblsize='$longdblsize'
23649 longlongsize='$longlongsize'
23650 longsize='$longsize'
23651 lp='$lp'
23652 lpr='$lpr'
23653 ls='$ls'
23654 lseeksize='$lseeksize'
23655 lseektype='$lseektype'
23656 mad='$mad'
23657 madlyh='$madlyh'
23658 madlyobj='$madlyobj'
23659 madlysrc='$madlysrc'
23660 mail='$mail'
23661 mailx='$mailx'
23662 make='$make'
23663 make_set_make='$make_set_make'
23664 mallocobj='$mallocobj'
23665 mallocsrc='$mallocsrc'
23666 malloctype='$malloctype'
23667 man1dir='$man1dir'
23668 man1direxp='$man1direxp'
23669 man1ext='$man1ext'
23670 man3dir='$man3dir'
23671 man3direxp='$man3direxp'
23672 man3ext='$man3ext'
23673 mips_type='$mips_type'
23674 mistrustnm='$mistrustnm'
23675 mkdir='$mkdir'
23676 mmaptype='$mmaptype'
23677 modetype='$modetype'
23678 more='$more'
23679 multiarch='$multiarch'
23680 mv='$mv'
23681 myarchname='$myarchname'
23682 mydomain='$mydomain'
23683 myhostname='$myhostname'
23684 myuname='$myuname'
23685 n='$n'
23686 need_va_copy='$need_va_copy'
23687 netdb_hlen_type='$netdb_hlen_type'
23688 netdb_host_type='$netdb_host_type'
23689 netdb_name_type='$netdb_name_type'
23690 netdb_net_type='$netdb_net_type'
23691 nm='$nm'
23692 nm_opt='$nm_opt'
23693 nm_so_opt='$nm_so_opt'
23694 nonxs_ext='$nonxs_ext'
23695 nroff='$nroff'
23696 nvEUformat='$nvEUformat'
23697 nvFUformat='$nvFUformat'
23698 nvGUformat='$nvGUformat'
23699 nv_overflows_integers_at='$nv_overflows_integers_at'
23700 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23701 nveformat='$nveformat'
23702 nvfformat='$nvfformat'
23703 nvgformat='$nvgformat'
23704 nvsize='$nvsize'
23705 nvtype='$nvtype'
23706 o_nonblock='$o_nonblock'
23707 obj_ext='$obj_ext'
23708 old_pthread_create_joinable='$old_pthread_create_joinable'
23709 optimize='$optimize'
23710 orderlib='$orderlib'
23711 osname='$osname'
23712 osvers='$osvers'
23713 otherlibdirs='$otherlibdirs'
23714 package='$package'
23715 pager='$pager'
23716 passcat='$passcat'
23717 patchlevel='$patchlevel'
23718 path_sep='$path_sep'
23719 perl5='$perl5'
23720 perl='$perl'
23721 perl_patchlevel='$perl_patchlevel'
23722 perl_static_inline='$perl_static_inline'
23723 perladmin='$perladmin'
23724 perllibs='$perllibs'
23725 perlpath='$perlpath'
23726 pg='$pg'
23727 phostname='$phostname'
23728 pidtype='$pidtype'
23729 plibpth='$plibpth'
23730 pmake='$pmake'
23731 pr='$pr'
23732 prefix='$prefix'
23733 prefixexp='$prefixexp'
23734 privlib='$privlib'
23735 privlibexp='$privlibexp'
23736 procselfexe='$procselfexe'
23737 prototype='$prototype'
23738 ptrsize='$ptrsize'
23739 quadkind='$quadkind'
23740 quadtype='$quadtype'
23741 randbits='$randbits'
23742 randfunc='$randfunc'
23743 random_r_proto='$random_r_proto'
23744 randseedtype='$randseedtype'
23745 ranlib='$ranlib'
23746 rd_nodata='$rd_nodata'
23747 readdir64_r_proto='$readdir64_r_proto'
23748 readdir_r_proto='$readdir_r_proto'
23749 revision='$revision'
23750 rm='$rm'
23751 rm_try='$rm_try'
23752 rmail='$rmail'
23753 run='$run'
23754 runnm='$runnm'
23755 sGMTIME_max='$sGMTIME_max'
23756 sGMTIME_min='$sGMTIME_min'
23757 sLOCALTIME_max='$sLOCALTIME_max'
23758 sLOCALTIME_min='$sLOCALTIME_min'
23759 sPRIEUldbl='$sPRIEUldbl'
23760 sPRIFUldbl='$sPRIFUldbl'
23761 sPRIGUldbl='$sPRIGUldbl'
23762 sPRIXU64='$sPRIXU64'
23763 sPRId64='$sPRId64'
23764 sPRIeldbl='$sPRIeldbl'
23765 sPRIfldbl='$sPRIfldbl'
23766 sPRIgldbl='$sPRIgldbl'
23767 sPRIi64='$sPRIi64'
23768 sPRIo64='$sPRIo64'
23769 sPRIu64='$sPRIu64'
23770 sPRIx64='$sPRIx64'
23771 sSCNfldbl='$sSCNfldbl'
23772 sched_yield='$sched_yield'
23773 scriptdir='$scriptdir'
23774 scriptdirexp='$scriptdirexp'
23775 sed='$sed'
23776 seedfunc='$seedfunc'
23777 selectminbits='$selectminbits'
23778 selecttype='$selecttype'
23779 sendmail='$sendmail'
23780 setgrent_r_proto='$setgrent_r_proto'
23781 sethostent_r_proto='$sethostent_r_proto'
23782 setlocale_r_proto='$setlocale_r_proto'
23783 setnetent_r_proto='$setnetent_r_proto'
23784 setprotoent_r_proto='$setprotoent_r_proto'
23785 setpwent_r_proto='$setpwent_r_proto'
23786 setservent_r_proto='$setservent_r_proto'
23787 sh='$sh'
23788 shar='$shar'
23789 sharpbang='$sharpbang'
23790 shmattype='$shmattype'
23791 shortsize='$shortsize'
23792 shrpenv='$shrpenv'
23793 shsharp='$shsharp'
23794 sig_count='$sig_count'
23795 sig_name='$sig_name'
23796 sig_name_init='$sig_name_init'
23797 sig_num='$sig_num'
23798 sig_num_init='$sig_num_init'
23799 sig_size='$sig_size'
23800 signal_t='$signal_t'
23801 sitearch='$sitearch'
23802 sitearchexp='$sitearchexp'
23803 sitebin='$sitebin'
23804 sitebinexp='$sitebinexp'
23805 sitehtml1dir='$sitehtml1dir'
23806 sitehtml1direxp='$sitehtml1direxp'
23807 sitehtml3dir='$sitehtml3dir'
23808 sitehtml3direxp='$sitehtml3direxp'
23809 sitelib='$sitelib'
23810 sitelib_stem='$sitelib_stem'
23811 sitelibexp='$sitelibexp'
23812 siteman1dir='$siteman1dir'
23813 siteman1direxp='$siteman1direxp'
23814 siteman3dir='$siteman3dir'
23815 siteman3direxp='$siteman3direxp'
23816 siteprefix='$siteprefix'
23817 siteprefixexp='$siteprefixexp'
23818 sitescript='$sitescript'
23819 sitescriptexp='$sitescriptexp'
23820 sizesize='$sizesize'
23821 sizetype='$sizetype'
23822 sleep='$sleep'
23823 smail='$smail'
23824 so='$so'
23825 sockethdr='$sockethdr'
23826 socketlib='$socketlib'
23827 socksizetype='$socksizetype'
23828 sort='$sort'
23829 spackage='$spackage'
23830 spitshell='$spitshell'
23831 srand48_r_proto='$srand48_r_proto'
23832 srandom_r_proto='$srandom_r_proto'
23833 src='$src'
23834 ssizetype='$ssizetype'
23835 st_ino_sign='$st_ino_sign'
23836 st_ino_size='$st_ino_size'
23837 startperl='$startperl'
23838 startsh='$startsh'
23839 static_ext='$static_ext'
23840 stdchar='$stdchar'
23841 stdio_base='$stdio_base'
23842 stdio_bufsiz='$stdio_bufsiz'
23843 stdio_cnt='$stdio_cnt'
23844 stdio_filbuf='$stdio_filbuf'
23845 stdio_ptr='$stdio_ptr'
23846 stdio_stream_array='$stdio_stream_array'
23847 strerror_r_proto='$strerror_r_proto'
23848 strings='$strings'
23849 submit='$submit'
23850 subversion='$subversion'
23851 sysman='$sysman'
23852 tail='$tail'
23853 tar='$tar'
23854 targetarch='$targetarch'
23855 tbl='$tbl'
23856 tee='$tee'
23857 test='$test'
23858 timeincl='$timeincl'
23859 timetype='$timetype'
23860 tmpnam_r_proto='$tmpnam_r_proto'
23861 to='$to'
23862 touch='$touch'
23863 tr='$tr'
23864 trnl='$trnl'
23865 troff='$troff'
23866 ttyname_r_proto='$ttyname_r_proto'
23867 u16size='$u16size'
23868 u16type='$u16type'
23869 u32size='$u32size'
23870 u32type='$u32type'
23871 u64size='$u64size'
23872 u64type='$u64type'
23873 u8size='$u8size'
23874 u8type='$u8type'
23875 uidformat='$uidformat'
23876 uidsign='$uidsign'
23877 uidsize='$uidsize'
23878 uidtype='$uidtype'
23879 uname='$uname'
23880 uniq='$uniq'
23881 uquadtype='$uquadtype'
23882 use5005threads='$use5005threads'
23883 use64bitall='$use64bitall'
23884 use64bitint='$use64bitint'
23885 usecrosscompile='$usecrosscompile'
23886 usedevel='$usedevel'
23887 usedl='$usedl'
23888 usedtrace='$usedtrace'
23889 usefaststdio='$usefaststdio'
23890 useithreads='$useithreads'
23891 usekernprocpathname='$usekernprocpathname'
23892 uselargefiles='$uselargefiles'
23893 uselongdouble='$uselongdouble'
23894 usemallocwrap='$usemallocwrap'
23895 usemorebits='$usemorebits'
23896 usemultiplicity='$usemultiplicity'
23897 usemymalloc='$usemymalloc'
23898 usenm='$usenm'
23899 usensgetexecutablepath='$usensgetexecutablepath'
23900 useopcode='$useopcode'
23901 useperlio='$useperlio'
23902 useposix='$useposix'
23903 usereentrant='$usereentrant'
23904 userelocatableinc='$userelocatableinc'
23905 usesfio='$usesfio'
23906 useshrplib='$useshrplib'
23907 usesitecustomize='$usesitecustomize'
23908 usesocks='$usesocks'
23909 usethreads='$usethreads'
23910 usevendorprefix='$usevendorprefix'
23911 useversionedarchname='$useversionedarchname'
23912 usevfork='$usevfork'
23913 usrinc='$usrinc'
23914 uuname='$uuname'
23915 uvXUformat='$uvXUformat'
23916 uvoformat='$uvoformat'
23917 uvsize='$uvsize'
23918 uvtype='$uvtype'
23919 uvuformat='$uvuformat'
23920 uvxformat='$uvxformat'
23921 vaproto='$vaproto'
23922 vendorarch='$vendorarch'
23923 vendorarchexp='$vendorarchexp'
23924 vendorbin='$vendorbin'
23925 vendorbinexp='$vendorbinexp'
23926 vendorhtml1dir='$vendorhtml1dir'
23927 vendorhtml1direxp='$vendorhtml1direxp'
23928 vendorhtml3dir='$vendorhtml3dir'
23929 vendorhtml3direxp='$vendorhtml3direxp'
23930 vendorlib='$vendorlib'
23931 vendorlib_stem='$vendorlib_stem'
23932 vendorlibexp='$vendorlibexp'
23933 vendorman1dir='$vendorman1dir'
23934 vendorman1direxp='$vendorman1direxp'
23935 vendorman3dir='$vendorman3dir'
23936 vendorman3direxp='$vendorman3direxp'
23937 vendorprefix='$vendorprefix'
23938 vendorprefixexp='$vendorprefixexp'
23939 vendorscript='$vendorscript'
23940 vendorscriptexp='$vendorscriptexp'
23941 version='$version'
23942 version_patchlevel_string='$version_patchlevel_string'
23943 versiononly='$versiononly'
23944 vi='$vi'
23945 voidflags='$voidflags'
23946 xlibpth='$xlibpth'
23947 yacc='$yacc'
23948 yaccflags='$yaccflags'
23949 zcat='$zcat'
23950 zip='$zip'
23951 EOT
23952
23953 : add special variables
23954 $test -f $src/patchlevel.h && \
23955 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23956 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23957 echo "PERL_CONFIG_SH=true" >>config.sh
23958
23959 : propagate old symbols
23960 if $test -f UU/config.sh; then
23961         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23962         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23963                 config.sh config.sh UU/oldconfig.sh |\
23964                 $sort | $uniq -u >UU/oldsyms
23965         set X `$cat UU/oldsyms`
23966         shift
23967         case $# in
23968         0) ;;
23969         *)
23970                 $cat <<EOM
23971 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23972 EOM
23973                 echo ": Variables propagated from previous config.sh file." >>config.sh
23974                 for sym in `$cat UU/oldsyms`; do
23975                         echo "    Propagating $hint variable "'$'"$sym..."
23976                         eval 'tmp="$'"${sym}"'"'
23977                         echo "$tmp" | \
23978                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23979                 done
23980                 ;;
23981         esac
23982 fi
23983
23984 : Finish up by extracting the .SH files
23985 case "$alldone" in
23986 exit)
23987         $rm -rf UU
23988         echo "Extraction done."
23989         exit 0
23990         ;;
23991 cont)
23992         ;;
23993 '')
23994         dflt=''
23995         nostick=true
23996         $cat <<EOM
23997
23998 If you'd like to make any changes to the config.sh file before I begin
23999 to configure things, do it as a shell escape now (e.g. !vi config.sh).
24000
24001 EOM
24002         rp="Press return or use a shell escape to edit config.sh:"
24003         . UU/myread
24004         nostick=''
24005         case "$ans" in
24006         '') ;;
24007         *) : in case they cannot read
24008                 sh 1>&4 -c "$ans";;
24009         esac
24010         ;;
24011 esac
24012
24013 : if this fails, just run all the .SH files by hand
24014 . ./config.sh
24015
24016 echo " "
24017 exec 1>&4
24018 pwd=`pwd`
24019 . ./UU/extract
24020 cd "$pwd"
24021
24022 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24023         dflt=y
24024         case "$silent" in
24025         true) ;;
24026         *)
24027                 $cat <<EOM
24028
24029 Now you need to generate make dependencies by running "$make depend".
24030 You might prefer to run it in background: "$make depend > makedepend.out &"
24031 It can take a while, so you might not want to run it right now.
24032
24033 EOM
24034                 ;;
24035         esac
24036         rp="Run $make depend now?"
24037         . UU/myread
24038         case "$ans" in
24039         y*)
24040                 $make depend && echo "Now you must run '$make'."
24041                 ;;
24042         *)
24043                 echo "You must run '$make depend' then '$make'."
24044                 ;;
24045         esac
24046 elif test -f [Mm]akefile; then
24047         echo " "
24048         echo "Now you must run a $make."
24049 else
24050         echo "Configure done."
24051 fi
24052
24053 if $test -f Policy.sh; then
24054     $cat <<EOM
24055
24056 If you compile $package on a different machine or from a different object
24057 directory, copy the Policy.sh file from this object directory to the
24058 new one before you run Configure -- this will help you with most of
24059 the policy defaults.
24060
24061 EOM
24062 fi
24063 if $test -f config.msg; then
24064     echo "Hmm.  I also noted the following information while running:"
24065     echo " "
24066     $cat config.msg >&4
24067     $rm -f config.msg
24068 fi
24069 $rm -f kit*isdone ark*isdone
24070 $rm -rf UU
24071
24072 : End of Configure
24073